Skip to content

Commit

Permalink
feat: added prop for displayDefaultSavedPaymentIcon (#434)
Browse files Browse the repository at this point in the history
Co-authored-by: Praful Koppalkar <[email protected]>
  • Loading branch information
PritishBudhiraja and prafulkoppalkar authored Jun 13, 2024
1 parent b02a25c commit b141aed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Components/SavedCardItem.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ let make = (
~setRequiredFieldsBody,
) => {
let {themeObj, config, localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
let {hideExpiredPaymentMethods} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
let {hideExpiredPaymentMethods, displayDefaultSavedPaymentIcon} = Recoil.useRecoilValueFromAtom(
RecoilAtoms.optionAtom,
)
let (cardBrand, setCardBrand) = Recoil.useRecoilState(RecoilAtoms.cardBrand)
let (
isCVCValid,
Expand Down Expand Up @@ -116,7 +118,9 @@ let make = (
</div>
</div>
: <div> {React.string(paymentMethodType->Utils.snakeToTitleCase)} </div>}
<RenderIf condition={paymentItem.defaultPaymentMethodSet}>
<RenderIf
condition={displayDefaultSavedPaymentIcon &&
paymentItem.defaultPaymentMethodSet}>
<Icon size=18 name="checkmark" style={color: themeObj.colorPrimary} />
</RenderIf>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/Types/PaymentType.res
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ type options = {
paymentMethodsHeaderText?: string,
savedPaymentMethodsHeaderText?: string,
hideExpiredPaymentMethods: bool,
displayDefaultSavedPaymentIcon: bool,
}
let defaultCardDetails = {
scheme: None,
Expand Down Expand Up @@ -295,6 +296,7 @@ let defaultOptions = {
billingAddress: defaultBillingAddress,
sdkHandleConfirmPayment: defaultSdkHandleConfirmPayment,
hideExpiredPaymentMethods: false,
displayDefaultSavedPaymentIcon: true,
}
let getLayout = (str, logger) => {
switch str {
Expand Down Expand Up @@ -978,6 +980,7 @@ let itemToObjMapper = (dict, logger) => {
"paymentMethodsHeaderText",
"savedPaymentMethodsHeaderText",
"hideExpiredPaymentMethods",
"displayDefaultSavedPaymentIcon",
],
dict,
"options",
Expand Down Expand Up @@ -1019,6 +1022,7 @@ let itemToObjMapper = (dict, logger) => {
paymentMethodsHeaderText: ?getOptionString(dict, "paymentMethodsHeaderText"),
savedPaymentMethodsHeaderText: ?getOptionString(dict, "savedPaymentMethodsHeaderText"),
hideExpiredPaymentMethods: getBool(dict, "hideExpiredPaymentMethods", false),
displayDefaultSavedPaymentIcon: getBool(dict, "displayDefaultSavedPaymentIcon", true),
}
}

Expand Down

0 comments on commit b141aed

Please sign in to comment.