@atlaskit/smart-card 26.23.2 → 26.24.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 (80) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/constants.js +1 -0
  3. package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +53 -0
  4. package/dist/cjs/extractors/flexible/index.js +3 -0
  5. package/dist/cjs/messages.js +10 -0
  6. package/dist/cjs/utils/analytics/analytics.js +1 -1
  7. package/dist/cjs/view/BlockCard/views/flexible/styled.js +2 -2
  8. package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  10. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +43 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +40 -0
  12. package/dist/cjs/view/FlexibleCard/components/actions/index.js +10 -1
  13. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  14. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +8 -1
  15. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +22 -1
  16. package/dist/cjs/view/HoverCard/styled.js +2 -2
  17. package/dist/cjs/view/LinkUrl/index.js +1 -1
  18. package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
  19. package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
  20. package/dist/es2019/constants.js +1 -0
  21. package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
  22. package/dist/es2019/extractors/flexible/index.js +3 -0
  23. package/dist/es2019/messages.js +10 -0
  24. package/dist/es2019/utils/analytics/analytics.js +1 -1
  25. package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
  26. package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
  27. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
  28. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
  29. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
  30. package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
  31. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
  32. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  33. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
  34. package/dist/es2019/view/HoverCard/styled.js +3 -3
  35. package/dist/es2019/view/LinkUrl/index.js +1 -1
  36. package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
  37. package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
  38. package/dist/esm/constants.js +1 -0
  39. package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
  40. package/dist/esm/extractors/flexible/index.js +3 -0
  41. package/dist/esm/messages.js +10 -0
  42. package/dist/esm/utils/analytics/analytics.js +1 -1
  43. package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
  44. package/dist/esm/view/EmbedCard/components/styled.js +2 -2
  45. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  46. package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
  47. package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
  48. package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
  49. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  50. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  51. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
  52. package/dist/esm/view/HoverCard/styled.js +2 -2
  53. package/dist/esm/view/LinkUrl/index.js +1 -1
  54. package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
  55. package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
  56. package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
  57. package/dist/types/constants.d.ts +1 -0
  58. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -0
  59. package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  60. package/dist/types/messages.d.ts +1 -1
  61. package/dist/types/state/flexible-ui-context/types.d.ts +11 -0
  62. package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  63. package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  64. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
  65. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  66. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  67. package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
  68. package/dist/types-ts4.5/constants.d.ts +1 -0
  69. package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -0
  70. package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  71. package/dist/types-ts4.5/messages.d.ts +1 -1
  72. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +11 -0
  73. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  74. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  75. package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
  76. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  77. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  78. package/package.json +2 -2
  79. package/report.api.md +3 -0
  80. package/tmp/api-report-tmp.d.ts +3 -1
@@ -7,7 +7,7 @@ var LINK_COLOR_DARK = '#4794FF';
7
7
 
8
8
  // By default buttons will hide overflow and ellipsis content instead of wrapping.
9
9
  // This basically turns the button back into inline content
10
- export var IconStyledButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &&& {\n text-align: initial;\n display: inline;\n vertical-align: baseline;\n border-radius: ", ";\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n padding: ", " ", ";\n background-clip: padding-box;\n box-decoration-break: clone;\n }\n > span {\n display: inline;\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])), "var(--ds-border-radius-100, 2px)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)");
10
+ export var IconStyledButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &&& {\n text-align: initial;\n display: inline;\n vertical-align: baseline;\n border-radius: ", ";\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n padding: ", " ", ";\n background-clip: padding-box;\n box-decoration-break: clone;\n }\n > span {\n display: inline;\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])), "var(--ds-border-radius-100, 4px)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)");
11
11
  export var NoLinkAppearance = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n margin-left: ", ";\n"])), themed({
12
12
  light: "var(--ds-text-subtlest, ".concat(N200, ")"),
13
13
  dark: "var(--ds-text-subtlest, ".concat(LINK_COLOR_DARK, ")")
@@ -0,0 +1,68 @@
1
+ declare const _default: {
2
+ meta: {
3
+ auth: never[];
4
+ definitionId: string;
5
+ product: string;
6
+ visibility: string;
7
+ access: string;
8
+ key: string;
9
+ };
10
+ data: {
11
+ '@context': {
12
+ '@vocab': string;
13
+ atlassian: string;
14
+ schema: string;
15
+ };
16
+ generator: {
17
+ '@type': string;
18
+ '@id': string;
19
+ name: string;
20
+ icon: {
21
+ '@type': string;
22
+ url: string;
23
+ };
24
+ };
25
+ '@type': string[];
26
+ url: string;
27
+ icon: {
28
+ '@type': string;
29
+ url: string;
30
+ };
31
+ name: string;
32
+ summary: string;
33
+ 'atlassian:state': {
34
+ '@type': string;
35
+ name: string;
36
+ appearance: string;
37
+ };
38
+ attributedTo: {
39
+ name: string;
40
+ icon: string;
41
+ }[];
42
+ 'atlassian:updatedBy': {
43
+ name: string;
44
+ icon: string;
45
+ }[];
46
+ preview: {
47
+ '@type': string;
48
+ href: string;
49
+ };
50
+ 'schema:commentCount': number;
51
+ 'atlassian:subscriberCount': number;
52
+ endTime: string;
53
+ updated: string;
54
+ 'atlassian:serverAction': {
55
+ '@type': string;
56
+ name: string;
57
+ dataUpdateAction: {
58
+ '@type': string;
59
+ name: string;
60
+ };
61
+ resourceIdentifiers: {
62
+ ari: string;
63
+ };
64
+ refField: string;
65
+ }[];
66
+ };
67
+ };
68
+ export default _default;
@@ -125,6 +125,7 @@ export declare enum ElementName {
125
125
  export declare enum ActionName {
126
126
  DeleteAction = "DeleteAction",
127
127
  EditAction = "EditAction",
128
+ FollowAction = "FollowAction",
128
129
  PreviewAction = "PreviewAction",
129
130
  ViewAction = "ViewAction",
130
131
  DownloadAction = "DownloadAction",
@@ -29,6 +29,9 @@ export declare const TEST_UNDEFINED_LINK: JsonLd.Data.UndefinedLinkDocument;
29
29
  export declare const TEST_ASSIGN_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
30
30
  export declare const TEST_NO_ID_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
31
31
  export declare const TEST_VIEW_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
32
+ export declare const TEST_FOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
33
+ export declare const TEST_UNFOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
34
+ export declare const TEST_STATUS_UPDATE_ACTION: JsonLd.Primitives.UpdateAction;
32
35
  export declare const TEST_DOCUMENT_WITH_ACTIONS: JsonLd.Data.BaseData;
33
36
  export declare const TEST_DOCUMENT_WITH_DOWNLOAD_ACTION: JsonLd.Data.BaseData;
34
37
  export declare const TEST_DOCUMENT_WITH_VIEW_ACTION: JsonLd.Data.BaseData;
@@ -0,0 +1,5 @@
1
+ import type { JsonLd } from 'json-ld-types';
2
+ import { ServerActionProp } from '../../../state/flexible-ui-context/types';
3
+ import { ServerActionOptions } from '../../../view/FlexibleCard/types';
4
+ declare const extractFollowAction: (response?: JsonLd.Response, showServerActions?: boolean | ServerActionOptions, id?: string) => ServerActionProp<boolean> | undefined;
5
+ export default extractFollowAction;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -1,6 +1,7 @@
1
1
  import { LinkLozenge } from '../../extractors/common/lozenge/types';
2
2
  import { LinkPerson } from '@atlaskit/link-extractors';
3
3
  import { IconType, MediaType } from '../../constants';
4
+ import { InvokeRequestWithCardDetails } from '../hooks/use-invoke/types';
4
5
  /**
5
6
  * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
7
  * underlying elements.
@@ -45,6 +46,12 @@ export type FlexibleUiDataContext = {
45
46
  * @see DueOn
46
47
  */
47
48
  dueOn?: string;
49
+ /**
50
+ * Contains data needed to perform follow action.
51
+ * @type PreviewActionData
52
+ * @see FollowAction
53
+ */
54
+ followAction?: ServerActionProp<boolean>;
48
55
  /**
49
56
  * Contains the number of views of the linked resource.
50
57
  * @type number
@@ -254,3 +261,7 @@ export type ViewActionData = {
254
261
  export type DownloadActionData = {
255
262
  downloadUrl?: string;
256
263
  };
264
+ export type ServerActionProp<TValue> = {
265
+ action: InvokeRequestWithCardDetails;
266
+ value?: TValue;
267
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ActionProps } from '../action/types';
3
+ declare const FollowAction: React.FC<ActionProps>;
4
+ export default FollowAction;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type IconProps } from '@atlaskit/icon';
3
+ declare const UnfollowIcon: (props: IconProps) => JSX.Element;
4
+ export default UnfollowIcon;
@@ -3,6 +3,7 @@ import { ActionProps } from './action/types';
3
3
  import { PreviewActionProps } from './action/preview-action/types';
4
4
  import { ViewActionProps } from './action/view-action/types';
5
5
  import { DownloadActionProps } from './action/download-action/types';
6
+ export { default as FollowAction } from './follow-action';
6
7
  /**
7
8
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
9
  * the icon to a cross icon.
@@ -145,7 +145,7 @@ export type BaseDataActionItem = {
145
145
  * renders a preview modal when clicked.
146
146
  */
147
147
  export type NamedDataActionItem = BaseDataActionItem & {
148
- name: ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
148
+ name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
149
149
  };
150
150
  /**
151
151
  * This represents an action that does not fetch data where Icon and Content are provided implicitly.
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import { SerializedStyles } from '@emotion/react';
3
- import { ElementItem } from './types';
3
+ import { ActionItem, ElementItem } from './types';
4
4
  import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
5
+ import type { FlexibleUiDataContext } from '../../../../state/flexible-ui-context/types';
5
6
  export type ElementDisplaySchemaType = 'inline' | 'block';
6
7
  export declare const ElementDisplaySchema: Record<ElementName, ElementDisplaySchemaType[]>;
7
8
  export declare const getGapSize: (size: SmartLinkSize) => number;
8
9
  export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
9
10
  export declare const highlightRemoveStyles: SerializedStyles;
10
11
  export declare const isJSXElementNull: (children: JSX.Element) => boolean;
12
+ export declare const filterActionItems: (items?: ActionItem[], context?: FlexibleUiDataContext) => ActionItem[];
11
13
  export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
12
14
  export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
@@ -0,0 +1,68 @@
1
+ declare const _default: {
2
+ meta: {
3
+ auth: never[];
4
+ definitionId: string;
5
+ product: string;
6
+ visibility: string;
7
+ access: string;
8
+ key: string;
9
+ };
10
+ data: {
11
+ '@context': {
12
+ '@vocab': string;
13
+ atlassian: string;
14
+ schema: string;
15
+ };
16
+ generator: {
17
+ '@type': string;
18
+ '@id': string;
19
+ name: string;
20
+ icon: {
21
+ '@type': string;
22
+ url: string;
23
+ };
24
+ };
25
+ '@type': string[];
26
+ url: string;
27
+ icon: {
28
+ '@type': string;
29
+ url: string;
30
+ };
31
+ name: string;
32
+ summary: string;
33
+ 'atlassian:state': {
34
+ '@type': string;
35
+ name: string;
36
+ appearance: string;
37
+ };
38
+ attributedTo: {
39
+ name: string;
40
+ icon: string;
41
+ }[];
42
+ 'atlassian:updatedBy': {
43
+ name: string;
44
+ icon: string;
45
+ }[];
46
+ preview: {
47
+ '@type': string;
48
+ href: string;
49
+ };
50
+ 'schema:commentCount': number;
51
+ 'atlassian:subscriberCount': number;
52
+ endTime: string;
53
+ updated: string;
54
+ 'atlassian:serverAction': {
55
+ '@type': string;
56
+ name: string;
57
+ dataUpdateAction: {
58
+ '@type': string;
59
+ name: string;
60
+ };
61
+ resourceIdentifiers: {
62
+ ari: string;
63
+ };
64
+ refField: string;
65
+ }[];
66
+ };
67
+ };
68
+ export default _default;
@@ -125,6 +125,7 @@ export declare enum ElementName {
125
125
  export declare enum ActionName {
126
126
  DeleteAction = "DeleteAction",
127
127
  EditAction = "EditAction",
128
+ FollowAction = "FollowAction",
128
129
  PreviewAction = "PreviewAction",
129
130
  ViewAction = "ViewAction",
130
131
  DownloadAction = "DownloadAction",
@@ -29,6 +29,9 @@ export declare const TEST_UNDEFINED_LINK: JsonLd.Data.UndefinedLinkDocument;
29
29
  export declare const TEST_ASSIGN_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
30
30
  export declare const TEST_NO_ID_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
31
31
  export declare const TEST_VIEW_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
32
+ export declare const TEST_FOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
33
+ export declare const TEST_UNFOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
34
+ export declare const TEST_STATUS_UPDATE_ACTION: JsonLd.Primitives.UpdateAction;
32
35
  export declare const TEST_DOCUMENT_WITH_ACTIONS: JsonLd.Data.BaseData;
33
36
  export declare const TEST_DOCUMENT_WITH_DOWNLOAD_ACTION: JsonLd.Data.BaseData;
34
37
  export declare const TEST_DOCUMENT_WITH_VIEW_ACTION: JsonLd.Data.BaseData;
@@ -0,0 +1,5 @@
1
+ import type { JsonLd } from 'json-ld-types';
2
+ import { ServerActionProp } from '../../../state/flexible-ui-context/types';
3
+ import { ServerActionOptions } from '../../../view/FlexibleCard/types';
4
+ declare const extractFollowAction: (response?: JsonLd.Response, showServerActions?: boolean | ServerActionOptions, id?: string) => ServerActionProp<boolean> | undefined;
5
+ export default extractFollowAction;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -1,6 +1,7 @@
1
1
  import { LinkLozenge } from '../../extractors/common/lozenge/types';
2
2
  import { LinkPerson } from '@atlaskit/link-extractors';
3
3
  import { IconType, MediaType } from '../../constants';
4
+ import { InvokeRequestWithCardDetails } from '../hooks/use-invoke/types';
4
5
  /**
5
6
  * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
7
  * underlying elements.
@@ -45,6 +46,12 @@ export type FlexibleUiDataContext = {
45
46
  * @see DueOn
46
47
  */
47
48
  dueOn?: string;
49
+ /**
50
+ * Contains data needed to perform follow action.
51
+ * @type PreviewActionData
52
+ * @see FollowAction
53
+ */
54
+ followAction?: ServerActionProp<boolean>;
48
55
  /**
49
56
  * Contains the number of views of the linked resource.
50
57
  * @type number
@@ -254,3 +261,7 @@ export type ViewActionData = {
254
261
  export type DownloadActionData = {
255
262
  downloadUrl?: string;
256
263
  };
264
+ export type ServerActionProp<TValue> = {
265
+ action: InvokeRequestWithCardDetails;
266
+ value?: TValue;
267
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ActionProps } from '../action/types';
3
+ declare const FollowAction: React.FC<ActionProps>;
4
+ export default FollowAction;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type IconProps } from '@atlaskit/icon';
3
+ declare const UnfollowIcon: (props: IconProps) => JSX.Element;
4
+ export default UnfollowIcon;
@@ -3,6 +3,7 @@ import { ActionProps } from './action/types';
3
3
  import { PreviewActionProps } from './action/preview-action/types';
4
4
  import { ViewActionProps } from './action/view-action/types';
5
5
  import { DownloadActionProps } from './action/download-action/types';
6
+ export { default as FollowAction } from './follow-action';
6
7
  /**
7
8
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
9
  * the icon to a cross icon.
@@ -145,7 +145,7 @@ export type BaseDataActionItem = {
145
145
  * renders a preview modal when clicked.
146
146
  */
147
147
  export type NamedDataActionItem = BaseDataActionItem & {
148
- name: ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
148
+ name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
149
149
  };
150
150
  /**
151
151
  * This represents an action that does not fetch data where Icon and Content are provided implicitly.
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import { SerializedStyles } from '@emotion/react';
3
- import { ElementItem } from './types';
3
+ import { ActionItem, ElementItem } from './types';
4
4
  import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
5
+ import type { FlexibleUiDataContext } from '../../../../state/flexible-ui-context/types';
5
6
  export type ElementDisplaySchemaType = 'inline' | 'block';
6
7
  export declare const ElementDisplaySchema: Record<ElementName, ElementDisplaySchemaType[]>;
7
8
  export declare const getGapSize: (size: SmartLinkSize) => number;
8
9
  export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
9
10
  export declare const highlightRemoveStyles: SerializedStyles;
10
11
  export declare const isJSXElementNull: (children: JSX.Element) => boolean;
12
+ export declare const filterActionItems: (items?: ActionItem[], context?: FlexibleUiDataContext) => ActionItem[];
11
13
  export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
12
14
  export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.23.2",
3
+ "version": "26.24.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -75,7 +75,7 @@
75
75
  "@atlaskit/analytics-listeners": "^8.7.0",
76
76
  "@atlaskit/avatar": "^21.3.0",
77
77
  "@atlaskit/css-reset": "^6.5.0",
78
- "@atlaskit/link-test-helpers": "^6.0.0",
78
+ "@atlaskit/link-test-helpers": "^6.1.0",
79
79
  "@atlaskit/lozenge": "^11.4.0",
80
80
  "@atlaskit/media-test-helpers": "^33.0.0",
81
81
  "@atlaskit/visual-regression": "*",
package/report.api.md CHANGED
@@ -67,6 +67,8 @@ export enum ActionName {
67
67
  // (undocumented)
68
68
  EditAction = 'EditAction',
69
69
  // (undocumented)
70
+ FollowAction = 'FollowAction',
71
+ // (undocumented)
70
72
  PreviewAction = 'PreviewAction',
71
73
  // (undocumented)
72
74
  ViewAction = 'ViewAction',
@@ -710,6 +712,7 @@ type NamedActionItem = BaseActionItem & {
710
712
  type NamedDataActionItem = BaseDataActionItem & {
711
713
  name:
712
714
  | ActionName.DownloadAction
715
+ | ActionName.FollowAction
713
716
  | ActionName.PreviewAction
714
717
  | ActionName.ViewAction;
715
718
  };
@@ -53,6 +53,8 @@ export enum ActionName {
53
53
  // (undocumented)
54
54
  EditAction = "EditAction",
55
55
  // (undocumented)
56
+ FollowAction = "FollowAction",
57
+ // (undocumented)
56
58
  PreviewAction = "PreviewAction",
57
59
  // (undocumented)
58
60
  ViewAction = "ViewAction"
@@ -563,7 +565,7 @@ type NamedActionItem = BaseActionItem & {
563
565
 
564
566
  // @public
565
567
  type NamedDataActionItem = BaseDataActionItem & {
566
- name: ActionName.DownloadAction | ActionName.PreviewAction | ActionName.ViewAction;
568
+ name: ActionName.DownloadAction | ActionName.FollowAction | ActionName.PreviewAction | ActionName.ViewAction;
567
569
  };
568
570
 
569
571
  // @public (undocumented)