@atlaskit/media-card 78.0.0 → 78.0.2
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 +13 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +24 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +25 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +24 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 78.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fc2ed679e4540`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fc2ed679e4540) -
|
|
8
|
+
Sanitise UGC from fileId in `media-card-render` UFO experience
|
|
9
|
+
|
|
10
|
+
## 78.0.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 78.0.0
|
|
4
17
|
|
|
5
18
|
### Major Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -16,7 +16,7 @@ var _externalImageCard = require("./externalImageCard");
|
|
|
16
16
|
var _fileCard = require("./fileCard");
|
|
17
17
|
var _excluded = ["identifier"];
|
|
18
18
|
var packageName = "@atlaskit/media-card";
|
|
19
|
-
var packageVersion = "78.0.
|
|
19
|
+
var packageVersion = "78.0.2";
|
|
20
20
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
21
21
|
var identifier = _ref.identifier,
|
|
22
22
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -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 = "78.0.
|
|
93
|
+
var packageVersion = "78.0.2";
|
|
94
94
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
95
95
|
packageVersion: packageVersion,
|
|
96
96
|
packageName: packageName,
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "78.0.
|
|
122
|
+
packageName: "78.0.2",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -8,13 +8,14 @@ exports.startUfoExperience = exports.completeUfoExperience = exports.abortUfoExp
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _ufo = require("@atlaskit/ufo");
|
|
10
10
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
11
|
+
var _uuidValidate = _interopRequireDefault(require("uuid-validate"));
|
|
11
12
|
var _analytics = require("./analytics");
|
|
12
13
|
var _errors = require("../errors");
|
|
13
14
|
var _mediaClient = require("@atlaskit/media-client");
|
|
14
15
|
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
16
|
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
17
|
var packageName = "@atlaskit/media-card";
|
|
17
|
-
var packageVersion = "78.0.
|
|
18
|
+
var packageVersion = "78.0.2";
|
|
18
19
|
var concurrentExperience;
|
|
19
20
|
var getExperience = function getExperience(id) {
|
|
20
21
|
if (!concurrentExperience) {
|
|
@@ -33,6 +34,19 @@ var getExperience = function getExperience(id) {
|
|
|
33
34
|
var startUfoExperience = exports.startUfoExperience = function startUfoExperience(id) {
|
|
34
35
|
getExperience(id).start();
|
|
35
36
|
};
|
|
37
|
+
var sanitiseFileAttributes = function sanitiseFileAttributes(fileAttributes) {
|
|
38
|
+
/*
|
|
39
|
+
Allow external image mediaItemType as fileId
|
|
40
|
+
See ExternalImageIdentifier interface on platform/packages/media/media-client/src/identifier.ts
|
|
41
|
+
*/
|
|
42
|
+
var sanitisedFileId = 'INVALID_FILE_ID';
|
|
43
|
+
if (fileAttributes.fileId === 'external-image' || (0, _uuidValidate.default)(fileAttributes.fileId)) {
|
|
44
|
+
sanitisedFileId = fileAttributes.fileId;
|
|
45
|
+
}
|
|
46
|
+
return _objectSpread(_objectSpread({}, fileAttributes), {}, {
|
|
47
|
+
fileId: sanitisedFileId
|
|
48
|
+
});
|
|
49
|
+
};
|
|
36
50
|
var completeUfoExperience = exports.completeUfoExperience = function completeUfoExperience(id, status, fileAttributes, fileStateFlags, ssrReliability) {
|
|
37
51
|
var error = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _errors.MediaCardError('missing-error-data');
|
|
38
52
|
switch (status) {
|
|
@@ -71,17 +85,26 @@ var getBasePayloadAttributes = function getBasePayloadAttributes() {
|
|
|
71
85
|
};
|
|
72
86
|
};
|
|
73
87
|
var succeedUfoExperience = function succeedUfoExperience(id, properties) {
|
|
88
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
89
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
90
|
+
}
|
|
74
91
|
getExperience(id).success({
|
|
75
92
|
metadata: _objectSpread(_objectSpread({}, properties), getBasePayloadAttributes())
|
|
76
93
|
});
|
|
77
94
|
};
|
|
78
95
|
var failUfoExperience = function failUfoExperience(id, properties) {
|
|
96
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
97
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
98
|
+
}
|
|
79
99
|
getExperience(id).failure({
|
|
80
100
|
metadata: _objectSpread(_objectSpread({}, properties), getBasePayloadAttributes())
|
|
81
101
|
});
|
|
82
102
|
};
|
|
83
103
|
var abortUfoExperience = exports.abortUfoExperience = function abortUfoExperience(id, properties) {
|
|
84
104
|
// UFO won't abort if it's already in a final state (succeeded, failed, aborted, etc)
|
|
105
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
106
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
107
|
+
}
|
|
85
108
|
getExperience(id).abort({
|
|
86
109
|
metadata: _objectSpread(_objectSpread({}, properties), getBasePayloadAttributes())
|
|
87
110
|
});
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -7,7 +7,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { ExternalImageCard } from './externalImageCard';
|
|
8
8
|
import { FileCard } from './fileCard';
|
|
9
9
|
const packageName = "@atlaskit/media-card";
|
|
10
|
-
const packageVersion = "78.0.
|
|
10
|
+
const packageVersion = "78.0.2";
|
|
11
11
|
export const CardBase = ({
|
|
12
12
|
identifier,
|
|
13
13
|
...otherProps
|
|
@@ -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 = "78.0.
|
|
69
|
+
const packageVersion = "78.0.2";
|
|
70
70
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
71
71
|
packageVersion,
|
|
72
72
|
packageName,
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "78.0.
|
|
40
|
+
packageName: "78.0.2",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
2
2
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
3
|
+
import isValidId from 'uuid-validate';
|
|
3
4
|
import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
4
5
|
import { MediaCardError } from '../errors';
|
|
5
6
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
7
|
const packageName = "@atlaskit/media-card";
|
|
7
|
-
const packageVersion = "78.0.
|
|
8
|
+
const packageVersion = "78.0.2";
|
|
8
9
|
let concurrentExperience;
|
|
9
10
|
const getExperience = id => {
|
|
10
11
|
if (!concurrentExperience) {
|
|
@@ -23,6 +24,20 @@ const getExperience = id => {
|
|
|
23
24
|
export const startUfoExperience = id => {
|
|
24
25
|
getExperience(id).start();
|
|
25
26
|
};
|
|
27
|
+
const sanitiseFileAttributes = fileAttributes => {
|
|
28
|
+
/*
|
|
29
|
+
Allow external image mediaItemType as fileId
|
|
30
|
+
See ExternalImageIdentifier interface on platform/packages/media/media-client/src/identifier.ts
|
|
31
|
+
*/
|
|
32
|
+
let sanitisedFileId = 'INVALID_FILE_ID';
|
|
33
|
+
if (fileAttributes.fileId === 'external-image' || isValidId(fileAttributes.fileId)) {
|
|
34
|
+
sanitisedFileId = fileAttributes.fileId;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
...fileAttributes,
|
|
38
|
+
fileId: sanitisedFileId
|
|
39
|
+
};
|
|
40
|
+
};
|
|
26
41
|
export const completeUfoExperience = (id, status, fileAttributes, fileStateFlags, ssrReliability, error = new MediaCardError('missing-error-data')) => {
|
|
27
42
|
switch (status) {
|
|
28
43
|
case 'complete':
|
|
@@ -58,6 +73,9 @@ const getBasePayloadAttributes = () => ({
|
|
|
58
73
|
mediaRegion: getMediaRegion()
|
|
59
74
|
});
|
|
60
75
|
const succeedUfoExperience = (id, properties) => {
|
|
76
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
77
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
78
|
+
}
|
|
61
79
|
getExperience(id).success({
|
|
62
80
|
metadata: {
|
|
63
81
|
...properties,
|
|
@@ -66,6 +84,9 @@ const succeedUfoExperience = (id, properties) => {
|
|
|
66
84
|
});
|
|
67
85
|
};
|
|
68
86
|
const failUfoExperience = (id, properties) => {
|
|
87
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
88
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
89
|
+
}
|
|
69
90
|
getExperience(id).failure({
|
|
70
91
|
metadata: {
|
|
71
92
|
...properties,
|
|
@@ -75,6 +96,9 @@ const failUfoExperience = (id, properties) => {
|
|
|
75
96
|
};
|
|
76
97
|
export const abortUfoExperience = (id, properties) => {
|
|
77
98
|
// UFO won't abort if it's already in a final state (succeeded, failed, aborted, etc)
|
|
99
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
100
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
101
|
+
}
|
|
78
102
|
getExperience(id).abort({
|
|
79
103
|
metadata: {
|
|
80
104
|
...properties,
|
package/dist/esm/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
9
9
|
import { ExternalImageCard } from './externalImageCard';
|
|
10
10
|
import { FileCard } from './fileCard';
|
|
11
11
|
var packageName = "@atlaskit/media-card";
|
|
12
|
-
var packageVersion = "78.0.
|
|
12
|
+
var packageVersion = "78.0.2";
|
|
13
13
|
export var CardBase = function CardBase(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -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 = "78.0.
|
|
86
|
+
var packageVersion = "78.0.2";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
104
104
|
var analyticsContext = {
|
|
105
105
|
packageVersion: "@atlaskit/media-card",
|
|
106
|
-
packageName: "78.0.
|
|
106
|
+
packageName: "78.0.2",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -3,11 +3,12 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
5
5
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
6
|
+
import isValidId from 'uuid-validate';
|
|
6
7
|
import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
7
8
|
import { MediaCardError } from '../errors';
|
|
8
9
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
9
10
|
var packageName = "@atlaskit/media-card";
|
|
10
|
-
var packageVersion = "78.0.
|
|
11
|
+
var packageVersion = "78.0.2";
|
|
11
12
|
var concurrentExperience;
|
|
12
13
|
var getExperience = function getExperience(id) {
|
|
13
14
|
if (!concurrentExperience) {
|
|
@@ -26,6 +27,19 @@ var getExperience = function getExperience(id) {
|
|
|
26
27
|
export var startUfoExperience = function startUfoExperience(id) {
|
|
27
28
|
getExperience(id).start();
|
|
28
29
|
};
|
|
30
|
+
var sanitiseFileAttributes = function sanitiseFileAttributes(fileAttributes) {
|
|
31
|
+
/*
|
|
32
|
+
Allow external image mediaItemType as fileId
|
|
33
|
+
See ExternalImageIdentifier interface on platform/packages/media/media-client/src/identifier.ts
|
|
34
|
+
*/
|
|
35
|
+
var sanitisedFileId = 'INVALID_FILE_ID';
|
|
36
|
+
if (fileAttributes.fileId === 'external-image' || isValidId(fileAttributes.fileId)) {
|
|
37
|
+
sanitisedFileId = fileAttributes.fileId;
|
|
38
|
+
}
|
|
39
|
+
return _objectSpread(_objectSpread({}, fileAttributes), {}, {
|
|
40
|
+
fileId: sanitisedFileId
|
|
41
|
+
});
|
|
42
|
+
};
|
|
29
43
|
export var completeUfoExperience = function completeUfoExperience(id, status, fileAttributes, fileStateFlags, ssrReliability) {
|
|
30
44
|
var error = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new MediaCardError('missing-error-data');
|
|
31
45
|
switch (status) {
|
|
@@ -64,17 +78,26 @@ var getBasePayloadAttributes = function getBasePayloadAttributes() {
|
|
|
64
78
|
};
|
|
65
79
|
};
|
|
66
80
|
var succeedUfoExperience = function succeedUfoExperience(id, properties) {
|
|
81
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
82
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
83
|
+
}
|
|
67
84
|
getExperience(id).success({
|
|
68
85
|
metadata: _objectSpread(_objectSpread({}, properties), getBasePayloadAttributes())
|
|
69
86
|
});
|
|
70
87
|
};
|
|
71
88
|
var failUfoExperience = function failUfoExperience(id, properties) {
|
|
89
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
90
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
91
|
+
}
|
|
72
92
|
getExperience(id).failure({
|
|
73
93
|
metadata: _objectSpread(_objectSpread({}, properties), getBasePayloadAttributes())
|
|
74
94
|
});
|
|
75
95
|
};
|
|
76
96
|
export var abortUfoExperience = function abortUfoExperience(id, properties) {
|
|
77
97
|
// UFO won't abort if it's already in a final state (succeeded, failed, aborted, etc)
|
|
98
|
+
if (properties !== null && properties !== void 0 && properties.fileAttributes) {
|
|
99
|
+
properties.fileAttributes = sanitiseFileAttributes(properties.fileAttributes);
|
|
100
|
+
}
|
|
78
101
|
getExperience(id).abort({
|
|
79
102
|
metadata: _objectSpread(_objectSpread({}, properties), getBasePayloadAttributes())
|
|
80
103
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "78.0.
|
|
3
|
+
"version": "78.0.2",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@atlaskit/media-svg": "^0.1.3",
|
|
48
48
|
"@atlaskit/media-ui": "^25.10.0",
|
|
49
49
|
"@atlaskit/media-viewer": "^48.6.0",
|
|
50
|
-
"@atlaskit/platform-feature-flags": "^0.
|
|
51
|
-
"@atlaskit/primitives": "^
|
|
50
|
+
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
51
|
+
"@atlaskit/primitives": "^10.0.0",
|
|
52
52
|
"@atlaskit/spinner": "^16.2.0",
|
|
53
53
|
"@atlaskit/theme": "^12.11.0",
|
|
54
54
|
"@atlaskit/tokens": "^1.53.0",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"classnames": "^2.2.5",
|
|
61
61
|
"eventemitter2": "^4.1.0",
|
|
62
62
|
"lru_map": "^0.4.1",
|
|
63
|
-
"react-loadable": "^5.1.0"
|
|
63
|
+
"react-loadable": "^5.1.0",
|
|
64
|
+
"uuid-validate": "^0.0.3"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"@emotion/react": "^11.7.1",
|