| BlikCode =>
| Country =>
- let updatedCountryNames: array<
- DropdownField.optionType,
- > = countryNames->Array.map(item => {
- let optionVal: DropdownField.optionType = {
- label: item,
- value: item,
- }
- optionVal
- })
+ let updatedCountryNames =
+ countryNames->DropdownField.updateArrayOfStringToOptionsTypeArray
| AddressCountry(countryArr) =>
- let updatedCountryArr: array<
- DropdownField.optionType,
- > = countryArr->Array.map(item => {
- let optionVal: DropdownField.optionType = {
- label: item,
- value: item,
- }
- optionVal
- })
+ let updatedCountryArr =
+ countryArr->DropdownField.updateArrayOfStringToOptionsTypeArray
| Bank =>
- let updatedBankNames: array<
- DropdownField.optionType,
- > = bankNames->Array.map(item => {
- let optionVal: DropdownField.optionType = {
- label: item,
- value: item,
- }
- optionVal
- })
+ let updatedBankNames =
+ bankNames->DropdownField.updateArrayOfStringToOptionsTypeArray
{
DropdownField.optionType,
> = countryAndCodeCodeList->Array.reduce([], (acc, countryObj) => {
let countryObjDict = countryObj->getDictFromJson
+ let countryFlag = countryObjDict->getString("country_flag", "")
+ let phoneNumberCode = countryObjDict->getString("phone_number_code", "")
+ let countryName = countryObjDict->getString("country_name", "")
+
let phoneNumberOptionsValue: DropdownField.optionType = {
- label: `${countryObjDict->getString("country_flag", "")} ${countryObjDict->getString(
- "country_name",
- "",
- )} ${countryObjDict->getString("phone_number_code", "")}`,
- displayValue: `${countryObjDict->getString("country_flag", "")} ${countryObjDict->getString(
- "phone_number_code",
- "",
- )}`,
- value: countryObjDict->getString("phone_number_code", ""),
+ label: `${countryFlag} ${countryName} ${phoneNumberCode}`,
+ displayValue: `${countryFlag} ${phoneNumberCode}`,
+ value: phoneNumberCode,
}
acc->Array.push(phoneNumberOptionsValue)
acc
@@ -76,11 +74,13 @@ let make = () => {
phoneNumberCodeOptions
->Array.find(ele => ele.value === valueDropDown)
->Option.getOr({
- label: "",
value: "",
- displayValue: "",
})
- setDisplayValue(_ => findDisplayValue.displayValue->Option.getOr(findDisplayValue.label))
+ setDisplayValue(_ =>
+ findDisplayValue.displayValue->Option.getOr(
+ findDisplayValue.label->Option.getOr(findDisplayValue.value),
+ )
+ )
None
}, [phoneNumberCodeOptions])
diff --git a/src/Payments/BankDebitModal.res b/src/Payments/BankDebitModal.res
index 83ea47c17..879b82a14 100644
--- a/src/Payments/BankDebitModal.res
+++ b/src/Payments/BankDebitModal.res
@@ -319,11 +319,9 @@ let make = (~setModalData) => {
disabled=false
options=[
{
- label: "Savings",
value: "Savings",
},
{
- label: "Checking",
value: "Checking",
},
]
diff --git a/src/Payments/KlarnaPayment.res b/src/Payments/KlarnaPayment.res
index 7a6c1f802..84a2bb91c 100644
--- a/src/Payments/KlarnaPayment.res
+++ b/src/Payments/KlarnaPayment.res
@@ -15,7 +15,8 @@ let make = (~paymentType, ~list: PaymentMethodsRecord.list) => {
let (fullName, _) = Recoil.useLoggedRecoilState(userFullName, "fullName", loggerState)
let (email, _) = Recoil.useLoggedRecoilState(userEmailAddress, "email", loggerState)
- let countryNames = Utils.getCountryNames(Country.country)
+ let countryNames =
+ Utils.getCountryNames(Country.country)->DropdownField.updateArrayOfStringToOptionsTypeArray
let (country, setCountry) = Recoil.useRecoilState(userCountry)
let setCountry = val => {
diff --git a/src/Payments/SepaBankTransfer.res b/src/Payments/SepaBankTransfer.res
index 5d4f2a25a..6fbe2970b 100644
--- a/src/Payments/SepaBankTransfer.res
+++ b/src/Payments/SepaBankTransfer.res
@@ -56,15 +56,8 @@ let make = (~paymentType, ~list) => {
}, (email, fullName, country))
useSubmitPaymentData(submitCallback)
- let updatedOptionsArrayForCountry: array<
- DropdownField.optionType,
- > = countryNames->Array.map(item => {
- let optionVal: DropdownField.optionType = {
- label: item,
- value: item,
- }
- optionVal
- })
+ let updatedOptionsArrayForCountry =
+ countryNames->DropdownField.updateArrayOfStringToOptionsTypeArray