@atlaskit/media-card 79.13.0 → 79.13.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 +19 -0
- package/dist/cjs/card/card.js +1 -29
- package/dist/cjs/card/fileCard.js +54 -2
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/titleBox/titleBox.js +0 -1
- package/dist/cjs/card/ui/unhandledErrorCard/unhandledErrorCard-compiled.js +0 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/lightCards/cardError.js +2 -9
- package/dist/cjs/utils/lightCards/errorIcon/index.js +2 -8
- package/dist/cjs/utils/ufoExperiences.js +9 -8
- package/dist/es2019/card/card.js +2 -28
- package/dist/es2019/card/fileCard.js +52 -2
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/titleBox/titleBox.js +0 -1
- package/dist/es2019/card/ui/unhandledErrorCard/unhandledErrorCard-compiled.js +0 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/lightCards/cardError.js +2 -11
- package/dist/es2019/utils/lightCards/errorIcon/index.js +2 -10
- package/dist/es2019/utils/ufoExperiences.js +10 -8
- package/dist/esm/card/card.js +2 -30
- package/dist/esm/card/fileCard.js +54 -2
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/titleBox/titleBox.js +0 -1
- package/dist/esm/card/ui/unhandledErrorCard/unhandledErrorCard-compiled.js +0 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/lightCards/cardError.js +2 -9
- package/dist/esm/utils/lightCards/errorIcon/index.js +2 -8
- package/dist/esm/utils/ufoExperiences.js +10 -8
- package/dist/types/utils/lightCards/cardError.d.ts +1 -7
- package/dist/types/utils/lightCards/errorIcon/index.d.ts +1 -7
- package/dist/types-ts4.5/utils/lightCards/cardError.d.ts +1 -7
- package/dist/types-ts4.5/utils/lightCards/errorIcon/index.d.ts +1 -7
- package/example-helpers/index.tsx +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b611e9165d122`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b611e9165d122) -
|
|
8
|
+
Correlate auth provider analytics events with MediaCardRender events by emitting them when card
|
|
9
|
+
reaches final state, ensuring accurate correlation after HTTP retries.
|
|
10
|
+
- [`c09b399aeb198`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c09b399aeb198) -
|
|
11
|
+
Fix edge cases of ssrReliability remaining unknown
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 79.13.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`71b895a2fd401`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71b895a2fd401) -
|
|
19
|
+
Fixed the timing of ssr succeded to use resourceTimingEntry instead of mount time
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 79.13.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -15,14 +15,12 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
15
15
|
var _externalImageCard = require("./externalImageCard");
|
|
16
16
|
var _fileCard = require("./fileCard");
|
|
17
17
|
var _mediaPerformanceObserver = require("../utils/mediaPerformanceObserver/mediaPerformanceObserver");
|
|
18
|
-
var _analytics = require("../utils/analytics");
|
|
19
18
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
20
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
19
|
var _label = _interopRequireDefault(require("@atlaskit/react-ufo/label"));
|
|
22
20
|
var _excluded = ["identifier"];
|
|
23
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
22
|
var packageName = "@atlaskit/media-card";
|
|
25
|
-
var packageVersion = "79.13.
|
|
23
|
+
var packageVersion = "79.13.1";
|
|
26
24
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
27
25
|
var identifier = _ref.identifier,
|
|
28
26
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -50,32 +48,6 @@ var CardWithPerformanceObserver = exports.CardWithPerformanceObserver = function
|
|
|
50
48
|
(0, _react.useEffect)(function () {
|
|
51
49
|
(0, _mediaPerformanceObserver.setAnalyticsContext)(createAnalyticsEvent);
|
|
52
50
|
}, [createAnalyticsEvent]);
|
|
53
|
-
|
|
54
|
-
// Auth provider analytics listener
|
|
55
|
-
(0, _react.useEffect)(function () {
|
|
56
|
-
if (!(0, _platformFeatureFlags.fg)('platform_media_auth_provider_analytics')) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Sample auth-provider-succeeded events at 10%
|
|
61
|
-
var shouldSampleAuthProviderSucceeded = function shouldSampleAuthProviderSucceeded() {
|
|
62
|
-
return Math.random() < 0.1;
|
|
63
|
-
};
|
|
64
|
-
var onAuthSuccess = function onAuthSuccess(payload) {
|
|
65
|
-
if (shouldSampleAuthProviderSucceeded()) {
|
|
66
|
-
(0, _analytics.fireMediaCardEvent)((0, _analytics.getAuthProviderSucceededPayload)(payload.durationMs, payload.timeoutMs, payload.authContext), createAnalyticsEvent);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var onAuthFailed = function onAuthFailed(payload) {
|
|
70
|
-
(0, _analytics.fireMediaCardEvent)((0, _analytics.getAuthProviderFailedPayload)(payload.durationMs, payload.timeoutMs, payload.error, payload.authContext), createAnalyticsEvent);
|
|
71
|
-
};
|
|
72
|
-
_mediaClient.globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
|
|
73
|
-
_mediaClient.globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
|
|
74
|
-
return function () {
|
|
75
|
-
_mediaClient.globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
|
|
76
|
-
_mediaClient.globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
|
|
77
|
-
};
|
|
78
|
-
}, [createAnalyticsEvent]);
|
|
79
51
|
return /*#__PURE__*/_react.default.createElement(CardBase, props);
|
|
80
52
|
};
|
|
81
53
|
var Card = exports.Card = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -30,6 +30,7 @@ var _usePrevious = require("../utils/usePrevious");
|
|
|
30
30
|
var _viewportDetector = require("../utils/viewportDetector");
|
|
31
31
|
var _cardDimensions = require("../utils/cardDimensions");
|
|
32
32
|
var _cardAnalytics = require("./cardAnalytics");
|
|
33
|
+
var _analytics = require("../utils/analytics");
|
|
33
34
|
var _cardView = require("./cardView");
|
|
34
35
|
var _inlinePlayerLazy = require("./inlinePlayerLazy");
|
|
35
36
|
var _mediaFilePreview = require("@atlaskit/media-file-preview");
|
|
@@ -242,6 +243,9 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
242
243
|
mediaViewerSelectedItem = _useState16[0],
|
|
243
244
|
setMediaViewerSelectedItem = _useState16[1];
|
|
244
245
|
var uploadProgressRef = (0, _react.useRef)();
|
|
246
|
+
|
|
247
|
+
// Store latest auth provider event (emit with fireOperationalEventRef)
|
|
248
|
+
var pendingAuthProviderEventRef = (0, _react.useRef)(null);
|
|
245
249
|
var metadata = (0, _react.useMemo)(function () {
|
|
246
250
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
247
251
|
switch (status) {
|
|
@@ -354,10 +358,31 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
354
358
|
};
|
|
355
359
|
createAnalyticsEvent && (0, _cardAnalytics.fireOperationalEvent)(createAnalyticsEvent, finalStatus, fileAttributes, performanceAttributes, ssrReliability, finalError, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
356
360
|
|
|
361
|
+
// Emit stored auth provider events when card reaches final state
|
|
362
|
+
if (createAnalyticsEvent && pendingAuthProviderEventRef.current && ['complete', 'error', 'failed-processing'].includes(finalStatus) && (0, _platformFeatureFlags.fg)('platform_media_auth_provider_analytics')) {
|
|
363
|
+
var authEvent = pendingAuthProviderEventRef.current;
|
|
364
|
+
// Sample auth-provider-succeeded events at 10%
|
|
365
|
+
var shouldSampleAuthProviderSucceeded = function shouldSampleAuthProviderSucceeded() {
|
|
366
|
+
return Math.random() < 0.1;
|
|
367
|
+
};
|
|
368
|
+
if (authEvent.type === 'succeeded') {
|
|
369
|
+
// Emit success events when card completes (or errors - auth can succeed even if card fails)
|
|
370
|
+
if (shouldSampleAuthProviderSucceeded()) {
|
|
371
|
+
(0, _analytics.fireMediaCardEvent)((0, _analytics.getAuthProviderSucceededPayload)(authEvent.payload.durationMs, authEvent.payload.timeoutMs, authEvent.payload.authContext), createAnalyticsEvent);
|
|
372
|
+
}
|
|
373
|
+
} else if (authEvent.type === 'failed') {
|
|
374
|
+
// Always emit failed events (no sampling)
|
|
375
|
+
(0, _analytics.fireMediaCardEvent)((0, _analytics.getAuthProviderFailedPayload)(authEvent.payload.durationMs, authEvent.payload.timeoutMs, authEvent.payload.error, authEvent.payload.authContext), createAnalyticsEvent);
|
|
376
|
+
}
|
|
377
|
+
pendingAuthProviderEventRef.current = null;
|
|
378
|
+
}
|
|
357
379
|
// Determine SSR preview info for UFO timing strategy
|
|
358
|
-
// wasSSRAttempted is only true when SSR was used AND preview is non-lazy
|
|
380
|
+
// wasSSRAttempted is only true when SSR was used AND preview exists AND preview is non-lazy
|
|
359
381
|
// because lazy SSR defers loading, so it behaves like CSR for timing purposes
|
|
360
|
-
|
|
382
|
+
// We also require preview to exist to avoid false positives when:
|
|
383
|
+
// 1. ssr='client' but no SSR data exists (client-side navigation)
|
|
384
|
+
// 2. Non-previewable files (e.g., zip files) where no preview is generated
|
|
385
|
+
var isSSRNonLazy = !!ssr && !!preview && preview.lazy !== true;
|
|
361
386
|
var wasSSRSuccessful = isSSRNonLazy && (((_ssrReliability$serve = ssrReliability.server) === null || _ssrReliability$serve === void 0 ? void 0 : _ssrReliability$serve.status) === 'success' || ((_ssrReliability$clien = ssrReliability.client) === null || _ssrReliability$clien === void 0 ? void 0 : _ssrReliability$clien.status) === 'success');
|
|
362
387
|
var ssrPreviewInfo = {
|
|
363
388
|
dataUri: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
@@ -392,6 +417,33 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
392
417
|
});
|
|
393
418
|
});
|
|
394
419
|
|
|
420
|
+
// Listen to auth provider events and store them (don't emit yet)
|
|
421
|
+
(0, _react.useEffect)(function () {
|
|
422
|
+
if (!(0, _platformFeatureFlags.fg)('platform_media_auth_provider_analytics')) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
var onAuthSuccess = function onAuthSuccess(payload) {
|
|
426
|
+
// Store latest auth provider event for later emission when card status changes
|
|
427
|
+
pendingAuthProviderEventRef.current = {
|
|
428
|
+
type: 'succeeded',
|
|
429
|
+
payload: payload
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
var onAuthFailed = function onAuthFailed(payload) {
|
|
433
|
+
// Store latest auth provider event for later emission when card status changes
|
|
434
|
+
pendingAuthProviderEventRef.current = {
|
|
435
|
+
type: 'failed',
|
|
436
|
+
payload: payload
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
_mediaClient.globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
|
|
440
|
+
_mediaClient.globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
|
|
441
|
+
return function () {
|
|
442
|
+
_mediaClient.globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
|
|
443
|
+
_mediaClient.globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
|
|
444
|
+
};
|
|
445
|
+
}, []);
|
|
446
|
+
|
|
395
447
|
//----------------------------------------------------------------//
|
|
396
448
|
//--------------------- Handling Errors---------------------------//
|
|
397
449
|
//----------------------------------------------------------------//
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "79.13.
|
|
90
|
+
var packageVersion = "79.13.1";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -41,7 +41,6 @@ var TitleBox = exports.TitleBox = (0, _reactIntlNext.injectIntl)(function (_ref)
|
|
|
41
41
|
}, createdAt !== undefined && isValidTimestamp(createdAt) ? (0, _formatDate.formatDate)(createdAt, (_intl$locale = intl === null || intl === void 0 ? void 0 : intl.locale) !== null && _intl$locale !== void 0 ? _intl$locale : 'en') : placeholderText), titleBoxIcon === 'LockFilledIcon' && /*#__PURE__*/_react.default.createElement(_titleBoxComponents.TitleBoxIcon, null, /*#__PURE__*/_react.default.createElement(_lockLocked.default, {
|
|
42
42
|
color: "currentColor",
|
|
43
43
|
label: "",
|
|
44
|
-
LEGACY_size: "small",
|
|
45
44
|
size: "small"
|
|
46
45
|
})));
|
|
47
46
|
}, {
|
|
@@ -78,7 +78,6 @@ var UnhandledErrorCard = exports.UnhandledErrorCard = /*#__PURE__*/function (_Co
|
|
|
78
78
|
}, /*#__PURE__*/React.createElement(_statusWarning.default, {
|
|
79
79
|
label: "Error",
|
|
80
80
|
color: "var(--ds-icon-warning, ".concat(_colors.Y500, ")"),
|
|
81
|
-
LEGACY_size: "medium",
|
|
82
81
|
spacing: "spacious"
|
|
83
82
|
}), /*#__PURE__*/React.createElement(_contentLoadingErrorMessage.ContentLoadingErrorMessage, {
|
|
84
83
|
isHidden: hideText
|
|
@@ -116,7 +116,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
116
116
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
117
117
|
var analyticsContext = {
|
|
118
118
|
packageVersion: "@atlaskit/media-card",
|
|
119
|
-
packageName: "79.13.
|
|
119
|
+
packageName: "79.13.1",
|
|
120
120
|
componentName: 'mediaInlineCard',
|
|
121
121
|
component: 'mediaInlineCard'
|
|
122
122
|
};
|
|
@@ -11,7 +11,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
15
|
var _errorIcon = require("./errorIcon");
|
|
17
16
|
var _lightCardWrappers = require("./lightCardWrappers");
|
|
@@ -36,13 +35,7 @@ var CardError = exports.CardError = /*#__PURE__*/function (_Component) {
|
|
|
36
35
|
}, {
|
|
37
36
|
key: "icon",
|
|
38
37
|
get: function get() {
|
|
39
|
-
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_errorIcon.ErrorIcon, {
|
|
41
|
-
size: size
|
|
42
|
-
});
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_errorIcon.ErrorIcon, null);
|
|
43
39
|
}
|
|
44
40
|
}]);
|
|
45
|
-
}(_react.Component);
|
|
46
|
-
(0, _defineProperty2.default)(CardError, "defaultProps", {
|
|
47
|
-
size: 'medium'
|
|
48
|
-
});
|
|
41
|
+
}(_react.Component);
|
|
@@ -11,7 +11,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
15
|
var _react2 = require("@emotion/react");
|
|
17
16
|
var _statusWarning = _interopRequireDefault(require("@atlaskit/icon/core/status-warning"));
|
|
@@ -31,20 +30,15 @@ var ErrorIcon = exports.ErrorIcon = /*#__PURE__*/function (_Component) {
|
|
|
31
30
|
return (0, _createClass2.default)(ErrorIcon, [{
|
|
32
31
|
key: "render",
|
|
33
32
|
value: function render() {
|
|
34
|
-
var size = this.props.size;
|
|
35
33
|
return (
|
|
36
34
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
37
35
|
(0, _react2.jsx)("div", {
|
|
38
36
|
css: _styles.errorIconWrapperStyles
|
|
39
37
|
}, (0, _react2.jsx)(_statusWarning.default, {
|
|
40
38
|
color: "currentColor",
|
|
41
|
-
label: "Error"
|
|
42
|
-
LEGACY_size: size
|
|
39
|
+
label: "Error"
|
|
43
40
|
}))
|
|
44
41
|
);
|
|
45
42
|
}
|
|
46
43
|
}]);
|
|
47
|
-
}(_react.Component);
|
|
48
|
-
(0, _defineProperty2.default)(ErrorIcon, "defaultProps", {
|
|
49
|
-
size: 'small'
|
|
50
|
-
});
|
|
44
|
+
}(_react.Component);
|
|
@@ -19,7 +19,7 @@ var _globalScope = require("./globalScope/globalScope");
|
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
21
21
|
var packageName = "@atlaskit/media-card";
|
|
22
|
-
var packageVersion = "79.13.
|
|
22
|
+
var packageVersion = "79.13.1";
|
|
23
23
|
var SAMPLE_RATE = 0.05;
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -284,10 +284,12 @@ var useMediaCardUfoExperience = exports.useMediaCardUfoExperience = function use
|
|
|
284
284
|
var experience = createExperience(instanceId, timingsConfig);
|
|
285
285
|
experienceRef.current = experience;
|
|
286
286
|
experience.start(startTimeRef.current);
|
|
287
|
+
var endTime = performance.now();
|
|
287
288
|
|
|
288
289
|
// Add timing marks and metadata based on strategy
|
|
289
290
|
if (ssrPreviewInfo !== null && ssrPreviewInfo !== void 0 && ssrPreviewInfo.wasSSRSuccessful && ssrPreviewInfo.dataUri) {
|
|
290
291
|
if (resourceTimingEntry) {
|
|
292
|
+
endTime = resourceTimingEntry.responseEnd;
|
|
291
293
|
addResourceTimingMarks(experience, resourceTimingEntry, interactionStartTime, 'ssr');
|
|
292
294
|
experience.addMetadata(_objectSpread(_objectSpread({}, createResourceTimingMetadata(resourceTimingEntry)), {}, {
|
|
293
295
|
timingStrategy: 'ssr-resource-timing'
|
|
@@ -315,13 +317,12 @@ var useMediaCardUfoExperience = exports.useMediaCardUfoExperience = function use
|
|
|
315
317
|
var sanitisedFileAttributes = sanitiseFileAttributes(fileAttributes);
|
|
316
318
|
switch (status) {
|
|
317
319
|
case 'complete':
|
|
318
|
-
experience.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
});
|
|
320
|
+
experience.addMetadata(_objectSpread({
|
|
321
|
+
fileAttributes: sanitisedFileAttributes,
|
|
322
|
+
ssrReliability: ssrReliability,
|
|
323
|
+
fileStateFlags: fileStateFlags
|
|
324
|
+
}, getBasePayloadAttributes()));
|
|
325
|
+
experience.transition(_ufo.UFOExperienceState.SUCCEEDED, endTime);
|
|
325
326
|
break;
|
|
326
327
|
case 'failed-processing':
|
|
327
328
|
experience.failure({
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import { isFileIdentifier
|
|
2
|
+
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
3
3
|
import { withMediaAnalyticsContext } from '@atlaskit/media-common';
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
5
|
import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
6
6
|
import { ExternalImageCard } from './externalImageCard';
|
|
7
7
|
import { FileCard } from './fileCard';
|
|
8
8
|
import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerformanceObserver/mediaPerformanceObserver';
|
|
9
|
-
import { fireMediaCardEvent, getAuthProviderSucceededPayload, getAuthProviderFailedPayload } from '../utils/analytics';
|
|
10
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
11
|
const packageName = "@atlaskit/media-card";
|
|
14
|
-
const packageVersion = "79.13.
|
|
12
|
+
const packageVersion = "79.13.1";
|
|
15
13
|
export const CardBase = ({
|
|
16
14
|
identifier,
|
|
17
15
|
...otherProps
|
|
@@ -41,30 +39,6 @@ export const CardWithPerformanceObserver = props => {
|
|
|
41
39
|
useEffect(() => {
|
|
42
40
|
setAnalyticsContext(createAnalyticsEvent);
|
|
43
41
|
}, [createAnalyticsEvent]);
|
|
44
|
-
|
|
45
|
-
// Auth provider analytics listener
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!fg('platform_media_auth_provider_analytics')) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Sample auth-provider-succeeded events at 10%
|
|
52
|
-
const shouldSampleAuthProviderSucceeded = () => Math.random() < 0.1;
|
|
53
|
-
const onAuthSuccess = payload => {
|
|
54
|
-
if (shouldSampleAuthProviderSucceeded()) {
|
|
55
|
-
fireMediaCardEvent(getAuthProviderSucceededPayload(payload.durationMs, payload.timeoutMs, payload.authContext), createAnalyticsEvent);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const onAuthFailed = payload => {
|
|
59
|
-
fireMediaCardEvent(getAuthProviderFailedPayload(payload.durationMs, payload.timeoutMs, payload.error, payload.authContext), createAnalyticsEvent);
|
|
60
|
-
};
|
|
61
|
-
globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
|
|
62
|
-
globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
|
|
63
|
-
return () => {
|
|
64
|
-
globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
|
|
65
|
-
globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
|
|
66
|
-
};
|
|
67
|
-
}, [createAnalyticsEvent]);
|
|
68
42
|
return /*#__PURE__*/React.createElement(CardBase, props);
|
|
69
43
|
};
|
|
70
44
|
export const Card = withMediaAnalyticsContext({
|
|
@@ -17,6 +17,7 @@ import { usePrevious } from '../utils/usePrevious';
|
|
|
17
17
|
import { ViewportDetector } from '../utils/viewportDetector';
|
|
18
18
|
import { getDefaultCardDimensions } from '../utils/cardDimensions';
|
|
19
19
|
import { fireNonCriticalErrorEvent, fireOperationalEvent, fireDownloadSucceededEvent, fireDownloadFailedEvent } from './cardAnalytics';
|
|
20
|
+
import { fireMediaCardEvent, getAuthProviderSucceededPayload, getAuthProviderFailedPayload } from '../utils/analytics';
|
|
20
21
|
import { CardView } from './cardView';
|
|
21
22
|
import { InlinePlayerLazy } from './inlinePlayerLazy';
|
|
22
23
|
import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
@@ -195,6 +196,9 @@ export const FileCard = ({
|
|
|
195
196
|
const finalStatus = finalError ? 'error' : status === 'failed-processing' && (fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.mimeType) === 'image/svg+xml' ? 'loading-preview' : status;
|
|
196
197
|
const [mediaViewerSelectedItem, setMediaViewerSelectedItem] = useState(null);
|
|
197
198
|
const uploadProgressRef = useRef();
|
|
199
|
+
|
|
200
|
+
// Store latest auth provider event (emit with fireOperationalEventRef)
|
|
201
|
+
const pendingAuthProviderEventRef = useRef(null);
|
|
198
202
|
const metadata = useMemo(() => {
|
|
199
203
|
const getProcessingStatusFromFileState = status => {
|
|
200
204
|
switch (status) {
|
|
@@ -275,10 +279,29 @@ export const FileCard = ({
|
|
|
275
279
|
};
|
|
276
280
|
createAnalyticsEvent && fireOperationalEvent(createAnalyticsEvent, finalStatus, fileAttributes, performanceAttributes, ssrReliability, finalError, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
277
281
|
|
|
282
|
+
// Emit stored auth provider events when card reaches final state
|
|
283
|
+
if (createAnalyticsEvent && pendingAuthProviderEventRef.current && ['complete', 'error', 'failed-processing'].includes(finalStatus) && fg('platform_media_auth_provider_analytics')) {
|
|
284
|
+
const authEvent = pendingAuthProviderEventRef.current;
|
|
285
|
+
// Sample auth-provider-succeeded events at 10%
|
|
286
|
+
const shouldSampleAuthProviderSucceeded = () => Math.random() < 0.1;
|
|
287
|
+
if (authEvent.type === 'succeeded') {
|
|
288
|
+
// Emit success events when card completes (or errors - auth can succeed even if card fails)
|
|
289
|
+
if (shouldSampleAuthProviderSucceeded()) {
|
|
290
|
+
fireMediaCardEvent(getAuthProviderSucceededPayload(authEvent.payload.durationMs, authEvent.payload.timeoutMs, authEvent.payload.authContext), createAnalyticsEvent);
|
|
291
|
+
}
|
|
292
|
+
} else if (authEvent.type === 'failed') {
|
|
293
|
+
// Always emit failed events (no sampling)
|
|
294
|
+
fireMediaCardEvent(getAuthProviderFailedPayload(authEvent.payload.durationMs, authEvent.payload.timeoutMs, authEvent.payload.error, authEvent.payload.authContext), createAnalyticsEvent);
|
|
295
|
+
}
|
|
296
|
+
pendingAuthProviderEventRef.current = null;
|
|
297
|
+
}
|
|
278
298
|
// Determine SSR preview info for UFO timing strategy
|
|
279
|
-
// wasSSRAttempted is only true when SSR was used AND preview is non-lazy
|
|
299
|
+
// wasSSRAttempted is only true when SSR was used AND preview exists AND preview is non-lazy
|
|
280
300
|
// because lazy SSR defers loading, so it behaves like CSR for timing purposes
|
|
281
|
-
|
|
301
|
+
// We also require preview to exist to avoid false positives when:
|
|
302
|
+
// 1. ssr='client' but no SSR data exists (client-side navigation)
|
|
303
|
+
// 2. Non-previewable files (e.g., zip files) where no preview is generated
|
|
304
|
+
const isSSRNonLazy = !!ssr && !!preview && preview.lazy !== true;
|
|
282
305
|
const wasSSRSuccessful = isSSRNonLazy && (((_ssrReliability$serve = ssrReliability.server) === null || _ssrReliability$serve === void 0 ? void 0 : _ssrReliability$serve.status) === 'success' || ((_ssrReliability$clien = ssrReliability.client) === null || _ssrReliability$clien === void 0 ? void 0 : _ssrReliability$clien.status) === 'success');
|
|
283
306
|
const ssrPreviewInfo = {
|
|
284
307
|
dataUri: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
@@ -313,6 +336,33 @@ export const FileCard = ({
|
|
|
313
336
|
});
|
|
314
337
|
});
|
|
315
338
|
|
|
339
|
+
// Listen to auth provider events and store them (don't emit yet)
|
|
340
|
+
useEffect(() => {
|
|
341
|
+
if (!fg('platform_media_auth_provider_analytics')) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const onAuthSuccess = payload => {
|
|
345
|
+
// Store latest auth provider event for later emission when card status changes
|
|
346
|
+
pendingAuthProviderEventRef.current = {
|
|
347
|
+
type: 'succeeded',
|
|
348
|
+
payload
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
const onAuthFailed = payload => {
|
|
352
|
+
// Store latest auth provider event for later emission when card status changes
|
|
353
|
+
pendingAuthProviderEventRef.current = {
|
|
354
|
+
type: 'failed',
|
|
355
|
+
payload
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
|
|
359
|
+
globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
|
|
360
|
+
return () => {
|
|
361
|
+
globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
|
|
362
|
+
globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
|
|
363
|
+
};
|
|
364
|
+
}, []);
|
|
365
|
+
|
|
316
366
|
//----------------------------------------------------------------//
|
|
317
367
|
//--------------------- Handling Errors---------------------------//
|
|
318
368
|
//----------------------------------------------------------------//
|
|
@@ -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 = "79.13.
|
|
69
|
+
const packageVersion = "79.13.1";
|
|
70
70
|
|
|
71
71
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
72
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -33,7 +33,6 @@ export const TitleBox = injectIntl(({
|
|
|
33
33
|
}, createdAt !== undefined && isValidTimestamp(createdAt) ? formatDate(createdAt, (_intl$locale = intl === null || intl === void 0 ? void 0 : intl.locale) !== null && _intl$locale !== void 0 ? _intl$locale : 'en') : placeholderText), titleBoxIcon === 'LockFilledIcon' && /*#__PURE__*/React.createElement(TitleBoxIcon, null, /*#__PURE__*/React.createElement(LockFilledIcon, {
|
|
34
34
|
color: "currentColor",
|
|
35
35
|
label: "",
|
|
36
|
-
LEGACY_size: "small",
|
|
37
36
|
size: "small"
|
|
38
37
|
})));
|
|
39
38
|
}, {
|
|
@@ -49,7 +49,6 @@ export class UnhandledErrorCard extends Component {
|
|
|
49
49
|
}, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
50
50
|
label: "Error",
|
|
51
51
|
color: `var(--ds-icon-warning, ${Y500})`,
|
|
52
|
-
LEGACY_size: "medium",
|
|
53
52
|
spacing: "spacious"
|
|
54
53
|
}), /*#__PURE__*/React.createElement(ContentLoadingErrorMessage, {
|
|
55
54
|
isHidden: hideText
|
|
@@ -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: "79.13.
|
|
40
|
+
packageName: "79.13.1",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Component } from 'react';
|
|
4
3
|
import { ErrorIcon } from './errorIcon';
|
|
@@ -12,14 +11,6 @@ export class CardError extends Component {
|
|
|
12
11
|
}, this.icon);
|
|
13
12
|
}
|
|
14
13
|
get icon() {
|
|
15
|
-
|
|
16
|
-
size
|
|
17
|
-
} = this.props;
|
|
18
|
-
return /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
19
|
-
size: size
|
|
20
|
-
});
|
|
14
|
+
return /*#__PURE__*/React.createElement(ErrorIcon, null);
|
|
21
15
|
}
|
|
22
|
-
}
|
|
23
|
-
_defineProperty(CardError, "defaultProps", {
|
|
24
|
-
size: 'medium'
|
|
25
|
-
});
|
|
16
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
@@ -11,21 +10,14 @@ import WarningIcon from '@atlaskit/icon/core/status-warning';
|
|
|
11
10
|
import { errorIconWrapperStyles } from './styles';
|
|
12
11
|
export class ErrorIcon extends Component {
|
|
13
12
|
render() {
|
|
14
|
-
const {
|
|
15
|
-
size
|
|
16
|
-
} = this.props;
|
|
17
13
|
return (
|
|
18
14
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
19
15
|
jsx("div", {
|
|
20
16
|
css: errorIconWrapperStyles
|
|
21
17
|
}, jsx(WarningIcon, {
|
|
22
18
|
color: "currentColor",
|
|
23
|
-
label: "Error"
|
|
24
|
-
LEGACY_size: size
|
|
19
|
+
label: "Error"
|
|
25
20
|
}))
|
|
26
21
|
);
|
|
27
22
|
}
|
|
28
|
-
}
|
|
29
|
-
_defineProperty(ErrorIcon, "defaultProps", {
|
|
30
|
-
size: 'small'
|
|
31
|
-
});
|
|
23
|
+
}
|
|
@@ -2,13 +2,14 @@ import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
|
2
2
|
import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes, ConcurrentExperience } from '@atlaskit/ufo';
|
|
3
3
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
4
4
|
import isValidId from 'uuid-validate';
|
|
5
|
+
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
5
6
|
import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
6
7
|
import { MediaCardError } from '../errors';
|
|
7
8
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
8
9
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
9
10
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
10
11
|
const packageName = "@atlaskit/media-card";
|
|
11
|
-
const packageVersion = "79.13.
|
|
12
|
+
const packageVersion = "79.13.1";
|
|
12
13
|
const SAMPLE_RATE = 0.05;
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -261,10 +262,12 @@ export const useMediaCardUfoExperience = ({
|
|
|
261
262
|
const experience = createExperience(instanceId, timingsConfig);
|
|
262
263
|
experienceRef.current = experience;
|
|
263
264
|
experience.start(startTimeRef.current);
|
|
265
|
+
let endTime = performance.now();
|
|
264
266
|
|
|
265
267
|
// Add timing marks and metadata based on strategy
|
|
266
268
|
if (ssrPreviewInfo !== null && ssrPreviewInfo !== void 0 && ssrPreviewInfo.wasSSRSuccessful && ssrPreviewInfo.dataUri) {
|
|
267
269
|
if (resourceTimingEntry) {
|
|
270
|
+
endTime = resourceTimingEntry.responseEnd;
|
|
268
271
|
addResourceTimingMarks(experience, resourceTimingEntry, interactionStartTime, 'ssr');
|
|
269
272
|
experience.addMetadata({
|
|
270
273
|
...createResourceTimingMetadata(resourceTimingEntry),
|
|
@@ -293,14 +296,13 @@ export const useMediaCardUfoExperience = ({
|
|
|
293
296
|
const sanitisedFileAttributes = sanitiseFileAttributes(fileAttributes);
|
|
294
297
|
switch (status) {
|
|
295
298
|
case 'complete':
|
|
296
|
-
experience.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
...getBasePayloadAttributes()
|
|
302
|
-
}
|
|
299
|
+
experience.addMetadata({
|
|
300
|
+
fileAttributes: sanitisedFileAttributes,
|
|
301
|
+
ssrReliability,
|
|
302
|
+
fileStateFlags,
|
|
303
|
+
...getBasePayloadAttributes()
|
|
303
304
|
});
|
|
305
|
+
experience.transition(UFOExperienceState.SUCCEEDED, endTime);
|
|
304
306
|
break;
|
|
305
307
|
case 'failed-processing':
|
|
306
308
|
experience.failure({
|
package/dist/esm/card/card.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["identifier"];
|
|
4
|
-
import { isFileIdentifier
|
|
4
|
+
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
5
5
|
import { withMediaAnalyticsContext } from '@atlaskit/media-common';
|
|
6
6
|
import React, { useEffect } from 'react';
|
|
7
7
|
import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
8
8
|
import { ExternalImageCard } from './externalImageCard';
|
|
9
9
|
import { FileCard } from './fileCard';
|
|
10
10
|
import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerformanceObserver/mediaPerformanceObserver';
|
|
11
|
-
import { fireMediaCardEvent, getAuthProviderSucceededPayload, getAuthProviderFailedPayload } from '../utils/analytics';
|
|
12
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
12
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
15
13
|
var packageName = "@atlaskit/media-card";
|
|
16
|
-
var packageVersion = "79.13.
|
|
14
|
+
var packageVersion = "79.13.1";
|
|
17
15
|
export var CardBase = function CardBase(_ref) {
|
|
18
16
|
var identifier = _ref.identifier,
|
|
19
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -41,32 +39,6 @@ export var CardWithPerformanceObserver = function CardWithPerformanceObserver(pr
|
|
|
41
39
|
useEffect(function () {
|
|
42
40
|
setAnalyticsContext(createAnalyticsEvent);
|
|
43
41
|
}, [createAnalyticsEvent]);
|
|
44
|
-
|
|
45
|
-
// Auth provider analytics listener
|
|
46
|
-
useEffect(function () {
|
|
47
|
-
if (!fg('platform_media_auth_provider_analytics')) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Sample auth-provider-succeeded events at 10%
|
|
52
|
-
var shouldSampleAuthProviderSucceeded = function shouldSampleAuthProviderSucceeded() {
|
|
53
|
-
return Math.random() < 0.1;
|
|
54
|
-
};
|
|
55
|
-
var onAuthSuccess = function onAuthSuccess(payload) {
|
|
56
|
-
if (shouldSampleAuthProviderSucceeded()) {
|
|
57
|
-
fireMediaCardEvent(getAuthProviderSucceededPayload(payload.durationMs, payload.timeoutMs, payload.authContext), createAnalyticsEvent);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var onAuthFailed = function onAuthFailed(payload) {
|
|
61
|
-
fireMediaCardEvent(getAuthProviderFailedPayload(payload.durationMs, payload.timeoutMs, payload.error, payload.authContext), createAnalyticsEvent);
|
|
62
|
-
};
|
|
63
|
-
globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
|
|
64
|
-
globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
|
|
65
|
-
return function () {
|
|
66
|
-
globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
|
|
67
|
-
globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
|
|
68
|
-
};
|
|
69
|
-
}, [createAnalyticsEvent]);
|
|
70
42
|
return /*#__PURE__*/React.createElement(CardBase, props);
|
|
71
43
|
};
|
|
72
44
|
export var Card = withMediaAnalyticsContext({
|
|
@@ -24,6 +24,7 @@ import { usePrevious } from '../utils/usePrevious';
|
|
|
24
24
|
import { ViewportDetector } from '../utils/viewportDetector';
|
|
25
25
|
import { getDefaultCardDimensions } from '../utils/cardDimensions';
|
|
26
26
|
import { fireNonCriticalErrorEvent, fireOperationalEvent, fireDownloadSucceededEvent, fireDownloadFailedEvent } from './cardAnalytics';
|
|
27
|
+
import { fireMediaCardEvent, getAuthProviderSucceededPayload, getAuthProviderFailedPayload } from '../utils/analytics';
|
|
27
28
|
import { CardView } from './cardView';
|
|
28
29
|
import { InlinePlayerLazy } from './inlinePlayerLazy';
|
|
29
30
|
import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
@@ -234,6 +235,9 @@ export var FileCard = function FileCard(_ref) {
|
|
|
234
235
|
mediaViewerSelectedItem = _useState16[0],
|
|
235
236
|
setMediaViewerSelectedItem = _useState16[1];
|
|
236
237
|
var uploadProgressRef = useRef();
|
|
238
|
+
|
|
239
|
+
// Store latest auth provider event (emit with fireOperationalEventRef)
|
|
240
|
+
var pendingAuthProviderEventRef = useRef(null);
|
|
237
241
|
var metadata = useMemo(function () {
|
|
238
242
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
239
243
|
switch (status) {
|
|
@@ -346,10 +350,31 @@ export var FileCard = function FileCard(_ref) {
|
|
|
346
350
|
};
|
|
347
351
|
createAnalyticsEvent && fireOperationalEvent(createAnalyticsEvent, finalStatus, fileAttributes, performanceAttributes, ssrReliability, finalError, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
348
352
|
|
|
353
|
+
// Emit stored auth provider events when card reaches final state
|
|
354
|
+
if (createAnalyticsEvent && pendingAuthProviderEventRef.current && ['complete', 'error', 'failed-processing'].includes(finalStatus) && fg('platform_media_auth_provider_analytics')) {
|
|
355
|
+
var authEvent = pendingAuthProviderEventRef.current;
|
|
356
|
+
// Sample auth-provider-succeeded events at 10%
|
|
357
|
+
var shouldSampleAuthProviderSucceeded = function shouldSampleAuthProviderSucceeded() {
|
|
358
|
+
return Math.random() < 0.1;
|
|
359
|
+
};
|
|
360
|
+
if (authEvent.type === 'succeeded') {
|
|
361
|
+
// Emit success events when card completes (or errors - auth can succeed even if card fails)
|
|
362
|
+
if (shouldSampleAuthProviderSucceeded()) {
|
|
363
|
+
fireMediaCardEvent(getAuthProviderSucceededPayload(authEvent.payload.durationMs, authEvent.payload.timeoutMs, authEvent.payload.authContext), createAnalyticsEvent);
|
|
364
|
+
}
|
|
365
|
+
} else if (authEvent.type === 'failed') {
|
|
366
|
+
// Always emit failed events (no sampling)
|
|
367
|
+
fireMediaCardEvent(getAuthProviderFailedPayload(authEvent.payload.durationMs, authEvent.payload.timeoutMs, authEvent.payload.error, authEvent.payload.authContext), createAnalyticsEvent);
|
|
368
|
+
}
|
|
369
|
+
pendingAuthProviderEventRef.current = null;
|
|
370
|
+
}
|
|
349
371
|
// Determine SSR preview info for UFO timing strategy
|
|
350
|
-
// wasSSRAttempted is only true when SSR was used AND preview is non-lazy
|
|
372
|
+
// wasSSRAttempted is only true when SSR was used AND preview exists AND preview is non-lazy
|
|
351
373
|
// because lazy SSR defers loading, so it behaves like CSR for timing purposes
|
|
352
|
-
|
|
374
|
+
// We also require preview to exist to avoid false positives when:
|
|
375
|
+
// 1. ssr='client' but no SSR data exists (client-side navigation)
|
|
376
|
+
// 2. Non-previewable files (e.g., zip files) where no preview is generated
|
|
377
|
+
var isSSRNonLazy = !!ssr && !!preview && preview.lazy !== true;
|
|
353
378
|
var wasSSRSuccessful = isSSRNonLazy && (((_ssrReliability$serve = ssrReliability.server) === null || _ssrReliability$serve === void 0 ? void 0 : _ssrReliability$serve.status) === 'success' || ((_ssrReliability$clien = ssrReliability.client) === null || _ssrReliability$clien === void 0 ? void 0 : _ssrReliability$clien.status) === 'success');
|
|
354
379
|
var ssrPreviewInfo = {
|
|
355
380
|
dataUri: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
@@ -384,6 +409,33 @@ export var FileCard = function FileCard(_ref) {
|
|
|
384
409
|
});
|
|
385
410
|
});
|
|
386
411
|
|
|
412
|
+
// Listen to auth provider events and store them (don't emit yet)
|
|
413
|
+
useEffect(function () {
|
|
414
|
+
if (!fg('platform_media_auth_provider_analytics')) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
var onAuthSuccess = function onAuthSuccess(payload) {
|
|
418
|
+
// Store latest auth provider event for later emission when card status changes
|
|
419
|
+
pendingAuthProviderEventRef.current = {
|
|
420
|
+
type: 'succeeded',
|
|
421
|
+
payload: payload
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
var onAuthFailed = function onAuthFailed(payload) {
|
|
425
|
+
// Store latest auth provider event for later emission when card status changes
|
|
426
|
+
pendingAuthProviderEventRef.current = {
|
|
427
|
+
type: 'failed',
|
|
428
|
+
payload: payload
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
|
|
432
|
+
globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
|
|
433
|
+
return function () {
|
|
434
|
+
globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
|
|
435
|
+
globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
|
|
436
|
+
};
|
|
437
|
+
}, []);
|
|
438
|
+
|
|
387
439
|
//----------------------------------------------------------------//
|
|
388
440
|
//--------------------- Handling Errors---------------------------//
|
|
389
441
|
//----------------------------------------------------------------//
|
|
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
80
80
|
}(React.Component);
|
|
81
81
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
82
82
|
var packageName = "@atlaskit/media-card";
|
|
83
|
-
var packageVersion = "79.13.
|
|
83
|
+
var packageVersion = "79.13.1";
|
|
84
84
|
|
|
85
85
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
86
86
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -34,7 +34,6 @@ export var TitleBox = injectIntl(function (_ref) {
|
|
|
34
34
|
}, createdAt !== undefined && isValidTimestamp(createdAt) ? formatDate(createdAt, (_intl$locale = intl === null || intl === void 0 ? void 0 : intl.locale) !== null && _intl$locale !== void 0 ? _intl$locale : 'en') : placeholderText), titleBoxIcon === 'LockFilledIcon' && /*#__PURE__*/React.createElement(TitleBoxIcon, null, /*#__PURE__*/React.createElement(LockFilledIcon, {
|
|
35
35
|
color: "currentColor",
|
|
36
36
|
label: "",
|
|
37
|
-
LEGACY_size: "small",
|
|
38
37
|
size: "small"
|
|
39
38
|
})));
|
|
40
39
|
}, {
|
|
@@ -69,7 +69,6 @@ export var UnhandledErrorCard = /*#__PURE__*/function (_Component) {
|
|
|
69
69
|
}, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
70
70
|
label: "Error",
|
|
71
71
|
color: "var(--ds-icon-warning, ".concat(Y500, ")"),
|
|
72
|
-
LEGACY_size: "medium",
|
|
73
72
|
spacing: "spacious"
|
|
74
73
|
}), /*#__PURE__*/React.createElement(ContentLoadingErrorMessage, {
|
|
75
74
|
isHidden: hideText
|
|
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
102
102
|
var analyticsContext = {
|
|
103
103
|
packageVersion: "@atlaskit/media-card",
|
|
104
|
-
packageName: "79.13.
|
|
104
|
+
packageName: "79.13.1",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -3,7 +3,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
8
|
import React from 'react';
|
|
@@ -28,13 +27,7 @@ export var CardError = /*#__PURE__*/function (_Component) {
|
|
|
28
27
|
}, {
|
|
29
28
|
key: "icon",
|
|
30
29
|
get: function get() {
|
|
31
|
-
|
|
32
|
-
return /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
33
|
-
size: size
|
|
34
|
-
});
|
|
30
|
+
return /*#__PURE__*/React.createElement(ErrorIcon, null);
|
|
35
31
|
}
|
|
36
32
|
}]);
|
|
37
|
-
}(Component);
|
|
38
|
-
_defineProperty(CardError, "defaultProps", {
|
|
39
|
-
size: 'medium'
|
|
40
|
-
});
|
|
33
|
+
}(Component);
|
|
@@ -3,7 +3,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
8
|
/**
|
|
@@ -25,20 +24,15 @@ export var ErrorIcon = /*#__PURE__*/function (_Component) {
|
|
|
25
24
|
return _createClass(ErrorIcon, [{
|
|
26
25
|
key: "render",
|
|
27
26
|
value: function render() {
|
|
28
|
-
var size = this.props.size;
|
|
29
27
|
return (
|
|
30
28
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
31
29
|
jsx("div", {
|
|
32
30
|
css: errorIconWrapperStyles
|
|
33
31
|
}, jsx(WarningIcon, {
|
|
34
32
|
color: "currentColor",
|
|
35
|
-
label: "Error"
|
|
36
|
-
LEGACY_size: size
|
|
33
|
+
label: "Error"
|
|
37
34
|
}))
|
|
38
35
|
);
|
|
39
36
|
}
|
|
40
37
|
}]);
|
|
41
|
-
}(Component);
|
|
42
|
-
_defineProperty(ErrorIcon, "defaultProps", {
|
|
43
|
-
size: 'small'
|
|
44
|
-
});
|
|
38
|
+
}(Component);
|
|
@@ -6,13 +6,14 @@ import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
|
6
6
|
import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes, ConcurrentExperience } from '@atlaskit/ufo';
|
|
7
7
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
8
8
|
import isValidId from 'uuid-validate';
|
|
9
|
+
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
9
10
|
import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
10
11
|
import { MediaCardError } from '../errors';
|
|
11
12
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
12
13
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
13
14
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
14
15
|
var packageName = "@atlaskit/media-card";
|
|
15
|
-
var packageVersion = "79.13.
|
|
16
|
+
var packageVersion = "79.13.1";
|
|
16
17
|
var SAMPLE_RATE = 0.05;
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -277,10 +278,12 @@ export var useMediaCardUfoExperience = function useMediaCardUfoExperience(_ref4)
|
|
|
277
278
|
var experience = createExperience(instanceId, timingsConfig);
|
|
278
279
|
experienceRef.current = experience;
|
|
279
280
|
experience.start(startTimeRef.current);
|
|
281
|
+
var endTime = performance.now();
|
|
280
282
|
|
|
281
283
|
// Add timing marks and metadata based on strategy
|
|
282
284
|
if (ssrPreviewInfo !== null && ssrPreviewInfo !== void 0 && ssrPreviewInfo.wasSSRSuccessful && ssrPreviewInfo.dataUri) {
|
|
283
285
|
if (resourceTimingEntry) {
|
|
286
|
+
endTime = resourceTimingEntry.responseEnd;
|
|
284
287
|
addResourceTimingMarks(experience, resourceTimingEntry, interactionStartTime, 'ssr');
|
|
285
288
|
experience.addMetadata(_objectSpread(_objectSpread({}, createResourceTimingMetadata(resourceTimingEntry)), {}, {
|
|
286
289
|
timingStrategy: 'ssr-resource-timing'
|
|
@@ -308,13 +311,12 @@ export var useMediaCardUfoExperience = function useMediaCardUfoExperience(_ref4)
|
|
|
308
311
|
var sanitisedFileAttributes = sanitiseFileAttributes(fileAttributes);
|
|
309
312
|
switch (status) {
|
|
310
313
|
case 'complete':
|
|
311
|
-
experience.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
});
|
|
314
|
+
experience.addMetadata(_objectSpread({
|
|
315
|
+
fileAttributes: sanitisedFileAttributes,
|
|
316
|
+
ssrReliability: ssrReliability,
|
|
317
|
+
fileStateFlags: fileStateFlags
|
|
318
|
+
}, getBasePayloadAttributes()));
|
|
319
|
+
experience.transition(UFOExperienceState.SUCCEEDED, endTime);
|
|
318
320
|
break;
|
|
319
321
|
case 'failed-processing':
|
|
320
322
|
experience.failure({
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
import { type StaticCardProps } from './types';
|
|
4
|
-
export
|
|
5
|
-
readonly size: 'small' | 'medium' | 'large' | 'xlarge';
|
|
6
|
-
}
|
|
7
|
-
export declare class CardError extends Component<ErrorCardProps, {}> {
|
|
8
|
-
static defaultProps: {
|
|
9
|
-
size: string;
|
|
10
|
-
};
|
|
4
|
+
export declare class CardError extends Component<StaticCardProps, {}> {
|
|
11
5
|
render(): React.JSX.Element;
|
|
12
6
|
get icon(): React.JSX.Element;
|
|
13
7
|
}
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Component } from 'react';
|
|
7
|
-
export
|
|
8
|
-
readonly size: 'small' | 'medium' | 'large' | 'xlarge';
|
|
9
|
-
}
|
|
10
|
-
export declare class ErrorIcon extends Component<ErrorIconProps, {}> {
|
|
11
|
-
static defaultProps: {
|
|
12
|
-
size: string;
|
|
13
|
-
};
|
|
7
|
+
export declare class ErrorIcon extends Component {
|
|
14
8
|
render(): React.JSX.Element;
|
|
15
9
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
import { type StaticCardProps } from './types';
|
|
4
|
-
export
|
|
5
|
-
readonly size: 'small' | 'medium' | 'large' | 'xlarge';
|
|
6
|
-
}
|
|
7
|
-
export declare class CardError extends Component<ErrorCardProps, {}> {
|
|
8
|
-
static defaultProps: {
|
|
9
|
-
size: string;
|
|
10
|
-
};
|
|
4
|
+
export declare class CardError extends Component<StaticCardProps, {}> {
|
|
11
5
|
render(): React.JSX.Element;
|
|
12
6
|
get icon(): React.JSX.Element;
|
|
13
7
|
}
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Component } from 'react';
|
|
7
|
-
export
|
|
8
|
-
readonly size: 'small' | 'medium' | 'large' | 'xlarge';
|
|
9
|
-
}
|
|
10
|
-
export declare class ErrorIcon extends Component<ErrorIconProps, {}> {
|
|
11
|
-
static defaultProps: {
|
|
12
|
-
size: string;
|
|
13
|
-
};
|
|
7
|
+
export declare class ErrorIcon extends Component {
|
|
14
8
|
render(): React.JSX.Element;
|
|
15
9
|
}
|
|
@@ -89,7 +89,7 @@ export const deleteAction: {
|
|
|
89
89
|
handler: () => {
|
|
90
90
|
console.log('delete');
|
|
91
91
|
},
|
|
92
|
-
icon: <CrossIcon color="currentColor"
|
|
92
|
+
icon: <CrossIcon color="currentColor" label="delete" />,
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
export const annotateCardAction: CardAction = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.13.
|
|
3
|
+
"version": "79.13.2",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"@atlaskit/media-viewer": "^52.6.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^17.0.0",
|
|
48
|
-
"@atlaskit/react-ufo": "^4.
|
|
48
|
+
"@atlaskit/react-ufo": "^4.17.0",
|
|
49
49
|
"@atlaskit/spinner": "^19.0.0",
|
|
50
50
|
"@atlaskit/theme": "^21.0.0",
|
|
51
51
|
"@atlaskit/tokens": "^9.1.0",
|
|
52
|
-
"@atlaskit/tooltip": "^20.
|
|
52
|
+
"@atlaskit/tooltip": "^20.14.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.4.0",
|
|
54
54
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|