@atlaskit/media-card 77.0.1 → 77.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/card/card.js +9 -1
- package/dist/cjs/card/getCardPreview/index.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/progressBar/styledBar.js +2 -1
- package/dist/cjs/card/v2/cardV2.js +7 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/mockIntersectionObserver.js +68 -0
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +9 -1
- package/dist/es2019/card/getCardPreview/index.js +1 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/progressBar/styledBar.js +2 -1
- package/dist/es2019/card/v2/cardV2.js +7 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/mockIntersectionObserver.js +41 -0
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +9 -1
- package/dist/esm/card/getCardPreview/index.js +1 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/progressBar/styledBar.js +2 -1
- package/dist/esm/card/v2/cardV2.js +7 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/mockIntersectionObserver.js +60 -0
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/utils/mockIntersectionObserver.d.ts +20 -0
- package/dist/types-ts4.5/utils/mockIntersectionObserver.d.ts +20 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 77.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`25252788c18`](https://bitbucket.org/atlassian/atlassian-frontend/commits/25252788c18) - Give the progress bar in media card a "progressbar" role.
|
|
8
|
+
|
|
9
|
+
## 77.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`78b51d6134c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/78b51d6134c) - Fixed issue with media card lazy loading not working during SSR hydration
|
|
14
|
+
|
|
3
15
|
## 77.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -49,7 +49,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
49
49
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
50
50
|
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; } }
|
|
51
51
|
var packageName = "@atlaskit/media-card";
|
|
52
|
-
var packageVersion = "77.0.
|
|
52
|
+
var packageVersion = "77.0.3";
|
|
53
53
|
var CardBase = /*#__PURE__*/function (_Component) {
|
|
54
54
|
(0, _inherits2.default)(CardBase, _Component);
|
|
55
55
|
var _super = _createSuper(CardBase);
|
|
@@ -744,6 +744,8 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
744
744
|
if ((0, _getCardPreview.isSSRDataPreview)(cardPreview) && (0, _dimensionComparer.isBigger)((_this$ssrData3 = this.ssrData) === null || _this$ssrData3 === void 0 ? void 0 : _this$ssrData3.dimensions, dimensions)) {
|
|
745
745
|
// If dimensions from Server have changed and are bigger,
|
|
746
746
|
// we need to refetch
|
|
747
|
+
// This is repeated in componentDidUpdate because in the case of lazy loading true
|
|
748
|
+
// the card will be invisible by default.
|
|
747
749
|
this.refetchSSRPreview(identifier);
|
|
748
750
|
}
|
|
749
751
|
}
|
|
@@ -756,6 +758,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
756
758
|
}, {
|
|
757
759
|
key: "componentDidUpdate",
|
|
758
760
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
761
|
+
var _this$ssrData4;
|
|
759
762
|
var prevMediaClient = prevProps.mediaClient,
|
|
760
763
|
prevIdentifier = prevProps.identifier,
|
|
761
764
|
prevDimensions = prevProps.dimensions;
|
|
@@ -810,6 +813,11 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
810
813
|
isCardVisible: true
|
|
811
814
|
});
|
|
812
815
|
}
|
|
816
|
+
if (cardPreview && turnedVisible && (0, _mediaClient2.isFileIdentifier)(identifier) && (0, _getCardPreview.isSSRDataPreview)(cardPreview) && (0, _dimensionComparer.isBigger)((_this$ssrData4 = this.ssrData) === null || _this$ssrData4 === void 0 ? void 0 : _this$ssrData4.dimensions, dimensions)) {
|
|
817
|
+
// If dimensions from Server have changed and are bigger,
|
|
818
|
+
// we need to refetch
|
|
819
|
+
this.refetchSSRPreview(identifier);
|
|
820
|
+
}
|
|
813
821
|
if ((0, _mediaClient2.isFileIdentifier)(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDiffIdentifier))) {
|
|
814
822
|
this.updateStateForIdentifier(identifier);
|
|
815
823
|
}
|
|
@@ -217,7 +217,7 @@ var isLocalPreview = function isLocalPreview(preview) {
|
|
|
217
217
|
};
|
|
218
218
|
exports.isLocalPreview = isLocalPreview;
|
|
219
219
|
var isSSRPreview = function isSSRPreview(preview) {
|
|
220
|
-
return isSSRClientPreview(preview) || isSSRServerPreview(preview);
|
|
220
|
+
return isSSRClientPreview(preview) || isSSRServerPreview(preview) || isSSRDataPreview(preview);
|
|
221
221
|
};
|
|
222
222
|
exports.isSSRPreview = isSSRPreview;
|
|
223
223
|
var isSSRServerPreview = function isSSRServerPreview(preview) {
|
|
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
90
90
|
}(_react.default.Component);
|
|
91
91
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
92
92
|
var packageName = "@atlaskit/media-card";
|
|
93
|
-
var packageVersion = "77.0.
|
|
93
|
+
var packageVersion = "77.0.3";
|
|
94
94
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
95
95
|
packageVersion: packageVersion,
|
|
96
96
|
packageName: packageName,
|
|
@@ -15,7 +15,8 @@ var StyledBar = function StyledBar(props) {
|
|
|
15
15
|
showOnTop = props.showOnTop;
|
|
16
16
|
return (0, _react.jsx)("div", {
|
|
17
17
|
id: "styledBar",
|
|
18
|
-
|
|
18
|
+
role: "progressbar",
|
|
19
|
+
"aria-valuenow": progress,
|
|
19
20
|
css: (0, _styles.styledBarStyles)({
|
|
20
21
|
progress: progress,
|
|
21
22
|
breakpoint: breakpoint,
|
|
@@ -50,7 +50,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
50
50
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
51
51
|
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; } }
|
|
52
52
|
var packageName = "@atlaskit/media-card";
|
|
53
|
-
var packageVersion = "77.0.
|
|
53
|
+
var packageVersion = "77.0.3";
|
|
54
54
|
var CardV2Base = /*#__PURE__*/function (_Component) {
|
|
55
55
|
(0, _inherits2.default)(CardV2Base, _Component);
|
|
56
56
|
var _super = _createSuper(CardV2Base);
|
|
@@ -763,6 +763,7 @@ var CardV2Base = /*#__PURE__*/function (_Component) {
|
|
|
763
763
|
}, {
|
|
764
764
|
key: "componentDidUpdate",
|
|
765
765
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
766
|
+
var _this$ssrData4;
|
|
766
767
|
var prevMediaClient = prevProps.mediaClient,
|
|
767
768
|
prevIdentifier = prevProps.identifier,
|
|
768
769
|
prevDimensions = prevProps.dimensions;
|
|
@@ -817,6 +818,11 @@ var CardV2Base = /*#__PURE__*/function (_Component) {
|
|
|
817
818
|
isCardVisible: true
|
|
818
819
|
});
|
|
819
820
|
}
|
|
821
|
+
if (cardPreview && turnedVisible && (0, _mediaClient2.isFileIdentifier)(identifier) && (0, _getCardPreview.isSSRDataPreview)(cardPreview) && (0, _dimensionComparer.isBigger)((_this$ssrData4 = this.ssrData) === null || _this$ssrData4 === void 0 ? void 0 : _this$ssrData4.dimensions, dimensions)) {
|
|
822
|
+
// If dimensions from Server have changed and are bigger,
|
|
823
|
+
// we need to refetch
|
|
824
|
+
this.refetchSSRPreview(identifier);
|
|
825
|
+
}
|
|
820
826
|
if ((0, _mediaClient2.isFileIdentifier)(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDiffIdentifier))) {
|
|
821
827
|
this.updateStateForIdentifier(identifier);
|
|
822
828
|
}
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "77.0.
|
|
122
|
+
packageName: "77.0.3",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.MockIntersectionObserver = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var noop = function noop() {};
|
|
12
|
+
var MockIntersectionObserver = /*#__PURE__*/function () {
|
|
13
|
+
function MockIntersectionObserver() {
|
|
14
|
+
(0, _classCallCheck2.default)(this, MockIntersectionObserver);
|
|
15
|
+
(0, _defineProperty2.default)(this, "callback", noop);
|
|
16
|
+
}
|
|
17
|
+
(0, _createClass2.default)(MockIntersectionObserver, [{
|
|
18
|
+
key: "storeMockObserver",
|
|
19
|
+
value: function storeMockObserver(_ref) {
|
|
20
|
+
var observe = _ref.observe,
|
|
21
|
+
disconnect = _ref.disconnect;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
23
|
+
var outerThis = this;
|
|
24
|
+
this.mockObserver = /*#__PURE__*/function () {
|
|
25
|
+
function _class2(callback) {
|
|
26
|
+
(0, _classCallCheck2.default)(this, _class2);
|
|
27
|
+
(0, _defineProperty2.default)(this, "observe", observe !== null && observe !== void 0 ? observe : noop);
|
|
28
|
+
(0, _defineProperty2.default)(this, "unobserve", noop);
|
|
29
|
+
(0, _defineProperty2.default)(this, "disconnect", disconnect !== null && disconnect !== void 0 ? disconnect : noop);
|
|
30
|
+
outerThis.callback = callback;
|
|
31
|
+
outerThis.mockObserverInstance = this;
|
|
32
|
+
}
|
|
33
|
+
return (0, _createClass2.default)(_class2);
|
|
34
|
+
}();
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "addMockObserverToWindow",
|
|
38
|
+
value: function addMockObserverToWindow() {
|
|
39
|
+
this.originalObserver = window.IntersectionObserver;
|
|
40
|
+
window.IntersectionObserver = this.mockObserver;
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "removeMockObserverFromWindow",
|
|
44
|
+
value: function removeMockObserverFromWindow() {
|
|
45
|
+
window.IntersectionObserver = this.originalObserver;
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "setup",
|
|
49
|
+
value: function setup() {
|
|
50
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
|
+
this.storeMockObserver(options);
|
|
52
|
+
this.addMockObserverToWindow();
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "cleanup",
|
|
56
|
+
value: function cleanup() {
|
|
57
|
+
this.removeMockObserverFromWindow();
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "triggerIntersect",
|
|
61
|
+
value: function triggerIntersect(entry) {
|
|
62
|
+
var entries = [entry];
|
|
63
|
+
this.callback(entries, this.mockObserverInstance);
|
|
64
|
+
}
|
|
65
|
+
}]);
|
|
66
|
+
return MockIntersectionObserver;
|
|
67
|
+
}();
|
|
68
|
+
exports.MockIntersectionObserver = MockIntersectionObserver;
|
|
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
var packageName = "@atlaskit/media-card";
|
|
17
|
-
var packageVersion = "77.0.
|
|
17
|
+
var packageVersion = "77.0.3";
|
|
18
18
|
var concurrentExperience;
|
|
19
19
|
var getExperience = function getExperience(id) {
|
|
20
20
|
if (!concurrentExperience) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -27,7 +27,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
27
27
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
28
28
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
29
29
|
const packageName = "@atlaskit/media-card";
|
|
30
|
-
const packageVersion = "77.0.
|
|
30
|
+
const packageVersion = "77.0.3";
|
|
31
31
|
export class CardBase extends Component {
|
|
32
32
|
constructor(props) {
|
|
33
33
|
super(props);
|
|
@@ -717,6 +717,8 @@ export class CardBase extends Component {
|
|
|
717
717
|
if (isSSRDataPreview(cardPreview) && isBigger((_this$ssrData3 = this.ssrData) === null || _this$ssrData3 === void 0 ? void 0 : _this$ssrData3.dimensions, dimensions)) {
|
|
718
718
|
// If dimensions from Server have changed and are bigger,
|
|
719
719
|
// we need to refetch
|
|
720
|
+
// This is repeated in componentDidUpdate because in the case of lazy loading true
|
|
721
|
+
// the card will be invisible by default.
|
|
720
722
|
this.refetchSSRPreview(identifier);
|
|
721
723
|
}
|
|
722
724
|
}
|
|
@@ -727,6 +729,7 @@ export class CardBase extends Component {
|
|
|
727
729
|
(_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.addEventListener('copy', this.fireCopiedEvent);
|
|
728
730
|
}
|
|
729
731
|
componentDidUpdate(prevProps, prevState) {
|
|
732
|
+
var _this$ssrData4;
|
|
730
733
|
const {
|
|
731
734
|
mediaClient: prevMediaClient,
|
|
732
735
|
identifier: prevIdentifier,
|
|
@@ -789,6 +792,11 @@ export class CardBase extends Component {
|
|
|
789
792
|
isCardVisible: true
|
|
790
793
|
});
|
|
791
794
|
}
|
|
795
|
+
if (cardPreview && turnedVisible && isFileIdentifier(identifier) && isSSRDataPreview(cardPreview) && isBigger((_this$ssrData4 = this.ssrData) === null || _this$ssrData4 === void 0 ? void 0 : _this$ssrData4.dimensions, dimensions)) {
|
|
796
|
+
// If dimensions from Server have changed and are bigger,
|
|
797
|
+
// we need to refetch
|
|
798
|
+
this.refetchSSRPreview(identifier);
|
|
799
|
+
}
|
|
792
800
|
if (isFileIdentifier(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDiffIdentifier))) {
|
|
793
801
|
this.updateStateForIdentifier(identifier);
|
|
794
802
|
}
|
|
@@ -156,7 +156,7 @@ export const isLocalPreview = preview => {
|
|
|
156
156
|
const localSources = ['local', 'cache-local'];
|
|
157
157
|
return localSources.includes(preview.source);
|
|
158
158
|
};
|
|
159
|
-
export const isSSRPreview = preview => isSSRClientPreview(preview) || isSSRServerPreview(preview);
|
|
159
|
+
export const isSSRPreview = preview => isSSRClientPreview(preview) || isSSRServerPreview(preview) || isSSRDataPreview(preview);
|
|
160
160
|
export const isSSRServerPreview = preview => {
|
|
161
161
|
const ssrClientSources = ['ssr-server', 'cache-ssr-server'];
|
|
162
162
|
return ssrClientSources.includes(preview.source);
|
|
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
|
|
|
66
66
|
}
|
|
67
67
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
68
68
|
const packageName = "@atlaskit/media-card";
|
|
69
|
-
const packageVersion = "77.0.
|
|
69
|
+
const packageVersion = "77.0.3";
|
|
70
70
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
71
71
|
packageVersion,
|
|
72
72
|
packageName,
|
|
@@ -28,7 +28,7 @@ import { completeUfoExperience, startUfoExperience } from '../../utils/ufoExperi
|
|
|
28
28
|
import { generateUniqueId } from '../../utils/generateUniqueId';
|
|
29
29
|
import { useFileState } from '@atlaskit/media-client-react';
|
|
30
30
|
const packageName = "@atlaskit/media-card";
|
|
31
|
-
const packageVersion = "77.0.
|
|
31
|
+
const packageVersion = "77.0.3";
|
|
32
32
|
export class CardV2Base extends Component {
|
|
33
33
|
constructor(props) {
|
|
34
34
|
super(props);
|
|
@@ -738,6 +738,7 @@ export class CardV2Base extends Component {
|
|
|
738
738
|
(_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.addEventListener('copy', this.fireCopiedEvent);
|
|
739
739
|
}
|
|
740
740
|
componentDidUpdate(prevProps, prevState) {
|
|
741
|
+
var _this$ssrData4;
|
|
741
742
|
const {
|
|
742
743
|
mediaClient: prevMediaClient,
|
|
743
744
|
identifier: prevIdentifier,
|
|
@@ -800,6 +801,11 @@ export class CardV2Base extends Component {
|
|
|
800
801
|
isCardVisible: true
|
|
801
802
|
});
|
|
802
803
|
}
|
|
804
|
+
if (cardPreview && turnedVisible && isFileIdentifier(identifier) && isSSRDataPreview(cardPreview) && isBigger((_this$ssrData4 = this.ssrData) === null || _this$ssrData4 === void 0 ? void 0 : _this$ssrData4.dimensions, dimensions)) {
|
|
805
|
+
// If dimensions from Server have changed and are bigger,
|
|
806
|
+
// we need to refetch
|
|
807
|
+
this.refetchSSRPreview(identifier);
|
|
808
|
+
}
|
|
803
809
|
if (isFileIdentifier(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDiffIdentifier))) {
|
|
804
810
|
this.updateStateForIdentifier(identifier);
|
|
805
811
|
}
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "77.0.
|
|
40
|
+
packageName: "77.0.3",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
const noop = () => {};
|
|
3
|
+
export class MockIntersectionObserver {
|
|
4
|
+
constructor() {
|
|
5
|
+
_defineProperty(this, "callback", noop);
|
|
6
|
+
}
|
|
7
|
+
storeMockObserver({
|
|
8
|
+
observe,
|
|
9
|
+
disconnect
|
|
10
|
+
}) {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
12
|
+
const outerThis = this;
|
|
13
|
+
this.mockObserver = class {
|
|
14
|
+
constructor(callback) {
|
|
15
|
+
_defineProperty(this, "observe", observe !== null && observe !== void 0 ? observe : noop);
|
|
16
|
+
_defineProperty(this, "unobserve", noop);
|
|
17
|
+
_defineProperty(this, "disconnect", disconnect !== null && disconnect !== void 0 ? disconnect : noop);
|
|
18
|
+
outerThis.callback = callback;
|
|
19
|
+
outerThis.mockObserverInstance = this;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
addMockObserverToWindow() {
|
|
24
|
+
this.originalObserver = window.IntersectionObserver;
|
|
25
|
+
window.IntersectionObserver = this.mockObserver;
|
|
26
|
+
}
|
|
27
|
+
removeMockObserverFromWindow() {
|
|
28
|
+
window.IntersectionObserver = this.originalObserver;
|
|
29
|
+
}
|
|
30
|
+
setup(options = {}) {
|
|
31
|
+
this.storeMockObserver(options);
|
|
32
|
+
this.addMockObserverToWindow();
|
|
33
|
+
}
|
|
34
|
+
cleanup() {
|
|
35
|
+
this.removeMockObserverFromWindow();
|
|
36
|
+
}
|
|
37
|
+
triggerIntersect(entry) {
|
|
38
|
+
const entries = [entry];
|
|
39
|
+
this.callback(entries, this.mockObserverInstance);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
4
4
|
import { MediaCardError } from '../errors';
|
|
5
5
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
6
|
const packageName = "@atlaskit/media-card";
|
|
7
|
-
const packageVersion = "77.0.
|
|
7
|
+
const packageVersion = "77.0.3";
|
|
8
8
|
let concurrentExperience;
|
|
9
9
|
const getExperience = id => {
|
|
10
10
|
if (!concurrentExperience) {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -40,7 +40,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
40
40
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
41
41
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
42
42
|
var packageName = "@atlaskit/media-card";
|
|
43
|
-
var packageVersion = "77.0.
|
|
43
|
+
var packageVersion = "77.0.3";
|
|
44
44
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
45
45
|
_inherits(CardBase, _Component);
|
|
46
46
|
var _super = _createSuper(CardBase);
|
|
@@ -735,6 +735,8 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
735
735
|
if (isSSRDataPreview(cardPreview) && isBigger((_this$ssrData3 = this.ssrData) === null || _this$ssrData3 === void 0 ? void 0 : _this$ssrData3.dimensions, dimensions)) {
|
|
736
736
|
// If dimensions from Server have changed and are bigger,
|
|
737
737
|
// we need to refetch
|
|
738
|
+
// This is repeated in componentDidUpdate because in the case of lazy loading true
|
|
739
|
+
// the card will be invisible by default.
|
|
738
740
|
this.refetchSSRPreview(identifier);
|
|
739
741
|
}
|
|
740
742
|
}
|
|
@@ -747,6 +749,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
747
749
|
}, {
|
|
748
750
|
key: "componentDidUpdate",
|
|
749
751
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
752
|
+
var _this$ssrData4;
|
|
750
753
|
var prevMediaClient = prevProps.mediaClient,
|
|
751
754
|
prevIdentifier = prevProps.identifier,
|
|
752
755
|
prevDimensions = prevProps.dimensions;
|
|
@@ -801,6 +804,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
801
804
|
isCardVisible: true
|
|
802
805
|
});
|
|
803
806
|
}
|
|
807
|
+
if (cardPreview && turnedVisible && isFileIdentifier(identifier) && isSSRDataPreview(cardPreview) && isBigger((_this$ssrData4 = this.ssrData) === null || _this$ssrData4 === void 0 ? void 0 : _this$ssrData4.dimensions, dimensions)) {
|
|
808
|
+
// If dimensions from Server have changed and are bigger,
|
|
809
|
+
// we need to refetch
|
|
810
|
+
this.refetchSSRPreview(identifier);
|
|
811
|
+
}
|
|
804
812
|
if (isFileIdentifier(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDiffIdentifier))) {
|
|
805
813
|
this.updateStateForIdentifier(identifier);
|
|
806
814
|
}
|
|
@@ -178,7 +178,7 @@ export var isLocalPreview = function isLocalPreview(preview) {
|
|
|
178
178
|
return localSources.includes(preview.source);
|
|
179
179
|
};
|
|
180
180
|
export var isSSRPreview = function isSSRPreview(preview) {
|
|
181
|
-
return isSSRClientPreview(preview) || isSSRServerPreview(preview);
|
|
181
|
+
return isSSRClientPreview(preview) || isSSRServerPreview(preview) || isSSRDataPreview(preview);
|
|
182
182
|
};
|
|
183
183
|
export var isSSRServerPreview = function isSSRServerPreview(preview) {
|
|
184
184
|
var ssrClientSources = ['ssr-server', 'cache-ssr-server'];
|
|
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
83
83
|
}(React.Component);
|
|
84
84
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
85
85
|
var packageName = "@atlaskit/media-card";
|
|
86
|
-
var packageVersion = "77.0.
|
|
86
|
+
var packageVersion = "77.0.3";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -8,7 +8,8 @@ export var StyledBar = function StyledBar(props) {
|
|
|
8
8
|
showOnTop = props.showOnTop;
|
|
9
9
|
return jsx("div", {
|
|
10
10
|
id: "styledBar",
|
|
11
|
-
|
|
11
|
+
role: "progressbar",
|
|
12
|
+
"aria-valuenow": progress,
|
|
12
13
|
css: styledBarStyles({
|
|
13
14
|
progress: progress,
|
|
14
15
|
breakpoint: breakpoint,
|
|
@@ -41,7 +41,7 @@ import { completeUfoExperience, startUfoExperience } from '../../utils/ufoExperi
|
|
|
41
41
|
import { generateUniqueId } from '../../utils/generateUniqueId';
|
|
42
42
|
import { useFileState } from '@atlaskit/media-client-react';
|
|
43
43
|
var packageName = "@atlaskit/media-card";
|
|
44
|
-
var packageVersion = "77.0.
|
|
44
|
+
var packageVersion = "77.0.3";
|
|
45
45
|
export var CardV2Base = /*#__PURE__*/function (_Component) {
|
|
46
46
|
_inherits(CardV2Base, _Component);
|
|
47
47
|
var _super = _createSuper(CardV2Base);
|
|
@@ -754,6 +754,7 @@ export var CardV2Base = /*#__PURE__*/function (_Component) {
|
|
|
754
754
|
}, {
|
|
755
755
|
key: "componentDidUpdate",
|
|
756
756
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
757
|
+
var _this$ssrData4;
|
|
757
758
|
var prevMediaClient = prevProps.mediaClient,
|
|
758
759
|
prevIdentifier = prevProps.identifier,
|
|
759
760
|
prevDimensions = prevProps.dimensions;
|
|
@@ -808,6 +809,11 @@ export var CardV2Base = /*#__PURE__*/function (_Component) {
|
|
|
808
809
|
isCardVisible: true
|
|
809
810
|
});
|
|
810
811
|
}
|
|
812
|
+
if (cardPreview && turnedVisible && isFileIdentifier(identifier) && isSSRDataPreview(cardPreview) && isBigger((_this$ssrData4 = this.ssrData) === null || _this$ssrData4 === void 0 ? void 0 : _this$ssrData4.dimensions, dimensions)) {
|
|
813
|
+
// If dimensions from Server have changed and are bigger,
|
|
814
|
+
// we need to refetch
|
|
815
|
+
this.refetchSSRPreview(identifier);
|
|
816
|
+
}
|
|
811
817
|
if (isFileIdentifier(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDiffIdentifier))) {
|
|
812
818
|
this.updateStateForIdentifier(identifier);
|
|
813
819
|
}
|
|
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
104
104
|
var analyticsContext = {
|
|
105
105
|
packageVersion: "@atlaskit/media-card",
|
|
106
|
-
packageName: "77.0.
|
|
106
|
+
packageName: "77.0.3",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var noop = function noop() {};
|
|
5
|
+
export var MockIntersectionObserver = /*#__PURE__*/function () {
|
|
6
|
+
function MockIntersectionObserver() {
|
|
7
|
+
_classCallCheck(this, MockIntersectionObserver);
|
|
8
|
+
_defineProperty(this, "callback", noop);
|
|
9
|
+
}
|
|
10
|
+
_createClass(MockIntersectionObserver, [{
|
|
11
|
+
key: "storeMockObserver",
|
|
12
|
+
value: function storeMockObserver(_ref) {
|
|
13
|
+
var observe = _ref.observe,
|
|
14
|
+
disconnect = _ref.disconnect;
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
16
|
+
var outerThis = this;
|
|
17
|
+
this.mockObserver = /*#__PURE__*/function () {
|
|
18
|
+
function _class2(callback) {
|
|
19
|
+
_classCallCheck(this, _class2);
|
|
20
|
+
_defineProperty(this, "observe", observe !== null && observe !== void 0 ? observe : noop);
|
|
21
|
+
_defineProperty(this, "unobserve", noop);
|
|
22
|
+
_defineProperty(this, "disconnect", disconnect !== null && disconnect !== void 0 ? disconnect : noop);
|
|
23
|
+
outerThis.callback = callback;
|
|
24
|
+
outerThis.mockObserverInstance = this;
|
|
25
|
+
}
|
|
26
|
+
return _createClass(_class2);
|
|
27
|
+
}();
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "addMockObserverToWindow",
|
|
31
|
+
value: function addMockObserverToWindow() {
|
|
32
|
+
this.originalObserver = window.IntersectionObserver;
|
|
33
|
+
window.IntersectionObserver = this.mockObserver;
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "removeMockObserverFromWindow",
|
|
37
|
+
value: function removeMockObserverFromWindow() {
|
|
38
|
+
window.IntersectionObserver = this.originalObserver;
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "setup",
|
|
42
|
+
value: function setup() {
|
|
43
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
44
|
+
this.storeMockObserver(options);
|
|
45
|
+
this.addMockObserverToWindow();
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "cleanup",
|
|
49
|
+
value: function cleanup() {
|
|
50
|
+
this.removeMockObserverFromWindow();
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "triggerIntersect",
|
|
54
|
+
value: function triggerIntersect(entry) {
|
|
55
|
+
var entries = [entry];
|
|
56
|
+
this.callback(entries, this.mockObserverInstance);
|
|
57
|
+
}
|
|
58
|
+
}]);
|
|
59
|
+
return MockIntersectionObserver;
|
|
60
|
+
}();
|
|
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
7
7
|
import { MediaCardError } from '../errors';
|
|
8
8
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
9
9
|
var packageName = "@atlaskit/media-card";
|
|
10
|
-
var packageVersion = "77.0.
|
|
10
|
+
var packageVersion = "77.0.3";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type NestedPartial<T> = {
|
|
2
|
+
[K in keyof T]?: Partial<T[K]>;
|
|
3
|
+
};
|
|
4
|
+
type SetupOptions = {
|
|
5
|
+
observe?: () => void;
|
|
6
|
+
disconnect?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare class MockIntersectionObserver {
|
|
9
|
+
private callback;
|
|
10
|
+
private originalObserver?;
|
|
11
|
+
private mockObserver?;
|
|
12
|
+
private mockObserverInstance?;
|
|
13
|
+
private storeMockObserver;
|
|
14
|
+
private addMockObserverToWindow;
|
|
15
|
+
private removeMockObserverFromWindow;
|
|
16
|
+
setup(options?: SetupOptions): void;
|
|
17
|
+
cleanup(): void;
|
|
18
|
+
triggerIntersect(entry: NestedPartial<IntersectionObserverEntry>): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type NestedPartial<T> = {
|
|
2
|
+
[K in keyof T]?: Partial<T[K]>;
|
|
3
|
+
};
|
|
4
|
+
type SetupOptions = {
|
|
5
|
+
observe?: () => void;
|
|
6
|
+
disconnect?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare class MockIntersectionObserver {
|
|
9
|
+
private callback;
|
|
10
|
+
private originalObserver?;
|
|
11
|
+
private mockObserver?;
|
|
12
|
+
private mockObserverInstance?;
|
|
13
|
+
private storeMockObserver;
|
|
14
|
+
private addMockObserverToWindow;
|
|
15
|
+
private removeMockObserverFromWindow;
|
|
16
|
+
setup(options?: SetupOptions): void;
|
|
17
|
+
cleanup(): void;
|
|
18
|
+
triggerIntersect(entry: NestedPartial<IntersectionObserverEntry>): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "77.0.
|
|
3
|
+
"version": "77.0.3",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
40
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
41
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
40
|
+
"@atlaskit/dropdown-menu": "^11.14.0",
|
|
41
|
+
"@atlaskit/editor-shared-styles": "^2.7.0",
|
|
42
42
|
"@atlaskit/icon": "^21.12.0",
|
|
43
43
|
"@atlaskit/media-client": "^24.0.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^1.0.0",
|
|
45
45
|
"@atlaskit/media-common": "^9.0.0",
|
|
46
46
|
"@atlaskit/media-ui": "^25.0.0",
|
|
47
|
-
"@atlaskit/media-viewer": "^48.
|
|
47
|
+
"@atlaskit/media-viewer": "^48.1.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.2",
|
|
49
|
-
"@atlaskit/spinner": "^15.
|
|
49
|
+
"@atlaskit/spinner": "^15.6.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.25.0",
|
|
52
52
|
"@atlaskit/tooltip": "^17.8.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.2.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|