@atlaskit/media-card 72.1.0 → 73.2.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 +89 -0
- package/dist/cjs/actions.js +2 -2
- package/dist/cjs/errors.js +11 -7
- package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
- package/dist/cjs/files/cardImageView/index.js +52 -42
- package/dist/cjs/files/cardImageView/styled.js +1 -1
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/root/card/cardAnalytics.js +2 -2
- package/dist/cjs/root/card/cardState.js +2 -2
- package/dist/cjs/root/card/getCardPreview/cache.js +5 -5
- package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +4 -1
- package/dist/cjs/root/card/getCardPreview/helpers.js +1 -1
- package/dist/cjs/root/card/getCardPreview/index.js +18 -9
- package/dist/cjs/root/card/getCardStatus.js +1 -1
- package/dist/cjs/root/card/index.js +279 -159
- package/dist/cjs/root/cardView.js +130 -118
- package/dist/cjs/root/inline/loader.js +45 -14
- package/dist/cjs/root/inline/mediaInlineCard.js +24 -9
- package/dist/cjs/root/inlinePlayer.js +80 -25
- 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 +1 -1
- package/dist/cjs/root/ui/iconMessage/index.js +5 -3
- package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +14 -6
- package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +4 -2
- 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 +5 -2
- package/dist/cjs/root/ui/progressBar/styled.js +7 -6
- package/dist/cjs/root/ui/styled.js +6 -6
- package/dist/cjs/root/ui/tickBox/styled.js +1 -1
- package/dist/cjs/root/ui/titleBox/failedTitleBox.js +4 -2
- package/dist/cjs/root/ui/titleBox/styled.js +1 -1
- 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/types.js +10 -1
- package/dist/cjs/utils/analytics.js +24 -7
- package/dist/cjs/utils/breakpoint.js +1 -1
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +3 -1
- 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 +7 -13
- package/dist/cjs/utils/getErrorMessage.js +2 -2
- package/dist/cjs/utils/getMediaCardCursor.js +29 -0
- package/dist/cjs/utils/globalScope/getSSRData.js +20 -0
- package/dist/cjs/utils/globalScope/globalScope.js +94 -0
- package/dist/cjs/utils/globalScope/index.js +39 -0
- package/dist/cjs/utils/globalScope/types.js +5 -0
- package/dist/cjs/utils/index.js +46 -46
- package/dist/cjs/utils/lightCards/styled.js +1 -1
- package/dist/cjs/utils/objectURLCache.js +1 -1
- package/dist/cjs/utils/printScript.js +44 -0
- package/dist/cjs/utils/viewportDetector.js +49 -22
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/files/cardImageView/index.js +19 -5
- package/dist/es2019/root/card/cardAnalytics.js +1 -1
- package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +4 -1
- package/dist/es2019/root/card/getCardPreview/index.js +1 -0
- package/dist/es2019/root/card/index.js +150 -49
- package/dist/es2019/root/cardView.js +40 -30
- package/dist/es2019/root/inline/loader.js +15 -4
- package/dist/es2019/root/inline/mediaInlineCard.js +23 -8
- package/dist/es2019/root/inlinePlayer.js +59 -5
- package/dist/es2019/root/styled.js +2 -1
- package/dist/es2019/root/ui/iconMessage/index.js +3 -2
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +14 -6
- package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +3 -2
- package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/es2019/root/ui/progressBar/progressBar.js +4 -2
- package/dist/es2019/root/ui/progressBar/styled.js +6 -4
- package/dist/es2019/root/ui/styled.js +5 -5
- package/dist/es2019/root/ui/titleBox/failedTitleBox.js +3 -2
- package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
- package/dist/es2019/types.js +7 -1
- package/dist/es2019/utils/analytics.js +8 -3
- package/dist/es2019/utils/dimensionComparer.js +6 -13
- package/dist/es2019/utils/getErrorMessage.js +1 -1
- package/dist/es2019/utils/getMediaCardCursor.js +19 -0
- package/dist/es2019/utils/globalScope/getSSRData.js +10 -0
- package/dist/es2019/utils/globalScope/globalScope.js +62 -0
- package/dist/es2019/utils/globalScope/index.js +2 -0
- package/dist/es2019/utils/globalScope/types.js +1 -0
- package/dist/es2019/utils/printScript.js +19 -0
- 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 +6 -5
- package/dist/esm/files/cardImageView/index.js +53 -41
- package/dist/esm/root/card/cardAnalytics.js +1 -1
- package/dist/esm/root/card/cardState.js +2 -2
- package/dist/esm/root/card/getCardPreview/cache.js +3 -2
- package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +4 -1
- package/dist/esm/root/card/getCardPreview/index.js +5 -2
- package/dist/esm/root/card/index.js +266 -145
- package/dist/esm/root/cardView.js +128 -117
- package/dist/esm/root/inline/loader.js +46 -14
- package/dist/esm/root/inline/mediaInlineCard.js +23 -8
- package/dist/esm/root/inlinePlayer.js +77 -24
- package/dist/esm/root/styled.js +3 -2
- package/dist/esm/root/ui/iconMessage/index.js +3 -2
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +14 -6
- package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +3 -2
- package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/esm/root/ui/progressBar/progressBar.js +5 -2
- package/dist/esm/root/ui/progressBar/styled.js +6 -5
- package/dist/esm/root/ui/styled.js +5 -5
- package/dist/esm/root/ui/titleBox/failedTitleBox.js +3 -2
- package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
- package/dist/esm/types.js +7 -1
- package/dist/esm/utils/analytics.js +17 -6
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +2 -1
- package/dist/esm/utils/dimensionComparer.js +8 -13
- package/dist/esm/utils/getErrorMessage.js +1 -1
- package/dist/esm/utils/getMediaCardCursor.js +19 -0
- package/dist/esm/utils/globalScope/getSSRData.js +10 -0
- package/dist/esm/utils/globalScope/globalScope.js +69 -0
- package/dist/esm/utils/globalScope/index.js +2 -0
- package/dist/esm/utils/globalScope/types.js +1 -0
- package/dist/esm/utils/printScript.js +30 -0
- package/dist/esm/utils/viewportDetector.js +48 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/files/cardImageView/index.d.ts +6 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/root/card/cardLoader.d.ts +2 -2
- package/dist/types/root/card/getCardPreview/index.d.ts +1 -0
- package/dist/types/root/card/index.d.ts +10 -9
- package/dist/types/root/cardView.d.ts +10 -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 +10 -1
- package/dist/types/root/styled.d.ts +1 -0
- package/dist/types/root/ui/iconMessage/index.d.ts +2 -2
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +4 -4
- package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +1 -0
- package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
- package/dist/types/root/ui/progressBar/progressBar.d.ts +3 -1
- package/dist/types/root/ui/progressBar/styled.d.ts +2 -1
- package/dist/types/root/ui/styled.d.ts +2 -1
- package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +2 -2
- package/dist/types/root/ui/titleBox/titleBox.d.ts +1 -9
- package/dist/types/types.d.ts +6 -1
- package/dist/types/utils/analytics.d.ts +6 -0
- package/dist/types/utils/getErrorMessage.d.ts +1 -0
- package/dist/types/utils/getMediaCardCursor.d.ts +2 -0
- package/dist/types/utils/globalScope/getSSRData.d.ts +3 -0
- package/dist/types/utils/globalScope/globalScope.d.ts +21 -0
- package/dist/types/utils/globalScope/index.d.ts +4 -0
- package/dist/types/utils/globalScope/types.d.ts +8 -0
- package/dist/types/utils/printScript.d.ts +2 -0
- package/dist/types/utils/viewportDetector.d.ts +13 -5
- package/package.json +14 -16
- package/dist/cjs/utils/lazyContent/index.js +0 -56
- package/dist/cjs/utils/lazyContent/styled.js +0 -23
- package/dist/es2019/utils/lazyContent/index.js +0 -18
- package/dist/es2019/utils/lazyContent/styled.js +0 -12
- package/dist/esm/utils/lazyContent/index.js +0 -41
- package/dist/esm/utils/lazyContent/styled.js +0 -14
- package/dist/types/utils/lazyContent/index.d.ts +0 -11
- package/dist/types/utils/lazyContent/styled.d.ts +0 -5
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.
|
|
10
|
+
exports.blinkLoadingAnimation = exports.Wrapper = exports.AnimatedWrapper = void 0;
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.createObjectURLCache = exports.
|
|
8
|
+
exports.createObjectURLCache = exports.PREVIEW_CACHE_LRU_SIZE = exports.ObjectURLCache = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.printScript = exports.printFunctionCall = void 0;
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var printParam = function printParam(param) {
|
|
13
|
+
if (typeof param === 'string') {
|
|
14
|
+
return "'".concat(param, "'");
|
|
15
|
+
} else if ((0, _typeof2.default)(param) === 'object') {
|
|
16
|
+
return JSON.stringify(param);
|
|
17
|
+
} else if (param === undefined) {
|
|
18
|
+
return 'undefined';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return param;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var printParams = function printParams(args) {
|
|
25
|
+
return args.map(function (arg) {
|
|
26
|
+
return printParam(arg);
|
|
27
|
+
}).join(',');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var printFunctionCall = function printFunctionCall(fn) {
|
|
31
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
32
|
+
args[_key - 1] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return "(".concat(fn.toString(), ")(").concat(printParams(args), ");");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.printFunctionCall = printFunctionCall;
|
|
39
|
+
|
|
40
|
+
var printScript = function printScript(statements) {
|
|
41
|
+
return "(function(){\n ".concat(statements.join(';'), "\n})();\n");
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.printScript = printScript;
|
|
@@ -5,12 +5,10 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.ViewportDetector = exports.
|
|
8
|
+
exports.ViewportDetector = exports.ViewportAnchor = exports.ABS_VIEWPORT_ANCHOR_OFFSET_TOP = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
-
var _lazyContent = require("./lazyContent");
|
|
13
|
-
|
|
14
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
13
|
|
|
16
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -21,6 +19,29 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
21
19
|
|
|
22
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
23
21
|
|
|
22
|
+
/**
|
|
23
|
+
* As IntersectionObserver::rootMargin doesn't work within IFrames, we use an empty div + dynamic offsetTop to eagerly detect cards entering viewport.
|
|
24
|
+
* Using this approach, we can lazy load cards ABS_VIEWPORT_ANCHOR_OFFSET_TOP px before they enter viewport.
|
|
25
|
+
*/
|
|
26
|
+
var ABS_VIEWPORT_ANCHOR_OFFSET_TOP = 900; //px
|
|
27
|
+
|
|
28
|
+
exports.ABS_VIEWPORT_ANCHOR_OFFSET_TOP = ABS_VIEWPORT_ANCHOR_OFFSET_TOP;
|
|
29
|
+
var ViewportAnchor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
30
|
+
if (typeof IntersectionObserver === 'undefined') {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
+
ref: ref,
|
|
36
|
+
className: "media-card-viewport-anchor",
|
|
37
|
+
style: {
|
|
38
|
+
position: 'absolute',
|
|
39
|
+
top: "".concat(props.offsetTop, "px")
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
exports.ViewportAnchor = ViewportAnchor;
|
|
44
|
+
|
|
24
45
|
var createIntersectionObserverCallback = function createIntersectionObserverCallback(onVisible) {
|
|
25
46
|
return function (entries, observer) {
|
|
26
47
|
var _iterator = _createForOfIteratorHelper(entries),
|
|
@@ -44,36 +65,42 @@ var createIntersectionObserverCallback = function createIntersectionObserverCall
|
|
|
44
65
|
};
|
|
45
66
|
};
|
|
46
67
|
|
|
47
|
-
var
|
|
68
|
+
var ViewportObserver = function ViewportObserver(_ref) {
|
|
48
69
|
var onVisible = _ref.onVisible,
|
|
70
|
+
cardEl = _ref.cardEl,
|
|
49
71
|
children = _ref.children,
|
|
50
|
-
|
|
72
|
+
preAnchorRef = _ref.preAnchorRef,
|
|
73
|
+
postAnchorRef = _ref.postAnchorRef;
|
|
51
74
|
(0, _react.useEffect)(function () {
|
|
52
75
|
// IntersectionObserver uses root and target elements to detect intersections, defaulting root to the viewport
|
|
53
76
|
var intersectionObserver = new IntersectionObserver(createIntersectionObserverCallback(onVisible));
|
|
54
|
-
|
|
77
|
+
(preAnchorRef === null || preAnchorRef === void 0 ? void 0 : preAnchorRef.current) && intersectionObserver.observe(preAnchorRef.current);
|
|
78
|
+
(postAnchorRef === null || postAnchorRef === void 0 ? void 0 : postAnchorRef.current) && intersectionObserver.observe(postAnchorRef.current);
|
|
79
|
+
cardEl && intersectionObserver.observe(cardEl);
|
|
55
80
|
return function () {
|
|
56
81
|
intersectionObserver.disconnect();
|
|
57
82
|
};
|
|
58
|
-
}, [
|
|
83
|
+
}, [cardEl, preAnchorRef, postAnchorRef, onVisible]);
|
|
59
84
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
60
85
|
};
|
|
61
86
|
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
var ViewportDetector = function ViewportDetector(_ref2) {
|
|
88
|
+
var cardEl = _ref2.cardEl,
|
|
89
|
+
preAnchorRef = _ref2.preAnchorRef,
|
|
90
|
+
postAnchorRef = _ref2.postAnchorRef,
|
|
91
|
+
onVisible = _ref2.onVisible,
|
|
92
|
+
children = _ref2.children;
|
|
93
|
+
|
|
94
|
+
if (typeof IntersectionObserver === 'undefined') {
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(ViewportObserver, {
|
|
99
|
+
cardEl: cardEl,
|
|
100
|
+
preAnchorRef: preAnchorRef,
|
|
101
|
+
postAnchorRef: postAnchorRef,
|
|
102
|
+
onVisible: onVisible
|
|
103
|
+
}, children);
|
|
75
104
|
};
|
|
76
105
|
|
|
77
|
-
exports.createViewportDetector = createViewportDetector;
|
|
78
|
-
var ViewportDetector = createViewportDetector(typeof IntersectionObserver !== 'undefined');
|
|
79
106
|
exports.ViewportDetector = ViewportDetector;
|
package/dist/cjs/version.json
CHANGED
|
@@ -138,6 +138,22 @@ export class FileCardImageView extends Component {
|
|
|
138
138
|
})));
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
+
_defineProperty(this, "onImageLoad", () => {
|
|
142
|
+
const {
|
|
143
|
+
onImageLoad,
|
|
144
|
+
cardPreview
|
|
145
|
+
} = this.props;
|
|
146
|
+
onImageLoad && onImageLoad(cardPreview);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
_defineProperty(this, "onImageError", () => {
|
|
150
|
+
const {
|
|
151
|
+
onImageError,
|
|
152
|
+
cardPreview
|
|
153
|
+
} = this.props;
|
|
154
|
+
onImageError && onImageError(cardPreview);
|
|
155
|
+
});
|
|
156
|
+
|
|
141
157
|
_defineProperty(this, "renderMediaImage", () => {
|
|
142
158
|
const {
|
|
143
159
|
status,
|
|
@@ -147,9 +163,7 @@ export class FileCardImageView extends Component {
|
|
|
147
163
|
mimeType,
|
|
148
164
|
previewOrientation,
|
|
149
165
|
onDisplayImage,
|
|
150
|
-
alt
|
|
151
|
-
onImageLoad,
|
|
152
|
-
onImageError
|
|
166
|
+
alt
|
|
153
167
|
} = this.props;
|
|
154
168
|
|
|
155
169
|
if (!shouldDisplayImageThumbnail(status, mediaItemType, dataURI, mediaType, mimeType)) {
|
|
@@ -167,8 +181,8 @@ export class FileCardImageView extends Component {
|
|
|
167
181
|
crop: this.isCropped,
|
|
168
182
|
stretch: this.isStretched,
|
|
169
183
|
previewOrientation: previewOrientation,
|
|
170
|
-
onImageLoad: onImageLoad,
|
|
171
|
-
onImageError: onImageError
|
|
184
|
+
onImageLoad: this.onImageLoad,
|
|
185
|
+
onImageError: this.onImageError
|
|
172
186
|
});
|
|
173
187
|
});
|
|
174
188
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fireMediaCardEvent, getRenderSucceededEventPayload, getRenderErrorEventPayload, getRenderFailedFileStatusPayload, getCopiedFilePayload, getRenderCommencedEventPayload, getRenderPreviewableCardPayload } from '../../utils/analytics';
|
|
2
|
-
export const relevantFeatureFlagNames = ['newCardExperience', 'captions'];
|
|
2
|
+
export const relevantFeatureFlagNames = ['newCardExperience', 'captions', 'timestampOnVideo'];
|
|
3
3
|
export const fireOperationalEvent = (createAnalyticsEvent, status, fileAttributes, performanceAttributes, error) => {
|
|
4
4
|
const fireEvent = payload => fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
5
5
|
|
|
@@ -31,5 +31,8 @@ export const isPreviewableStatus = (cardStatus, {
|
|
|
31
31
|
hasPreview,
|
|
32
32
|
isSupportedByBrowser
|
|
33
33
|
}) => {
|
|
34
|
-
return hasPreview && isPreviewable && (cardStatus === 'complete' || cardStatus === 'loading-preview' || cardStatus === 'uploading' ||
|
|
34
|
+
return hasPreview && isPreviewable && (cardStatus === 'complete' || cardStatus === 'loading-preview' || cardStatus === 'uploading' || // For Video, we can have local or remote preview while processing.
|
|
35
|
+
// Then, we only want to show the thumbnail if the file is supported by the browser,
|
|
36
|
+
// this way we prevent playing unsupported videos that are not procesed
|
|
37
|
+
cardStatus === 'processing' && isSupportedByBrowser);
|
|
35
38
|
};
|
|
@@ -165,6 +165,7 @@ export const isSSRClientPreview = preview => {
|
|
|
165
165
|
const ssrClientSources = ['ssr-client', 'cache-ssr-client'];
|
|
166
166
|
return ssrClientSources.includes(preview.source);
|
|
167
167
|
};
|
|
168
|
+
export const isSSRDataPreview = preview => preview.source === 'ssr-data';
|
|
168
169
|
export const fetchAndCacheRemotePreview = async (mediaClient, id, dimensions, params, mediaBlobUrlAttrs) => {
|
|
169
170
|
const remotePreview = await getCardPreviewFromBackend(mediaClient, id, params);
|
|
170
171
|
return extendAndCachePreview(id, dimensions, remotePreview, mediaBlobUrlAttrs);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React, { Component } from 'react';
|
|
2
|
+
import React, { Component, createRef } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import { version as packageVersion, name as packageName } from '../../version.json';
|
|
5
5
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -7,18 +7,23 @@ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
|
|
|
7
7
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
8
8
|
import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
|
|
9
9
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
10
|
-
import {
|
|
10
|
+
import { injectIntl, IntlProvider } from 'react-intl-next';
|
|
11
11
|
import { CardView } from '../cardView';
|
|
12
|
-
import { ViewportDetector } from '../../utils/viewportDetector';
|
|
12
|
+
import { ABS_VIEWPORT_ANCHOR_OFFSET_TOP, ViewportDetector, ViewportAnchor } from '../../utils/viewportDetector';
|
|
13
13
|
import { getRequestedDimensions } from '../../utils/getDataURIDimension';
|
|
14
|
-
import { getCardPreview, getCardPreviewFromCache, removeCardPreviewFromCache, getFilePreviewFromFileState, shouldResolvePreview, getSSRCardPreview, isLocalPreview, isSSRPreview, isSSRClientPreview, fetchAndCacheRemotePreview } from './getCardPreview';
|
|
14
|
+
import { getCardPreview, getCardPreviewFromCache, removeCardPreviewFromCache, getFilePreviewFromFileState, shouldResolvePreview, getSSRCardPreview, isLocalPreview, isSSRPreview, isSSRClientPreview, isSSRDataPreview, fetchAndCacheRemotePreview } from './getCardPreview';
|
|
15
15
|
import { getFileDetails } from '../../utils/metadata';
|
|
16
16
|
import { InlinePlayer } from '../inlinePlayer';
|
|
17
|
-
import { getFileAttributes } from '../../utils/analytics';
|
|
17
|
+
import { getFileAttributes, extractErrorInfo } from '../../utils/analytics';
|
|
18
18
|
import { isLocalPreviewError, MediaCardError, ensureMediaCardError, ImageLoadError } from '../../errors';
|
|
19
19
|
import { fireOperationalEvent, fireCommencedEvent, relevantFeatureFlagNames, fireCopiedEvent, fireScreenEvent } from './cardAnalytics';
|
|
20
20
|
import getDocument from '../../utils/document';
|
|
21
|
+
import { StoreSSRDataScript, getSSRData } from '../../utils/globalScope';
|
|
21
22
|
import { getCardStateFromFileState, createStateUpdater } from './cardState';
|
|
23
|
+
import { isProcessedFileState } from '@atlaskit/media-client';
|
|
24
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
25
|
+
import { isBigger } from '../../utils/dimensionComparer';
|
|
26
|
+
import { getMediaCardCursor } from '../../utils/getMediaCardCursor';
|
|
22
27
|
export class CardBase extends Component {
|
|
23
28
|
// We initialise timeElapsedTillCommenced
|
|
24
29
|
// to avoid extra branching on a possibly undefined value.
|
|
@@ -27,6 +32,10 @@ export class CardBase extends Component {
|
|
|
27
32
|
|
|
28
33
|
_defineProperty(this, "hasBeenMounted", false);
|
|
29
34
|
|
|
35
|
+
_defineProperty(this, "viewportPreAnchorRef", /*#__PURE__*/createRef());
|
|
36
|
+
|
|
37
|
+
_defineProperty(this, "viewportPostAnchorRef", /*#__PURE__*/createRef());
|
|
38
|
+
|
|
30
39
|
_defineProperty(this, "timeElapsedTillCommenced", performance.now());
|
|
31
40
|
|
|
32
41
|
_defineProperty(this, "getImageURLParams", ({
|
|
@@ -100,15 +109,19 @@ export class CardBase extends Component {
|
|
|
100
109
|
});
|
|
101
110
|
});
|
|
102
111
|
|
|
103
|
-
_defineProperty(this, "
|
|
112
|
+
_defineProperty(this, "refetchSSRPreview", async identifier => {
|
|
104
113
|
const {
|
|
105
|
-
mediaClient
|
|
114
|
+
mediaClient,
|
|
115
|
+
dimensions = {}
|
|
106
116
|
} = this.props;
|
|
107
117
|
|
|
108
118
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
119
|
+
const cardPreview = await fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, this.getImageURLParams(identifier), this.getMediaBlobUrlAttrs(identifier));
|
|
120
|
+
this.safeSetState({
|
|
121
|
+
cardPreview
|
|
122
|
+
});
|
|
123
|
+
} catch (e) {// No need to log this error.
|
|
124
|
+
// If preview fails, it will be refetched later
|
|
112
125
|
}
|
|
113
126
|
});
|
|
114
127
|
|
|
@@ -152,13 +165,18 @@ export class CardBase extends Component {
|
|
|
152
165
|
};
|
|
153
166
|
});
|
|
154
167
|
|
|
155
|
-
_defineProperty(this, "onImageError",
|
|
168
|
+
_defineProperty(this, "onImageError", cardPreview => {
|
|
156
169
|
const {
|
|
157
|
-
cardPreview
|
|
158
|
-
} = this.state;
|
|
170
|
+
cardPreview: currentPreview
|
|
171
|
+
} = this.state; // If the dataURI has been replaced, we can dismiss this error
|
|
172
|
+
|
|
173
|
+
if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
159
177
|
const error = new ImageLoadError(cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source);
|
|
160
178
|
const isLocal = cardPreview && isLocalPreview(cardPreview);
|
|
161
|
-
const isSSR = cardPreview && isSSRClientPreview(cardPreview);
|
|
179
|
+
const isSSR = cardPreview && (isSSRClientPreview(cardPreview) || isSSRDataPreview(cardPreview));
|
|
162
180
|
|
|
163
181
|
if (isLocal || isSSR) {
|
|
164
182
|
const updateState = {
|
|
@@ -188,7 +206,15 @@ export class CardBase extends Component {
|
|
|
188
206
|
}
|
|
189
207
|
});
|
|
190
208
|
|
|
191
|
-
_defineProperty(this, "onImageLoad",
|
|
209
|
+
_defineProperty(this, "onImageLoad", cardPreview => {
|
|
210
|
+
const {
|
|
211
|
+
cardPreview: currentPreview
|
|
212
|
+
} = this.state; // If the dataURI has been replaced, we can dismiss this callback
|
|
213
|
+
|
|
214
|
+
if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
192
218
|
this.safeSetState({
|
|
193
219
|
previewDidRender: true
|
|
194
220
|
});
|
|
@@ -260,7 +286,8 @@ export class CardBase extends Component {
|
|
|
260
286
|
|
|
261
287
|
if (useInlinePlayer && isVideo && !!cardPreview) {
|
|
262
288
|
this.setState({
|
|
263
|
-
isPlayingFile: true
|
|
289
|
+
isPlayingFile: true,
|
|
290
|
+
shouldAutoplay: true
|
|
264
291
|
});
|
|
265
292
|
} else if (shouldOpenMediaViewer) {
|
|
266
293
|
let mediaViewerSelectedItem;
|
|
@@ -307,16 +334,22 @@ export class CardBase extends Component {
|
|
|
307
334
|
testId,
|
|
308
335
|
originalDimensions
|
|
309
336
|
} = this.props;
|
|
337
|
+
const {
|
|
338
|
+
shouldAutoplay,
|
|
339
|
+
cardPreview
|
|
340
|
+
} = this.state;
|
|
310
341
|
return /*#__PURE__*/React.createElement(InlinePlayer, {
|
|
311
342
|
mediaClient: mediaClient,
|
|
312
343
|
dimensions: dimensions,
|
|
313
344
|
originalDimensions: originalDimensions,
|
|
314
345
|
identifier: identifier,
|
|
346
|
+
autoplay: !!shouldAutoplay,
|
|
315
347
|
onError: this.onInlinePlayerError,
|
|
316
348
|
onClick: this.onClick,
|
|
317
349
|
selected: selected,
|
|
318
350
|
ref: this.setRef,
|
|
319
|
-
testId: testId
|
|
351
|
+
testId: testId,
|
|
352
|
+
cardPreview: cardPreview
|
|
320
353
|
});
|
|
321
354
|
});
|
|
322
355
|
|
|
@@ -396,7 +429,9 @@ export class CardBase extends Component {
|
|
|
396
429
|
featureFlags,
|
|
397
430
|
titleBoxBgColor,
|
|
398
431
|
titleBoxIcon,
|
|
399
|
-
ssr
|
|
432
|
+
ssr,
|
|
433
|
+
useInlinePlayer,
|
|
434
|
+
shouldOpenMediaViewer
|
|
400
435
|
} = this.props;
|
|
401
436
|
const {
|
|
402
437
|
mediaItemType
|
|
@@ -404,13 +439,7 @@ export class CardBase extends Component {
|
|
|
404
439
|
const {
|
|
405
440
|
status,
|
|
406
441
|
progress,
|
|
407
|
-
cardPreview
|
|
408
|
-
dataURI,
|
|
409
|
-
orientation
|
|
410
|
-
} = {
|
|
411
|
-
dataURI: undefined,
|
|
412
|
-
orientation: 1
|
|
413
|
-
},
|
|
442
|
+
cardPreview,
|
|
414
443
|
error,
|
|
415
444
|
cardRef,
|
|
416
445
|
isCardVisible
|
|
@@ -429,12 +458,13 @@ export class CardBase extends Component {
|
|
|
429
458
|
const nativeLazyLoad = isLazy && !isCardVisible; // Force Media Image to always display img for SSR
|
|
430
459
|
|
|
431
460
|
const forceSyncDisplay = !!ssr;
|
|
461
|
+
const mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, status === 'error' || status === 'failed-processing', !!this.state.cardPreview, metadata.mediaType);
|
|
432
462
|
const card = /*#__PURE__*/React.createElement(CardView, {
|
|
433
463
|
status: status,
|
|
434
464
|
error: error,
|
|
435
465
|
mediaItemType: mediaItemType,
|
|
436
466
|
metadata: metadata,
|
|
437
|
-
|
|
467
|
+
cardPreview: cardPreview,
|
|
438
468
|
alt: alt,
|
|
439
469
|
appearance: appearance,
|
|
440
470
|
resizeMode: resizeMode,
|
|
@@ -447,7 +477,6 @@ export class CardBase extends Component {
|
|
|
447
477
|
disableOverlay: disableOverlay,
|
|
448
478
|
progress: progress,
|
|
449
479
|
onDisplayImage: onDisplayImage,
|
|
450
|
-
previewOrientation: orientation,
|
|
451
480
|
innerRef: this.setRef,
|
|
452
481
|
testId: testId,
|
|
453
482
|
featureFlags: featureFlags,
|
|
@@ -456,12 +485,41 @@ export class CardBase extends Component {
|
|
|
456
485
|
onImageError: this.onImageError,
|
|
457
486
|
onImageLoad: this.onImageLoad,
|
|
458
487
|
nativeLazyLoad: nativeLazyLoad,
|
|
459
|
-
forceSyncDisplay: forceSyncDisplay
|
|
488
|
+
forceSyncDisplay: forceSyncDisplay,
|
|
489
|
+
mediaCardCursor: mediaCardCursor
|
|
460
490
|
});
|
|
461
491
|
return isLazy ? /*#__PURE__*/React.createElement(ViewportDetector, {
|
|
462
|
-
|
|
492
|
+
cardEl: cardRef,
|
|
493
|
+
preAnchorRef: this.viewportPreAnchorRef,
|
|
494
|
+
postAnchorRef: this.viewportPostAnchorRef,
|
|
463
495
|
onVisible: this.onCardInViewport
|
|
464
|
-
},
|
|
496
|
+
}, /*#__PURE__*/React.createElement(ViewportAnchor, {
|
|
497
|
+
ref: this.viewportPreAnchorRef,
|
|
498
|
+
offsetTop: -ABS_VIEWPORT_ANCHOR_OFFSET_TOP
|
|
499
|
+
}), card, /*#__PURE__*/React.createElement(ViewportAnchor, {
|
|
500
|
+
ref: this.viewportPostAnchorRef,
|
|
501
|
+
offsetTop: ABS_VIEWPORT_ANCHOR_OFFSET_TOP
|
|
502
|
+
})) : card;
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
_defineProperty(this, "storeSSRData", () => {
|
|
506
|
+
const {
|
|
507
|
+
ssr,
|
|
508
|
+
identifier
|
|
509
|
+
} = this.props;
|
|
510
|
+
const {
|
|
511
|
+
cardPreview: {
|
|
512
|
+
dataURI
|
|
513
|
+
} = {},
|
|
514
|
+
error
|
|
515
|
+
} = this.state;
|
|
516
|
+
const ssrDataError = !!error ? extractErrorInfo(error) : undefined;
|
|
517
|
+
return isFileIdentifier(identifier) && ssr === 'server' && /*#__PURE__*/React.createElement(StoreSSRDataScript, {
|
|
518
|
+
identifier: identifier,
|
|
519
|
+
dataURI: dataURI,
|
|
520
|
+
dimensions: this.requestedDimensions,
|
|
521
|
+
error: ssrDataError
|
|
522
|
+
});
|
|
465
523
|
});
|
|
466
524
|
|
|
467
525
|
_defineProperty(this, "onCardInViewport", () => {
|
|
@@ -508,10 +566,13 @@ export class CardBase extends Component {
|
|
|
508
566
|
|
|
509
567
|
let _cardPreview;
|
|
510
568
|
|
|
569
|
+
let _error;
|
|
570
|
+
|
|
511
571
|
const {
|
|
512
572
|
identifier: _identifier,
|
|
513
573
|
dimensions: _dimensions = {},
|
|
514
|
-
ssr: _ssr
|
|
574
|
+
ssr: _ssr,
|
|
575
|
+
mediaClient: _mediaClient
|
|
515
576
|
} = this.props;
|
|
516
577
|
|
|
517
578
|
if (isFileIdentifier(_identifier)) {
|
|
@@ -521,8 +582,26 @@ export class CardBase extends Component {
|
|
|
521
582
|
_cardPreview = getCardPreviewFromCache(id, _dimensions);
|
|
522
583
|
|
|
523
584
|
if (!_cardPreview && _ssr) {
|
|
524
|
-
|
|
525
|
-
|
|
585
|
+
var _this$ssrData;
|
|
586
|
+
|
|
587
|
+
this.ssrData = getSSRData(_identifier);
|
|
588
|
+
|
|
589
|
+
if (_ssr === 'server' || !((_this$ssrData = this.ssrData) !== null && _this$ssrData !== void 0 && _this$ssrData.dataURI)) {
|
|
590
|
+
try {
|
|
591
|
+
_cardPreview = getSSRCardPreview(_ssr, _mediaClient, _identifier.id, this.getImageURLParams(_identifier), this.getMediaBlobUrlAttrs(_identifier));
|
|
592
|
+
} catch (e) {
|
|
593
|
+
// TODO: handle error in client MEX-770
|
|
594
|
+
// If we fail building the dataURI in server, we store the error in the state
|
|
595
|
+
// to be later stored in global scope and logged in client.
|
|
596
|
+
// We don't set the status = error to fall back to the spinner icon
|
|
597
|
+
_error = _ssr === 'server' ? e : undefined;
|
|
598
|
+
}
|
|
599
|
+
} else {
|
|
600
|
+
_cardPreview = {
|
|
601
|
+
dataURI: this.ssrData.dataURI,
|
|
602
|
+
source: 'ssr-data'
|
|
603
|
+
};
|
|
604
|
+
}
|
|
526
605
|
}
|
|
527
606
|
} else if (isExternalImageIdentifier(_identifier)) {
|
|
528
607
|
this.fireCommencedEvent();
|
|
@@ -547,10 +626,12 @@ export class CardBase extends Component {
|
|
|
547
626
|
status: _status,
|
|
548
627
|
isCardVisible: _isCardVisible,
|
|
549
628
|
isPlayingFile: false,
|
|
629
|
+
shouldAutoplay: false,
|
|
550
630
|
cardPreview: _cardPreview,
|
|
551
631
|
cardRef: null,
|
|
552
632
|
isBannedLocalPreview: false,
|
|
553
|
-
previewDidRender: false
|
|
633
|
+
previewDidRender: false,
|
|
634
|
+
error: _error
|
|
554
635
|
};
|
|
555
636
|
}
|
|
556
637
|
|
|
@@ -562,17 +643,28 @@ export class CardBase extends Component {
|
|
|
562
643
|
} = this.state;
|
|
563
644
|
const {
|
|
564
645
|
identifier,
|
|
565
|
-
ssr
|
|
646
|
+
ssr,
|
|
647
|
+
dimensions
|
|
566
648
|
} = this.props;
|
|
567
649
|
|
|
568
650
|
if (isCardVisible && isFileIdentifier(identifier)) {
|
|
569
651
|
this.updateStateForIdentifier(identifier);
|
|
570
652
|
}
|
|
571
653
|
|
|
572
|
-
if (isCardVisible && !!ssr && !!cardPreview &&
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
654
|
+
if (isCardVisible && !!ssr && !!cardPreview && isFileIdentifier(identifier)) {
|
|
655
|
+
var _this$ssrData2;
|
|
656
|
+
|
|
657
|
+
if (isSSRClientPreview(cardPreview)) {
|
|
658
|
+
// Since the SSR preview brings the token in the query params,
|
|
659
|
+
// We need to fetch the remote preview to be able to cache it,
|
|
660
|
+
this.setCacheSSRPreview(identifier);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (isSSRDataPreview(cardPreview) && isBigger((_this$ssrData2 = this.ssrData) === null || _this$ssrData2 === void 0 ? void 0 : _this$ssrData2.dimensions, dimensions)) {
|
|
664
|
+
// If dimensions from Server have changed and are bigger,
|
|
665
|
+
// we need to refetch
|
|
666
|
+
this.refetchSSRPreview(identifier);
|
|
667
|
+
}
|
|
576
668
|
} // we add a listener for each of the cards on the page
|
|
577
669
|
// and then check if the triggered listener is from the card
|
|
578
670
|
// that contains a div in current window.getSelection()
|
|
@@ -595,7 +687,9 @@ export class CardBase extends Component {
|
|
|
595
687
|
mediaClient,
|
|
596
688
|
identifier,
|
|
597
689
|
dimensions,
|
|
598
|
-
featureFlags
|
|
690
|
+
featureFlags,
|
|
691
|
+
useInlinePlayer,
|
|
692
|
+
disableOverlay
|
|
599
693
|
} = this.props;
|
|
600
694
|
const {
|
|
601
695
|
isCardVisible,
|
|
@@ -603,7 +697,8 @@ export class CardBase extends Component {
|
|
|
603
697
|
status,
|
|
604
698
|
fileState,
|
|
605
699
|
isBannedLocalPreview,
|
|
606
|
-
previewDidRender
|
|
700
|
+
previewDidRender,
|
|
701
|
+
isPlayingFile
|
|
607
702
|
} = this.state;
|
|
608
703
|
const isDifferent = isDifferentIdentifier(prevIdentifier, identifier);
|
|
609
704
|
const turnedVisible = !prevIsCardVisible && isCardVisible;
|
|
@@ -662,6 +757,15 @@ export class CardBase extends Component {
|
|
|
662
757
|
});
|
|
663
758
|
this.unsubscribe();
|
|
664
759
|
}
|
|
760
|
+
|
|
761
|
+
const isVideo = this.fileAttributes.fileMediatype === 'video';
|
|
762
|
+
const videoAvailableToPlay = fileState && isProcessedFileState(fileState);
|
|
763
|
+
|
|
764
|
+
if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
|
|
765
|
+
this.setState({
|
|
766
|
+
isPlayingFile: true
|
|
767
|
+
});
|
|
768
|
+
}
|
|
665
769
|
}
|
|
666
770
|
|
|
667
771
|
componentWillUnmount() {
|
|
@@ -790,8 +894,8 @@ export class CardBase extends Component {
|
|
|
790
894
|
isPlayingFile,
|
|
791
895
|
mediaViewerSelectedItem
|
|
792
896
|
} = this.state;
|
|
793
|
-
const innerContent = /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null);
|
|
794
|
-
return this.
|
|
897
|
+
const innerContent = /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null, this.storeSSRData());
|
|
898
|
+
return this.props.intl ? innerContent : /*#__PURE__*/React.createElement(IntlProvider, {
|
|
795
899
|
locale: "en"
|
|
796
900
|
}, innerContent);
|
|
797
901
|
}
|
|
@@ -807,11 +911,6 @@ _defineProperty(CardBase, "defaultProps", {
|
|
|
807
911
|
featureFlags: {}
|
|
808
912
|
});
|
|
809
913
|
|
|
810
|
-
_defineProperty(CardBase, "contextTypes", {
|
|
811
|
-
// Required to detect a parent IntlProvider
|
|
812
|
-
intl: intlShape
|
|
813
|
-
});
|
|
814
|
-
|
|
815
914
|
export const Card = withMediaAnalyticsContext({
|
|
816
915
|
packageVersion,
|
|
817
916
|
packageName,
|
|
@@ -819,4 +918,6 @@ export const Card = withMediaAnalyticsContext({
|
|
|
819
918
|
component: 'mediaCard'
|
|
820
919
|
}, {
|
|
821
920
|
filterFeatureFlags: relevantFeatureFlagNames
|
|
822
|
-
})(withAnalyticsEvents()(CardBase
|
|
921
|
+
})(withAnalyticsEvents()(injectIntl(CardBase, {
|
|
922
|
+
enforceContext: false
|
|
923
|
+
})));
|