fix(subscription): preselect pay channel before navigation
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
type PendingChatUnlock,
|
||||
type PendingChatUnlockKind,
|
||||
} from "@/lib/navigation/chat_unlock_session";
|
||||
import { getDefaultPayChannelForCountryCode } from "@/lib/payment/default_pay_channel";
|
||||
|
||||
import { getInsufficientCreditsSubscriptionType } from "../chat-screen.helpers";
|
||||
|
||||
@@ -135,10 +136,13 @@ export function useChatUnlockNavigationFlow({
|
||||
stage: "payment",
|
||||
});
|
||||
chatDispatch({ type: "ChatUnlockPaywallNavigationConsumed" });
|
||||
const defaultPayChannel = getDefaultPayChannelForCountryCode(
|
||||
userState.currentUser?.countryCode,
|
||||
);
|
||||
router.push(
|
||||
ROUTE_BUILDERS.subscription(
|
||||
getInsufficientCreditsSubscriptionType(userState.isVip),
|
||||
{ returnTo: "chat" },
|
||||
{ payChannel: defaultPayChannel, returnTo: "chat" },
|
||||
),
|
||||
);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user