
interface KlarnaLoadResponse {
    show_form: boolean;
    error?: {
      invalid_fields?: string[];
    };
}

interface KlarnaAuthorizeResponse {
    approved: boolean;
    show_form: boolean;
    authorization_token?: string;
    error?: {
      invalid_fields?: string[];
    };
}


interface KlarnaPayments {
    init: (options: { client_token: string }) => void;
    load: (
      options: { container: string; payment_method_category?: string },
      callback?: (res: KlarnaLoadResponse) => void
    ) => void;
    authorize: (
      options?: { payment_method_category?: string },
      data?: Record<string, unknown>,
      callback?: (res: KlarnaAuthorizeResponse) => void
    ) => void;
}

declare global {

 interface Window {
    Klarna: {
      Payments: KlarnaPayments;
    };
 }

}
// 这里的export {} 起到一个标记的作用，告诉Typescript，这个文件是一个模块，而不是一个全局变量。
export {};
