From be30810b9f87e82f111a8b322bd18fb7af642ded Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Mon, 16 Oct 2023 14:28:04 +0530 Subject: [PATCH 1/4] Add display name for organizations in branding --- .../src/extensions/i18n/models/extensions.ts | 5 +++++ .../i18n/resources/en-US/extensions.ts | 6 +++++ .../i18n/resources/fr-FR/extensions.ts | 7 ++++++ .../i18n/resources/si-LK/extensions.ts | 7 ++++++ .../components/branding-preference-tabs.tsx | 2 ++ .../general/general-details-form.tsx | 22 ++++++++++++++++++- .../email-template-screen-skeleton.tsx | 3 ++- .../branding-preferences-constants.ts | 7 +++++- .../branding/models/branding-preferences.ts | 4 ++++ .../src/features/branding/pages/branding.tsx | 6 +++++ .../utils/email-customization-utils.ts | 5 +++-- .../src/models/branding-preferences.ts | 4 ++++ 12 files changed, 73 insertions(+), 5 deletions(-) diff --git a/apps/console/src/extensions/i18n/models/extensions.ts b/apps/console/src/extensions/i18n/models/extensions.ts index cc511efaa1d..6c23625d90d 100755 --- a/apps/console/src/extensions/i18n/models/extensions.ts +++ b/apps/console/src/extensions/i18n/models/extensions.ts @@ -1570,6 +1570,11 @@ export interface Extensions { label: string; placeholder: string; }; + displayName: { + hint: string; + label: string; + placeholder: 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 df0badb9396..0df0ffc0985 100755 --- a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts @@ -1777,6 +1777,12 @@ export const extensions: Extensions = { }, general: { fields: { + displayName: { + hint: "Organization name that appears to users. If not set, {{ productName }} defaults " + + "are used.", + label: "Organization Display Name", + placeholder: "Enter a display name" + }, supportEmail: { hint: "The email address that appears on error pages and other pages where " + "users would require support. If not set, {{ productName }} defaults are used.", 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 e0332987942..cf1b1a70d41 100755 --- a/apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts @@ -1792,6 +1792,13 @@ export const extensions: Extensions = { }, general: { fields: { + displayName: { + hint: + "Nom de l'organisation qui apparaît aux utilisateurs. S'il n'est pas défini, " + + "les valeurs par défaut de {{ productName }} seront utilisées.", + label: "Nom d’affichage de l’organisation", + placeholder: "Entrer un nom d'affichage" + }, supportEmail: { hint: "TEmail qui apparaît sur les pages d'erreur et dans les endroits où une " + 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 4d21a0eff54..ead934158d2 100755 --- a/apps/console/src/extensions/i18n/resources/si-LK/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/si-LK/extensions.ts @@ -1752,6 +1752,13 @@ export const extensions: Extensions = { }, general: { fields: { + displayName: { + hint: + "පරිශීලකයින්ට දිස්වන සංවිධානයේ නම." + + "සකසා නොමැති නම්, {{ productName }} පෙරනිමිය භාවිතා වේ.", + label: "සංවිධානයේ සංදර්ශක නම", + placeholder: "සංදර්ශක නාමයක් ඇතුළත් කරන්න" + }, supportEmail: { hint: "දෝෂ පිටු සහ පාරිභෝගිකයින් සඳහා සහය අවශ්‍ය වන ස්ථානවල දිස්වන විද්‍යුත් තැපෑල." + diff --git a/apps/console/src/features/branding/components/branding-preference-tabs.tsx b/apps/console/src/features/branding/components/branding-preference-tabs.tsx index a374e0eb7ec..cdbfa668e29 100644 --- a/apps/console/src/features/branding/components/branding-preference-tabs.tsx +++ b/apps/console/src/features/branding/components/branding-preference-tabs.tsx @@ -190,6 +190,7 @@ export const BrandingPreferenceTabs: FunctionComponent state.config.ui.productName); + const [ displayName, setDisplayName ] = useState(initialValues.organizationDetails.displayName); const [ supportEmail, setSupportEmail ] = useState(initialValues.organizationDetails.supportEmail); /** @@ -103,10 +104,11 @@ export const GeneralDetailsForm: FunctionComponent + setDisplayName(value) } + data-componentid={ `${componentId}-organization-display-name` } + /> = ( eventPublisher.publish("organization-branding-configure-site-title"); } + // If a display name is updated, publish an event. + if (isEmpty(brandingPreference.organizationDetails.displayName) + && !isEmpty(values.organizationDetails?.displayName)) { + eventPublisher.publish("organization-branding-configure-display-name"); + } + // When a theme is selected for the first time or switched, publish an event. if (isEmpty(brandingPreference.theme?.activeTheme)) { eventPublisher.publish(`organization-branding-configure-${ diff --git a/apps/console/src/features/email-management/utils/email-customization-utils.ts b/apps/console/src/features/email-management/utils/email-customization-utils.ts index 970c5e19c91..75363bbe152 100644 --- a/apps/console/src/features/email-management/utils/email-customization-utils.ts +++ b/apps/console/src/features/email-management/utils/email-customization-utils.ts @@ -81,7 +81,8 @@ export class EmailCustomizationUtils { const { organizationDetails: { copyrightText, - supportEmail + supportEmail, + displayName }, theme } = BrandingPreferenceUtils.migrateThemePreference(brandingConfigs, { @@ -114,7 +115,7 @@ export class EmailCustomizationUtils { .replace(/{{organization.font}}/g, currentTheme.typography.font.fontFamily) .replace(/{{organization.font.color}}/g, currentTheme.colors.text.primary) .replace(/{{organization.button.font.color}}/g, currentTheme.buttons.primary.base.font.color) - .replace(/{{organization-name}}/g, organizationName) + .replace(/{{organization-name}}/g, displayName ? displayName : organizationName) .replace(/{{organization.logo.img}}/g, currentTheme.images.logo.imgURL || defaultOrgLogo) .replace(/{{organization.logo.altText}}/g, currentTheme.images.logo.altText) .replace(/{{organization.copyright.text}}/g, diff --git a/apps/myaccount/src/models/branding-preferences.ts b/apps/myaccount/src/models/branding-preferences.ts index 19a719dc333..08e3f8c9307 100644 --- a/apps/myaccount/src/models/branding-preferences.ts +++ b/apps/myaccount/src/models/branding-preferences.ts @@ -101,6 +101,10 @@ export interface BrandingPreferenceOrganizationDetailsInterface { * Support email to be shown for Org members. */ supportEmail: string; + /** + * Display name to be shown for Org members. + */ + displayName: string; } /** From 2d6fbb97cd3bbfaeeee82d39a5d9e8ba65e011a9 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 17 Oct 2023 13:33:39 +0530 Subject: [PATCH 2/4] Add changeset --- .changeset/dry-cooks-add.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dry-cooks-add.md diff --git a/.changeset/dry-cooks-add.md b/.changeset/dry-cooks-add.md new file mode 100644 index 00000000000..f78631872d1 --- /dev/null +++ b/.changeset/dry-cooks-add.md @@ -0,0 +1,6 @@ +--- +"@wso2is/myaccount": minor +"@wso2is/console": minor +--- + +Add organization display name in branding From 8553db3f6f2f52f810a3ce89e75e0533901110bd Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 17 Oct 2023 13:38:09 +0530 Subject: [PATCH 3/4] Fix lint issues --- .../branding/components/general/general-details-form.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/console/src/features/branding/components/general/general-details-form.tsx b/apps/console/src/features/branding/components/general/general-details-form.tsx index 18fbbc35d85..d15d5b7c9fb 100644 --- a/apps/console/src/features/branding/components/general/general-details-form.tsx +++ b/apps/console/src/features/branding/components/general/general-details-form.tsx @@ -149,8 +149,12 @@ export const GeneralDetailsForm: FunctionComponent setDisplayName(value) } data-componentid={ `${componentId}-organization-display-name` } From 12ea7c3e195aeefe4eb455af0963737f180efd2c Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 17 Oct 2023 14:11:16 +0530 Subject: [PATCH 4/4] Fix review comments --- .../components/preview/email-template-screen-skeleton.tsx | 3 +-- .../email-management/utils/email-customization-utils.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/console/src/features/branding/components/preview/email-template-screen-skeleton.tsx b/apps/console/src/features/branding/components/preview/email-template-screen-skeleton.tsx index 256ec793be3..16781645f21 100644 --- a/apps/console/src/features/branding/components/preview/email-template-screen-skeleton.tsx +++ b/apps/console/src/features/branding/components/preview/email-template-screen-skeleton.tsx @@ -142,8 +142,7 @@ export const EmailTemplateScreenSkeleton: FunctionComponent