Skip to content

Commit

Permalink
fix: nav straight to close modal if no isFromPostOnboardingEntryPoint…
Browse files Browse the repository at this point in the history
… boolean
  • Loading branch information
beths-ledger committed Apr 15, 2024
1 parent 048bab9 commit a1d0668
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-shirts-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Add isFromPostOnboardingEntryPoint param to open modal data. Use this to disable the Grow Your ETH staking modal advert when the user first receives ETH during the Stax onboarding flow.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type Data = {
receiveTokenMode?: boolean;
receiveNFTMode?: boolean;
eventType?: string;
isFromPostOnboardingEntryPoint: boolean;
isFromPostOnboardingEntryPoint?: boolean;
};

type OwnProps = {
Expand Down Expand Up @@ -69,6 +69,7 @@ export type StepProps = {
onChangeAddressVerified: (b?: boolean | null, a?: Error | null) => void;
onClose: () => void;
currencyName: string | undefined | null;
isFromPostOnboardingEntryPoint?: boolean;
};
export type St = Step<StepId, StepProps>;
const createSteps = (): Array<St> => [
Expand Down Expand Up @@ -161,6 +162,7 @@ const Body = ({
}
onChangeStepId("receive");
}, [onChangeAddressVerified, setDisabledSteps, steps, onChangeStepId]);

useEffect(() => {
const stepId =
params && params.startWithWarning ? "warning" : params.receiveTokenMode ? "account" : null;
Expand Down Expand Up @@ -220,6 +222,7 @@ const Body = ({
onStepChange: handleStepChange,
onClose: handleCloseModal,
currencyName,
isFromPostOnboardingEntryPoint: params.isFromPostOnboardingEntryPoint,
};
return (
<Stepper {...stepperProps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,13 @@ const StepReceiveFunds = (props: StepProps) => {
const onFinishReceiveFlow = useCallback(() => {
const dismissModal =
global.localStorage.getItem(`${LOCAL_STORAGE_KEY_PREFIX}${receivedCurrencyId}`) === "true";
if (!dismissModal && !receiveNFTMode && !receiveTokenMode && isStakingEnabledForAccount) {
if (
!dismissModal &&
!receiveNFTMode &&
!receiveTokenMode &&
isStakingEnabledForAccount &&
!isFromPostOnboardingEntryPoint
) {
track("button_clicked2", {
button: "continue",
page: window.location.hash
Expand All @@ -223,8 +229,8 @@ const StepReceiveFunds = (props: StepProps) => {
modal: "receive",
account: name,
});
// Only open EVM staking modal if the user received ETH or an EVM currency supported by the providers, and the user is not in the post-onboarding flow.
if (isDirectStakingEnabledForAccount && !isFromPostOnboardingEntryPoint) {
// Only open EVM staking modal if the user received ETH or an EVM currency supported by the providers
if (isDirectStakingEnabledForAccount) {
dispatch(
openModal("MODAL_EVM_STAKE", {
account: mainAccount,
Expand Down

0 comments on commit a1d0668

Please sign in to comment.