@atlaskit/media-card 74.5.1 → 74.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/card/actions.js +0 -5
- package/dist/cjs/card/card.js +263 -322
- package/dist/cjs/card/cardAnalytics.js +0 -18
- package/dist/cjs/card/cardImageView/cardImageViewWrapper.js +7 -16
- package/dist/cjs/card/cardImageView/cardOverlay/cardOverlayComponents.js +3 -15
- package/dist/cjs/card/cardImageView/cardOverlay/index.js +20 -52
- package/dist/cjs/card/cardImageView/cardOverlay/styles.js +1 -19
- package/dist/cjs/card/cardImageView/cardViewWrapper.js +7 -10
- package/dist/cjs/card/cardImageView/fileCardImageView.js +66 -111
- package/dist/cjs/card/cardImageView/index.js +0 -1
- package/dist/cjs/card/cardImageView/styles.js +0 -14
- package/dist/cjs/card/cardLoader.js +3 -20
- package/dist/cjs/card/cardState.js +0 -9
- package/dist/cjs/card/cardView.js +105 -198
- package/dist/cjs/card/getCardPreview/cache.js +0 -12
- package/dist/cjs/card/getCardPreview/filePreviewStatus.js +8 -16
- package/dist/cjs/card/getCardPreview/helpers.js +0 -39
- package/dist/cjs/card/getCardPreview/imageRefetchingAnalytics.js +0 -8
- package/dist/cjs/card/getCardPreview/index.js +19 -86
- package/dist/cjs/card/getCardStatus.js +5 -24
- package/dist/cjs/card/index.js +0 -2
- package/dist/cjs/card/inlinePlayer.js +19 -102
- package/dist/cjs/card/inlinePlayerLazy.js +0 -11
- package/dist/cjs/card/inlinePlayerWrapper.js +5 -8
- package/dist/cjs/card/media-card-analytics-error-boundary.js +6 -34
- package/dist/cjs/card/styles/animations.js +0 -5
- package/dist/cjs/card/styles/getSelectedBorderStyle.js +0 -4
- package/dist/cjs/card/styles/index.js +0 -14
- package/dist/cjs/card/styles/mixins.js +0 -11
- package/dist/cjs/card/styles/styles.js +4 -20
- package/dist/cjs/card/ui/actionsBar/actionsBar.js +2 -20
- package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +1 -4
- package/dist/cjs/card/ui/actionsBar/styles.js +0 -8
- package/dist/cjs/card/ui/blanket/blanket.js +1 -4
- package/dist/cjs/card/ui/blanket/styles.js +0 -9
- package/dist/cjs/card/ui/common.js +0 -8
- package/dist/cjs/card/ui/iconMessage/iconMessageWrapper.js +2 -5
- package/dist/cjs/card/ui/iconMessage/index.js +4 -22
- package/dist/cjs/card/ui/iconMessage/styles.js +1 -10
- package/dist/cjs/card/ui/iconWrapper/iconWrapper.js +2 -5
- package/dist/cjs/card/ui/iconWrapper/styles.js +3 -11
- package/dist/cjs/card/ui/imageRenderer/imageRenderer.js +8 -21
- package/dist/cjs/card/ui/loadingRateLimited/styles.js +1 -10
- package/dist/cjs/card/ui/newFileExperience/newFileExperienceWrapper.js +14 -19
- package/dist/cjs/card/ui/newFileExperience/styles.js +10 -26
- package/dist/cjs/card/ui/playButton/playButton.js +0 -7
- package/dist/cjs/card/ui/playButton/playButtonBackground.js +1 -4
- package/dist/cjs/card/ui/playButton/playButtonWrapper.js +1 -4
- package/dist/cjs/card/ui/playButton/styles.js +0 -6
- package/dist/cjs/card/ui/progressBar/progressBar.js +6 -14
- package/dist/cjs/card/ui/progressBar/styledBar.js +4 -7
- package/dist/cjs/card/ui/progressBar/styles.js +4 -18
- package/dist/cjs/card/ui/styles.js +12 -46
- package/dist/cjs/card/ui/tickBox/styles.js +0 -11
- package/dist/cjs/card/ui/tickBox/tickBox.js +0 -6
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +1 -4
- package/dist/cjs/card/ui/titleBox/failedTitleBox.js +2 -11
- package/dist/cjs/card/ui/titleBox/styles.js +4 -19
- package/dist/cjs/card/ui/titleBox/titleBox.js +9 -21
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +2 -14
- package/dist/cjs/card/ui/unhandledErrorCard/index.js +6 -36
- package/dist/cjs/classnames.js +0 -1
- package/dist/cjs/errors.js +7 -66
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/inline/index.js +0 -2
- package/dist/cjs/inline/loader.js +2 -43
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +4 -29
- package/dist/cjs/inline/mediaInlineCard.js +21 -57
- package/dist/cjs/types.js +0 -2
- package/dist/cjs/utils/analytics.js +0 -49
- package/dist/cjs/utils/breakpoint.js +0 -10
- package/dist/cjs/utils/cardActions/cardActionButton.js +1 -4
- package/dist/cjs/utils/cardActions/cardActionIconButton.js +7 -29
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +6 -35
- package/dist/cjs/utils/cardActions/cardActionsView.js +7 -34
- package/dist/cjs/utils/cardActions/index.js +0 -4
- package/dist/cjs/utils/cardActions/styles.js +0 -13
- package/dist/cjs/utils/cardDimensions.js +5 -22
- package/dist/cjs/utils/containsPixelUnit.js +0 -2
- package/dist/cjs/utils/dimensionComparer.js +0 -8
- package/dist/cjs/utils/document.js +0 -4
- package/dist/cjs/utils/errorIcon/index.js +0 -18
- package/dist/cjs/utils/errorIcon/styles.js +0 -5
- package/dist/cjs/utils/fileIcon/index.js +3 -21
- package/dist/cjs/utils/fileIcon/styles.js +0 -6
- package/dist/cjs/utils/generateUniqueId.js +0 -2
- package/dist/cjs/utils/getCSSUnitValue.js +0 -1
- package/dist/cjs/utils/getDataURIDimension.js +0 -13
- package/dist/cjs/utils/getElementDimension.js +0 -2
- package/dist/cjs/utils/getErrorMessage.js +0 -6
- package/dist/cjs/utils/getMediaCardCursor.js +1 -6
- package/dist/cjs/utils/globalScope/getSSRData.js +0 -5
- package/dist/cjs/utils/globalScope/globalScope.js +8 -25
- package/dist/cjs/utils/globalScope/index.js +0 -2
- package/dist/cjs/utils/index.js +0 -12
- package/dist/cjs/utils/isRetina.js +0 -1
- package/dist/cjs/utils/isValidPercentageUnit.js +0 -2
- package/dist/cjs/utils/lightCards/cardError.js +0 -21
- package/dist/cjs/utils/lightCards/cardLoading.js +3 -27
- package/dist/cjs/utils/lightCards/getDimensionsWithDefault.js +0 -2
- package/dist/cjs/utils/lightCards/lightCardWrappers.js +1 -9
- package/dist/cjs/utils/lightCards/styles.js +1 -13
- package/dist/cjs/utils/metadata.js +0 -7
- package/dist/cjs/utils/objectURLCache.js +0 -22
- package/dist/cjs/utils/preventClickThrough.js +0 -5
- package/dist/cjs/utils/printScript.js +0 -10
- package/dist/cjs/utils/progressBar/index.js +0 -17
- package/dist/cjs/utils/progressBar/styles.js +0 -6
- package/dist/cjs/utils/resizeModeToMediaImageProps.js +0 -1
- package/dist/cjs/utils/shouldDisplayImageThumbnail.js +0 -5
- package/dist/cjs/utils/ufoExperiences.js +1 -21
- package/dist/cjs/utils/videoSnapshot.js +2 -11
- package/dist/cjs/utils/viewportDetector.js +5 -24
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/actions.js +2 -1
- package/dist/es2019/card/card.js +115 -156
- package/dist/es2019/card/cardAnalytics.js +0 -5
- package/dist/es2019/card/cardImageView/cardOverlay/index.js +2 -16
- package/dist/es2019/card/cardImageView/cardOverlay/styles.js +1 -2
- package/dist/es2019/card/cardImageView/fileCardImageView.js +3 -36
- package/dist/es2019/card/cardImageView/styles.js +0 -3
- package/dist/es2019/card/cardLoader.js +3 -14
- package/dist/es2019/card/cardState.js +1 -2
- package/dist/es2019/card/cardView.js +24 -68
- package/dist/es2019/card/getCardPreview/cache.js +0 -4
- package/dist/es2019/card/getCardPreview/filePreviewStatus.js +8 -5
- package/dist/es2019/card/getCardPreview/helpers.js +0 -9
- package/dist/es2019/card/getCardPreview/imageRefetchingAnalytics.js +0 -3
- package/dist/es2019/card/getCardPreview/index.js +20 -32
- package/dist/es2019/card/getCardStatus.js +2 -15
- package/dist/es2019/card/inlinePlayer.js +2 -35
- package/dist/es2019/card/inlinePlayerLazy.js +1 -2
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -15
- package/dist/es2019/card/styles/getSelectedBorderStyle.js +1 -1
- package/dist/es2019/card/styles/styles.js +0 -3
- package/dist/es2019/card/ui/actionsBar/actionsBar.js +0 -3
- package/dist/es2019/card/ui/common.js +0 -2
- package/dist/es2019/card/ui/iconMessage/styles.js +0 -2
- package/dist/es2019/card/ui/iconWrapper/styles.js +2 -2
- package/dist/es2019/card/ui/imageRenderer/imageRenderer.js +0 -3
- package/dist/es2019/card/ui/progressBar/styles.js +1 -3
- package/dist/es2019/card/ui/styles.js +3 -4
- package/dist/es2019/card/ui/titleBox/styles.js +2 -3
- package/dist/es2019/card/ui/unhandledErrorCard/index.js +0 -8
- package/dist/es2019/errors.js +8 -17
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/inline/loader.js +1 -18
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +1 -12
- package/dist/es2019/inline/mediaInlineCard.js +0 -15
- package/dist/es2019/types.js +1 -1
- package/dist/es2019/utils/analytics.js +0 -3
- package/dist/es2019/utils/breakpoint.js +0 -4
- package/dist/es2019/utils/cardActions/cardActionIconButton.js +3 -5
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +0 -5
- package/dist/es2019/utils/cardActions/cardActionsView.js +0 -10
- package/dist/es2019/utils/cardActions/styles.js +0 -3
- package/dist/es2019/utils/cardDimensions.js +7 -14
- package/dist/es2019/utils/dimensionComparer.js +0 -3
- package/dist/es2019/utils/document.js +0 -2
- package/dist/es2019/utils/errorIcon/index.js +0 -3
- package/dist/es2019/utils/fileIcon/index.js +0 -1
- package/dist/es2019/utils/getDataURIDimension.js +0 -4
- package/dist/es2019/utils/getMediaCardCursor.js +1 -4
- package/dist/es2019/utils/globalScope/getSSRData.js +0 -2
- package/dist/es2019/utils/globalScope/globalScope.js +3 -10
- package/dist/es2019/utils/lightCards/cardError.js +0 -3
- package/dist/es2019/utils/lightCards/cardLoading.js +0 -3
- package/dist/es2019/utils/lightCards/lightCardWrappers.js +0 -1
- package/dist/es2019/utils/metadata.js +0 -5
- package/dist/es2019/utils/objectURLCache.js +0 -10
- package/dist/es2019/utils/printScript.js +0 -3
- package/dist/es2019/utils/progressBar/index.js +0 -2
- package/dist/es2019/utils/shouldDisplayImageThumbnail.js +0 -2
- package/dist/es2019/utils/ufoExperiences.js +5 -10
- package/dist/es2019/utils/videoSnapshot.js +2 -4
- package/dist/es2019/utils/viewportDetector.js +0 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/actions.js +0 -3
- package/dist/esm/card/card.js +263 -316
- package/dist/esm/card/cardAnalytics.js +0 -6
- package/dist/esm/card/cardImageView/cardImageViewWrapper.js +6 -6
- package/dist/esm/card/cardImageView/cardOverlay/cardOverlayComponents.js +2 -2
- package/dist/esm/card/cardImageView/cardOverlay/index.js +22 -37
- package/dist/esm/card/cardImageView/cardOverlay/styles.js +2 -6
- package/dist/esm/card/cardImageView/cardViewWrapper.js +6 -6
- package/dist/esm/card/cardImageView/fileCardImageView.js +66 -104
- package/dist/esm/card/cardImageView/styles.js +0 -5
- package/dist/esm/card/cardLoader.js +6 -17
- package/dist/esm/card/cardState.js +1 -2
- package/dist/esm/card/cardView.js +105 -171
- package/dist/esm/card/getCardPreview/cache.js +0 -7
- package/dist/esm/card/getCardPreview/filePreviewStatus.js +11 -11
- package/dist/esm/card/getCardPreview/helpers.js +0 -28
- package/dist/esm/card/getCardPreview/imageRefetchingAnalytics.js +0 -3
- package/dist/esm/card/getCardPreview/index.js +19 -54
- package/dist/esm/card/getCardStatus.js +5 -20
- package/dist/esm/card/inlinePlayer.js +19 -85
- package/dist/esm/card/inlinePlayerLazy.js +1 -5
- package/dist/esm/card/inlinePlayerWrapper.js +4 -4
- package/dist/esm/card/media-card-analytics-error-boundary.js +6 -28
- package/dist/esm/card/styles/animations.js +0 -2
- package/dist/esm/card/styles/getSelectedBorderStyle.js +1 -1
- package/dist/esm/card/styles/index.js +0 -2
- package/dist/esm/card/styles/styles.js +4 -9
- package/dist/esm/card/ui/actionsBar/actionsBar.js +2 -12
- package/dist/esm/card/ui/actionsBar/styles.js +0 -2
- package/dist/esm/card/ui/blanket/styles.js +0 -2
- package/dist/esm/card/ui/common.js +0 -4
- package/dist/esm/card/ui/iconMessage/iconMessageWrapper.js +1 -1
- package/dist/esm/card/ui/iconMessage/index.js +4 -4
- package/dist/esm/card/ui/iconMessage/styles.js +1 -5
- package/dist/esm/card/ui/iconWrapper/iconWrapper.js +1 -1
- package/dist/esm/card/ui/iconWrapper/styles.js +3 -5
- package/dist/esm/card/ui/imageRenderer/imageRenderer.js +8 -11
- package/dist/esm/card/ui/loadingRateLimited/styles.js +1 -3
- package/dist/esm/card/ui/newFileExperience/newFileExperienceWrapper.js +13 -13
- package/dist/esm/card/ui/newFileExperience/styles.js +10 -12
- package/dist/esm/card/ui/playButton/styles.js +0 -2
- package/dist/esm/card/ui/progressBar/progressBar.js +6 -6
- package/dist/esm/card/ui/progressBar/styledBar.js +3 -3
- package/dist/esm/card/ui/progressBar/styles.js +4 -8
- package/dist/esm/card/ui/styles.js +12 -20
- package/dist/esm/card/ui/tickBox/styles.js +0 -2
- package/dist/esm/card/ui/titleBox/failedTitleBox.js +2 -2
- package/dist/esm/card/ui/titleBox/styles.js +4 -7
- package/dist/esm/card/ui/titleBox/titleBox.js +9 -11
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +1 -1
- package/dist/esm/card/ui/unhandledErrorCard/index.js +6 -24
- package/dist/esm/errors.js +8 -40
- package/dist/esm/index.js +1 -0
- package/dist/esm/inline/loader.js +3 -40
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +4 -23
- package/dist/esm/inline/mediaInlineCard.js +21 -40
- package/dist/esm/types.js +1 -1
- package/dist/esm/utils/analytics.js +0 -6
- package/dist/esm/utils/breakpoint.js +0 -5
- package/dist/esm/utils/cardActions/cardActionIconButton.js +7 -18
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +6 -19
- package/dist/esm/utils/cardActions/cardActionsView.js +7 -22
- package/dist/esm/utils/cardActions/styles.js +0 -5
- package/dist/esm/utils/cardDimensions.js +7 -14
- package/dist/esm/utils/dimensionComparer.js +0 -3
- package/dist/esm/utils/document.js +0 -2
- package/dist/esm/utils/errorIcon/index.js +0 -9
- package/dist/esm/utils/errorIcon/styles.js +0 -2
- package/dist/esm/utils/fileIcon/index.js +3 -11
- package/dist/esm/utils/fileIcon/styles.js +0 -2
- package/dist/esm/utils/getDataURIDimension.js +0 -4
- package/dist/esm/utils/getMediaCardCursor.js +1 -4
- package/dist/esm/utils/globalScope/getSSRData.js +0 -2
- package/dist/esm/utils/globalScope/globalScope.js +8 -15
- package/dist/esm/utils/lightCards/cardError.js +0 -9
- package/dist/esm/utils/lightCards/cardLoading.js +3 -13
- package/dist/esm/utils/lightCards/lightCardWrappers.js +0 -1
- package/dist/esm/utils/lightCards/styles.js +1 -3
- package/dist/esm/utils/metadata.js +0 -5
- package/dist/esm/utils/objectURLCache.js +0 -15
- package/dist/esm/utils/printScript.js +0 -5
- package/dist/esm/utils/progressBar/index.js +0 -9
- package/dist/esm/utils/progressBar/styles.js +0 -2
- package/dist/esm/utils/shouldDisplayImageThumbnail.js +0 -2
- package/dist/esm/utils/ufoExperiences.js +1 -12
- package/dist/esm/utils/videoSnapshot.js +2 -6
- package/dist/esm/utils/viewportDetector.js +5 -16
- package/dist/esm/version.json +1 -1
- package/dist/types/card/card.d.ts +3 -0
- package/dist/types/card/getCardPreview/index.d.ts +2 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +6 -4
- package/report.api.md +2 -0
package/dist/esm/errors.js
CHANGED
|
@@ -5,127 +5,96 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
8
|
-
|
|
9
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* Primary reason is logged through Data Portal.
|
|
15
12
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
16
13
|
*/
|
|
14
|
+
|
|
17
15
|
export var MediaCardError = /*#__PURE__*/function (_Error) {
|
|
18
16
|
_inherits(MediaCardError, _Error);
|
|
19
|
-
|
|
20
17
|
var _super = _createSuper(MediaCardError);
|
|
21
|
-
|
|
22
18
|
function MediaCardError(primaryReason, secondaryError) {
|
|
23
19
|
var _this;
|
|
24
|
-
|
|
25
20
|
_classCallCheck(this, MediaCardError);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
_this = _super.call(this, primaryReason);
|
|
22
|
+
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
29
23
|
_this.primaryReason = primaryReason;
|
|
30
24
|
_this.secondaryError = secondaryError;
|
|
31
|
-
Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof MediaCardError ? this.constructor : void 0).prototype);
|
|
25
|
+
Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof MediaCardError ? this.constructor : void 0).prototype);
|
|
32
26
|
|
|
27
|
+
// https://v8.dev/docs/stack-trace-api
|
|
33
28
|
if ('captureStackTrace' in Error) {
|
|
34
29
|
Error.captureStackTrace(_assertThisInitialized(_this), this instanceof MediaCardError ? this.constructor : void 0);
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
return _this;
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
return _createClass(MediaCardError);
|
|
41
34
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
42
35
|
export var LocalPreviewError = /*#__PURE__*/function (_MediaCardError) {
|
|
43
36
|
_inherits(LocalPreviewError, _MediaCardError);
|
|
44
|
-
|
|
45
37
|
var _super2 = _createSuper(LocalPreviewError);
|
|
46
|
-
|
|
47
38
|
function LocalPreviewError(primaryReason, secondaryError) {
|
|
48
39
|
var _this2;
|
|
49
|
-
|
|
50
40
|
_classCallCheck(this, LocalPreviewError);
|
|
51
|
-
|
|
52
41
|
_this2 = _super2.call(this, primaryReason, secondaryError);
|
|
53
42
|
_this2.primaryReason = primaryReason;
|
|
54
43
|
_this2.secondaryError = secondaryError;
|
|
55
44
|
return _this2;
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
return _createClass(LocalPreviewError);
|
|
59
47
|
}(MediaCardError);
|
|
60
48
|
export var RemotePreviewError = /*#__PURE__*/function (_MediaCardError2) {
|
|
61
49
|
_inherits(RemotePreviewError, _MediaCardError2);
|
|
62
|
-
|
|
63
50
|
var _super3 = _createSuper(RemotePreviewError);
|
|
64
|
-
|
|
65
51
|
function RemotePreviewError(primaryReason, secondaryError) {
|
|
66
52
|
var _this3;
|
|
67
|
-
|
|
68
53
|
_classCallCheck(this, RemotePreviewError);
|
|
69
|
-
|
|
70
54
|
_this3 = _super3.call(this, primaryReason, secondaryError);
|
|
71
55
|
_this3.primaryReason = primaryReason;
|
|
72
56
|
_this3.secondaryError = secondaryError;
|
|
73
57
|
return _this3;
|
|
74
58
|
}
|
|
75
|
-
|
|
76
59
|
return _createClass(RemotePreviewError);
|
|
77
60
|
}(MediaCardError);
|
|
78
61
|
export var SsrPreviewError = /*#__PURE__*/function (_MediaCardError3) {
|
|
79
62
|
_inherits(SsrPreviewError, _MediaCardError3);
|
|
80
|
-
|
|
81
63
|
var _super4 = _createSuper(SsrPreviewError);
|
|
82
|
-
|
|
83
64
|
function SsrPreviewError(primaryReason, secondaryError) {
|
|
84
65
|
var _this4;
|
|
85
|
-
|
|
86
66
|
_classCallCheck(this, SsrPreviewError);
|
|
87
|
-
|
|
88
67
|
_this4 = _super4.call(this, primaryReason, secondaryError);
|
|
89
68
|
_this4.primaryReason = primaryReason;
|
|
90
69
|
_this4.secondaryError = secondaryError;
|
|
91
70
|
return _this4;
|
|
92
71
|
}
|
|
93
|
-
|
|
94
72
|
return _createClass(SsrPreviewError);
|
|
95
73
|
}(MediaCardError);
|
|
96
74
|
export var getImageLoadPrimaryReason = function getImageLoadPrimaryReason(source) {
|
|
97
75
|
switch (source) {
|
|
98
76
|
case 'cache-remote':
|
|
99
77
|
return 'cache-remote-uri';
|
|
100
|
-
|
|
101
78
|
case 'cache-local':
|
|
102
79
|
return 'cache-local-uri';
|
|
103
|
-
|
|
104
80
|
case 'external':
|
|
105
81
|
return 'external-uri';
|
|
106
|
-
|
|
107
82
|
case 'local':
|
|
108
83
|
return 'local-uri';
|
|
109
|
-
|
|
110
84
|
case 'remote':
|
|
111
85
|
return 'remote-uri';
|
|
112
86
|
// This fail reason will come from a bug, most likely.
|
|
113
|
-
|
|
114
87
|
default:
|
|
115
88
|
return "unknown-uri";
|
|
116
89
|
}
|
|
117
90
|
};
|
|
118
91
|
export var ImageLoadError = /*#__PURE__*/function (_MediaCardError4) {
|
|
119
92
|
_inherits(ImageLoadError, _MediaCardError4);
|
|
120
|
-
|
|
121
93
|
var _super5 = _createSuper(ImageLoadError);
|
|
122
|
-
|
|
123
94
|
function ImageLoadError(source) {
|
|
124
95
|
_classCallCheck(this, ImageLoadError);
|
|
125
|
-
|
|
126
96
|
return _super5.call(this, getImageLoadPrimaryReason(source));
|
|
127
97
|
}
|
|
128
|
-
|
|
129
98
|
return _createClass(ImageLoadError);
|
|
130
99
|
}(MediaCardError);
|
|
131
100
|
export function isMediaCardError(err) {
|
|
@@ -142,19 +111,18 @@ export var isUnsupportedLocalPreviewError = function isUnsupportedLocalPreviewEr
|
|
|
142
111
|
};
|
|
143
112
|
export function isImageLoadError(err) {
|
|
144
113
|
return err instanceof ImageLoadError;
|
|
145
|
-
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// In a try/catch statement, the error caught is the type of unknown.
|
|
146
117
|
// We can use this helper to ensure that the error handled is the type of MediaCardError if unsure
|
|
147
118
|
// If updatePrimaryReason is true, if it's a MediaCardError already, it will update it's primary reason
|
|
148
|
-
|
|
149
119
|
export var ensureMediaCardError = function ensureMediaCardError(primaryReason, error, updatePrimaryReason) {
|
|
150
120
|
if (isMediaCardError(error)) {
|
|
151
121
|
if (updatePrimaryReason && error.primaryReason !== primaryReason) {
|
|
152
122
|
return new MediaCardError(primaryReason, error.secondaryError);
|
|
153
123
|
}
|
|
154
|
-
|
|
155
124
|
return error;
|
|
156
125
|
}
|
|
157
|
-
|
|
158
126
|
return new MediaCardError(primaryReason, error);
|
|
159
127
|
};
|
|
160
128
|
export var isUploadError = function isUploadError(error) {
|
package/dist/esm/index.js
CHANGED
|
@@ -8,67 +8,44 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
|
|
12
11
|
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
12
|
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
13
|
import React from 'react';
|
|
17
14
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
18
|
-
|
|
19
15
|
var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
20
16
|
_inherits(MediaInlineCardLoader, _React$PureComponent);
|
|
21
|
-
|
|
22
17
|
var _super = _createSuper(MediaInlineCardLoader);
|
|
23
|
-
|
|
24
18
|
function MediaInlineCardLoader() {
|
|
25
19
|
var _this;
|
|
26
|
-
|
|
27
20
|
_classCallCheck(this, MediaInlineCardLoader);
|
|
28
|
-
|
|
29
21
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
22
|
args[_key] = arguments[_key];
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
-
|
|
35
25
|
_defineProperty(_assertThisInitialized(_this), "isMounted", false);
|
|
36
|
-
|
|
37
26
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
38
27
|
MediaInlineCard: MediaInlineCardLoader.MediaInlineCard,
|
|
39
28
|
ErrorBoundary: MediaInlineCardLoader.ErrorBoundary
|
|
40
29
|
});
|
|
41
|
-
|
|
42
30
|
return _this;
|
|
43
31
|
}
|
|
44
|
-
|
|
45
32
|
_createClass(MediaInlineCardLoader, [{
|
|
46
33
|
key: "componentDidMount",
|
|
47
34
|
value: function () {
|
|
48
35
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
49
36
|
var _yield$Promise$all, _yield$Promise$all2, mediaClient, cardModule, mediaInlineErrorBoundaryModule;
|
|
50
|
-
|
|
51
37
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
52
38
|
while (1) {
|
|
53
39
|
switch (_context.prev = _context.next) {
|
|
54
40
|
case 0:
|
|
55
41
|
this.isMounted = true;
|
|
56
|
-
|
|
57
42
|
if (this.state.MediaInlineCard) {
|
|
58
43
|
_context.next = 17;
|
|
59
44
|
break;
|
|
60
45
|
}
|
|
61
|
-
|
|
62
46
|
_context.prev = 2;
|
|
63
47
|
_context.next = 5;
|
|
64
|
-
return Promise.all([import(
|
|
65
|
-
/* webpackChunkName: "@atlaskit-internal_media-client" */
|
|
66
|
-
'@atlaskit/media-client'), import(
|
|
67
|
-
/* webpackChunkName: "@atlaskit-internal_inline-media-card" */
|
|
68
|
-
'./mediaInlineCard'), import(
|
|
69
|
-
/* webpackChunkName: "@atlaskit-internal_media-inline-error-boundary" */
|
|
70
|
-
'./mediaInlineAnalyticsErrorBoundary')]);
|
|
71
|
-
|
|
48
|
+
return Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client" */'@atlaskit/media-client'), import( /* webpackChunkName: "@atlaskit-internal_inline-media-card" */'./mediaInlineCard'), import( /* webpackChunkName: "@atlaskit-internal_media-inline-error-boundary" */'./mediaInlineAnalyticsErrorBoundary')]);
|
|
72
49
|
case 5:
|
|
73
50
|
_yield$Promise$all = _context.sent;
|
|
74
51
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
@@ -77,21 +54,17 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
77
54
|
mediaInlineErrorBoundaryModule = _yield$Promise$all2[2];
|
|
78
55
|
MediaInlineCardLoader.MediaInlineCard = mediaClient.withMediaClient(cardModule.MediaInlineCard);
|
|
79
56
|
MediaInlineCardLoader.ErrorBoundary = mediaInlineErrorBoundaryModule.default;
|
|
80
|
-
|
|
81
57
|
if (this.isMounted) {
|
|
82
58
|
this.setState({
|
|
83
59
|
MediaInlineCard: MediaInlineCardLoader.MediaInlineCard,
|
|
84
60
|
ErrorBoundary: MediaInlineCardLoader.ErrorBoundary
|
|
85
61
|
});
|
|
86
62
|
}
|
|
87
|
-
|
|
88
63
|
_context.next = 17;
|
|
89
64
|
break;
|
|
90
|
-
|
|
91
65
|
case 15:
|
|
92
66
|
_context.prev = 15;
|
|
93
67
|
_context.t0 = _context["catch"](2);
|
|
94
|
-
|
|
95
68
|
case 17:
|
|
96
69
|
case "end":
|
|
97
70
|
return _context.stop();
|
|
@@ -99,11 +72,9 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
99
72
|
}
|
|
100
73
|
}, _callee, this, [[2, 15]]);
|
|
101
74
|
}));
|
|
102
|
-
|
|
103
75
|
function componentDidMount() {
|
|
104
76
|
return _componentDidMount.apply(this, arguments);
|
|
105
77
|
}
|
|
106
|
-
|
|
107
78
|
return componentDidMount;
|
|
108
79
|
}()
|
|
109
80
|
}, {
|
|
@@ -115,7 +86,6 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
115
86
|
switch (_context2.prev = _context2.next) {
|
|
116
87
|
case 0:
|
|
117
88
|
this.isMounted = false;
|
|
118
|
-
|
|
119
89
|
case 1:
|
|
120
90
|
case "end":
|
|
121
91
|
return _context2.stop();
|
|
@@ -123,33 +93,26 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
123
93
|
}
|
|
124
94
|
}, _callee2, this);
|
|
125
95
|
}));
|
|
126
|
-
|
|
127
96
|
function componentWillUnmount() {
|
|
128
97
|
return _componentWillUnmount.apply(this, arguments);
|
|
129
98
|
}
|
|
130
|
-
|
|
131
99
|
return componentWillUnmount;
|
|
132
100
|
}()
|
|
133
101
|
}, {
|
|
134
102
|
key: "render",
|
|
135
103
|
value: function render() {
|
|
136
104
|
var _this$state = this.state,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
105
|
+
MediaInlineCard = _this$state.MediaInlineCard,
|
|
106
|
+
ErrorBoundary = _this$state.ErrorBoundary;
|
|
140
107
|
if (!MediaInlineCard || !ErrorBoundary) {
|
|
141
108
|
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
142
109
|
message: ""
|
|
143
110
|
});
|
|
144
111
|
}
|
|
145
|
-
|
|
146
112
|
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(MediaInlineCard, this.props));
|
|
147
113
|
}
|
|
148
114
|
}]);
|
|
149
|
-
|
|
150
115
|
return MediaInlineCardLoader;
|
|
151
116
|
}(React.PureComponent);
|
|
152
|
-
|
|
153
117
|
_defineProperty(MediaInlineCardLoader, "displayName", 'MediaInlineCardLoader');
|
|
154
|
-
|
|
155
118
|
export { MediaInlineCardLoader as default };
|
|
@@ -5,39 +5,27 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
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; }
|
|
10
|
-
|
|
11
9
|
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; }
|
|
12
|
-
|
|
13
10
|
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); }; }
|
|
14
|
-
|
|
15
11
|
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; } }
|
|
16
|
-
|
|
17
12
|
import React from 'react';
|
|
18
13
|
import { withMediaAnalyticsContext } from '@atlaskit/media-common';
|
|
19
14
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
20
15
|
import { fireMediaCardEvent } from '../utils/analytics';
|
|
21
|
-
|
|
22
16
|
var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
23
17
|
_inherits(WrappedMediaInlineAnalyticsErrorBoundary, _React$Component);
|
|
24
|
-
|
|
25
18
|
var _super = _createSuper(WrappedMediaInlineAnalyticsErrorBoundary);
|
|
26
|
-
|
|
27
19
|
function WrappedMediaInlineAnalyticsErrorBoundary(props) {
|
|
28
20
|
var _this;
|
|
29
|
-
|
|
30
21
|
_classCallCheck(this, WrappedMediaInlineAnalyticsErrorBoundary);
|
|
31
|
-
|
|
32
22
|
_this = _super.call(this, props);
|
|
33
|
-
|
|
34
23
|
_defineProperty(_assertThisInitialized(_this), "fireOperationalEvent", function (error, info) {
|
|
35
24
|
var _window, _window$navigator;
|
|
36
|
-
|
|
37
25
|
var _this$props = _this.props,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
_this$props$data = _this$props.data,
|
|
27
|
+
data = _this$props$data === void 0 ? {} : _this$props$data,
|
|
28
|
+
createAnalyticsEvent = _this$props.createAnalyticsEvent;
|
|
41
29
|
var payload = {
|
|
42
30
|
eventType: 'operational',
|
|
43
31
|
action: 'failed',
|
|
@@ -51,13 +39,11 @@ var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Com
|
|
|
51
39
|
};
|
|
52
40
|
fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
53
41
|
});
|
|
54
|
-
|
|
55
42
|
_this.state = {
|
|
56
43
|
hasError: false
|
|
57
44
|
};
|
|
58
45
|
return _this;
|
|
59
46
|
}
|
|
60
|
-
|
|
61
47
|
_createClass(WrappedMediaInlineAnalyticsErrorBoundary, [{
|
|
62
48
|
key: "componentDidCatch",
|
|
63
49
|
value: function componentDidCatch(error, info) {
|
|
@@ -73,23 +59,18 @@ var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Com
|
|
|
73
59
|
value: function render() {
|
|
74
60
|
var hasError = this.state.hasError;
|
|
75
61
|
var children = this.props.children;
|
|
76
|
-
|
|
77
62
|
if (hasError) {
|
|
78
63
|
// TODO refactor error boundary for inline card https://product-fabric.atlassian.net/browse/MEX-2140
|
|
79
64
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
80
65
|
}
|
|
81
|
-
|
|
82
66
|
return children;
|
|
83
67
|
}
|
|
84
68
|
}]);
|
|
85
|
-
|
|
86
69
|
return WrappedMediaInlineAnalyticsErrorBoundary;
|
|
87
70
|
}(React.Component);
|
|
88
|
-
|
|
89
71
|
_defineProperty(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
|
|
90
|
-
|
|
91
72
|
var packageName = "@atlaskit/media-card";
|
|
92
|
-
var packageVersion = "74.
|
|
73
|
+
var packageVersion = "74.6.0";
|
|
93
74
|
var MediaInlineAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
94
75
|
packageVersion: packageVersion,
|
|
95
76
|
packageName: packageName,
|
|
@@ -10,42 +10,35 @@ import { formatDate } from '@atlaskit/media-ui/formatDate';
|
|
|
10
10
|
// UI component which renders an inline link in the appropiate state based on a media file
|
|
11
11
|
export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
12
12
|
var mediaClient = _ref.mediaClient,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
identifier = _ref.identifier,
|
|
14
|
+
shouldOpenMediaViewer = _ref.shouldOpenMediaViewer,
|
|
15
|
+
isSelected = _ref.isSelected,
|
|
16
|
+
onClick = _ref.onClick,
|
|
17
|
+
mediaViewerDataSource = _ref.mediaViewerDataSource,
|
|
18
|
+
intl = _ref.intl;
|
|
20
19
|
var _useState = useState(),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
fileState = _useState2[0],
|
|
22
|
+
setFileState = _useState2[1];
|
|
25
23
|
var _useState3 = useState(false),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
isErrored = _useState4[0],
|
|
26
|
+
setIsErrored = _useState4[1];
|
|
30
27
|
var _useState5 = useState(false),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
29
|
+
isMediaViewerVisible = _useState6[0],
|
|
30
|
+
setMediaViewerVisible = _useState6[1];
|
|
35
31
|
var onMediaInlineCardClick = function onMediaInlineCardClick(event) {
|
|
36
32
|
if (shouldOpenMediaViewer) {
|
|
37
33
|
setMediaViewerVisible(true);
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
if (onClick) {
|
|
41
36
|
onClick(event);
|
|
42
37
|
}
|
|
43
38
|
};
|
|
44
|
-
|
|
45
39
|
var onMediaViewerClose = function onMediaViewerClose() {
|
|
46
40
|
return setMediaViewerVisible(false);
|
|
47
41
|
};
|
|
48
|
-
|
|
49
42
|
var renderMediaViewer = function renderMediaViewer() {
|
|
50
43
|
if (isMediaViewerVisible) {
|
|
51
44
|
var dataSource = mediaViewerDataSource || {
|
|
@@ -59,16 +52,13 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
59
52
|
onClose: onMediaViewerClose
|
|
60
53
|
}), document.body);
|
|
61
54
|
}
|
|
62
|
-
|
|
63
55
|
return null;
|
|
64
56
|
};
|
|
65
|
-
|
|
66
57
|
var renderContent = function renderContent(children) {
|
|
67
58
|
return intl ? children : /*#__PURE__*/React.createElement(IntlProvider, {
|
|
68
59
|
locale: "en"
|
|
69
60
|
}, children);
|
|
70
61
|
};
|
|
71
|
-
|
|
72
62
|
var defaultIntl = createIntl({
|
|
73
63
|
locale: 'en'
|
|
74
64
|
});
|
|
@@ -88,45 +78,39 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
88
78
|
subscription.unsubscribe();
|
|
89
79
|
};
|
|
90
80
|
}, [identifier.collectionName, identifier.id, mediaClient.file]);
|
|
91
|
-
|
|
92
81
|
if (!fileState) {
|
|
93
82
|
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
94
83
|
message: (intl || defaultIntl).formatMessage(messages.loading_file),
|
|
95
84
|
isSelected: isSelected
|
|
96
85
|
});
|
|
97
86
|
}
|
|
98
|
-
|
|
99
87
|
if (isErrored) {
|
|
100
88
|
return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
|
|
101
89
|
message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file),
|
|
102
90
|
isSelected: isSelected
|
|
103
91
|
});
|
|
104
92
|
}
|
|
105
|
-
|
|
106
93
|
if (fileState.status === 'error') {
|
|
107
94
|
return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
|
|
108
95
|
message: fileState.message || '',
|
|
109
96
|
isSelected: isSelected
|
|
110
97
|
});
|
|
111
98
|
}
|
|
112
|
-
|
|
113
99
|
if (fileState.status === 'failed-processing') {
|
|
114
100
|
return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
|
|
115
101
|
message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file),
|
|
116
102
|
isSelected: isSelected
|
|
117
103
|
});
|
|
118
104
|
}
|
|
119
|
-
|
|
120
105
|
if (fileState.status === 'uploading') {
|
|
121
106
|
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
122
107
|
message: fileState.name,
|
|
123
108
|
isSelected: isSelected
|
|
124
109
|
});
|
|
125
110
|
}
|
|
126
|
-
|
|
127
111
|
var mediaType = fileState.mediaType,
|
|
128
|
-
|
|
129
|
-
|
|
112
|
+
name = fileState.name,
|
|
113
|
+
mimeType = fileState.mimeType;
|
|
130
114
|
var linkIcon = /*#__PURE__*/React.createElement(MimeTypeIcon, {
|
|
131
115
|
testId: 'media-inline-card-file-type-icon',
|
|
132
116
|
size: "small",
|
|
@@ -136,17 +120,14 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
136
120
|
});
|
|
137
121
|
var mediaViewer = renderMediaViewer();
|
|
138
122
|
var formattedDate;
|
|
139
|
-
|
|
140
123
|
if (fileState.createdAt) {
|
|
141
124
|
var _ref2 = intl || {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
125
|
+
locale: 'en'
|
|
126
|
+
},
|
|
127
|
+
_ref2$locale = _ref2.locale,
|
|
128
|
+
locale = _ref2$locale === void 0 ? 'en' : _ref2$locale;
|
|
147
129
|
formattedDate = formatDate(fileState.createdAt, locale);
|
|
148
130
|
}
|
|
149
|
-
|
|
150
131
|
return renderContent( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
151
132
|
position: "bottom",
|
|
152
133
|
content: formattedDate,
|
package/dist/esm/types.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
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
3
|
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
4
|
import { getMediaClientErrorReason, isRequestError } from '@atlaskit/media-client';
|
|
8
5
|
import { ANALYTICS_MEDIA_CHANNEL, filterFeatureFlagNames, filterFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
9
6
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
@@ -113,12 +110,10 @@ export var getRenderErrorFailReason = function getRenderErrorFailReason(error) {
|
|
|
113
110
|
export var getRenderErrorErrorReason = function getRenderErrorErrorReason(error) {
|
|
114
111
|
if (isMediaCardError(error) && error.secondaryError) {
|
|
115
112
|
var mediaClientReason = getMediaClientErrorReason(error.secondaryError);
|
|
116
|
-
|
|
117
113
|
if (mediaClientReason !== 'unknown') {
|
|
118
114
|
return mediaClientReason;
|
|
119
115
|
}
|
|
120
116
|
}
|
|
121
|
-
|
|
122
117
|
return 'nativeError';
|
|
123
118
|
};
|
|
124
119
|
export var getRenderErrorErrorDetail = function getRenderErrorErrorDetail(error) {
|
|
@@ -131,7 +126,6 @@ export var getRenderErrorErrorDetail = function getRenderErrorErrorDetail(error)
|
|
|
131
126
|
export var getErrorTraceContext = function getErrorTraceContext(error) {
|
|
132
127
|
if (isMediaCardError(error) && !!error.secondaryError && isRequestError(error.secondaryError)) {
|
|
133
128
|
var _error$secondaryError;
|
|
134
|
-
|
|
135
129
|
return (_error$secondaryError = error.secondaryError.metadata) === null || _error$secondaryError === void 0 ? void 0 : _error$secondaryError.traceContext;
|
|
136
130
|
}
|
|
137
131
|
};
|
|
@@ -2,7 +2,6 @@ import { size } from '@atlaskit/media-ui';
|
|
|
2
2
|
export var breakpointSize = function breakpointSize(width) {
|
|
3
3
|
var sizes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : cardBreakpointSizes;
|
|
4
4
|
var value = parseInt("".concat(width), 10); // Normalize value
|
|
5
|
-
|
|
6
5
|
var keys = Object.keys(sizes);
|
|
7
6
|
var defaultValue = keys[0];
|
|
8
7
|
var breakpoint;
|
|
@@ -21,17 +20,13 @@ export var cardBreakpointSizes = {
|
|
|
21
20
|
};
|
|
22
21
|
export var breakpointStyles = function breakpointStyles(_ref) {
|
|
23
22
|
var breakpointSize = _ref.breakpointSize;
|
|
24
|
-
|
|
25
23
|
switch (breakpointSize) {
|
|
26
24
|
case 'small':
|
|
27
25
|
return "\n .title {\n font-size: 12px;\n }\n .file-type-icon span {\n // We need to use important here since we can't use the dimensions provided by the Icon component\n ".concat(size('14px !important'), "\n }\n ");
|
|
28
|
-
|
|
29
26
|
case 'medium':
|
|
30
27
|
return "\n .title {\n font-size: 14px;\n }\n .file-type-icon span {\n ".concat(size('16px !important'), "\n }\n ");
|
|
31
|
-
|
|
32
28
|
case 'large':
|
|
33
29
|
return "\n .overlay {\n padding: 24px;\n }\n .title {\n font-size: 14px;\n }\n .file-size {\n font-size: 14px;\n }\n .file-type-icon span {\n ".concat(size('18px !important'), "\n }\n ");
|
|
34
|
-
|
|
35
30
|
case 'xlarge':
|
|
36
31
|
return "\n border-radius: 2px;\n\n .title {\n font-size: 16px;\n }\n\n .file-size {\n font-size: 14px;\n }\n \n .wrapper, .img-wrapper {\n border-radius: 2px;\n }\n\n .overlay {\n padding: 24px;\n }\n\n .file-type-icon span {\n ".concat(size('18px !important'), "\n }\n ");
|
|
37
32
|
}
|
|
@@ -5,45 +5,34 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
10
|
import React from 'react';
|
|
14
11
|
import { Component } from 'react';
|
|
15
12
|
import { CardActionButton } from './cardActionButton';
|
|
16
13
|
export var CardActionIconButton = /*#__PURE__*/function (_Component) {
|
|
17
14
|
_inherits(CardActionIconButton, _Component);
|
|
18
|
-
|
|
19
15
|
var _super = _createSuper(CardActionIconButton);
|
|
20
|
-
|
|
21
16
|
function CardActionIconButton() {
|
|
22
17
|
var _this;
|
|
23
|
-
|
|
24
18
|
_classCallCheck(this, CardActionIconButton);
|
|
25
|
-
|
|
26
19
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
20
|
args[_key] = arguments[_key];
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
-
|
|
32
23
|
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (event) {
|
|
33
24
|
event.preventDefault();
|
|
34
25
|
});
|
|
35
|
-
|
|
36
26
|
return _this;
|
|
37
27
|
}
|
|
38
|
-
|
|
39
28
|
_createClass(CardActionIconButton, [{
|
|
40
29
|
key: "render",
|
|
41
30
|
value: function render() {
|
|
42
31
|
var _this$props = this.props,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
icon = _this$props.icon,
|
|
33
|
+
triggerColor = _this$props.triggerColor,
|
|
34
|
+
onClick = _this$props.onClick,
|
|
35
|
+
variant = _this$props.variant;
|
|
47
36
|
return /*#__PURE__*/React.createElement(CardActionButton, {
|
|
48
37
|
onClick: onClick,
|
|
49
38
|
onMouseDown: this.onMouseDown,
|
|
@@ -52,10 +41,10 @@ export var CardActionIconButton = /*#__PURE__*/function (_Component) {
|
|
|
52
41
|
},
|
|
53
42
|
variant: variant
|
|
54
43
|
}, icon);
|
|
55
|
-
}
|
|
56
|
-
// this does not prevent onclick behavior
|
|
44
|
+
}
|
|
57
45
|
|
|
46
|
+
// this is to prevent currently focused text to loose cursor on clicking card action
|
|
47
|
+
// this does not prevent onclick behavior
|
|
58
48
|
}]);
|
|
59
|
-
|
|
60
49
|
return CardActionIconButton;
|
|
61
50
|
}(Component);
|