diff --git a/apps/storefront/src/pages/accountSetting/AccountSetting.tsx b/apps/storefront/src/pages/accountSetting/AccountSetting.tsx index 3179afa0..0baf448a 100644 --- a/apps/storefront/src/pages/accountSetting/AccountSetting.tsx +++ b/apps/storefront/src/pages/accountSetting/AccountSetting.tsx @@ -23,7 +23,7 @@ import { updateBCAccountSettings, } from '@/shared/service/b2b' import { Fields, ParamProps } from '@/types/accountSetting' -import { B3SStorage, snackbar } from '@/utils' +import { B3SStorage, manipulateString, snackbar } from '@/utils' import { getAccountFormFields } from '../registered/config' @@ -288,6 +288,16 @@ function AccountSetting() { })() } + const convertLabel = (infos: Partial[]) => + infos.map((info: Partial) => { + const { label } = info + if (label) { + info.label = manipulateString(label) + } + + return info + }) || [] + return ( { + const { label } = field + if (label) field.label = manipulateString(label) + + return field + }) || [] + setAddressFields(newAddressFields) } catch (err) { console.log(err) } finally { diff --git a/apps/storefront/src/pages/registered/RegisterComplete.tsx b/apps/storefront/src/pages/registered/RegisterComplete.tsx index c189e9c8..5241cc4b 100644 --- a/apps/storefront/src/pages/registered/RegisterComplete.tsx +++ b/apps/storefront/src/pages/registered/RegisterComplete.tsx @@ -22,7 +22,7 @@ import { sendSubscribersState, uploadB2BFile, } from '@/shared/service/b2b' -import { storeHash } from '@/utils' +import { convertLabel, manipulateString, storeHash } from '@/utils' import RegisteredStepButton from './component/RegisteredStepButton' import { RegisteredContext } from './context/RegisteredContext' @@ -85,9 +85,11 @@ export default function RegisterComplete(props: RegisterCompleteProps) { const list: RegisterCompleteList = accountType === '1' ? contactInformation : bcContactInformation const passwordInfo: RegisterCompleteList = - accountType === '1' ? passwordInformation : bcPasswordInformation + accountType === '1' + ? convertLabel(passwordInformation) + : convertLabel(bcPasswordInformation) - const passwordName = passwordInfo[0]?.groupName || '' + const passwordName = manipulateString(passwordInfo[0]?.groupName) || '' const additionalInfo: RegisterCompleteList = accountType === '1' ? additionalInformation : bcAdditionalInformation diff --git a/apps/storefront/src/pages/registered/RegisteredAccount.tsx b/apps/storefront/src/pages/registered/RegisteredAccount.tsx index 9d839ee1..59a71289 100644 --- a/apps/storefront/src/pages/registered/RegisteredAccount.tsx +++ b/apps/storefront/src/pages/registered/RegisteredAccount.tsx @@ -20,6 +20,7 @@ import { CustomStyleContext } from '@/shared/customStyleButtton' import { GlobaledContext } from '@/shared/global' import { checkUserBCEmail, checkUserEmail } from '@/shared/service/b2b' import { themeFrameSelector } from '@/store' +import { convertLabel, manipulateString } from '@/utils' import RegisteredStepButton from './component/RegisteredStepButton' import { RegisteredContext } from './context/RegisteredContext' @@ -78,8 +79,8 @@ export default function RegisteredAccount(props: RegisteredAccountProps) { accountType === '1' ? 'additionalInformation' : 'bcAdditionalInformation' const additionalInfo: any = accountType === '1' - ? additionalInformation || [] - : bcAdditionalInformation || [] + ? convertLabel(additionalInformation || []) + : convertLabel(bcAdditionalInformation || []) const newContactInformation = contactInformation?.map( (info: CustomFieldItems) => { @@ -87,22 +88,28 @@ export default function RegisteredAccount(props: RegisteredAccountProps) { info.isTip = true info.tipText = 'This email will be used to sign in to your account' } + const { label } = info + if (label) { + info.label = manipulateString(label) + } return info } ) const contactInfo: any = - accountType === '1' ? newContactInformation : bcContactInformation || [] + accountType === '1' + ? newContactInformation + : convertLabel(bcContactInformation || []) const contactName = accountType === '1' ? 'contactInformation' : 'bcContactInformationFields' const contactInformationLabel = contactInfo.length - ? contactInfo[0]?.groupName + ? manipulateString(contactInfo[0]?.groupName) : '' const additionalInformationLabel = additionalInfo.length - ? additionalInfo[0]?.groupName + ? manipulateString(additionalInfo[0]?.groupName) : '' const handleChange = (event: ChangeEvent) => { diff --git a/apps/storefront/src/pages/registered/RegisteredBCToB2B.tsx b/apps/storefront/src/pages/registered/RegisteredBCToB2B.tsx index c6d793cc..2482daaf 100644 --- a/apps/storefront/src/pages/registered/RegisteredBCToB2B.tsx +++ b/apps/storefront/src/pages/registered/RegisteredBCToB2B.tsx @@ -18,7 +18,12 @@ import { getContrastColor } from '@/components/outSideComponents/utils/b3CustomS import { useMobile } from '@/hooks' import { CustomStyleContext } from '@/shared/customStyleButtton' import { GlobaledContext } from '@/shared/global' -import { getCurrentCustomerInfo, storeHash } from '@/utils' +import { + convertLabel, + getCurrentCustomerInfo, + manipulateString, + storeHash, +} from '@/utils' import { createB2BCompanyUser, @@ -590,11 +595,13 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { > {bcTob2bContactInformation?.length - ? bcTob2bContactInformation[0]?.groupName + ? manipulateString( + bcTob2bContactInformation[0]?.groupName + ) : ''} {bcTob2bCompanyInformation?.length - ? bcTob2bCompanyInformation[0]?.groupName + ? manipulateString( + bcTob2bCompanyInformation[0]?.groupName + ) : ''} {bcTob2bAddressBasicFields?.length - ? bcTob2bAddressBasicFields[0]?.groupName + ? manipulateString( + bcTob2bAddressBasicFields[0]?.groupName + ) : ''} { const stateList = @@ -261,7 +266,7 @@ export default function RegisteredDetail(props: RegisteredDetailProps) { {businessDetailsName}