Skip to content

Commit b5e49a7

Browse files
handle mm window
1 parent 3a8f6af commit b5e49a7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function ConnectWalletQrCode(props: ConnectWalletQrCodeProps) {
1515
const { qrCodeValue, isDark, selectedButton, logoImage, primaryColor } = props;
1616

1717
const isDesktop = useMemo<boolean>(() => {
18+
if (typeof window === "undefined") return false;
1819
const browser = Bowser.getParser(window.navigator.userAgent);
1920
return browser.getPlatformType() === "desktop";
2021
}, []);

packages/modal/src/ui/components/Root/Root.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function Root(props: RootProps) {
100100

101101
// Wallet Details
102102
const deviceDetails = useMemo<{ platform: platform; browser: browser; os: mobileOs }>(() => {
103+
if (typeof window === "undefined") return { platform: "mobile", browser: "chrome", os: "ios" };
103104
const browserData = Bowser.getParser(window.navigator.userAgent);
104105
return {
105106
platform: browserData.getPlatformType() as platform,

packages/no-modal/src/connectors/metamask-connector/metamaskConnector.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ class MetaMaskConnector extends BaseEvmConnector<void> {
7373

7474
// Detect app metadata
7575
const iconUrl = await getSiteIcon(window);
76+
// TODO: handle ssr
7677
const appMetadata: MetaMaskSDKOptions["dappMetadata"] = {
77-
name: getSiteName(window),
78-
url: window.location.origin,
78+
name: getSiteName(window) || "web3auth",
79+
url: window.location.origin || "https://web3auth.io",
7980
iconUrl,
8081
};
8182

8283
// initialize the MetaMask SDK
8384
const metamaskOptions = deepmerge(this.metamaskOptions || {}, { dappMetadata: appMetadata });
84-
this.metamaskSDK = new MetaMaskSDK({ ...metamaskOptions, _source: "web3auth" });
85+
this.metamaskSDK = new MetaMaskSDK({ ...metamaskOptions, _source: "web3auth", useDeeplink: metamaskOptions.useDeeplink ?? true });
8586
// Work around: in case there is an existing SDK instance in memory (window.mmsdk exists), it won't initialize the new SDK instance again
8687
// and return the existing instance instead of undefined (this is an assumption, not sure if it's a bug or feature of the MetaMask SDK)
8788
const initResult = await this.metamaskSDK.init();

0 commit comments

Comments
 (0)