Repository URL to install this package:
Version:
0.14.1 ▾
|
/* eslint-disable max-statements */
import { isString } from 'exotic'
const errorMessageList = {
email: 'Please enter a valid Email address',
emailAndPhone: 'Please enter a valid phone number / email address',
enterPassword: 'Please enter your password',
password: 'Password must contain at least 6 characters.',
confirmPassword: 'Passwords do not match',
currentPassword: 'Please enter your current password',
name: 'Please enter a valid name',
firstName: 'Please enter your first name',
lastName: 'Please enter your last name',
middleName: 'Please enter a valid middle name',
phoneNumber: 'Please enter a valid phone number',
addressRequired: 'Please enter your address',
zipCode: 'Please enter a valid ZipCode',
creditCard: 'Enter your 16 digit card number',
cvvNumber: 'Please enter a valid cvv number',
expiryDate: 'Please enter the card expiry date',
expirationMonth: 'Please enter month',
expirationYear: 'Please enter year',
otp: 'Please enter the OTP',
promoCode: 'Please enter a valid promo code',
securityQuestionAnswer: 'Please enter your answer',
orderId: 'Order ID is invalid',
selectSecurityQuestion: 'Please choose a security question',
city: 'Please enter a valid city',
state: 'Please enter a valid state',
country: 'Please enter a valid country',
postalCode: 'Please enter a valid postal code',
addressLine1: 'Please enter address line1',
addressLine2: 'Please enter address line2',
required: 'This field is required',
invalidInput: 'Input is invalid',
invalidPin: 'Enter PIN',
passwordSameAsEmail: 'Password should not be the same as Email',
couponCode: 'Please enter a valid coupon code',
cancelReason: 'Please choose an option for cancellation',
returnReason: 'Please choose an option for return',
securityCode: 'Enter Security Code',
organizationName: 'Please enter a valid organization name',
taxId: 'Please enter a valid tax Id',
}
function errorMessage(type: string): string {
if (isString(type) && isString(errorMessageList[type])) {
return errorMessageList[type]
}
// Default message
return 'This field is required'
}
export { errorMessage }
export default errorMessage