All checks were successful
Deploy / deploy (push) Successful in 16m7s
- Added Rybbit analytics configuration in .mcp.json for improved data collection. - Updated layout.tsx to conditionally load the Rybbit analytics script in production. - Enhanced user interaction tracking in various components, including GirisForm, RevizyonKutusu, and SatinAlForm, by logging specific events. - Updated privacy policy page to reflect new data handling practices and added a section on service providers and data transfer. - Improved user navigation and experience by integrating Rybbit's live visitor widget in the site footer.
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
"use client";
|
||
|
||
import { useActionState, useEffect } from "react";
|
||
import { ArrowRight } from "lucide-react";
|
||
import { toast } from "sonner";
|
||
import { Button } from "@/components/ui/button";
|
||
import { olay } from "@/lib/analitik";
|
||
import { baslatOdeme, type OdemeBaslatDurum } from "./actions";
|
||
|
||
export function SatinAlForm({
|
||
urun,
|
||
label,
|
||
vurgulu = false,
|
||
}: {
|
||
urun: "paket" | "topup";
|
||
label: string;
|
||
vurgulu?: boolean;
|
||
}) {
|
||
const [state, formAction, pending] = useActionState<
|
||
OdemeBaslatDurum,
|
||
FormData
|
||
>(baslatOdeme, undefined);
|
||
|
||
useEffect(() => {
|
||
if (state?.error) toast.error(state.error);
|
||
}, [state]);
|
||
|
||
return (
|
||
<form
|
||
action={formAction}
|
||
onSubmit={() => olay("odeme_baslatildi", { urun })}
|
||
>
|
||
<input type="hidden" name="urun" value={urun} />
|
||
<Button
|
||
type="submit"
|
||
disabled={pending}
|
||
className={
|
||
vurgulu
|
||
? "h-12 w-full cursor-pointer bg-orange-500 px-8 text-white transition-colors duration-200 hover:bg-orange-600"
|
||
: "h-11 w-full cursor-pointer"
|
||
}
|
||
variant={vurgulu ? "default" : "outline"}
|
||
>
|
||
{pending ? (
|
||
"Ödeme sayfasına yönlendiriliyorsun…"
|
||
) : (
|
||
<>
|
||
{label}
|
||
<ArrowRight className="size-4" aria-hidden />
|
||
</>
|
||
)}
|
||
</Button>
|
||
</form>
|
||
);
|
||
}
|