@atlaskit/media-card 71.0.0 → 73.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/dist/cjs/actions.js +2 -2
- package/dist/cjs/errors.js +83 -8
- package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
- package/dist/cjs/files/cardImageView/index.js +53 -104
- package/dist/cjs/files/cardImageView/styled.js +1 -1
- package/dist/cjs/files/index.js +0 -6
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/root/card/cardAnalytics.js +4 -16
- package/dist/cjs/root/card/cardLoader.js +66 -124
- package/dist/cjs/root/card/cardState.js +50 -0
- package/dist/cjs/root/card/getCardPreview/cache.js +10 -5
- package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +53 -0
- package/dist/cjs/root/card/getCardPreview/helpers.js +14 -22
- package/dist/cjs/root/card/getCardPreview/index.js +177 -97
- package/dist/cjs/root/card/getCardStatus.js +7 -1
- package/dist/cjs/root/card/index.js +384 -285
- package/dist/cjs/root/cardView.js +113 -88
- package/dist/cjs/root/inline/loader.js +47 -15
- package/dist/cjs/root/inline/mediaInlineCard.js +33 -12
- package/dist/cjs/root/inlinePlayer.js +77 -24
- package/dist/cjs/root/styled.js +7 -3
- package/dist/cjs/root/ui/actionsBar/styled.js +1 -1
- package/dist/cjs/root/ui/blanket/styled.js +1 -1
- package/dist/cjs/root/ui/common.js +11 -5
- package/dist/cjs/root/ui/iconMessage/index.js +16 -7
- package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +47 -123
- package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +6 -4
- package/dist/cjs/root/ui/loadingRateLimited/styled.js +2 -2
- package/dist/cjs/root/ui/playButton/styled.js +1 -1
- package/dist/cjs/root/ui/progressBar/progressBar.js +7 -4
- package/dist/cjs/root/ui/progressBar/styled.js +8 -9
- package/dist/cjs/root/ui/styled.js +80 -17
- package/dist/cjs/root/ui/tickBox/styled.js +1 -1
- package/dist/cjs/root/ui/titleBox/failedTitleBox.js +9 -3
- package/dist/cjs/root/ui/titleBox/styled.js +2 -4
- package/dist/cjs/root/ui/titleBox/titleBox.js +2 -2
- package/dist/cjs/styles/index.js +25 -23
- package/dist/cjs/styles/mixins.js +1 -1
- package/dist/cjs/utils/analytics.js +7 -44
- package/dist/cjs/utils/breakpoint.js +1 -1
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +18 -9
- package/dist/cjs/utils/cardActions/index.js +10 -10
- package/dist/cjs/utils/cardActions/styled.js +1 -1
- package/dist/cjs/utils/cardDimensions.js +1 -1
- package/dist/cjs/utils/dimensionComparer.js +1 -1
- package/dist/cjs/utils/getErrorMessage.js +2 -2
- package/dist/cjs/utils/index.js +46 -46
- package/dist/cjs/utils/lightCards/styled.js +1 -1
- package/dist/cjs/utils/metadata.js +11 -3
- package/dist/cjs/utils/objectURLCache.js +7 -1
- package/dist/cjs/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/cjs/utils/viewportDetector.js +49 -22
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/errors.js +42 -2
- package/dist/es2019/files/cardImageView/index.js +8 -61
- package/dist/es2019/files/index.js +1 -1
- package/dist/es2019/root/card/cardAnalytics.js +3 -14
- package/dist/es2019/root/card/cardLoader.js +47 -53
- package/dist/es2019/root/card/cardState.js +26 -0
- package/dist/es2019/root/card/getCardPreview/cache.js +5 -0
- package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +38 -0
- package/dist/es2019/root/card/getCardPreview/helpers.js +2 -12
- package/dist/es2019/root/card/getCardPreview/index.js +112 -73
- package/dist/es2019/root/card/getCardStatus.js +1 -0
- package/dist/es2019/root/card/index.js +308 -190
- package/dist/es2019/root/cardView.js +97 -68
- package/dist/es2019/root/inline/loader.js +17 -5
- package/dist/es2019/root/inline/mediaInlineCard.js +32 -11
- package/dist/es2019/root/inlinePlayer.js +56 -4
- package/dist/es2019/root/styled.js +2 -1
- package/dist/es2019/root/ui/common.js +7 -1
- package/dist/es2019/root/ui/iconMessage/index.js +8 -5
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +35 -88
- package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/es2019/root/ui/progressBar/progressBar.js +5 -3
- package/dist/es2019/root/ui/progressBar/styled.js +7 -6
- package/dist/es2019/root/ui/styled.js +65 -4
- package/dist/es2019/root/ui/titleBox/failedTitleBox.js +6 -3
- package/dist/es2019/root/ui/titleBox/styled.js +1 -2
- package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
- package/dist/es2019/utils/analytics.js +5 -34
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
- package/dist/es2019/utils/dimensionComparer.js +1 -1
- package/dist/es2019/utils/getErrorMessage.js +1 -1
- package/dist/es2019/utils/metadata.js +12 -4
- package/dist/es2019/utils/objectURLCache.js +5 -0
- package/dist/es2019/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/es2019/utils/viewportDetector.js +48 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions.js +2 -2
- package/dist/esm/errors.js +64 -4
- package/dist/esm/files/cardImageView/index.js +51 -102
- package/dist/esm/files/index.js +1 -1
- package/dist/esm/root/card/cardAnalytics.js +3 -15
- package/dist/esm/root/card/cardLoader.js +66 -126
- package/dist/esm/root/card/cardState.js +32 -0
- package/dist/esm/root/card/getCardPreview/cache.js +9 -2
- package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +38 -0
- package/dist/esm/root/card/getCardPreview/helpers.js +13 -21
- package/dist/esm/root/card/getCardPreview/index.js +144 -91
- package/dist/esm/root/card/getCardStatus.js +3 -0
- package/dist/esm/root/card/index.js +396 -288
- package/dist/esm/root/cardView.js +113 -86
- package/dist/esm/root/inline/loader.js +48 -15
- package/dist/esm/root/inline/mediaInlineCard.js +32 -11
- package/dist/esm/root/inlinePlayer.js +74 -23
- package/dist/esm/root/styled.js +3 -2
- package/dist/esm/root/ui/common.js +7 -1
- package/dist/esm/root/ui/iconMessage/index.js +10 -5
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +37 -116
- package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/esm/root/ui/progressBar/progressBar.js +6 -3
- package/dist/esm/root/ui/progressBar/styled.js +7 -7
- package/dist/esm/root/ui/styled.js +61 -13
- package/dist/esm/root/ui/titleBox/failedTitleBox.js +7 -3
- package/dist/esm/root/ui/titleBox/styled.js +1 -2
- package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
- package/dist/esm/utils/analytics.js +5 -36
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +17 -9
- package/dist/esm/utils/dimensionComparer.js +1 -1
- package/dist/esm/utils/getErrorMessage.js +1 -1
- package/dist/esm/utils/metadata.js +12 -4
- package/dist/esm/utils/objectURLCache.js +6 -0
- package/dist/esm/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/esm/utils/viewportDetector.js +48 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +15 -1
- package/dist/types/files/cardImageView/index.d.ts +4 -13
- package/dist/types/files/cardImageView/styled.d.ts +1 -1
- package/dist/types/files/index.d.ts +1 -1
- package/dist/types/index.d.ts +7 -4
- package/dist/types/root/card/cardAnalytics.d.ts +1 -6
- package/dist/types/root/card/cardLoader.d.ts +5 -19
- package/dist/types/root/card/cardState.d.ts +5 -0
- package/dist/types/root/card/getCardPreview/cache.d.ts +3 -1
- package/dist/types/root/card/getCardPreview/filePreviewStatus.d.ts +5 -0
- package/dist/types/root/card/getCardPreview/helpers.d.ts +3 -4
- package/dist/types/root/card/getCardPreview/index.d.ts +24 -14
- package/dist/types/root/card/getCardStatus.d.ts +1 -0
- package/dist/types/root/card/index.d.ts +20 -18
- package/dist/types/root/cardView.d.ts +13 -8
- package/dist/types/root/inline/loader.d.ts +2 -0
- package/dist/types/root/inline/mediaInlineCard.d.ts +3 -5
- package/dist/types/root/inlinePlayer.d.ts +8 -1
- package/dist/types/root/styled.d.ts +1 -0
- package/dist/types/root/ui/common.d.ts +4 -1
- package/dist/types/root/ui/iconMessage/index.d.ts +4 -3
- package/dist/types/root/ui/iconWrapper/styled.d.ts +1 -1
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +14 -15
- package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +2 -1
- package/dist/types/root/ui/loadingRateLimited/styled.d.ts +1 -1
- package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
- package/dist/types/root/ui/progressBar/progressBar.d.ts +4 -2
- package/dist/types/root/ui/progressBar/styled.d.ts +3 -2
- package/dist/types/root/ui/styled.d.ts +10 -3
- package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +3 -1
- package/dist/types/root/ui/titleBox/styled.d.ts +1 -1
- package/dist/types/root/ui/titleBox/titleBox.d.ts +2 -10
- package/dist/types/styles/mixins.d.ts +1 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/types/utils/analytics.d.ts +6 -15
- package/dist/types/utils/cardDimensions.d.ts +4 -4
- package/dist/types/utils/dimensionComparer.d.ts +1 -1
- package/dist/types/utils/getErrorMessage.d.ts +1 -0
- package/dist/types/utils/metadata.d.ts +2 -2
- package/dist/types/utils/objectURLCache.d.ts +2 -1
- package/dist/types/utils/viewportDetector.d.ts +13 -5
- package/example-helpers/developmentUseMessage.tsx +14 -0
- package/example-helpers/index.tsx +55 -4
- package/example-helpers/selectableCard.tsx +2 -1
- package/package.json +18 -16
- package/dist/cjs/root/card/cardSSRView.js +0 -112
- package/dist/cjs/root/card/getCardPreview/types.js +0 -5
- package/dist/cjs/root/ui/Breakpoint.js +0 -13
- package/dist/cjs/root/ui/styledSSR.js +0 -108
- package/dist/cjs/utils/fileAttributesContext.js +0 -40
- package/dist/cjs/utils/lazyContent/index.js +0 -56
- package/dist/cjs/utils/lazyContent/styled.js +0 -23
- package/dist/es2019/root/card/cardSSRView.js +0 -92
- package/dist/es2019/root/card/getCardPreview/types.js +0 -1
- package/dist/es2019/root/ui/Breakpoint.js +0 -6
- package/dist/es2019/root/ui/styledSSR.js +0 -93
- package/dist/es2019/utils/fileAttributesContext.js +0 -19
- package/dist/es2019/utils/lazyContent/index.js +0 -18
- package/dist/es2019/utils/lazyContent/styled.js +0 -12
- package/dist/esm/root/card/cardSSRView.js +0 -91
- package/dist/esm/root/card/getCardPreview/types.js +0 -1
- package/dist/esm/root/ui/Breakpoint.js +0 -6
- package/dist/esm/root/ui/styledSSR.js +0 -76
- package/dist/esm/utils/fileAttributesContext.js +0 -18
- package/dist/esm/utils/lazyContent/index.js +0 -41
- package/dist/esm/utils/lazyContent/styled.js +0 -14
- package/dist/types/root/card/cardSSRView.d.ts +0 -13
- package/dist/types/root/card/getCardPreview/types.d.ts +0 -5
- package/dist/types/root/ui/Breakpoint.d.ts +0 -4
- package/dist/types/root/ui/styledSSR.d.ts +0 -16
- package/dist/types/utils/fileAttributesContext.d.ts +0 -10
- package/dist/types/utils/lazyContent/index.d.ts +0 -11
- package/dist/types/utils/lazyContent/styled.d.ts +0 -5
package/dist/esm/actions.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
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; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
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) { _defineProperty(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; }
|
|
6
6
|
|
|
7
7
|
export function attachDetailsToActions(actions, details) {
|
|
8
8
|
return actions.map(function (action) {
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
@@ -32,7 +33,7 @@ export var MediaCardError = /*#__PURE__*/function (_Error) {
|
|
|
32
33
|
return _this;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
return MediaCardError;
|
|
36
|
+
return _createClass(MediaCardError);
|
|
36
37
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
37
38
|
export var LocalPreviewError = /*#__PURE__*/function (_MediaCardError) {
|
|
38
39
|
_inherits(LocalPreviewError, _MediaCardError);
|
|
@@ -50,7 +51,7 @@ export var LocalPreviewError = /*#__PURE__*/function (_MediaCardError) {
|
|
|
50
51
|
return _this2;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
return LocalPreviewError;
|
|
54
|
+
return _createClass(LocalPreviewError);
|
|
54
55
|
}(MediaCardError);
|
|
55
56
|
export var RemotePreviewError = /*#__PURE__*/function (_MediaCardError2) {
|
|
56
57
|
_inherits(RemotePreviewError, _MediaCardError2);
|
|
@@ -68,7 +69,60 @@ export var RemotePreviewError = /*#__PURE__*/function (_MediaCardError2) {
|
|
|
68
69
|
return _this3;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
return RemotePreviewError;
|
|
72
|
+
return _createClass(RemotePreviewError);
|
|
73
|
+
}(MediaCardError);
|
|
74
|
+
export var SsrPreviewError = /*#__PURE__*/function (_MediaCardError3) {
|
|
75
|
+
_inherits(SsrPreviewError, _MediaCardError3);
|
|
76
|
+
|
|
77
|
+
var _super4 = _createSuper(SsrPreviewError);
|
|
78
|
+
|
|
79
|
+
function SsrPreviewError(primaryReason, secondaryError) {
|
|
80
|
+
var _this4;
|
|
81
|
+
|
|
82
|
+
_classCallCheck(this, SsrPreviewError);
|
|
83
|
+
|
|
84
|
+
_this4 = _super4.call(this, primaryReason, secondaryError);
|
|
85
|
+
_this4.primaryReason = primaryReason;
|
|
86
|
+
_this4.secondaryError = secondaryError;
|
|
87
|
+
return _this4;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return _createClass(SsrPreviewError);
|
|
91
|
+
}(MediaCardError);
|
|
92
|
+
export var getImageLoadPrimaryReason = function getImageLoadPrimaryReason(source) {
|
|
93
|
+
switch (source) {
|
|
94
|
+
case 'cache-remote':
|
|
95
|
+
return 'cache-remote-uri';
|
|
96
|
+
|
|
97
|
+
case 'cache-local':
|
|
98
|
+
return 'cache-local-uri';
|
|
99
|
+
|
|
100
|
+
case 'external':
|
|
101
|
+
return 'external-uri';
|
|
102
|
+
|
|
103
|
+
case 'local':
|
|
104
|
+
return 'local-uri';
|
|
105
|
+
|
|
106
|
+
case 'remote':
|
|
107
|
+
return 'remote-uri';
|
|
108
|
+
// This fail reason will come from a bug, most likely.
|
|
109
|
+
|
|
110
|
+
default:
|
|
111
|
+
return "unknown-uri";
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
export var ImageLoadError = /*#__PURE__*/function (_MediaCardError4) {
|
|
115
|
+
_inherits(ImageLoadError, _MediaCardError4);
|
|
116
|
+
|
|
117
|
+
var _super5 = _createSuper(ImageLoadError);
|
|
118
|
+
|
|
119
|
+
function ImageLoadError(source) {
|
|
120
|
+
_classCallCheck(this, ImageLoadError);
|
|
121
|
+
|
|
122
|
+
return _super5.call(this, getImageLoadPrimaryReason(source));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return _createClass(ImageLoadError);
|
|
72
126
|
}(MediaCardError);
|
|
73
127
|
export function isMediaCardError(err) {
|
|
74
128
|
return err instanceof MediaCardError;
|
|
@@ -81,9 +135,15 @@ export var isRemotePreviewError = function isRemotePreviewError(err) {
|
|
|
81
135
|
};
|
|
82
136
|
export var isUnsupportedLocalPreviewError = function isUnsupportedLocalPreviewError(err) {
|
|
83
137
|
return isMediaCardError(err) && err.primaryReason === 'local-preview-unsupported';
|
|
84
|
-
};
|
|
138
|
+
};
|
|
139
|
+
export function isImageLoadError(err) {
|
|
140
|
+
return err instanceof ImageLoadError;
|
|
141
|
+
} // In a try/catch statement, the error caught is the type of any.
|
|
85
142
|
// We can use this helper to ensure that the error handled is the type of MediaCardError if unsure
|
|
86
143
|
|
|
87
144
|
export var ensureMediaCardError = function ensureMediaCardError(primaryReason, error) {
|
|
88
145
|
return isMediaCardError(error) ? error : new MediaCardError(primaryReason, error);
|
|
146
|
+
};
|
|
147
|
+
export var isUploadError = function isUploadError(error) {
|
|
148
|
+
return error && error.primaryReason === 'upload';
|
|
89
149
|
};
|
|
@@ -20,20 +20,17 @@ import { CardLoading } from '../../utils/lightCards/cardLoading';
|
|
|
20
20
|
import { shouldDisplayImageThumbnail } from '../../utils/shouldDisplayImageThumbnail';
|
|
21
21
|
import { ProgressBar } from '../../utils/progressBar';
|
|
22
22
|
import CardActions from '../../utils/cardActions';
|
|
23
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
24
|
-
import { fireMediaCardEvent, RenderEventAction, getRenderSucceededEventPayload, getRenderFailedFileUriPayload, getRenderFailedExternalUriPayload } from '../../utils/analytics';
|
|
25
|
-
import { withFileAttributes } from '../../utils/fileAttributesContext';
|
|
26
23
|
export var fileCardImageViewSelector = 'media-file-card-view';
|
|
27
24
|
export var fileCardImageViewSelectedSelector = 'media-file-card-view-selected';
|
|
28
|
-
export var
|
|
29
|
-
_inherits(
|
|
25
|
+
export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
26
|
+
_inherits(FileCardImageView, _Component);
|
|
30
27
|
|
|
31
|
-
var _super = _createSuper(
|
|
28
|
+
var _super = _createSuper(FileCardImageView);
|
|
32
29
|
|
|
33
|
-
function
|
|
30
|
+
function FileCardImageView() {
|
|
34
31
|
var _this;
|
|
35
32
|
|
|
36
|
-
_classCallCheck(this,
|
|
33
|
+
_classCallCheck(this, FileCardImageView);
|
|
37
34
|
|
|
38
35
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
36
|
args[_key] = arguments[_key];
|
|
@@ -159,60 +156,18 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
159
156
|
})));
|
|
160
157
|
});
|
|
161
158
|
|
|
162
|
-
_defineProperty(_assertThisInitialized(_this), "onImageLoad", function () {
|
|
163
|
-
var _this$props6 = _this.props,
|
|
164
|
-
createAnalyticsEvent = _this$props6.createAnalyticsEvent,
|
|
165
|
-
fileAttributes = _this$props6.fileAttributes,
|
|
166
|
-
timeElapsedTillCommenced = _this$props6.timeElapsedTillCommenced;
|
|
167
|
-
|
|
168
|
-
if (fileAttributes && _this.shouldFireEvent(RenderEventAction.SUCCEEDED)) {
|
|
169
|
-
var timeElapsedTillSucceeded = performance.now();
|
|
170
|
-
var durationSinceCommenced = timeElapsedTillCommenced && timeElapsedTillSucceeded - timeElapsedTillCommenced;
|
|
171
|
-
var performanceAttributes = {
|
|
172
|
-
overall: {
|
|
173
|
-
durationSincePageStart: timeElapsedTillSucceeded,
|
|
174
|
-
durationSinceCommenced: durationSinceCommenced
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
fireMediaCardEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
_defineProperty(_assertThisInitialized(_this), "onImageError", function () {
|
|
182
|
-
var fileAttributes = _this.props.fileAttributes;
|
|
183
|
-
|
|
184
|
-
if (fileAttributes && _this.shouldFireEvent(RenderEventAction.FAILED)) {
|
|
185
|
-
var _this$props7 = _this.props,
|
|
186
|
-
createAnalyticsEvent = _this$props7.createAnalyticsEvent,
|
|
187
|
-
mediaItemType = _this$props7.mediaItemType,
|
|
188
|
-
timeElapsedTillCommenced = _this$props7.timeElapsedTillCommenced;
|
|
189
|
-
var timeElapsedTillFailed = performance.now();
|
|
190
|
-
var durationSinceCommenced = timeElapsedTillCommenced && timeElapsedTillFailed - timeElapsedTillCommenced;
|
|
191
|
-
var performanceAttributes = {
|
|
192
|
-
overall: {
|
|
193
|
-
durationSincePageStart: timeElapsedTillFailed,
|
|
194
|
-
durationSinceCommenced: durationSinceCommenced
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
if (mediaItemType === 'file') {
|
|
199
|
-
fireMediaCardEvent(getRenderFailedFileUriPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
200
|
-
} else if (mediaItemType === 'external-image') {
|
|
201
|
-
fireMediaCardEvent(getRenderFailedExternalUriPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
|
|
206
159
|
_defineProperty(_assertThisInitialized(_this), "renderMediaImage", function () {
|
|
207
|
-
var _this$
|
|
208
|
-
status = _this$
|
|
209
|
-
mediaItemType = _this$
|
|
210
|
-
dataURI = _this$
|
|
211
|
-
mediaType = _this$
|
|
212
|
-
mimeType = _this$
|
|
213
|
-
previewOrientation = _this$
|
|
214
|
-
onDisplayImage = _this$
|
|
215
|
-
alt = _this$
|
|
160
|
+
var _this$props6 = _this.props,
|
|
161
|
+
status = _this$props6.status,
|
|
162
|
+
mediaItemType = _this$props6.mediaItemType,
|
|
163
|
+
dataURI = _this$props6.dataURI,
|
|
164
|
+
mediaType = _this$props6.mediaType,
|
|
165
|
+
mimeType = _this$props6.mimeType,
|
|
166
|
+
previewOrientation = _this$props6.previewOrientation,
|
|
167
|
+
onDisplayImage = _this$props6.onDisplayImage,
|
|
168
|
+
alt = _this$props6.alt,
|
|
169
|
+
onImageLoad = _this$props6.onImageLoad,
|
|
170
|
+
onImageError = _this$props6.onImageError;
|
|
216
171
|
|
|
217
172
|
if (!shouldDisplayImageThumbnail(status, mediaItemType, dataURI, mediaType, mimeType)) {
|
|
218
173
|
return null;
|
|
@@ -229,21 +184,17 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
229
184
|
crop: _this.isCropped,
|
|
230
185
|
stretch: _this.isStretched,
|
|
231
186
|
previewOrientation: previewOrientation,
|
|
232
|
-
onImageLoad:
|
|
233
|
-
onImageError:
|
|
187
|
+
onImageLoad: onImageLoad,
|
|
188
|
+
onImageError: onImageError
|
|
234
189
|
});
|
|
235
190
|
});
|
|
236
191
|
|
|
237
|
-
_defineProperty(_assertThisInitialized(_this), "shouldFireEvent", function (action) {
|
|
238
|
-
return !_this.lastAnalyticsAction || _this.lastAnalyticsAction !== action;
|
|
239
|
-
});
|
|
240
|
-
|
|
241
192
|
_defineProperty(_assertThisInitialized(_this), "renderProgressBar", function () {
|
|
242
|
-
var _this$
|
|
243
|
-
mediaName = _this$
|
|
244
|
-
progress = _this$
|
|
245
|
-
actions = _this$
|
|
246
|
-
status = _this$
|
|
193
|
+
var _this$props7 = _this.props,
|
|
194
|
+
mediaName = _this$props7.mediaName,
|
|
195
|
+
progress = _this$props7.progress,
|
|
196
|
+
actions = _this$props7.actions,
|
|
197
|
+
status = _this$props7.status;
|
|
247
198
|
|
|
248
199
|
if (status !== 'uploading') {
|
|
249
200
|
return null;
|
|
@@ -262,10 +213,10 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
262
213
|
});
|
|
263
214
|
|
|
264
215
|
_defineProperty(_assertThisInitialized(_this), "renderSuccessCardContents", function () {
|
|
265
|
-
var _this$
|
|
266
|
-
disableOverlay = _this$
|
|
267
|
-
selectable = _this$
|
|
268
|
-
status = _this$
|
|
216
|
+
var _this$props8 = _this.props,
|
|
217
|
+
disableOverlay = _this$props8.disableOverlay,
|
|
218
|
+
selectable = _this$props8.selectable,
|
|
219
|
+
status = _this$props8.status;
|
|
269
220
|
var overlay = null;
|
|
270
221
|
|
|
271
222
|
if (!disableOverlay) {
|
|
@@ -286,15 +237,15 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
286
237
|
});
|
|
287
238
|
|
|
288
239
|
_defineProperty(_assertThisInitialized(_this), "renderSuccessCardOverlay", function () {
|
|
289
|
-
var _this$
|
|
290
|
-
status = _this$
|
|
291
|
-
mediaName = _this$
|
|
292
|
-
mediaType = _this$
|
|
293
|
-
fileSize = _this$
|
|
294
|
-
dataURI = _this$
|
|
295
|
-
selectable = _this$
|
|
296
|
-
selected = _this$
|
|
297
|
-
actions = _this$
|
|
240
|
+
var _this$props9 = _this.props,
|
|
241
|
+
status = _this$props9.status,
|
|
242
|
+
mediaName = _this$props9.mediaName,
|
|
243
|
+
mediaType = _this$props9.mediaType,
|
|
244
|
+
fileSize = _this$props9.fileSize,
|
|
245
|
+
dataURI = _this$props9.dataURI,
|
|
246
|
+
selectable = _this$props9.selectable,
|
|
247
|
+
selected = _this$props9.selected,
|
|
248
|
+
actions = _this$props9.actions;
|
|
298
249
|
var isPersistent = mediaType === 'doc' || !dataURI;
|
|
299
250
|
return /*#__PURE__*/React.createElement(CardOverlay, {
|
|
300
251
|
cardStatus: status,
|
|
@@ -311,17 +262,17 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
311
262
|
return _this;
|
|
312
263
|
}
|
|
313
264
|
|
|
314
|
-
_createClass(
|
|
265
|
+
_createClass(FileCardImageView, [{
|
|
315
266
|
key: "render",
|
|
316
267
|
value: function render() {
|
|
317
|
-
var _this$
|
|
318
|
-
disableOverlay = _this$
|
|
319
|
-
selectable = _this$
|
|
320
|
-
selected = _this$
|
|
321
|
-
mediaType = _this$
|
|
322
|
-
progress = _this$
|
|
323
|
-
status = _this$
|
|
324
|
-
mediaName = _this$
|
|
268
|
+
var _this$props10 = this.props,
|
|
269
|
+
disableOverlay = _this$props10.disableOverlay,
|
|
270
|
+
selectable = _this$props10.selectable,
|
|
271
|
+
selected = _this$props10.selected,
|
|
272
|
+
mediaType = _this$props10.mediaType,
|
|
273
|
+
progress = _this$props10.progress,
|
|
274
|
+
status = _this$props10.status,
|
|
275
|
+
mediaName = _this$props10.mediaName;
|
|
325
276
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
326
277
|
"data-testid": "media-file-card-view",
|
|
327
278
|
"data-test-media-name": mediaName,
|
|
@@ -338,9 +289,9 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
338
289
|
}, {
|
|
339
290
|
key: "isFileCardImageReadyForDisplay",
|
|
340
291
|
get: function get() {
|
|
341
|
-
var _this$
|
|
342
|
-
dataURI = _this$
|
|
343
|
-
status = _this$
|
|
292
|
+
var _this$props11 = this.props,
|
|
293
|
+
dataURI = _this$props11.dataURI,
|
|
294
|
+
status = _this$props11.status;
|
|
344
295
|
return !!dataURI || !['loading', 'processing', 'loading-preview'].includes(status);
|
|
345
296
|
}
|
|
346
297
|
}, {
|
|
@@ -357,12 +308,10 @@ export var FileCardImageViewBase = /*#__PURE__*/function (_Component) {
|
|
|
357
308
|
}
|
|
358
309
|
}]);
|
|
359
310
|
|
|
360
|
-
return
|
|
311
|
+
return FileCardImageView;
|
|
361
312
|
}(Component);
|
|
362
313
|
|
|
363
|
-
_defineProperty(
|
|
314
|
+
_defineProperty(FileCardImageView, "defaultProps", {
|
|
364
315
|
resizeMode: 'crop',
|
|
365
316
|
disableOverlay: false
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
export var FileCardImageView = withAnalyticsEvents()(withFileAttributes(FileCardImageViewBase));
|
|
317
|
+
});
|
package/dist/esm/files/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FileCardImageView
|
|
1
|
+
export { FileCardImageView } from './cardImageView';
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { fireMediaCardEvent, getRenderSucceededEventPayload, getRenderErrorEventPayload, getRenderFailedFileStatusPayload, getCopiedFilePayload, getRenderCommencedEventPayload, getRenderPreviewableCardPayload } from '../../utils/analytics';
|
|
2
|
-
export var relevantFeatureFlagNames = ['newCardExperience', '
|
|
3
|
-
export var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes) {
|
|
4
|
-
var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
|
|
5
|
-
cardPreview = _ref.cardPreview,
|
|
6
|
-
error = _ref.error;
|
|
7
|
-
|
|
2
|
+
export var relevantFeatureFlagNames = ['newCardExperience', 'captions', 'timestampOnVideo'];
|
|
3
|
+
export var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, error) {
|
|
8
4
|
var fireEvent = function fireEvent(payload) {
|
|
9
5
|
return fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
10
6
|
};
|
|
11
7
|
|
|
12
8
|
switch (status) {
|
|
13
9
|
case 'complete':
|
|
14
|
-
|
|
15
|
-
* A Card that is considered Complete and has no preview,
|
|
16
|
-
* reflects an expected behaviour, and thus a legitimate
|
|
17
|
-
* success case to be logged.
|
|
18
|
-
*/
|
|
19
|
-
if (!(cardPreview !== null && cardPreview !== void 0 && cardPreview.dataURI)) {
|
|
20
|
-
fireEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes));
|
|
21
|
-
}
|
|
22
|
-
|
|
10
|
+
fireEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes));
|
|
23
11
|
break;
|
|
24
12
|
|
|
25
13
|
case 'failed-processing':
|
|
@@ -1,129 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
|
-
|
|
12
|
-
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); }; }
|
|
13
|
-
|
|
14
|
-
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; } }
|
|
15
|
-
|
|
16
|
-
import React from 'react';
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { useMemoizeFeatureFlags } from '@atlaskit/media-common';
|
|
4
|
+
import Loadable from 'react-loadable';
|
|
17
5
|
import { CardLoading } from '../..';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
-
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
36
|
-
Card: CardLoader.Card,
|
|
37
|
-
MediaCardErrorBoundary: CardLoader.MediaCardErrorBoundary
|
|
6
|
+
var MediaCardContext = /*#__PURE__*/React.createContext({});
|
|
7
|
+
|
|
8
|
+
var CardLoadingWithContext = function CardLoadingWithContext() {
|
|
9
|
+
var props = useContext(MediaCardContext);
|
|
10
|
+
return /*#__PURE__*/React.createElement(CardLoading, props);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
var MediaCard = Loadable({
|
|
14
|
+
loader: function loader() {
|
|
15
|
+
return import(
|
|
16
|
+
/* webpackChunkName: "@atlaskit-internal_media-card" */
|
|
17
|
+
'./index').then(function (mod) {
|
|
18
|
+
return mod.Card;
|
|
38
19
|
});
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
},
|
|
21
|
+
loading: function loading() {
|
|
22
|
+
return /*#__PURE__*/React.createElement(CardLoadingWithContext, null);
|
|
41
23
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
case "end":
|
|
89
|
-
return _context.stop();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, _callee, this, [[1, 14]]);
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
function componentDidMount() {
|
|
96
|
-
return _componentDidMount.apply(this, arguments);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return componentDidMount;
|
|
100
|
-
}()
|
|
101
|
-
}, {
|
|
102
|
-
key: "render",
|
|
103
|
-
value: function render() {
|
|
104
|
-
var _this$props = this.props,
|
|
105
|
-
dimensions = _this$props.dimensions,
|
|
106
|
-
testId = _this$props.testId,
|
|
107
|
-
featureFlags = _this$props.featureFlags;
|
|
108
|
-
var _this$state = this.state,
|
|
109
|
-
Card = _this$state.Card,
|
|
110
|
-
MediaCardErrorBoundary = _this$state.MediaCardErrorBoundary;
|
|
111
|
-
|
|
112
|
-
if (!Card || !MediaCardErrorBoundary) {
|
|
113
|
-
return /*#__PURE__*/React.createElement(CardLoading, {
|
|
114
|
-
testId: testId,
|
|
115
|
-
dimensions: dimensions,
|
|
116
|
-
featureFlags: featureFlags
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return /*#__PURE__*/React.createElement(MediaCardErrorBoundary, null, /*#__PURE__*/React.createElement(Card, this.props));
|
|
121
|
-
}
|
|
122
|
-
}]);
|
|
123
|
-
|
|
124
|
-
return CardLoader;
|
|
125
|
-
}(React.PureComponent);
|
|
126
|
-
|
|
127
|
-
_defineProperty(CardLoader, "displayName", 'AsyncCard');
|
|
128
|
-
|
|
129
|
-
export { CardLoader as default };
|
|
24
|
+
});
|
|
25
|
+
var MediaCardErrorBoundary = Loadable({
|
|
26
|
+
loader: function loader() {
|
|
27
|
+
return import(
|
|
28
|
+
/* webpackChunkName: "@atlaskit-internal_media-card-error-boundary" */
|
|
29
|
+
'../media-card-analytics-error-boundary').then(function (mod) {
|
|
30
|
+
return mod.default;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
loading: function loading() {
|
|
34
|
+
return /*#__PURE__*/React.createElement(CardLoadingWithContext, null);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var MediaCardWithMediaClient = Loadable({
|
|
38
|
+
loader: function loader() {
|
|
39
|
+
return import(
|
|
40
|
+
/* webpackChunkName: "@atlaskit-internal_media-client" */
|
|
41
|
+
'@atlaskit/media-client');
|
|
42
|
+
},
|
|
43
|
+
loading: function loading() {
|
|
44
|
+
return /*#__PURE__*/React.createElement(CardLoadingWithContext, null);
|
|
45
|
+
},
|
|
46
|
+
render: function render(loaded, props) {
|
|
47
|
+
return /*#__PURE__*/React.createElement(CardWithMediaClient, _extends({}, props, {
|
|
48
|
+
withMediaClient: loaded.withMediaClient
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var CardWithMediaClient = function CardWithMediaClient(props) {
|
|
54
|
+
var withMediaClient = props.withMediaClient,
|
|
55
|
+
featureFlags = props.featureFlags;
|
|
56
|
+
var memoizedFeatureFlags = useMemoizeFeatureFlags(featureFlags);
|
|
57
|
+
var Card = React.useMemo(function () {
|
|
58
|
+
return withMediaClient(MediaCard, memoizedFeatureFlags);
|
|
59
|
+
}, [withMediaClient, memoizedFeatureFlags]);
|
|
60
|
+
return /*#__PURE__*/React.createElement(MediaCardErrorBoundary, null, /*#__PURE__*/React.createElement(Card, props));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var CardLoader = function CardLoader(props) {
|
|
64
|
+
return /*#__PURE__*/React.createElement(MediaCardContext.Provider, {
|
|
65
|
+
value: props
|
|
66
|
+
}, /*#__PURE__*/React.createElement(MediaCardWithMediaClient, props));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default CardLoader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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) { _defineProperty(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; }
|
|
6
|
+
|
|
7
|
+
import { isErrorFileState } from '@atlaskit/media-client';
|
|
8
|
+
import { MediaCardError } from '../../errors';
|
|
9
|
+
import { getCardStatus, isFinalCardStatus } from './getCardStatus';
|
|
10
|
+
import { extractFilePreviewStatus } from './getCardPreview';
|
|
11
|
+
export var createStateUpdater = function createStateUpdater(newState) {
|
|
12
|
+
return function (prevState) {
|
|
13
|
+
// Only override if previous status is non-final
|
|
14
|
+
// or new status is 'complete'
|
|
15
|
+
if (isFinalCardStatus(prevState.status) && newState.status !== 'complete') {
|
|
16
|
+
return prevState;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _objectSpread(_objectSpread({}, prevState), newState);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export var getCardStateFromFileState = function getCardStateFromFileState(fileState, isBannedLocalPreview, featureFlags) {
|
|
23
|
+
var status = getCardStatus(fileState.status, extractFilePreviewStatus(fileState, isBannedLocalPreview, featureFlags));
|
|
24
|
+
var error = status === 'error' && isErrorFileState(fileState) ? new MediaCardError('error-file-state', new Error(fileState.message)) : undefined;
|
|
25
|
+
var progress = status === 'uploading' && fileState.status === 'uploading' ? fileState.progress : 1;
|
|
26
|
+
return {
|
|
27
|
+
fileState: fileState,
|
|
28
|
+
status: status,
|
|
29
|
+
progress: progress,
|
|
30
|
+
error: error
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import { createObjectURLCache } from '../../../utils/objectURLCache';
|
|
@@ -6,7 +7,7 @@ import { createObjectURLCache } from '../../../utils/objectURLCache';
|
|
|
6
7
|
export var getCacheKey = function getCacheKey(id, dimensions) {
|
|
7
8
|
return [id, dimensions.height, dimensions.width].join('-');
|
|
8
9
|
};
|
|
9
|
-
export var CardPreviewCacheImpl = function CardPreviewCacheImpl(previewCache) {
|
|
10
|
+
export var CardPreviewCacheImpl = /*#__PURE__*/_createClass(function CardPreviewCacheImpl(previewCache) {
|
|
10
11
|
var _this = this;
|
|
11
12
|
|
|
12
13
|
_classCallCheck(this, CardPreviewCacheImpl);
|
|
@@ -22,6 +23,12 @@ export var CardPreviewCacheImpl = function CardPreviewCacheImpl(previewCache) {
|
|
|
22
23
|
_this.previewCache.set(cacheKey, cardPreview);
|
|
23
24
|
});
|
|
24
25
|
|
|
26
|
+
_defineProperty(this, "remove", function (id, dimensions) {
|
|
27
|
+
var cacheKey = getCacheKey(id, dimensions);
|
|
28
|
+
|
|
29
|
+
_this.previewCache.remove(cacheKey);
|
|
30
|
+
});
|
|
31
|
+
|
|
25
32
|
this.previewCache = previewCache;
|
|
26
|
-
};
|
|
33
|
+
});
|
|
27
34
|
export default new CardPreviewCacheImpl(createObjectURLCache());
|