diff --git a/apps/storefront/src/pages/invoice/Invoice.tsx b/apps/storefront/src/pages/invoice/Invoice.tsx index a96cdae9c..958955ac3 100644 --- a/apps/storefront/src/pages/invoice/Invoice.tsx +++ b/apps/storefront/src/pages/invoice/Invoice.tsx @@ -471,13 +471,10 @@ function Invoice() { -decimalPlaces )}` } + } else if (result.length > 1) { + result = `${val.slice(0, 1)}.${val.slice(-1)}` } else { - const movePoint = result.length - +decimalPlaces - if (movePoint > 0) { - result = `${val.slice(0, -decimalPlaces)}.${val.slice(-decimalPlaces)}` - } else { - result = `.${val}` - } + result = `${val}` } handleSetSelectedInvoiceAccount(result, id) diff --git a/apps/storefront/src/pages/login/Login.tsx b/apps/storefront/src/pages/login/Login.tsx index d624d19f7..99d00d152 100644 --- a/apps/storefront/src/pages/login/Login.tsx +++ b/apps/storefront/src/pages/login/Login.tsx @@ -54,6 +54,8 @@ interface RegisteredProps { setOpenPage: Dispatch> } +type AlertColor = 'success' | 'info' | 'warning' | 'error' + export default function Login(props: RegisteredProps) { const [isLoading, setLoading] = useState(true) const [isMobile] = useMobile() @@ -180,6 +182,9 @@ export default function Login(props: RegisteredProps) { case '4': str = b3Lang('login.loginTipInfo.accountincorrect') break + case '5': + str = b3Lang('login.loginTipInfo.accountPrelaunch') + break default: str = '' } @@ -187,6 +192,25 @@ export default function Login(props: RegisteredProps) { return str } + const setTipType = (flag: string): AlertColor | undefined => { + if (!flag) return undefined + let tipType: AlertColor = 'success' + switch (flag) { + case '1': + tipType = 'error' + break + case '4': + tipType = 'error' + break + case '5': + tipType = 'warning' + break + default: + tipType = 'success' + } + return tipType + } + const getforcePasswordReset = async (email: string) => { const { companyUserInfo: { @@ -220,8 +244,18 @@ export default function Login(props: RegisteredProps) { pass: data.password, } const { data: bcData, errors } = await bcLogin(getBCFieldsValue) - if (errors?.length || !bcData) { + if (errors?.length) { + const { message } = errors[0] + if ( + message === + 'Operation cannot be performed as the storefront channel is not live' + ) { + setLoginFlag('5') + setLoading(false) + return + } + } getforcePasswordReset(data.emailAddress) } else { const info = await getCurrentCustomerInfo(dispatch) @@ -276,12 +310,7 @@ export default function Login(props: RegisteredProps) { margin: '30px 0 0 0', }} > - + {tipInfo(flag, loginAccount?.emailAddress || '')} diff --git a/packages/lang/locales/en.json b/packages/lang/locales/en.json index 0c1a6295b..a7c58f4aa 100644 --- a/packages/lang/locales/en.json +++ b/packages/lang/locales/en.json @@ -355,6 +355,7 @@ "login.loginTipInfo.receivePassword": "If the entered email address is associated with this store, you will receive a password reset email. If you don't receive this e-mail, please check your junk mail folder or contact us for further assistance.", "login.loginTipInfo.loggedOutLogin": "You've been logged out of your account successfully.", "login.loginTipInfo.accountincorrect": "Your email address or password is incorrect. Please try again. If you've forgotten your sign in details, just click the 'Forgot your password?' link below.", + "login.loginTipInfo.accountPrelaunch": "You can not login to the Buyer Portal while the store is in prelaunch or maintenance mode. Please set the store live, or login inside the customer admin panel.", "login.loginText.forgotPasswordText": "Forgot your password?", "login.loginText.password": "Password",