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(LIVE-9486): add specific featureFlags deeplinks tutorial #5027

Merged

Conversation

stephane-lieumont-ledger
Copy link
Contributor

@stephane-lieumont-ledger stephane-lieumont-ledger commented Oct 11, 2023

📝 Description

  • Add specific featureflags deeplinks during LLD Onboarding with LNX to redirect on recover.
  • Add Custom uri on hook useProtect useCustomPath
  • Adjust links to recover Restore and Upsell screen with function useCustomPath
  • Fix black screen at the end of onboarding Stax during Recover Live App redirection

❓ Context

  • Impacted projects: ledger-live-desktop, live-common, types-live
  • Linked resource(s): LIVE-9486 - PROTECT-2575

✅ Checklist

  • Test coverage
  • Atomic delivery
  • No breaking changes

📸 Demo

🚀 Expectations to reach

Please make sure you follow these Important Steps.

Pull Requests must pass the CI and be internally validated in order to be merged.

@changeset-bot
Copy link

changeset-bot bot commented Oct 11, 2023

🦋 Changeset detected

Latest commit: 843834a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@ledgerhq/types-live Patch
ledger-live-desktop Patch
@ledgerhq/live-common Patch
@ledgerhq/live-cli Patch
live-mobile Patch
web-tools Patch
@ledgerhq/coin-algorand Patch
@ledgerhq/coin-evm Patch
@ledgerhq/coin-framework Patch
@ledgerhq/coin-polkadot Patch
@ledgerhq/domain-service Patch
@ledgerhq/hw-app-eth Patch
@ledgerhq/test-utils Patch
dummy-wallet-app Patch
@ledgerhq/swift-bridge-hw-app-eth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 11, 2023

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

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

@github-actions github-actions bot added desktop Has changes in LLD common Has changes in live-common ledgerjs Has changes in the ledgerjs open source libs labels Oct 11, 2023
Comment on lines 139 to 141
const search = `?${page ? `redirectTo=${page}` : ""}${page && source ? "&" : ""}${
source ? `source=${source}` : ""
}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to use URLSearchParams and call .toString() on it instead of constructing by hand the different variant

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 577 to 580
} else if (useCase === UseCase.recoveryPhrase && postOnboardingPath) {
history.push(postOnboardingPath);
} else if (useCase === UseCase.connectDevice && devicePairingPath) {
history.push(devicePairingPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

Was that added to move to different "route" if you end the onboarding in different screens ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's done on liveApp
The links are update on featureflags protectServiceDesktop (dev).
We need to wait next release to update FF staging and prod

There is all routes params for deeplinks_clicked events
We need to send this with the LiveApp to have the good UserID of Recover

Copy link
Contributor

@Justkant Justkant left a comment

Choose a reason for hiding this comment

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

Small change I would do

Comment on lines 156 to 164
const [basicUri] = modelUri ? modelUri.split("?") : [];
const uri = new URL(basicUri);

if (page) uri.searchParams.append("redirectTo", page);
if (source) uri.searchParams.append("source", source);
if (source && deeplinkCampaign) {
uri.searchParams.append("ajs_recover_source", source);
uri.searchParams.append("ajs_recover_campaign", deeplinkCampaign);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about the cost of creating an URL and appending to it but I would memo that part

Suggested change
const [basicUri] = modelUri ? modelUri.split("?") : [];
const uri = new URL(basicUri);
if (page) uri.searchParams.append("redirectTo", page);
if (source) uri.searchParams.append("source", source);
if (source && deeplinkCampaign) {
uri.searchParams.append("ajs_recover_source", source);
uri.searchParams.append("ajs_recover_campaign", deeplinkCampaign);
}
const uri = useMemo(() => {
const [basicUri] = modelUri ? modelUri.split("?") : [];
const uri = new URL(basicUri);
if (page) uri.searchParams.append("redirectTo", page);
if (source) uri.searchParams.append("source", source);
if (source && deeplinkCampaign) {
uri.searchParams.append("ajs_recover_source", source);
uri.searchParams.append("ajs_recover_campaign", deeplinkCampaign);
}
return uri;
}, [deeplinkCampaign, modelUri, page, source]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stephane-lieumont-ledger stephane-lieumont-ledger merged commit 3dc4937 into develop Oct 25, 2023
63 of 72 checks passed
@stephane-lieumont-ledger stephane-lieumont-ledger deleted the bugfix/deeplink-redirection-tracking-lld branch October 25, 2023 18:47
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 desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants