@atlaskit/media-card 74.1.8 → 74.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 +17 -0
- package/dist/cjs/card/card.js +11 -6
- package/dist/cjs/card/cardAnalytics.js +6 -5
- package/dist/cjs/card/getCardPreview/helpers.js +3 -3
- package/dist/cjs/card/getCardPreview/index.js +6 -6
- package/dist/cjs/utils/analytics.js +14 -8
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/cjs/utils/videoSnapshot.js +36 -11
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/card.js +13 -6
- package/dist/es2019/card/cardAnalytics.js +6 -6
- package/dist/es2019/card/getCardPreview/helpers.js +2 -2
- package/dist/es2019/card/getCardPreview/index.js +5 -4
- package/dist/es2019/utils/analytics.js +14 -8
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/es2019/utils/videoSnapshot.js +36 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/card.js +13 -6
- package/dist/esm/card/cardAnalytics.js +6 -5
- package/dist/esm/card/getCardPreview/helpers.js +3 -3
- package/dist/esm/card/getCardPreview/index.js +6 -6
- package/dist/esm/utils/analytics.js +14 -8
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/esm/utils/videoSnapshot.js +36 -10
- package/dist/esm/version.json +1 -1
- package/dist/types/card/card.d.ts +1 -0
- package/dist/types/card/cardAnalytics.d.ts +3 -3
- package/dist/types/card/getCardPreview/helpers.d.ts +1 -1
- package/dist/types/card/getCardPreview/index.d.ts +3 -2
- package/dist/types/utils/analytics.d.ts +8 -8
- package/dist/types-ts4.0/card/card.d.ts +1 -0
- package/dist/types-ts4.0/card/cardAnalytics.d.ts +3 -3
- package/dist/types-ts4.0/card/getCardPreview/helpers.d.ts +1 -1
- package/dist/types-ts4.0/card/getCardPreview/index.d.ts +3 -2
- package/dist/types-ts4.0/utils/analytics.d.ts +8 -8
- package/package.json +9 -11
- package/report.api.md +192 -85
- package/dist/cjs/__tests_external__/index.js +0 -13
- package/dist/cjs/__tests_external__/page-objects/MediaCard.js +0 -67
- package/dist/cjs/in-product.js +0 -13
- package/dist/es2019/__tests_external__/index.js +0 -1
- package/dist/es2019/__tests_external__/page-objects/MediaCard.js +0 -23
- package/dist/es2019/in-product.js +0 -5
- package/dist/esm/__tests_external__/index.js +0 -1
- package/dist/esm/__tests_external__/page-objects/MediaCard.js +0 -53
- package/dist/esm/in-product.js +0 -5
- package/dist/types/__tests_external__/index.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/MediaCard.d.ts +0 -8
- package/dist/types/in-product.d.ts +0 -5
- package/dist/types-ts4.0/__tests_external__/index.d.ts +0 -1
- package/dist/types-ts4.0/__tests_external__/page-objects/MediaCard.d.ts +0 -8
- package/dist/types-ts4.0/in-product.d.ts +0 -5
- package/in-product/package.json +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 74.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2c402e87213`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c402e87213) - [Experimental] Add traceId in media card get image request.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`bf8302c838a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bf8302c838a) - Implemented internal functionality to create local video preview.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 74.1.9
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`d2cde0ebdfd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2cde0ebdfd) - fix editor cypress tests and delete media cypress tests
|
|
19
|
+
|
|
3
20
|
## 74.1.8
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -90,7 +90,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
90
90
|
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; } }
|
|
91
91
|
|
|
92
92
|
var packageName = "@atlaskit/media-card";
|
|
93
|
-
var packageVersion = "74.
|
|
93
|
+
var packageVersion = "74.2.0";
|
|
94
94
|
|
|
95
95
|
var CardBase = /*#__PURE__*/function (_Component) {
|
|
96
96
|
(0, _inherits2.default)(CardBase, _Component);
|
|
@@ -101,6 +101,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
101
101
|
// of Cards regardless of whether it shares the same file (either internal or external)
|
|
102
102
|
// We initialise timeElapsedTillCommenced
|
|
103
103
|
// to avoid extra branching on a possibly undefined value.
|
|
104
|
+
// Generate unique traceId for file
|
|
104
105
|
function CardBase(props) {
|
|
105
106
|
var _this;
|
|
106
107
|
|
|
@@ -121,6 +122,9 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
121
122
|
}
|
|
122
123
|
});
|
|
123
124
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "timeElapsedTillCommenced", performance.now());
|
|
125
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "traceContext", {
|
|
126
|
+
traceId: (0, _mediaCommon.getRandomHex)(16)
|
|
127
|
+
});
|
|
124
128
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getImageURLParams", function (_ref) {
|
|
125
129
|
var collection = _ref.collectionName;
|
|
126
130
|
return _objectSpread(_objectSpread({
|
|
@@ -154,7 +158,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
154
158
|
alt: alt
|
|
155
159
|
}) : undefined;
|
|
156
160
|
});
|
|
157
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getCardPreviewParams", function (identifier, fileState) {
|
|
161
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getCardPreviewParams", function (identifier, fileState, traceContext) {
|
|
158
162
|
var isBannedLocalPreview = _this.state.isBannedLocalPreview;
|
|
159
163
|
var id = identifier.id;
|
|
160
164
|
var _this$props2 = _this.props,
|
|
@@ -172,7 +176,8 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
172
176
|
imageUrlParams: _this.getImageURLParams(identifier),
|
|
173
177
|
mediaBlobUrlAttrs: _this.getMediaBlobUrlAttrs(identifier, fileState),
|
|
174
178
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
175
|
-
featureFlags: _this.props.featureFlags
|
|
179
|
+
featureFlags: _this.props.featureFlags,
|
|
180
|
+
traceId: traceContext.traceId
|
|
176
181
|
};
|
|
177
182
|
});
|
|
178
183
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setCacheSSRPreview", function (identifier) {
|
|
@@ -233,7 +238,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
233
238
|
switch (_context2.prev = _context2.next) {
|
|
234
239
|
case 0:
|
|
235
240
|
_context2.prev = 0;
|
|
236
|
-
params = _this.getCardPreviewParams(identifier, fileState);
|
|
241
|
+
params = _this.getCardPreviewParams(identifier, fileState, _this.traceContext);
|
|
237
242
|
_context2.next = 4;
|
|
238
243
|
return (0, _getCardPreview.getCardPreview)(params);
|
|
239
244
|
|
|
@@ -989,7 +994,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
989
994
|
status = _this$state7.status,
|
|
990
995
|
error = _this$state7.error;
|
|
991
996
|
var createAnalyticsEvent = this.props.createAnalyticsEvent;
|
|
992
|
-
createAnalyticsEvent && (0, _cardAnalytics.fireOperationalEvent)(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error);
|
|
997
|
+
createAnalyticsEvent && (0, _cardAnalytics.fireOperationalEvent)(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error, this.traceContext);
|
|
993
998
|
(0, _ufoExperiences.completeUfoExperience)(this.internalOccurrenceKey, status, this.fileAttributes, this.fileStateFlags, this.ssrReliability, error);
|
|
994
999
|
}
|
|
995
1000
|
}, {
|
|
@@ -1001,7 +1006,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
1001
1006
|
overall: {
|
|
1002
1007
|
durationSincePageStart: this.timeElapsedTillCommenced
|
|
1003
1008
|
}
|
|
1004
|
-
});
|
|
1009
|
+
}, this.traceContext);
|
|
1005
1010
|
(0, _ufoExperiences.startUfoExperience)(this.internalOccurrenceKey);
|
|
1006
1011
|
}
|
|
1007
1012
|
}, {
|
|
@@ -11,6 +11,7 @@ var _errors = require("../errors");
|
|
|
11
11
|
|
|
12
12
|
var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability) {
|
|
13
13
|
var error = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _errors.MediaCardError('missing-error-data');
|
|
14
|
+
var traceContext = arguments.length > 6 ? arguments[6] : undefined;
|
|
14
15
|
|
|
15
16
|
var fireEvent = function fireEvent(payload) {
|
|
16
17
|
return (0, _analytics.fireMediaCardEvent)(payload, createAnalyticsEvent);
|
|
@@ -18,23 +19,23 @@ var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, s
|
|
|
18
19
|
|
|
19
20
|
switch (status) {
|
|
20
21
|
case 'complete':
|
|
21
|
-
fireEvent((0, _analytics.getRenderSucceededEventPayload)(fileAttributes, performanceAttributes, ssrReliability));
|
|
22
|
+
fireEvent((0, _analytics.getRenderSucceededEventPayload)(fileAttributes, performanceAttributes, ssrReliability, traceContext));
|
|
22
23
|
break;
|
|
23
24
|
|
|
24
25
|
case 'failed-processing':
|
|
25
|
-
fireEvent((0, _analytics.getRenderFailedFileStatusPayload)(fileAttributes, performanceAttributes, ssrReliability));
|
|
26
|
+
fireEvent((0, _analytics.getRenderFailedFileStatusPayload)(fileAttributes, performanceAttributes, ssrReliability, traceContext));
|
|
26
27
|
break;
|
|
27
28
|
|
|
28
29
|
case 'error':
|
|
29
|
-
fireEvent((0, _analytics.getRenderErrorEventPayload)(fileAttributes, performanceAttributes, error, ssrReliability));
|
|
30
|
+
fireEvent((0, _analytics.getRenderErrorEventPayload)(fileAttributes, performanceAttributes, error, ssrReliability, traceContext));
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
exports.fireOperationalEvent = fireOperationalEvent;
|
|
35
36
|
|
|
36
|
-
var fireCommencedEvent = function fireCommencedEvent(createAnalyticsEvent, fileAttributes, performanceAttributes) {
|
|
37
|
-
(0, _analytics.fireMediaCardEvent)((0, _analytics.getRenderCommencedEventPayload)(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
37
|
+
var fireCommencedEvent = function fireCommencedEvent(createAnalyticsEvent, fileAttributes, performanceAttributes, traceContext) {
|
|
38
|
+
(0, _analytics.fireMediaCardEvent)((0, _analytics.getRenderCommencedEventPayload)(fileAttributes, performanceAttributes, traceContext), createAnalyticsEvent);
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
exports.fireCommencedEvent = fireCommencedEvent;
|
|
@@ -176,7 +176,7 @@ var getCardPreviewFromFilePreview = /*#__PURE__*/function () {
|
|
|
176
176
|
exports.getCardPreviewFromFilePreview = getCardPreviewFromFilePreview;
|
|
177
177
|
|
|
178
178
|
var getCardPreviewFromBackend = /*#__PURE__*/function () {
|
|
179
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(mediaClient, id, params) {
|
|
179
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(mediaClient, id, params, traceId) {
|
|
180
180
|
var blob;
|
|
181
181
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
182
182
|
while (1) {
|
|
@@ -184,7 +184,7 @@ var getCardPreviewFromBackend = /*#__PURE__*/function () {
|
|
|
184
184
|
case 0:
|
|
185
185
|
_context4.prev = 0;
|
|
186
186
|
_context4.next = 3;
|
|
187
|
-
return mediaClient.getImage(id, params);
|
|
187
|
+
return mediaClient.getImage(id, params, undefined, undefined, traceId);
|
|
188
188
|
|
|
189
189
|
case 3:
|
|
190
190
|
blob = _context4.sent;
|
|
@@ -207,7 +207,7 @@ var getCardPreviewFromBackend = /*#__PURE__*/function () {
|
|
|
207
207
|
}, _callee4, null, [[0, 7]]);
|
|
208
208
|
}));
|
|
209
209
|
|
|
210
|
-
return function getCardPreviewFromBackend(_x4, _x5, _x6) {
|
|
210
|
+
return function getCardPreviewFromBackend(_x4, _x5, _x6, _x7) {
|
|
211
211
|
return _ref4.apply(this, arguments);
|
|
212
212
|
};
|
|
213
213
|
}();
|
|
@@ -126,13 +126,13 @@ var extendAndCachePreview = function extendAndCachePreview(id, mode, preview, me
|
|
|
126
126
|
|
|
127
127
|
var getCardPreview = /*#__PURE__*/function () {
|
|
128
128
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
129
|
-
var mediaClient, id, _ref$dimensions, dimensions, filePreview, onLocalPreviewError, isRemotePreviewReady, imageUrlParams, mediaBlobUrlAttrs, createAnalyticsEvent, featureFlags, mode, cachedPreview, dimensionsAreBigger, localPreview, remotePreview;
|
|
129
|
+
var mediaClient, id, _ref$dimensions, dimensions, filePreview, onLocalPreviewError, isRemotePreviewReady, imageUrlParams, mediaBlobUrlAttrs, createAnalyticsEvent, featureFlags, traceId, mode, cachedPreview, dimensionsAreBigger, localPreview, remotePreview;
|
|
130
130
|
|
|
131
131
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
132
132
|
while (1) {
|
|
133
133
|
switch (_context.prev = _context.next) {
|
|
134
134
|
case 0:
|
|
135
|
-
mediaClient = _ref.mediaClient, id = _ref.id, _ref$dimensions = _ref.dimensions, dimensions = _ref$dimensions === void 0 ? {} : _ref$dimensions, filePreview = _ref.filePreview, onLocalPreviewError = _ref.onLocalPreviewError, isRemotePreviewReady = _ref.isRemotePreviewReady, imageUrlParams = _ref.imageUrlParams, mediaBlobUrlAttrs = _ref.mediaBlobUrlAttrs, createAnalyticsEvent = _ref.createAnalyticsEvent, featureFlags = _ref.featureFlags;
|
|
135
|
+
mediaClient = _ref.mediaClient, id = _ref.id, _ref$dimensions = _ref.dimensions, dimensions = _ref$dimensions === void 0 ? {} : _ref$dimensions, filePreview = _ref.filePreview, onLocalPreviewError = _ref.onLocalPreviewError, isRemotePreviewReady = _ref.isRemotePreviewReady, imageUrlParams = _ref.imageUrlParams, mediaBlobUrlAttrs = _ref.mediaBlobUrlAttrs, createAnalyticsEvent = _ref.createAnalyticsEvent, featureFlags = _ref.featureFlags, traceId = _ref.traceId;
|
|
136
136
|
mode = imageUrlParams.mode;
|
|
137
137
|
cachedPreview = _cache.default.get(id, mode);
|
|
138
138
|
dimensionsAreBigger = (0, _dimensionComparer.isBigger)(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions);
|
|
@@ -214,7 +214,7 @@ var getCardPreview = /*#__PURE__*/function () {
|
|
|
214
214
|
|
|
215
215
|
case 22:
|
|
216
216
|
_context.next = 24;
|
|
217
|
-
return fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs);
|
|
217
|
+
return fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs, traceId);
|
|
218
218
|
|
|
219
219
|
case 24:
|
|
220
220
|
remotePreview = _context.sent;
|
|
@@ -318,14 +318,14 @@ var isSSRDataPreview = function isSSRDataPreview(preview) {
|
|
|
318
318
|
exports.isSSRDataPreview = isSSRDataPreview;
|
|
319
319
|
|
|
320
320
|
var fetchAndCacheRemotePreview = /*#__PURE__*/function () {
|
|
321
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(mediaClient, id, dimensions, params, mediaBlobUrlAttrs) {
|
|
321
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(mediaClient, id, dimensions, params, mediaBlobUrlAttrs, traceId) {
|
|
322
322
|
var remotePreview;
|
|
323
323
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
324
324
|
while (1) {
|
|
325
325
|
switch (_context2.prev = _context2.next) {
|
|
326
326
|
case 0:
|
|
327
327
|
_context2.next = 2;
|
|
328
|
-
return (0, _helpers.getCardPreviewFromBackend)(mediaClient, id, params);
|
|
328
|
+
return (0, _helpers.getCardPreviewFromBackend)(mediaClient, id, params, traceId);
|
|
329
329
|
|
|
330
330
|
case 2:
|
|
331
331
|
remotePreview = _context2.sent;
|
|
@@ -341,7 +341,7 @@ var fetchAndCacheRemotePreview = /*#__PURE__*/function () {
|
|
|
341
341
|
}, _callee2);
|
|
342
342
|
}));
|
|
343
343
|
|
|
344
|
-
return function fetchAndCacheRemotePreview(_x2, _x3, _x4, _x5, _x6) {
|
|
344
|
+
return function fetchAndCacheRemotePreview(_x2, _x3, _x4, _x5, _x6, _x7) {
|
|
345
345
|
return _ref4.apply(this, arguments);
|
|
346
346
|
};
|
|
347
347
|
}();
|
|
@@ -65,21 +65,24 @@ var getRenderPreviewableCardPayload = function getRenderPreviewableCardPayload(f
|
|
|
65
65
|
|
|
66
66
|
exports.getRenderPreviewableCardPayload = getRenderPreviewableCardPayload;
|
|
67
67
|
|
|
68
|
-
var getRenderCommencedEventPayload = function getRenderCommencedEventPayload(fileAttributes, performanceAttributes) {
|
|
68
|
+
var getRenderCommencedEventPayload = function getRenderCommencedEventPayload(fileAttributes, performanceAttributes, traceContext) {
|
|
69
69
|
return {
|
|
70
70
|
eventType: 'operational',
|
|
71
71
|
action: 'commenced',
|
|
72
72
|
actionSubject: 'mediaCardRender',
|
|
73
73
|
attributes: {
|
|
74
74
|
fileAttributes: fileAttributes,
|
|
75
|
-
performanceAttributes: performanceAttributes
|
|
75
|
+
performanceAttributes: performanceAttributes,
|
|
76
|
+
traceContext: {
|
|
77
|
+
traceId: traceContext.traceId
|
|
78
|
+
}
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
};
|
|
79
82
|
|
|
80
83
|
exports.getRenderCommencedEventPayload = getRenderCommencedEventPayload;
|
|
81
84
|
|
|
82
|
-
var getRenderSucceededEventPayload = function getRenderSucceededEventPayload(fileAttributes, performanceAttributes, ssrReliability) {
|
|
85
|
+
var getRenderSucceededEventPayload = function getRenderSucceededEventPayload(fileAttributes, performanceAttributes, ssrReliability, traceContext) {
|
|
83
86
|
return {
|
|
84
87
|
eventType: 'operational',
|
|
85
88
|
action: 'succeeded',
|
|
@@ -88,7 +91,8 @@ var getRenderSucceededEventPayload = function getRenderSucceededEventPayload(fil
|
|
|
88
91
|
fileAttributes: fileAttributes,
|
|
89
92
|
performanceAttributes: performanceAttributes,
|
|
90
93
|
status: 'success',
|
|
91
|
-
ssrReliability: ssrReliability
|
|
94
|
+
ssrReliability: ssrReliability,
|
|
95
|
+
traceContext: traceContext
|
|
92
96
|
}
|
|
93
97
|
};
|
|
94
98
|
};
|
|
@@ -189,7 +193,7 @@ var extractErrorInfo = function extractErrorInfo(error) {
|
|
|
189
193
|
|
|
190
194
|
exports.extractErrorInfo = extractErrorInfo;
|
|
191
195
|
|
|
192
|
-
var getRenderErrorEventPayload = function getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability) {
|
|
196
|
+
var getRenderErrorEventPayload = function getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability, traceContext) {
|
|
193
197
|
return {
|
|
194
198
|
eventType: 'operational',
|
|
195
199
|
action: 'failed',
|
|
@@ -200,14 +204,15 @@ var getRenderErrorEventPayload = function getRenderErrorEventPayload(fileAttribu
|
|
|
200
204
|
status: 'fail'
|
|
201
205
|
}, extractErrorInfo(error)), {}, {
|
|
202
206
|
request: getRenderErrorRequestMetadata(error),
|
|
203
|
-
ssrReliability: ssrReliability
|
|
207
|
+
ssrReliability: ssrReliability,
|
|
208
|
+
traceContext: traceContext
|
|
204
209
|
})
|
|
205
210
|
};
|
|
206
211
|
};
|
|
207
212
|
|
|
208
213
|
exports.getRenderErrorEventPayload = getRenderErrorEventPayload;
|
|
209
214
|
|
|
210
|
-
var getRenderFailedFileStatusPayload = function getRenderFailedFileStatusPayload(fileAttributes, performanceAttributes, ssrReliability) {
|
|
215
|
+
var getRenderFailedFileStatusPayload = function getRenderFailedFileStatusPayload(fileAttributes, performanceAttributes, ssrReliability, traceContext) {
|
|
211
216
|
return {
|
|
212
217
|
eventType: 'operational',
|
|
213
218
|
action: 'failed',
|
|
@@ -217,7 +222,8 @@ var getRenderFailedFileStatusPayload = function getRenderFailedFileStatusPayload
|
|
|
217
222
|
performanceAttributes: performanceAttributes,
|
|
218
223
|
status: 'fail',
|
|
219
224
|
failReason: 'failed-processing',
|
|
220
|
-
ssrReliability: ssrReliability
|
|
225
|
+
ssrReliability: ssrReliability,
|
|
226
|
+
traceContext: traceContext
|
|
221
227
|
}
|
|
222
228
|
};
|
|
223
229
|
};
|
|
@@ -22,7 +22,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
22
22
|
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) { (0, _defineProperty2.default)(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; }
|
|
23
23
|
|
|
24
24
|
var packageName = "@atlaskit/media-card";
|
|
25
|
-
var packageVersion = "74.
|
|
25
|
+
var packageVersion = "74.2.0";
|
|
26
26
|
var concurrentExperience;
|
|
27
27
|
|
|
28
28
|
var getExperience = function getExperience(id) {
|
|
@@ -11,25 +11,50 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
|
|
14
|
-
var _videoSnapshot = _interopRequireDefault(require("video-snapshot"));
|
|
15
|
-
|
|
16
14
|
var takeSnapshot = /*#__PURE__*/function () {
|
|
17
15
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(blob) {
|
|
18
|
-
var snapshooter, dataUri;
|
|
19
16
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
20
17
|
while (1) {
|
|
21
18
|
switch (_context.prev = _context.next) {
|
|
22
19
|
case 0:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
21
|
+
var url = URL.createObjectURL(blob);
|
|
22
|
+
var video = document.createElement('video');
|
|
23
|
+
video.preload = 'metadata';
|
|
24
|
+
video.src = url;
|
|
25
|
+
video.muted = true;
|
|
26
|
+
video.play().catch(function () {
|
|
27
|
+
return reject(new Error('failed to play video'));
|
|
28
|
+
});
|
|
29
|
+
video.addEventListener('timeupdate', function timeUpdateHandler() {
|
|
30
|
+
video.removeEventListener('timeupdate', timeUpdateHandler);
|
|
31
|
+
video.pause();
|
|
32
|
+
URL.revokeObjectURL(url); //create canvas to draw our first frame on.
|
|
33
|
+
|
|
34
|
+
if (!video.videoWidth && !video.videoHeight) {
|
|
35
|
+
return reject(new Error('error retrieving video dimensions'));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var canvas = document.createElement('canvas');
|
|
39
|
+
canvas.width = video.videoWidth;
|
|
40
|
+
canvas.height = video.videoHeight;
|
|
41
|
+
var context = canvas.getContext('2d');
|
|
42
|
+
|
|
43
|
+
if (!context) {
|
|
44
|
+
return reject(new Error('error creating canvas context'));
|
|
45
|
+
}
|
|
26
46
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
48
|
+
var dataURL = canvas.toDataURL('image/jpeg', 0.85);
|
|
49
|
+
resolve(dataURL);
|
|
50
|
+
});
|
|
51
|
+
video.addEventListener('error', function () {
|
|
52
|
+
reject(new Error('failed to load video'));
|
|
53
|
+
URL.revokeObjectURL(url);
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
31
56
|
|
|
32
|
-
case
|
|
57
|
+
case 1:
|
|
33
58
|
case "end":
|
|
34
59
|
return _context.stop();
|
|
35
60
|
}
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/card/card.js
CHANGED
|
@@ -4,6 +4,7 @@ import ReactDOM from 'react-dom';
|
|
|
4
4
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
5
|
import { withMediaAnalyticsContext } from '@atlaskit/media-common';
|
|
6
6
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
7
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
7
8
|
import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, isProcessedFileState, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
|
|
8
9
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
9
10
|
import { injectIntl, IntlProvider } from 'react-intl-next';
|
|
@@ -25,12 +26,13 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
25
26
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
26
27
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
27
28
|
const packageName = "@atlaskit/media-card";
|
|
28
|
-
const packageVersion = "74.
|
|
29
|
+
const packageVersion = "74.2.0";
|
|
29
30
|
export class CardBase extends Component {
|
|
30
31
|
// An internalOccurrenceKey is a randomly generated value to differentiate various instances
|
|
31
32
|
// of Cards regardless of whether it shares the same file (either internal or external)
|
|
32
33
|
// We initialise timeElapsedTillCommenced
|
|
33
34
|
// to avoid extra branching on a possibly undefined value.
|
|
35
|
+
// Generate unique traceId for file
|
|
34
36
|
constructor(props) {
|
|
35
37
|
super(props);
|
|
36
38
|
|
|
@@ -54,6 +56,10 @@ export class CardBase extends Component {
|
|
|
54
56
|
|
|
55
57
|
_defineProperty(this, "timeElapsedTillCommenced", performance.now());
|
|
56
58
|
|
|
59
|
+
_defineProperty(this, "traceContext", {
|
|
60
|
+
traceId: getRandomHex(16)
|
|
61
|
+
});
|
|
62
|
+
|
|
57
63
|
_defineProperty(this, "getImageURLParams", ({
|
|
58
64
|
collectionName: collection
|
|
59
65
|
}) => ({
|
|
@@ -90,7 +96,7 @@ export class CardBase extends Component {
|
|
|
90
96
|
} : undefined;
|
|
91
97
|
});
|
|
92
98
|
|
|
93
|
-
_defineProperty(this, "getCardPreviewParams", (identifier, fileState) => {
|
|
99
|
+
_defineProperty(this, "getCardPreviewParams", (identifier, fileState, traceContext) => {
|
|
94
100
|
const {
|
|
95
101
|
isBannedLocalPreview
|
|
96
102
|
} = this.state;
|
|
@@ -112,7 +118,8 @@ export class CardBase extends Component {
|
|
|
112
118
|
imageUrlParams: this.getImageURLParams(identifier),
|
|
113
119
|
mediaBlobUrlAttrs: this.getMediaBlobUrlAttrs(identifier, fileState),
|
|
114
120
|
createAnalyticsEvent,
|
|
115
|
-
featureFlags: this.props.featureFlags
|
|
121
|
+
featureFlags: this.props.featureFlags,
|
|
122
|
+
traceId: traceContext.traceId
|
|
116
123
|
};
|
|
117
124
|
});
|
|
118
125
|
|
|
@@ -146,7 +153,7 @@ export class CardBase extends Component {
|
|
|
146
153
|
|
|
147
154
|
_defineProperty(this, "resolvePreview", async (identifier, fileState) => {
|
|
148
155
|
try {
|
|
149
|
-
const params = this.getCardPreviewParams(identifier, fileState);
|
|
156
|
+
const params = this.getCardPreviewParams(identifier, fileState, this.traceContext);
|
|
150
157
|
const cardPreview = await getCardPreview(params);
|
|
151
158
|
this.safeSetState({
|
|
152
159
|
cardPreview
|
|
@@ -937,7 +944,7 @@ export class CardBase extends Component {
|
|
|
937
944
|
const {
|
|
938
945
|
createAnalyticsEvent
|
|
939
946
|
} = this.props;
|
|
940
|
-
createAnalyticsEvent && fireOperationalEvent(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error);
|
|
947
|
+
createAnalyticsEvent && fireOperationalEvent(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error, this.traceContext);
|
|
941
948
|
completeUfoExperience(this.internalOccurrenceKey, status, this.fileAttributes, this.fileStateFlags, this.ssrReliability, error);
|
|
942
949
|
}
|
|
943
950
|
|
|
@@ -950,7 +957,7 @@ export class CardBase extends Component {
|
|
|
950
957
|
overall: {
|
|
951
958
|
durationSincePageStart: this.timeElapsedTillCommenced
|
|
952
959
|
}
|
|
953
|
-
});
|
|
960
|
+
}, this.traceContext);
|
|
954
961
|
startUfoExperience(this.internalOccurrenceKey);
|
|
955
962
|
}
|
|
956
963
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { fireMediaCardEvent, getRenderSucceededEventPayload, getRenderErrorEventPayload, getRenderFailedFileStatusPayload, getCopiedFilePayload, getRenderCommencedEventPayload, getRenderPreviewableCardPayload } from '../utils/analytics';
|
|
2
2
|
import { MediaCardError } from '../errors';
|
|
3
|
-
export const fireOperationalEvent = (createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability, error = new MediaCardError('missing-error-data')) => {
|
|
3
|
+
export const fireOperationalEvent = (createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability, error = new MediaCardError('missing-error-data'), traceContext) => {
|
|
4
4
|
const fireEvent = payload => fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
5
5
|
|
|
6
6
|
switch (status) {
|
|
7
7
|
case 'complete':
|
|
8
|
-
fireEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes, ssrReliability));
|
|
8
|
+
fireEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes, ssrReliability, traceContext));
|
|
9
9
|
break;
|
|
10
10
|
|
|
11
11
|
case 'failed-processing':
|
|
12
|
-
fireEvent(getRenderFailedFileStatusPayload(fileAttributes, performanceAttributes, ssrReliability));
|
|
12
|
+
fireEvent(getRenderFailedFileStatusPayload(fileAttributes, performanceAttributes, ssrReliability, traceContext));
|
|
13
13
|
break;
|
|
14
14
|
|
|
15
15
|
case 'error':
|
|
16
|
-
fireEvent(getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability));
|
|
16
|
+
fireEvent(getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability, traceContext));
|
|
17
17
|
break;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
export const fireCommencedEvent = (createAnalyticsEvent, fileAttributes, performanceAttributes) => {
|
|
21
|
-
fireMediaCardEvent(getRenderCommencedEventPayload(fileAttributes, performanceAttributes), createAnalyticsEvent);
|
|
20
|
+
export const fireCommencedEvent = (createAnalyticsEvent, fileAttributes, performanceAttributes, traceContext) => {
|
|
21
|
+
fireMediaCardEvent(getRenderCommencedEventPayload(fileAttributes, performanceAttributes, traceContext), createAnalyticsEvent);
|
|
22
22
|
};
|
|
23
23
|
export const fireCopiedEvent = (createAnalyticsEvent, fileId, cardRef) => {
|
|
24
24
|
if (typeof window.getSelection === 'function') {
|
|
@@ -69,9 +69,9 @@ export const getCardPreviewFromFilePreview = async filePreview => {
|
|
|
69
69
|
|
|
70
70
|
throw new LocalPreviewError('local-preview-unsupported');
|
|
71
71
|
};
|
|
72
|
-
export const getCardPreviewFromBackend = async (mediaClient, id, params) => {
|
|
72
|
+
export const getCardPreviewFromBackend = async (mediaClient, id, params, traceId) => {
|
|
73
73
|
try {
|
|
74
|
-
const blob = await mediaClient.getImage(id, params);
|
|
74
|
+
const blob = await mediaClient.getImage(id, params, undefined, undefined, traceId);
|
|
75
75
|
return {
|
|
76
76
|
dataURI: URL.createObjectURL(blob),
|
|
77
77
|
orientation: 1,
|
|
@@ -75,7 +75,8 @@ export const getCardPreview = async ({
|
|
|
75
75
|
imageUrlParams,
|
|
76
76
|
mediaBlobUrlAttrs,
|
|
77
77
|
createAnalyticsEvent,
|
|
78
|
-
featureFlags
|
|
78
|
+
featureFlags,
|
|
79
|
+
traceId
|
|
79
80
|
}) => {
|
|
80
81
|
const mode = imageUrlParams.mode;
|
|
81
82
|
const cachedPreview = cardPreviewCache.get(id, mode);
|
|
@@ -136,7 +137,7 @@ export const getCardPreview = async ({
|
|
|
136
137
|
throw new MediaCardError('remote-preview-not-ready');
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
const remotePreview = await fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs);
|
|
140
|
+
const remotePreview = await fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs, traceId);
|
|
140
141
|
|
|
141
142
|
if (getMediaFeatureFlag('memoryCacheLogging', featureFlags)) {
|
|
142
143
|
createAnalyticsEvent && fireImageFetchingOperationalEvent(createAnalyticsEvent, 'remote-success', {
|
|
@@ -197,8 +198,8 @@ export const isSSRClientPreview = preview => {
|
|
|
197
198
|
return ssrClientSources.includes(preview.source);
|
|
198
199
|
};
|
|
199
200
|
export const isSSRDataPreview = preview => preview.source === 'ssr-data';
|
|
200
|
-
export const fetchAndCacheRemotePreview = async (mediaClient, id, dimensions, params, mediaBlobUrlAttrs) => {
|
|
201
|
-
const remotePreview = await getCardPreviewFromBackend(mediaClient, id, params);
|
|
201
|
+
export const fetchAndCacheRemotePreview = async (mediaClient, id, dimensions, params, mediaBlobUrlAttrs, traceId) => {
|
|
202
|
+
const remotePreview = await getCardPreviewFromBackend(mediaClient, id, params, traceId);
|
|
202
203
|
return extendAndCachePreview(id, params.mode, { ...remotePreview,
|
|
203
204
|
dimensions
|
|
204
205
|
}, mediaBlobUrlAttrs);
|
|
@@ -31,18 +31,21 @@ export const getRenderPreviewableCardPayload = fileAttributes => ({
|
|
|
31
31
|
fileAttributes
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
export const getRenderCommencedEventPayload = (fileAttributes, performanceAttributes) => {
|
|
34
|
+
export const getRenderCommencedEventPayload = (fileAttributes, performanceAttributes, traceContext) => {
|
|
35
35
|
return {
|
|
36
36
|
eventType: 'operational',
|
|
37
37
|
action: 'commenced',
|
|
38
38
|
actionSubject: 'mediaCardRender',
|
|
39
39
|
attributes: {
|
|
40
40
|
fileAttributes,
|
|
41
|
-
performanceAttributes
|
|
41
|
+
performanceAttributes,
|
|
42
|
+
traceContext: {
|
|
43
|
+
traceId: traceContext.traceId
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
};
|
|
45
|
-
export const getRenderSucceededEventPayload = (fileAttributes, performanceAttributes, ssrReliability) => ({
|
|
48
|
+
export const getRenderSucceededEventPayload = (fileAttributes, performanceAttributes, ssrReliability, traceContext) => ({
|
|
46
49
|
eventType: 'operational',
|
|
47
50
|
action: 'succeeded',
|
|
48
51
|
actionSubject: 'mediaCardRender',
|
|
@@ -50,7 +53,8 @@ export const getRenderSucceededEventPayload = (fileAttributes, performanceAttrib
|
|
|
50
53
|
fileAttributes,
|
|
51
54
|
performanceAttributes,
|
|
52
55
|
status: 'success',
|
|
53
|
-
ssrReliability
|
|
56
|
+
ssrReliability,
|
|
57
|
+
traceContext
|
|
54
58
|
}
|
|
55
59
|
});
|
|
56
60
|
export const getCacheHitEventPayload = cardPreviewAttributes => ({
|
|
@@ -117,7 +121,7 @@ export const extractErrorInfo = error => {
|
|
|
117
121
|
errorDetail: getRenderErrorErrorDetail(error)
|
|
118
122
|
};
|
|
119
123
|
};
|
|
120
|
-
export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes, error, ssrReliability) => ({
|
|
124
|
+
export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes, error, ssrReliability, traceContext) => ({
|
|
121
125
|
eventType: 'operational',
|
|
122
126
|
action: 'failed',
|
|
123
127
|
actionSubject: 'mediaCardRender',
|
|
@@ -127,10 +131,11 @@ export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes
|
|
|
127
131
|
status: 'fail',
|
|
128
132
|
...extractErrorInfo(error),
|
|
129
133
|
request: getRenderErrorRequestMetadata(error),
|
|
130
|
-
ssrReliability
|
|
134
|
+
ssrReliability,
|
|
135
|
+
traceContext
|
|
131
136
|
}
|
|
132
137
|
});
|
|
133
|
-
export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttributes, ssrReliability) => ({
|
|
138
|
+
export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttributes, ssrReliability, traceContext) => ({
|
|
134
139
|
eventType: 'operational',
|
|
135
140
|
action: 'failed',
|
|
136
141
|
actionSubject: 'mediaCardRender',
|
|
@@ -139,7 +144,8 @@ export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttr
|
|
|
139
144
|
performanceAttributes,
|
|
140
145
|
status: 'fail',
|
|
141
146
|
failReason: 'failed-processing',
|
|
142
|
-
ssrReliability
|
|
147
|
+
ssrReliability,
|
|
148
|
+
traceContext
|
|
143
149
|
}
|
|
144
150
|
});
|
|
145
151
|
export const getCopiedFilePayload = fileId => ({
|
|
@@ -3,7 +3,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata, LOGGED_FEATURE_FLAG_KE
|
|
|
3
3
|
import { MediaCardError } from '../errors';
|
|
4
4
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
5
5
|
const packageName = "@atlaskit/media-card";
|
|
6
|
-
const packageVersion = "74.
|
|
6
|
+
const packageVersion = "74.2.0";
|
|
7
7
|
let concurrentExperience;
|
|
8
8
|
|
|
9
9
|
const getExperience = id => {
|
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import VideoSnapshot from 'video-snapshot';
|
|
2
1
|
export const takeSnapshot = async blob => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
const url = URL.createObjectURL(blob);
|
|
4
|
+
const video = document.createElement('video');
|
|
5
|
+
video.preload = 'metadata';
|
|
6
|
+
video.src = url;
|
|
7
|
+
video.muted = true;
|
|
8
|
+
video.play().catch(() => {
|
|
9
|
+
return reject(new Error('failed to play video'));
|
|
10
|
+
});
|
|
11
|
+
video.addEventListener('timeupdate', function timeUpdateHandler() {
|
|
12
|
+
video.removeEventListener('timeupdate', timeUpdateHandler);
|
|
13
|
+
video.pause();
|
|
14
|
+
URL.revokeObjectURL(url); //create canvas to draw our first frame on.
|
|
15
|
+
|
|
16
|
+
if (!video.videoWidth && !video.videoHeight) {
|
|
17
|
+
return reject(new Error('error retrieving video dimensions'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const canvas = document.createElement('canvas');
|
|
21
|
+
canvas.width = video.videoWidth;
|
|
22
|
+
canvas.height = video.videoHeight;
|
|
23
|
+
const context = canvas.getContext('2d');
|
|
24
|
+
|
|
25
|
+
if (!context) {
|
|
26
|
+
return reject(new Error('error creating canvas context'));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
30
|
+
const dataURL = canvas.toDataURL('image/jpeg', 0.85);
|
|
31
|
+
resolve(dataURL);
|
|
32
|
+
});
|
|
33
|
+
video.addEventListener('error', () => {
|
|
34
|
+
reject(new Error('failed to load video'));
|
|
35
|
+
URL.revokeObjectURL(url);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
7
38
|
};
|
package/dist/es2019/version.json
CHANGED