@atlaskit/smart-card 23.3.1 → 23.4.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 (89) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/constants.js +3 -0
  3. package/dist/cjs/extractors/common/actions/extractActions.js +3 -0
  4. package/dist/cjs/extractors/flexible/actions/extract-download-action.js +26 -0
  5. package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +36 -0
  6. package/dist/cjs/extractors/flexible/actions/extract-view-action.js +26 -0
  7. package/dist/cjs/extractors/flexible/index.js +9 -0
  8. package/dist/cjs/state/flexible-ui-context/index.js +15 -2
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +110 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/types.js +5 -0
  12. package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +167 -0
  13. package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/types.js +5 -0
  14. package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +92 -0
  15. package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/types.js +5 -0
  16. package/dist/cjs/view/FlexibleCard/components/actions/index.js +26 -2
  17. package/dist/cjs/view/FlexibleCard/components/actions/utils.js +51 -2
  18. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +19 -13
  19. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +9 -4
  20. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +1 -1
  21. package/dist/cjs/view/FlexibleCard/index.js +6 -3
  22. package/dist/cjs/view/common/Icon.js +25 -13
  23. package/dist/es2019/constants.js +3 -0
  24. package/dist/es2019/extractors/common/actions/extractActions.js +1 -2
  25. package/dist/es2019/extractors/flexible/actions/extract-download-action.js +13 -0
  26. package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +23 -0
  27. package/dist/es2019/extractors/flexible/actions/extract-view-action.js +13 -0
  28. package/dist/es2019/extractors/flexible/index.js +7 -1
  29. package/dist/es2019/state/flexible-ui-context/index.js +8 -1
  30. package/dist/es2019/version.json +1 -1
  31. package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +66 -0
  32. package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/types.js +1 -0
  33. package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +104 -0
  34. package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/types.js +1 -0
  35. package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +46 -0
  36. package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/types.js +1 -0
  37. package/dist/es2019/view/FlexibleCard/components/actions/index.js +23 -2
  38. package/dist/es2019/view/FlexibleCard/components/actions/utils.js +48 -2
  39. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +12 -9
  40. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +9 -4
  41. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +1 -1
  42. package/dist/es2019/view/FlexibleCard/index.js +7 -4
  43. package/dist/es2019/view/common/Icon.js +31 -13
  44. package/dist/esm/constants.js +3 -0
  45. package/dist/esm/extractors/common/actions/extractActions.js +1 -2
  46. package/dist/esm/extractors/flexible/actions/extract-download-action.js +15 -0
  47. package/dist/esm/extractors/flexible/actions/extract-preview-action.js +23 -0
  48. package/dist/esm/extractors/flexible/actions/extract-view-action.js +15 -0
  49. package/dist/esm/extractors/flexible/index.js +7 -1
  50. package/dist/esm/state/flexible-ui-context/index.js +9 -0
  51. package/dist/esm/version.json +1 -1
  52. package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +96 -0
  53. package/dist/esm/view/FlexibleCard/components/actions/action/download-action/types.js +1 -0
  54. package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +136 -0
  55. package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/types.js +1 -0
  56. package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +77 -0
  57. package/dist/esm/view/FlexibleCard/components/actions/action/view-action/types.js +1 -0
  58. package/dist/esm/view/FlexibleCard/components/actions/index.js +23 -2
  59. package/dist/esm/view/FlexibleCard/components/actions/utils.js +45 -2
  60. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +19 -13
  61. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +9 -4
  62. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +1 -1
  63. package/dist/esm/view/FlexibleCard/index.js +7 -4
  64. package/dist/esm/view/common/Icon.js +27 -13
  65. package/dist/types/constants.d.ts +3 -0
  66. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +112 -0
  67. package/dist/types/extractors/common/actions/extractActions.d.ts +1 -0
  68. package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +3 -0
  69. package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +3 -0
  70. package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +3 -0
  71. package/dist/types/state/flexible-ui-context/index.d.ts +76 -0
  72. package/dist/types/state/flexible-ui-context/types.d.ts +32 -0
  73. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +2 -2
  74. package/dist/types/view/EmbedModal/index.d.ts +20 -2
  75. package/dist/types/view/EmbedModal/types.d.ts +1 -2
  76. package/dist/types/view/FlexibleCard/components/actions/action/download-action/index.d.ts +4 -0
  77. package/dist/types/view/FlexibleCard/components/actions/action/download-action/types.d.ts +8 -0
  78. package/dist/types/view/FlexibleCard/components/actions/action/preview-action/index.d.ts +5 -0
  79. package/dist/types/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +15 -0
  80. package/dist/types/view/FlexibleCard/components/actions/action/view-action/index.d.ts +5 -0
  81. package/dist/types/view/FlexibleCard/components/actions/action/view-action/types.d.ts +8 -0
  82. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +21 -0
  83. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +50 -3
  84. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -1
  85. package/dist/types/view/FlexibleCard/types.d.ts +6 -0
  86. package/dist/types/view/common/Icon.d.ts +2 -1
  87. package/package.json +1 -1
  88. package/report.api.md +30 -2
  89. package/tmp/api-report-tmp.d.ts +25 -3
@@ -20,12 +20,14 @@ export declare const TEST_PROJECT: JsonLd.Data.Project;
20
20
  export declare const TEST_PULL_REQUEST: JsonLd.Data.SourceCodePullRequest;
21
21
  export declare const TEST_TASK: JsonLd.Data.Task;
22
22
  export declare const TEST_META_DATA: JsonLd.Meta.BaseMeta;
23
+ export declare const TEST_RESOLVED_META_DATA: JsonLd.Meta.BaseMeta;
23
24
  export declare const TEST_DOCUMENT: JsonLd.Data.Document;
24
25
  export declare const TEST_CURRENT_DOCUMENT: JsonLd.Data.Document;
25
26
  export declare const TEST_DOWNLOAD_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
26
27
  export declare const TEST_UNDEFINED_LINK: JsonLd.Data.UndefinedLinkDocument;
27
28
  export declare const TEST_ASSIGN_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
28
29
  export declare const TEST_NO_ID_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
30
+ export declare const TEST_VIEW_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
29
31
  export declare const TEST_DOCUMENT_WITH_ACTIONS: {
30
32
  'schema:potentialAction': any[];
31
33
  '@type': "Collection" | "Document" | "schema:BlogPosting" | "schema:TextDigitalDocument" | "schema:DigitalDocument" | "schema:PresentationDigitalDocument" | "schema:SpreadsheetDigitalDocument" | "atlassian:UndefinedLink" | ("Object" | "Document")[] | (JsonLd.Data.DocumentChildType | JsonLd.Data.DocumentParentType)[] | ("Document" | "schema:DigitalDocument")[];
@@ -81,6 +83,116 @@ export declare const TEST_DOCUMENT_WITH_ACTIONS: {
81
83
  summaryMap?: Record<string, string> | undefined;
82
84
  updated?: string | undefined;
83
85
  };
86
+ export declare const TEST_DOCUMENT_WITH_DOWNLOAD_ACTION: {
87
+ 'atlassian:downloadUrl': string;
88
+ 'schema:potentialAction': import("schema-dts").DownloadAction[];
89
+ '@type': "Collection" | "Document" | "schema:BlogPosting" | "schema:TextDigitalDocument" | "schema:DigitalDocument" | "schema:PresentationDigitalDocument" | "schema:SpreadsheetDigitalDocument" | "atlassian:UndefinedLink" | ("Object" | "Document")[] | (JsonLd.Data.DocumentChildType | JsonLd.Data.DocumentParentType)[] | ("Document" | "schema:DigitalDocument")[];
90
+ 'schema:fileFormat'?: string | undefined;
91
+ 'atlassian:fileSize'?: number | undefined;
92
+ 'schema:commentCount'?: number | undefined;
93
+ 'atlassian:isDeleted'?: boolean | undefined;
94
+ 'atlassian:attachmentCount'?: number | undefined;
95
+ 'atlassian:dateViewed'?: string | undefined;
96
+ 'atlassian:reactCount'?: number | undefined;
97
+ 'atlassian:state'?: string | JsonLd.Primitives.Object<any> | undefined;
98
+ 'atlassian:viewCount'?: number | undefined;
99
+ 'atlassian:voteCount'?: number | undefined;
100
+ '@context': JsonLd.Primitives.Context;
101
+ 'atlassian:visitUrl'?: string | undefined;
102
+ 'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
103
+ 'atlassian:updatedBy'?: JsonLd.Primitives.Link | JsonLd.Primitives.Person<any> | JsonLd.Primitives.Collection<JsonLd.Primitives.Link | JsonLd.Primitives.Person<any>> | undefined;
104
+ 'schema:dateCreated'?: string | undefined;
105
+ '@id'?: string | undefined;
106
+ attachment?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
107
+ attributedTo?: JsonLd.Primitives.Property<(JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link) & {
108
+ actor?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
109
+ }> | undefined;
110
+ audience?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
111
+ bcc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
112
+ bto?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
113
+ cc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
114
+ context?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
115
+ generator?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
116
+ icon?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
117
+ image?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
118
+ inReplyTo?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
119
+ location?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
120
+ oneOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
121
+ anyOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
122
+ closed?: boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
123
+ preview?: string | ((JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel) & JsonLd.Primitives.PreviewExtension) | undefined;
124
+ replies?: JsonLd.Primitives.Collection<any> | undefined;
125
+ tag?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
126
+ to?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
127
+ url?: JsonLd.Primitives.Property<JsonLd.Primitives.Link> | undefined;
128
+ content?: string | undefined;
129
+ contentMap?: Record<string, string> | undefined;
130
+ name?: string | undefined;
131
+ nameMap?: Record<string, string> | undefined;
132
+ duration?: string | undefined;
133
+ mediaType?: string | undefined;
134
+ endTime?: string | undefined;
135
+ published?: string | undefined;
136
+ startTime?: string | undefined;
137
+ summary?: string | undefined;
138
+ summaryMap?: Record<string, string> | undefined;
139
+ updated?: string | undefined;
140
+ };
141
+ export declare const TEST_DOCUMENT_WITH_VIEW_ACTION: {
142
+ 'schema:potentialAction': import("schema-dts").ViewAction[];
143
+ '@type': "Collection" | "Document" | "schema:BlogPosting" | "schema:TextDigitalDocument" | "schema:DigitalDocument" | "schema:PresentationDigitalDocument" | "schema:SpreadsheetDigitalDocument" | "atlassian:UndefinedLink" | ("Object" | "Document")[] | (JsonLd.Data.DocumentChildType | JsonLd.Data.DocumentParentType)[] | ("Document" | "schema:DigitalDocument")[];
144
+ 'schema:fileFormat'?: string | undefined;
145
+ 'atlassian:fileSize'?: number | undefined;
146
+ 'schema:commentCount'?: number | undefined;
147
+ 'atlassian:isDeleted'?: boolean | undefined;
148
+ 'atlassian:attachmentCount'?: number | undefined;
149
+ 'atlassian:dateViewed'?: string | undefined;
150
+ 'atlassian:reactCount'?: number | undefined;
151
+ 'atlassian:state'?: string | JsonLd.Primitives.Object<any> | undefined;
152
+ 'atlassian:viewCount'?: number | undefined;
153
+ 'atlassian:voteCount'?: number | undefined;
154
+ '@context': JsonLd.Primitives.Context;
155
+ 'atlassian:downloadUrl'?: string | undefined;
156
+ 'atlassian:visitUrl'?: string | undefined;
157
+ 'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
158
+ 'atlassian:updatedBy'?: JsonLd.Primitives.Link | JsonLd.Primitives.Person<any> | JsonLd.Primitives.Collection<JsonLd.Primitives.Link | JsonLd.Primitives.Person<any>> | undefined;
159
+ 'schema:dateCreated'?: string | undefined;
160
+ '@id'?: string | undefined;
161
+ attachment?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
162
+ attributedTo?: JsonLd.Primitives.Property<(JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link) & {
163
+ actor?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
164
+ }> | undefined;
165
+ audience?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
166
+ bcc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
167
+ bto?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
168
+ cc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
169
+ context?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
170
+ generator?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
171
+ icon?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
172
+ image?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
173
+ inReplyTo?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
174
+ location?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
175
+ oneOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
176
+ anyOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
177
+ closed?: boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
178
+ preview?: string | ((JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel) & JsonLd.Primitives.PreviewExtension) | undefined;
179
+ replies?: JsonLd.Primitives.Collection<any> | undefined;
180
+ tag?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
181
+ to?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
182
+ url?: JsonLd.Primitives.Property<JsonLd.Primitives.Link> | undefined;
183
+ content?: string | undefined;
184
+ contentMap?: Record<string, string> | undefined;
185
+ name?: string | undefined;
186
+ nameMap?: Record<string, string> | undefined;
187
+ duration?: string | undefined;
188
+ mediaType?: string | undefined;
189
+ endTime?: string | undefined;
190
+ published?: string | undefined;
191
+ startTime?: string | undefined;
192
+ summary?: string | undefined;
193
+ summaryMap?: Record<string, string> | undefined;
194
+ updated?: string | undefined;
195
+ };
84
196
  export declare const PREVIEW: JsonLd.Data.BaseData['preview'];
85
197
  export declare const TEST_DOCUMENT_WITH_PREVIEW: {
86
198
  preview: JsonLd.Primitives.LinkModel & JsonLd.Primitives.PreviewExtension;
@@ -1,4 +1,5 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  import { InvokeHandler } from '../../../model/invoke-handler';
3
3
  import { ActionProps } from '../../../view/BlockCard/components/Action';
4
+ export declare const getActionsFromJsonLd: (jsonLd: JsonLd.Data.BaseData) => JsonLd.Primitives.Action[];
4
5
  export declare function extractActions(jsonLd: JsonLd.Data.BaseData, handler: InvokeHandler): ActionProps[];
@@ -0,0 +1,3 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { DownloadActionData } from '../../../state/flexible-ui-context/types';
3
+ export declare const extractDownloadAction: (data: JsonLd.Data.BaseData) => DownloadActionData | undefined;
@@ -0,0 +1,3 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { PreviewActionData } from '../../../state/flexible-ui-context/types';
3
+ export declare const extractPreviewAction: (response: JsonLd.Response) => PreviewActionData | undefined;
@@ -0,0 +1,3 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { ViewActionData } from '../../../state/flexible-ui-context/types';
3
+ export declare const extractViewAction: (data: JsonLd.Data.BaseData) => ViewActionData | undefined;
@@ -6,3 +6,79 @@ import { FlexibleUiDataContext } from './types';
6
6
  */
7
7
  export declare const FlexibleUiContext: import("react").Context<FlexibleUiDataContext | undefined>;
8
8
  export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefined;
9
+ /**
10
+ * This provides the data that will be used by Smart Links Flexible UI to populate it's
11
+ * underlying elements.
12
+ */
13
+ export declare const FlexibleUiAnalyticsContext: import("react").Context<{
14
+ ui: {
15
+ authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiAuthEventProps) => void;
16
+ authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiAuthAlternateAccountEventProps) => void;
17
+ buttonClickedEvent: (data: Partial<import("../..").AnalyticsPayload> & {
18
+ actionSubjectId: string;
19
+ }) => void;
20
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("../../utils/analytics/types").UiCardClickedEventProps) => void;
21
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiActionClickedEventProps) => void;
22
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("../../utils/analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
23
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiClosedAuthEventProps) => void;
24
+ modalClosedEvent: (data: Partial<import("../..").AnalyticsPayload> & {
25
+ actionSubjectId: string;
26
+ }) => void;
27
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
28
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
29
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
30
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
31
+ };
32
+ operational: {
33
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeSucceededEventProps) => void;
34
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeFailedEventProps) => void;
35
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectSucceededEventProps) => void;
36
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectFailedEventProps) => void;
37
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("../../utils/analytics/types").InstrumentEventProps) => void;
38
+ };
39
+ track: {
40
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
41
+ };
42
+ screen: {
43
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
44
+ modalViewedEvent: (data: Partial<import("../..").AnalyticsPayload> & {
45
+ name: "embedPreviewModal";
46
+ }) => void;
47
+ };
48
+ } | undefined>;
49
+ export declare const useFlexibleUiAnalyticsContext: () => {
50
+ ui: {
51
+ authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiAuthEventProps) => void;
52
+ authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiAuthAlternateAccountEventProps) => void;
53
+ buttonClickedEvent: (data: Partial<import("../..").AnalyticsPayload> & {
54
+ actionSubjectId: string;
55
+ }) => void;
56
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("../../utils/analytics/types").UiCardClickedEventProps) => void;
57
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiActionClickedEventProps) => void;
58
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("../../utils/analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
59
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiClosedAuthEventProps) => void;
60
+ modalClosedEvent: (data: Partial<import("../..").AnalyticsPayload> & {
61
+ actionSubjectId: string;
62
+ }) => void;
63
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
64
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
65
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
66
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
67
+ };
68
+ operational: {
69
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeSucceededEventProps) => void;
70
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeFailedEventProps) => void;
71
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectSucceededEventProps) => void;
72
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectFailedEventProps) => void;
73
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("../../utils/analytics/types").InstrumentEventProps) => void;
74
+ };
75
+ track: {
76
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
77
+ };
78
+ screen: {
79
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
80
+ modalViewedEvent: (data: Partial<import("../..").AnalyticsPayload> & {
81
+ name: "embedPreviewModal";
82
+ }) => void;
83
+ };
84
+ } | undefined;
@@ -65,6 +65,24 @@ export declare type FlexibleUiDataContext = {
65
65
  * @see CreatedOn
66
66
  */
67
67
  createdOn?: string;
68
+ /**
69
+ * Contains data needed to show a preview action.
70
+ * @type PreviewActionData
71
+ * @see PreviewAction
72
+ */
73
+ previewAction?: PreviewActionData;
74
+ /**
75
+ * Contains data needed to show a view action.
76
+ * @type ViewActionData
77
+ * @see ViewAction
78
+ */
79
+ viewAction?: ViewActionData;
80
+ /**
81
+ * Contains data needed to show a download action.
82
+ * @type DownloadActionData
83
+ * @see DownloadAction
84
+ */
85
+ downloadAction?: DownloadActionData;
68
86
  /**
69
87
  * Contains the information about the latest commit in the repository
70
88
  */
@@ -163,3 +181,17 @@ export declare type Media = {
163
181
  type: MediaType;
164
182
  url: string;
165
183
  };
184
+ export declare type PreviewActionData = {
185
+ downloadUrl?: string;
186
+ linkIcon?: Icon;
187
+ providerName?: string;
188
+ src?: string;
189
+ title?: string;
190
+ url?: string;
191
+ };
192
+ export declare type ViewActionData = {
193
+ viewUrl?: string;
194
+ };
195
+ export declare type DownloadActionData = {
196
+ downloadUrl?: string;
197
+ };
@@ -1,11 +1,11 @@
1
1
  import React, { ErrorInfo } from 'react';
2
2
  import { AnalyticsFacade } from '../../../state/analytics';
3
- import { EmbedModalWithExperimentProps } from '../../EmbedModal/types';
3
+ import { EmbedModalProps } from '../../EmbedModal/types';
4
4
  import { ActionProps } from '../components/Action';
5
5
  import { IconProps } from '../../common/Icon';
6
6
  import { MetadataProps } from '../../common/Metadata';
7
7
  import { AnalyticsOrigin } from '../../../utils/types';
8
- export interface PreviewFunctionArg extends EmbedModalWithExperimentProps {
8
+ export interface PreviewFunctionArg extends EmbedModalProps {
9
9
  popupMountPointId: string;
10
10
  }
11
11
  export declare function previewFunction({ popupMountPointId, onClose, ...rest }: PreviewFunctionArg): Promise<void>;
@@ -1,4 +1,22 @@
1
1
  import React from 'react';
2
- import { EmbedModalProps } from './types';
3
- declare const _default: React.FC<EmbedModalProps & import("./components/analytics/types").WithAnalytics>;
2
+ import { EmbedModalSize } from './types';
3
+ declare const _default: React.FC<{
4
+ download?: string | undefined;
5
+ icon?: import("../common/Icon").IconProps | undefined;
6
+ iframeName: string;
7
+ isTrusted?: boolean | undefined;
8
+ onClose: (context: import("./types").EmbedModalContext) => void;
9
+ onDownloadActionClick?: (() => void) | undefined;
10
+ onOpen?: ((context: import("./types").EmbedModalContext) => void) | undefined;
11
+ onOpenFailed?: ((error: Error, errorInfo: React.ErrorInfo) => void) | undefined;
12
+ onResize?: ((context: import("./types").EmbedModalContext) => void) | undefined;
13
+ onViewActionClick?: (() => void) | undefined;
14
+ providerName?: string | undefined;
15
+ showModal?: boolean | undefined;
16
+ size?: EmbedModalSize | undefined;
17
+ src?: string | undefined;
18
+ testId?: string | undefined;
19
+ title?: string | undefined;
20
+ url?: string | undefined;
21
+ } & import("./components/analytics/types").WithAnalytics>;
4
22
  export default _default;
@@ -27,5 +27,4 @@ export declare type EmbedModalProps = {
27
27
  testId?: string;
28
28
  title?: string;
29
29
  url?: string;
30
- };
31
- export declare type EmbedModalWithExperimentProps = EmbedModalProps & WithAnalytics;
30
+ } & WithAnalytics;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { DownloadActionProps } from './types';
3
+ declare const DownloadAction: React.FC<DownloadActionProps>;
4
+ export default DownloadAction;
@@ -0,0 +1,8 @@
1
+ import { ActionProps } from '../types';
2
+ export declare type DownloadActionProps = ActionProps & {
3
+ downloadUrl?: string;
4
+ url: string;
5
+ };
6
+ export interface DownloadFunctionProps {
7
+ url?: string;
8
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { PreviewActionProps, PreviewFunctionProps } from './types';
3
+ declare const PreviewAction: React.FC<PreviewActionProps>;
4
+ export declare function previewFunction({ popupMountPointId, ...rest }: PreviewFunctionProps): Promise<void>;
5
+ export default PreviewAction;
@@ -0,0 +1,15 @@
1
+ import { Icon } from '../../../../../../state/flexible-ui-context/types';
2
+ import { EmbedModalProps } from '../../../../../../view/EmbedModal/types';
3
+ import { ActionProps } from '../types';
4
+ export declare type PreviewActionProps = ActionProps & FlexibleEmbedProps;
5
+ export declare type FlexibleEmbedProps = {
6
+ downloadUrl?: string;
7
+ linkIcon?: Icon;
8
+ providerName?: string;
9
+ src?: string;
10
+ title?: string;
11
+ url: string;
12
+ };
13
+ export interface PreviewFunctionProps extends EmbedModalProps {
14
+ popupMountPointId: string;
15
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ViewActionProps, ViewFunctionProps } from './types';
3
+ declare const ViewAction: React.FC<ViewActionProps>;
4
+ export declare function viewFunction({ url }: ViewFunctionProps): Promise<void>;
5
+ export default ViewAction;
@@ -0,0 +1,8 @@
1
+ import { ActionProps } from '../types';
2
+ export declare type ViewActionProps = ActionProps & {
3
+ viewUrl?: string;
4
+ url: string;
5
+ };
6
+ export interface ViewFunctionProps {
7
+ url?: string;
8
+ }
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { ActionProps } from './action/types';
3
+ import { PreviewActionProps } from './action/preview-action/types';
4
+ import { ViewActionProps } from './action/view-action/types';
5
+ import { DownloadActionProps } from './action/download-action/types';
3
6
  /**
4
7
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
5
8
  * the icon to a cross icon.
@@ -12,6 +15,24 @@ export declare const DeleteAction: import("react").FC<ActionProps>;
12
15
  * @see Action
13
16
  */
14
17
  export declare const EditAction: import("react").FC<ActionProps>;
18
+ /**
19
+ * Creates a PreviewAction component. Accepts default PreviewActionProps, and defaults
20
+ * to the text 'Preview' inside the button.
21
+ * @see Action
22
+ */
23
+ export declare const PreviewAction: import("react").FC<PreviewActionProps>;
24
+ /**
25
+ * Creates a ViewAction component. Accepts default ViewActionProps, and defaults
26
+ * to the text 'View' inside the button.
27
+ * @see Action
28
+ */
29
+ export declare const ViewAction: import("react").FC<ViewActionProps>;
30
+ /**
31
+ * Creates a DownloadAction component. Accepts default DownloadActionProps, and defaults
32
+ * to the text 'Download' inside the button.
33
+ * @see Action
34
+ */
35
+ export declare const DownloadAction: import("react").FC<DownloadActionProps>;
15
36
  /**
16
37
  * Creates a CustomAction component. Accepts default ActionProps. Required to provide
17
38
  * your own icon or text.
@@ -101,12 +101,59 @@ export declare type BaseActionItem = {
101
101
  testId?: string;
102
102
  };
103
103
  /**
104
- * This represents an action where Icon and Content are provided implicitly.
104
+ * Used to represent an Action which self-hydrates with data when passing props into Flexible UI.
105
+ */
106
+ export declare type BaseDataActionItem = {
107
+ /**
108
+ * Determines whether the action should hide the text content of the button.
109
+ */
110
+ hideContent?: boolean;
111
+ /**
112
+ * Determines whether the action should hide the icon inside the button.
113
+ */
114
+ hideIcon?: boolean;
115
+ /**
116
+ * Determines the text and icon representation of the action, with exception
117
+ * to CustomAction.
118
+ */
119
+ name: ActionName;
120
+ /**
121
+ * Determines the onClick behaviour of the action. This is optional because
122
+ * the onClick functionality will be hydrated by the action by default.
123
+ */
124
+ onClick?: () => any;
125
+ /**
126
+ * Additional CSS properties on the Action.
127
+ */
128
+ overrideCss?: SerializedStyles;
129
+ /**
130
+ * Determines the size of the Action. Corresponds to an Action appearance.
131
+ */
132
+ size?: SmartLinkSize;
133
+ /**
134
+ * A `testId` prop is provided for specified elements, which is a unique
135
+ * string that appears as a data attribute `data-testid` in the rendered code,
136
+ * serving as a hook for automated tests
137
+ */
138
+ testId?: string;
139
+ };
140
+ /**
141
+ * This represents an action that will render based on the data provided from the Smart Link.
142
+ * Icon and Content are also provided implicitly.
143
+ * @example PreviewAction - by default will contain a fullscreen icon with the 'Preview'
144
+ * content if content and icon are not provided. This also will add a button that
145
+ * renders a preview modal when clicked.
146
+ */
147
+ export declare type NamedDataActionItem = BaseDataActionItem & {
148
+ name: ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
149
+ };
150
+ /**
151
+ * This represents an action that does not fetch data where Icon and Content are provided implicitly.
105
152
  * @example DeleteAction - by default will contain a cross icon with the
106
153
  * 'delete' content if content and icon are not provided.
107
154
  */
108
155
  export declare type NamedActionItem = BaseActionItem & {
109
- name: Exclude<ActionName, ActionName.CustomAction>;
156
+ name: ActionName.DeleteAction | ActionName.EditAction;
110
157
  };
111
158
  /**
112
159
  * This represents an action where either Icon or label must be provided.
@@ -114,7 +161,7 @@ export declare type NamedActionItem = BaseActionItem & {
114
161
  export declare type CustomActionItem = BaseActionItem & {
115
162
  name: ActionName.CustomAction;
116
163
  } & ((Required<Pick<ActionProps, 'icon' | 'iconPosition'>> & Pick<ActionProps, 'content'>) | ((Required<Pick<ActionProps, 'content'>> & Pick<ActionProps, 'icon' | 'iconPosition'>) & Pick<ActionProps, 'tooltipMessage'>));
117
- export declare type ActionItem = NamedActionItem | CustomActionItem;
164
+ export declare type ActionItem = NamedActionItem | NamedDataActionItem | CustomActionItem;
118
165
  export declare type OnActionMenuOpenChangeOptions = {
119
166
  isOpen: boolean;
120
167
  };
@@ -10,4 +10,4 @@ export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartL
10
10
  export declare const highlightRemoveStyles: SerializedStyles;
11
11
  export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
12
12
  export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
13
- export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: Appearance | undefined, asDropDownItems?: boolean | undefined, onActionItemClick?: (() => void) | undefined) => React.ReactNode | undefined;
13
+ export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: Appearance | undefined, asDropDownItems?: boolean | undefined, onActionItemClick?: (() => void) | undefined) => React.ReactElement[] | undefined;
@@ -6,11 +6,17 @@ import { SmartLinkSize, SmartLinkTheme } from '../../constants';
6
6
  import { CardAppearance } from '../../view/Card';
7
7
  import { OnResolveCallback } from '../Card/types';
8
8
  import { OnErrorCallback } from '../types';
9
+ import { AnalyticsFacade } from '../../state/analytics';
9
10
  export declare type FlexibleCardProps = {
10
11
  /**
11
12
  * @internal A unique ID for a Smart Link.
12
13
  */
13
14
  id?: string;
15
+ /**
16
+ * An analytics facade object which will be used to send analytics.
17
+ * @internal
18
+ */
19
+ analytics?: AnalyticsFacade;
14
20
  /**
15
21
  * Determines the appearance of the Smart Link.
16
22
  * @internal
@@ -6,6 +6,7 @@ export interface IconProps {
6
6
  icon?: React.ReactNode;
7
7
  defaultIcon?: React.ReactNode;
8
8
  testId?: string;
9
+ isFlexibleUi?: boolean;
9
10
  }
10
11
  export declare const blockCardIconImageClassName = "block-card-icon-image";
11
- export declare const Icon: ({ url, icon, defaultIcon, testId, }: IconProps) => jsx.JSX.Element;
12
+ export declare const Icon: ({ url, icon, defaultIcon, testId, isFlexibleUi, }: IconProps) => jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.3.1",
3
+ "version": "23.4.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -47,7 +47,10 @@ import { WithIntlProps } from 'react-intl-next';
47
47
  import { WrappedComponentProps } from 'react-intl-next';
48
48
 
49
49
  // @public (undocumented)
50
- export type ActionItem = CustomActionItem | NamedActionItem;
50
+ export type ActionItem =
51
+ | CustomActionItem
52
+ | NamedActionItem
53
+ | NamedDataActionItem;
51
54
 
52
55
  // @public
53
56
  export enum ActionName {
@@ -56,7 +59,13 @@ export enum ActionName {
56
59
  // (undocumented)
57
60
  DeleteAction = 'DeleteAction',
58
61
  // (undocumented)
62
+ DownloadAction = 'DownloadAction',
63
+ // (undocumented)
59
64
  EditAction = 'EditAction',
65
+ // (undocumented)
66
+ PreviewAction = 'PreviewAction',
67
+ // (undocumented)
68
+ ViewAction = 'ViewAction',
60
69
  }
61
70
 
62
71
  // @public (undocumented)
@@ -145,6 +154,17 @@ type BaseActionItem = {
145
154
  testId?: string;
146
155
  };
147
156
 
157
+ // @public
158
+ type BaseDataActionItem = {
159
+ hideContent?: boolean;
160
+ hideIcon?: boolean;
161
+ name: ActionName;
162
+ onClick?: () => any;
163
+ overrideCss?: SerializedStyles;
164
+ size?: SmartLinkSize;
165
+ testId?: string;
166
+ };
167
+
148
168
  export { BlockCardAdf };
149
169
 
150
170
  // @public (undocumented)
@@ -577,7 +597,15 @@ type ModifiedOn = {
577
597
 
578
598
  // @public
579
599
  type NamedActionItem = BaseActionItem & {
580
- name: Exclude<ActionName, ActionName.CustomAction>;
600
+ name: ActionName.DeleteAction | ActionName.EditAction;
601
+ };
602
+
603
+ // @public
604
+ type NamedDataActionItem = BaseDataActionItem & {
605
+ name:
606
+ | ActionName.DownloadAction
607
+ | ActionName.PreviewAction
608
+ | ActionName.ViewAction;
581
609
  };
582
610
 
583
611
  // @public (undocumented)