From 53359b5a983183f2fba4fced08febe7ad8ff0d1e Mon Sep 17 00:00:00 2001 From: Pasindu Yeshan Date: Wed, 25 Sep 2024 21:16:00 +0530 Subject: [PATCH 1/2] Hide multi email, mobile specific attributes --- .changeset/light-seas-dance.md | 6 ++++++ apps/myaccount/src/components/profile/profile.tsx | 8 ++++++++ features/admin.users.v1/components/user-profile.tsx | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100644 .changeset/light-seas-dance.md diff --git a/.changeset/light-seas-dance.md b/.changeset/light-seas-dance.md new file mode 100644 index 00000000000..baea536ec5c --- /dev/null +++ b/.changeset/light-seas-dance.md @@ -0,0 +1,6 @@ +--- +"@wso2is/admin.users.v1": patch +"@wso2is/myaccount": patch +--- + +Hide multi email and mobile specifc attributes. diff --git a/apps/myaccount/src/components/profile/profile.tsx b/apps/myaccount/src/components/profile/profile.tsx index a22343c3f56..7dfff8e1826 100644 --- a/apps/myaccount/src/components/profile/profile.tsx +++ b/apps/myaccount/src/components/profile/profile.tsx @@ -75,6 +75,10 @@ import { CommonUtils } from "../../utils"; import { EditSection, SettingsSection } from "../shared"; import { MobileUpdateWizard } from "../shared/mobile-update-wizard"; +// TODO: Remove this once multiple email and mobile support is onboarded. +const multipleEmailMobileFeatureSpecificSchemaNames: string[] = [ "emailAddresses", "verifiedEmailAddresses", + "mobileNumbers", "verifiedMobileNumbers" ]; + /** * Prop types for the basic details component. * Also see {@link Profile.defaultProps} @@ -739,6 +743,10 @@ export const Profile: FunctionComponent = (props: ProfileProps): R const isProfileUsernameReadonly: boolean = config.ui.isProfileUsernameReadonly; const { displayName, name } = schema; + if (multipleEmailMobileFeatureSpecificSchemaNames?.includes(name)) { + return; + } + if (isProfileUsernameReadonly) { const usernameClaim: string = "username"; diff --git a/features/admin.users.v1/components/user-profile.tsx b/features/admin.users.v1/components/user-profile.tsx index ea690948348..c814bf8bf74 100644 --- a/features/admin.users.v1/components/user-profile.tsx +++ b/features/admin.users.v1/components/user-profile.tsx @@ -66,6 +66,10 @@ import { updateUserInfo } from "../api"; import { AdminAccountTypes, LocaleJoiningSymbol, UserManagementConstants } from "../constants"; import { AccountConfigSettingsInterface, SchemaAttributeValueInterface, SubValueInterface } from "../models"; +// TODO: Remove this once multiple email and mobile support is onboarded. +const multipleEmailMobileFeatureSpecificSchemaNames: string[] = [ "emailAddresses", "verifiedEmailAddresses", + "mobileNumbers", "verifiedMobileNumbers" ]; + /** * Prop types for the basic details component. */ @@ -1524,6 +1528,10 @@ export const UserProfile: FunctionComponent = ( const domainName: string[] = profileInfo?.get(schema.name)?.toString().split("/"); + if (multipleEmailMobileFeatureSpecificSchemaNames?.includes(schema?.name)) { + return; + } + return ( From 9e1ff061a836d8406c21b214d978ce8f88b2499c Mon Sep 17 00:00:00 2001 From: Pasindu Yeshan Date: Thu, 26 Sep 2024 10:54:44 +0530 Subject: [PATCH 2/2] disabled eslint warning for hasRequiredScopes. --- apps/myaccount/src/components/profile/profile.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/myaccount/src/components/profile/profile.tsx b/apps/myaccount/src/components/profile/profile.tsx index 7dfff8e1826..4127336638e 100644 --- a/apps/myaccount/src/components/profile/profile.tsx +++ b/apps/myaccount/src/components/profile/profile.tsx @@ -18,13 +18,16 @@ import { ProfileConstants } from "@wso2is/core/constants"; import { IdentityAppsApiException } from "@wso2is/core/exceptions"; -import { - getUserNameWithoutDomain, - hasRequiredScopes, +/** + * `useRequiredScopes` is not supported for myaccount. + */ +/* eslint-disable no-restricted-imports */ +import { getUserNameWithoutDomain, hasRequiredScopes, isFeatureEnabled, resolveUserDisplayName, resolveUserEmails } from "@wso2is/core/helpers"; +/* eslint-enable */ import { ProfileSchemaInterface, SBACInterface,