"use client";
import { PayPalProvider } from "@paypal/react-paypal-js/sdk-v6";

export function PayPalWrapper({ 
    children,
    clientId
}: { 
    clientId: string;
    children: React.ReactNode;
}) {

  return (
    <PayPalProvider
        clientId={clientId}
        components={[
            "paypal-payments",
            "venmo-payments",
            "paypal-guest-payments",
            "paypal-subscriptions",
            "card-fields",
            "paypal-messages",
            "applepay-payments"
        ]}
        environment={process.env.NEXT_PUBLIC_APP_ENV === "production" ? "production" : "sandbox"} // 上线改为 "production"
        pageType="checkout"
    >
        {children}
    </PayPalProvider>
  );
}