Skip to content

Commit

Permalink
Merge pull request #1245 from internxt/fix/change-auth-method-in-inte…
Browse files Browse the repository at this point in the history
…grated-checkout

[MKT-434]: fix/avoid activating/deactivating upsells from auth toggle button and fix saved discount
  • Loading branch information
xabg2 authored Aug 27, 2024
2 parents c36d0e2 + 2efddca commit 6cbbb95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/payment/components/checkout/ProductCardComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export const ProductFeaturesComponent = ({
const planAmount = getProductAmount(selectedPlan.decimalAmount, couponCodeData).toFixed(2);
const upsellPlanAmount = upsellManager.amount && getProductAmount(upsellManager.amount, couponCodeData).toFixed(2);

const discountPercentage =
couponCodeData?.amountOff && couponCodeData?.amountOff < selectedPlan.amount
? ((couponCodeData?.amountOff / selectedPlan.amount) * 100).toFixed(2)
: undefined;

return (
<div className="flex w-full flex-col space-y-4 overflow-y-auto">
<div className="flex w-full flex-row items-center justify-between space-x-4">
Expand Down Expand Up @@ -91,7 +96,7 @@ export const ProductFeaturesComponent = ({
<SealPercent weight="fill" size={24} />
<p className="">
{translate('checkout.productCard.saving', {
percent: couponCodeData?.percentOff,
percent: couponCodeData?.percentOff ?? discountPercentage,
})}
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ const CheckoutView = ({
});

function onAuthMethodToggled(authMethod: AuthMethodTypes) {
reset({
email: '',
password: '',
});
checkoutViewManager.handleAuthMethodChange(authMethod);
reset();
}

return (
Expand Down

0 comments on commit 6cbbb95

Please sign in to comment.