Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: HS-222: Address line2 optional in case of isUseBillingAddress #174

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Utilities/DynamicFieldsUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ let useRequiredFieldsEmptyAndValid = (
| AddressCountry(countryArr) => country !== "" || countryArr->Belt.Array.length === 0
| BillingName => checkIfNameIsValid(requiredFields, paymentMethodFields, billingName)
| AddressLine1 => line1.value !== ""
| AddressLine2 => line2.value !== ""
| AddressLine2 => billingAddress.isUseBillingAddress ? true : line2.value !== ""
| Bank => selectedBank !== "" || bankNames->Belt.Array.length === 0
| PhoneNumber => phone.value !== ""
| StateAndCity => state.value !== "" && city.value !== ""
Expand Down Expand Up @@ -172,7 +172,7 @@ let useRequiredFieldsEmptyAndValid = (
| AddressCountry(countryArr) => country === "" && countryArr->Belt.Array.length > 0
| BillingName => billingName.value === ""
| AddressLine1 => line1.value === ""
| AddressLine2 => line2.value === ""
| AddressLine2 => billingAddress.isUseBillingAddress ? false : line2.value === ""
| Bank => selectedBank === "" && bankNames->Belt.Array.length > 0
| StateAndCity => city.value === "" || state.value === ""
| CountryAndPincode(countryArr) =>
Expand Down Expand Up @@ -656,7 +656,7 @@ let useSubmitCallback = () => {
logger,
)
let (city, setCity) = Recoil.useLoggedRecoilState(RecoilAtoms.userAddressCity, "city", logger)

let {billingAddress} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
React.useCallback5((ev: Window.event) => {
let json = ev.data->Js.Json.parseExn
let confirm = json->Utils.getDictFromJson->ConfirmType.itemToObjMapper
Expand All @@ -670,7 +670,7 @@ let useSubmitCallback = () => {
if line2.value == "" {
setLine2(.prev => {
...prev,
errorString: "Address line 2 cannot be empty",
errorString: billingAddress.isUseBillingAddress ? "" : "Address line 2 cannot be empty",
})
}
if state.value == "" {
Expand Down