From 13533efd31b71757b4cfb030e7cbfcda0d1666ea Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Wed, 29 May 2024 17:07:31 +0300 Subject: [PATCH] Removed prompt from the New Virtual Persona Form --- src/core/apollo/generated/apollo-helpers.ts | 23 +++++- src/core/apollo/generated/apollo-hooks.ts | 2 +- src/core/apollo/generated/graphql-schema.ts | 82 ++++++++++++++----- .../space/createSpace/CreateNewSpace.graphql | 2 +- .../virtual-contributors/NewPersonaForm.tsx | 34 ++++---- 5 files changed, 101 insertions(+), 42 deletions(-) diff --git a/src/core/apollo/generated/apollo-helpers.ts b/src/core/apollo/generated/apollo-helpers.ts index 4226cb4ab5..ad2d21d871 100644 --- a/src/core/apollo/generated/apollo-helpers.ts +++ b/src/core/apollo/generated/apollo-helpers.ts @@ -13,6 +13,7 @@ export type AccountKeySpecifier = ( | 'library' | 'license' | 'spaceID' + | 'subscriptions' | AccountKeySpecifier )[]; export type AccountFieldPolicy = { @@ -24,6 +25,12 @@ export type AccountFieldPolicy = { library?: FieldPolicy | FieldReadFunction; license?: FieldPolicy | FieldReadFunction; spaceID?: FieldPolicy | FieldReadFunction; + subscriptions?: FieldPolicy | FieldReadFunction; +}; +export type AccountSubscriptionKeySpecifier = ('expires' | 'name' | AccountSubscriptionKeySpecifier)[]; +export type AccountSubscriptionFieldPolicy = { + expires?: FieldPolicy | FieldReadFunction; + name?: FieldPolicy | FieldReadFunction; }; export type ActivityCreatedSubscriptionResultKeySpecifier = ( | 'activity' @@ -1345,6 +1352,7 @@ export type LicensePlanKeySpecifier = ( | 'enabled' | 'id' | 'isFree' + | 'licenseCredential' | 'name' | 'pricePerMonth' | 'requiresContactSupport' @@ -1357,6 +1365,7 @@ export type LicensePlanFieldPolicy = { enabled?: FieldPolicy | FieldReadFunction; id?: FieldPolicy | FieldReadFunction; isFree?: FieldPolicy | FieldReadFunction; + licenseCredential?: FieldPolicy | FieldReadFunction; name?: FieldPolicy | FieldReadFunction; pricePerMonth?: FieldPolicy | FieldReadFunction; requiresContactSupport?: FieldPolicy | FieldReadFunction; @@ -1381,9 +1390,17 @@ export type LicensePolicyRuleFeatureFlagFieldPolicy = { grantedPrivileges?: FieldPolicy | FieldReadFunction; name?: FieldPolicy | FieldReadFunction; }; -export type LicensingKeySpecifier = ('authorization' | 'id' | 'plans' | 'policy' | LicensingKeySpecifier)[]; +export type LicensingKeySpecifier = ( + | 'authorization' + | 'basePlan' + | 'id' + | 'plans' + | 'policy' + | LicensingKeySpecifier +)[]; export type LicensingFieldPolicy = { authorization?: FieldPolicy | FieldReadFunction; + basePlan?: FieldPolicy | FieldReadFunction; id?: FieldPolicy | FieldReadFunction; plans?: FieldPolicy | FieldReadFunction; policy?: FieldPolicy | FieldReadFunction; @@ -2992,6 +3009,10 @@ export type StrictTypedTypePolicies = { keyFields?: false | AccountKeySpecifier | (() => undefined | AccountKeySpecifier); fields?: AccountFieldPolicy; }; + AccountSubscription?: Omit & { + keyFields?: false | AccountSubscriptionKeySpecifier | (() => undefined | AccountSubscriptionKeySpecifier); + fields?: AccountSubscriptionFieldPolicy; + }; ActivityCreatedSubscriptionResult?: Omit & { keyFields?: | false diff --git a/src/core/apollo/generated/apollo-hooks.ts b/src/core/apollo/generated/apollo-hooks.ts index 2ad4cadfc3..01986e642a 100644 --- a/src/core/apollo/generated/apollo-hooks.ts +++ b/src/core/apollo/generated/apollo-hooks.ts @@ -15853,7 +15853,7 @@ export function refetchLegacySubspaceDashboardPageQuery( export const CreateNewSpaceDocument = gql` mutation CreateNewSpace($hostId: UUID_NAMEID!, $spaceData: CreateSpaceInput!, $planId: UUID) { - createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, planID: $planId }) { + createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, licensePlanID: $planId }) { id spaceID } diff --git a/src/core/apollo/generated/graphql-schema.ts b/src/core/apollo/generated/graphql-schema.ts index edf9ae7129..01fbe3c78f 100644 --- a/src/core/apollo/generated/graphql-schema.ts +++ b/src/core/apollo/generated/graphql-schema.ts @@ -52,6 +52,8 @@ export type Account = { license: License; /** The ID for the root space for the Account . */ spaceID: Scalars['String']; + /** The subscriptions active for this Account. */ + subscriptions: Array; }; export type AccountAuthorizationResetInput = { @@ -59,6 +61,14 @@ export type AccountAuthorizationResetInput = { accountID: Scalars['UUID_NAMEID']; }; +export type AccountSubscription = { + __typename?: 'AccountSubscription'; + /** The expiry date of this subscription, null if it does never expire. */ + expires?: Maybe; + /** The name of the Subscription. */ + name: Scalars['String']; +}; + export type ActivityCreatedSubscriptionInput = { /** The collaboration on which to subscribe for new activity */ collaborationID: Scalars['UUID']; @@ -1407,8 +1417,8 @@ export type ConvertSubsubspaceToSubspaceInput = { export type CreateAccountInput = { /** The host Organization or User for the account */ hostID: Scalars['UUID_NAMEID']; - /** The plan selected for the account */ - planID?: InputMaybe; + /** The license plan selected for the account */ + licensePlanID?: InputMaybe; /** The root Space to be created. */ spaceData: CreateSpaceInput; }; @@ -1738,7 +1748,6 @@ export type CreateVirtualPersonaInput = { /** A readable identifier, unique within the containing scope. */ nameID: Scalars['NameID']; profileData: CreateProfileInput; - prompt: Scalars['JSON']; }; export type CreateWhiteboardInput = { @@ -1768,7 +1777,7 @@ export type Credential = { /** The User issuing the credential */ issuer?: Maybe; resourceID: Scalars['String']; - type: AuthorizationCredential; + type: CredentialType; }; export type CredentialDefinition = { @@ -1795,6 +1804,31 @@ export type CredentialMetadataOutput = { uniqueType: Scalars['String']; }; +export enum CredentialType { + AccountHost = 'ACCOUNT_HOST', + BetaTester = 'BETA_TESTER', + GlobalAdmin = 'GLOBAL_ADMIN', + GlobalCommunityRead = 'GLOBAL_COMMUNITY_READ', + GlobalLicenseManager = 'GLOBAL_LICENSE_MANAGER', + GlobalRegistered = 'GLOBAL_REGISTERED', + GlobalSpacesReader = 'GLOBAL_SPACES_READER', + GlobalSupport = 'GLOBAL_SUPPORT', + InnovationPackProvider = 'INNOVATION_PACK_PROVIDER', + LicenseSpaceEnterprise = 'LICENSE_SPACE_ENTERPRISE', + LicenseSpaceFree = 'LICENSE_SPACE_FREE', + LicenseSpacePlus = 'LICENSE_SPACE_PLUS', + LicenseSpacePremium = 'LICENSE_SPACE_PREMIUM', + OrganizationAdmin = 'ORGANIZATION_ADMIN', + OrganizationAssociate = 'ORGANIZATION_ASSOCIATE', + OrganizationOwner = 'ORGANIZATION_OWNER', + SpaceAdmin = 'SPACE_ADMIN', + SpaceLead = 'SPACE_LEAD', + SpaceMember = 'SPACE_MEMBER', + SpaceSubspaceAdmin = 'SPACE_SUBSPACE_ADMIN', + UserGroupMember = 'USER_GROUP_MEMBER', + UserSelfManagement = 'USER_SELF_MANAGEMENT', +} + export type DeleteActorGroupInput = { ID: Scalars['UUID']; }; @@ -2299,6 +2333,13 @@ export type License = { visibility: SpaceVisibility; }; +export enum LicenseCredential { + LicenseSpaceEnterprise = 'LICENSE_SPACE_ENTERPRISE', + LicenseSpaceFree = 'LICENSE_SPACE_FREE', + LicenseSpacePlus = 'LICENSE_SPACE_PLUS', + LicenseSpacePremium = 'LICENSE_SPACE_PREMIUM', +} + export type LicenseFeatureFlag = { __typename?: 'LicenseFeatureFlag'; /** Is this feature flag enabled? */ @@ -2321,6 +2362,8 @@ export type LicensePlan = { id: Scalars['UUID']; /** Is this plan free? */ isFree: Scalars['Boolean']; + /** The credential to represent this plan */ + licenseCredential: LicenseCredential; /** The name of the License Plan */ name: Scalars['String']; /** The price per month of this plan. */ @@ -2362,6 +2405,8 @@ export type Licensing = { __typename?: 'Licensing'; /** The authorization rules for the entity */ authorization?: Maybe; + /** The base License Plan assigned to all Accounts in use on the platform. */ + basePlan: LicensePlan; /** The ID of the entity */ id: Scalars['UUID']; /** The License Plans in use on the platform. */ @@ -5478,7 +5523,6 @@ export type UpdateVirtualPersonaInput = { nameID?: InputMaybe; /** The Profile of this entity. */ profileData?: InputMaybe; - prompt: Scalars['JSON']; }; export type UpdateVisualInput = { @@ -5939,7 +5983,7 @@ export type UserAgentSsiFragment = { id: string; did?: string | undefined; credentials?: - | Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: AuthorizationCredential }> + | Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: CredentialType }> | undefined; verifiedCredentials?: | Array<{ @@ -5972,7 +6016,7 @@ export type UserSsiQuery = { id: string; did?: string | undefined; credentials?: - | Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: AuthorizationCredential }> + | Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: CredentialType }> | undefined; verifiedCredentials?: | Array<{ @@ -14324,7 +14368,7 @@ export type CommunityPageMembersFragment = { __typename?: 'Agent'; id: string; credentials?: - | Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }> + | Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }> | undefined; }; profile: { @@ -15087,7 +15131,7 @@ export type ContributorsPageUsersQuery = { __typename?: 'Agent'; id: string; credentials?: - | Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }> + | Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }> | undefined; }; userProfile: { @@ -15167,7 +15211,7 @@ export type UserContributorPaginatedFragment = { __typename?: 'Agent'; id: string; credentials?: - | Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }> + | Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }> | undefined; }; userProfile: { @@ -15205,7 +15249,7 @@ export type UserContributorFragment = { __typename?: 'Agent'; id: string; credentials?: - | Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }> + | Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }> | undefined; }; userProfile: { @@ -16334,7 +16378,7 @@ export type UserAgentFragment = { id: string; did?: string | undefined; credentials?: - | Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: AuthorizationCredential }> + | Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: CredentialType }> | undefined; }; }; @@ -16351,7 +16395,7 @@ export type UserDetailsFragment = { accountUpn: string; agent: { __typename?: 'Agent'; - credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined; + credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined; }; profile: { __typename?: 'Profile'; @@ -16464,7 +16508,7 @@ export type CreateUserMutation = { accountUpn: string; agent: { __typename?: 'Agent'; - credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined; + credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined; }; profile: { __typename?: 'Profile'; @@ -16521,7 +16565,7 @@ export type CreateUserNewRegistrationMutation = { accountUpn: string; agent: { __typename?: 'Agent'; - credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined; + credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined; }; profile: { __typename?: 'Profile'; @@ -16656,7 +16700,7 @@ export type UpdateUserMutation = { accountUpn: string; agent: { __typename?: 'Agent'; - credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined; + credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined; }; profile: { __typename?: 'Profile'; @@ -16727,7 +16771,7 @@ export type UserQuery = { id: string; did?: string | undefined; credentials?: - | Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string; id: string }> + | Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string; id: string }> | undefined; }; profile: { @@ -16817,7 +16861,7 @@ export type UserProfileQuery = { id: string; did?: string | undefined; credentials?: - | Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string; id: string }> + | Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string; id: string }> | undefined; }; profile: { @@ -16952,7 +16996,7 @@ export type UserProviderQuery = { id: string; did?: string | undefined; credentials?: - | Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string; id: string }> + | Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string; id: string }> | undefined; }; profile: { diff --git a/src/domain/journey/space/createSpace/CreateNewSpace.graphql b/src/domain/journey/space/createSpace/CreateNewSpace.graphql index 8b0013c60f..27bc6ab035 100644 --- a/src/domain/journey/space/createSpace/CreateNewSpace.graphql +++ b/src/domain/journey/space/createSpace/CreateNewSpace.graphql @@ -1,5 +1,5 @@ mutation CreateNewSpace($hostId: UUID_NAMEID!, $spaceData: CreateSpaceInput!, $planId: UUID) { - createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, planID: $planId }) { + createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, licensePlanID: $planId }) { id spaceID } diff --git a/src/domain/platform/admin/virtual-contributors/NewPersonaForm.tsx b/src/domain/platform/admin/virtual-contributors/NewPersonaForm.tsx index fbf56a492e..236b03d2ab 100644 --- a/src/domain/platform/admin/virtual-contributors/NewPersonaForm.tsx +++ b/src/domain/platform/admin/virtual-contributors/NewPersonaForm.tsx @@ -26,7 +26,6 @@ interface NewPersonaFormValues { displayName: string; nameId: string; description: string; - prompt: string; engine: VirtualContributorEngine; } @@ -41,7 +40,6 @@ const NewPersonaForm = ({ parentPagePath }: NewPersonaFormProps) => { const initialValues = { displayName: '', nameId: '', - prompt: '', description: '', engine: VirtualContributorEngine.Expert, }; @@ -53,25 +51,22 @@ const NewPersonaForm = ({ parentPagePath }: NewPersonaFormProps) => { navigateBack(); }; - const [handleSubmit] = useLoadingState( - async ({ displayName, prompt, engine, nameId, description }: NewPersonaFormValues) => { - await createPersona({ - variables: { - virtualPersonaData: { - prompt, - nameID: nameId, - profileData: { - displayName, - description, - }, - engine, + const [handleSubmit] = useLoadingState(async ({ displayName, engine, nameId, description }: NewPersonaFormValues) => { + await createPersona({ + variables: { + virtualPersonaData: { + nameID: nameId, + profileData: { + displayName, + description, }, + engine, }, - }); - notify('Persona Created Successfully!', 'success'); - navigateBack(); - } - ); + }, + }); + notify('Persona Created Successfully!', 'success'); + navigateBack(); + }); const engines = useMemo( () => @@ -93,7 +88,6 @@ const NewPersonaForm = ({ parentPagePath }: NewPersonaFormProps) => { -