feat(FN-281): add payment_success and payment_failed PostHog events (+1 more)
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Commits merged: - fix(FN-281): make result search param truly optional to fix typecheck - feat(FN-281): add payment_success and payment_failed PostHog events Files changed: apps/api/package.json | 1 + apps/api/src/app.module.ts | 2 + apps/api/src/payments/payments.service.spec.ts | 99 +- apps/api/src/payments/payments.service.ts | 40 + apps/api/src/posthog/posthog.module.ts | 9 + apps/api/src/posthog/posthog.service.ts | 64 ++ .../web/src/components/payment/payment-content.tsx | 24 +- apps/web/src/routeTree.gen.ts | 1110 ++++++++++---------- apps/web/src/routes/dashboard/subscription/pay.tsx | 24 +- packages/config/src/index.ts | 4 + pnpm-lock.yaml | 30 + 11 files changed, 827 insertions(+), 580 deletions(-) Fusion-Task-Id: FN-281
This commit is contained in:
@@ -9,16 +9,26 @@ const PaymentContent = lazy(() =>
|
||||
);
|
||||
|
||||
export const Route = createFileRoute("/dashboard/subscription/pay")({
|
||||
validateSearch: (search: Record<string, unknown>) => ({
|
||||
plan: (search.plan as string) || "",
|
||||
period: ((search.period as string) || "monthly") as "monthly" | "yearly",
|
||||
brands: (search.brands as string) || "",
|
||||
}),
|
||||
validateSearch: (search: Record<string, unknown>) => {
|
||||
const params: {
|
||||
plan: string;
|
||||
period: "monthly" | "yearly";
|
||||
brands: string;
|
||||
result?: string;
|
||||
} = {
|
||||
plan: (search.plan as string) || "",
|
||||
period: ((search.period as string) || "monthly") as "monthly" | "yearly",
|
||||
brands: (search.brands as string) || "",
|
||||
};
|
||||
const result = search.result as string | undefined;
|
||||
if (result) params.result = result;
|
||||
return params;
|
||||
},
|
||||
component: PaymentPage,
|
||||
});
|
||||
|
||||
function PaymentPage() {
|
||||
const { plan, period, brands } = Route.useSearch();
|
||||
const { plan, period, brands, result } = Route.useSearch();
|
||||
const brandIds = brands.split(",").filter(Boolean);
|
||||
|
||||
return (
|
||||
@@ -37,7 +47,7 @@ function PaymentPage() {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<PaymentContent planKey={plan} period={period} brandIds={brandIds} />
|
||||
<PaymentContent planKey={plan} period={period} brandIds={brandIds} result={result} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user