@atlaskit/smart-card 23.5.2 → 23.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/messages.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +4 -1
- package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +5 -16
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +4 -2
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +30 -92
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +134 -0
- package/dist/cjs/view/HoverCard/components/views/resolved/styled.js +24 -0
- package/dist/cjs/view/HoverCard/components/views/resolved/types.js +5 -0
- package/dist/cjs/view/HoverCard/components/{HoverCardLoadingView.js → views/resolving/index.js} +8 -6
- package/dist/cjs/view/HoverCard/components/views/resolving/styled.js +19 -0
- package/dist/cjs/view/HoverCard/components/views/resolving/types.js +5 -0
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +85 -0
- package/dist/cjs/view/HoverCard/components/views/unauthorised/styled.js +24 -0
- package/dist/cjs/view/HoverCard/components/views/unauthorised/types.js +5 -0
- package/dist/cjs/view/HoverCard/styled.js +4 -13
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +16 -2
- package/dist/cjs/view/InlineCard/index.js +4 -2
- package/dist/cjs/view/common/UnauthorisedViewContent.js +40 -0
- package/dist/es2019/messages.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +4 -1
- package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +5 -13
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +4 -2
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +28 -76
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +96 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/styled.js +34 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/types.js +1 -0
- package/dist/es2019/view/HoverCard/components/{HoverCardLoadingView.js → views/resolving/index.js} +5 -4
- package/dist/es2019/view/HoverCard/components/views/resolving/styled.js +11 -0
- package/dist/es2019/view/HoverCard/components/views/resolving/types.js +1 -0
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +58 -0
- package/dist/es2019/view/HoverCard/components/views/unauthorised/styled.js +18 -0
- package/dist/es2019/view/HoverCard/components/views/unauthorised/types.js +1 -0
- package/dist/es2019/view/HoverCard/styled.js +1 -42
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +13 -2
- package/dist/es2019/view/InlineCard/index.js +4 -2
- package/dist/es2019/view/common/UnauthorisedViewContent.js +24 -0
- package/dist/esm/messages.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +4 -1
- package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +5 -13
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +4 -2
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +29 -83
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +104 -0
- package/dist/esm/view/HoverCard/components/views/resolved/styled.js +10 -0
- package/dist/esm/view/HoverCard/components/views/resolved/types.js +1 -0
- package/dist/esm/view/HoverCard/components/{HoverCardLoadingView.js → views/resolving/index.js} +5 -4
- package/dist/esm/view/HoverCard/components/views/resolving/styled.js +7 -0
- package/dist/esm/view/HoverCard/components/views/resolving/types.js +1 -0
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +58 -0
- package/dist/esm/view/HoverCard/components/views/unauthorised/styled.js +11 -0
- package/dist/esm/view/HoverCard/components/views/unauthorised/types.js +1 -0
- package/dist/esm/view/HoverCard/styled.js +3 -8
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +14 -2
- package/dist/esm/view/InlineCard/index.js +4 -2
- package/dist/esm/view/common/UnauthorisedViewContent.js +26 -0
- package/dist/types/view/HoverCard/components/HoverCardContent.d.ts +0 -2
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +7 -0
- package/dist/types/view/HoverCard/components/views/resolved/styled.d.ts +3 -0
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +13 -0
- package/dist/types/view/HoverCard/components/{HoverCardLoadingView.d.ts → views/resolving/index.d.ts} +1 -1
- package/dist/types/view/HoverCard/components/views/resolving/styled.d.ts +2 -0
- package/dist/types/view/HoverCard/components/views/resolving/types.d.ts +6 -0
- package/dist/types/view/HoverCard/components/views/unauthorised/index.d.ts +4 -0
- package/dist/types/view/HoverCard/components/views/unauthorised/styled.d.ts +3 -0
- package/dist/types/view/HoverCard/components/views/unauthorised/types.d.ts +19 -0
- package/dist/types/view/HoverCard/index.d.ts +1 -1
- package/dist/types/view/HoverCard/styled.d.ts +1 -5
- package/dist/types/view/HoverCard/types.d.ts +3 -6
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +2 -0
- package/dist/types/view/InlineCard/types.d.ts +1 -0
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +20 -0
- package/package.json +2 -2
|
@@ -22,6 +22,7 @@ import { Frame } from '../Frame';
|
|
|
22
22
|
import { AKIconWrapper } from '../Icon';
|
|
23
23
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
24
24
|
import { IconStyledButton, LinkAppearance } from '../styled';
|
|
25
|
+
import { HoverCard } from '../../HoverCard';
|
|
25
26
|
var FallbackUnauthorizedIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
26
27
|
label: "error",
|
|
27
28
|
size: "small",
|
|
@@ -81,8 +82,10 @@ export var InlineCardUnauthorizedView = /*#__PURE__*/function (_React$Component)
|
|
|
81
82
|
onClick = _this$props2.onClick,
|
|
82
83
|
isSelected = _this$props2.isSelected,
|
|
83
84
|
_this$props2$testId = _this$props2.testId,
|
|
84
|
-
testId = _this$props2$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props2$testId
|
|
85
|
-
|
|
85
|
+
testId = _this$props2$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props2$testId,
|
|
86
|
+
_this$props2$showAuth = _this$props2.showAuthTooltip,
|
|
87
|
+
showAuthTooltip = _this$props2$showAuth === void 0 ? false : _this$props2$showAuth;
|
|
88
|
+
var inlineCardUnauthenticatedView = /*#__PURE__*/React.createElement(Frame, {
|
|
86
89
|
testId: testId,
|
|
87
90
|
link: url,
|
|
88
91
|
onClick: onClick,
|
|
@@ -92,6 +95,15 @@ export var InlineCardUnauthorizedView = /*#__PURE__*/function (_React$Component)
|
|
|
92
95
|
title: this.renderMessage(),
|
|
93
96
|
titleColor: token('color.text.subtle', N500)
|
|
94
97
|
}));
|
|
98
|
+
|
|
99
|
+
if (showAuthTooltip) {
|
|
100
|
+
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
101
|
+
url: url,
|
|
102
|
+
onAuthorize: this.props.onAuthorise
|
|
103
|
+
}, inlineCardUnauthenticatedView);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return inlineCardUnauthenticatedView;
|
|
95
107
|
}
|
|
96
108
|
}]);
|
|
97
109
|
|
|
@@ -25,7 +25,8 @@ export var InlineCard = function InlineCard(_ref) {
|
|
|
25
25
|
onError = _ref.onError,
|
|
26
26
|
testId = _ref.testId,
|
|
27
27
|
inlinePreloaderStyle = _ref.inlinePreloaderStyle,
|
|
28
|
-
showHoverPreview = _ref.showHoverPreview
|
|
28
|
+
showHoverPreview = _ref.showHoverPreview,
|
|
29
|
+
showAuthTooltip = _ref.showAuthTooltip;
|
|
29
30
|
var status = cardState.status,
|
|
30
31
|
details = cardState.details;
|
|
31
32
|
var cardDetails = details && details.data || getEmptyJsonLd();
|
|
@@ -77,7 +78,8 @@ export var InlineCard = function InlineCard(_ref) {
|
|
|
77
78
|
isSelected: isSelected,
|
|
78
79
|
onClick: handleFrameClick,
|
|
79
80
|
onAuthorise: handleAuthorize,
|
|
80
|
-
testId: testIdWithStatus
|
|
81
|
+
testId: testIdWithStatus,
|
|
82
|
+
showAuthTooltip: showAuthTooltip
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
case 'forbidden':
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import { messages } from '../../messages';
|
|
5
|
+
import { CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../constants';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This component is used in unauthorized views of a smart link.
|
|
9
|
+
* It represents the main text that provides a user with information on how to connect their account
|
|
10
|
+
*/
|
|
11
|
+
var UnauthorisedViewContent = function UnauthorisedViewContent(_ref) {
|
|
12
|
+
var providerName = _ref.providerName,
|
|
13
|
+
_ref$testId = _ref.testId,
|
|
14
|
+
testId = _ref$testId === void 0 ? 'unauthorised-view-content' : _ref$testId;
|
|
15
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
|
|
16
|
+
values: {
|
|
17
|
+
context: providerName
|
|
18
|
+
}
|
|
19
|
+
})), ' ', /*#__PURE__*/React.createElement("a", {
|
|
20
|
+
href: CONTENT_URL_SECURITY_AND_PERMISSIONS,
|
|
21
|
+
target: "_blank",
|
|
22
|
+
"data-testid": "".concat(testId, "-learn-more")
|
|
23
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.learn_more_about_smart_links_security)));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default UnauthorisedViewContent;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnalyticsFacade } from '../../../state/analytics';
|
|
3
|
-
import { LinkAction } from '../../../state/hooks-external/useSmartLinkActions';
|
|
4
3
|
import { ActionItem } from '../../FlexibleCard/components/blocks/types';
|
|
5
4
|
import { HoverCardContentProps } from '../types';
|
|
6
5
|
export declare const getOpenAction: (url: string, analytics: AnalyticsFacade, onActionClick?: ((actionId: string) => void) | undefined) => ActionItem;
|
|
7
|
-
export declare const toFooterActions: (cardActions: LinkAction[], onActionClick?: ((actionId: string) => void) | undefined) => ActionItem[];
|
|
8
6
|
declare const HoverCardContent: React.FC<HoverCardContentProps>;
|
|
9
7
|
export default HoverCardContent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActionItem } from '../../../../FlexibleCard/components/blocks/types';
|
|
3
|
+
import { LinkAction } from '../../../../../state/hooks-external/useSmartLinkActions';
|
|
4
|
+
import { HoverCardResolvedProps } from './types';
|
|
5
|
+
export declare const toFooterActions: (cardActions: LinkAction[], onActionClick?: ((actionId: string) => void) | undefined) => ActionItem[];
|
|
6
|
+
declare const HoverCardResolvedView: React.FC<HoverCardResolvedProps>;
|
|
7
|
+
export default HoverCardResolvedView;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnalyticsFacade } from '../../../../../state/analytics';
|
|
2
|
+
import { LinkAction } from '../../../../../state/hooks-external/useSmartLinkActions';
|
|
3
|
+
import { CardState } from '@atlaskit/linking-common';
|
|
4
|
+
import { HoverCardLoadingViewProps } from '../resolving/types';
|
|
5
|
+
export declare type HoverCardResolvedProps = {
|
|
6
|
+
extensionKey?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
url: string;
|
|
9
|
+
analytics: AnalyticsFacade;
|
|
10
|
+
cardActions?: LinkAction[];
|
|
11
|
+
cardState: CardState;
|
|
12
|
+
onActionClick: (actionId: string) => void;
|
|
13
|
+
} & HoverCardLoadingViewProps;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FlexibleCardProps } from '../../../../FlexibleCard/types';
|
|
2
|
+
import { TitleBlockProps } from '../../../../FlexibleCard/components/blocks/title-block/types';
|
|
3
|
+
export declare type HoverCardLoadingViewProps = {
|
|
4
|
+
flexibleCardProps: FlexibleCardProps;
|
|
5
|
+
titleBlockProps: TitleBlockProps;
|
|
6
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FlexibleCardProps } from '../../../../FlexibleCard/types';
|
|
2
|
+
export declare type HoverCardUnauthorisedProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Data required for rendering a Flexible Card
|
|
5
|
+
*/
|
|
6
|
+
flexibleCardProps: FlexibleCardProps;
|
|
7
|
+
/**
|
|
8
|
+
* A function that determines an additional action that can be performed on an unauthorised link, e.g.
|
|
9
|
+
* connecting an account to gain access.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
onAuthorize?: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
15
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
16
|
+
* serving as a hook for automated tests
|
|
17
|
+
*/
|
|
18
|
+
testId?: string;
|
|
19
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HoverCardProps } from './types';
|
|
3
|
-
export declare const HoverCard: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "children" | "key" | "id" | "analyticsContext"> & import("react").RefAttributes<any>>;
|
|
3
|
+
export declare const HoverCard: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "children" | "key" | "id" | "analyticsContext" | "onAuthorize"> & import("react").RefAttributes<any>>;
|
|
@@ -2,11 +2,7 @@ import { FlexibleUiOptions } from '../FlexibleCard/types';
|
|
|
2
2
|
export declare const flexibleUiOptions: FlexibleUiOptions;
|
|
3
3
|
export declare const CARD_WIDTH_REM = 24;
|
|
4
4
|
export declare const CARD_GAP_PX = 10;
|
|
5
|
+
export declare const separatorCss: import("@emotion/react").SerializedStyles;
|
|
5
6
|
export declare const HoverCardContainer: import("@emotion/react").SerializedStyles;
|
|
6
7
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
7
|
-
export declare const metadataBlockCss: import("@emotion/react").SerializedStyles;
|
|
8
|
-
export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
|
|
9
|
-
export declare const loadingViewContainer: import("@emotion/react").SerializedStyles;
|
|
10
|
-
export declare const skeletonContainer: import("@emotion/react").SerializedStyles;
|
|
11
|
-
export declare const hiddenSnippetStyles: import("@emotion/react").SerializedStyles;
|
|
12
8
|
export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
@@ -6,17 +6,17 @@ import { CardState } from '@atlaskit/linking-common';
|
|
|
6
6
|
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
7
7
|
import { AnalyticsHandler } from '../../utils/types';
|
|
8
8
|
import { ReactElement } from 'react';
|
|
9
|
-
import { TitleBlockProps } from '../FlexibleCard/components/blocks/title-block/types';
|
|
10
|
-
import { FlexibleCardProps } from '../FlexibleCard/types';
|
|
11
9
|
import { JsonLd } from 'json-ld-types';
|
|
12
10
|
export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
13
11
|
id?: string;
|
|
14
12
|
url: string;
|
|
15
13
|
children: ReactElement;
|
|
14
|
+
onAuthorize?: () => void;
|
|
16
15
|
}
|
|
17
16
|
export interface HoverCardComponentProps extends HoverCardProps {
|
|
18
17
|
analyticsHandler: AnalyticsHandler;
|
|
19
18
|
analytics: AnalyticsFacade;
|
|
19
|
+
onAuthorize?: () => void;
|
|
20
20
|
}
|
|
21
21
|
export declare type PreviewDisplay = 'card' | 'embed';
|
|
22
22
|
export declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
|
|
@@ -34,10 +34,7 @@ export declare type HoverCardContentProps = {
|
|
|
34
34
|
onActionClick: (actionId: string) => void;
|
|
35
35
|
onResolve: () => void;
|
|
36
36
|
url: string;
|
|
37
|
-
|
|
38
|
-
export declare type HoverCardLoadingViewProps = {
|
|
39
|
-
flexibleCardProps: FlexibleCardProps;
|
|
40
|
-
titleBlockProps: TitleBlockProps;
|
|
37
|
+
onAuthorize?: () => void;
|
|
41
38
|
};
|
|
42
39
|
export declare type SnippetOrPreviewProps = {
|
|
43
40
|
data: JsonLd.Data.BaseData;
|
|
@@ -14,6 +14,8 @@ export interface InlineCardUnauthorizedViewProps {
|
|
|
14
14
|
isSelected?: boolean;
|
|
15
15
|
/** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */
|
|
16
16
|
testId?: string;
|
|
17
|
+
/** A flag that determines is a tooltip should show up on hover over the unauthorised link */
|
|
18
|
+
showAuthTooltip?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare class InlineCardUnauthorizedView extends React.Component<InlineCardUnauthorizedViewProps> {
|
|
19
21
|
handleConnectAccount: (event: React.MouseEvent<HTMLElement>) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type UnauthorisedViewContentProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Is the name of the provider for the account that needs to be connected
|
|
5
|
+
* Eg. Google, Microsoft etc
|
|
6
|
+
*/
|
|
7
|
+
providerName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
10
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
11
|
+
* serving as a hook for automated tests
|
|
12
|
+
*/
|
|
13
|
+
testId?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This component is used in unauthorized views of a smart link.
|
|
17
|
+
* It represents the main text that provides a user with information on how to connect their account
|
|
18
|
+
*/
|
|
19
|
+
declare const UnauthorisedViewContent: ({ providerName, testId, }: UnauthorisedViewContentProps) => JSX.Element;
|
|
20
|
+
export default UnauthorisedViewContent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.6.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/icon-object": "^6.2.0",
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
|
-
"@atlaskit/linking-common": "^1.
|
|
36
|
+
"@atlaskit/linking-common": "^1.15.0",
|
|
37
37
|
"@atlaskit/logo": "^13.10.0",
|
|
38
38
|
"@atlaskit/lozenge": "^11.3.0",
|
|
39
39
|
"@atlaskit/media-common": "^2.17.0",
|