Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
fricoben committed Dec 2, 2024
1 parent da3630e commit 5551369
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
37 changes: 18 additions & 19 deletions components/discount/freeRegisterCheckout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ const FreeRegisterCheckout: FunctionComponent<FreeRegisterCheckoutProps> = ({
});
}, [coupon, domain, address, isWrongNetwork]);

const getButtonText = () => {
if (isWrongNetwork) return "Wrong Network";
if (!termsBox) return "Please accept terms & policies";
if (couponError || !coupon) return "Enter a valid Coupon";
if (loadingCallData) return "Loading call data";
if (loadingGas) {
if (invalidTx) return txError?.short;
return "Loading gas";
}
if (loadingTypedData) return "Building typed data";
if (loadingDeploymentData) {
if (paymasterRewards.length > 0) return "Loading deployment data";
return "No Paymaster reward available";
}
return "Register my domain";
};

return (
<div className={styles.container}>
<div className={styles.card}>
Expand Down Expand Up @@ -227,25 +244,7 @@ const FreeRegisterCheckout: FunctionComponent<FreeRegisterCheckoutProps> = ({
loadingTypedData
}
>
{isWrongNetwork
? "Wrong Network"
: !termsBox
? "Please accept terms & policies"
: couponError || !coupon
? "Enter a valid Coupon"
: loadingCallData
? "Loading call data"
: loadingGas
? invalidTx
? txError?.short
: "Loading gas"
: loadingTypedData
? "Building typed data"
: loadingDeploymentData
? paymasterRewards.length > 0
? "Loading deployment data"
: "No Paymaster reward available"
: "Register my domain"}
{getButtonText()}
</Button>
) : (
<ConnectButton />
Expand Down
12 changes: 7 additions & 5 deletions components/domains/steps/checkoutCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ const CheckoutCard: FunctionComponent<CheckoutCardProps> = ({
[updateFormState]
);

const getButtonText = () => {
if (!termsBox) return "Please accept terms & policies";
if (invalidBalance) return `You don't have enough ${displayedCurrency}`;
return "Purchase";
};

return (
<>
{formState.durationInYears === 1 ? (
Expand Down Expand Up @@ -307,11 +313,7 @@ const CheckoutCard: FunctionComponent<CheckoutCardProps> = ({
!termsBox
}
>
{!termsBox
? "Please accept terms & policies"
: invalidBalance
? `You don't have enough ${displayedCurrency}`
: "Purchase"}
{getButtonText()}
</Button>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions tests/utils/userDataService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ describe("computeMetadataHash function", () => {
expectedHashHex.length - 2
);

const result = await computeMetadataHash(
"none",email, taxState, salt);
const result = await computeMetadataHash(email, taxState, salt);

expect(result).toBe(expectedHash);
});
Expand Down

0 comments on commit 5551369

Please sign in to comment.