From cee9d9a0fb37ae405d0bcfb34b4afc519888fd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnlaugur=20Gu=C3=B0mundsson?= Date: Mon, 16 Dec 2024 12:47:14 +0000 Subject: [PATCH] remove all user profile v1 from api --- .../src/lib/V1/userProfile.service.ts | 282 ------------------ .../src/lib/V2/userProfile.service.ts | 60 ++-- .../lib/dto/confirmEmailVerificationInput.ts | 13 - .../lib/dto/confirmSmsVerificationInput.ts | 13 - .../src/lib/userProfile.module.ts | 2 - .../src/lib/userProfile.resolver.ts | 42 +-- .../src/lib/userProfile.service.ts | 119 +++----- .../profile/useResendEmailVerification.ts | 20 -- libs/portals/my-pages/graphql/src/index.ts | 2 - .../lib/mutations/resendEmailVerification.ts | 9 - .../Forms/ProfileForm/ProfileForm.tsx | 22 +- 11 files changed, 78 insertions(+), 506 deletions(-) delete mode 100644 libs/api/domains/user-profile/src/lib/V1/userProfile.service.ts delete mode 100644 libs/api/domains/user-profile/src/lib/dto/confirmEmailVerificationInput.ts delete mode 100644 libs/api/domains/user-profile/src/lib/dto/confirmSmsVerificationInput.ts delete mode 100644 libs/portals/my-pages/graphql/src/hooks/profile/useResendEmailVerification.ts delete mode 100644 libs/portals/my-pages/graphql/src/lib/mutations/resendEmailVerification.ts diff --git a/libs/api/domains/user-profile/src/lib/V1/userProfile.service.ts b/libs/api/domains/user-profile/src/lib/V1/userProfile.service.ts deleted file mode 100644 index 07e9f769b098..000000000000 --- a/libs/api/domains/user-profile/src/lib/V1/userProfile.service.ts +++ /dev/null @@ -1,282 +0,0 @@ -import { Injectable } from '@nestjs/common' -import { logger } from '@island.is/logging' -import { ForbiddenError } from 'apollo-server-express' - -import { - ConfirmationDtoResponse, - CreateUserProfileDto, - UpdateUserProfileDto, - UserProfileApi, - UserProfileControllerCreateRequest, - UserProfileControllerUpdateRequest, -} from '@island.is/clients/user-profile' -import { handle204, handle404 } from '@island.is/clients/middlewares' -import { UpdateUserProfileInput } from '../dto/updateUserProfileInput' -import { CreateUserProfileInput } from '../dto/createUserProfileInput' -import { CreateSmsVerificationInput } from '../dto/createSmsVerificationInput' -import { CreateEmailVerificationInput } from '../dto/createEmalVerificationInput' -import { ConfirmSmsVerificationInput } from '../dto/confirmSmsVerificationInput' -import { ConfirmEmailVerificationInput } from '../dto/confirmEmailVerificationInput' -import { UserProfile } from '../userProfile.model' -import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools' -import { IslykillService } from '../islykill.service' -import { DataStatus } from '../types/dataStatus.enum' - -@Injectable() -export class UserProfileServiceV1 { - constructor( - private userProfileApi: UserProfileApi, - private readonly islyklarService: IslykillService, - ) {} - - userProfileApiWithAuth(auth: Auth) { - return this.userProfileApi.withMiddleware(new AuthMiddleware(auth)) - } - - async getIslykillProfile(user: User) { - try { - const islyklarData = await this.islyklarService.getIslykillSettings( - user.nationalId, - ) - - return { - nationalId: user.nationalId, - emailVerified: false, - mobilePhoneNumberVerified: false, - documentNotifications: false, - emailStatus: DataStatus.NOT_VERIFIED, - mobileStatus: DataStatus.NOT_VERIFIED, - - // Islyklar data: - mobilePhoneNumber: islyklarData?.mobile, - email: islyklarData?.email, - canNudge: islyklarData?.canNudge, - bankInfo: islyklarData?.bankInfo, - } - } catch (e) { - logger.error(JSON.stringify(e)) - return null - } - } - - async getUserProfile(user: User) { - try { - const profile = await handle204( - this.userProfileApiWithAuth( - user, - ).userProfileControllerFindOneByNationalIdRaw({ - nationalId: user.nationalId, - }), - ) - - if (profile === null) { - /** - * Even if userProfileApiWithAuth does not exist. - * Islykill data might exist for the user, so we need to get that, with default values in the userprofile data. - */ - return await this.getIslykillProfile(user) - } - - const islyklarData = await this.islyklarService.getIslykillSettings( - user.nationalId, - ) - return { - ...profile, - // Temporary solution while we still run the old user profile service. - mobilePhoneNumber: islyklarData?.mobile, - email: islyklarData?.email, - canNudge: islyklarData?.canNudge, - bankInfo: islyklarData?.bankInfo, - emailNotifications: islyklarData?.canNudge, - } - } catch (error) { - handle404(error) - } - } - - async createUserProfile( - input: CreateUserProfileInput, - user: User, - ): Promise { - const createUserDto: CreateUserProfileDto = { - nationalId: user.nationalId, - //temporary as schemas where not working properly - locale: input.locale as string, - smsCode: input.smsCode, - emailCode: input.emailCode, - emailStatus: input.emailStatus, - mobileStatus: input.mobileStatus, - - /** - * Mobile and email will be within islykill service - * Only here for verification purposes in userProfile.controller. - * Will be removed in controller before saving to db - */ - mobilePhoneNumber: input.mobilePhoneNumber, - email: input.email, - } - const request: UserProfileControllerCreateRequest = { - createUserProfileDto: createUserDto, - } - - const userProfileResponse = await this.userProfileApiWithAuth( - user, - ).userProfileControllerCreate(request) - - if (input.email || input.mobilePhoneNumber) { - const islyklarData = await this.islyklarService.getIslykillSettings( - user.nationalId, - ) - - const emailVerified = - userProfileResponse.emailStatus === DataStatus.VERIFIED - const mobileVerified = - userProfileResponse.mobileStatus === DataStatus.VERIFIED - if ( - (input.email && !emailVerified) || - (input.mobilePhoneNumber && !mobileVerified) - ) { - throw new ForbiddenError('Updating value verification invalid') - } - - if (islyklarData.noUserFound) { - await this.islyklarService.createIslykillSettings(user.nationalId, { - email: emailVerified ? input.email : undefined, - mobile: mobileVerified ? input.mobilePhoneNumber : undefined, - }) - } else { - await this.islyklarService.updateIslykillSettings(user.nationalId, { - email: emailVerified ? input.email : islyklarData.email, - mobile: mobileVerified - ? input.mobilePhoneNumber - : islyklarData.mobile, - bankInfo: islyklarData.bankInfo, - canNudge: islyklarData.canNudge, - }) - } - } - - return userProfileResponse - } - - async updateMeUserProfile( - input: UpdateUserProfileInput, - user: User, - ): Promise { - const updateUserDto: UpdateUserProfileDto = { - //temporary as schemas where not working properly - locale: input.locale as string, - documentNotifications: input.documentNotifications, - smsCode: input.smsCode, - emailCode: input.emailCode, - - /** - * Mobile and email will be within islykill service - * Only here for verification purposes in userProfile.controller. - * Will be removed in controller before saving to db - */ - mobilePhoneNumber: input.mobilePhoneNumber, - email: input.email, - } - const request: UserProfileControllerUpdateRequest = { - nationalId: user.nationalId, - updateUserProfileDto: updateUserDto, - } - - const islyklarData = await this.islyklarService.getIslykillSettings( - user.nationalId, - ) - - const updatedUserProfile = await this.userProfileApiWithAuth( - user, - ).userProfileControllerUpdate(request) - - const emailVerified = updatedUserProfile.emailStatus === DataStatus.VERIFIED - const mobileVerified = - updatedUserProfile.mobileStatus === DataStatus.VERIFIED - if ( - (input.email && !emailVerified) || - (input.mobilePhoneNumber && !mobileVerified) - ) { - throw new ForbiddenError('Updating value verification invalid') - } - - if (islyklarData.noUserFound) { - await this.islyklarService.createIslykillSettings(user.nationalId, { - email: input.email && emailVerified ? input.email : islyklarData.email, - mobile: - input.mobilePhoneNumber && mobileVerified - ? input.mobilePhoneNumber - : islyklarData.mobile, - }) - } else { - await this.islyklarService.updateIslykillSettings(user.nationalId, { - email: input.email && emailVerified ? input.email : islyklarData.email, - mobile: - input.mobilePhoneNumber && mobileVerified - ? input.mobilePhoneNumber - : islyklarData.mobile, - canNudge: input.canNudge ?? islyklarData.canNudge, - bankInfo: input.bankInfo ?? islyklarData.bankInfo, - }) - } - - return updatedUserProfile - } - - async createSmsVerification( - input: CreateSmsVerificationInput, - user: User, - ): Promise { - const createSmsVerificationDto = { nationalId: user.nationalId, ...input } - await this.userProfileApiWithAuth( - user, - ).userProfileControllerCreateSmsVerification({ createSmsVerificationDto }) - } - - async createEmailVerification( - input: CreateEmailVerificationInput, - user: User, - ): Promise { - const createEmailVerificationDto = { nationalId: user.nationalId, ...input } - await this.userProfileApiWithAuth( - user, - ).userProfileControllerCreateEmailVerification({ - createEmailVerificationDto, - }) - } - - async resendEmailVerification(user: User): Promise { - await this.userProfileApiWithAuth( - user, - ).userProfileControllerRecreateVerification({ - nationalId: user.nationalId, - }) - } - - async confirmSms( - input: ConfirmSmsVerificationInput, - user: User, - ): Promise { - const { ...confirmSmsDto } = input - return await this.userProfileApiWithAuth( - user, - ).userProfileControllerConfirmSms({ - nationalId: user.nationalId, - confirmSmsDto, - }) - } - - async confirmEmail( - input: ConfirmEmailVerificationInput, - user: User, - ): Promise { - const { ...confirmEmailDto } = input - return await this.userProfileApiWithAuth( - user, - ).userProfileControllerConfirmEmail({ - nationalId: user.nationalId, - confirmEmailDto, - }) - } -} diff --git a/libs/api/domains/user-profile/src/lib/V2/userProfile.service.ts b/libs/api/domains/user-profile/src/lib/V2/userProfile.service.ts index 7dd68700fe33..5181db290e3e 100644 --- a/libs/api/domains/user-profile/src/lib/V2/userProfile.service.ts +++ b/libs/api/domains/user-profile/src/lib/V2/userProfile.service.ts @@ -1,22 +1,24 @@ -import { BadRequestException, Injectable } from '@nestjs/common' +import { Injectable } from '@nestjs/common' +import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools' import { - ConfirmationDtoResponse, - UserProfileControllerFindUserProfileClientTypeEnum, PostNudgeDtoNudgeTypeEnum, + UserProfileControllerFindUserProfileClientTypeEnum, V2MeApi, V2UsersApi, } from '@island.is/clients/user-profile' -import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools' -import { IslykillService } from '../islykill.service' -import { UserProfile } from '../userProfile.model' +import { ApolloError } from 'apollo-server-express' +import { AdminUserProfile } from '../adminUserProfile.model' import { ActorProfile, ActorProfileResponse } from '../dto/actorProfile' -import { UpdateUserProfileInput } from '../dto/updateUserProfileInput' -import { CreateSmsVerificationInput } from '../dto/createSmsVerificationInput' import { CreateEmailVerificationInput } from '../dto/createEmalVerificationInput' +import { CreateSmsVerificationInput } from '../dto/createSmsVerificationInput' +import { DeleteIslykillValueInput } from '../dto/deleteIslykillValueInput' import { UpdateActorProfileInput } from '../dto/updateActorProfileInput' -import { AdminUserProfile } from '../adminUserProfile.model' +import { UpdateUserProfileInput } from '../dto/updateUserProfileInput' +import { IslykillService } from '../islykill.service' +import { DeleteIslykillSettings } from '../models/deleteIslykillSettings.model' +import { UserProfile } from '../userProfile.model' @Injectable() export class UserProfileServiceV2 { @@ -134,24 +136,6 @@ export class UserProfileServiceV2 { }) } - async confirmSms(): Promise { - throw new BadRequestException( - 'For User Profile V2 call updateUserProfile instead with mobilePhoneNumberVerificationCode', - ) - } - - async confirmEmail(): Promise { - throw new BadRequestException( - 'For User Profile V2 call updateUserProfile instead with emailVerificationCode', - ) - } - - async resendEmailVerification(): Promise { - throw new BadRequestException( - 'For User Profile V2 call createEmailVerification instead with email again', - ) - } - async getUserProfiles(user: User, search: string) { return this.v2UserProfileApiWithAuth( user, @@ -184,4 +168,26 @@ export class UserProfileServiceV2 { patchUserProfileDto: input, }) } + + async deleteIslykillValue( + input: DeleteIslykillValueInput, + user: User, + ): Promise { + const { nationalId } = await this.updateMeUserProfile( + { + ...(input.email && { email: '' }), + ...(input.mobilePhoneNumber && { mobilePhoneNumber: '' }), + }, + user, + ) + + if (!nationalId) { + throw new ApolloError('Failed to update user profile') + } + + return { + nationalId, + valid: true, + } + } } diff --git a/libs/api/domains/user-profile/src/lib/dto/confirmEmailVerificationInput.ts b/libs/api/domains/user-profile/src/lib/dto/confirmEmailVerificationInput.ts deleted file mode 100644 index a3d812048967..000000000000 --- a/libs/api/domains/user-profile/src/lib/dto/confirmEmailVerificationInput.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Field, InputType } from '@nestjs/graphql' -import { IsString } from 'class-validator' - -@InputType() -export class ConfirmEmailVerificationInput { - @Field(() => String) - @IsString() - hash!: string - - @Field(() => String) - @IsString() - email!: string -} diff --git a/libs/api/domains/user-profile/src/lib/dto/confirmSmsVerificationInput.ts b/libs/api/domains/user-profile/src/lib/dto/confirmSmsVerificationInput.ts deleted file mode 100644 index 6cd072bc950d..000000000000 --- a/libs/api/domains/user-profile/src/lib/dto/confirmSmsVerificationInput.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Field, InputType } from '@nestjs/graphql' -import { IsString } from 'class-validator' - -@InputType() -export class ConfirmSmsVerificationInput { - @Field(() => String) - @IsString() - code!: string - - @Field(() => String) - @IsString() - mobilePhoneNumber!: string -} diff --git a/libs/api/domains/user-profile/src/lib/userProfile.module.ts b/libs/api/domains/user-profile/src/lib/userProfile.module.ts index 973ad3c0f021..81683496ee17 100644 --- a/libs/api/domains/user-profile/src/lib/userProfile.module.ts +++ b/libs/api/domains/user-profile/src/lib/userProfile.module.ts @@ -11,7 +11,6 @@ import { IdentityClientModule } from '@island.is/clients/identity' import { FeatureFlagModule } from '@island.is/nest/feature-flags' import { UserProfileServiceV2 } from './V2/userProfile.service' -import { UserProfileServiceV1 } from './V1/userProfile.service' import { AdminUserProfileResolver } from './adminUserProfile.resolver' import { ActorProfileResolver } from './actorProfile.resolver' @@ -26,7 +25,6 @@ export class UserProfileModule { providers: [ UserProfileService, UserProfileServiceV2, - UserProfileServiceV1, UserProfileResolver, ActorProfileResolver, AdminUserProfileResolver, diff --git a/libs/api/domains/user-profile/src/lib/userProfile.resolver.ts b/libs/api/domains/user-profile/src/lib/userProfile.resolver.ts index 22aa08b390d6..59d978256274 100644 --- a/libs/api/domains/user-profile/src/lib/userProfile.resolver.ts +++ b/libs/api/domains/user-profile/src/lib/userProfile.resolver.ts @@ -1,5 +1,5 @@ -import { Args, Mutation, Query, Resolver } from '@nestjs/graphql' import { UseGuards } from '@nestjs/common' +import { Args, Mutation, Query, Resolver } from '@nestjs/graphql' import type { User } from '@island.is/auth-nest-tools' import { @@ -8,21 +8,19 @@ import { ScopesGuard, } from '@island.is/auth-nest-tools' -import { ConfirmEmailVerificationInput } from './dto/confirmEmailVerificationInput' -import { ConfirmSmsVerificationInput } from './dto/confirmSmsVerificationInput' -import { CreateSmsVerificationInput } from './dto/createSmsVerificationInput' import { CreateEmailVerificationInput } from './dto/createEmalVerificationInput' +import { CreateSmsVerificationInput } from './dto/createSmsVerificationInput' import { CreateUserProfileInput } from './dto/createUserProfileInput' -import { UpdateUserProfileInput } from './dto/updateUserProfileInput' import { DeleteIslykillValueInput } from './dto/deleteIslykillValueInput' -import { UserProfile } from './userProfile.model' -import { ConfirmResponse, Response } from './response.model' -import { DeleteIslykillSettings } from './models/deleteIslykillSettings.model' -import { UserProfileService } from './userProfile.service' -import { UserDeviceToken } from './userDeviceToken.model' -import { UserDeviceTokenInput } from './dto/userDeviceTokenInput' import { DeleteTokenResponse } from './dto/deleteTokenResponse' +import { UpdateUserProfileInput } from './dto/updateUserProfileInput' +import { UserDeviceTokenInput } from './dto/userDeviceTokenInput' +import { DeleteIslykillSettings } from './models/deleteIslykillSettings.model' import { UserProfileLocale } from './models/userProfileLocale.model' +import { Response } from './response.model' +import { UserDeviceToken } from './userDeviceToken.model' +import { UserProfile } from './userProfile.model' +import { UserProfileService } from './userProfile.service' @UseGuards(IdsUserGuard, ScopesGuard) @Resolver() @@ -85,28 +83,6 @@ export class UserProfileResolver { return Promise.resolve({ created: true }) } - @Mutation(() => Response, { nullable: true }) - async resendEmailVerification(@CurrentUser() user: User): Promise { - await this.userProfileService.resendEmailVerification(user) - return Promise.resolve({ created: true }) - } - - @Mutation(() => ConfirmResponse, { nullable: true }) - confirmSmsVerification( - @Args('input') input: ConfirmSmsVerificationInput, - @CurrentUser() user: User, - ): Promise { - return this.userProfileService.confirmSms(input, user) - } - - @Mutation(() => ConfirmResponse, { nullable: true }) - confirmEmailVerification( - @Args('input') input: ConfirmEmailVerificationInput, - @CurrentUser() user: User, - ): Promise { - return this.userProfileService.confirmEmail(input, user) - } - @Mutation(() => UserDeviceToken) addUserProfileDeviceToken( @Args('input') input: UserDeviceTokenInput, diff --git a/libs/api/domains/user-profile/src/lib/userProfile.service.ts b/libs/api/domains/user-profile/src/lib/userProfile.service.ts index 0b51690dfc9c..71947e3eb5a2 100644 --- a/libs/api/domains/user-profile/src/lib/userProfile.service.ts +++ b/libs/api/domains/user-profile/src/lib/userProfile.service.ts @@ -1,52 +1,35 @@ import { Injectable } from '@nestjs/common' import { ApolloError } from 'apollo-server-express' +import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools' +import { handle204 } from '@island.is/clients/middlewares' import { ActorLocaleLocaleEnum, - ConfirmationDtoResponse, UserProfileApi, } from '@island.is/clients/user-profile' -import { handle204 } from '@island.is/clients/middlewares' -import { FeatureFlagService, Features } from '@island.is/nest/feature-flags' -import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools' -import { DeleteIslykillSettings } from './models/deleteIslykillSettings.model' -import { UpdateUserProfileInput } from './dto/updateUserProfileInput' -import { CreateUserProfileInput } from './dto/createUserProfileInput' -import { CreateSmsVerificationInput } from './dto/createSmsVerificationInput' import { CreateEmailVerificationInput } from './dto/createEmalVerificationInput' -import { ConfirmSmsVerificationInput } from './dto/confirmSmsVerificationInput' -import { ConfirmEmailVerificationInput } from './dto/confirmEmailVerificationInput' +import { CreateSmsVerificationInput } from './dto/createSmsVerificationInput' +import { CreateUserProfileInput } from './dto/createUserProfileInput' import { DeleteIslykillValueInput } from './dto/deleteIslykillValueInput' -import { UserProfile } from './userProfile.model' +import { UpdateActorProfileInput } from './dto/updateActorProfileInput' +import { UpdateUserProfileInput } from './dto/updateUserProfileInput' import { UserDeviceTokenInput } from './dto/userDeviceTokenInput' -import { UserProfileServiceV1 } from './V1/userProfile.service' +import { DeleteIslykillSettings } from './models/deleteIslykillSettings.model' +import { UserProfile } from './userProfile.model' import { UserProfileServiceV2 } from './V2/userProfile.service' -import { UpdateActorProfileInput } from './dto/updateActorProfileInput' @Injectable() export class UserProfileService { constructor( private userProfileApi: UserProfileApi, private userProfileServiceV2: UserProfileServiceV2, - private userProfileServiceV1: UserProfileServiceV1, - private featureFlagService: FeatureFlagService, ) {} userProfileApiWithAuth(auth: Auth) { return this.userProfileApi.withMiddleware(new AuthMiddleware(auth)) } - private async getService(user: User) { - const isV2 = await this.featureFlagService.getValue( - Features.isIASSpaPagesEnabled, - false, - user, - ) - - return isV2 ? this.userProfileServiceV2 : this.userProfileServiceV1 - } - async getUserProfileLocale(user: User) { // This always calls the user profile API V1, which calls the actor API const locale = await handle204( @@ -61,38 +44,6 @@ export class UserProfileService { } } - async getUserProfile(user: User) { - const service = await this.getService(user) - - return service.getUserProfile(user) - } - - async createUserProfile( - input: CreateUserProfileInput, - user: User, - ): Promise { - const service = await this.getService(user) - - return service.createUserProfile(input, user) - } - - async updateMeUserProfile( - input: UpdateUserProfileInput, - user: User, - ): Promise { - const service = await this.getService(user) - - return service.updateMeUserProfile(input, user) - } - - async updateUserProfile( - nationalId: string, - input: UpdateUserProfileInput, - user: User, - ): Promise { - return this.userProfileServiceV2.updateUserProfile(input, user, nationalId) - } - async deleteIslykillValue( input: DeleteIslykillValueInput, user: User, @@ -115,46 +66,44 @@ export class UserProfileService { } } - async createSmsVerification( - input: CreateSmsVerificationInput, - user: User, - ): Promise { - const service = await this.getService(user) - - return service.createSmsVerification(input, user) + async getUserProfile(user: User) { + return this.userProfileServiceV2.getUserProfile(user) } - async createEmailVerification( - input: CreateEmailVerificationInput, + async createUserProfile( + input: CreateUserProfileInput, user: User, - ): Promise { - const service = await this.getService(user) - - return service.createEmailVerification(input, user) + ): Promise { + return this.userProfileServiceV2.createUserProfile(input, user) } - async resendEmailVerification(user: User): Promise { - const service = await this.getService(user) - - return service.resendEmailVerification(user) + async updateMeUserProfile( + input: UpdateUserProfileInput, + user: User, + ): Promise { + return this.userProfileServiceV2.updateMeUserProfile(input, user) } - async confirmSms( - input: ConfirmSmsVerificationInput, + async updateUserProfile( + nationalId: string, + input: UpdateUserProfileInput, user: User, - ): Promise { - const service = await this.getService(user) - - return service.confirmSms(input, user) + ): Promise { + return this.userProfileServiceV2.updateUserProfile(input, user, nationalId) } - async confirmEmail( - input: ConfirmEmailVerificationInput, + async createSmsVerification( + input: CreateSmsVerificationInput, user: User, - ): Promise { - const service = await this.getService(user) + ): Promise { + return this.userProfileServiceV2.createSmsVerification(input, user) + } - return service.confirmEmail(input, user) + async createEmailVerification( + input: CreateEmailVerificationInput, + user: User, + ): Promise { + return this.userProfileServiceV2.createEmailVerification(input, user) } addDeviceToken(input: UserDeviceTokenInput, user: User) { diff --git a/libs/portals/my-pages/graphql/src/hooks/profile/useResendEmailVerification.ts b/libs/portals/my-pages/graphql/src/hooks/profile/useResendEmailVerification.ts deleted file mode 100644 index efd1394a3455..000000000000 --- a/libs/portals/my-pages/graphql/src/hooks/profile/useResendEmailVerification.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { useMutation } from '@apollo/client' -import { Mutation } from '@island.is/api/schema' -import { RESEND_EMAIL_VERIFICATION } from '../../lib/mutations/resendEmailVerification' - -export const useResendEmailVerification = () => { - const [resendEmailVerificationMutation, { loading, error }] = useMutation< - Mutation, - {} - >(RESEND_EMAIL_VERIFICATION) - - const resendEmailVerification = () => { - return resendEmailVerificationMutation() - } - - return { - resendEmailVerification, - loading, - error, - } -} diff --git a/libs/portals/my-pages/graphql/src/index.ts b/libs/portals/my-pages/graphql/src/index.ts index f94f76e92d26..527d31e51137 100644 --- a/libs/portals/my-pages/graphql/src/index.ts +++ b/libs/portals/my-pages/graphql/src/index.ts @@ -13,7 +13,6 @@ export * from './lib/queries/getUserProfile' export * from './lib/queries/alertBanners' export * from './lib/mutations/createUserProfile' export * from './lib/mutations/updateUserProfile' -export * from './lib/mutations/resendEmailVerification' export * from './lib/mutations/createPkPass' export * from './lib/client' export * from './hooks/documents/useListDocuments' @@ -24,7 +23,6 @@ export * from './hooks/profile/useUpdateUserProfile' export * from './hooks/profile/useCreateUserProfile' export * from './hooks/profile/useVerifySms' export * from './hooks/profile/useVerifyEmail' -export * from './hooks/profile/useResendEmailVerification' export * from './hooks/profile/useUpdateOrCreateUserProfile' export * from './hooks/profile/useDeleteIslykillValue' export * from './hooks/passport/usePassport' diff --git a/libs/portals/my-pages/graphql/src/lib/mutations/resendEmailVerification.ts b/libs/portals/my-pages/graphql/src/lib/mutations/resendEmailVerification.ts deleted file mode 100644 index 7e14c6320678..000000000000 --- a/libs/portals/my-pages/graphql/src/lib/mutations/resendEmailVerification.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { gql } from '@apollo/client' - -export const RESEND_EMAIL_VERIFICATION = gql` - mutation resendEmailVerification { - resendEmailVerification { - created - } - } -` diff --git a/libs/portals/my-pages/information/src/components/PersonalInformation/Forms/ProfileForm/ProfileForm.tsx b/libs/portals/my-pages/information/src/components/PersonalInformation/Forms/ProfileForm/ProfileForm.tsx index 3572dd96d6c1..a18dc425f3ef 100644 --- a/libs/portals/my-pages/information/src/components/PersonalInformation/Forms/ProfileForm/ProfileForm.tsx +++ b/libs/portals/my-pages/information/src/components/PersonalInformation/Forms/ProfileForm/ProfileForm.tsx @@ -66,7 +66,6 @@ export const ProfileForm: FC> = ({ const [internalLoading, setInternalLoading] = useState(false) const [showPaperMail, setShowPaperMail] = useState(false) const [showDropModal, setShowDropModal] = useState() - const [v2UserProfileEnabled, setV2UserProfileEnabled] = useState(false) const { deleteIslykillValue, loading: deleteLoading } = useDeleteIslykillValue() const userInfo = useUserInfo() @@ -76,23 +75,6 @@ export const ProfileForm: FC> = ({ const [confirmNudge] = useConfirmNudgeMutation() const isCompany = userInfo?.profile?.subjectType === 'legalEntity' - const isV2UserProfileEnabled = async () => { - const ffEnabled = await featureFlagClient.getValue( - Features.isIASSpaPagesEnabled, - false, - ) - - if (ffEnabled) { - setV2UserProfileEnabled(!isCompany) - } - } - - /* Should disable email and phone input with deeplink to IDS */ - useEffect(() => { - isV2UserProfileEnabled() - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) - /** * Creates a link to the IDS user profile page. * By setting the state to update, the user will exit the onboarding process after updating the desired field. @@ -210,7 +192,7 @@ export const ProfileForm: FC> = ({ loading={userLoading} > {!userLoading && - (v2UserProfileEnabled ? ( + (!isCompany ? ( > = ({ loading={userLoading} > {!userLoading && - (v2UserProfileEnabled ? ( + (!isCompany ? (