Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add feature flag for social login #2770

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Conversation

usame-algan
Copy link
Member

@usame-algan usame-algan commented Nov 8, 2023

What it solves

Part of #2452

How this PR fixes it

Adds a new feature flag SOCIAL_LOGIN. If the feature flag is not enabled on a certain chain the Google Login button in the Header and Welcome page will be hidden and the Social Login option in Onboard will be hidden.

Also removes the redirect to safe creation when logging in on the welcome page.

How to test it

  1. Open Safe on staging CGW
  2. Switch to Goerli
  3. Observe no Google button visible in the header and welcome page
  4. Observe no Social Login button visible in the onboard modal

Screenshots

Screenshot 2023-11-08 at 10 25 15 Screenshot 2023-11-08 at 10 25 23 Screenshot 2023-11-08 at 10 25 30

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Nov 8, 2023

Branch preview

✅ Deploy successful!

https://feature_flag--walletweb.review-wallet-web.5afe.dev

@usame-algan
Copy link
Member Author

We could also show the "old" Connect button in the header then that immediately opens the onboard modal. Wdyt @schmanu @katspaugh ?

Copy link

github-actions bot commented Nov 8, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@katspaugh
Copy link
Member

@usame-algan yes, I think that would be good if not too difficult.

Copy link

github-actions bot commented Nov 8, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.09% (+0.01% 🔼)
10092/13439
🔴 Branches
49.6% (-0.04% 🔻)
2051/4135
🔴 Functions
57.64% (-0.06% 🔻)
1501/2604
🟡 Lines
76.64% (+0.02% 🔼)
9126/11907
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / ConnectionCenter.tsx
85.19% 66.67% 40% 91.67%
🟡
... / ConnectWalletButton.tsx
77.78% 100% 50% 75%
🟢
... / WalletDetails.tsx
100% 100% 0% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / SocialLoginModule.ts
58.46% (-0.55% 🔻)
30% (-3.33% 🔻)
62.5% (-4.17% 🔻)
57.89% (+1.53% 🔼)
🟢
... / index.tsx
80.3% (-3.52% 🔻)
75% (-6.25% 🔻)
60%
85% (-2.3% 🔻)

Test suite run success

1105 tests passing in 155 suites.

Report generated by 🧪jest coverage report action from 33b220f

@@ -29,13 +32,17 @@ const WelcomeLogin = () => {
</Typography>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also remove or change the text above?
It still says "Choose how you would like to create your Safe Account" or is it okay as you can choose one of the onboard wallets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine because there are multiple options in the onboard modal so the user is technically still choosing.

@@ -2,6 +2,8 @@ import { _getMPCCoreKitInstance } from '@/hooks/wallets/mpc/useMPC'
import { getSocialWalletService } from '@/hooks/wallets/mpc/useSocialWallet'
import { getWeb3ReadOnly } from '@/hooks/wallets/web3'
import * as PasswordRecoveryModal from '@/services/mpc/PasswordRecoveryModal'
import { FEATURES, hasFeature } from '@/utils/chains'
import { ChainInfo } from '@safe-global/safe-gateway-typescript-sdk'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import type is required here.

describe('MPC Onboard module', () => {
beforeAll(() => {
jest.spyOn(feature, 'hasFeature').mockReturnValue(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the feature to the mockChain using the builder instead?

@usame-algan usame-algan merged commit ea3763b into web3authcoresdk Nov 8, 2023
11 checks passed
@usame-algan usame-algan deleted the feature-flag branch November 8, 2023 12:56
@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants