@atlaskit/media-card 79.9.0 → 79.9.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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 79.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a9118006d1586`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a9118006d1586) -
8
+ Subscribe to auth provider events from media-client and fire analytics with actionSubject
9
+ mediaAuthProvider.
10
+ - Updated dependencies
11
+
12
+ ## 79.9.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [`2fe94e8511b55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fe94e8511b55) -
17
+ Improved same-aspect-ratio detection in image rendering by using threshold-based comparison
18
+ instead of rounding-based comparison. This fixes edge cases where images with negligible aspect
19
+ ratio differences (1-2 pixels) from their parent container were incorrectly treated as different
20
+ ratios, causing unnecessary style recalculations and sub-optimal rendering strategies.
21
+
3
22
  ## 79.9.0
4
23
 
5
24
  ### Minor Changes
@@ -15,7 +15,9 @@ 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");
18
19
  var _analyticsNext = require("@atlaskit/analytics-next");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
21
  var _label = _interopRequireDefault(require("@atlaskit/react-ufo/label"));
20
22
  var _excluded = ["identifier"];
21
23
  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); }
@@ -48,6 +50,25 @@ var CardWithPerformanceObserver = exports.CardWithPerformanceObserver = function
48
50
  (0, _react.useEffect)(function () {
49
51
  (0, _mediaPerformanceObserver.setAnalyticsContext)(createAnalyticsEvent);
50
52
  }, [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
+ var onAuthSuccess = function onAuthSuccess(payload) {
60
+ (0, _analytics.fireMediaCardEvent)((0, _analytics.getAuthProviderSucceededPayload)(payload.durationMs, payload.timeoutMs, payload.authContext), createAnalyticsEvent);
61
+ };
62
+ var onAuthFailed = function onAuthFailed(payload) {
63
+ (0, _analytics.fireMediaCardEvent)((0, _analytics.getAuthProviderFailedPayload)(payload.durationMs, payload.timeoutMs, payload.error, payload.authContext), createAnalyticsEvent);
64
+ };
65
+ _mediaClient.globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
66
+ _mediaClient.globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
67
+ return function () {
68
+ _mediaClient.globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
69
+ _mediaClient.globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
70
+ };
71
+ }, [createAnalyticsEvent]);
51
72
  return /*#__PURE__*/_react.default.createElement(CardBase, props);
52
73
  };
53
74
  var Card = exports.Card = (0, _mediaCommon.withMediaAnalyticsContext)({
@@ -36,7 +36,7 @@ var calculateDimensions = exports.calculateDimensions = function calculateDimens
36
36
  var imgRatio = imgWidth / imgHeight;
37
37
  var cardRatio = parentWidth / parentHeight;
38
38
  if ((0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix')) {
39
- var isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
39
+ var isSameRatio = (0, _platformFeatureFlags.fg)('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
40
40
  if (isSameRatio) {
41
41
  if (resizeMode === 'stretchy-fit') {
42
42
  return DEFAULT_STRETCHY_FIT_DIMENSIONS;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.extractErrorInfo = exports.createAndFireMediaCardEvent = void 0;
8
8
  exports.fireMediaCardEvent = fireMediaCardEvent;
9
- exports.getRenderSucceededEventPayload = exports.getRenderFailedFileStatusPayload = exports.getRenderFailedExternalUriPayload = exports.getRenderErrorRequestMetadata = exports.getRenderErrorFailReason = exports.getRenderErrorEventPayload = exports.getRenderErrorErrorReason = exports.getRenderErrorErrorDetail = exports.getRemoteSuccessEventPayload = exports.getFileAttributes = exports.getErrorTraceContext = exports.getErrorEventPayload = exports.getDownloadSucceededEventPayload = exports.getDownloadFailedEventPayload = exports.getCacheHitEventPayload = void 0;
9
+ exports.getRenderSucceededEventPayload = exports.getRenderFailedFileStatusPayload = exports.getRenderFailedExternalUriPayload = exports.getRenderErrorRequestMetadata = exports.getRenderErrorFailReason = exports.getRenderErrorEventPayload = exports.getRenderErrorErrorReason = exports.getRenderErrorErrorDetail = exports.getRemoteSuccessEventPayload = exports.getFileAttributes = exports.getErrorTraceContext = exports.getErrorEventPayload = exports.getDownloadSucceededEventPayload = exports.getDownloadFailedEventPayload = exports.getCacheHitEventPayload = exports.getAuthProviderSucceededPayload = exports.getAuthProviderFailedPayload = void 0;
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _mediaClient = require("@atlaskit/media-client");
12
12
  var _analytics = require("@atlaskit/media-common/analytics");
@@ -199,6 +199,67 @@ var getRenderFailedFileStatusPayload = exports.getRenderFailedFileStatusPayload
199
199
  }
200
200
  };
201
201
  };
202
+
203
+ // Similar to extractErrorInfo but works with raw Error (not MediaCardError)
204
+ var extractAuthProviderErrorInfo = function extractAuthProviderErrorInfo(error) {
205
+ if ((0, _mediaClient.isCommonMediaClientError)(error)) {
206
+ var _error$innerError$mes, _error$innerError;
207
+ return {
208
+ failReason: error.reason,
209
+ error: error.reason,
210
+ errorDetail: (_error$innerError$mes = (_error$innerError = error.innerError) === null || _error$innerError === void 0 ? void 0 : _error$innerError.message) !== null && _error$innerError$mes !== void 0 ? _error$innerError$mes : error.message
211
+ };
212
+ }
213
+ return {
214
+ failReason: error.name || 'unknown',
215
+ error: error.name || '',
216
+ errorDetail: error.message
217
+ };
218
+ };
219
+
220
+ // Extract collection name from authContext - supports both new `access` array and deprecated `collectionName`
221
+ var getCollectionNameFromAuthContext = function getCollectionNameFromAuthContext(authContext) {
222
+ var _authContext$access;
223
+ if (!authContext) {
224
+ return undefined;
225
+ }
226
+ // Try new access array first
227
+ var collectionAccess = (_authContext$access = authContext.access) === null || _authContext$access === void 0 ? void 0 : _authContext$access.find(function (a) {
228
+ return a.type === 'collection';
229
+ });
230
+ if (collectionAccess && 'name' in collectionAccess) {
231
+ return collectionAccess.name;
232
+ }
233
+ // Fallback to deprecated collectionName
234
+ return authContext.collectionName;
235
+ };
236
+ var getAuthProviderSucceededPayload = exports.getAuthProviderSucceededPayload = function getAuthProviderSucceededPayload(durationMs, timeoutMs, authContext) {
237
+ return {
238
+ eventType: 'operational',
239
+ action: 'succeeded',
240
+ actionSubject: 'mediaAuthProvider',
241
+ attributes: {
242
+ status: 'succeeded',
243
+ durationMs: durationMs,
244
+ timeoutMs: timeoutMs,
245
+ collectionName: getCollectionNameFromAuthContext(authContext)
246
+ }
247
+ };
248
+ };
249
+ var getAuthProviderFailedPayload = exports.getAuthProviderFailedPayload = function getAuthProviderFailedPayload(durationMs, timeoutMs, error, authContext) {
250
+ var errorInfo = extractAuthProviderErrorInfo(error);
251
+ return {
252
+ eventType: 'operational',
253
+ action: 'failed',
254
+ actionSubject: 'mediaAuthProvider',
255
+ attributes: _objectSpread({
256
+ status: 'failed',
257
+ durationMs: durationMs,
258
+ timeoutMs: timeoutMs,
259
+ collectionName: getCollectionNameFromAuthContext(authContext)
260
+ }, errorInfo)
261
+ };
262
+ };
202
263
  function fireMediaCardEvent(payload, createAnalyticsEvent) {
203
264
  if (createAnalyticsEvent) {
204
265
  var event = createAnalyticsEvent((0, _analytics.sanitiseAnalyticsPayload)(payload));
@@ -21,6 +21,18 @@ Object.defineProperty(exports, "fireMediaCardEvent", {
21
21
  return _analytics.fireMediaCardEvent;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "getAuthProviderFailedPayload", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _analytics.getAuthProviderFailedPayload;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "getAuthProviderSucceededPayload", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _analytics.getAuthProviderSucceededPayload;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "getCacheHitEventPayload", {
25
37
  enumerable: true,
26
38
  get: function get() {
@@ -1,12 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import { isFileIdentifier } from '@atlaskit/media-client';
2
+ import { isFileIdentifier, globalMediaEventEmitter } 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';
9
10
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
10
12
  import UFOLabel from '@atlaskit/react-ufo/label';
11
13
  const packageName = "@atlaskit/media-card";
12
14
  const packageVersion = "0.0.0-development";
@@ -39,6 +41,25 @@ export const CardWithPerformanceObserver = props => {
39
41
  useEffect(() => {
40
42
  setAnalyticsContext(createAnalyticsEvent);
41
43
  }, [createAnalyticsEvent]);
44
+
45
+ // Auth provider analytics listener
46
+ useEffect(() => {
47
+ if (!fg('platform_media_auth_provider_analytics')) {
48
+ return;
49
+ }
50
+ const onAuthSuccess = payload => {
51
+ fireMediaCardEvent(getAuthProviderSucceededPayload(payload.durationMs, payload.timeoutMs, payload.authContext), createAnalyticsEvent);
52
+ };
53
+ const onAuthFailed = payload => {
54
+ fireMediaCardEvent(getAuthProviderFailedPayload(payload.durationMs, payload.timeoutMs, payload.error, payload.authContext), createAnalyticsEvent);
55
+ };
56
+ globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
57
+ globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
58
+ return () => {
59
+ globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
60
+ globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
61
+ };
62
+ }, [createAnalyticsEvent]);
42
63
  return /*#__PURE__*/React.createElement(CardBase, props);
43
64
  };
44
65
  export const Card = withMediaAnalyticsContext({
@@ -33,7 +33,7 @@ export const calculateDimensions = (imgElement, parentElement, resizeMode) => {
33
33
  const imgRatio = imgWidth / imgHeight;
34
34
  const cardRatio = parentWidth / parentHeight;
35
35
  if (fg('media-perf-uplift-mutation-fix')) {
36
- const isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
36
+ const isSameRatio = fg('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
37
37
  if (isSameRatio) {
38
38
  if (resizeMode === 'stretchy-fit') {
39
39
  return DEFAULT_STRETCHY_FIT_DIMENSIONS;
@@ -181,6 +181,64 @@ export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttr
181
181
  metadataTraceContext
182
182
  }
183
183
  });
184
+
185
+ // Similar to extractErrorInfo but works with raw Error (not MediaCardError)
186
+ const extractAuthProviderErrorInfo = error => {
187
+ if (isCommonMediaClientError(error)) {
188
+ var _error$innerError$mes, _error$innerError;
189
+ return {
190
+ failReason: error.reason,
191
+ error: error.reason,
192
+ errorDetail: (_error$innerError$mes = (_error$innerError = error.innerError) === null || _error$innerError === void 0 ? void 0 : _error$innerError.message) !== null && _error$innerError$mes !== void 0 ? _error$innerError$mes : error.message
193
+ };
194
+ }
195
+ return {
196
+ failReason: error.name || 'unknown',
197
+ error: error.name || '',
198
+ errorDetail: error.message
199
+ };
200
+ };
201
+
202
+ // Extract collection name from authContext - supports both new `access` array and deprecated `collectionName`
203
+ const getCollectionNameFromAuthContext = authContext => {
204
+ var _authContext$access;
205
+ if (!authContext) {
206
+ return undefined;
207
+ }
208
+ // Try new access array first
209
+ const collectionAccess = (_authContext$access = authContext.access) === null || _authContext$access === void 0 ? void 0 : _authContext$access.find(a => a.type === 'collection');
210
+ if (collectionAccess && 'name' in collectionAccess) {
211
+ return collectionAccess.name;
212
+ }
213
+ // Fallback to deprecated collectionName
214
+ return authContext.collectionName;
215
+ };
216
+ export const getAuthProviderSucceededPayload = (durationMs, timeoutMs, authContext) => ({
217
+ eventType: 'operational',
218
+ action: 'succeeded',
219
+ actionSubject: 'mediaAuthProvider',
220
+ attributes: {
221
+ status: 'succeeded',
222
+ durationMs,
223
+ timeoutMs,
224
+ collectionName: getCollectionNameFromAuthContext(authContext)
225
+ }
226
+ });
227
+ export const getAuthProviderFailedPayload = (durationMs, timeoutMs, error, authContext) => {
228
+ const errorInfo = extractAuthProviderErrorInfo(error);
229
+ return {
230
+ eventType: 'operational',
231
+ action: 'failed',
232
+ actionSubject: 'mediaAuthProvider',
233
+ attributes: {
234
+ status: 'failed',
235
+ durationMs,
236
+ timeoutMs,
237
+ collectionName: getCollectionNameFromAuthContext(authContext),
238
+ ...errorInfo
239
+ }
240
+ };
241
+ };
184
242
  export function fireMediaCardEvent(payload, createAnalyticsEvent) {
185
243
  if (createAnalyticsEvent) {
186
244
  const event = createAnalyticsEvent(sanitiseAnalyticsPayload(payload));
@@ -1 +1 @@
1
- export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload } from './analytics';
1
+ export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload, getAuthProviderSucceededPayload, getAuthProviderFailedPayload } from './analytics';
@@ -1,14 +1,16 @@
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 } from '@atlaskit/media-client';
4
+ import { isFileIdentifier, globalMediaEventEmitter } 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';
11
12
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
12
14
  import UFOLabel from '@atlaskit/react-ufo/label';
13
15
  var packageName = "@atlaskit/media-card";
14
16
  var packageVersion = "0.0.0-development";
@@ -39,6 +41,25 @@ export var CardWithPerformanceObserver = function CardWithPerformanceObserver(pr
39
41
  useEffect(function () {
40
42
  setAnalyticsContext(createAnalyticsEvent);
41
43
  }, [createAnalyticsEvent]);
44
+
45
+ // Auth provider analytics listener
46
+ useEffect(function () {
47
+ if (!fg('platform_media_auth_provider_analytics')) {
48
+ return;
49
+ }
50
+ var onAuthSuccess = function onAuthSuccess(payload) {
51
+ fireMediaCardEvent(getAuthProviderSucceededPayload(payload.durationMs, payload.timeoutMs, payload.authContext), createAnalyticsEvent);
52
+ };
53
+ var onAuthFailed = function onAuthFailed(payload) {
54
+ fireMediaCardEvent(getAuthProviderFailedPayload(payload.durationMs, payload.timeoutMs, payload.error, payload.authContext), createAnalyticsEvent);
55
+ };
56
+ globalMediaEventEmitter.on('auth-provider-succeeded', onAuthSuccess);
57
+ globalMediaEventEmitter.on('auth-provider-failed', onAuthFailed);
58
+ return function () {
59
+ globalMediaEventEmitter.off('auth-provider-succeeded', onAuthSuccess);
60
+ globalMediaEventEmitter.off('auth-provider-failed', onAuthFailed);
61
+ };
62
+ }, [createAnalyticsEvent]);
42
63
  return /*#__PURE__*/React.createElement(CardBase, props);
43
64
  };
44
65
  export var Card = withMediaAnalyticsContext({
@@ -30,7 +30,7 @@ export var calculateDimensions = function calculateDimensions(imgElement, parent
30
30
  var imgRatio = imgWidth / imgHeight;
31
31
  var cardRatio = parentWidth / parentHeight;
32
32
  if (fg('media-perf-uplift-mutation-fix')) {
33
- var isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
33
+ var isSameRatio = fg('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
34
34
  if (isSameRatio) {
35
35
  if (resizeMode === 'stretchy-fit') {
36
36
  return DEFAULT_STRETCHY_FIT_DIMENSIONS;
@@ -190,6 +190,67 @@ export var getRenderFailedFileStatusPayload = function getRenderFailedFileStatus
190
190
  }
191
191
  };
192
192
  };
193
+
194
+ // Similar to extractErrorInfo but works with raw Error (not MediaCardError)
195
+ var extractAuthProviderErrorInfo = function extractAuthProviderErrorInfo(error) {
196
+ if (isCommonMediaClientError(error)) {
197
+ var _error$innerError$mes, _error$innerError;
198
+ return {
199
+ failReason: error.reason,
200
+ error: error.reason,
201
+ errorDetail: (_error$innerError$mes = (_error$innerError = error.innerError) === null || _error$innerError === void 0 ? void 0 : _error$innerError.message) !== null && _error$innerError$mes !== void 0 ? _error$innerError$mes : error.message
202
+ };
203
+ }
204
+ return {
205
+ failReason: error.name || 'unknown',
206
+ error: error.name || '',
207
+ errorDetail: error.message
208
+ };
209
+ };
210
+
211
+ // Extract collection name from authContext - supports both new `access` array and deprecated `collectionName`
212
+ var getCollectionNameFromAuthContext = function getCollectionNameFromAuthContext(authContext) {
213
+ var _authContext$access;
214
+ if (!authContext) {
215
+ return undefined;
216
+ }
217
+ // Try new access array first
218
+ var collectionAccess = (_authContext$access = authContext.access) === null || _authContext$access === void 0 ? void 0 : _authContext$access.find(function (a) {
219
+ return a.type === 'collection';
220
+ });
221
+ if (collectionAccess && 'name' in collectionAccess) {
222
+ return collectionAccess.name;
223
+ }
224
+ // Fallback to deprecated collectionName
225
+ return authContext.collectionName;
226
+ };
227
+ export var getAuthProviderSucceededPayload = function getAuthProviderSucceededPayload(durationMs, timeoutMs, authContext) {
228
+ return {
229
+ eventType: 'operational',
230
+ action: 'succeeded',
231
+ actionSubject: 'mediaAuthProvider',
232
+ attributes: {
233
+ status: 'succeeded',
234
+ durationMs: durationMs,
235
+ timeoutMs: timeoutMs,
236
+ collectionName: getCollectionNameFromAuthContext(authContext)
237
+ }
238
+ };
239
+ };
240
+ export var getAuthProviderFailedPayload = function getAuthProviderFailedPayload(durationMs, timeoutMs, error, authContext) {
241
+ var errorInfo = extractAuthProviderErrorInfo(error);
242
+ return {
243
+ eventType: 'operational',
244
+ action: 'failed',
245
+ actionSubject: 'mediaAuthProvider',
246
+ attributes: _objectSpread({
247
+ status: 'failed',
248
+ durationMs: durationMs,
249
+ timeoutMs: timeoutMs,
250
+ collectionName: getCollectionNameFromAuthContext(authContext)
251
+ }, errorInfo)
252
+ };
253
+ };
193
254
  export function fireMediaCardEvent(payload, createAnalyticsEvent) {
194
255
  if (createAnalyticsEvent) {
195
256
  var event = createAnalyticsEvent(sanitiseAnalyticsPayload(payload));
@@ -1 +1 @@
1
- export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload } from './analytics';
1
+ export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload, getAuthProviderSucceededPayload, getAuthProviderFailedPayload } from './analytics';
@@ -105,7 +105,22 @@ export type CopiedFileEventPayload = UIEventPayload<{}, 'copied', string>;
105
105
  export type ClickedEventPayload = UIEventPayload<{
106
106
  label?: string;
107
107
  }, 'clicked', string>;
108
- export type MediaCardAnalyticsEventPayload = RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | CacheHitEventPayload | RemoteSuccessEventPayload | ErrorEventPayload | AnalyticsErrorBoundaryCardPayload | AnalyticsErrorBoundaryInlinePayload | RenderInlineCardFailedEventPayload | RenderInlineCardSucceededEventPayload | DownloadSucceededEventPayload | DownloadFailedEventPayload;
108
+ export type AuthProviderSucceededAnalyticsPayload = OperationalEventPayload<{
109
+ status: 'succeeded';
110
+ durationMs: number;
111
+ timeoutMs: number;
112
+ collectionName?: string;
113
+ }, 'succeeded', 'mediaAuthProvider'>;
114
+ export type AuthProviderFailedAnalyticsPayload = OperationalEventPayload<{
115
+ status: 'failed';
116
+ durationMs: number;
117
+ timeoutMs: number;
118
+ collectionName?: string;
119
+ failReason: string;
120
+ error?: string;
121
+ errorDetail?: string;
122
+ }, 'failed', 'mediaAuthProvider'>;
123
+ export type MediaCardAnalyticsEventPayload = RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | CacheHitEventPayload | RemoteSuccessEventPayload | ErrorEventPayload | AnalyticsErrorBoundaryCardPayload | AnalyticsErrorBoundaryInlinePayload | RenderInlineCardFailedEventPayload | RenderInlineCardSucceededEventPayload | DownloadSucceededEventPayload | DownloadFailedEventPayload | AuthProviderSucceededAnalyticsPayload | AuthProviderFailedAnalyticsPayload;
109
124
  export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: FileStatus) => FileAttributes;
110
125
  export declare const getRenderSucceededEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderSucceededEventPayload;
111
126
  export declare const getDownloadSucceededEventPayload: (fileAttributes: FileAttributes, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => DownloadSucceededEventPayload;
@@ -122,6 +137,20 @@ export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes
122
137
  export declare const getDownloadFailedEventPayload: (fileAttributes: FileAttributes, error: MediaCardError, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => DownloadFailedEventPayload;
123
138
  export declare const getErrorEventPayload: (cardStatus: CardStatus, fileAttributes: FileAttributes, error: MediaCardError, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => ErrorEventPayload;
124
139
  export declare const getRenderFailedFileStatusPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderFailedEventPayload;
140
+ export declare const getAuthProviderSucceededPayload: (durationMs: number, timeoutMs: number, authContext?: {
141
+ access?: Array<{
142
+ type: string;
143
+ name?: string;
144
+ }>;
145
+ collectionName?: string;
146
+ }) => AuthProviderSucceededAnalyticsPayload;
147
+ export declare const getAuthProviderFailedPayload: (durationMs: number, timeoutMs: number, error: Error, authContext?: {
148
+ access?: Array<{
149
+ type: string;
150
+ name?: string;
151
+ }>;
152
+ collectionName?: string;
153
+ }) => AuthProviderFailedAnalyticsPayload;
125
154
  export declare function fireMediaCardEvent(payload: MediaCardAnalyticsEventPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
126
155
  export declare const createAndFireMediaCardEvent: (payload: MediaCardAnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
127
156
  export {};
@@ -1,2 +1,2 @@
1
- export type { CardPreviewAttributes, FileUriFailReason, FailedErrorFailReason, MediaCardErrorInfo, SSRStatusFail, SSRStatus, WithSSRReliability, RenderFailedEventPayload, ErrorEventPayload, ErrorBoundaryErrorInfo, AnalyticsErrorBoundaryAttributes, AnalyticsErrorBoundaryCardPayload, AnalyticsErrorBoundaryInlinePayload, RenderInlineCardSucceededEventPayload, RenderInlineCardFailedEventPayload, RenderSucceededEventPayload, CacheHitEventPayload, RemoteSuccessEventPayload, CopiedFileEventPayload, ClickedEventPayload, MediaCardAnalyticsEventPayload, } from './analytics';
2
- export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload, } from './analytics';
1
+ export type { CardPreviewAttributes, FileUriFailReason, FailedErrorFailReason, MediaCardErrorInfo, SSRStatusFail, SSRStatus, WithSSRReliability, RenderFailedEventPayload, ErrorEventPayload, ErrorBoundaryErrorInfo, AnalyticsErrorBoundaryAttributes, AnalyticsErrorBoundaryCardPayload, AnalyticsErrorBoundaryInlinePayload, RenderInlineCardSucceededEventPayload, RenderInlineCardFailedEventPayload, RenderSucceededEventPayload, CacheHitEventPayload, RemoteSuccessEventPayload, CopiedFileEventPayload, ClickedEventPayload, MediaCardAnalyticsEventPayload, AuthProviderSucceededAnalyticsPayload, AuthProviderFailedAnalyticsPayload, } from './analytics';
2
+ export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload, getAuthProviderSucceededPayload, getAuthProviderFailedPayload, } from './analytics';
@@ -105,7 +105,22 @@ export type CopiedFileEventPayload = UIEventPayload<{}, 'copied', string>;
105
105
  export type ClickedEventPayload = UIEventPayload<{
106
106
  label?: string;
107
107
  }, 'clicked', string>;
108
- export type MediaCardAnalyticsEventPayload = RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | CacheHitEventPayload | RemoteSuccessEventPayload | ErrorEventPayload | AnalyticsErrorBoundaryCardPayload | AnalyticsErrorBoundaryInlinePayload | RenderInlineCardFailedEventPayload | RenderInlineCardSucceededEventPayload | DownloadSucceededEventPayload | DownloadFailedEventPayload;
108
+ export type AuthProviderSucceededAnalyticsPayload = OperationalEventPayload<{
109
+ status: 'succeeded';
110
+ durationMs: number;
111
+ timeoutMs: number;
112
+ collectionName?: string;
113
+ }, 'succeeded', 'mediaAuthProvider'>;
114
+ export type AuthProviderFailedAnalyticsPayload = OperationalEventPayload<{
115
+ status: 'failed';
116
+ durationMs: number;
117
+ timeoutMs: number;
118
+ collectionName?: string;
119
+ failReason: string;
120
+ error?: string;
121
+ errorDetail?: string;
122
+ }, 'failed', 'mediaAuthProvider'>;
123
+ export type MediaCardAnalyticsEventPayload = RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | CacheHitEventPayload | RemoteSuccessEventPayload | ErrorEventPayload | AnalyticsErrorBoundaryCardPayload | AnalyticsErrorBoundaryInlinePayload | RenderInlineCardFailedEventPayload | RenderInlineCardSucceededEventPayload | DownloadSucceededEventPayload | DownloadFailedEventPayload | AuthProviderSucceededAnalyticsPayload | AuthProviderFailedAnalyticsPayload;
109
124
  export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: FileStatus) => FileAttributes;
110
125
  export declare const getRenderSucceededEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderSucceededEventPayload;
111
126
  export declare const getDownloadSucceededEventPayload: (fileAttributes: FileAttributes, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => DownloadSucceededEventPayload;
@@ -122,6 +137,20 @@ export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes
122
137
  export declare const getDownloadFailedEventPayload: (fileAttributes: FileAttributes, error: MediaCardError, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => DownloadFailedEventPayload;
123
138
  export declare const getErrorEventPayload: (cardStatus: CardStatus, fileAttributes: FileAttributes, error: MediaCardError, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => ErrorEventPayload;
124
139
  export declare const getRenderFailedFileStatusPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderFailedEventPayload;
140
+ export declare const getAuthProviderSucceededPayload: (durationMs: number, timeoutMs: number, authContext?: {
141
+ access?: Array<{
142
+ type: string;
143
+ name?: string;
144
+ }>;
145
+ collectionName?: string;
146
+ }) => AuthProviderSucceededAnalyticsPayload;
147
+ export declare const getAuthProviderFailedPayload: (durationMs: number, timeoutMs: number, error: Error, authContext?: {
148
+ access?: Array<{
149
+ type: string;
150
+ name?: string;
151
+ }>;
152
+ collectionName?: string;
153
+ }) => AuthProviderFailedAnalyticsPayload;
125
154
  export declare function fireMediaCardEvent(payload: MediaCardAnalyticsEventPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
126
155
  export declare const createAndFireMediaCardEvent: (payload: MediaCardAnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
127
156
  export {};
@@ -1,2 +1,2 @@
1
- export type { CardPreviewAttributes, FileUriFailReason, FailedErrorFailReason, MediaCardErrorInfo, SSRStatusFail, SSRStatus, WithSSRReliability, RenderFailedEventPayload, ErrorEventPayload, ErrorBoundaryErrorInfo, AnalyticsErrorBoundaryAttributes, AnalyticsErrorBoundaryCardPayload, AnalyticsErrorBoundaryInlinePayload, RenderInlineCardSucceededEventPayload, RenderInlineCardFailedEventPayload, RenderSucceededEventPayload, CacheHitEventPayload, RemoteSuccessEventPayload, CopiedFileEventPayload, ClickedEventPayload, MediaCardAnalyticsEventPayload, } from './analytics';
2
- export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload, } from './analytics';
1
+ export type { CardPreviewAttributes, FileUriFailReason, FailedErrorFailReason, MediaCardErrorInfo, SSRStatusFail, SSRStatus, WithSSRReliability, RenderFailedEventPayload, ErrorEventPayload, ErrorBoundaryErrorInfo, AnalyticsErrorBoundaryAttributes, AnalyticsErrorBoundaryCardPayload, AnalyticsErrorBoundaryInlinePayload, RenderInlineCardSucceededEventPayload, RenderInlineCardFailedEventPayload, RenderSucceededEventPayload, CacheHitEventPayload, RemoteSuccessEventPayload, CopiedFileEventPayload, ClickedEventPayload, MediaCardAnalyticsEventPayload, AuthProviderSucceededAnalyticsPayload, AuthProviderFailedAnalyticsPayload, } from './analytics';
2
+ export { getFileAttributes, getRenderSucceededEventPayload, getCacheHitEventPayload, getRemoteSuccessEventPayload, getRenderFailedExternalUriPayload, getRenderErrorFailReason, getRenderErrorErrorReason, getRenderErrorErrorDetail, getErrorTraceContext, getRenderErrorRequestMetadata, extractErrorInfo, getRenderErrorEventPayload, getErrorEventPayload, getRenderFailedFileStatusPayload, fireMediaCardEvent, createAndFireMediaCardEvent, getDownloadSucceededEventPayload, getDownloadFailedEventPayload, getAuthProviderSucceededPayload, getAuthProviderFailedPayload, } from './analytics';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "79.9.0",
3
+ "version": "79.9.2",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,20 +36,20 @@
36
36
  "@atlaskit/editor-shared-styles": "^3.10.0",
37
37
  "@atlaskit/icon": "^29.0.0",
38
38
  "@atlaskit/link": "^3.2.0",
39
- "@atlaskit/media-client": "^35.6.0",
39
+ "@atlaskit/media-client": "^35.7.0",
40
40
  "@atlaskit/media-client-react": "^4.1.0",
41
41
  "@atlaskit/media-common": "^12.3.0",
42
42
  "@atlaskit/media-file-preview": "^0.15.0",
43
43
  "@atlaskit/media-svg": "^2.1.0",
44
44
  "@atlaskit/media-ui": "^28.7.0",
45
- "@atlaskit/media-viewer": "^52.4.0",
45
+ "@atlaskit/media-viewer": "^52.5.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/primitives": "^16.4.0",
48
48
  "@atlaskit/react-ufo": "^4.15.0",
49
49
  "@atlaskit/spinner": "^19.0.0",
50
50
  "@atlaskit/theme": "^21.0.0",
51
51
  "@atlaskit/tokens": "^8.4.0",
52
- "@atlaskit/tooltip": "^20.10.0",
52
+ "@atlaskit/tooltip": "^20.11.0",
53
53
  "@atlaskit/ufo": "^0.4.0",
54
54
  "@atlaskit/visually-hidden": "^3.0.0",
55
55
  "@babel/runtime": "^7.0.0",
@@ -79,9 +79,9 @@
79
79
  "@atlaskit/media-test-data": "^3.2.0",
80
80
  "@atlaskit/media-test-helpers": "^39.0.0",
81
81
  "@atlaskit/radio": "^8.3.0",
82
- "@atlaskit/range": "^9.2.0",
82
+ "@atlaskit/range": "^9.3.0",
83
83
  "@atlaskit/ssr": "workspace:^",
84
- "@atlaskit/toggle": "^15.1.0",
84
+ "@atlaskit/toggle": "^15.2.0",
85
85
  "@atlassian/feature-flags-test-utils": "^1.0.0",
86
86
  "@atlassian/ufo": "^0.7.0",
87
87
  "@testing-library/dom": "^10.1.0",
@@ -99,6 +99,9 @@
99
99
  "wait-for-expect": "^1.2.0"
100
100
  },
101
101
  "platform-feature-flags": {
102
+ "platform_media_auth_provider_analytics": {
103
+ "type": "boolean"
104
+ },
102
105
  "platform-filecard-ufo-trace": {
103
106
  "type": "boolean"
104
107
  },
@@ -117,9 +120,6 @@
117
120
  "platform_editor_ssr_media": {
118
121
  "type": "boolean"
119
122
  },
120
- "jfp-magma-media-cursor": {
121
- "type": "boolean"
122
- },
123
123
  "platform_media_card_image_render": {
124
124
  "type": "boolean"
125
125
  },
@@ -140,6 +140,9 @@
140
140
  },
141
141
  "media-perf-lazy-loading-optimisation": {
142
142
  "type": "boolean"
143
+ },
144
+ "media-perf-ratio-calc-fix": {
145
+ "type": "boolean"
143
146
  }
144
147
  },
145
148
  "techstack": {