@atlaskit/media-card 78.1.0 → 78.1.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
+ ## 78.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`eaacfc7b03414`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eaacfc7b03414) -
8
+ Changed the feature flag used for analytics publishing to prevent spamming due to cached clients
9
+ using bugged versions of Card
10
+
11
+ ## 78.1.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#132917](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132917)
16
+ [`c940f8ae45182`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c940f8ae45182) -
17
+ Include additional attributes in the mediaCardPerfObserver metrics: `contentDownloadTime`,
18
+ `nextHopProtocol`, `userAgent`
19
+
20
+ And remove the `url` attribute.
21
+
3
22
  ## 78.1.0
4
23
 
5
24
  ### Minor Changes
@@ -21,7 +21,7 @@ var _excluded = ["identifier"];
21
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
23
  var packageName = "@atlaskit/media-card";
24
- var packageVersion = "78.1.0";
24
+ var packageVersion = "78.1.2";
25
25
  var CardBase = exports.CardBase = function CardBase(_ref) {
26
26
  var identifier = _ref.identifier,
27
27
  otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
@@ -40,12 +40,12 @@ var CardWithPerformanceObserver = exports.CardWithPerformanceObserver = function
40
40
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
41
41
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
42
42
  (0, _react.useEffect)(function () {
43
- if ((0, _platformFeatureFlags.fg)('platform.media-card-performance-observer_lgc7b')) {
43
+ if ((0, _platformFeatureFlags.fg)('platform.media-card-performance-observer_a803k')) {
44
44
  (0, _mediaPerformanceObserver.startResourceObserver)();
45
45
  }
46
46
  }, []);
47
47
  (0, _react.useEffect)(function () {
48
- if ((0, _platformFeatureFlags.fg)('platform.media-card-performance-observer_lgc7b')) {
48
+ if ((0, _platformFeatureFlags.fg)('platform.media-card-performance-observer_a803k')) {
49
49
  (0, _mediaPerformanceObserver.setAnalyticsContext)(createAnalyticsEvent);
50
50
  }
51
51
  }, [createAnalyticsEvent]);
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
90
90
  }(_react.default.Component);
91
91
  (0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
92
92
  var packageName = "@atlaskit/media-card";
93
- var packageVersion = "78.1.0";
93
+ var packageVersion = "78.1.2";
94
94
 
95
95
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
96
96
  var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
119
119
  ErrorBoundary = _this$state.ErrorBoundary;
120
120
  var analyticsContext = {
121
121
  packageVersion: "@atlaskit/media-card",
122
- packageName: "78.1.0",
122
+ packageName: "78.1.2",
123
123
  componentName: 'mediaInlineCard',
124
124
  component: 'mediaInlineCard'
125
125
  };
@@ -8,10 +8,10 @@ var _analytics = require("@atlaskit/media-common/analytics");
8
8
  var MEDIA_CARD_PERF_STATE_KEY = '__mediaCardPerfState_asflkajsdflja';
9
9
  var urlRegex = /https:\/\/(?:media\.(?:dev|staging|prod)\.atl-paas\.net|api\.media\.atlassian\.com)\/file\/([^/]+)\/image.*[?&]source=mediaCard/;
10
10
  var clientIdParamRegex = /[?&]clientId=([^&]+)/;
11
- var ssrParamRegex = /[?&]ssr=([^&]+)/;
11
+ var ssrParamRegex = /[?&]token=([^&]+)/;
12
12
 
13
13
  /**
14
- * `ExperimentalPerfoamnceResourceTiming` type accounts for the experimental value `firstInterimResponseStart`
14
+ * `ExperimentalPerformanceResourceTiming` type accounts for the experimental value `firstInterimResponseStart`
15
15
  * which is present in Chrome, but not present in FireFox or Safari.
16
16
  * Read more: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/firstInterimResponseStart
17
17
  */
@@ -28,7 +28,8 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
28
28
  var _entry$serverTiming$f, _entry$serverTiming$f2;
29
29
  var fileId = matchFileId[1];
30
30
  var clientId = matchClientId === null || matchClientId === void 0 ? void 0 : matchClientId[1];
31
- var ssr = matchSSR === null || matchSSR === void 0 ? void 0 : matchSSR[1];
31
+ var ssr = matchSSR ? 'server' : undefined;
32
+ var navigationTime = performance.getEntriesByType('navigation')[0];
32
33
  var event = window[MEDIA_CARD_PERF_STATE_KEY].mediaCardCreateAnalyticsEvent({
33
34
  eventType: 'operational',
34
35
  action: 'succeeded',
@@ -37,7 +38,7 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
37
38
  ssr: ssr,
38
39
  fileId: fileId,
39
40
  mediaClientId: clientId,
40
- url: entry.name,
41
+ startedAt: entry.startTime - ((navigationTime === null || navigationTime === void 0 ? void 0 : navigationTime.domContentLoadedEventEnd) || 0),
41
42
  /**
42
43
  * Performance resource timing data regarding the loading of an
43
44
  * application's resources as described in
@@ -52,12 +53,20 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
52
53
  tlsConnectNegotiationTime: entry.requestStart - entry.secureConnectionStart,
53
54
  timeTakenToFetchWithoutRedirect: entry.responseEnd - entry.fetchStart,
54
55
  browserCacheHit: entry.transferSize === 0,
56
+ nextHopProtocol: entry.nextHopProtocol,
55
57
  /**
56
58
  * `interimRequestTime` represents the entire time the browser took to
57
59
  * request the resource from the server. This includes the interim response time
58
- * (for example, 100 Continue or 103 Early Hints). Please, note that this value
59
- * is distinctly different from the aforementioned document.
60
+ * (for example, 100 Continue or 103 Early Hints).
61
+ *
62
+ * i.e. It is the time taken for the request to be sent
63
+ * + the waiting time for the server to send a response
60
64
  *
65
+ * Please, note that this value
66
+ * is distinctly different from the aforementioned document.
67
+ */
68
+ interimRequestTime: entry.responseStart - entry.requestStart,
69
+ /**
61
70
  * `requestInvocationTime` represents the actual time the browser took to request
62
71
  * the resource from the server (i.e. it does not include the interim reponse
63
72
  * time).
@@ -65,8 +74,18 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
65
74
  * available in Chrome, but not in FireFox or Safari. This value will be undefined
66
75
  * when `firstInterimResponseStart` is unavailable.
67
76
  */
68
- interimRequestTime: entry.responseStart - entry.requestStart,
69
77
  requestInvocationTime: entry.firstInterimResponseStart ? entry.firstInterimResponseStart - entry.requestStart : undefined,
78
+ /**
79
+ * `contentDownloadTime` represents the time taken for the browser to receive
80
+ * the resource from the server. This may be cut short if the transport
81
+ * connection is closed.
82
+ */
83
+ contentDownloadTime: entry.responseEnd - entry.responseStart,
84
+ /**
85
+ * The user agent string for the current browser
86
+ * Read more: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
87
+ */
88
+ userAgent: window.navigator.userAgent,
70
89
  /**
71
90
  * Performance resource timing data sent by the server. This includes:
72
91
  *
@@ -106,10 +125,15 @@ var setAnalyticsContext = exports.setAnalyticsContext = function setAnalyticsCon
106
125
  };
107
126
  var startResourceObserver = exports.startResourceObserver = function startResourceObserver() {
108
127
  var _window$MEDIA_CARD_PE2;
109
- if (!((_window$MEDIA_CARD_PE2 = window[MEDIA_CARD_PERF_STATE_KEY]) !== null && _window$MEDIA_CARD_PE2 !== void 0 && _window$MEDIA_CARD_PE2.mediaCardPerfObserver)) {
110
- createAndGetResourceObserver().observe({
111
- type: 'resource',
112
- buffered: true
113
- });
128
+ if ((_window$MEDIA_CARD_PE2 = window[MEDIA_CARD_PERF_STATE_KEY]) !== null && _window$MEDIA_CARD_PE2 !== void 0 && _window$MEDIA_CARD_PE2.mediaCardPerfObserver) {
129
+ return;
114
130
  }
131
+ if (!window[MEDIA_CARD_PERF_STATE_KEY]) {
132
+ window[MEDIA_CARD_PERF_STATE_KEY] = {};
133
+ }
134
+ window[MEDIA_CARD_PERF_STATE_KEY].mediaCardPerfObserver = createAndGetResourceObserver();
135
+ window[MEDIA_CARD_PERF_STATE_KEY].mediaCardPerfObserver.observe({
136
+ type: 'resource',
137
+ buffered: true
138
+ });
115
139
  };
@@ -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 = "78.1.0";
18
+ var packageVersion = "78.1.2";
19
19
  var concurrentExperience;
20
20
  var getExperience = function getExperience(id) {
21
21
  if (!concurrentExperience) {
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
9
9
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
11
  const packageName = "@atlaskit/media-card";
12
- const packageVersion = "78.1.0";
12
+ const packageVersion = "78.1.2";
13
13
  export const CardBase = ({
14
14
  identifier,
15
15
  ...otherProps
@@ -30,12 +30,12 @@ export const CardWithPerformanceObserver = props => {
30
30
  createAnalyticsEvent
31
31
  } = useAnalyticsEvents();
32
32
  useEffect(() => {
33
- if (fg('platform.media-card-performance-observer_lgc7b')) {
33
+ if (fg('platform.media-card-performance-observer_a803k')) {
34
34
  startResourceObserver();
35
35
  }
36
36
  }, []);
37
37
  useEffect(() => {
38
- if (fg('platform.media-card-performance-observer_lgc7b')) {
38
+ if (fg('platform.media-card-performance-observer_a803k')) {
39
39
  setAnalyticsContext(createAnalyticsEvent);
40
40
  }
41
41
  }, [createAnalyticsEvent]);
@@ -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 = "78.1.0";
69
+ const packageVersion = "78.1.2";
70
70
 
71
71
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
72
72
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
37
37
  } = this.state;
38
38
  const analyticsContext = {
39
39
  packageVersion: "@atlaskit/media-card",
40
- packageName: "78.1.0",
40
+ packageName: "78.1.2",
41
41
  componentName: 'mediaInlineCard',
42
42
  component: 'mediaInlineCard'
43
43
  };
@@ -2,10 +2,10 @@ import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common/analytics';
2
2
  const MEDIA_CARD_PERF_STATE_KEY = '__mediaCardPerfState_asflkajsdflja';
3
3
  const urlRegex = /https:\/\/(?:media\.(?:dev|staging|prod)\.atl-paas\.net|api\.media\.atlassian\.com)\/file\/([^/]+)\/image.*[?&]source=mediaCard/;
4
4
  const clientIdParamRegex = /[?&]clientId=([^&]+)/;
5
- const ssrParamRegex = /[?&]ssr=([^&]+)/;
5
+ const ssrParamRegex = /[?&]token=([^&]+)/;
6
6
 
7
7
  /**
8
- * `ExperimentalPerfoamnceResourceTiming` type accounts for the experimental value `firstInterimResponseStart`
8
+ * `ExperimentalPerformanceResourceTiming` type accounts for the experimental value `firstInterimResponseStart`
9
9
  * which is present in Chrome, but not present in FireFox or Safari.
10
10
  * Read more: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/firstInterimResponseStart
11
11
  */
@@ -22,7 +22,8 @@ const createAndGetResourceObserver = () => {
22
22
  var _entry$serverTiming$f, _entry$serverTiming$f2;
23
23
  const fileId = matchFileId[1];
24
24
  const clientId = matchClientId === null || matchClientId === void 0 ? void 0 : matchClientId[1];
25
- const ssr = matchSSR === null || matchSSR === void 0 ? void 0 : matchSSR[1];
25
+ const ssr = matchSSR ? 'server' : undefined;
26
+ const navigationTime = performance.getEntriesByType('navigation')[0];
26
27
  const event = window[MEDIA_CARD_PERF_STATE_KEY].mediaCardCreateAnalyticsEvent({
27
28
  eventType: 'operational',
28
29
  action: 'succeeded',
@@ -31,7 +32,7 @@ const createAndGetResourceObserver = () => {
31
32
  ssr,
32
33
  fileId: fileId,
33
34
  mediaClientId: clientId,
34
- url: entry.name,
35
+ startedAt: entry.startTime - ((navigationTime === null || navigationTime === void 0 ? void 0 : navigationTime.domContentLoadedEventEnd) || 0),
35
36
  /**
36
37
  * Performance resource timing data regarding the loading of an
37
38
  * application's resources as described in
@@ -46,12 +47,20 @@ const createAndGetResourceObserver = () => {
46
47
  tlsConnectNegotiationTime: entry.requestStart - entry.secureConnectionStart,
47
48
  timeTakenToFetchWithoutRedirect: entry.responseEnd - entry.fetchStart,
48
49
  browserCacheHit: entry.transferSize === 0,
50
+ nextHopProtocol: entry.nextHopProtocol,
49
51
  /**
50
52
  * `interimRequestTime` represents the entire time the browser took to
51
53
  * request the resource from the server. This includes the interim response time
52
- * (for example, 100 Continue or 103 Early Hints). Please, note that this value
53
- * is distinctly different from the aforementioned document.
54
+ * (for example, 100 Continue or 103 Early Hints).
55
+ *
56
+ * i.e. It is the time taken for the request to be sent
57
+ * + the waiting time for the server to send a response
54
58
  *
59
+ * Please, note that this value
60
+ * is distinctly different from the aforementioned document.
61
+ */
62
+ interimRequestTime: entry.responseStart - entry.requestStart,
63
+ /**
55
64
  * `requestInvocationTime` represents the actual time the browser took to request
56
65
  * the resource from the server (i.e. it does not include the interim reponse
57
66
  * time).
@@ -59,8 +68,18 @@ const createAndGetResourceObserver = () => {
59
68
  * available in Chrome, but not in FireFox or Safari. This value will be undefined
60
69
  * when `firstInterimResponseStart` is unavailable.
61
70
  */
62
- interimRequestTime: entry.responseStart - entry.requestStart,
63
71
  requestInvocationTime: entry.firstInterimResponseStart ? entry.firstInterimResponseStart - entry.requestStart : undefined,
72
+ /**
73
+ * `contentDownloadTime` represents the time taken for the browser to receive
74
+ * the resource from the server. This may be cut short if the transport
75
+ * connection is closed.
76
+ */
77
+ contentDownloadTime: entry.responseEnd - entry.responseStart,
78
+ /**
79
+ * The user agent string for the current browser
80
+ * Read more: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
81
+ */
82
+ userAgent: window.navigator.userAgent,
64
83
  /**
65
84
  * Performance resource timing data sent by the server. This includes:
66
85
  *
@@ -103,10 +122,15 @@ export const setAnalyticsContext = newAnalyticsContext => {
103
122
  };
104
123
  export const startResourceObserver = () => {
105
124
  var _window$MEDIA_CARD_PE2;
106
- if (!((_window$MEDIA_CARD_PE2 = window[MEDIA_CARD_PERF_STATE_KEY]) !== null && _window$MEDIA_CARD_PE2 !== void 0 && _window$MEDIA_CARD_PE2.mediaCardPerfObserver)) {
107
- createAndGetResourceObserver().observe({
108
- type: 'resource',
109
- buffered: true
110
- });
125
+ if ((_window$MEDIA_CARD_PE2 = window[MEDIA_CARD_PERF_STATE_KEY]) !== null && _window$MEDIA_CARD_PE2 !== void 0 && _window$MEDIA_CARD_PE2.mediaCardPerfObserver) {
126
+ return;
111
127
  }
128
+ if (!window[MEDIA_CARD_PERF_STATE_KEY]) {
129
+ window[MEDIA_CARD_PERF_STATE_KEY] = {};
130
+ }
131
+ window[MEDIA_CARD_PERF_STATE_KEY].mediaCardPerfObserver = createAndGetResourceObserver();
132
+ window[MEDIA_CARD_PERF_STATE_KEY].mediaCardPerfObserver.observe({
133
+ type: 'resource',
134
+ buffered: true
135
+ });
112
136
  };
@@ -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 = "78.1.0";
8
+ const packageVersion = "78.1.2";
9
9
  let concurrentExperience;
10
10
  const getExperience = id => {
11
11
  if (!concurrentExperience) {
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
11
11
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
13
  var packageName = "@atlaskit/media-card";
14
- var packageVersion = "78.1.0";
14
+ var packageVersion = "78.1.2";
15
15
  export var CardBase = function CardBase(_ref) {
16
16
  var identifier = _ref.identifier,
17
17
  otherProps = _objectWithoutProperties(_ref, _excluded);
@@ -30,12 +30,12 @@ export var CardWithPerformanceObserver = function CardWithPerformanceObserver(pr
30
30
  var _useAnalyticsEvents = useAnalyticsEvents(),
31
31
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
32
32
  useEffect(function () {
33
- if (fg('platform.media-card-performance-observer_lgc7b')) {
33
+ if (fg('platform.media-card-performance-observer_a803k')) {
34
34
  startResourceObserver();
35
35
  }
36
36
  }, []);
37
37
  useEffect(function () {
38
- if (fg('platform.media-card-performance-observer_lgc7b')) {
38
+ if (fg('platform.media-card-performance-observer_a803k')) {
39
39
  setAnalyticsContext(createAnalyticsEvent);
40
40
  }
41
41
  }, [createAnalyticsEvent]);
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
83
83
  }(React.Component);
84
84
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
85
85
  var packageName = "@atlaskit/media-card";
86
- var packageVersion = "78.1.0";
86
+ var packageVersion = "78.1.2";
87
87
 
88
88
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
89
89
  var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
103
103
  ErrorBoundary = _this$state.ErrorBoundary;
104
104
  var analyticsContext = {
105
105
  packageVersion: "@atlaskit/media-card",
106
- packageName: "78.1.0",
106
+ packageName: "78.1.2",
107
107
  componentName: 'mediaInlineCard',
108
108
  component: 'mediaInlineCard'
109
109
  };
@@ -2,10 +2,10 @@ import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common/analytics';
2
2
  var MEDIA_CARD_PERF_STATE_KEY = '__mediaCardPerfState_asflkajsdflja';
3
3
  var urlRegex = /https:\/\/(?:media\.(?:dev|staging|prod)\.atl-paas\.net|api\.media\.atlassian\.com)\/file\/([^/]+)\/image.*[?&]source=mediaCard/;
4
4
  var clientIdParamRegex = /[?&]clientId=([^&]+)/;
5
- var ssrParamRegex = /[?&]ssr=([^&]+)/;
5
+ var ssrParamRegex = /[?&]token=([^&]+)/;
6
6
 
7
7
  /**
8
- * `ExperimentalPerfoamnceResourceTiming` type accounts for the experimental value `firstInterimResponseStart`
8
+ * `ExperimentalPerformanceResourceTiming` type accounts for the experimental value `firstInterimResponseStart`
9
9
  * which is present in Chrome, but not present in FireFox or Safari.
10
10
  * Read more: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/firstInterimResponseStart
11
11
  */
@@ -22,7 +22,8 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
22
22
  var _entry$serverTiming$f, _entry$serverTiming$f2;
23
23
  var fileId = matchFileId[1];
24
24
  var clientId = matchClientId === null || matchClientId === void 0 ? void 0 : matchClientId[1];
25
- var ssr = matchSSR === null || matchSSR === void 0 ? void 0 : matchSSR[1];
25
+ var ssr = matchSSR ? 'server' : undefined;
26
+ var navigationTime = performance.getEntriesByType('navigation')[0];
26
27
  var event = window[MEDIA_CARD_PERF_STATE_KEY].mediaCardCreateAnalyticsEvent({
27
28
  eventType: 'operational',
28
29
  action: 'succeeded',
@@ -31,7 +32,7 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
31
32
  ssr: ssr,
32
33
  fileId: fileId,
33
34
  mediaClientId: clientId,
34
- url: entry.name,
35
+ startedAt: entry.startTime - ((navigationTime === null || navigationTime === void 0 ? void 0 : navigationTime.domContentLoadedEventEnd) || 0),
35
36
  /**
36
37
  * Performance resource timing data regarding the loading of an
37
38
  * application's resources as described in
@@ -46,12 +47,20 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
46
47
  tlsConnectNegotiationTime: entry.requestStart - entry.secureConnectionStart,
47
48
  timeTakenToFetchWithoutRedirect: entry.responseEnd - entry.fetchStart,
48
49
  browserCacheHit: entry.transferSize === 0,
50
+ nextHopProtocol: entry.nextHopProtocol,
49
51
  /**
50
52
  * `interimRequestTime` represents the entire time the browser took to
51
53
  * request the resource from the server. This includes the interim response time
52
- * (for example, 100 Continue or 103 Early Hints). Please, note that this value
53
- * is distinctly different from the aforementioned document.
54
+ * (for example, 100 Continue or 103 Early Hints).
55
+ *
56
+ * i.e. It is the time taken for the request to be sent
57
+ * + the waiting time for the server to send a response
54
58
  *
59
+ * Please, note that this value
60
+ * is distinctly different from the aforementioned document.
61
+ */
62
+ interimRequestTime: entry.responseStart - entry.requestStart,
63
+ /**
55
64
  * `requestInvocationTime` represents the actual time the browser took to request
56
65
  * the resource from the server (i.e. it does not include the interim reponse
57
66
  * time).
@@ -59,8 +68,18 @@ var createAndGetResourceObserver = function createAndGetResourceObserver() {
59
68
  * available in Chrome, but not in FireFox or Safari. This value will be undefined
60
69
  * when `firstInterimResponseStart` is unavailable.
61
70
  */
62
- interimRequestTime: entry.responseStart - entry.requestStart,
63
71
  requestInvocationTime: entry.firstInterimResponseStart ? entry.firstInterimResponseStart - entry.requestStart : undefined,
72
+ /**
73
+ * `contentDownloadTime` represents the time taken for the browser to receive
74
+ * the resource from the server. This may be cut short if the transport
75
+ * connection is closed.
76
+ */
77
+ contentDownloadTime: entry.responseEnd - entry.responseStart,
78
+ /**
79
+ * The user agent string for the current browser
80
+ * Read more: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
81
+ */
82
+ userAgent: window.navigator.userAgent,
64
83
  /**
65
84
  * Performance resource timing data sent by the server. This includes:
66
85
  *
@@ -100,10 +119,15 @@ export var setAnalyticsContext = function setAnalyticsContext(newAnalyticsContex
100
119
  };
101
120
  export var startResourceObserver = function startResourceObserver() {
102
121
  var _window$MEDIA_CARD_PE2;
103
- if (!((_window$MEDIA_CARD_PE2 = window[MEDIA_CARD_PERF_STATE_KEY]) !== null && _window$MEDIA_CARD_PE2 !== void 0 && _window$MEDIA_CARD_PE2.mediaCardPerfObserver)) {
104
- createAndGetResourceObserver().observe({
105
- type: 'resource',
106
- buffered: true
107
- });
122
+ if ((_window$MEDIA_CARD_PE2 = window[MEDIA_CARD_PERF_STATE_KEY]) !== null && _window$MEDIA_CARD_PE2 !== void 0 && _window$MEDIA_CARD_PE2.mediaCardPerfObserver) {
123
+ return;
108
124
  }
125
+ if (!window[MEDIA_CARD_PERF_STATE_KEY]) {
126
+ window[MEDIA_CARD_PERF_STATE_KEY] = {};
127
+ }
128
+ window[MEDIA_CARD_PERF_STATE_KEY].mediaCardPerfObserver = createAndGetResourceObserver();
129
+ window[MEDIA_CARD_PERF_STATE_KEY].mediaCardPerfObserver.observe({
130
+ type: 'resource',
131
+ buffered: true
132
+ });
109
133
  };
@@ -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 = "78.1.0";
11
+ var packageVersion = "78.1.2";
12
12
  var concurrentExperience;
13
13
  var getExperience = function getExperience(id) {
14
14
  if (!concurrentExperience) {
@@ -16,10 +16,9 @@ type WithCardPreviewCacheAttributes = {
16
16
  cardPreviewAttributes: CardPreviewAttributes;
17
17
  };
18
18
  type WithCardPerfAttributes = {
19
- ssr: SSR;
19
+ ssr?: SSR;
20
20
  fileId: string;
21
21
  mediaClientId?: string;
22
- url: string;
23
22
  transferSize: number;
24
23
  decodedBodySize: number;
25
24
  totalDuration: number;
@@ -29,8 +28,11 @@ type WithCardPerfAttributes = {
29
28
  tlsConnectNegotiationTime: number;
30
29
  timeTakenToFetchWithoutRedirect: number;
31
30
  browserCacheHit: boolean;
31
+ nextHopProtocol: string;
32
32
  interimRequestTime: number;
33
33
  requestInvocationTime?: number;
34
+ contentDownloadTime: number;
35
+ userAgent: string;
34
36
  cdnCacheHit: boolean;
35
37
  cdnDownstreamFBL?: number;
36
38
  cdnUpstreamFBL?: number;
@@ -16,10 +16,9 @@ type WithCardPreviewCacheAttributes = {
16
16
  cardPreviewAttributes: CardPreviewAttributes;
17
17
  };
18
18
  type WithCardPerfAttributes = {
19
- ssr: SSR;
19
+ ssr?: SSR;
20
20
  fileId: string;
21
21
  mediaClientId?: string;
22
- url: string;
23
22
  transferSize: number;
24
23
  decodedBodySize: number;
25
24
  totalDuration: number;
@@ -29,8 +28,11 @@ type WithCardPerfAttributes = {
29
28
  tlsConnectNegotiationTime: number;
30
29
  timeTakenToFetchWithoutRedirect: number;
31
30
  browserCacheHit: boolean;
31
+ nextHopProtocol: string;
32
32
  interimRequestTime: number;
33
33
  requestInvocationTime?: number;
34
+ contentDownloadTime: number;
35
+ userAgent: string;
34
36
  cdnCacheHit: boolean;
35
37
  cdnDownstreamFBL?: number;
36
38
  cdnUpstreamFBL?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "78.1.0",
3
+ "version": "78.1.2",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,8 +39,8 @@
39
39
  "@atlaskit/analytics-next": "^10.1.0",
40
40
  "@atlaskit/dropdown-menu": "^12.17.0",
41
41
  "@atlaskit/editor-shared-styles": "^2.13.0",
42
- "@atlaskit/icon": "^22.13.0",
43
- "@atlaskit/media-client": "^27.4.0",
42
+ "@atlaskit/icon": "^22.14.0",
43
+ "@atlaskit/media-client": "^27.5.0",
44
44
  "@atlaskit/media-client-react": "^2.1.0",
45
45
  "@atlaskit/media-common": "^11.4.0",
46
46
  "@atlaskit/media-file-preview": "^0.8.0",
@@ -78,8 +78,8 @@
78
78
  "@atlaskit/media-core": "^34.3.0",
79
79
  "@atlaskit/media-picker": "^66.5.0",
80
80
  "@atlaskit/media-state": "^1.1.0",
81
- "@atlaskit/media-test-data": "^2.5.0",
82
- "@atlaskit/media-test-helpers": "^34.0.0",
81
+ "@atlaskit/media-test-data": "^2.6.0",
82
+ "@atlaskit/media-test-helpers": "^34.1.0",
83
83
  "@atlaskit/radio": "^6.5.0",
84
84
  "@atlaskit/range": "^7.4.0",
85
85
  "@atlaskit/ssr": "*",
@@ -109,7 +109,7 @@
109
109
  "platform.media-card-svg-rendering_6tdbv": {
110
110
  "type": "boolean"
111
111
  },
112
- "platform.media-card-performance-observer_lgc7b": {
112
+ "platform.media-card-performance-observer_a803k": {
113
113
  "type": "boolean"
114
114
  }
115
115
  },