@atlaskit/smart-card 21.2.0 → 22.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/cjs/extractors/block/index.js +6 -7
  3. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +16 -19
  4. package/dist/cjs/state/actions/index.js +54 -10
  5. package/dist/cjs/state/analytics/types.js +5 -0
  6. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +429 -109
  7. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -3
  8. package/dist/cjs/utils/analytics/analytics.js +241 -74
  9. package/dist/cjs/utils/analytics/index.js +32 -5
  10. package/dist/cjs/utils/mocks.js +28 -2
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +2 -2
  13. package/dist/cjs/view/BlockCard/index.js +6 -5
  14. package/dist/cjs/view/CardWithUrl/component.js +27 -5
  15. package/dist/cjs/view/CardWithUrl/loader.js +6 -1
  16. package/dist/cjs/view/EmbedCard/index.js +3 -2
  17. package/dist/cjs/view/EmbedModal/components/analytics/index.js +100 -0
  18. package/dist/cjs/view/EmbedModal/components/analytics/types.js +5 -0
  19. package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +5 -10
  20. package/dist/cjs/view/EmbedModal/index.js +54 -15
  21. package/dist/cjs/view/EmbedModal/types.js +9 -1
  22. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +17 -3
  23. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
  24. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  25. package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
  26. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +5 -2
  27. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -3
  28. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +36 -8
  29. package/dist/cjs/view/HoverCard/components/SnippetOrPreview.js +74 -0
  30. package/dist/cjs/view/HoverCard/index.js +6 -1
  31. package/dist/cjs/view/HoverCard/styled.js +11 -3
  32. package/dist/cjs/view/common/Modal.js +29 -4
  33. package/dist/cjs/view/common/ModalHeader.js +3 -2
  34. package/dist/es2019/extractors/block/index.js +6 -7
  35. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +16 -10
  36. package/dist/es2019/state/actions/index.js +54 -10
  37. package/dist/es2019/state/analytics/types.js +1 -0
  38. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +424 -41
  39. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -3
  40. package/dist/es2019/utils/analytics/analytics.js +254 -79
  41. package/dist/es2019/utils/analytics/index.js +32 -4
  42. package/dist/es2019/utils/mocks.js +26 -1
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +3 -3
  45. package/dist/es2019/view/BlockCard/index.js +5 -4
  46. package/dist/es2019/view/CardWithUrl/component.js +27 -5
  47. package/dist/es2019/view/CardWithUrl/loader.js +6 -1
  48. package/dist/es2019/view/EmbedCard/index.js +3 -2
  49. package/dist/es2019/view/EmbedModal/components/analytics/index.js +80 -0
  50. package/dist/es2019/view/EmbedModal/components/analytics/types.js +1 -0
  51. package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +5 -9
  52. package/dist/es2019/view/EmbedModal/index.js +46 -13
  53. package/dist/es2019/view/EmbedModal/types.js +6 -1
  54. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +17 -7
  55. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +4 -1
  56. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  57. package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -3
  58. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +5 -2
  59. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +11 -3
  60. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +36 -10
  61. package/dist/es2019/view/HoverCard/components/SnippetOrPreview.js +42 -0
  62. package/dist/es2019/view/HoverCard/index.js +6 -1
  63. package/dist/es2019/view/HoverCard/styled.js +8 -0
  64. package/dist/es2019/view/common/Modal.js +27 -6
  65. package/dist/es2019/view/common/ModalHeader.js +3 -2
  66. package/dist/esm/extractors/block/index.js +6 -7
  67. package/dist/esm/extractors/common/actions/extractPreviewAction.js +17 -19
  68. package/dist/esm/state/actions/index.js +54 -10
  69. package/dist/esm/state/analytics/types.js +1 -0
  70. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +428 -111
  71. package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -3
  72. package/dist/esm/utils/analytics/analytics.js +241 -74
  73. package/dist/esm/utils/analytics/index.js +31 -4
  74. package/dist/esm/utils/mocks.js +25 -0
  75. package/dist/esm/version.json +1 -1
  76. package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
  77. package/dist/esm/view/BlockCard/index.js +5 -4
  78. package/dist/esm/view/CardWithUrl/component.js +27 -5
  79. package/dist/esm/view/CardWithUrl/loader.js +6 -1
  80. package/dist/esm/view/EmbedCard/index.js +3 -2
  81. package/dist/esm/view/EmbedModal/components/analytics/index.js +82 -0
  82. package/dist/esm/view/EmbedModal/components/analytics/types.js +1 -0
  83. package/dist/esm/view/EmbedModal/components/size-experiment/index.js +5 -10
  84. package/dist/esm/view/EmbedModal/index.js +52 -15
  85. package/dist/esm/view/EmbedModal/types.js +6 -1
  86. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +11 -3
  87. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
  88. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  89. package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
  90. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +5 -2
  91. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -3
  92. package/dist/esm/view/HoverCard/components/HoverCardContent.js +36 -10
  93. package/dist/esm/view/HoverCard/components/SnippetOrPreview.js +53 -0
  94. package/dist/esm/view/HoverCard/index.js +6 -1
  95. package/dist/esm/view/HoverCard/styled.js +6 -2
  96. package/dist/esm/view/common/Modal.js +28 -6
  97. package/dist/esm/view/common/ModalHeader.js +3 -2
  98. package/dist/types/extractors/block/types.d.ts +4 -2
  99. package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +7 -5
  100. package/dist/types/state/analytics/types.d.ts +9 -0
  101. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +41 -24
  102. package/dist/types/state/hooks/useSmartLink.d.ts +26 -18
  103. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +6 -2
  104. package/dist/types/utils/analytics/analytics.d.ts +19 -21
  105. package/dist/types/utils/analytics/index.d.ts +2 -2
  106. package/dist/types/utils/analytics/types.d.ts +91 -0
  107. package/dist/types/utils/mocks.d.ts +48 -0
  108. package/dist/types/utils/types.d.ts +3 -1
  109. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +4 -0
  110. package/dist/types/view/BlockCard/index.d.ts +2 -2
  111. package/dist/types/view/BlockCard/types.d.ts +4 -4
  112. package/dist/types/view/Card/index.d.ts +1 -1
  113. package/dist/types/view/EmbedCard/types.d.ts +2 -2
  114. package/dist/types/view/EmbedModal/components/analytics/index.d.ts +5 -0
  115. package/dist/types/view/EmbedModal/components/analytics/types.d.ts +6 -0
  116. package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +4 -3
  117. package/dist/types/view/EmbedModal/index.d.ts +3 -1
  118. package/dist/types/view/EmbedModal/types.d.ts +14 -4
  119. package/dist/types/view/FlexibleCard/components/blocks/preview-block/types.d.ts +7 -1
  120. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +15 -0
  121. package/dist/types/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
  122. package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +5 -0
  123. package/dist/types/view/HoverCard/components/SnippetOrPreview.d.ts +4 -0
  124. package/dist/types/view/HoverCard/styled.d.ts +2 -0
  125. package/dist/types/view/HoverCard/types.d.ts +5 -0
  126. package/dist/types/view/common/Modal.d.ts +6 -8
  127. package/package.json +1 -1
  128. package/report.api.md +324 -108
@@ -1,2 +1,93 @@
1
+ import { APIError, CardType } from '@atlaskit/linking-common';
2
+ import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
3
+ import { ErrorInfo } from 'react';
4
+ import { CardInnerAppearance } from '../../view/Card/types';
5
+ import { InvokeType } from '../../model/invoke-opts';
1
6
  export declare type DestinationProduct = 'jira' | 'confluence' | 'bitbucket' | 'trello';
2
7
  export declare type DestinationSubproduct = 'core' | 'software' | 'servicedesk';
8
+ export interface CommonEventProps {
9
+ id?: string;
10
+ definitionId?: string;
11
+ extensionKey?: string;
12
+ resourceType?: string;
13
+ destinationSubproduct?: DestinationSubproduct | string;
14
+ destinationProduct?: DestinationProduct | string;
15
+ location?: string;
16
+ }
17
+ export declare type ResolvedEventProps = CommonEventProps & {
18
+ id: string;
19
+ };
20
+ export declare type UnresolvedEventProps = CommonEventProps & {
21
+ id: string;
22
+ status: string;
23
+ error?: APIError;
24
+ };
25
+ export declare type InvokeSucceededEventProps = CommonEventProps & {
26
+ id: string;
27
+ actionType: string;
28
+ display: CardInnerAppearance;
29
+ };
30
+ export declare type InvokeFailedEventProps = CommonEventProps & {
31
+ id: string;
32
+ actionType: string;
33
+ display: CardInnerAppearance;
34
+ reason: string;
35
+ };
36
+ export declare type ConnectSucceededEventProps = CommonEventProps & {
37
+ id?: string;
38
+ };
39
+ export declare type ConnectFailedEventProps = CommonEventProps & {
40
+ id?: string;
41
+ reason?: string;
42
+ };
43
+ export declare type TrackAppAccountConnectedProps = CommonEventProps;
44
+ export declare type UiAuthEventProps = CommonEventProps & {
45
+ display: CardInnerAppearance;
46
+ };
47
+ export declare type UiAuthAlternateAccountEventProps = CommonEventProps & {
48
+ display: CardInnerAppearance;
49
+ };
50
+ export declare type UiCardClickedEventProps = CommonEventProps & {
51
+ id: string;
52
+ display: CardInnerAppearance;
53
+ status: CardType;
54
+ isModifierKeyPressed?: boolean;
55
+ actionSubjectId?: string;
56
+ };
57
+ export declare type UiActionClickedEventProps = CommonEventProps & {
58
+ id: string;
59
+ display: CardInnerAppearance;
60
+ actionType: string;
61
+ invokeType?: InvokeType;
62
+ };
63
+ export declare type ScreenAuthPopupEventProps = CommonEventProps;
64
+ export declare type UiClosedAuthEventProps = CommonEventProps & {
65
+ display: CardInnerAppearance;
66
+ };
67
+ export declare type UiRenderSuccessEventProps = CommonEventProps & {
68
+ display: CardInnerAppearance;
69
+ status: CardType;
70
+ };
71
+ export declare type UiRenderFailedEventProps = CommonEventProps & {
72
+ display: CardInnerAppearance;
73
+ error: Error;
74
+ errorInfo: ErrorInfo;
75
+ };
76
+ export declare type UiHoverCardViewedEventProps = CommonEventProps & {
77
+ previewDisplay: PreviewDisplay;
78
+ previewInvokeMethod?: PreviewInvokeMethod;
79
+ };
80
+ export declare type UiHoverCardDismissedEventProps = CommonEventProps & {
81
+ previewDisplay: PreviewDisplay;
82
+ hoverTime: number;
83
+ previewInvokeMethod?: PreviewInvokeMethod;
84
+ };
85
+ export declare type UiHoverCardOpenLinkClickedEventProps = CommonEventProps & {
86
+ previewDisplay: PreviewDisplay;
87
+ previewInvokeMethod?: PreviewInvokeMethod;
88
+ };
89
+ export declare type InstrumentEventProps = CommonEventProps & {
90
+ error?: APIError;
91
+ status: CardType;
92
+ id: string;
93
+ };
@@ -20,7 +20,55 @@ export declare const mocks: {
20
20
  status: string;
21
21
  };
22
22
  };
23
+ analytics: {
24
+ status: string;
25
+ details: {
26
+ meta: {
27
+ definitionId: string;
28
+ key: string;
29
+ resourceType: string;
30
+ subproduct: string;
31
+ product: string;
32
+ };
33
+ };
34
+ };
23
35
  };
24
36
  export declare const fakeResponse: () => Promise<JsonLd.Response<JsonLd.Data.BaseData>>;
25
37
  export declare const fakeFactory: any;
26
38
  export declare const waitFor: (time?: number) => Promise<unknown>;
39
+ export declare const mockAnalytics: {
40
+ ui: {
41
+ authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiAuthEventProps) => void;
42
+ authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiAuthAlternateAccountEventProps) => void;
43
+ buttonClickedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
44
+ actionSubjectId: string;
45
+ }) => void;
46
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("./analytics/types").UiCardClickedEventProps) => void;
47
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiActionClickedEventProps) => void;
48
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("./analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
49
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiClosedAuthEventProps) => void;
50
+ modalClosedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
51
+ actionSubjectId: string;
52
+ }) => void;
53
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
54
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderFailedEventProps) => void;
55
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiHoverCardViewedEventProps) => void;
56
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiHoverCardDismissedEventProps) => void;
57
+ };
58
+ operational: {
59
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").InvokeSucceededEventProps) => void;
60
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").InvokeFailedEventProps) => void;
61
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").ConnectSucceededEventProps) => void;
62
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").ConnectFailedEventProps) => void;
63
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("./analytics/types").InstrumentEventProps) => void;
64
+ };
65
+ track: {
66
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").CommonEventProps) => void;
67
+ };
68
+ screen: {
69
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").CommonEventProps) => void;
70
+ modalViewedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
71
+ name: "embedPreviewModal";
72
+ }) => void;
73
+ };
74
+ };
@@ -1,7 +1,9 @@
1
1
  import { GasPayload } from '@atlaskit/analytics-gas-types';
2
2
  import { CardInnerAppearance } from '../view/Card/types';
3
3
  export declare type AnalyticsAction = 'resolved' | 'unresolved' | 'connectSucceeded' | 'connectFailed' | 'connected' | 'clicked' | 'closed' | 'renderFailed' | 'renderWithStatus' | 'renderSuccess' | 'inserted' | 'viewed' | 'dismissed' | 'created';
4
- export declare type AnalyticsActionSubject = 'smartLink' | 'smartLinkAction' | 'applicationAccount' | 'button' | 'consentModal' | 'hoverCard';
4
+ export declare type AnalyticsActionSubject = 'smartLink' | 'smartLinkAction' | 'applicationAccount' | 'button' | 'consentModal' | 'hoverCard' | 'modal' | 'embedPreviewModal';
5
+ export declare type AnalyticsName = 'embedPreviewModal';
6
+ export declare type AnalyticsOrigin = 'smartLinkCard' | 'smartLinkEmbed' | 'smartLinkInline' | 'smartLinkPreviewHoverCard';
5
7
  export declare type AnalyticsPayload = GasPayload & {
6
8
  action?: AnalyticsAction;
7
9
  actionSubject: AnalyticsActionSubject;
@@ -1,9 +1,11 @@
1
1
  import React, { ErrorInfo } from 'react';
2
2
  import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
3
+ import { AnalyticsFacade } from '../../../state/analytics';
3
4
  import { EmbedModalWithExperimentProps } from '../../EmbedModal/types';
4
5
  import { ActionProps } from '../components/Action';
5
6
  import { IconProps } from '../../common/Icon';
6
7
  import { MetadataProps } from '../../common/Metadata';
8
+ import { AnalyticsOrigin } from '../../../utils/types';
7
9
  export interface PreviewFunctionArg extends EmbedModalWithExperimentProps {
8
10
  popupMountPointId: string;
9
11
  }
@@ -23,6 +25,8 @@ declare type PreviewInfo = {
23
25
  onOpen?: () => void;
24
26
  onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
25
27
  featureFlags?: Partial<LinkingPlatformFeatureFlags>;
28
+ analytics: AnalyticsFacade;
29
+ origin?: AnalyticsOrigin;
26
30
  };
27
31
  declare const _default: ({ details, ...rest }: PreviewInfo) => ActionProps;
28
32
  export default _default;
@@ -1,14 +1,14 @@
1
1
  import { FC } from 'react';
2
2
  import { BlockCardProps } from './types';
3
- export { default as PreviewAction } from './actions/PreviewAction';
4
3
  import { AuthorizeAction } from './actions/AuthorizeAction';
5
4
  import { ForbiddenAction } from './actions/ForbiddenAction';
6
5
  import { ResolvedView as BlockCardResolvedView } from './views/ResolvedView';
7
- export type { ResolvedViewProps as BlockCardResolvedViewProps } from './views/ResolvedView';
8
6
  import { NotFoundView as BlockCardNotFoundView } from './views/NotFoundView';
9
7
  import { ResolvingView as BlockCardResolvingView } from './views/ResolvingView';
10
8
  import { UnauthorizedView as BlockCardUnauthorisedView } from './views/UnauthorizedView';
11
9
  import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
12
10
  import { ErroredView as BlockCardErroredView } from './views/ErroredView';
11
+ export { default as PreviewAction } from './actions/PreviewAction';
12
+ export type { ResolvedViewProps as BlockCardResolvedViewProps } from './views/ResolvedView';
13
13
  export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView, };
14
14
  export declare const BlockCard: FC<BlockCardProps>;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { CardProviderRenderers, CardAuthFlowOpts } from '@atlaskit/link-provider';
2
+ import { CardAuthFlowOpts, CardProviderRenderers } from '@atlaskit/link-provider';
3
3
  import { CardState } from '../../state/types';
4
4
  import { InvokeHandler } from '../../model/invoke-handler';
5
- import { AnalyticsHandler } from '../../utils/types';
6
- import { OnResolveCallback, CardPlatform } from '../Card/types';
5
+ import { CardPlatform, OnResolveCallback } from '../Card/types';
7
6
  import { OnErrorCallback } from '../types';
7
+ import { AnalyticsFacade } from '../../state/analytics';
8
8
  export declare type BlockCardProps = {
9
9
  id: string;
10
10
  url: string;
@@ -12,7 +12,6 @@ export declare type BlockCardProps = {
12
12
  authFlow?: CardAuthFlowOpts['authFlow'];
13
13
  handleAuthorize: (() => void) | undefined;
14
14
  handleErrorRetry: () => void;
15
- handleAnalytics: AnalyticsHandler;
16
15
  handleInvoke: InvokeHandler;
17
16
  handleFrameClick: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
18
17
  isSelected?: boolean;
@@ -22,4 +21,5 @@ export declare type BlockCardProps = {
22
21
  showActions?: boolean;
23
22
  renderers?: CardProviderRenderers;
24
23
  platform?: CardPlatform;
24
+ analytics: AnalyticsFacade;
25
25
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { CardAppearance, CardPlatform, CardProps } from './types';
3
3
  import { WrappedComponentProps } from 'react-intl-next';
4
- export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onError" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showHoverPreview" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
4
+ export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onError" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "showHoverPreview" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
5
5
  export type { CardAppearance, CardProps, CardPlatform };
@@ -1,18 +1,18 @@
1
1
  import { CardState } from '../../state/types';
2
2
  import { InvokeHandler } from '../../model/invoke-handler';
3
- import { AnalyticsHandler } from '../../utils/types';
4
3
  import { CardPlatform, OnResolveCallback } from '../Card/types';
5
4
  import { ReactNode } from 'react';
6
5
  import { ActionProps } from '../BlockCard/components/Action';
7
6
  import { RequestAccessMessageKey } from '../../messages';
8
7
  import { OnErrorCallback } from '../types';
8
+ import { AnalyticsFacade } from '../../state/analytics';
9
9
  export declare type EmbedCardProps = {
10
10
  url: string;
11
11
  cardState: CardState;
12
12
  handleAuthorize: (() => void) | undefined;
13
13
  handleErrorRetry: () => void;
14
14
  handleFrameClick: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
15
- handleAnalytics: AnalyticsHandler;
15
+ analytics: AnalyticsFacade;
16
16
  handleInvoke: InvokeHandler;
17
17
  id?: string;
18
18
  isSelected?: boolean;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { EmbedModalProps } from '../../types';
3
+ import { WithAnalytics } from './types';
4
+ declare const withAnalytics: (Component: React.ComponentType<EmbedModalProps>) => React.FC<EmbedModalProps & WithAnalytics>;
5
+ export default withAnalytics;
@@ -0,0 +1,6 @@
1
+ import { AnalyticsFacade } from '../../../../state/analytics';
2
+ import { AnalyticsOrigin } from '../../../../utils/types';
3
+ export declare type WithAnalytics = {
4
+ analytics: AnalyticsFacade;
5
+ origin?: AnalyticsOrigin;
6
+ };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { ModalProps } from '../../../common/Modal';
3
- import { EmbedModalProps } from '../../types';
2
+ import Modal from '../../../common/Modal';
4
3
  import { WithSizeExperimentProps } from './types';
5
- declare const withSizeExperiment: (Component: React.ComponentType<EmbedModalProps>) => React.FC<(EmbedModalProps | ModalProps) & WithSizeExperimentProps>;
4
+ declare const withSizeExperiment: <Props, Component>(Component: React.ComponentType<Props>) => React.FC<Props & import("../../types").EmbedModalProps & import("../analytics/types").WithAnalytics & {
5
+ children?: React.ReactNode;
6
+ } & WithSizeExperimentProps>;
6
7
  export default withSizeExperiment;
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
2
  import { EmbedModalProps } from './types';
3
- declare const _default: React.FC<(import("../common/Modal").ModalProps | EmbedModalProps) & import("./components/size-experiment/types").WithSizeExperimentProps>;
3
+ declare const _default: React.FC<EmbedModalProps & import("./components/analytics/types").WithAnalytics & {
4
+ children?: React.ReactNode;
5
+ } & import("./components/size-experiment/types").WithSizeExperimentProps>;
4
6
  export default _default;
@@ -2,23 +2,33 @@ import { ErrorInfo } from 'react';
2
2
  import { IconProps } from '../common/Icon';
3
3
  import { WithSizeExperimentProps } from './components/size-experiment/types';
4
4
  import { ModalProps } from '../common/Modal';
5
+ import { WithAnalytics } from './components/analytics/types';
6
+ export declare enum EmbedModalSize {
7
+ Large = "large",
8
+ Small = "small"
9
+ }
10
+ export declare type EmbedModalContext = {
11
+ duration?: number;
12
+ size: EmbedModalSize;
13
+ };
5
14
  export declare type EmbedModalProps = {
6
15
  closeLabel?: string;
7
16
  download?: string;
8
17
  icon?: IconProps;
9
18
  iframeName: string;
10
19
  isTrusted?: boolean;
11
- onClose: () => any;
20
+ onClose: (context: EmbedModalContext) => void;
12
21
  onDownloadActionClick?: () => void;
13
- onOpen?: () => void;
22
+ onOpen?: (context: EmbedModalContext) => void;
14
23
  onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
24
+ onResize?: (context: EmbedModalContext) => void;
15
25
  onViewActionClick?: () => void;
16
26
  providerName?: string;
17
27
  showModal?: boolean;
18
- size?: string;
28
+ size?: EmbedModalSize;
19
29
  src?: string;
20
30
  testId?: string;
21
31
  title?: string;
22
32
  url?: string;
23
33
  };
24
- export declare type EmbedModalWithExperimentProps = EmbedModalProps & ModalProps & WithSizeExperimentProps;
34
+ export declare type EmbedModalWithExperimentProps = EmbedModalProps & ModalProps & WithSizeExperimentProps & WithAnalytics;
@@ -1,2 +1,8 @@
1
1
  import { BlockProps } from '../types';
2
- export declare type PreviewBlockProps = BlockProps;
2
+ export declare type PreviewBlockProps = {
3
+ /**
4
+ * Function to be called on error loading media.
5
+ * @internal
6
+ */
7
+ onError?: () => void;
8
+ } & BlockProps;
@@ -1,6 +1,7 @@
1
1
  import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize, SmartLinkStatus } from '../../../../constants';
2
2
  import { SerializedStyles } from '@emotion/core';
3
3
  import { ActionProps } from '../actions/action/types';
4
+ import { Ref } from 'react';
4
5
  export declare type BlockProps = {
5
6
  /**
6
7
  * The direction that the block should arrange it's elements. Can be vertical
@@ -29,6 +30,20 @@ export declare type BlockProps = {
29
30
  * serving as a hook for automated tests
30
31
  */
31
32
  testId?: string;
33
+ /**
34
+ * Ref to block wrapper div.
35
+ */
36
+ blockRef?: Ref<HTMLDivElement>;
37
+ /**
38
+ * Function to be called on render of block.
39
+ * @internal
40
+ */
41
+ onRender?: () => void;
42
+ /**
43
+ * Function to be called on transition end of block.
44
+ * @internal
45
+ */
46
+ onTransitionEnd?: () => void;
32
47
  };
33
48
  /**
34
49
  * Used to represent a metadata element to be rendered.
@@ -3,4 +3,5 @@ export declare type ImageIconProps = {
3
3
  defaultIcon?: React.ReactNode;
4
4
  testId?: string;
5
5
  url: string;
6
+ onError?: () => void;
6
7
  };
@@ -9,4 +9,9 @@ export declare type MediaProps = ElementProps & {
9
9
  * The URL of the associated media to display.
10
10
  */
11
11
  url?: string;
12
+ /**
13
+ * Function to be called on error loading media.
14
+ * @internal
15
+ */
16
+ onError?: () => void;
12
17
  };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SnippetOrPreviewProps } from '../types';
3
+ declare const SnippetOrPreview: React.FC<SnippetOrPreviewProps>;
4
+ export default SnippetOrPreview;
@@ -8,3 +8,5 @@ export declare const metadataBlockCss: import("@emotion/utils").SerializedStyles
8
8
  export declare const footerBlockCss: import("@emotion/utils").SerializedStyles;
9
9
  export declare const loadingViewContainer: import("@emotion/utils").SerializedStyles;
10
10
  export declare const skeletonContainer: import("@emotion/utils").SerializedStyles;
11
+ export declare const hiddenSnippetStyles: import("@emotion/utils").SerializedStyles;
12
+ export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/utils").SerializedStyles;
@@ -8,6 +8,7 @@ import { AnalyticsHandler } from '../../utils/types';
8
8
  import { ReactElement } from 'react';
9
9
  import { TitleBlockProps } from '../FlexibleCard/components/blocks/title-block/types';
10
10
  import { FlexibleCardProps } from '../FlexibleCard/types';
11
+ import { JsonLd } from 'json-ld-types';
11
12
  export interface HoverCardProps extends WithAnalyticsEventsProps {
12
13
  id?: string;
13
14
  url: string;
@@ -38,3 +39,7 @@ export declare type HoverCardLoadingViewProps = {
38
39
  flexibleCardProps: FlexibleCardProps;
39
40
  titleBlockProps: TitleBlockProps;
40
41
  };
42
+ export declare type SnippetOrPreviewProps = {
43
+ data: JsonLd.Data.BaseData;
44
+ snippetHeight: number;
45
+ };
@@ -1,15 +1,16 @@
1
1
  import React, { ErrorInfo } from 'react';
2
2
  import { IconProps } from './Icon';
3
3
  import { MetadataListProps } from './MetadataList';
4
+ import { EmbedModalContext } from '../EmbedModal/types';
4
5
  export interface ModalProps {
5
- onClose: () => any;
6
- onOpen?: () => void;
6
+ onClose: (context: EmbedModalContext) => void;
7
+ onOpen?: (context: EmbedModalContext) => void;
7
8
  onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
8
9
  src?: string;
9
10
  showModal?: boolean;
10
11
  iframeName: string;
11
12
  providerName?: string;
12
- closeLabel: string;
13
+ closeLabel?: string;
13
14
  url?: string;
14
15
  title?: string;
15
16
  metadata?: MetadataListProps;
@@ -21,8 +22,5 @@ export interface ModalProps {
21
22
  onDownloadActionClick?: () => void;
22
23
  testId?: string;
23
24
  }
24
- declare class ModalWithErrorBoundary extends React.Component<ModalProps> {
25
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
26
- render(): JSX.Element;
27
- }
28
- export default ModalWithErrorBoundary;
25
+ declare const _default: React.FC<import("../EmbedModal/types").EmbedModalProps & import("../EmbedModal/components/analytics/types").WithAnalytics>;
26
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "21.2.0",
3
+ "version": "22.1.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"