@atlaskit/media-card 79.8.0 → 79.8.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  4. package/dist/cjs/card/ui/unhandledErrorCard/contentLoadingErrorMessage.js +1 -1
  5. package/dist/cjs/inline/loader.js +1 -1
  6. package/dist/cjs/utils/analytics/analytics.js +9 -3
  7. package/dist/cjs/utils/ufoExperiences.js +1 -1
  8. package/dist/es2019/card/card.js +1 -1
  9. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  10. package/dist/es2019/card/ui/unhandledErrorCard/contentLoadingErrorMessage.js +1 -1
  11. package/dist/es2019/inline/loader.js +1 -1
  12. package/dist/es2019/utils/analytics/analytics.js +54 -42
  13. package/dist/es2019/utils/ufoExperiences.js +1 -1
  14. package/dist/esm/card/card.js +1 -1
  15. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  16. package/dist/esm/card/ui/unhandledErrorCard/contentLoadingErrorMessage.js +1 -1
  17. package/dist/esm/inline/loader.js +1 -1
  18. package/dist/esm/utils/analytics/analytics.js +9 -3
  19. package/dist/esm/utils/ufoExperiences.js +1 -1
  20. package/dist/types/card/ui/unhandledErrorCard/contentLoadingErrorMessage.d.ts +1 -1
  21. package/dist/types/utils/analytics/analytics.d.ts +5 -2
  22. package/dist/types/utils/viewportDetector.d.ts +1 -1
  23. package/dist/types-ts4.5/card/ui/unhandledErrorCard/contentLoadingErrorMessage.d.ts +1 -1
  24. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +5 -2
  25. package/dist/types-ts4.5/utils/viewportDetector.d.ts +1 -1
  26. package/example-helpers/DelayedRender.tsx +1 -1
  27. package/example-helpers/cards.tsx +75 -22
  28. package/example-helpers/index.tsx +14 -4
  29. package/example-helpers/selectableCard.tsx +1 -1
  30. package/example-helpers/ssrHelpers.tsx +5 -1
  31. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 79.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dee27fdf979fb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dee27fdf979fb) -
8
+ Added statusCode at the top level of analytics failure events, for SignalFX compatibility.
9
+ - Updated dependencies
10
+
11
+ ## 79.8.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`7cfa4a9ffdf8d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7cfa4a9ffdf8d) -
16
+ Suppress i18n eslint errors
17
+ - Updated dependencies
18
+
3
19
  ## 79.8.0
4
20
 
5
21
  ### Minor Changes
@@ -20,7 +20,7 @@ var _label = _interopRequireDefault(require("@atlaskit/react-ufo/label"));
20
20
  var _excluded = ["identifier"];
21
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); }
22
22
  var packageName = "@atlaskit/media-card";
23
- var packageVersion = "79.7.2";
23
+ var packageVersion = "79.8.1";
24
24
  var CardBase = exports.CardBase = function CardBase(_ref) {
25
25
  var identifier = _ref.identifier,
26
26
  otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
@@ -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.7.2";
90
+ var packageVersion = "79.8.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)({
@@ -10,7 +10,7 @@ var ContentLoadingErrorMessage = exports.ContentLoadingErrorMessage = function C
10
10
  var isHidden = _ref.isHidden;
11
11
  return (
12
12
  /*#__PURE__*/
13
- // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
13
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, @atlassian/i18n/no-literal-string-in-jsx
14
14
  _react.default.createElement("p", {
15
15
  style: {
16
16
  display: isHidden ? 'none' : 'block'
@@ -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.7.2",
119
+ packageName: "79.8.1",
120
120
  componentName: 'mediaInlineCard',
121
121
  component: 'mediaInlineCard'
122
122
  };
@@ -129,6 +129,7 @@ var extractErrorInfo = exports.extractErrorInfo = function extractErrorInfo(erro
129
129
  };
130
130
  };
131
131
  var getRenderErrorEventPayload = exports.getRenderErrorEventPayload = function getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability, traceContext, metadataTraceContext) {
132
+ var requestMetadata = getRenderErrorRequestMetadata(error);
132
133
  return {
133
134
  eventType: 'operational',
134
135
  action: 'failed',
@@ -139,13 +140,15 @@ var getRenderErrorEventPayload = exports.getRenderErrorEventPayload = function g
139
140
  performanceAttributes: performanceAttributes,
140
141
  status: 'fail'
141
142
  }, extractErrorInfo(error, metadataTraceContext)), {}, {
142
- request: getRenderErrorRequestMetadata(error),
143
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
144
+ request: requestMetadata,
143
145
  ssrReliability: ssrReliability,
144
146
  traceContext: traceContext
145
147
  })
146
148
  };
147
149
  };
148
150
  var getDownloadFailedEventPayload = exports.getDownloadFailedEventPayload = function getDownloadFailedEventPayload(fileAttributes, error, traceContext, metadataTraceContext) {
151
+ var requestMetadata = getRenderErrorRequestMetadata(error);
149
152
  return {
150
153
  eventType: 'operational',
151
154
  action: 'failed',
@@ -155,12 +158,14 @@ var getDownloadFailedEventPayload = exports.getDownloadFailedEventPayload = func
155
158
  fileAttributes: fileAttributes,
156
159
  status: 'fail'
157
160
  }, extractErrorInfo(error, metadataTraceContext)), {}, {
158
- request: getRenderErrorRequestMetadata(error),
161
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
162
+ request: requestMetadata,
159
163
  traceContext: traceContext
160
164
  })
161
165
  };
162
166
  };
163
167
  var getErrorEventPayload = exports.getErrorEventPayload = function getErrorEventPayload(cardStatus, fileAttributes, error, ssrReliability, traceContext, metadataTraceContext) {
168
+ var requestMetadata = getRenderErrorRequestMetadata(error);
164
169
  return {
165
170
  eventType: 'operational',
166
171
  action: 'nonCriticalFail',
@@ -169,7 +174,8 @@ var getErrorEventPayload = exports.getErrorEventPayload = function getErrorEvent
169
174
  fileAttributes: fileAttributes,
170
175
  status: 'fail'
171
176
  }, extractErrorInfo(error, metadataTraceContext)), {}, {
172
- request: getRenderErrorRequestMetadata(error),
177
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
178
+ request: requestMetadata,
173
179
  ssrReliability: ssrReliability,
174
180
  traceContext: traceContext,
175
181
  cardStatus: cardStatus
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
15
15
  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; }
16
16
  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; }
17
17
  var packageName = "@atlaskit/media-card";
18
- var packageVersion = "79.7.2";
18
+ var packageVersion = "79.8.1";
19
19
  var SAMPLE_RATE = 0.05;
20
20
  var concurrentExperience;
21
21
  var getExperience = function getExperience(id) {
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
9
9
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
10
  import UFOLabel from '@atlaskit/react-ufo/label';
11
11
  const packageName = "@atlaskit/media-card";
12
- const packageVersion = "79.7.2";
12
+ const packageVersion = "79.8.1";
13
13
  export const CardBase = ({
14
14
  identifier,
15
15
  ...otherProps
@@ -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.7.2";
69
+ const packageVersion = "79.8.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({
@@ -3,7 +3,7 @@ export const ContentLoadingErrorMessage = ({
3
3
  isHidden
4
4
  }) =>
5
5
  /*#__PURE__*/
6
- // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
6
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, @atlassian/i18n/no-literal-string-in-jsx
7
7
  React.createElement("p", {
8
8
  style: {
9
9
  display: isHidden ? 'none' : 'block'
@@ -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.7.2",
40
+ packageName: "79.8.1",
41
41
  componentName: 'mediaInlineCard',
42
42
  component: 'mediaInlineCard'
43
43
  };
@@ -112,48 +112,60 @@ export const extractErrorInfo = (error, metadataTraceContext) => {
112
112
  metadataTraceContext: metadataTraceContext !== null && metadataTraceContext !== void 0 ? metadataTraceContext : getErrorTraceContext(error)
113
113
  };
114
114
  };
115
- export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes, error, ssrReliability, traceContext, metadataTraceContext) => ({
116
- eventType: 'operational',
117
- action: 'failed',
118
- actionSubject: 'mediaCardRender',
119
- attributes: {
120
- fileMimetype: fileAttributes.fileMimetype,
121
- fileAttributes,
122
- performanceAttributes,
123
- status: 'fail',
124
- ...extractErrorInfo(error, metadataTraceContext),
125
- request: getRenderErrorRequestMetadata(error),
126
- ssrReliability,
127
- traceContext
128
- }
129
- });
130
- export const getDownloadFailedEventPayload = (fileAttributes, error, traceContext, metadataTraceContext) => ({
131
- eventType: 'operational',
132
- action: 'failed',
133
- actionSubject: 'mediaCardDownload',
134
- attributes: {
135
- fileMimetype: fileAttributes.fileMimetype,
136
- fileAttributes,
137
- status: 'fail',
138
- ...extractErrorInfo(error, metadataTraceContext),
139
- request: getRenderErrorRequestMetadata(error),
140
- traceContext
141
- }
142
- });
143
- export const getErrorEventPayload = (cardStatus, fileAttributes, error, ssrReliability, traceContext, metadataTraceContext) => ({
144
- eventType: 'operational',
145
- action: 'nonCriticalFail',
146
- actionSubject: 'mediaCardRender',
147
- attributes: {
148
- fileAttributes,
149
- status: 'fail',
150
- ...extractErrorInfo(error, metadataTraceContext),
151
- request: getRenderErrorRequestMetadata(error),
152
- ssrReliability,
153
- traceContext,
154
- cardStatus
155
- }
156
- });
115
+ export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes, error, ssrReliability, traceContext, metadataTraceContext) => {
116
+ const requestMetadata = getRenderErrorRequestMetadata(error);
117
+ return {
118
+ eventType: 'operational',
119
+ action: 'failed',
120
+ actionSubject: 'mediaCardRender',
121
+ attributes: {
122
+ fileMimetype: fileAttributes.fileMimetype,
123
+ fileAttributes,
124
+ performanceAttributes,
125
+ status: 'fail',
126
+ ...extractErrorInfo(error, metadataTraceContext),
127
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
128
+ request: requestMetadata,
129
+ ssrReliability,
130
+ traceContext
131
+ }
132
+ };
133
+ };
134
+ export const getDownloadFailedEventPayload = (fileAttributes, error, traceContext, metadataTraceContext) => {
135
+ const requestMetadata = getRenderErrorRequestMetadata(error);
136
+ return {
137
+ eventType: 'operational',
138
+ action: 'failed',
139
+ actionSubject: 'mediaCardDownload',
140
+ attributes: {
141
+ fileMimetype: fileAttributes.fileMimetype,
142
+ fileAttributes,
143
+ status: 'fail',
144
+ ...extractErrorInfo(error, metadataTraceContext),
145
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
146
+ request: requestMetadata,
147
+ traceContext
148
+ }
149
+ };
150
+ };
151
+ export const getErrorEventPayload = (cardStatus, fileAttributes, error, ssrReliability, traceContext, metadataTraceContext) => {
152
+ const requestMetadata = getRenderErrorRequestMetadata(error);
153
+ return {
154
+ eventType: 'operational',
155
+ action: 'nonCriticalFail',
156
+ actionSubject: 'mediaCardRender',
157
+ attributes: {
158
+ fileAttributes,
159
+ status: 'fail',
160
+ ...extractErrorInfo(error, metadataTraceContext),
161
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
162
+ request: requestMetadata,
163
+ ssrReliability,
164
+ traceContext,
165
+ cardStatus
166
+ }
167
+ };
168
+ };
157
169
  export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttributes, ssrReliability, traceContext, metadataTraceContext) => ({
158
170
  eventType: 'operational',
159
171
  action: 'failed',
@@ -5,7 +5,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
5
5
  import { MediaCardError } from '../errors';
6
6
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
7
7
  const packageName = "@atlaskit/media-card";
8
- const packageVersion = "79.7.2";
8
+ const packageVersion = "79.8.1";
9
9
  const SAMPLE_RATE = 0.05;
10
10
  let concurrentExperience;
11
11
  const getExperience = id => {
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
11
11
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
12
12
  import UFOLabel from '@atlaskit/react-ufo/label';
13
13
  var packageName = "@atlaskit/media-card";
14
- var packageVersion = "79.7.2";
14
+ var packageVersion = "79.8.1";
15
15
  export var CardBase = function CardBase(_ref) {
16
16
  var identifier = _ref.identifier,
17
17
  otherProps = _objectWithoutProperties(_ref, _excluded);
@@ -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.7.2";
83
+ var packageVersion = "79.8.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({
@@ -3,7 +3,7 @@ export var ContentLoadingErrorMessage = function ContentLoadingErrorMessage(_ref
3
3
  var isHidden = _ref.isHidden;
4
4
  return (
5
5
  /*#__PURE__*/
6
- // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
6
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, @atlassian/i18n/no-literal-string-in-jsx
7
7
  React.createElement("p", {
8
8
  style: {
9
9
  display: isHidden ? 'none' : 'block'
@@ -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.7.2",
104
+ packageName: "79.8.1",
105
105
  componentName: 'mediaInlineCard',
106
106
  component: 'mediaInlineCard'
107
107
  };
@@ -120,6 +120,7 @@ export var extractErrorInfo = function extractErrorInfo(error, metadataTraceCont
120
120
  };
121
121
  };
122
122
  export var getRenderErrorEventPayload = function getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability, traceContext, metadataTraceContext) {
123
+ var requestMetadata = getRenderErrorRequestMetadata(error);
123
124
  return {
124
125
  eventType: 'operational',
125
126
  action: 'failed',
@@ -130,13 +131,15 @@ export var getRenderErrorEventPayload = function getRenderErrorEventPayload(file
130
131
  performanceAttributes: performanceAttributes,
131
132
  status: 'fail'
132
133
  }, extractErrorInfo(error, metadataTraceContext)), {}, {
133
- request: getRenderErrorRequestMetadata(error),
134
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
135
+ request: requestMetadata,
134
136
  ssrReliability: ssrReliability,
135
137
  traceContext: traceContext
136
138
  })
137
139
  };
138
140
  };
139
141
  export var getDownloadFailedEventPayload = function getDownloadFailedEventPayload(fileAttributes, error, traceContext, metadataTraceContext) {
142
+ var requestMetadata = getRenderErrorRequestMetadata(error);
140
143
  return {
141
144
  eventType: 'operational',
142
145
  action: 'failed',
@@ -146,12 +149,14 @@ export var getDownloadFailedEventPayload = function getDownloadFailedEventPayloa
146
149
  fileAttributes: fileAttributes,
147
150
  status: 'fail'
148
151
  }, extractErrorInfo(error, metadataTraceContext)), {}, {
149
- request: getRenderErrorRequestMetadata(error),
152
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
153
+ request: requestMetadata,
150
154
  traceContext: traceContext
151
155
  })
152
156
  };
153
157
  };
154
158
  export var getErrorEventPayload = function getErrorEventPayload(cardStatus, fileAttributes, error, ssrReliability, traceContext, metadataTraceContext) {
159
+ var requestMetadata = getRenderErrorRequestMetadata(error);
155
160
  return {
156
161
  eventType: 'operational',
157
162
  action: 'nonCriticalFail',
@@ -160,7 +165,8 @@ export var getErrorEventPayload = function getErrorEventPayload(cardStatus, file
160
165
  fileAttributes: fileAttributes,
161
166
  status: 'fail'
162
167
  }, extractErrorInfo(error, metadataTraceContext)), {}, {
163
- request: getRenderErrorRequestMetadata(error),
168
+ statusCode: requestMetadata === null || requestMetadata === void 0 ? void 0 : requestMetadata.statusCode,
169
+ request: requestMetadata,
164
170
  ssrReliability: ssrReliability,
165
171
  traceContext: traceContext,
166
172
  cardStatus: cardStatus
@@ -8,7 +8,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
8
8
  import { MediaCardError } from '../errors';
9
9
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
10
10
  var packageName = "@atlaskit/media-card";
11
- var packageVersion = "79.7.2";
11
+ var packageVersion = "79.8.1";
12
12
  var SAMPLE_RATE = 0.05;
13
13
  var concurrentExperience;
14
14
  var getExperience = function getExperience(id) {
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  type ContentLoadingErrorMessageProps = {
3
3
  isHidden?: boolean;
4
4
  };
5
- export declare const ContentLoadingErrorMessage: ({ isHidden }: ContentLoadingErrorMessageProps) => React.JSX.Element;
5
+ export declare const ContentLoadingErrorMessage: ({ isHidden, }: ContentLoadingErrorMessageProps) => React.JSX.Element;
6
6
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type ErrorInfo } from 'react';
2
- import { type FileDetails, type FileStatus, type MediaClientErrorReason, type RequestMetadata } from '@atlaskit/media-client';
2
+ import { type FileDetails, type FileStatus, type MediaClientErrorReason, type RequestErrorMetadata, type RequestMetadata } from '@atlaskit/media-client';
3
3
  import { type FileAttributes, type PerformanceAttributes, type OperationalEventPayload, type UIEventPayload, type WithFileAttributes, type WithPerformanceAttributes, type SuccessAttributes, type FailureAttributes, type MediaTraceContext, type WithTraceContext } from '@atlaskit/media-common/analytics';
4
4
  import { type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
5
  import { type MediaCardError, type MediaCardErrorPrimaryReason } from '../../errors';
@@ -63,17 +63,20 @@ export type WithSSRReliability = {
63
63
  export type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & WithTraceContext & FailureAttributes & {
64
64
  failReason: FailedErrorFailReason | 'failed-processing';
65
65
  error?: MediaClientErrorReason | 'nativeError';
66
+ statusCode?: number;
66
67
  request?: RequestMetadata;
67
68
  }, 'failed', 'mediaCardRender'>;
68
69
  export type DownloadFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithTraceContext & FailureAttributes & {
69
70
  failReason: FailedErrorFailReason;
70
71
  error?: MediaClientErrorReason | 'nativeError';
72
+ statusCode?: number;
71
73
  request?: RequestMetadata;
72
74
  }, 'failed', 'mediaCardDownload'>;
73
75
  export type ErrorEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & WithTraceContext & FailureAttributes & {
74
76
  cardStatus: CardStatus;
75
77
  failReason: FailedErrorFailReason | 'failed-processing';
76
78
  error?: MediaClientErrorReason | 'nativeError';
79
+ statusCode?: number;
77
80
  request?: RequestMetadata;
78
81
  }, 'nonCriticalFail', 'mediaCardRender'>;
79
82
  export type ErrorBoundaryErrorInfo = {
@@ -113,7 +116,7 @@ export declare const getRenderErrorFailReason: (error: MediaCardError) => Failed
113
116
  export declare const getRenderErrorErrorReason: (error: MediaCardError) => MediaClientErrorReason | "nativeError";
114
117
  export declare const getRenderErrorErrorDetail: (error: MediaCardError) => string;
115
118
  export declare const getErrorTraceContext: (error: MediaCardError) => MediaTraceContext | undefined;
116
- export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestMetadata | undefined;
119
+ export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestErrorMetadata | undefined;
117
120
  export declare const extractErrorInfo: (error: MediaCardError, metadataTraceContext?: MediaTraceContext) => MediaCardErrorInfo;
118
121
  export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error: MediaCardError, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderFailedEventPayload;
119
122
  export declare const getDownloadFailedEventPayload: (fileAttributes: FileAttributes, error: MediaCardError, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => DownloadFailedEventPayload;
@@ -3,4 +3,4 @@ export type ViewportDetectorProps = PropsWithChildren<{
3
3
  cardEl: HTMLElement | null;
4
4
  onVisible: () => void;
5
5
  }>;
6
- export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => React.JSX.Element;
6
+ export declare const ViewportDetector: ({ cardEl, onVisible, children, }: ViewportDetectorProps) => React.JSX.Element;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  type ContentLoadingErrorMessageProps = {
3
3
  isHidden?: boolean;
4
4
  };
5
- export declare const ContentLoadingErrorMessage: ({ isHidden }: ContentLoadingErrorMessageProps) => React.JSX.Element;
5
+ export declare const ContentLoadingErrorMessage: ({ isHidden, }: ContentLoadingErrorMessageProps) => React.JSX.Element;
6
6
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type ErrorInfo } from 'react';
2
- import { type FileDetails, type FileStatus, type MediaClientErrorReason, type RequestMetadata } from '@atlaskit/media-client';
2
+ import { type FileDetails, type FileStatus, type MediaClientErrorReason, type RequestErrorMetadata, type RequestMetadata } from '@atlaskit/media-client';
3
3
  import { type FileAttributes, type PerformanceAttributes, type OperationalEventPayload, type UIEventPayload, type WithFileAttributes, type WithPerformanceAttributes, type SuccessAttributes, type FailureAttributes, type MediaTraceContext, type WithTraceContext } from '@atlaskit/media-common/analytics';
4
4
  import { type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
5
  import { type MediaCardError, type MediaCardErrorPrimaryReason } from '../../errors';
@@ -63,17 +63,20 @@ export type WithSSRReliability = {
63
63
  export type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & WithTraceContext & FailureAttributes & {
64
64
  failReason: FailedErrorFailReason | 'failed-processing';
65
65
  error?: MediaClientErrorReason | 'nativeError';
66
+ statusCode?: number;
66
67
  request?: RequestMetadata;
67
68
  }, 'failed', 'mediaCardRender'>;
68
69
  export type DownloadFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithTraceContext & FailureAttributes & {
69
70
  failReason: FailedErrorFailReason;
70
71
  error?: MediaClientErrorReason | 'nativeError';
72
+ statusCode?: number;
71
73
  request?: RequestMetadata;
72
74
  }, 'failed', 'mediaCardDownload'>;
73
75
  export type ErrorEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & WithTraceContext & FailureAttributes & {
74
76
  cardStatus: CardStatus;
75
77
  failReason: FailedErrorFailReason | 'failed-processing';
76
78
  error?: MediaClientErrorReason | 'nativeError';
79
+ statusCode?: number;
77
80
  request?: RequestMetadata;
78
81
  }, 'nonCriticalFail', 'mediaCardRender'>;
79
82
  export type ErrorBoundaryErrorInfo = {
@@ -113,7 +116,7 @@ export declare const getRenderErrorFailReason: (error: MediaCardError) => Failed
113
116
  export declare const getRenderErrorErrorReason: (error: MediaCardError) => MediaClientErrorReason | "nativeError";
114
117
  export declare const getRenderErrorErrorDetail: (error: MediaCardError) => string;
115
118
  export declare const getErrorTraceContext: (error: MediaCardError) => MediaTraceContext | undefined;
116
- export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestMetadata | undefined;
119
+ export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestErrorMetadata | undefined;
117
120
  export declare const extractErrorInfo: (error: MediaCardError, metadataTraceContext?: MediaTraceContext) => MediaCardErrorInfo;
118
121
  export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error: MediaCardError, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderFailedEventPayload;
119
122
  export declare const getDownloadFailedEventPayload: (fileAttributes: FileAttributes, error: MediaCardError, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => DownloadFailedEventPayload;
@@ -3,4 +3,4 @@ export type ViewportDetectorProps = PropsWithChildren<{
3
3
  cardEl: HTMLElement | null;
4
4
  onVisible: () => void;
5
5
  }>;
6
- export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => React.JSX.Element;
6
+ export declare const ViewportDetector: ({ cardEl, onVisible, children, }: ViewportDetectorProps) => React.JSX.Element;
@@ -21,7 +21,7 @@ export class DelayedRender extends Component<Props, State> {
21
21
  }, this.props.timeout);
22
22
  }
23
23
 
24
- render() {
24
+ render(): React.JSX.Element | null {
25
25
  if (this.state.hidden) {
26
26
  return null;
27
27
  }
@@ -20,7 +20,10 @@ import { CardLoading, CardError, Card } from '../src';
20
20
  const mediaClientConfig = createStorybookMediaClientConfig();
21
21
  // standard
22
22
  const successIdentifier: FileIdentifier = imageFileId;
23
- export const standardCards = [
23
+ export const standardCards: {
24
+ title: string;
25
+ content: React.JSX.Element;
26
+ }[] = [
24
27
  {
25
28
  title: 'Image',
26
29
  content: (
@@ -33,7 +36,10 @@ export const standardCards = [
33
36
  },
34
37
  ];
35
38
 
36
- export const cardWithContextId = [
39
+ export const cardWithContextId: {
40
+ title: string;
41
+ content: React.JSX.Element;
42
+ }[] = [
37
43
  {
38
44
  title: 'Image with parameter',
39
45
  content: (
@@ -48,7 +54,10 @@ export const cardWithContextId = [
48
54
  ];
49
55
 
50
56
  //error cards
51
- export const errorCardsDark = [
57
+ export const errorCardsDark: {
58
+ title: string;
59
+ content: React.JSX.Element;
60
+ }[] = [
52
61
  {
53
62
  title: 'Image',
54
63
  content: (
@@ -57,7 +66,10 @@ export const errorCardsDark = [
57
66
  },
58
67
  ];
59
68
 
60
- export const errorCards = [
69
+ export const errorCards: {
70
+ title: string;
71
+ content: React.JSX.Element;
72
+ }[] = [
61
73
  {
62
74
  title: 'Image',
63
75
  content: (
@@ -77,7 +89,10 @@ export const errorCards = [
77
89
  },
78
90
  ];
79
91
 
80
- export const menuCards = [
92
+ export const menuCards: {
93
+ title: string;
94
+ content: React.JSX.Element;
95
+ }[] = [
81
96
  {
82
97
  title: 'Image',
83
98
  content: (
@@ -92,10 +107,16 @@ export const menuCards = [
92
107
  ];
93
108
 
94
109
  // api cards
95
- export const apiCards = createApiCards('image', successIdentifier);
110
+ export const apiCards: {
111
+ title: string;
112
+ content: React.JSX.Element;
113
+ }[] = createApiCards('image', successIdentifier);
96
114
 
97
115
  // no thumbnail
98
- export const noThumbnailCards = [
116
+ export const noThumbnailCards: {
117
+ title: string;
118
+ content: React.JSX.Element;
119
+ }[] = [
99
120
  {
100
121
  title: 'Image',
101
122
  content: (
@@ -105,7 +126,10 @@ export const noThumbnailCards = [
105
126
  ];
106
127
 
107
128
  // lazy load
108
- export const lazyLoadCards = [
129
+ export const lazyLoadCards: {
130
+ title: string;
131
+ content: React.JSX.Element;
132
+ }[] = [
109
133
  {
110
134
  title: 'Lazy',
111
135
  content: (
@@ -131,7 +155,10 @@ export const lazyLoadCards = [
131
155
  ];
132
156
 
133
157
  // no hover state cards
134
- export const noHoverStateCards = [
158
+ export const noHoverStateCards: {
159
+ title: string;
160
+ content: React.JSX.Element;
161
+ }[] = [
135
162
  {
136
163
  title: 'Overlay disabled',
137
164
  content: (
@@ -164,7 +191,10 @@ export const fileWithNoCollection: FileIdentifier = {
164
191
  id: 'e84c54a4-38b2-463f-ae27-5ba043c3e4c2',
165
192
  };
166
193
 
167
- export const collectionConfigCards = [
194
+ export const collectionConfigCards: {
195
+ title: string;
196
+ content: React.JSX.Element;
197
+ }[] = [
168
198
  {
169
199
  title: 'Standalone file (NO collection)',
170
200
  content: <Card identifier={fileWithNoCollection} mediaClientConfig={mediaClientConfig} />,
@@ -181,7 +211,10 @@ const divStyle = {
181
211
  };
182
212
  const dimensions = { height: 50, width: 50 };
183
213
 
184
- export const lightDefaultCards = [
214
+ export const lightDefaultCards: {
215
+ title: string;
216
+ content: React.JSX.Element;
217
+ }[] = [
185
218
  {
186
219
  title: 'Medium Loading',
187
220
  content: (
@@ -202,7 +235,10 @@ export const lightDefaultCards = [
202
235
  },
203
236
  ];
204
237
 
205
- export const lightResizedCards = [
238
+ export const lightResizedCards: {
239
+ title: string;
240
+ content: React.JSX.Element;
241
+ }[] = [
206
242
  {
207
243
  title: 'Medium Loading',
208
244
  content: <CardLoading dimensions={dimensions} />,
@@ -214,25 +250,30 @@ export const lightResizedCards = [
214
250
  ];
215
251
 
216
252
  // file cards
217
- export const videoFileCard = (
253
+ export const videoFileCard: React.JSX.Element = (
218
254
  <Card mediaClientConfig={mediaClientConfig} identifier={videoFileId} />
219
255
  );
220
256
 
221
- export const imageFileCard = (
257
+ export const imageFileCard: React.JSX.Element = (
222
258
  <Card mediaClientConfig={mediaClientConfig} identifier={imageFileId} />
223
259
  );
224
260
 
225
- export const audioFileCard = (
261
+ export const audioFileCard: React.JSX.Element = (
226
262
  <Card mediaClientConfig={mediaClientConfig} identifier={audioFileId} />
227
263
  );
228
264
 
229
- export const docFileCard = <Card mediaClientConfig={mediaClientConfig} identifier={docFileId} />;
265
+ export const docFileCard: React.JSX.Element = (
266
+ <Card mediaClientConfig={mediaClientConfig} identifier={docFileId} />
267
+ );
230
268
 
231
- export const unknownFileCard = (
269
+ export const unknownFileCard: React.JSX.Element = (
232
270
  <Card mediaClientConfig={mediaClientConfig} identifier={unknownFileId} />
233
271
  );
234
272
 
235
- export const resizingDefaultCards = [
273
+ export const resizingDefaultCards: {
274
+ title: string;
275
+ content: React.JSX.Element;
276
+ }[] = [
236
277
  {
237
278
  title: 'Small',
238
279
  content: <Card identifier={smallImageFileId} mediaClientConfig={mediaClientConfig} />,
@@ -247,7 +288,10 @@ export const resizingDefaultCards = [
247
288
  },
248
289
  ];
249
290
 
250
- export const croppedCards = [
291
+ export const croppedCards: {
292
+ title: string;
293
+ content: React.JSX.Element;
294
+ }[] = [
251
295
  {
252
296
  title: 'Small',
253
297
  content: (
@@ -268,7 +312,10 @@ export const croppedCards = [
268
312
  },
269
313
  ];
270
314
 
271
- export const fitCards = [
315
+ export const fitCards: {
316
+ title: string;
317
+ content: React.JSX.Element;
318
+ }[] = [
272
319
  {
273
320
  title: 'Small',
274
321
  content: (
@@ -289,7 +336,10 @@ export const fitCards = [
289
336
  },
290
337
  ];
291
338
 
292
- export const fullFitCards = [
339
+ export const fullFitCards: {
340
+ title: string;
341
+ content: React.JSX.Element;
342
+ }[] = [
293
343
  {
294
344
  title: 'Small',
295
345
  content: (
@@ -322,7 +372,10 @@ export const fullFitCards = [
322
372
  },
323
373
  ];
324
374
 
325
- export const stretchyFitCards = [
375
+ export const stretchyFitCards: {
376
+ title: string;
377
+ content: React.JSX.Element;
378
+ }[] = [
326
379
  {
327
380
  title: 'Small',
328
381
  content: (
@@ -33,7 +33,13 @@ export const mouseEnterHandler = (result: CardEvent) => {
33
33
  console.log('mouseEnter', result.mediaItemDetails);
34
34
  };
35
35
 
36
- export const createApiCards = (appearance: CardAppearance, identifier: Identifier) => {
36
+ export const createApiCards = (
37
+ appearance: CardAppearance,
38
+ identifier: Identifier,
39
+ ): {
40
+ title: string;
41
+ content: React.JSX.Element;
42
+ }[] => {
37
43
  // API methods
38
44
  const apiCards = [
39
45
  {
@@ -74,7 +80,11 @@ export const closeAction = {
74
80
  console.log('close');
75
81
  },
76
82
  };
77
- export const deleteAction = {
83
+ export const deleteAction: {
84
+ label: string;
85
+ handler: () => void;
86
+ icon: React.JSX.Element;
87
+ } = {
78
88
  label: 'Delete',
79
89
  handler: () => {
80
90
  console.log('delete');
@@ -121,7 +131,7 @@ export const MainWrapper = ({
121
131
  children,
122
132
  developmentOnly,
123
133
  disableFeatureFlagWrapper = false,
124
- }: MainWrapperProps) => {
134
+ }: MainWrapperProps): React.JSX.Element => {
125
135
  enableMediaUfoLogger(payloadPublisher);
126
136
  return (
127
137
  <>
@@ -148,7 +158,7 @@ export const mediaCardErrorState = (error?: string): MediaCardError | undefined
148
158
  }
149
159
  };
150
160
 
151
- export const SSRAnalyticsWrapper = ({ children }: PropsWithChildren<{}>) => {
161
+ export const SSRAnalyticsWrapper = ({ children }: PropsWithChildren<{}>): React.JSX.Element => {
152
162
  const mockClient: AnalyticsWebClient = {
153
163
  sendUIEvent: (e) => console.debug('UI event', e),
154
164
  sendOperationalEvent: (e) => console.debug('Operational event', e),
@@ -15,7 +15,7 @@ export class SelectableCard extends Component<SelectableCardProps, { selected: b
15
15
  this.state = { selected: false };
16
16
  }
17
17
 
18
- render() {
18
+ render(): React.JSX.Element | null {
19
19
  const { mediaClientConfig, identifier } = this.props;
20
20
  const { selected } = this.state;
21
21
 
@@ -12,7 +12,11 @@ export interface SimulateSsrParams
12
12
  const randomStr = () => Math.random().toString(36).substr(2, 9);
13
13
  const generateSsrPageId = () => `media-ssr-page-${randomStr()}-${randomStr()}`;
14
14
 
15
- export const SimulateSsr = ({ serverPage, hydratePage, ...divProps }: SimulateSsrParams) => {
15
+ export const SimulateSsr = ({
16
+ serverPage,
17
+ hydratePage,
18
+ ...divProps
19
+ }: SimulateSsrParams): React.JSX.Element => {
16
20
  const id = useMemo(generateSsrPageId, []);
17
21
 
18
22
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "79.8.0",
3
+ "version": "79.8.2",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,12 +44,12 @@
44
44
  "@atlaskit/media-ui": "^28.7.0",
45
45
  "@atlaskit/media-viewer": "^52.4.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
- "@atlaskit/primitives": "^16.1.0",
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
- "@atlaskit/tokens": "^8.0.0",
52
- "@atlaskit/tooltip": "^20.9.0",
51
+ "@atlaskit/tokens": "^8.4.0",
52
+ "@atlaskit/tooltip": "^20.10.0",
53
53
  "@atlaskit/ufo": "^0.4.0",
54
54
  "@atlaskit/visually-hidden": "^3.0.0",
55
55
  "@babel/runtime": "^7.0.0",
@@ -71,10 +71,10 @@
71
71
  "@af/integration-testing": "workspace:^",
72
72
  "@atlaskit/analytics-listeners": "^9.1.0",
73
73
  "@atlaskit/analytics-namespaced-context": "^7.2.0",
74
- "@atlaskit/form": "^14.2.0",
74
+ "@atlaskit/form": "^14.3.0",
75
75
  "@atlaskit/inline-message": "^15.4.0",
76
76
  "@atlaskit/media-core": "^37.0.0",
77
- "@atlaskit/media-picker": "^70.0.0",
77
+ "@atlaskit/media-picker": "^70.1.0",
78
78
  "@atlaskit/media-state": "^1.8.0",
79
79
  "@atlaskit/media-test-data": "^3.2.0",
80
80
  "@atlaskit/media-test-helpers": "^39.0.0",