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

[LLM][PROTECT-3391/3392/3393/3401/3403] Auto redirection to Recover upsell at the end of Stax/Flex onboarding #8226

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

ofreyssinet-ledger
Copy link
Contributor

@ofreyssinet-ledger ofreyssinet-ledger commented Oct 28, 2024

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • Flex/Stax synchronous onboarding:
      • With feature flag recoverUpsellRedirection deactivated, the onboarding flow is unchanged.
      • With feature flag recoverUpsellRedirection activated, the "Backup for your Secret Recovery Phrase" step between Secret Recovery Phrase and Apps Installation will be hidden.
    • End of the onboarding:
      • With feature flag recoverUpsellRedirection deactivated, the post onboarding hub is opened immediately.
      • With feature flag recoverUpsellRedirection activate, the Ledger Recover upsell is opened. When that upsell is dismissed, the user is redirected to the post onboarding hub.

How to test:

0. Prerequisite for each test

  • Reset app (Recover upsell shows only once) OR go to Settings > Debug > Configuration and press "Reset onboarding state".
  • Go to Settings > Debug > Configuration & enable “Ledger Recover deeplinks environment”. This will ensure the URL Recover upsell is the production one, so it doesn't require any additional local setup (VPN etc.).

Test 1. recoverUpsellRedirection FF enabled
Onboarding Flex / Stax:
-> the "backup" step should not be in the sync onboarding.
-> at the end, it should open the Recover upsell.
-> when dismissing the Recover upsell, it should redirect to post onboarding.

Test 2. recoverUpsellRedirection FF disabled
Onboarding Flex / Stax:
-> the "backup" setup should be in the sync onboarding.
-> at the end, it should open the post onboarding.

Test 3. Nano X onboarding (non reg)
Onboarding Nano X:
-> at the end, it should open the Recover upsell.

Test 4. Nano SP onboarding (non reg)
Onboarding Nano SP:
-> at the end, it should just go to the portfolio screen.

📝 Description

Cf. "impact of the changes".

I had to do some refactoring to have all the post onboarding & upsell auto redirection logic in one place (the portfolio screen) to ensure its robustness for all device models.

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

Copy link

vercel bot commented Oct 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web-tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 30, 2024 3:52pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 3:52pm
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 3:52pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 3:52pm
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 3:52pm

@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from a909caa to 0037020 Compare October 28, 2024 18:35
@live-github-bot live-github-bot bot added mobile Has changes in LLM common Has changes in live-common ledgerjs Has changes in the ledgerjs open source libs labels Oct 28, 2024
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from 0037020 to 4410996 Compare October 28, 2024 18:36
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from 4410996 to e422f97 Compare October 28, 2024 18:47
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch 3 times, most recently from 14249d9 to 98b4bb0 Compare October 29, 2024 11:05
@ofreyssinet-ledger ofreyssinet-ledger changed the title Feature/protect 3391 3392 3393 3401 3403 [LLM][PROTECT-3391/3392/3393/3401/3403] Auto redirection to Recover upsell at the end of Stax/Flex onboarding Oct 29, 2024
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch 2 times, most recently from 119771d to 8f59261 Compare October 29, 2024 12:59
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from 8f59261 to 07016ab Compare October 29, 2024 14:25
@ofreyssinet-ledger ofreyssinet-ledger marked this pull request as ready for review October 29, 2024 14:45
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from 07016ab to 618e5b5 Compare October 29, 2024 17:07
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from 618e5b5 to 8a8dae5 Compare October 29, 2024 17:14
Copy link
Contributor

@mcayuelas-ledger mcayuelas-ledger left a comment

Choose a reason for hiding this comment

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

Some comments :)

@ofreyssinet-ledger ofreyssinet-ledger force-pushed the feature/protect-3391-3392-3393-3401-3403 branch from 8a8dae5 to 9caa863 Compare October 30, 2024 09:21
Copy link
Contributor

@mcayuelas-ledger mcayuelas-ledger left a comment

Choose a reason for hiding this comment

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

LGTM

aussedatlo
aussedatlo previously approved these changes Oct 30, 2024

function testScenarios(scenarios: Scenario[]) {
scenarios.forEach(scenario => {
it(`should return ${JSON.stringify(scenario.expected)} for ${JSON.stringify(scenario.device)} and feature flag enabled: ${scenario.featureFlagEnabled}`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

[could] use it.each syntax

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +23 to +38
useEffect(() => {
if (!isFocused) return;
if (shouldRedirectToProtectUpsell) {
openProtectUpsell();
} else if (shouldRedirectToPostOnboarding && lastConnectedDevice) {
openPostOnboarding(lastConnectedDevice.modelId);
}
}, [
lastConnectedDevice,
openPostOnboarding,
openProtectUpsell,
shouldRedirectToPostOnboarding,
shouldRedirectToProtectUpsell,
focused,
isFocused,
]);
Copy link
Contributor

@Justkant Justkant Oct 31, 2024

Choose a reason for hiding this comment

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

I'm wondering if there is a risk of us calling again an open because isFocused toggles when opening the first time and coming back to the screen using this hook

Edit: probably handled here I suppose https://github.com/LedgerHQ/ledger-live/pull/8226/files#diff-3f35818d8304ffbf87ae671eca670437cfc8eade2dfac067406cdb959ae5f496R37-R41

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once the redirection to whatever is done, shouldRedirectToWhatever will be false, so it won't trigger again 👍

@ofreyssinet-ledger ofreyssinet-ledger merged commit cd686cf into develop Oct 31, 2024
56 checks passed
@ofreyssinet-ledger ofreyssinet-ledger deleted the feature/protect-3391-3392-3393-3401-3403 branch October 31, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants