Skip to content

Commit c87784e

Browse files
authored
Button to create wingback account on account page (#7503)
1 parent 873cca6 commit c87784e

File tree

11 files changed

+348
-205
lines changed

11 files changed

+348
-205
lines changed

src/core/apollo/generated/apollo-helpers.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,7 @@ export type LookupQueryResultsFieldPolicy = {
21092109
export type MeQueryResultsKeySpecifier = (
21102110
| 'communityApplications'
21112111
| 'communityInvitations'
2112+
| 'communityInvitationsCount'
21122113
| 'id'
21132114
| 'mySpaces'
21142115
| 'spaceMembershipsFlat'
@@ -2119,6 +2120,7 @@ export type MeQueryResultsKeySpecifier = (
21192120
export type MeQueryResultsFieldPolicy = {
21202121
communityApplications?: FieldPolicy<any> | FieldReadFunction<any>;
21212122
communityInvitations?: FieldPolicy<any> | FieldReadFunction<any>;
2123+
communityInvitationsCount?: FieldPolicy<any> | FieldReadFunction<any>;
21222124
id?: FieldPolicy<any> | FieldReadFunction<any>;
21232125
mySpaces?: FieldPolicy<any> | FieldReadFunction<any>;
21242126
spaceMembershipsFlat?: FieldPolicy<any> | FieldReadFunction<any>;
@@ -2176,7 +2178,6 @@ export type MutationKeySpecifier = (
21762178
| 'aiServerAuthorizationPolicyReset'
21772179
| 'aiServerCreateAiPersonaService'
21782180
| 'aiServerDeleteAiPersonaService'
2179-
| 'aiServerPersonaServiceIngest'
21802181
| 'aiServerUpdateAiPersonaService'
21812182
| 'applyForEntryRoleOnRoleSet'
21822183
| 'askChatGuidanceQuestion'
@@ -2222,6 +2223,7 @@ export type MutationKeySpecifier = (
22222223
| 'createUser'
22232224
| 'createUserNewRegistration'
22242225
| 'createVirtualContributor'
2226+
| 'createWingbackAccount'
22252227
| 'deleteActor'
22262228
| 'deleteActorGroup'
22272229
| 'deleteCalendarEvent'
@@ -2347,7 +2349,6 @@ export type MutationFieldPolicy = {
23472349
aiServerAuthorizationPolicyReset?: FieldPolicy<any> | FieldReadFunction<any>;
23482350
aiServerCreateAiPersonaService?: FieldPolicy<any> | FieldReadFunction<any>;
23492351
aiServerDeleteAiPersonaService?: FieldPolicy<any> | FieldReadFunction<any>;
2350-
aiServerPersonaServiceIngest?: FieldPolicy<any> | FieldReadFunction<any>;
23512352
aiServerUpdateAiPersonaService?: FieldPolicy<any> | FieldReadFunction<any>;
23522353
applyForEntryRoleOnRoleSet?: FieldPolicy<any> | FieldReadFunction<any>;
23532354
askChatGuidanceQuestion?: FieldPolicy<any> | FieldReadFunction<any>;
@@ -2393,6 +2394,7 @@ export type MutationFieldPolicy = {
23932394
createUser?: FieldPolicy<any> | FieldReadFunction<any>;
23942395
createUserNewRegistration?: FieldPolicy<any> | FieldReadFunction<any>;
23952396
createVirtualContributor?: FieldPolicy<any> | FieldReadFunction<any>;
2397+
createWingbackAccount?: FieldPolicy<any> | FieldReadFunction<any>;
23962398
deleteActor?: FieldPolicy<any> | FieldReadFunction<any>;
23972399
deleteActorGroup?: FieldPolicy<any> | FieldReadFunction<any>;
23982400
deleteCalendarEvent?: FieldPolicy<any> | FieldReadFunction<any>;

src/core/apollo/generated/apollo-hooks.ts

+46
Original file line numberDiff line numberDiff line change
@@ -11223,6 +11223,52 @@ export function refetchAllOrganizationsQuery(variables: SchemaTypes.AllOrganizat
1122311223
return { query: AllOrganizationsDocument, variables: variables };
1122411224
}
1122511225

11226+
export const CreateWingbackAccountDocument = gql`
11227+
mutation createWingbackAccount($accountID: UUID!) {
11228+
createWingbackAccount(accountID: $accountID)
11229+
}
11230+
`;
11231+
export type CreateWingbackAccountMutationFn = Apollo.MutationFunction<
11232+
SchemaTypes.CreateWingbackAccountMutation,
11233+
SchemaTypes.CreateWingbackAccountMutationVariables
11234+
>;
11235+
11236+
/**
11237+
* __useCreateWingbackAccountMutation__
11238+
*
11239+
* To run a mutation, you first call `useCreateWingbackAccountMutation` within a React component and pass it any options that fit your needs.
11240+
* When your component renders, `useCreateWingbackAccountMutation` returns a tuple that includes:
11241+
* - A mutate function that you can call at any time to execute the mutation
11242+
* - An object with fields that represent the current status of the mutation's execution
11243+
*
11244+
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
11245+
*
11246+
* @example
11247+
* const [createWingbackAccountMutation, { data, loading, error }] = useCreateWingbackAccountMutation({
11248+
* variables: {
11249+
* accountID: // value for 'accountID'
11250+
* },
11251+
* });
11252+
*/
11253+
export function useCreateWingbackAccountMutation(
11254+
baseOptions?: Apollo.MutationHookOptions<
11255+
SchemaTypes.CreateWingbackAccountMutation,
11256+
SchemaTypes.CreateWingbackAccountMutationVariables
11257+
>
11258+
) {
11259+
const options = { ...defaultOptions, ...baseOptions };
11260+
return Apollo.useMutation<
11261+
SchemaTypes.CreateWingbackAccountMutation,
11262+
SchemaTypes.CreateWingbackAccountMutationVariables
11263+
>(CreateWingbackAccountDocument, options);
11264+
}
11265+
11266+
export type CreateWingbackAccountMutationHookResult = ReturnType<typeof useCreateWingbackAccountMutation>;
11267+
export type CreateWingbackAccountMutationResult = Apollo.MutationResult<SchemaTypes.CreateWingbackAccountMutation>;
11268+
export type CreateWingbackAccountMutationOptions = Apollo.BaseMutationOptions<
11269+
SchemaTypes.CreateWingbackAccountMutation,
11270+
SchemaTypes.CreateWingbackAccountMutationVariables
11271+
>;
1122611272
export const ContributorsPageOrganizationsDocument = gql`
1122711273
query ContributorsPageOrganizations(
1122811274
$first: Int!

src/core/apollo/generated/graphql-schema.ts

+28-11
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,6 @@ export type AiPersonaService = {
667667
updatedDate?: Maybe<Scalars['DateTime']>;
668668
};
669669

670-
export type AiPersonaServiceIngestInput = {
671-
aiPersonaServiceID: Scalars['UUID'];
672-
};
673-
674670
export type AiServer = {
675671
__typename?: 'AiServer';
676672
/** A particular AiPersonaService */
@@ -820,6 +816,7 @@ export type Authorization = {
820816
};
821817

822818
export enum AuthorizationCredential {
819+
AccountAdmin = 'ACCOUNT_ADMIN',
823820
BetaTester = 'BETA_TESTER',
824821
GlobalAdmin = 'GLOBAL_ADMIN',
825822
GlobalAnonymous = 'GLOBAL_ANONYMOUS',
@@ -834,6 +831,7 @@ export enum AuthorizationCredential {
834831
SpaceAdmin = 'SPACE_ADMIN',
835832
SpaceLead = 'SPACE_LEAD',
836833
SpaceMember = 'SPACE_MEMBER',
834+
SpaceMemberInvitee = 'SPACE_MEMBER_INVITEE',
837835
SpaceSubspaceAdmin = 'SPACE_SUBSPACE_ADMIN',
838836
UserGroupMember = 'USER_GROUP_MEMBER',
839837
UserSelfManagement = 'USER_SELF_MANAGEMENT',
@@ -2192,6 +2190,7 @@ export type CredentialMetadataOutput = {
21922190
};
21932191

21942192
export enum CredentialType {
2193+
AccountAdmin = 'ACCOUNT_ADMIN',
21952194
AccountLicensePlus = 'ACCOUNT_LICENSE_PLUS',
21962195
BetaTester = 'BETA_TESTER',
21972196
GlobalAdmin = 'GLOBAL_ADMIN',
@@ -2214,6 +2213,7 @@ export enum CredentialType {
22142213
SpaceLicensePlus = 'SPACE_LICENSE_PLUS',
22152214
SpaceLicensePremium = 'SPACE_LICENSE_PREMIUM',
22162215
SpaceMember = 'SPACE_MEMBER',
2216+
SpaceMemberInvitee = 'SPACE_MEMBER_INVITEE',
22172217
SpaceSubspaceAdmin = 'SPACE_SUBSPACE_ADMIN',
22182218
UserGroupMember = 'USER_GROUP_MEMBER',
22192219
UserSelfManagement = 'USER_SELF_MANAGEMENT',
@@ -3539,6 +3539,8 @@ export type MeQueryResults = {
35393539
communityApplications: Array<CommunityApplicationResult>;
35403540
/** The invitations the current authenticated user can act on. */
35413541
communityInvitations: Array<CommunityInvitationResult>;
3542+
/** The number of invitations the current authenticated user can act on. */
3543+
communityInvitationsCount: Scalars['Float'];
35423544
/** The query id */
35433545
id: Scalars['String'];
35443546
/** The Spaces I am contributing to */
@@ -3559,10 +3561,18 @@ export type MeQueryResultsCommunityInvitationsArgs = {
35593561
states?: InputMaybe<Array<Scalars['String']>>;
35603562
};
35613563

3564+
export type MeQueryResultsCommunityInvitationsCountArgs = {
3565+
states?: InputMaybe<Array<Scalars['String']>>;
3566+
};
3567+
35623568
export type MeQueryResultsMySpacesArgs = {
35633569
limit?: InputMaybe<Scalars['Float']>;
35643570
};
35653571

3572+
export type MeQueryResultsSpaceMembershipsHierarchicalArgs = {
3573+
limit?: InputMaybe<Scalars['Float']>;
3574+
};
3575+
35663576
/** A message that was sent either as an Update or as part of a Discussion. */
35673577
export type Message = {
35683578
__typename?: 'Message';
@@ -3665,8 +3675,6 @@ export type Mutation = {
36653675
aiServerCreateAiPersonaService: AiPersonaService;
36663676
/** Deletes the specified AiPersonaService. */
36673677
aiServerDeleteAiPersonaService: AiPersonaService;
3668-
/** Trigger an ingesting of data on the remove AI Persona Service. */
3669-
aiServerPersonaServiceIngest: Scalars['Boolean'];
36703678
/** Updates the specified AI Persona. */
36713679
aiServerUpdateAiPersonaService: AiPersonaService;
36723680
/** Apply to join the specified RoleSet in the entry Role. */
@@ -3757,6 +3765,8 @@ export type Mutation = {
37573765
createUserNewRegistration: User;
37583766
/** Creates a new VirtualContributor on an Account. */
37593767
createVirtualContributor: VirtualContributor;
3768+
/** Creates an account in Wingback */
3769+
createWingbackAccount: Scalars['String'];
37603770
/** Deletes the specified Actor. */
37613771
deleteActor: Actor;
37623772
/** Deletes the specified Actor Group, including contained Actors. */
@@ -3815,7 +3825,7 @@ export type Mutation = {
38153825
grantCredentialToUser: User;
38163826
/** Resets the interaction with the chat engine. */
38173827
ingest: Scalars['Boolean'];
3818-
/** Invite an existing Contriburor to join the specified RoleSet in the Entry Role. */
3828+
/** Invite an existing Contributor to join the specified RoleSet in the Entry Role. */
38193829
inviteContributorsEntryRoleOnRoleSet: Array<Invitation>;
38203830
/** Invite a User to join the platform and the specified RoleSet as a member. */
38213831
inviteUserToPlatformAndRoleSet: PlatformInvitation;
@@ -4015,10 +4025,6 @@ export type MutationAiServerDeleteAiPersonaServiceArgs = {
40154025
deleteData: DeleteAiPersonaServiceInput;
40164026
};
40174027

4018-
export type MutationAiServerPersonaServiceIngestArgs = {
4019-
ingestData: AiPersonaServiceIngestInput;
4020-
};
4021-
40224028
export type MutationAiServerUpdateAiPersonaServiceArgs = {
40234029
aiPersonaServiceData: UpdateAiPersonaServiceInput;
40244030
};
@@ -4175,6 +4181,10 @@ export type MutationCreateVirtualContributorArgs = {
41754181
virtualContributorData: CreateVirtualContributorOnAccountInput;
41764182
};
41774183

4184+
export type MutationCreateWingbackAccountArgs = {
4185+
accountID: Scalars['UUID'];
4186+
};
4187+
41784188
export type MutationDeleteActorArgs = {
41794189
deleteData: DeleteActorInput;
41804190
};
@@ -5675,6 +5685,7 @@ export enum RoleSetContributorType {
56755685
}
56765686

56775687
export enum RoleSetRoleImplicit {
5688+
AccountAdmin = 'ACCOUNT_ADMIN',
56785689
SubspaceAdmin = 'SUBSPACE_ADMIN',
56795690
}
56805691

@@ -16658,6 +16669,12 @@ export type AllOrganizationsQuery = {
1665816669
};
1665916670
};
1666016671

16672+
export type CreateWingbackAccountMutationVariables = Exact<{
16673+
accountID: Scalars['UUID'];
16674+
}>;
16675+
16676+
export type CreateWingbackAccountMutation = { __typename?: 'Mutation'; createWingbackAccount: string };
16677+
1666116678
export type ContributorsPageOrganizationsQueryVariables = Exact<{
1666216679
first: Scalars['Int'];
1666316680
after?: InputMaybe<Scalars['UUID']>;

src/core/i18n/en/translation.en.json

+4
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,10 @@
18771877
"titleWithDaysLeft": "Free Trial - {{daysLeft}} days left",
18781878
"description": "Click here to set up your full {{planName}} subscription"
18791879
},
1880+
"externalSubExists": "This account already has an existing Wingback account",
1881+
"addExternalSub": "Create a Wingback account",
1882+
"externalSubAdded": "Successfully created a Wingback account",
1883+
"externalSubErrored": "An error occurred while creating the Wingback account",
18801884
"yourLicense": "Your current license:",
18811885
"changeLicense": "Change the Space license",
18821886
"changeLicense_description": "Contact the Alkemio team to change the license.",

src/core/ui/button/ButtonWithTooltip.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PropsWithChildren } from 'react';
2-
import { Button, ButtonProps, Tooltip, TooltipProps, useTheme } from '@mui/material';
2+
import { Box, Button, ButtonProps, Tooltip, TooltipProps, useTheme } from '@mui/material';
33
import { gutters } from '../grid/utils';
44
import { ButtonTypeMap } from '@mui/material/Button/Button';
55
import { Caption } from '../typography';
@@ -53,9 +53,11 @@ const ButtonWithTooltip = <D extends React.ElementType = ButtonTypeMap['defaultC
5353
componentsProps={{ tooltip: { sx: tooltipStyle } }}
5454
placement={tooltipPlacement}
5555
>
56-
<Button aria-label={tooltip} {...props} sx={buttonStyle} startIcon={iconButton && children}>
57-
{!iconButton && children}
58-
</Button>
56+
<Box>
57+
<Button aria-label={tooltip} {...props} sx={buttonStyle} startIcon={iconButton && children}>
58+
{!iconButton && children}
59+
</Button>
60+
</Box>
5961
</Tooltip>
6062
);
6163
};

src/core/ui/button/CreationButton.tsx

+5-23
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,22 @@
11
import React from 'react';
2-
import { useTranslation } from 'react-i18next';
3-
import { Box, IconButton, Tooltip } from '@mui/material';
4-
import RoundedIcon from '@/core/ui/icon/RoundedIcon';
5-
import AddIcon from '@mui/icons-material/Add';
2+
import { Box, Tooltip } from '@mui/material';
63
import { Caption } from '@/core/ui/typography';
74

85
const CreationButton = ({
96
disabledTooltip,
107
disabled,
11-
onClick,
8+
buttonComponent,
129
}: {
1310
disabledTooltip: string;
14-
onClick: () => void;
11+
buttonComponent: React.ReactNode;
1512
disabled?: boolean;
1613
}) => {
17-
const { t } = useTranslation();
18-
19-
const button = (
20-
<IconButton
21-
aria-label={t('common.add')}
22-
aria-disabled={disabled}
23-
aria-haspopup="true"
24-
size="small"
25-
onClick={onClick}
26-
disabled={disabled}
27-
>
28-
<RoundedIcon component={AddIcon} size="medium" iconSize="small" disabled={disabled} aria-disabled={disabled} />
29-
</IconButton>
30-
);
31-
3214
return disabled && disabledTooltip ? (
3315
<Tooltip arrow placement="top" title={<Caption>{disabledTooltip}</Caption>}>
34-
<Box>{button}</Box>
16+
<Box>{buttonComponent}</Box>
3517
</Tooltip>
3618
) : (
37-
<>{button}</>
19+
<>{buttonComponent}</>
3820
);
3921
};
4022

0 commit comments

Comments
 (0)