@atlaskit/media-card 79.13.1 → 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 +11 -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/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- 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/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- 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/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 79.13.1
|
|
4
15
|
|
|
5
16
|
### Patch 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)({
|
|
@@ -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
|
};
|
|
@@ -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
|
/**
|
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({
|
|
@@ -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
|
};
|
|
@@ -9,7 +9,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
9
9
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
10
10
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "79.13.
|
|
12
|
+
const packageVersion = "79.13.1";
|
|
13
13
|
const SAMPLE_RATE = 0.05;
|
|
14
14
|
|
|
15
15
|
/**
|
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({
|
|
@@ -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
|
};
|
|
@@ -13,7 +13,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
13
13
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
14
14
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
15
15
|
var packageName = "@atlaskit/media-card";
|
|
16
|
-
var packageVersion = "79.13.
|
|
16
|
+
var packageVersion = "79.13.1";
|
|
17
17
|
var SAMPLE_RATE = 0.05;
|
|
18
18
|
|
|
19
19
|
/**
|
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/"
|
|
@@ -49,7 +49,7 @@
|
|
|
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",
|