diff --git a/.changeset/stupid-bikes-glow.md b/.changeset/stupid-bikes-glow.md new file mode 100644 index 00000000000..5850c2df549 --- /dev/null +++ b/.changeset/stupid-bikes-glow.md @@ -0,0 +1,27 @@ +--- +"@wso2is/admin.server-configurations.v1": patch +"@wso2is/admin.remote-userstores.v1": patch +"@wso2is/admin.email-management.v1": patch +"@wso2is/admin.email-providers.v1": patch +"@wso2is/admin.administrators.v1": patch +"@wso2is/admin.api-resources.v1": patch +"@wso2is/admin.api-resources.v2": patch +"@wso2is/admin.login-flow.ai.v1": patch +"@wso2is/admin.organizations.v1": patch +"@wso2is/admin.sms-providers.v1": patch +"@wso2is/admin.applications.v1": patch +"@wso2is/admin.org-insights.v1": patch +"@wso2is/admin.branding.ai.v1": patch +"@wso2is/admin.extensions.v1": patch +"@wso2is/admin.claims.v1": patch +"@wso2is/admin.groups.v1": patch +"@wso2is/admin.roles.v2": patch +"@wso2is/admin.users.v1": patch +"@wso2is/admin.core.v1": patch +"@wso2is/admin.home.v1": patch +"@wso2is/admin.logs.v1": patch +"@wso2is/console": patch +"@wso2is/i18n": patch +--- + +Move common i18n extensions in console app to i18n module diff --git a/apps/console/src/extensions/i18n/models/extensions.ts b/apps/console/src/extensions/i18n/models/extensions.ts index 6a9e303f7e8..462037ab17a 100755 --- a/apps/console/src/extensions/i18n/models/extensions.ts +++ b/apps/console/src/extensions/i18n/models/extensions.ts @@ -20,94 +20,6 @@ import { FormAttributes, Notification, NotificationItem } from "@wso2is/i18n"; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Extensions { - common: { - community: string; - help: { - communityLinks: { - discord: string; - stackOverflow: string; - }; - docSiteLink: string; - helpCenterLink: { - title: string; - subtitle: string; - }; - helpDropdownLink: string; - }; - learnMore: string; - quickStart: { - greeting: { - alternativeHeading: string; - heading: string; - subHeading: string; - }; - sections: { - addSocialLogin: { - actions: { - setup: string; - view: string; - }; - description: string; - heading: string; - }; - integrateApps: { - actions: { - create: string; - manage: string; - view: string; - }; - capabilities: { - sso: string; - mfa: string; - social: string; - }; - description: string; - heading: string; - }; - learn: { - actions: { - view: string; - }; - description: string; - heading: string; - }; - manageUsers: { - actions: { - create: string; - manage: string; - view: string; - }; - capabilities: { - collaborators: string; - customers: string; - groups: string; - }; - description: string; - heading: string; - }; - asgardeoTryIt: { - errorMessages: { - appCreateGeneric: { - message: string; - description: string; - }; - appCreateDuplicate: { - message: string; - description: string; - }; - } - } - }; - }; - upgrade: string; - dropdown: { - footer: { - privacyPolicy: string; - cookiePolicy: string; - termsOfService: string; - } - }; - }; console: { application: { quickStart: { diff --git a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts index 8883120e4a2..20a6ee45e33 100755 --- a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts @@ -26,101 +26,6 @@ import { Extensions } from "../../models"; /* eslint-disable max-len */ /* eslint-disable sort-keys */ export const extensions: Extensions = { - common: { - community: "Community", - help: { - communityLinks: { - discord: "Ask on Discord", - stackOverflow: "Ask on Stack Overflow" - }, - docSiteLink: "Documentation", - helpCenterLink: { - title: "Contact Support", - subtitle: "Talk to the {{productName}} team to obtain personalized assistance." - }, - helpDropdownLink: "Get Help" - }, - learnMore: "Learn More", - quickStart: { - greeting: { - alternativeHeading: "Welcome back, {{username}}!", - heading: "Welcome, {{username}}!", - subHeading: "Here’s how you can get started" - }, - sections: { - addSocialLogin: { - actions: { - setup: "Set Up Social Connections", - view: "View Social Connections" - }, - description: - "Let your users log in to your applications with an Identity Provider of " + "their choice", - heading: "Add social login" - }, - integrateApps: { - actions: { - create: "Register Application", - manage: "Explore Applications", - view: "View Applications" - }, - capabilities: { - sso: "SSO", - mfa: "MFA", - social: "Social Login" - }, - description: - "Register your app and design the user login experience you want by configuring " + - "SSO, MFA, social login, and various flexible authentication rules.", - heading: "Add login to your apps" - }, - learn: { - actions: { - view: "View Docs" - }, - description: - "Get started using Asgardeo. Implement authentication for any kind of application " + - "in minutes.", - heading: "Learn" - }, - manageUsers: { - actions: { - create: "Add Users", - manage: "Manage Users", - view: "View Users" - }, - capabilities: { - collaborators: "Administrators", - customers: "Users", - groups: "User Groups" - }, - description: - "Create user accounts for users and invite administrators to your organization. " + - "Allow your users to securely self-manage their profiles.", - heading: "Manage users and groups" - }, - asgardeoTryIt: { - errorMessages: { - appCreateGeneric: { - message: "Something went wrong!", - description: "Failed to initialize the Try It app." - }, - appCreateDuplicate: { - message: "Application already exists!", - description: "Please delete the existing {{productName}} Try It application." - } - } - } - } - }, - upgrade: "Upgrade", - dropdown: { - footer: { - privacyPolicy: "Privacy", - cookiePolicy: "Cookies", - termsOfService: "Terms" - } - } - }, console: { application: { quickStart: { diff --git a/features/admin.administrators.v1/components/guests/guest-users.tsx b/features/admin.administrators.v1/components/guests/guest-users.tsx index 264f708881e..444fb13d97f 100644 --- a/features/admin.administrators.v1/components/guests/guest-users.tsx +++ b/features/admin.administrators.v1/components/guests/guest-users.tsx @@ -306,7 +306,7 @@ const GuestUsersPage: FunctionComponent = ( - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } diff --git a/features/admin.administrators.v1/components/guests/invitee-role-selection.tsx b/features/admin.administrators.v1/components/guests/invitee-role-selection.tsx index 69e0a5876d7..164ff123002 100644 --- a/features/admin.administrators.v1/components/guests/invitee-role-selection.tsx +++ b/features/admin.administrators.v1/components/guests/invitee-role-selection.tsx @@ -147,7 +147,7 @@ export const InviteeRoleSelection: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } diff --git a/features/admin.administrators.v1/components/guests/user-roles-edit.tsx b/features/admin.administrators.v1/components/guests/user-roles-edit.tsx index 77154178454..c9b746b029a 100644 --- a/features/admin.administrators.v1/components/guests/user-roles-edit.tsx +++ b/features/admin.administrators.v1/components/guests/user-roles-edit.tsx @@ -16,7 +16,7 @@ * under the License. */ -import { Show } from "@wso2is/access-control"; +import { Show, useRequiredScopes } from "@wso2is/access-control"; import { AppState, FeatureConfigInterface, @@ -27,7 +27,6 @@ import { APPLICATION_DOMAIN, INTERNAL_DOMAIN } from "@wso2is/admin.roles.v2/cons import { RealmConfigInterface } from "@wso2is/admin.server-configurations.v1/models"; import { UserRolePermissions } from "@wso2is/admin.users.v1/components/user-role-permissions"; import { RolePermissions } from "@wso2is/admin.users.v1/components/wizard/user-role-permissions"; -import { hasRequiredScopes } from "@wso2is/core/helpers"; import { AlertInterface, AlertLevels, @@ -109,7 +108,7 @@ export const UserRolesList: FunctionComponent = ( const { getLink } = useDocumentation(); const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features); - const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes); + const hasUserUpdatePermissions: boolean = useRequiredScopes(featureConfig?.users?.scopes?.update); const [ showAddNewRoleModal, setAddNewRoleModalView ] = useState(false); const [ roleList, setRoleList ] = useState([]); @@ -696,9 +695,8 @@ export const UserRolesList: FunctionComponent = ( { t("user:updateUser.roles.editRoles.heading") } - { !hasRequiredScopes(featureConfig?.users, - featureConfig?.users?.scopes?.update, - allowedScopes) || (user?.userName === realmConfigs?.adminUser + { !hasUserUpdatePermissions + || (user?.userName === realmConfigs?.adminUser && authenticatedUser !== user?.userName) ? ( <> @@ -714,7 +712,7 @@ export const UserRolesList: FunctionComponent = ( link={ getLink("manage.users.collaboratorAccounts." + "roles.learnMore") } > - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) @@ -759,12 +757,7 @@ export const UserRolesList: FunctionComponent = ( "modal-unselected-roles" } readOnly={ - !hasRequiredScopes( - featureConfig?.users, - featureConfig?.users - ?.scopes?.update, - allowedScopes - ) + !hasUserUpdatePermissions || ( user?.userName === realmConfigs?.adminUser && authenticatedUser @@ -785,8 +778,7 @@ export const UserRolesList: FunctionComponent = ( ) } - { !hasRequiredScopes(featureConfig?.users, featureConfig?.users?.scopes?.update, - allowedScopes) || (user?.userName === realmConfigs?.adminUser + { !hasUserUpdatePermissions || (user?.userName === realmConfigs?.adminUser && authenticatedUser !== user?.userName) && ( diff --git a/features/admin.administrators.v1/pages/administrator-settings.tsx b/features/admin.administrators.v1/pages/administrator-settings.tsx index cbf2f31827b..3e63539d57f 100644 --- a/features/admin.administrators.v1/pages/administrator-settings.tsx +++ b/features/admin.administrators.v1/pages/administrator-settings.tsx @@ -203,7 +203,7 @@ export const AdminSettingsPage: FunctionComponent = - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.administrators.v1/pages/administrators.tsx b/features/admin.administrators.v1/pages/administrators.tsx index 1b7c1212de0..23dab8dc619 100644 --- a/features/admin.administrators.v1/pages/administrators.tsx +++ b/features/admin.administrators.v1/pages/administrators.tsx @@ -1581,7 +1581,7 @@ const CollaboratorsPage: FunctionComponent = ( - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.administrators.v1/wizard/steps/admin-user-basic.tsx b/features/admin.administrators.v1/wizard/steps/admin-user-basic.tsx index 71400471bd0..5b589ddc4fe 100644 --- a/features/admin.administrators.v1/wizard/steps/admin-user-basic.tsx +++ b/features/admin.administrators.v1/wizard/steps/admin-user-basic.tsx @@ -519,7 +519,7 @@ export const AddAdminUserBasic: React.FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } diff --git a/features/admin.api-resources.v1/components/api-resource-panes/authorization-api-resource.tsx b/features/admin.api-resources.v1/components/api-resource-panes/authorization-api-resource.tsx index 81d1e0e404a..948a0b4441f 100644 --- a/features/admin.api-resources.v1/components/api-resource-panes/authorization-api-resource.tsx +++ b/features/admin.api-resources.v1/components/api-resource-panes/authorization-api-resource.tsx @@ -81,7 +81,7 @@ export const AuthorizationAPIResource: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.api-resources.v1/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx b/features/admin.api-resources.v1/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx index d7e43987b8d..738ba0e4c82 100644 --- a/features/admin.api-resources.v1/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx +++ b/features/admin.api-resources.v1/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx @@ -101,7 +101,7 @@ export const AddAPIResourceAuthorization: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } @@ -123,7 +123,7 @@ export const AddAPIResourceAuthorization: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.api-resources.v1/pages/api-resources.tsx b/features/admin.api-resources.v1/pages/api-resources.tsx index cdb61971d48..376cb4ee1df 100644 --- a/features/admin.api-resources.v1/pages/api-resources.tsx +++ b/features/admin.api-resources.v1/pages/api-resources.tsx @@ -235,7 +235,7 @@ const APIResourcesPage: FunctionComponent = ( - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.api-resources.v2/components/api-resource-panes/authorization-api-resource.tsx b/features/admin.api-resources.v2/components/api-resource-panes/authorization-api-resource.tsx index 41c2942808f..9d628f537cc 100644 --- a/features/admin.api-resources.v2/components/api-resource-panes/authorization-api-resource.tsx +++ b/features/admin.api-resources.v2/components/api-resource-panes/authorization-api-resource.tsx @@ -81,7 +81,7 @@ export const AuthorizationAPIResource: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.api-resources.v2/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx b/features/admin.api-resources.v2/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx index 6947359c76f..eff4ad4e425 100644 --- a/features/admin.api-resources.v2/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx +++ b/features/admin.api-resources.v2/components/wizard/add-api-resource-steps/add-api-resource-authorization.tsx @@ -100,7 +100,7 @@ export const AddAPIResourceAuthorization: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } @@ -122,7 +122,7 @@ export const AddAPIResourceAuthorization: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.api-resources.v2/pages/api-resources.tsx b/features/admin.api-resources.v2/pages/api-resources.tsx index d3b00eaa024..e5fbe3bc288 100644 --- a/features/admin.api-resources.v2/pages/api-resources.tsx +++ b/features/admin.api-resources.v2/pages/api-resources.tsx @@ -258,7 +258,7 @@ const APIResourcesPage: FunctionComponent = ( - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.applications.v1/components/api-authorization/api-authorization.tsx b/features/admin.applications.v1/components/api-authorization/api-authorization.tsx index 3c81c91814a..6a22f389da4 100644 --- a/features/admin.applications.v1/components/api-authorization/api-authorization.tsx +++ b/features/admin.applications.v1/components/api-authorization/api-authorization.tsx @@ -16,9 +16,9 @@ * under the License. */ +import { useRequiredScopes } from "@wso2is/access-control"; import { useAPIResources } from "@wso2is/admin.api-resources.v2/api"; import { AppState, FeatureConfigInterface, history } from "@wso2is/admin.core.v1"; -import { hasRequiredScopes } from "@wso2is/core/helpers"; import { AlertInterface, AlertLevels, IdentifiableComponentInterface, SBACInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; import { @@ -97,7 +97,6 @@ export const APIAuthorization: FunctionComponent const [ hideAuthorizeAPIResourceButton, setHideAuthorizeAPIResourceButton ] = useState(true); const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features); - const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes); const path: string[] = history.location.pathname.split("/"); const appId: string = path[path.length - 1].split("#")[0]; @@ -181,21 +180,13 @@ export const APIAuthorization: FunctionComponent } }, [ isUpdateData ]); - /** - * Check scopes available for update API resources. - * - * @returns `true` if scopes are available for update API resources. - */ - const isScopesAvailableForUpdate = (): boolean => { - return hasRequiredScopes(featureConfig?.applications, - featureConfig?.applications?.scopes?.update, allowedScopes); - }; + const hasApplicationUpdatePermissions: boolean = useRequiredScopes(featureConfig?.applications?.scopes?.update); /** * Set hide authorize API resource button. */ useEffect(() => { - const isScopesAvailable: boolean = isScopesAvailableForUpdate(); + const isScopesAvailable: boolean = hasApplicationUpdatePermissions; const hideAuthorizeAPIResourceButton: boolean = !isScopesAvailable || allAPIResourcesListData?.apiResources?.length === 0 || subscribedAPIResourcesListData?.length === 0; @@ -324,7 +315,7 @@ export const APIAuthorization: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } @@ -357,7 +348,7 @@ export const APIAuthorization: FunctionComponent subscribedAPIResourcesListData={ subscribedAPIResourcesListData } subscribedAPIResourcesFetchRequestError= { subscribedAPIResourcesFetchRequestError } - isScopesAvailableForUpdate={ isScopesAvailableForUpdate() } + isScopesAvailableForUpdate={ hasApplicationUpdatePermissions } isShownPlaceholder={ isShownPlaceholder } setRemoveSubscribedAPIResource={ setRemoveSubscribedAPIResource } bulkChangeAllAuthorizedScopes={ bulkChangeAllAuthorizedScopes } diff --git a/features/admin.applications.v1/components/api-authorization/wizard/authorize-api-resource.tsx b/features/admin.applications.v1/components/api-authorization/wizard/authorize-api-resource.tsx index 3adf4684d70..b848309db11 100644 --- a/features/admin.applications.v1/components/api-authorization/wizard/authorize-api-resource.tsx +++ b/features/admin.applications.v1/components/api-authorization/wizard/authorize-api-resource.tsx @@ -729,7 +729,7 @@ export const AuthorizeAPIResource: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.applications.v1/components/forms/advanced-configurations-form.tsx b/features/admin.applications.v1/components/forms/advanced-configurations-form.tsx index 3f5d842fdc9..ad9a17ff7e8 100644 --- a/features/admin.applications.v1/components/forms/advanced-configurations-form.tsx +++ b/features/admin.applications.v1/components/forms/advanced-configurations-form.tsx @@ -610,7 +610,7 @@ export const AdvancedConfigurationsForm: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } diff --git a/features/admin.applications.v1/components/my-account/my-account-overview.tsx b/features/admin.applications.v1/components/my-account/my-account-overview.tsx index 556a581266b..81ed8f5a55d 100644 --- a/features/admin.applications.v1/components/my-account/my-account-overview.tsx +++ b/features/admin.applications.v1/components/my-account/my-account-overview.tsx @@ -62,7 +62,7 @@ const MyAccountOverview: FunctionComponent = ({ link={ getLink("develop.applications.myaccount.overview.learnMore") } > Learn More diff --git a/features/admin.applications.v1/components/try-it/try-it-create-wizard.tsx b/features/admin.applications.v1/components/try-it/try-it-create-wizard.tsx index aba46eb82d1..8b13c692a7f 100644 --- a/features/admin.applications.v1/components/try-it/try-it-create-wizard.tsx +++ b/features/admin.applications.v1/components/try-it/try-it-create-wizard.tsx @@ -339,10 +339,10 @@ const TryItCreateWizard: FunctionComponent = ( ApplicationManagementConstants.ERROR_CODE_APPLICATION_ALREADY_EXISTS) { closeWizard(); dispatch(addAlert({ - description: t("extensions:common.quickStart.sections.asgardeoTryIt.errorMessages." + + description: t("console:common.quickStart.sections.asgardeoTryIt.errorMessages." + "appCreateDuplicate.description", { productName }), level: AlertLevels.ERROR, - message: t("extensions:common.quickStart.sections.asgardeoTryIt.errorMessages." + + message: t("console:common.quickStart.sections.asgardeoTryIt.errorMessages." + "appCreateDuplicate.message") })); @@ -350,10 +350,10 @@ const TryItCreateWizard: FunctionComponent = ( } else { closeWizard(); dispatch(addAlert({ - description: t("extensions:common.quickStart.sections.asgardeoTryIt.errorMessages." + + description: t("console:common.quickStart.sections.asgardeoTryIt.errorMessages." + "appCreateGeneric.description"), level: AlertLevels.ERROR, - message: t("extensions:common.quickStart.sections.asgardeoTryIt.errorMessages." + + message: t("console:common.quickStart.sections.asgardeoTryIt.errorMessages." + "appCreateGeneric.message") })); diff --git a/features/admin.branding.ai.v1/components/branding-ai-banner.tsx b/features/admin.branding.ai.v1/components/branding-ai-banner.tsx index e8f648d29a5..4a6f521e3ab 100644 --- a/features/admin.branding.ai.v1/components/branding-ai-banner.tsx +++ b/features/admin.branding.ai.v1/components/branding-ai-banner.tsx @@ -116,7 +116,7 @@ const BrandingAIBanner: FunctionComponent - + Learn more diff --git a/features/admin.claims.v1/pages/claim-dialects.tsx b/features/admin.claims.v1/pages/claim-dialects.tsx index dd241ffa48c..832ac9709ca 100644 --- a/features/admin.claims.v1/pages/claim-dialects.tsx +++ b/features/admin.claims.v1/pages/claim-dialects.tsx @@ -245,7 +245,7 @@ const ClaimDialectsPage: FunctionComponent = ( - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.core.v1/components/header.tsx b/features/admin.core.v1/components/header.tsx index e85c2923a2f..17ffb396880 100644 --- a/features/admin.core.v1/components/header.tsx +++ b/features/admin.core.v1/components/header.tsx @@ -176,7 +176,7 @@ export const Header: FunctionComponent = (props: HeaderPro startIcon={ } data-testid="dev-doc-site-link" > - { I18n.instance.t("extensions:common.help.docSiteLink") as ReactNode } + { I18n.instance.t("console:common.help.docSiteLink") as ReactNode } ), (window["AppUtils"].getConfig().extensions.getHelp) && ( @@ -188,7 +188,7 @@ export const Header: FunctionComponent = (props: HeaderPro className="oxygen-user-dropdown-button" onClick={ handleHelpMenuClick } > - { I18n.instance.t("extensions:common.help.helpDropdownLink") as ReactNode } + { I18n.instance.t("console:common.help.helpDropdownLink") as ReactNode } = (props: HeaderPro primary={ ( - { t("extensions:common.help.helpCenterLink.title") } + { t("console:common.help.helpCenterLink.title") } } label={ t(FeatureStatusLabel.PREMIUM) } @@ -231,7 +231,7 @@ export const Header: FunctionComponent = (props: HeaderPro secondary={ ( - { t("extensions:common.help.helpCenterLink.subtitle", + { t("console:common.help.helpCenterLink.subtitle", { productName }) } ) @@ -254,7 +254,7 @@ export const Header: FunctionComponent = (props: HeaderPro - + ) } @@ -271,7 +271,7 @@ export const Header: FunctionComponent = (props: HeaderPro - + ) } @@ -291,7 +291,7 @@ export const Header: FunctionComponent = (props: HeaderPro startIcon={ } > - { I18n.instance.t("extensions:common.upgrade") as ReactNode } + { I18n.instance.t("console:common.upgrade") as ReactNode } @@ -363,14 +363,14 @@ export const Header: FunctionComponent = (props: HeaderPro target="_blank" rel="noreferrer" > - { I18n.instance.t("extensions:common.dropdown.footer.privacyPolicy") as string } + { I18n.instance.t("console:common.dropdown.footer.privacyPolicy") as string } - { I18n.instance.t("extensions:common.dropdown.footer.cookiePolicy") as string } + { I18n.instance.t("console:common.dropdown.footer.cookiePolicy") as string } = (props: HeaderPro target="_blank" rel="noreferrer" > - { I18n.instance.t("extensions:common.dropdown.footer.termsOfService") as string } + { I18n.instance.t("console:common.dropdown.footer.termsOfService") as string } ], diff --git a/features/admin.email-management.v1/components/email-customization-form.tsx b/features/admin.email-management.v1/components/email-customization-form.tsx index 767616e7bf1..b1de5aff4ab 100755 --- a/features/admin.email-management.v1/components/email-customization-form.tsx +++ b/features/admin.email-management.v1/components/email-customization-form.tsx @@ -175,7 +175,7 @@ export const EmailCustomizationForm: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.email-management.v1/pages/email-customization.tsx b/features/admin.email-management.v1/pages/email-customization.tsx index 055ab316bf9..92d1b037c4f 100755 --- a/features/admin.email-management.v1/pages/email-customization.tsx +++ b/features/admin.email-management.v1/pages/email-customization.tsx @@ -408,7 +408,7 @@ const EmailCustomizationPage: FunctionComponent - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } ) } diff --git a/features/admin.email-providers.v1/pages/email-providers.tsx b/features/admin.email-providers.v1/pages/email-providers.tsx index 7b12a625913..f432bc26c31 100644 --- a/features/admin.email-providers.v1/pages/email-providers.tsx +++ b/features/admin.email-providers.v1/pages/email-providers.tsx @@ -16,6 +16,7 @@ * under the License. */ +import { useRequiredScopes } from "@wso2is/access-control"; import { AppConstants, AppState, @@ -23,7 +24,6 @@ import { } from "@wso2is/admin.core.v1"; import { history } from "@wso2is/admin.core.v1/helpers"; import { IdentityAppsApiException } from "@wso2is/core/exceptions"; -import { hasRequiredScopes } from "@wso2is/core/helpers"; import { AlertLevels } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; import { Field, Form, FormPropsInterface } from "@wso2is/form"; @@ -45,7 +45,6 @@ import React, { MutableRefObject, ReactElement, useEffect, - useMemo, useRef , useState } from "react"; @@ -82,16 +81,12 @@ const EmailProvidersPage: FunctionComponent = ( const { t } = useTranslation(); const { getLink } = useDocumentation(); const featureConfig : FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features); - const allowedScopes : string = useSelector((state: AppState) => state?.auth?.allowedScopes); const pageContextRef : MutableRefObject = useRef(null); const formRef: MutableRefObject = useRef(null); - const isReadOnly : boolean = useMemo(() => !hasRequiredScopes( - featureConfig?.emailProviders, - featureConfig?.emailProviders?.scopes?.update, - allowedScopes - ), [ featureConfig, allowedScopes ]); + const hasEmailTemplatesReadPermissions: boolean = useRequiredScopes(featureConfig?.emailTemplates?.scopes?.read); + const hasEmailProviderUpdatePermissions: boolean = useRequiredScopes(featureConfig?.emailProviders?.scopes?.update); const [ isSubmitting, setIsSubmitting ] = useState(false); const [ isDeleting, setIsDeleting ] = useState(false); @@ -397,7 +392,7 @@ const EmailProvidersPage: FunctionComponent = ( - { t("extensions:common.learnMore") } + { t("console:common.learnMore") } @@ -449,8 +444,7 @@ const EmailProvidersPage: FunctionComponent = ( } } action={ featureConfig.emailProviders?.enabled && - hasRequiredScopes(featureConfig?.emailTemplates, featureConfig?.emailTemplates?.scopes?.read, - allowedScopes) && + hasEmailTemplatesReadPermissions && ( = ( ) } required={ true } value={ emailProviderConfig?.smtpServerHost } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_CONFIG_FIELD_MAX_LENGTH } minLength={ EmailProviderConstants @@ -572,7 +566,7 @@ const EmailProvidersPage: FunctionComponent = ( ) } required={ true } value={ emailProviderConfig?.smtpPort } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_SERVER_PORT_MAX_LENGTH } minLength={ EmailProviderConstants @@ -599,7 +593,7 @@ const EmailProvidersPage: FunctionComponent = ( ".fromAddress.hint") } required={ true } value={ emailProviderConfig?.fromAddress } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_CONFIG_FIELD_MAX_LENGTH } minLength={ EmailProviderConstants @@ -624,7 +618,7 @@ const EmailProvidersPage: FunctionComponent = ( ".replyToAddress.hint") } required={ true } value={ emailProviderConfig?.replyToAddress } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_CONFIG_FIELD_MAX_LENGTH } minLength={ EmailProviderConstants @@ -653,7 +647,7 @@ const EmailProvidersPage: FunctionComponent = ( ".userName.hint") } required={ true } value={ emailProviderConfig?.userName } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_CONFIG_FIELD_MAX_LENGTH } minLength={ EmailProviderConstants @@ -679,7 +673,7 @@ const EmailProvidersPage: FunctionComponent = ( ".password.hint") } required={ true } value={ emailProviderConfig?.password } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_CONFIG_FIELD_MAX_LENGTH } minLength={ EmailProviderConstants @@ -706,7 +700,7 @@ const EmailProvidersPage: FunctionComponent = ( ".displayName.hint") } required={ true } value={ emailProviderConfig?.displayName } - readOnly={ isReadOnly } + readOnly={ !hasEmailProviderUpdatePermissions } maxLength={ EmailProviderConstants .EMAIL_PROVIDER_CONFIG_FIELD_MAX_LENGTH } minLength={ EmailProviderConstants @@ -720,7 +714,7 @@ const EmailProvidersPage: FunctionComponent = ( { - !isReadOnly && ( + hasEmailProviderUpdatePermissions && ( <>