diff --git a/apps/storefront/src/components/form/B3ControlTextField.tsx b/apps/storefront/src/components/form/B3ControlTextField.tsx index 9a428727..0acf0b5a 100644 --- a/apps/storefront/src/components/form/B3ControlTextField.tsx +++ b/apps/storefront/src/components/form/B3ControlTextField.tsx @@ -32,6 +32,8 @@ export default function B3ControlTextField({ readOnly, allowArrow = false, sx = {}, + isTip = false, + tipText = '', } = rest const b3Lang = useB3Lang() @@ -149,6 +151,17 @@ export default function B3ControlTextField({ ) } /> + {isTip && ( + + {tipText} + + )} ) : null } diff --git a/apps/storefront/src/pages/registered/RegisterComplete.tsx b/apps/storefront/src/pages/registered/RegisterComplete.tsx index d67d0bb1..ea617ee0 100644 --- a/apps/storefront/src/pages/registered/RegisterComplete.tsx +++ b/apps/storefront/src/pages/registered/RegisterComplete.tsx @@ -13,10 +13,7 @@ import { Alert, Box } from '@mui/material' // Captcha, // } from '@/components/form' import { B3CustomForm } from '@/components' -import { - b3HexToRgb, - getContrastColor, -} from '@/components/outSideComponents/utils/b3CustomStyles' +import { getContrastColor } from '@/components/outSideComponents/utils/b3CustomStyles' import { CustomStyleContext } from '@/shared/customStyleButtton' import { GlobaledContext } from '@/shared/global' import { @@ -45,6 +42,7 @@ export default function RegisterComplete(props: RegisterCompleteProps) { const [personalInfo, setPersonalInfo] = useState>([]) const [errorMessage, setErrorMessage] = useState('') + const [enterEmail, setEnterEmail] = useState('') // const [captchaMessage, setCaptchaMessage] = useState('') const { @@ -98,23 +96,14 @@ export default function RegisterComplete(props: RegisterCompleteProps) { useEffect(() => { if (!accountType) return - let newPasswordInformation: Array = [] - let emailItem: CustomFieldItems = {} if (list && list.length) { - const emailFields = + const emailFields: CustomFieldItems = list.find((item: RegisterFields) => item.name === 'email') || {} - emailItem = { - ...emailFields, - } - emailItem.label = `${b3Lang('intl.user.register.RegisterComplete.email')}` - emailItem.name = 'email' - emailItem.disabled = true - newPasswordInformation.push(emailItem) - } - newPasswordInformation = [...newPasswordInformation, ...passwordInfo] + setEnterEmail(emailFields?.default || '') + } - setPersonalInfo(newPasswordInformation) + setPersonalInfo(passwordInfo) }, [contactInformation, bcContactInformation, accountType]) const getBCFieldsValue = (data: CustomFieldItems) => { @@ -445,7 +434,6 @@ export default function RegisterComplete(props: RegisterCompleteProps) { color: customColor, }, '& input, & .MuiFormControl-root .MuiTextField-root': { - bgcolor: b3HexToRgb('#FFFFFF', 0.87), borderRadius: '4px', borderBottomLeftRadius: '0', borderBottomRightRadius: '0', @@ -460,11 +448,26 @@ export default function RegisterComplete(props: RegisterCompleteProps) { {passwordName} {personalInfo && ( - + <> + {enterEmail.length > 0 && ( + + {`Create password for ${enterEmail}`} + + )} + + )} diff --git a/apps/storefront/src/pages/registered/Registered.tsx b/apps/storefront/src/pages/registered/Registered.tsx index c215272b..9f9082e8 100644 --- a/apps/storefront/src/pages/registered/Registered.tsx +++ b/apps/storefront/src/pages/registered/Registered.tsx @@ -12,7 +12,7 @@ import { useB3Lang } from '@b3/lang' import { Box, ImageListItem } from '@mui/material' import { B3Card, B3Sping } from '@/components' -import { useScrollBar } from '@/hooks' +import { useMobile, useScrollBar } from '@/hooks' import { CustomStyleContext } from '@/shared/customStyleButtton' import { GlobaledContext } from '@/shared/global' import { getB2BAccountFormFields, getB2BCountries } from '@/shared/service/b2b' @@ -49,6 +49,7 @@ function Registered(props: RegisteredProps) { const [activeStep, setActiveStep] = useState(0) const b3Lang = useB3Lang() + const [isMobile] = useMobile() const navigate = useNavigate() @@ -286,7 +287,7 @@ function Registered(props: RegisteredProps) { return ( - + {logo && ( diff --git a/apps/storefront/src/pages/registered/RegisteredAccount.tsx b/apps/storefront/src/pages/registered/RegisteredAccount.tsx index cb566203..d6de2538 100644 --- a/apps/storefront/src/pages/registered/RegisteredAccount.tsx +++ b/apps/storefront/src/pages/registered/RegisteredAccount.tsx @@ -79,8 +79,19 @@ export default function RegisteredAccount(props: RegisteredAccountProps) { const additionalInfo: any = accountType === '1' ? additionalInformation : bcAdditionalInformation + const newContactInformation = contactInformation?.map( + (info: CustomFieldItems) => { + if (info.fieldId === 'field_email' && accountType === '1') { + info.isTip = true + info.tipText = 'This email will be used for sign in to your account' + } + + return info + } + ) + const contactInfo: any = - accountType === '1' ? contactInformation : bcContactInformation + accountType === '1' ? newContactInformation : bcContactInformation const contactName = accountType === '1' ? 'contactInformation' : 'bcContactInformationFields' @@ -198,7 +209,6 @@ export default function RegisteredAccount(props: RegisteredAccountProps) { {b3Lang('intl.user.register.registeredAccount.accountType')} { @@ -207,7 +208,7 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { countryList.find( (country: Country) => country.countryCode === countryCode )?.states || [] - const stateFields = addressBasicFields.find( + const stateFields = bcTob2bAddressBasicFields.find( (formFields: RegisterFields) => formFields.name === 'state' ) @@ -235,7 +236,7 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { type: 'stateList', payload: { stateList, - addressBasicFields: [...addressBasicFields], + bcTob2bAddressBasicFields: [...bcTob2bAddressBasicFields], }, }) } @@ -301,10 +302,12 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { b2bFields.customerId = customerId || '' b2bFields.storeHash = storeHash - const companyInfo = companyInformation.filter( + const companyInfo = bcTob2bCompanyInformation.filter( (list) => !list.custom && list.fieldType !== 'files' ) - const companyExtraInfo = companyInformation.filter((list) => !!list.custom) + const companyExtraInfo = bcTob2bCompanyInformation.filter( + (list) => !!list.custom + ) // company field if (companyInfo.length) { companyInfo.forEach((item: any) => { @@ -327,8 +330,10 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { b2bFields.companyEmail = data.email // address Field - const addressBasicInfo = addressBasicFields.filter((list) => !list.custom) - const addressExtraBasicInfo = addressBasicFields.filter( + const addressBasicInfo = bcTob2bAddressBasicFields.filter( + (list) => !list.custom + ) + const addressExtraBasicInfo = bcTob2bAddressBasicFields.filter( (list) => !!list.custom ) @@ -364,7 +369,7 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { const validateCompanyExtraFieldsUnique = async (data: CustomFieldItems) => { try { - const extraCompanyInformation = companyInformation.filter( + const extraCompanyInformation = bcTob2bCompanyInformation.filter( (item: RegisterFields) => !!item.custom ) const extraFields = extraCompanyInformation.map( @@ -417,7 +422,7 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { return } - const attachmentsList = companyInformation.filter( + const attachmentsList = bcTob2bCompanyInformation.filter( (list) => list.fieldType === 'files' ) const fileList = await getFileUrl(attachmentsList || [], data) @@ -463,7 +468,7 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { return ( - + ) : ( - <> + {b3Lang( 'intl.user.register.title.bcToB2B.businessAccountApplication' @@ -531,12 +547,12 @@ export default function RegisteredBCToB2B(props: RegisteredProps) { }} > - {contactInformation?.length - ? contactInformation[0]?.groupName + {bcTob2bContactInformation?.length + ? bcTob2bContactInformation[0]?.groupName : ''} - {companyInformation?.length - ? companyInformation[0]?.groupName + {bcTob2bCompanyInformation?.length + ? bcTob2bCompanyInformation[0]?.groupName : ''} - {addressBasicFields?.length - ? addressBasicFields[0]?.groupName + {bcTob2bAddressBasicFields?.length + ? bcTob2bAddressBasicFields[0]?.groupName : ''} - + + {!showFinishPage && ( + + + {b3Lang('intl.global.button.submit')} + + + )} + )} - - {!showFinishPage && ( - - - {b3Lang('intl.global.button.submit')} - - - )} ) diff --git a/apps/storefront/src/pages/registered/RegisteredDetail.tsx b/apps/storefront/src/pages/registered/RegisteredDetail.tsx index fb0abc2e..c4b04522 100644 --- a/apps/storefront/src/pages/registered/RegisteredDetail.tsx +++ b/apps/storefront/src/pages/registered/RegisteredDetail.tsx @@ -3,10 +3,7 @@ import { useForm } from 'react-hook-form' import { Alert, Box } from '@mui/material' import { B3CustomForm } from '@/components' -import { - b3HexToRgb, - getContrastColor, -} from '@/components/outSideComponents/utils/b3CustomStyles' +import { getContrastColor } from '@/components/outSideComponents/utils/b3CustomStyles' import { CustomStyleContext } from '@/shared/customStyleButtton' import { validateBCCompanyExtraFields } from '@/shared/service/b2b' @@ -247,7 +244,6 @@ export default function RegisteredDetail(props: RegisteredDetailProps) { }, '& input, & .MuiFormControl-root .MuiTextField-root, & .MuiDropzoneArea-textContainer, & .MuiSelect-select.MuiSelect-filled, & .MuiTextField-root .MuiInputBase-multiline': { - bgcolor: b3HexToRgb('#FFFFFF', 0.87), borderRadius: '4px', borderBottomLeftRadius: '0', borderBottomRightRadius: '0', diff --git a/apps/storefront/src/pages/registered/RegisteredFinish.tsx b/apps/storefront/src/pages/registered/RegisteredFinish.tsx index 81d3e160..beb076fa 100644 --- a/apps/storefront/src/pages/registered/RegisteredFinish.tsx +++ b/apps/storefront/src/pages/registered/RegisteredFinish.tsx @@ -3,6 +3,7 @@ import { useB3Lang } from '@b3/lang' import { Alert, Box } from '@mui/material' import { getContrastColor } from '@/components/outSideComponents/utils/b3CustomStyles' +import { useMobile } from '@/hooks' import { CustomStyleContext } from '@/shared/customStyleButtton' import { B3SStorage } from '@/utils' @@ -13,8 +14,9 @@ import { StyleTipContainer } from './styled' export default function RegisteredFinish(props: { activeStep: number handleFinish: () => void + isBCToB2B?: boolean }) { - const { activeStep, handleFinish } = props + const { activeStep, handleFinish, isBCToB2B = false } = props const { state } = useContext(RegisteredContext) const b3Lang = useB3Lang() @@ -23,6 +25,7 @@ export default function RegisteredFinish(props: { portalStyle: { backgroundColor = '#FEF9F5' }, }, } = useContext(CustomStyleContext) + const [isMobile] = useMobile() const customColor = getContrastColor(backgroundColor) @@ -78,14 +81,29 @@ export default function RegisteredFinish(props: { return ( {submitSuccess && ( <> diff --git a/apps/storefront/src/pages/registered/RegisteredStep.tsx b/apps/storefront/src/pages/registered/RegisteredStep.tsx index 3555f298..3abd85dc 100644 --- a/apps/storefront/src/pages/registered/RegisteredStep.tsx +++ b/apps/storefront/src/pages/registered/RegisteredStep.tsx @@ -13,6 +13,7 @@ import { b3HexToRgb, getContrastColor, } from '@/components/outSideComponents/utils/b3CustomStyles' +import { useMobile } from '@/hooks' import { RegisteredContext } from './context/RegisteredContext' import { steps } from './config' @@ -28,6 +29,7 @@ export default function RegisteredStep(props: RegisteredStepProps) { const { children, isStepOptional, activeStep, backgroundColor } = props const b3Lang = useB3Lang() + const [isMobile] = useMobile() const theme = useTheme() const { state } = useContext(RegisteredContext) @@ -39,7 +41,18 @@ export default function RegisteredStep(props: RegisteredStepProps) { const customColor = getContrastColor(backgroundColor) return ( - + + bcTob2bCompanyExtraFields?: Array + bcTob2bCompanyInformation?: Array + bcTob2bAddressBasicFields?: Array } interface RegisterAction { type: string @@ -62,6 +66,10 @@ const initState = { submitSuccess: false, isAutoApproval: true, blockPendingAccountOrderCreation: true, + bcTob2bContactInformation: [], + bcTob2bCompanyExtraFields: [], + bcTob2bCompanyInformation: [], + bcTob2bAddressBasicFields: [], } export const RegisteredContext = createContext({ @@ -102,6 +110,7 @@ const reducer = (state: RegisterState, action: RegisterAction) => { stateList: action.payload.stateList, addressBasicFields: action.payload.addressBasicFields, bcAddressBasicFields: action.payload.bcAddressBasicFields, + bcTob2bAddressBasicFields: action.payload.bcTob2bAddressBasicFields, } case 'finishInfo': return { diff --git a/apps/storefront/src/pages/registered/styled.ts b/apps/storefront/src/pages/registered/styled.ts index 360c75d9..e3d5a409 100644 --- a/apps/storefront/src/pages/registered/styled.ts +++ b/apps/storefront/src/pages/registered/styled.ts @@ -29,8 +29,15 @@ export const TipLogin = styled('div')(() => ({ borderBottom: '1px solid #1976d2', })) -export const RegisteredContainer = styled('div')({ - padding: '20px 40px', +export const RegisteredContainer = styled('div')((props: CustomFieldItems) => { + const { isMobile = false } = props + const style = isMobile + ? {} + : { + padding: '20px 40px', + } + + return style }) export const RegisteredImage = styled('div')({