Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/pages/accounts/api/dialog.iframe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Creates an iframe dialog that embeds the auth app in a `<dialog>` element. This

Falls back to a popup on Safari (which does not support WebAuthn in cross-origin iframes) and insecure (HTTP) origins.

Because Safari uses the popup fallback, open the wallet directly from the user's tap. Avoid `await`ing config fetches, dynamic imports, or other setup before calling `provider.request({ method: 'wallet_connect' })`; preload that work before rendering the button. See [`Dialog.popup`](/accounts/api/dialog.popup#mobile-safari-popup-blocking) for the recommended handler pattern.

## Usage

```ts
Expand Down
41 changes: 41 additions & 0 deletions src/pages/accounts/api/dialog.popup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,47 @@ description: Open the Tempo Wallet auth UI in a popup window.

Opens the auth app in a new browser window. Used as the default on Safari and insecure (HTTP) origins.

## Mobile Safari popup blocking

Mobile Safari blocks popups unless they open directly from the user's tap. Preload the Accounts SDK, provider, and any app configuration before the user taps a connect or payment button. In the tap handler, call the wallet request immediately, then continue the rest of your flow after the wallet responds.

```tsx
function ConnectButton({ provider }: { provider: Provider }) {
return (
<button
onClick={async () => {
const result = await provider.request({ method: 'wallet_connect' })
await continueAfterConnect(result)
}}
>
Connect
</button>
)
}
```

Do not fetch config, dynamically import the SDK, or check app state before opening the wallet inside the tap handler. If preload has not finished, show a loading state and ask the user to tap again.

```tsx
function ConnectButton({ providerReady }: { providerReady: boolean }) {
return (
<button
onClick={async () => {
if (!providerReady) {
setMessage('Tempo Wallet is still loading. Tap again in a moment.')
return
}

const result = await provider.request({ method: 'wallet_connect' })
await continueAfterConnect(result)
}}
>
Connect
</button>
)
}
```

## Usage

```ts
Expand Down
4 changes: 4 additions & 0 deletions src/pages/accounts/production.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ To enable the `iframe` dialog on all browsers in production, ensure your website

Without this, the `iframe` dialog will fallback to a popup on browsers that do not support the [IntersectionObserver v2 API](https://web.dev/articles/intersectionobserver-v2).

## Mobile Safari

Safari uses the popup fallback because WebAuthn is not supported in cross-origin iframes. Make sure the wallet request opens immediately from the user's tap: preload the Accounts SDK, provider, and configuration before the tap, then call `provider.request({ method: 'wallet_connect' })` as the first async wallet step in the tap handler. If preload is not ready, show a loading or retry state instead of doing setup and opening the popup later.

## Content Security Policy

If you've deployed a Content Security Policy, ensure that you have the Tempo Accounts SDK configured with your CSPs.
Expand Down
Loading