Skip to content

Commit

Permalink
fix: HS-222: Address line2 optional in case of isUseBillingAddress (#174
Browse files Browse the repository at this point in the history
)
  • Loading branch information
prafulkoppalkar committed Feb 16, 2024
1 parent 29e454a commit d2fa10e
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit d2fa10e

Please sign in to comment.