Skip to content

Commit

Permalink
fix: email 'or' line separator not showing after disabling social log…
Browse files Browse the repository at this point in the history
…ins (#2977)
  • Loading branch information
magiziz authored Oct 3, 2024
1 parent a649a1c commit d45545d
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .changeset/good-months-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
'@reown/appkit-scaffold-ui': patch
'@apps/laboratory': patch
'@apps/demo': patch
'@apps/gallery': patch
'@examples/html-ethers': patch
'@examples/html-ethers5': patch
'@examples/html-wagmi': patch
'@examples/next-ethers': patch
'@examples/next-wagmi': patch
'@examples/react-ethers': patch
'@examples/react-ethers5': patch
'@examples/react-solana': patch
'@examples/react-wagmi': patch
'@examples/vue-ethers5': patch
'@examples/vue-solana': patch
'@examples/vue-wagmi': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-ethers': patch
'@reown/appkit-ethers5': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-solana': patch
'@reown/appkit-ui': patch
'@reown/appkit-wagmi': patch
'@reown/appkit-wallet': patch
---

Fixed an issue where email line separator was not showing when social logins were disabled and `emailShowWallets` was set to false.
3 changes: 2 additions & 1 deletion apps/laboratory/src/pages/library/ethers-no-socials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const modal = createAppKit({
projectId: ConstantsUtil.ProjectId,
features: {
analytics: true,
socials: []
socials: [],
emailShowWallets: false
},
siweConfig
})
Expand Down
3 changes: 2 additions & 1 deletion apps/laboratory/src/pages/library/ethers5-no-socials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const modal = createAppKit({
projectId: ConstantsUtil.ProjectId,
features: {
analytics: true,
socials: []
socials: [],
emailShowWallets: false
},
siweConfig
})
Expand Down
3 changes: 2 additions & 1 deletion apps/laboratory/src/pages/library/solana-no-socials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const modal = createAppKit({
projectId: ConstantsUtil.ProjectId,
metadata: ConstantsUtil.Metadata,
features: {
socials: []
socials: [],
emailShowWallets: false
}
})

Expand Down
3 changes: 2 additions & 1 deletion apps/laboratory/src/pages/library/wagmi-no-socials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const modal = createAppKit({
projectId: ConstantsUtil.ProjectId,
features: {
analytics: true,
socials: []
socials: [],
emailShowWallets: false
}
})

Expand Down
4 changes: 4 additions & 0 deletions apps/laboratory/tests/no-socials.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ noSocialsTest('should not display any socials', async () => {
noSocialsTest('should show email login', async () => {
await modalValidator.expectEmailLogin()
})

noSocialsTest('should show "or" line separator under email field', async () => {
await modalValidator.expectEmailLineSeparator()
})
5 changes: 5 additions & 0 deletions apps/laboratory/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ export class ModalValidator {
await expect(emailInput).toBeVisible()
}

async expectEmailLineSeparator() {
const emailInput = this.page.getByTestId('w3m-email-login-or-separator')
await expect(emailInput).toBeVisible()
}

async expectValidSignature(signature: `0x${string}`, address: `0x${string}`, chainId: number) {
const isVerified = await verifySignature({
address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ export class W3mEmailLoginWidget extends LitElement {
const socials = OptionsController.state.features?.socials
const multipleConnectors = this.connectors.length > 1
const enableWallets = OptionsController.state.enableWallets
const emailShowWallets = OptionsController.state.features?.emailShowWallets

const hideSeparator = socials || !multipleConnectors || !enableWallets
const hideSeparator =
(socials && socials.length) || emailShowWallets || !multipleConnectors || !enableWallets

if (hideSeparator && this.walletGuide === 'get-started') {
return null
Expand All @@ -116,7 +118,10 @@ export class W3mEmailLoginWidget extends LitElement {
}

return html`
<wui-flex .padding=${['xxs', '0', '0', '0'] as const}>
<wui-flex
data-testid="w3m-email-login-or-separator"
.padding=${['xxs', '0', '0', '0'] as const}
>
<wui-separator text="or"></wui-separator>
</wui-flex>
`
Expand Down

0 comments on commit d45545d

Please sign in to comment.