Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
75 lines
2.5 KiB
TypeScript
75 lines
2.5 KiB
TypeScript
"use client";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
import {
|
|
PAYMENT_PROVIDERS,
|
|
type PaymentProvider,
|
|
} from "@/lib/types";
|
|
|
|
/** Human-readable label + hint for each supported payment provider. */
|
|
const PROVIDER_META: Record<PaymentProvider, { label: string; hint: string }> = {
|
|
stripe: { label: "Stripe", hint: "Cards worldwide" },
|
|
iyzico: { label: "iyzico", hint: "For Turkey (TR)" },
|
|
creem: { label: "Creem", hint: "Global cards & wallets, tax handled" },
|
|
polar: { label: "Polar", hint: "Global cards & wallets, tax handled" },
|
|
dodo: { label: "Dodo Payments", hint: "Global cards & wallets, tax handled" },
|
|
paddle: { label: "Paddle", hint: "Global cards & wallets, tax handled" },
|
|
};
|
|
|
|
interface ProviderToggleProps {
|
|
readonly value: PaymentProvider;
|
|
readonly onChange: (provider: PaymentProvider) => void;
|
|
readonly disabled?: boolean;
|
|
/**
|
|
* The providers to render, in order. Defaults to every known provider; pass
|
|
* the ENABLED subset from `GET /billing/providers` to show only configured
|
|
* options.
|
|
*/
|
|
readonly providers?: readonly PaymentProvider[];
|
|
}
|
|
|
|
/**
|
|
* Segmented toggle for choosing the checkout payment provider. Presentational
|
|
* and controlled by the parent so the choice can drive the checkout request.
|
|
*/
|
|
export function ProviderToggle({
|
|
value,
|
|
onChange,
|
|
disabled = false,
|
|
providers = PAYMENT_PROVIDERS,
|
|
}: ProviderToggleProps) {
|
|
return (
|
|
<div
|
|
role="radiogroup"
|
|
aria-label="Payment provider"
|
|
className="neu-inset inline-flex items-center gap-1 rounded-xl p-1"
|
|
>
|
|
{providers.map((provider) => {
|
|
const active = provider === value;
|
|
const meta = PROVIDER_META[provider];
|
|
return (
|
|
<button
|
|
key={provider}
|
|
type="button"
|
|
role="radio"
|
|
aria-checked={active}
|
|
disabled={disabled}
|
|
title={meta.hint}
|
|
onClick={() => onChange(provider)}
|
|
className={cn(
|
|
"press-sink rounded-lg border border-transparent px-4 py-1.5 text-sm font-medium",
|
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
active
|
|
? "neu-raised text-foreground"
|
|
: "text-muted-foreground hover:text-foreground",
|
|
)}
|
|
>
|
|
{meta.label}
|
|
</button>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|