Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/modules/integration-picker/IntegrationPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const IntegrationPicker: React.FC<IntegrationPickerProps> = ({
fields,
notices,
guide,
linkedAtSignIn,

// State
connectionState,
Expand Down Expand Up @@ -105,7 +106,9 @@ export const IntegrationPicker: React.FC<IntegrationPickerProps> = ({
) : (
<CardFooter
selectedIntegration={selectedIntegration}
showActions={!connectionState.loading && !connectionState.success}
showActions={
!connectionState.loading && !connectionState.success && !linkedAtSignIn
}
onBack={accountData || hasOnlyOneIntegration ? undefined : onBack}
onNext={handleConnect}
isFormValid={isFormValid}
Expand Down Expand Up @@ -157,6 +160,7 @@ export const IntegrationPicker: React.FC<IntegrationPickerProps> = ({
hubData={hubData ?? null}
fields={fields}
notices={notices}
linkedAtSignIn={linkedAtSignIn}
errorHubData={(errorHubData as Error) ?? null}
errorConnectorData={(errorConnectorData as Error) ?? null}
onSelect={setSelectedIntegration}
Expand Down
52 changes: 32 additions & 20 deletions src/modules/integration-picker/components/IntegrationFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ const ErrorBlock = ({ error }: { error?: { message: string; provider_response: s
interface IntegrationFieldsProps {
fields: Array<ConnectorConfigField>;
notices?: Array<AuthenticationNotice>;
linkedAtSignIn?: boolean;
error?: {
message: string;
provider_response: string;
Expand All @@ -234,7 +235,8 @@ const NoFieldsView: React.FC<{
integrationName: string;
error?: { message: string; provider_response: string };
notices?: AuthenticationNotice[];
}> = ({ integrationName, error, notices = [] }) => {
linkedAtSignIn?: boolean;
}> = ({ integrationName, error, notices = [], linkedAtSignIn }) => {
// No fields for a notice to sit above or below, so position is irrelevant here —
// render every notice together rather than orphaning bottom ones under the card.
return (
Expand All @@ -251,31 +253,34 @@ const NoFieldsView: React.FC<{
{notices.map((n) => (
<Alert key={n.key} type={n.type} message={n.description} hasMargin={false} />
))}
<Flex
direction={FlexDirection.Vertical}
gapSize={FlexGapSize.Small}
fullHeight
justify={FlexJustify.Center}
align={FlexAlign.Center}
>
<Spacer direction="vertical" size={8} fullWidth>
<Typography.Text size="small" fontWeight={'semi-bold'}>
Press "Connect" below to authenticate
</Typography.Text>
<Typography.Text size="small" color="secondary">
An authentication window for {integrationName} will display,
<br />
please complete the necessary steps.
</Typography.Text>
</Spacer>
</Flex>
{!linkedAtSignIn && (
<Flex
direction={FlexDirection.Vertical}
gapSize={FlexGapSize.Small}
fullHeight
justify={FlexJustify.Center}
align={FlexAlign.Center}
>
<Spacer direction="vertical" size={8} fullWidth>
<Typography.Text size="small" fontWeight={'semi-bold'}>
Press "Connect" below to authenticate
</Typography.Text>
<Typography.Text size="small" color="secondary">
An authentication window for {integrationName} will display,
<br />
please complete the necessary steps.
</Typography.Text>
</Spacer>
</Flex>
)}
</Padded>
);
};

export const IntegrationForm: React.FC<IntegrationFieldsProps> = ({
fields,
notices = [],
linkedAtSignIn,
onChange,
error,
onValidationChange,
Expand Down Expand Up @@ -336,7 +341,14 @@ export const IntegrationForm: React.FC<IntegrationFieldsProps> = ({
}, [isValid, onValidationChange]);

if (displayedFields.length === 0) {
return <NoFieldsView integrationName={integrationName} error={error} notices={notices} />;
return (
<NoFieldsView
integrationName={integrationName}
error={error}
notices={notices}
linkedAtSignIn={linkedAtSignIn}
/>
);
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface IntegrationPickerContentProps {
hubData: HubData | null;
fields: ConnectorConfigField[];
notices?: AuthenticationNotice[];
linkedAtSignIn?: boolean;
selectedCategory: string | null;
search: string;

Expand All @@ -56,6 +57,7 @@ export const IntegrationPickerContent: React.FC<IntegrationPickerContentProps> =
hubData,
fields,
notices,
linkedAtSignIn,
selectedCategory,
search,
errorHubData,
Expand Down Expand Up @@ -122,6 +124,7 @@ export const IntegrationPickerContent: React.FC<IntegrationPickerContentProps> =
<IntegrationFormView
fields={fields}
notices={notices}
linkedAtSignIn={linkedAtSignIn}
error={connectionState.error}
onChange={onChange}
onValidationChange={onValidationChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IntegrationForm } from '../IntegrationFields';
interface IntegrationFormViewProps {
fields: ConnectorConfigField[];
notices?: AuthenticationNotice[];
linkedAtSignIn?: boolean;
error?: {
message: string;
provider_response: string;
Expand All @@ -20,6 +21,7 @@ interface IntegrationFormViewProps {
export const IntegrationFormView: React.FC<IntegrationFormViewProps> = ({
fields,
notices,
linkedAtSignIn,
error,
onChange,
onValidationChange,
Expand All @@ -32,6 +34,7 @@ export const IntegrationFormView: React.FC<IntegrationFormViewProps> = ({
<IntegrationForm
fields={fields}
notices={notices}
linkedAtSignIn={linkedAtSignIn}
error={error}
onChange={onChange}
onValidationChange={onValidationChange}
Expand Down
4 changes: 3 additions & 1 deletion src/modules/integration-picker/hooks/useIntegrationPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const useIntegrationPicker = ({
...RETRY_CONFIG,
});

const { fields, guide, notices } = useMemo(() => {
const { fields, guide, notices, linkedAtSignIn } = useMemo(() => {
if (!connectorData || !selectedIntegration) {
const fields: ConnectorConfigField[] = [];
const notices: AuthenticationNotice[] = [];
Expand Down Expand Up @@ -258,6 +258,7 @@ export const useIntegrationPicker = ({
return {
fields: fieldsWithPrefilledValues,
notices: connectorData.config.configNotices ?? [],
linkedAtSignIn: connectorData.config.linkedAtSignIn,
guide: {
supportLink: connectorData.config.support?.link,
description: connectorData.config.support?.description ?? '',
Expand Down Expand Up @@ -790,6 +791,7 @@ export const useIntegrationPicker = ({
fields,
notices,
guide,
linkedAtSignIn,

// State
formData,
Expand Down
2 changes: 2 additions & 0 deletions src/modules/integration-picker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export interface FalconConnectorConfig {
grantType?: 'authorization_code' | 'client_credentials';
configFields?: Array<ConnectorConfigField>;
configNotices?: Array<AuthenticationNotice>;
/** The identity provider links these accounts when the user signs in, so there is nothing to connect. */
linkedAtSignIn?: boolean;
assets?: {
icon: string;
};
Expand Down
Loading