From b7ff5e10cae330adb3e8b38e620475035c2c5cbd Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Sun, 19 Nov 2023 12:33:22 +0530 Subject: [PATCH] (fix) Change page title of `channels` to be changed based on the enabled providers. --- .../src/extensions/i18n/models/extensions.ts | 18 +++++-- .../i18n/resources/en-US/extensions.ts | 18 +++++-- .../i18n/resources/fr-FR/extensions.ts | 18 +++++-- .../i18n/resources/si-LK/extensions.ts | 18 +++++-- .../pages/notification-channels.tsx | 53 ++++++++++++++++--- 5 files changed, 106 insertions(+), 19 deletions(-) diff --git a/apps/console/src/extensions/i18n/models/extensions.ts b/apps/console/src/extensions/i18n/models/extensions.ts index b71a0138314..773107a291c 100755 --- a/apps/console/src/extensions/i18n/models/extensions.ts +++ b/apps/console/src/extensions/i18n/models/extensions.ts @@ -1858,9 +1858,21 @@ export interface Extensions { }; }; notificationChannel: { - heading: string; - title: string; - description: string; + heading: { + heading: string; + onlySMSProvider: string; + onlyEmailProvider: string; + }, + title: { + heading: string; + onlySMSProvider: string; + onlyEmailProvider: string; + }, + description: { + description: string; + onlySMSProvider: string; + onlyEmailProvider: string; + } }; smsProviders: { heading: string; 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 1ba1edc3f4a..225cd7dacd5 100755 --- a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts @@ -2090,9 +2090,21 @@ export const extensions: Extensions = { } }, notificationChannel: { - heading: "SMS / Email Providers", - title: "SMS / Email Providers", - description: "Configure the SMS and Email providers for your organization." + heading: { + heading: "SMS / Email Providers", + onlySMSProvider: "SMS Provider", + onlyEmailProvider: "Email Provider" + }, + title: { + heading: "SMS / Email Providers", + onlySMSProvider: "SMS Provider", + onlyEmailProvider: "Email Provider" + }, + description: { + description: "Configure the SMS and Email providers for your organization.", + onlySMSProvider: "Configure the SMS provider for your organization.", + onlyEmailProvider: "Configure the Email provider for your organization." + } }, smsProviders: { heading: "Custom SMS Provider", diff --git a/apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts b/apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts index ac902a35e7d..09ae7976361 100755 --- a/apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts @@ -2124,9 +2124,21 @@ export const extensions: Extensions = { } }, notificationChannel: { - heading: "Fournisseurs SMS/e-mail", - title: "Fournisseurs SMS/e-mail", - description: "Configurez les fournisseurs SMS et Email pour votre organisation." + heading: { + heading: "SMS / fournisseurs de courriels", + onlySMSProvider: "Fournisseur de SMS", + onlyEmailProvider: "Fournisseur de messagerie" + }, + title: { + heading: "SMS / fournisseurs de courriels", + onlySMSProvider: "Fournisseur de SMS", + onlyEmailProvider: "Fournisseur de messagerie" + }, + description: { + description: "Configurez les SMS et les fournisseurs de messagerie pour votre organisation.", + onlySMSProvider: "Configurez le fournisseur SMS pour votre organisation.", + onlyEmailProvider: "Configurez le fournisseur de messagerie pour votre organisation." + } }, smsProviders: { heading: "Fournisseur de SMS personnalisé", diff --git a/apps/console/src/extensions/i18n/resources/si-LK/extensions.ts b/apps/console/src/extensions/i18n/resources/si-LK/extensions.ts index 79ed23b257c..510410dd920 100755 --- a/apps/console/src/extensions/i18n/resources/si-LK/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/si-LK/extensions.ts @@ -2063,9 +2063,21 @@ export const extensions: Extensions = { } }, notificationChannel: { - heading: "SMS / ඊමේල් සපයන්නන්", - title: "SMS / ඊමේල් සපයන්නන්", - description: "ඔබේ සංවිධානය සඳහා SMS සහ විද්‍යුත් තැපැල් සපයන්නන් වින්‍යාස කරන්න." + heading: { + heading: "කෙටි පණිවුඩ / ඊමේල් සැපයුම්කරුවන්", + onlySMSProvider: "කෙටි පණිවුඩ සැපයුම්කරු", + onlyEmailProvider: "විද්යුත් තැපැල් සැපයුම්කරු" + }, + title: { + heading: "කෙටි පණිවුඩ / ඊමේල් සැපයුම්කරුවන්", + onlySMSProvider: "කෙටි පණිවුඩ සැපයුම්කරු", + onlyEmailProvider: "විද්යුත් තැපැල් සැපයුම්කරු" + }, + description: { + description: "ඔබේ සංවිධානය සඳහා කෙටි පණිවුඩ සහ විද්යුත් තැපැල් සපයන්නන් වින්‍යාස කරන්න.", + onlySMSProvider: "ඔබේ සංවිධානය සඳහා කෙටි පණිවුඩ සැපයුම්කරු වින්‍යාස කරන්න.", + onlyEmailProvider: "ඔබේ සංවිධානය සඳහා විද්යුත් තැපැල් සැපයුම්කරු වින්‍යාස කරන්න." + } }, smsProviders: { heading: "අභිරුචි කෙටි පණිවුඩ සපයන්නා", diff --git a/apps/console/src/features/notification-channels/pages/notification-channels.tsx b/apps/console/src/features/notification-channels/pages/notification-channels.tsx index 3d6c595bfdc..eed4329ba6c 100644 --- a/apps/console/src/features/notification-channels/pages/notification-channels.tsx +++ b/apps/console/src/features/notification-channels/pages/notification-channels.tsx @@ -51,6 +51,18 @@ export const NotificationChannelPage: FunctionComponent state.config.ui.features); + /** + * Check if the email provider is enabled for the tenant. + */ + const isEmailProviderEnabled: boolean = featureConfig.emailProviders?.enabled + && !(featureConfig?.emailProviders?.disabledFeatures?.includes("superTenantProvider") + && organizationType === OrganizationType.SUPER_ORGANIZATION); + + /** + * Check if the SMS provider is enabled for the tenant. + */ + const isSMSProviderEnabled: boolean = featureConfig.smsProviders?.enabled; + /** * Handle connector advance setting selection. */ @@ -61,17 +73,44 @@ export const NotificationChannelPage: FunctionComponent { history.push(AppConstants.getPaths().get("EMAIL_PROVIDER")); }; + + /** + * Get the page details based on the enabled providers. + */ + const getPageDetails = (): { + description: string; + pageTitle: string; + title: string; + } => { + if (isEmailProviderEnabled === isSMSProviderEnabled) { + return { + description: t("extensions:develop.notificationChannel.description.description"), + pageTitle: t("extensions:develop.notificationChannel.heading.heading"), + title: t("extensions:develop.notificationChannel.title.title") + }; + } else if (isSMSProviderEnabled) { + return { + description: t("extensions:develop.notificationChannel.description.onlySMSProvider"), + pageTitle: t("extensions:develop.notificationChannel.heading.onlySMSProvider"), + title: t("extensions:develop.notificationChannel.title.onlySMSProvider") + }; + } else if (isEmailProviderEnabled) { + return { + description: t("extensions:develop.notificationChannel.description.onlyEmailProvider"), + pageTitle: t("extensions:develop.notificationChannel.heading.onlyEmailProvider"), + title: t("extensions:develop.notificationChannel.title.onlyEmailProvider") + }; + } + }; return ( - { featureConfig.emailProviders?.enabled - && !(featureConfig?.emailProviders?.disabledFeatures?.includes("superTenantProvider") - && organizationType === OrganizationType.SUPER_ORGANIZATION) && ( + { isEmailProviderEnabled && ( <>