Skip to content

[react] remove const enums #2354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilled-buses-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/react": patch
---

Remove const enums to object to fix issues with Next.js <13.5
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ interface VerifyOwnershipWithPaperProps {
clientId?: string;
}

const enum VERIFY_OWNERSHIP_WITH_PAPER_EVENT_TYPE {
USER_LOGIN_SUCCESS = "userLoginSuccess",
USER_LOGIN_FAILED = "userLoginFailed",
USER_CLOSE_LOGIN_PAGE = "userCloseLoginPage",
}
const VERIFY_OWNERSHIP_WITH_PAPER_EVENT_TYPE = {
USER_LOGIN_SUCCESS: "userLoginSuccess",
USER_LOGIN_FAILED: "userLoginFailed",
USER_CLOSE_LOGIN_PAGE: "userCloseLoginPage",
} as const;

export const VerifyOwnershipWithPaper: React.FC<
VerifyOwnershipWithPaperProps
Expand Down
16 changes: 9 additions & 7 deletions packages/react/src/payments/interfaces/WalletTypes.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// UNCHANGED
export const enum WalletType {
Preset = "Preset",
MetaMask = "metaMask",
CoinbaseWallet = "coinbaseWallet",
WalletConnect = "walletConnect",
Phantom = "Phantom",
}
const WalletTypeObj = {
Preset: "Preset",
MetaMask: "metaMask",
CoinbaseWallet: "coinbaseWallet",
WalletConnect: "walletConnect",
Phantom: "Phantom",
} as const;

export type WalletType = (typeof WalletTypeObj)[keyof typeof WalletTypeObj];

export interface ConnectWalletProps {
onWalletConnected: onWalletConnectedType;
Expand Down