refactor(app): tighten feature boundaries
This commit is contained in:
@@ -3,10 +3,13 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { BackButton } from "@/app/_components";
|
||||
import { consumePendingChatImageReturn } from "@/app/chat/chat-image-return-session";
|
||||
import { Checkbox, MobileShell } from "@/app/_components/core";
|
||||
import { AppConstants } from "@/core/app_constants";
|
||||
import { PendingPaymentOrderStorage } from "@/data/storage";
|
||||
import { consumePendingChatImageReturn } from "@/lib/navigation/chat_image_return_session";
|
||||
import {
|
||||
clearPendingPaymentOrder,
|
||||
getPendingPaymentOrderForType,
|
||||
} from "@/lib/payment/pending_payment_order";
|
||||
import {
|
||||
usePaymentDispatch,
|
||||
usePaymentState,
|
||||
@@ -85,13 +88,11 @@ export function SubscriptionScreen({
|
||||
let cancelled = false;
|
||||
|
||||
const handlePendingOrder = async () => {
|
||||
const result = await PendingPaymentOrderStorage.getPendingOrderForType(
|
||||
subscriptionType,
|
||||
);
|
||||
const result = await getPendingPaymentOrderForType(subscriptionType);
|
||||
if (cancelled || !result.success || result.data === null) return;
|
||||
|
||||
if (!shouldResumePendingOrder) {
|
||||
await PendingPaymentOrderStorage.clearPendingOrder();
|
||||
await clearPendingPaymentOrder();
|
||||
if (
|
||||
payment.currentOrderId === result.data.orderId &&
|
||||
(payment.isPollingOrder || payment.isPaid || payment.status === "failed")
|
||||
@@ -130,7 +131,7 @@ export function SubscriptionScreen({
|
||||
if (!payment.currentOrderId) return;
|
||||
if (!payment.isPaid && payment.status !== "failed") return;
|
||||
|
||||
void PendingPaymentOrderStorage.clearPendingOrder();
|
||||
void clearPendingPaymentOrder();
|
||||
}, [payment.currentOrderId, payment.isPaid, payment.status]);
|
||||
|
||||
const vipOfferPlans = useMemo(
|
||||
|
||||
Reference in New Issue
Block a user