Skip to content

Commit

Permalink
fix: remove duplicated basic button (#3678)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir authored Jan 17, 2025
1 parent 64b916c commit 1614ff6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
23 changes: 23 additions & 0 deletions .changeset/sweet-sloths-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@reown/appkit-scaffold-ui': patch
'@reown/appkit-adapter-bitcoin': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Removes duplicated all wallets button on AppKit Basic
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { html } from 'lit'
import { state } from 'lit/decorators.js'
import { ifDefined } from 'lit/directives/if-defined.js'

import {
AssetUtil,
ConnectionController,
EventsController,
OptionsController,
ThemeController
} from '@reown/appkit-core'
import { customElement } from '@reown/appkit-ui'
Expand All @@ -18,18 +16,9 @@ import styles from './styles.js'
export class W3mConnectingWcQrcode extends W3mConnectingWidget {
public static override styles = styles

// -- State & Properties -------------------------------- //
@state() private useInjectedUniversalProvider =
OptionsController.state.useInjectedUniversalProvider

public constructor() {
super()
window.addEventListener('resize', this.forceUpdate)
this.unsubscribe.push(
OptionsController.subscribeKey('useInjectedUniversalProvider', () => {
this.useInjectedUniversalProvider = OptionsController.state.useInjectedUniversalProvider
})
)

EventsController.sendEvent({
type: 'track',
Expand Down Expand Up @@ -63,11 +52,6 @@ export class W3mConnectingWcQrcode extends W3mConnectingWidget {
${this.copyTemplate()}
</wui-flex>
<w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
${this.useInjectedUniversalProvider
? html`<wui-flex flexDirection="column" .padding=${['0', 'xl', 'xl', 'xl']} gap="xl">
<w3m-all-wallets-widget></w3m-all-wallets-widget>
</wui-flex>`
: null}
`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
ConnectionController,
CoreHelperUtil,
EventsController,
OptionsController,
RouterController,
type WcWallet
} from '@reown/appkit-core'
Expand All @@ -16,7 +15,6 @@ import type { WuiQrCode } from '@reown/appkit-ui'
import { HelpersUtil } from '../utils/HelpersUtil'

// -- Constants ------------------------------------------- //
const ALL_WALLETS_WIDGET = 'w3m-all-wallets-widget'
const QR_CODE = 'wui-qr-code'
const WALLET = {
name: 'WalletConnect'
Expand Down Expand Up @@ -64,23 +62,4 @@ describe('W3mConnectingWcQrcode', () => {
properties: { name: WALLET.name, platform: 'qrcode' }
})
})

it('it should use the injected universal provider when "OptionsController.useInjectedUniversalProvider" is true', async () => {
vi.spyOn(OptionsController, 'state', 'get').mockReturnValue({
...OptionsController.state,
useInjectedUniversalProvider: true
})

const connectingQrCode = await fixture(
html`<w3m-connecting-wc-qrcode></w3m-connecting-wc-qrcode>`
)

// We display all wallets widget if we use injected universal provider
expect(HelpersUtil.querySelect(connectingQrCode, ALL_WALLETS_WIDGET)).not.toBeNull()
expect(EventsController.sendEvent).toHaveBeenCalledWith({
type: 'track',
event: 'SELECT_WALLET',
properties: { name: WALLET.name, platform: 'qrcode' }
})
})
})

0 comments on commit 1614ff6

Please sign in to comment.