@atlaskit/smart-card 46.13.13 → 46.13.15

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 (58) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cjs/__tests__/vr-tests/__snapshots__/block-card/block-card-google-doc-with-summarize-rovo-action--default.png +3 -0
  3. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +2 -2
  4. package/dist/cjs/ssr.js +6 -2
  5. package/dist/cjs/state/analytics/startUfoExperience.js +7 -2
  6. package/dist/cjs/utils/analytics/analytics.js +1 -1
  7. package/dist/cjs/view/CardWithUrl/card-error-boundary/index.js +104 -3
  8. package/dist/cjs/view/CardWithUrl/card-intersection-observer/index.js +87 -1
  9. package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +37 -7
  10. package/dist/cjs/view/CardWithUrl/loader.js +1 -1
  11. package/dist/cjs/view/EmbedCard/components/rovo-actions-footer/index.js +4 -1
  12. package/dist/cjs/view/FlexibleCard/components/actions/action/action-dropdown-item/index.js +2 -2
  13. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +2 -2
  14. package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +2 -2
  15. package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-error/index.js +3 -3
  16. package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-item/index.js +2 -2
  17. package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-items-group/index.js +2 -2
  18. package/dist/cjs/view/LinkUrl/index.js +1 -1
  19. package/dist/cjs/view/common/rovo-chat-utils/index.js +5 -1
  20. package/dist/es2019/__tests__/vr-tests/__snapshots__/block-card/block-card-google-doc-with-summarize-rovo-action--default.png +3 -0
  21. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +2 -2
  22. package/dist/es2019/ssr.js +6 -2
  23. package/dist/es2019/state/analytics/startUfoExperience.js +7 -2
  24. package/dist/es2019/utils/analytics/analytics.js +1 -1
  25. package/dist/es2019/view/CardWithUrl/card-error-boundary/index.js +105 -2
  26. package/dist/es2019/view/CardWithUrl/card-intersection-observer/index.js +88 -2
  27. package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +37 -7
  28. package/dist/es2019/view/CardWithUrl/loader.js +1 -1
  29. package/dist/es2019/view/EmbedCard/components/rovo-actions-footer/index.js +4 -1
  30. package/dist/es2019/view/FlexibleCard/components/actions/action/action-dropdown-item/index.js +1 -1
  31. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -1
  32. package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +1 -1
  33. package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-error/index.js +2 -2
  34. package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-item/index.js +1 -1
  35. package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-items-group/index.js +1 -1
  36. package/dist/es2019/view/LinkUrl/index.js +1 -1
  37. package/dist/es2019/view/common/rovo-chat-utils/index.js +5 -1
  38. package/dist/esm/__tests__/vr-tests/__snapshots__/block-card/block-card-google-doc-with-summarize-rovo-action--default.png +3 -0
  39. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +2 -2
  40. package/dist/esm/ssr.js +6 -2
  41. package/dist/esm/state/analytics/startUfoExperience.js +7 -2
  42. package/dist/esm/utils/analytics/analytics.js +1 -1
  43. package/dist/esm/view/CardWithUrl/card-error-boundary/index.js +102 -3
  44. package/dist/esm/view/CardWithUrl/card-intersection-observer/index.js +88 -2
  45. package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +38 -7
  46. package/dist/esm/view/CardWithUrl/loader.js +1 -1
  47. package/dist/esm/view/EmbedCard/components/rovo-actions-footer/index.js +4 -1
  48. package/dist/esm/view/FlexibleCard/components/actions/action/action-dropdown-item/index.js +1 -1
  49. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -1
  50. package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/index.js +1 -1
  51. package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-error/index.js +2 -2
  52. package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-item/index.js +1 -1
  53. package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-items-group/index.js +1 -1
  54. package/dist/esm/view/LinkUrl/index.js +1 -1
  55. package/dist/esm/view/common/rovo-chat-utils/index.js +5 -1
  56. package/dist/types/state/analytics/startUfoExperience.d.ts +6 -1
  57. package/dist/types/view/CardWithUrl/card-error-boundary/index.d.ts +4 -1
  58. package/package.json +4 -4
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React, { useState } from 'react';
2
3
 
3
4
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
@@ -20,7 +21,8 @@ export const CardSSR = props => {
20
21
  // FlexibleCards always need full ORS data regardless of appearance prop,
21
22
  // because they render custom blocks (TitleBlock etc.) requiring a complete response.
22
23
  // Override appearance to 'block' for FlexibleCards when FG is enabled.
23
- const effectiveAppearance = isFlexibleUiCard(props.children, props.ui) && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
24
+ const isFlexibleCard = isFlexibleUiCard(props.children, props.ui);
25
+ const effectiveAppearance = isFlexibleCard && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
24
26
  const propsWithId = {
25
27
  ...props,
26
28
  id,
@@ -28,5 +30,7 @@ export const CardSSR = props => {
28
30
  };
29
31
  return /*#__PURE__*/React.createElement(AnalyticsContext, {
30
32
  data: context
31
- }, /*#__PURE__*/React.createElement(CardErrorBoundary, propsWithId, /*#__PURE__*/React.createElement(CardWithUrl, propsWithId)));
33
+ }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({}, propsWithId, {
34
+ isFlexibleCard: isFlexibleCard
35
+ }), /*#__PURE__*/React.createElement(CardWithUrl, propsWithId)));
32
36
  };
@@ -1,7 +1,12 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
1
2
  import { ufoExperiences } from './ufoExperiences';
2
- export const startUfoExperience = (experienceName, id, properties) => {
3
+ export const startUfoExperience = (experienceName, id, properties, startTime) => {
3
4
  const experience = ufoExperiences[experienceName].getInstance(id);
4
- experience.start();
5
+ if (fg('platform_smartlink_cardssr_missing_events')) {
6
+ experience.start(startTime);
7
+ } else {
8
+ experience.start();
9
+ }
5
10
  if (properties) {
6
11
  experience.addMetadata(properties);
7
12
  }
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "46.13.12" || ''
7
+ packageVersion: "46.13.14" || ''
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,7 +1,15 @@
1
- import React from 'react';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback } from 'react';
2
3
  import { ErrorBoundary } from 'react-error-boundary';
4
+ import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
5
+ import { getUrl } from '@atlaskit/linking-common/store';
6
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
7
+ import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
8
+ import { failUfoExperience } from '../../../state/analytics/failUfoExperience';
9
+ import { startUfoExperience } from '../../../state/analytics/startUfoExperience';
10
+ import { getSmartLinkAnalyticsContext } from '../../../utils/analytics/getSmartLinkAnalyticsContext';
3
11
  import { LoadingCardLink } from '../component-lazy/LoadingCardLink';
4
- const CardErrorBoundary = ({
12
+ const CardErrorBoundaryOld = ({
5
13
  children,
6
14
  ...props
7
15
  }) => {
@@ -17,4 +25,99 @@ const CardErrorBoundary = ({
17
25
  FallbackComponent: errorBoundaryFallbackComponent
18
26
  }, children);
19
27
  };
28
+ const CardErrorBoundaryNew = ({
29
+ children,
30
+ isFlexibleCard = false,
31
+ ...props
32
+ }) => {
33
+ const {
34
+ appearance,
35
+ id,
36
+ onError,
37
+ url
38
+ } = props;
39
+ const ErrorFallbackComponent = props.fallbackComponent;
40
+ const {
41
+ fireEvent
42
+ } = useAnalyticsEvents();
43
+ const {
44
+ value: smartCardContext
45
+ } = useSmartCardContext();
46
+ const store = smartCardContext === null || smartCardContext === void 0 ? void 0 : smartCardContext.store;
47
+ const display = isFlexibleCard ? 'flexible' : appearance;
48
+
49
+ // Parity with CardWithURLRenderer error handler
50
+ const errorHandler = useCallback((error, info) => {
51
+ const {
52
+ componentStack
53
+ } = info;
54
+ const errorInfo = {
55
+ componentStack
56
+ };
57
+ // Read the link state when the error happens: useSmartCardContext does not subscribe
58
+ // to store updates, so a value captured during render can be stale by now.
59
+ const state = store ? getUrl(store, url) : undefined;
60
+ const analyticsContext = getSmartLinkAnalyticsContext({
61
+ display,
62
+ id,
63
+ response: state === null || state === void 0 ? void 0 : state.details,
64
+ status: state === null || state === void 0 ? void 0 : state.status,
65
+ url,
66
+ error: state === null || state === void 0 ? void 0 : state.error
67
+ });
68
+ // NB: APIErrors are thrown in response to Object Resolver Service. We do not
69
+ // fire an event for these, as they do not cover failed UI render events.
70
+ // The rest of the errors caught here are unexpected, and correlate
71
+ // to the reliability of the smart-card front-end components.
72
+ // Likewise, chunk loading errors are not caused by a failure of smart-card rendering.
73
+ if (error.name === 'ChunkLoadError') {
74
+ fireEvent('operational.smartLink.chunkLoadFailed', {
75
+ ...(analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes),
76
+ display,
77
+ error: error,
78
+ errorInfo: errorInfo,
79
+ definitionId: null
80
+ });
81
+ } else if (error.name !== 'APIError') {
82
+ startUfoExperience('smart-link-rendered', id, {
83
+ ssr: true
84
+ });
85
+ failUfoExperience('smart-link-rendered', id);
86
+ failUfoExperience('smart-link-authenticated', id);
87
+ fireEvent('ui.smartLink.renderFailed', {
88
+ ...(analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes),
89
+ display,
90
+ id,
91
+ error: error,
92
+ errorInfo: errorInfo
93
+ });
94
+ }
95
+ onError && onError({
96
+ status: 'errored',
97
+ url,
98
+ err: error
99
+ });
100
+ }, [display, fireEvent, id, onError, store, url]);
101
+ const errorBoundaryFallbackComponent = () => {
102
+ if (ErrorFallbackComponent) {
103
+ return /*#__PURE__*/React.createElement(ErrorFallbackComponent, null);
104
+ }
105
+ return /*#__PURE__*/React.createElement(LoadingCardLink, props);
106
+ };
107
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
108
+ FallbackComponent: errorBoundaryFallbackComponent,
109
+ onError: errorHandler
110
+ }, children);
111
+ };
112
+ const CardErrorBoundary = ({
113
+ isFlexibleCard,
114
+ ...props
115
+ }) => {
116
+ if (fg('platform_smartlink_cardssr_missing_events')) {
117
+ return /*#__PURE__*/React.createElement(CardErrorBoundaryNew, _extends({}, props, {
118
+ isFlexibleCard: isFlexibleCard
119
+ }));
120
+ }
121
+ return /*#__PURE__*/React.createElement(CardErrorBoundaryOld, props);
122
+ };
20
123
  export default CardErrorBoundary;
@@ -1,9 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback } from 'react';
2
+ import React, { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
3
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
4
+ import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
5
+ import { startUfoExperience } from '../../../state/analytics/startUfoExperience';
3
6
  import useIntersectionObserver from '../../../state/hooks/use-intersection-observer';
4
7
  import { useSmartLinkSeenEvent } from '../../../state/hooks/use-smart-link-seen-event';
8
+ import { clearMarks } from '../../../utils/clear-marks';
9
+ import { clearMeasures } from '../../../utils/clear-measures';
10
+ import { shouldSample } from '../../../utils/shouldSample';
5
11
  import CardLoaderWrapper from '../card-loader-wrapper';
6
- const withCardIntersectionObserver = Component => props => {
12
+ const withCardIntersectionObserverOld = Component => props => {
7
13
  // TODO: NAVX-4682: Add feature parity to LazyIntersectionObserverCard for no lazy loading
8
14
  const {
9
15
  appearance,
@@ -39,4 +45,84 @@ const withCardIntersectionObserver = Component => props => {
39
45
  onError: onError
40
46
  })));
41
47
  };
48
+ const withCardIntersectionObserverNew = Component => props => {
49
+ const {
50
+ appearance,
51
+ children,
52
+ id,
53
+ onError: onErrorCallback,
54
+ ui,
55
+ url = ''
56
+ } = props;
57
+ const hasStartedRenderedExperience = useRef(false);
58
+
59
+ // Unlike LazyIntersectionObserverCard, the content is rendered immediately
60
+ // (server rendered) and may reach its final state before intersecting, so the
61
+ // (sampled) rendered experience is started on mount instead of on intersection.
62
+ // Layout effects run before the content's passive effects (where the experience
63
+ // succeeds) and do not run on the server. The ref guards against StrictMode remounts.
64
+ // The start time is backdated to the active UFO interaction (page load / SPA transition)
65
+ // start, so the duration covers the time the card took to render since the interaction began.
66
+ useLayoutEffect(() => {
67
+ if (hasStartedRenderedExperience.current) {
68
+ return;
69
+ }
70
+ hasStartedRenderedExperience.current = true;
71
+ if (shouldSample()) {
72
+ var _getActiveInteraction;
73
+ const interactionStartTime = (_getActiveInteraction = getActiveInteraction()) === null || _getActiveInteraction === void 0 ? void 0 : _getActiveInteraction.start;
74
+ startUfoExperience('smart-link-rendered', id || 'NULL', {
75
+ ssr: true,
76
+ timingStrategy: interactionStartTime !== undefined ? 'interaction-start' : 'render'
77
+ }, interactionStartTime);
78
+ }
79
+ // Only start once on mount
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ }, []);
82
+ useEffect(() => {
83
+ if (!id) {
84
+ return;
85
+ }
86
+ // ComponentWillUnmount
87
+ return () => {
88
+ clearMarks(id);
89
+ clearMeasures(id);
90
+ };
91
+ }, [id]);
92
+ const {
93
+ onIntersecting,
94
+ onStatusSettled
95
+ } = useSmartLinkSeenEvent({
96
+ appearance,
97
+ children,
98
+ id,
99
+ ui,
100
+ url
101
+ });
102
+ const onError = useCallback(data => {
103
+ if (data !== null && data !== void 0 && data.status) {
104
+ onStatusSettled(data.status);
105
+ }
106
+ onErrorCallback === null || onErrorCallback === void 0 ? void 0 : onErrorCallback(data);
107
+ }, [onStatusSettled, onErrorCallback]);
108
+ const ref = useIntersectionObserver({
109
+ onIntersecting
110
+ });
111
+ return /*#__PURE__*/React.createElement(CardLoaderWrapper, {
112
+ appearance: props.appearance,
113
+ ref: ref
114
+ }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
115
+ onError: onError
116
+ })));
117
+ };
118
+ const withCardIntersectionObserver = Component => {
119
+ const WithCardIntersectionObserverOld = withCardIntersectionObserverOld(Component);
120
+ const WithCardIntersectionObserverNew = withCardIntersectionObserverNew(Component);
121
+ return props => {
122
+ if (fg('platform_smartlink_cardssr_missing_events')) {
123
+ return /*#__PURE__*/React.createElement(WithCardIntersectionObserverNew, props);
124
+ }
125
+ return /*#__PURE__*/React.createElement(WithCardIntersectionObserverOld, props);
126
+ };
127
+ };
42
128
  export default withCardIntersectionObserver;
@@ -1,5 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useState } from 'react';
3
+ import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
4
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
5
  import { startUfoExperience } from '../../../state/analytics/startUfoExperience';
4
6
  import useIntersectionObserver from '../../../state/hooks/use-intersection-observer';
5
7
  import { useSmartLinkSeenEvent } from '../../../state/hooks/use-smart-link-seen-event';
@@ -8,6 +10,9 @@ import { shouldSample } from '../../../utils/shouldSample';
8
10
  import CardLoaderWrapper from '../card-loader-wrapper';
9
11
  import { CardWithUrlContent } from '../component';
10
12
  import { LoadingCardLink } from './LoadingCardLink';
13
+
14
+ /** Statuses that came from a resolver response, so the card can show them again without loading. */
15
+ const SETTLED_STATUSES = new Set(['resolved', 'unauthorized', 'forbidden', 'not_found']);
11
16
  export const LazyIntersectionObserverCard = props => {
12
17
  const [isIntersected, setIsIntersected] = useState(false);
13
18
  const [shouldSendRenderedUFOEvent] = useState(shouldSample());
@@ -19,6 +24,20 @@ export const LazyIntersectionObserverCard = props => {
19
24
  ui,
20
25
  url
21
26
  } = props;
27
+ const {
28
+ store
29
+ } = useSmartLinkContext();
30
+ // A link the store has already settled (e.g. a remounted card) renders at once, not as the
31
+ // loading placeholder, so its rendered experience starts before the card can succeed it.
32
+ const [isSettledOnMount] = useState(() => {
33
+ var _store$getState$url;
34
+ const status = store === null || store === void 0 ? void 0 : (_store$getState$url = store.getState()[url]) === null || _store$getState$url === void 0 ? void 0 : _store$getState$url.status;
35
+ const settled = !!status && SETTLED_STATUSES.has(status) && fg('platform_smartlink_render_settled_link_on_mount');
36
+ if (settled && shouldSendRenderedUFOEvent) {
37
+ startUfoExperience('smart-link-rendered', id);
38
+ }
39
+ return settled;
40
+ });
22
41
  const prefetch = usePrefetch(url, appearance);
23
42
  const ComponentObserver = appearance === 'inline' ? 'span' : 'div';
24
43
  const {
@@ -39,7 +58,7 @@ export const LazyIntersectionObserverCard = props => {
39
58
  }, [onStatusSettled, onErrorCallback]);
40
59
  const onIntersection = useCallback(isIntersecting => {
41
60
  if (isIntersecting) {
42
- if (shouldSendRenderedUFOEvent) {
61
+ if (shouldSendRenderedUFOEvent && !isSettledOnMount) {
43
62
  startUfoExperience('smart-link-rendered', id);
44
63
  }
45
64
  onSeenIntersecting();
@@ -47,15 +66,26 @@ export const LazyIntersectionObserverCard = props => {
47
66
  } else {
48
67
  prefetch();
49
68
  }
50
- }, [id, onSeenIntersecting, prefetch, shouldSendRenderedUFOEvent]);
69
+ }, [id, isSettledOnMount, onSeenIntersecting, prefetch, shouldSendRenderedUFOEvent]);
51
70
  const ref = useIntersectionObserver({
52
71
  onIntersection
53
72
  });
54
- const content = isIntersected ? /*#__PURE__*/React.createElement(CardWithUrlContent, _extends({}, props, {
55
- onError: onError
56
- })) : /*#__PURE__*/React.createElement(ComponentObserver, {
57
- ref: ref
58
- }, /*#__PURE__*/React.createElement(LoadingCardLink, props));
73
+ let content;
74
+ if (isSettledOnMount) {
75
+ content = /*#__PURE__*/React.createElement(ComponentObserver, {
76
+ ref: ref
77
+ }, /*#__PURE__*/React.createElement(CardWithUrlContent, _extends({}, props, {
78
+ onError: onError
79
+ })));
80
+ } else if (isIntersected) {
81
+ content = /*#__PURE__*/React.createElement(CardWithUrlContent, _extends({}, props, {
82
+ onError: onError
83
+ }));
84
+ } else {
85
+ content = /*#__PURE__*/React.createElement(ComponentObserver, {
86
+ ref: ref
87
+ }, /*#__PURE__*/React.createElement(LoadingCardLink, props));
88
+ }
59
89
  return /*#__PURE__*/React.createElement(CardLoaderWrapper, {
60
90
  appearance: appearance
61
91
  }, content);
@@ -77,7 +77,7 @@ export function CardWithURLRenderer(props) {
77
77
  if (error.name === 'ChunkLoadError') {
78
78
  fireEvent('operational.smartLink.chunkLoadFailed', {
79
79
  ...(analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes),
80
- display: appearance,
80
+ display: fg('platform_smartlink_cardssr_missing_events') ? isFlexibleUi ? 'flexible' : appearance : appearance,
81
81
  error: error,
82
82
  errorInfo: errorInfo,
83
83
  definitionId: null
@@ -4,6 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useMemo, useState } from 'react';
5
5
  import { useIntl } from 'react-intl';
6
6
  import Button from '@atlaskit/button/default/button';
7
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
7
8
  import { WidthObserver } from '@atlaskit/width-detector/width-observer';
8
9
  import useInvokeClientAction from '../../../../state/hooks/use-invoke-client-action';
9
10
  import useRovoChat from '../../../../state/hooks/use-rovo-chat';
@@ -76,7 +77,9 @@ const EmbedRovoActionsFooter = ({
76
77
  const isPrimaryAction = actions.length === 0;
77
78
  // The primary action normally uses the branded AI icon. Visualize keeps its own
78
79
  // chart icon so the action stays recognisable, including in the icon-only view.
79
- const shouldUseBrandedIcon = isPrimaryAction && promptKey !== RovoChatPromptKey.VISUALIZE;
80
+ // With platform_sl_rovo_summarize_icon_consistency on, every action keeps its own
81
+ // prompt icon so Summarize matches the inline and block cards.
82
+ const shouldUseBrandedIcon = fg('platform_sl_rovo_summarize_icon_consistency') ? false : isPrimaryAction && promptKey !== RovoChatPromptKey.VISUALIZE;
80
83
  actions.push( /*#__PURE__*/React.createElement(RovoPromptButton, {
81
84
  hideContent: isPrimaryAction && shouldHidePrimaryActionContent,
82
85
  icon: shouldUseBrandedIcon ? /*#__PURE__*/React.createElement(AIEditIcon, null) : promptAction.icon,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import DropdownItem from '@atlaskit/dropdown-menu/dropdown-menu-item';
2
+ import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
3
3
  import { fg } from '@atlaskit/platform-feature-flags/fg';
4
4
  import { handleOnClick } from '../../../../../../utils/handle-on-click';
5
5
  const ActionDropdownItem = ({
@@ -10,7 +10,7 @@ import { FormattedMessage } from 'react-intl';
10
10
  import { di } from 'react-magnetic-di';
11
11
  import ButtonGroup from '@atlaskit/button/button-group';
12
12
  import IconButton from '@atlaskit/button/icon/button';
13
- import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
13
+ import { DropdownMenu } from '@atlaskit/dropdown-menu/dropdown-menu';
14
14
  import MoreIcon from '@atlaskit/icon/core/show-more-horizontal';
15
15
  import Tooltip from '@atlaskit/tooltip/Tooltip';
16
16
  import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants';
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
- import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
3
+ import { DropdownMenu } from '@atlaskit/dropdown-menu/dropdown-menu';
4
4
  import { fg } from '@atlaskit/platform-feature-flags/fg';
5
5
  import { useAnalyticsEvents } from '../../../../../../../common/analytics/generated/use-analytics-events';
6
6
  import extractLozengeActionItems from '../../../../../../../extractors/action/extract-lozenge-action-items';
@@ -4,8 +4,8 @@ import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { Fragment, useCallback, useMemo } from 'react';
6
6
  import { FormattedMessage } from 'react-intl';
7
- import DropdownItem from '@atlaskit/dropdown-menu/dropdown-menu-item';
8
- import DropdownItemGroup from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
7
+ import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
8
+ import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
9
9
  import ErrorIcon from '@atlaskit/icon/core/status-error';
10
10
  import { fg } from '@atlaskit/platform-feature-flags/fg';
11
11
  import { Pressable } from '@atlaskit/primitives/compiled/pressable';
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback } from 'react';
2
- import DropdownItem from '@atlaskit/dropdown-menu/dropdown-menu-item';
2
+ import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
3
3
  import Lozenge from '@atlaskit/lozenge/new/lozenge';
4
4
  const LozengeActionItem = ({
5
5
  appearance,
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
- import DropdownItemGroup from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
6
+ import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
7
7
  import LozengeActionItem from '../lozenge-action-item';
8
8
  const dropdownItemGroupStyles = null;
9
9
  const LozengeActionItemsGroup = ({
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
9
9
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
10
10
  const PACKAGE_DATA = {
11
11
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "46.13.12",
12
+ packageVersion: "46.13.14",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -5,6 +5,7 @@ import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-
5
5
  import ChartBarIcon from '@atlaskit/icon/core/chart-bar';
6
6
  import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
7
7
  import { RovoIcon } from '@atlaskit/logo/rovo/icon';
8
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
8
9
  import { CardDisplay } from '../../../constants';
9
10
  import { messages } from '../../../messages';
10
11
  import AiChapterIcon from '../../FlexibleCard/assets/ai-chapter-icon';
@@ -68,7 +69,10 @@ export const getPromptAction = ({
68
69
  ignoreTag: true
69
70
  });
70
71
  return {
71
- icon: /*#__PURE__*/React.createElement(AiChatIcon, {
72
+ icon: fg('platform_sl_rovo_summarize_icon_consistency') ? /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
73
+ label: label_summarize,
74
+ size: iconSize
75
+ }) : /*#__PURE__*/React.createElement(AiChatIcon, {
72
76
  label: label_summarize,
73
77
  size: iconSize
74
78
  }),
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb9ea8a1d01ec2b7aa0ced2e95a1691d937c78642483d0444f4f41b5556a16df
3
+ size 24300
@@ -1,3 +1,3 @@
1
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e44a8ee067885c9fc04085d8c35330ba8b2b2fc945fdf9a2e838c20b5d9b7697
3
- size 13107
2
+ oid sha256:8a43037a6feea0b2ca9f74c948e69c7895135414e55ace1732961acb1ac7e878
3
+ size 12727
package/dist/esm/ssr.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  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; }
@@ -26,12 +27,15 @@ export var CardSSR = function CardSSR(props) {
26
27
  // FlexibleCards always need full ORS data regardless of appearance prop,
27
28
  // because they render custom blocks (TitleBlock etc.) requiring a complete response.
28
29
  // Override appearance to 'block' for FlexibleCards when FG is enabled.
29
- var effectiveAppearance = isFlexibleUiCard(props.children, props.ui) && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
30
+ var isFlexibleCard = isFlexibleUiCard(props.children, props.ui);
31
+ var effectiveAppearance = isFlexibleCard && fg('platform_smartlink_inline_resolve_optimization') ? 'block' : props.appearance;
30
32
  var propsWithId = _objectSpread(_objectSpread({}, props), {}, {
31
33
  id: id,
32
34
  appearance: effectiveAppearance
33
35
  });
34
36
  return /*#__PURE__*/React.createElement(AnalyticsContext, {
35
37
  data: context
36
- }, /*#__PURE__*/React.createElement(CardErrorBoundary, propsWithId, /*#__PURE__*/React.createElement(CardWithUrl, propsWithId)));
38
+ }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({}, propsWithId, {
39
+ isFlexibleCard: isFlexibleCard
40
+ }), /*#__PURE__*/React.createElement(CardWithUrl, propsWithId)));
37
41
  };
@@ -1,7 +1,12 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
1
2
  import { ufoExperiences } from './ufoExperiences';
2
- export var startUfoExperience = function startUfoExperience(experienceName, id, properties) {
3
+ export var startUfoExperience = function startUfoExperience(experienceName, id, properties, startTime) {
3
4
  var experience = ufoExperiences[experienceName].getInstance(id);
4
- experience.start();
5
+ if (fg('platform_smartlink_cardssr_missing_events')) {
6
+ experience.start(startTime);
7
+ } else {
8
+ experience.start();
9
+ }
5
10
  if (properties) {
6
11
  experience.addMetadata(properties);
7
12
  }
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "46.13.12" || ''
7
+ packageVersion: "46.13.14" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,9 +1,22 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- var _excluded = ["children"];
3
- import React from 'react';
4
+ var _excluded = ["children"],
5
+ _excluded2 = ["children", "isFlexibleCard"],
6
+ _excluded3 = ["isFlexibleCard"];
7
+ 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; }
8
+ 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) { _defineProperty(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; }
9
+ import React, { useCallback } from 'react';
4
10
  import { ErrorBoundary } from 'react-error-boundary';
11
+ import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
12
+ import { getUrl } from '@atlaskit/linking-common/store';
13
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
14
+ import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
15
+ import { failUfoExperience } from '../../../state/analytics/failUfoExperience';
16
+ import { startUfoExperience } from '../../../state/analytics/startUfoExperience';
17
+ import { getSmartLinkAnalyticsContext } from '../../../utils/analytics/getSmartLinkAnalyticsContext';
5
18
  import { LoadingCardLink } from '../component-lazy/LoadingCardLink';
6
- var CardErrorBoundary = function CardErrorBoundary(_ref) {
19
+ var CardErrorBoundaryOld = function CardErrorBoundaryOld(_ref) {
7
20
  var children = _ref.children,
8
21
  props = _objectWithoutProperties(_ref, _excluded);
9
22
  // TODO: NAVX-4682: Add feature parity to CardWithURLRenderer
@@ -18,4 +31,90 @@ var CardErrorBoundary = function CardErrorBoundary(_ref) {
18
31
  FallbackComponent: errorBoundaryFallbackComponent
19
32
  }, children);
20
33
  };
34
+ var CardErrorBoundaryNew = function CardErrorBoundaryNew(_ref2) {
35
+ var children = _ref2.children,
36
+ _ref2$isFlexibleCard = _ref2.isFlexibleCard,
37
+ isFlexibleCard = _ref2$isFlexibleCard === void 0 ? false : _ref2$isFlexibleCard,
38
+ props = _objectWithoutProperties(_ref2, _excluded2);
39
+ var appearance = props.appearance,
40
+ id = props.id,
41
+ onError = props.onError,
42
+ url = props.url;
43
+ var ErrorFallbackComponent = props.fallbackComponent;
44
+ var _useAnalyticsEvents = useAnalyticsEvents(),
45
+ fireEvent = _useAnalyticsEvents.fireEvent;
46
+ var _useSmartCardContext = useSmartCardContext(),
47
+ smartCardContext = _useSmartCardContext.value;
48
+ var store = smartCardContext === null || smartCardContext === void 0 ? void 0 : smartCardContext.store;
49
+ var display = isFlexibleCard ? 'flexible' : appearance;
50
+
51
+ // Parity with CardWithURLRenderer error handler
52
+ var errorHandler = useCallback(function (error, info) {
53
+ var componentStack = info.componentStack;
54
+ var errorInfo = {
55
+ componentStack: componentStack
56
+ };
57
+ // Read the link state when the error happens: useSmartCardContext does not subscribe
58
+ // to store updates, so a value captured during render can be stale by now.
59
+ var state = store ? getUrl(store, url) : undefined;
60
+ var analyticsContext = getSmartLinkAnalyticsContext({
61
+ display: display,
62
+ id: id,
63
+ response: state === null || state === void 0 ? void 0 : state.details,
64
+ status: state === null || state === void 0 ? void 0 : state.status,
65
+ url: url,
66
+ error: state === null || state === void 0 ? void 0 : state.error
67
+ });
68
+ // NB: APIErrors are thrown in response to Object Resolver Service. We do not
69
+ // fire an event for these, as they do not cover failed UI render events.
70
+ // The rest of the errors caught here are unexpected, and correlate
71
+ // to the reliability of the smart-card front-end components.
72
+ // Likewise, chunk loading errors are not caused by a failure of smart-card rendering.
73
+ if (error.name === 'ChunkLoadError') {
74
+ fireEvent('operational.smartLink.chunkLoadFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
75
+ display: display,
76
+ error: error,
77
+ errorInfo: errorInfo,
78
+ definitionId: null
79
+ }));
80
+ } else if (error.name !== 'APIError') {
81
+ startUfoExperience('smart-link-rendered', id, {
82
+ ssr: true
83
+ });
84
+ failUfoExperience('smart-link-rendered', id);
85
+ failUfoExperience('smart-link-authenticated', id);
86
+ fireEvent('ui.smartLink.renderFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
87
+ display: display,
88
+ id: id,
89
+ error: error,
90
+ errorInfo: errorInfo
91
+ }));
92
+ }
93
+ onError && onError({
94
+ status: 'errored',
95
+ url: url,
96
+ err: error
97
+ });
98
+ }, [display, fireEvent, id, onError, store, url]);
99
+ var errorBoundaryFallbackComponent = function errorBoundaryFallbackComponent() {
100
+ if (ErrorFallbackComponent) {
101
+ return /*#__PURE__*/React.createElement(ErrorFallbackComponent, null);
102
+ }
103
+ return /*#__PURE__*/React.createElement(LoadingCardLink, props);
104
+ };
105
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
106
+ FallbackComponent: errorBoundaryFallbackComponent,
107
+ onError: errorHandler
108
+ }, children);
109
+ };
110
+ var CardErrorBoundary = function CardErrorBoundary(_ref3) {
111
+ var isFlexibleCard = _ref3.isFlexibleCard,
112
+ props = _objectWithoutProperties(_ref3, _excluded3);
113
+ if (fg('platform_smartlink_cardssr_missing_events')) {
114
+ return /*#__PURE__*/React.createElement(CardErrorBoundaryNew, _extends({}, props, {
115
+ isFlexibleCard: isFlexibleCard
116
+ }));
117
+ }
118
+ return /*#__PURE__*/React.createElement(CardErrorBoundaryOld, props);
119
+ };
21
120
  export default CardErrorBoundary;