Skip to content

Commit

Permalink
Set popup name to unique string (#1474)
Browse files Browse the repository at this point in the history
* set unique window name

* update tests

* move popup naming

* lint
  • Loading branch information
cb-jake authored Jan 13, 2025
1 parent 88773cb commit 3cd583e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/util/web.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('PopupManager', () => {
expect(window.open).toHaveBeenNthCalledWith(
1,
url,
'Smart Wallet',
expect.stringContaining('wallet_'),
'width=420, height=540, left=302, top=114'
);
expect(popup.focus).toHaveBeenCalledTimes(1);
Expand Down
4 changes: 2 additions & 2 deletions packages/wallet-sdk/src/util/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const POPUP_HEIGHT = 540;
export function openPopup(url: URL): Window {
const left = (window.innerWidth - POPUP_WIDTH) / 2 + window.screenX;
const top = (window.innerHeight - POPUP_HEIGHT) / 2 + window.screenY;

appendAppInfoQueryParams(url);

const popupId = `wallet_${crypto.randomUUID()}`;
const popup = window.open(
url,
'Smart Wallet',
popupId,
`width=${POPUP_WIDTH}, height=${POPUP_HEIGHT}, left=${left}, top=${top}`
);

Expand Down

0 comments on commit 3cd583e

Please sign in to comment.