@atlaskit/media-card 79.11.4 → 79.13.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 +22 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/externalImageCard.js +17 -12
- package/dist/cjs/card/fileCard.js +34 -12
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper-compiled.compiled.css +0 -3
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper-compiled.js +1 -3
- package/dist/cjs/card/ui/titleBox/failedTitleBox.js +0 -2
- package/dist/cjs/card/ui/titleBox/titleBoxComponents-compiled.js +1 -3
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +0 -2
- package/dist/cjs/utils/globalScope/globalScope.js +2 -1
- package/dist/cjs/utils/mediaPerformanceObserver/durationMetrics.js +1 -0
- package/dist/cjs/utils/ufoExperiences.js +454 -68
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/externalImageCard.js +16 -13
- package/dist/es2019/card/fileCard.js +33 -13
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/tickBox/tickBoxWrapper-compiled.compiled.css +0 -3
- package/dist/es2019/card/ui/tickBox/tickBoxWrapper-compiled.js +1 -3
- package/dist/es2019/card/ui/titleBox/failedTitleBox.js +0 -2
- package/dist/es2019/card/ui/titleBox/titleBoxComponents-compiled.js +1 -3
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +0 -2
- package/dist/es2019/utils/globalScope/globalScope.js +1 -0
- package/dist/es2019/utils/mediaPerformanceObserver/durationMetrics.js +1 -0
- package/dist/es2019/utils/ufoExperiences.js +449 -72
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/externalImageCard.js +18 -13
- package/dist/esm/card/fileCard.js +35 -13
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/tickBox/tickBoxWrapper-compiled.compiled.css +0 -3
- package/dist/esm/card/ui/tickBox/tickBoxWrapper-compiled.js +1 -3
- package/dist/esm/card/ui/titleBox/failedTitleBox.js +0 -2
- package/dist/esm/card/ui/titleBox/titleBoxComponents-compiled.js +1 -3
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +0 -2
- package/dist/esm/utils/globalScope/globalScope.js +1 -0
- package/dist/esm/utils/mediaPerformanceObserver/durationMetrics.js +1 -0
- package/dist/esm/utils/ufoExperiences.js +454 -68
- package/dist/types/utils/globalScope/globalScope.d.ts +2 -0
- package/dist/types/utils/mediaPerformanceObserver/durationMetrics.d.ts +1 -0
- package/dist/types/utils/ufoExperiences.d.ts +88 -5
- package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +2 -0
- package/dist/types-ts4.5/utils/mediaPerformanceObserver/durationMetrics.d.ts +1 -0
- package/dist/types-ts4.5/utils/ufoExperiences.d.ts +88 -5
- package/package.json +9 -9
|
@@ -11,7 +11,7 @@ import { generateUniqueId } from '../utils/generateUniqueId';
|
|
|
11
11
|
import { resolveCardPreviewDimensions } from '../utils/getDataURIDimension';
|
|
12
12
|
import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
13
13
|
import { getFileDetails } from '../utils/metadata';
|
|
14
|
-
import {
|
|
14
|
+
import { shouldPerformanceBeSampled, useMediaCardUfoExperience } from '../utils/ufoExperiences';
|
|
15
15
|
import { useCurrentValueRef } from '../utils/useCurrentValueRef';
|
|
16
16
|
import { usePrevious } from '../utils/usePrevious';
|
|
17
17
|
import { ViewportDetector } from '../utils/viewportDetector';
|
|
@@ -181,7 +181,13 @@ export const FileCard = ({
|
|
|
181
181
|
skipRemote: !isCardVisible,
|
|
182
182
|
source: 'mediaCard'
|
|
183
183
|
});
|
|
184
|
-
const
|
|
184
|
+
const shouldSendPerformanceEvent = useMemo(() => shouldPerformanceBeSampled(), []);
|
|
185
|
+
|
|
186
|
+
// UFO experience hook - creates a unique experience instance per card
|
|
187
|
+
const ufoExperience = useMediaCardUfoExperience({
|
|
188
|
+
instanceId: internalOccurrenceKey,
|
|
189
|
+
enabled: shouldSendPerformanceEvent
|
|
190
|
+
});
|
|
185
191
|
const [error, setError] = useState();
|
|
186
192
|
|
|
187
193
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
@@ -258,6 +264,7 @@ export const FileCard = ({
|
|
|
258
264
|
//----------------------------------------------------------------//
|
|
259
265
|
|
|
260
266
|
const fireOperationalEventRef = useCurrentValueRef(() => {
|
|
267
|
+
var _ssrReliability$serve, _ssrReliability$clien;
|
|
261
268
|
const timeElapsedTillEvent = performanceNow();
|
|
262
269
|
const durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
263
270
|
const performanceAttributes = {
|
|
@@ -267,7 +274,19 @@ export const FileCard = ({
|
|
|
267
274
|
}
|
|
268
275
|
};
|
|
269
276
|
createAnalyticsEvent && fireOperationalEvent(createAnalyticsEvent, finalStatus, fileAttributes, performanceAttributes, ssrReliability, finalError, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
270
|
-
|
|
277
|
+
|
|
278
|
+
// Determine SSR preview info for UFO timing strategy
|
|
279
|
+
// wasSSRAttempted is only true when SSR was used AND preview is non-lazy
|
|
280
|
+
// because lazy SSR defers loading, so it behaves like CSR for timing purposes
|
|
281
|
+
const isSSRNonLazy = !!ssr && (preview === null || preview === void 0 ? void 0 : preview.lazy) !== true;
|
|
282
|
+
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
|
+
const ssrPreviewInfo = {
|
|
284
|
+
dataUri: preview === null || preview === void 0 ? void 0 : preview.dataURI,
|
|
285
|
+
srcset: preview === null || preview === void 0 ? void 0 : preview.srcSet,
|
|
286
|
+
wasSSRAttempted: isSSRNonLazy,
|
|
287
|
+
wasSSRSuccessful
|
|
288
|
+
};
|
|
289
|
+
ufoExperience.complete(finalStatus, fileAttributes, fileStateFlagsRef.current, ssrReliability, finalError, ssrPreviewInfo);
|
|
271
290
|
});
|
|
272
291
|
const fireNonCriticalErrorEventRef = useCurrentValueRef(error => {
|
|
273
292
|
createAnalyticsEvent && fireNonCriticalErrorEvent(createAnalyticsEvent, finalStatus, fileAttributes, ssrReliability, error, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
@@ -278,19 +297,20 @@ export const FileCard = ({
|
|
|
278
297
|
}
|
|
279
298
|
}, [nonCriticalError, fireNonCriticalErrorEventRef]);
|
|
280
299
|
const startUfoExperienceRef = useCurrentValueRef(() => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
300
|
+
// For non-lazy SSR previews, use interaction start time as the experience start time
|
|
301
|
+
// because the image loading started at interaction start, not at mount time
|
|
302
|
+
const isSSRNonLazy = !!ssr && (preview === null || preview === void 0 ? void 0 : preview.lazy) !== true;
|
|
303
|
+
ufoExperience.start({
|
|
304
|
+
useInteractionTime: isSSRNonLazy
|
|
305
|
+
});
|
|
284
306
|
});
|
|
285
307
|
const fireAbortedEventRef = useCurrentValueRef(() => {
|
|
286
308
|
// UFO won't abort if it's already in a final state (succeeded, failed, aborted, etc)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
293
|
-
}
|
|
309
|
+
ufoExperience.abort({
|
|
310
|
+
fileAttributes,
|
|
311
|
+
fileStateFlags: fileStateFlagsRef === null || fileStateFlagsRef === void 0 ? void 0 : fileStateFlagsRef.current,
|
|
312
|
+
ssrReliability: ssrReliability
|
|
313
|
+
});
|
|
294
314
|
});
|
|
295
315
|
|
|
296
316
|
//----------------------------------------------------------------//
|
|
@@ -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.
|
|
69
|
+
const packageVersion = "79.13.0";
|
|
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({
|
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
._v564ybtr{transition:all .3s}
|
|
4
4
|
._154i1tpr{top:var(--ds-space-075,7px)}
|
|
5
5
|
._1b941ule span{display:block}
|
|
6
|
-
._1bsbdlk8{width:14px}
|
|
7
6
|
._1bsbpxbi{width:var(--ds-space-200,1pc)}
|
|
8
7
|
._1e0c11p5{display:grid}
|
|
9
8
|
._1ltv1tpr{left:var(--ds-space-075,7px)}
|
|
10
|
-
._1mcmdlk8 span svg{height:14px}
|
|
11
9
|
._4cvr1h6o{align-items:center}
|
|
12
|
-
._4t3idlk8{height:14px}
|
|
13
10
|
._4t3ipxbi{height:var(--ds-space-200,1pc)}
|
|
14
11
|
._6a6z1h6o{justify-items:center}
|
|
15
12
|
._bfhk8sto{background-color:var(--ds-icon-information,#2684ff)}
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
import "./tickBoxWrapper-compiled.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { tickBoxClassName } from './styles';
|
|
7
6
|
import { B200 } from '@atlaskit/theme/colors';
|
|
8
7
|
const selectedStyles = null;
|
|
9
|
-
const oldWrapperStyes = null;
|
|
10
8
|
const wrapperStyles = null;
|
|
11
9
|
export const TickBoxWrapper = props => {
|
|
12
10
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
11
|
id: "tickBoxWrapper",
|
|
14
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
15
|
-
className: ax(["_11c82smr _2rkov47k _4cvr1h6o _6a6z1h6o _v564ybtr _1bsbpxbi _4t3ipxbi _kqswstnw _154i1tpr _1ltv1tpr _syaz1j28 _1e0c11p5 _1b941ule",
|
|
13
|
+
className: ax(["_11c82smr _2rkov47k _4cvr1h6o _6a6z1h6o _v564ybtr _1bsbpxbi _4t3ipxbi _kqswstnw _154i1tpr _1ltv1tpr _syaz1j28 _1e0c11p5 _1b941ule", props.selected && "_bfhk8sto _syaz5w2r", tickBoxClassName])
|
|
16
14
|
}, props.children);
|
|
17
15
|
};
|
|
18
16
|
TickBoxWrapper.displayName = 'TickBoxWrapper';
|
|
@@ -16,8 +16,6 @@ export const FailedTitleBox = ({
|
|
|
16
16
|
breakpoint: breakpoint
|
|
17
17
|
}, /*#__PURE__*/React.createElement(ErrorMessageWrapper, null, /*#__PURE__*/React.createElement(EditorWarningIcon, {
|
|
18
18
|
label: 'Warning',
|
|
19
|
-
LEGACY_size: 'small',
|
|
20
|
-
LEGACY_margin: `0 ${"var(--ds-space-negative-025, -2px)"}`,
|
|
21
19
|
color: `var(--ds-text-danger, ${R300})`,
|
|
22
20
|
size: "small"
|
|
23
21
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import "./titleBoxComponents-compiled.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { N0, N800 } from '@atlaskit/theme/colors';
|
|
7
6
|
import { rgba } from '../styles';
|
|
8
7
|
const smallLineHeight = 14;
|
|
@@ -71,12 +70,11 @@ export const TitleBoxFooter = props => {
|
|
|
71
70
|
};
|
|
72
71
|
TitleBoxFooter.displayName = 'TitleBoxFooter';
|
|
73
72
|
const titleBoxIconStyles = null;
|
|
74
|
-
const newTitleBoxIconStyles = null;
|
|
75
73
|
export const TitleBoxIcon = props => {
|
|
76
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
77
75
|
id: "titleBoxIcon",
|
|
78
76
|
"data-testid": "title-box-icon",
|
|
79
|
-
className: ax([
|
|
77
|
+
className: ax(["_kqswstnw _1xi21b66 _94n51b66"])
|
|
80
78
|
}, props.children);
|
|
81
79
|
};
|
|
82
80
|
const errorMessageWrapperStyles = null;
|
|
@@ -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.
|
|
40
|
+
packageName: "79.13.0",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -57,9 +57,7 @@ const ErrorBoundaryComponent = ({
|
|
|
57
57
|
React.createElement("span", {
|
|
58
58
|
style: style
|
|
59
59
|
}, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
60
|
-
LEGACY_margin: `0 ${"var(--ds-space-negative-050, -4px)"} 0 0`,
|
|
61
60
|
label: "error",
|
|
62
|
-
LEGACY_size: "small",
|
|
63
61
|
color: `var(--ds-icon-danger, ${R300})`,
|
|
64
62
|
size: "small"
|
|
65
63
|
}), message)
|
|
@@ -7,6 +7,7 @@ import { printFunctionCall, printScript } from '../printScript';
|
|
|
7
7
|
|
|
8
8
|
export const GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
|
|
9
9
|
export const GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
|
|
10
|
+
export const GLOBAL_MEDIA_PERFORMANCE_ENTRIES = 'performanceEntries';
|
|
10
11
|
export function getMediaGlobalScope(globalScope = window) {
|
|
11
12
|
// Must match GLOBAL_MEDIA_NAMESPACE. Can't reference the constant from here.
|
|
12
13
|
const namespace = '__MEDIA_INTERNAL';
|
|
@@ -81,6 +81,7 @@ export const createMediaDurationMetrics = (entry, interactionStartTime) => {
|
|
|
81
81
|
totalDuration: entry.duration,
|
|
82
82
|
initiatorType: entry.initiatorType,
|
|
83
83
|
// value can be 'fetch' or 'img'
|
|
84
|
+
endedAt: entry.responseEnd - interactionStartTime,
|
|
84
85
|
responseEnd: entry.responseEnd,
|
|
85
86
|
browserCacheHit: entry.transferSize === 0,
|
|
86
87
|
nextHopProtocol: entry.nextHopProtocol,
|