/// /** * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ interface ReadyToPayChangeResponse { isButtonVisible: boolean; isReadyToPay: boolean; paymentMethodPresent?: boolean; } /** * Custom element for the Google Pay button */ declare class GooglePayButton extends HTMLElement { private manager; private static _observedAttributes; paymentRequest: google.payments.api.PaymentDataRequest; environment: google.payments.api.Environment; existingPaymentMethodRequired: boolean; buttonColor?: google.payments.api.ButtonColor; buttonType?: google.payments.api.ButtonType; buttonRadius?: number; buttonSizeMode?: google.payments.api.ButtonSizeMode; buttonLocale?: string; buttonBorderType?: google.payments.api.ButtonBorderType; onPaymentDataChanged?: google.payments.api.PaymentDataChangedHandler; onPaymentAuthorized?: google.payments.api.PaymentAuthorizedHandler; onReadyToPayChange?: (result: ReadyToPayChangeResponse) => void; onLoadPaymentData?: (paymentData: google.payments.api.PaymentData) => void; onCancel?: (reason: google.payments.api.PaymentsError) => void; onError?: (error: Error | google.payments.api.PaymentsError) => void; onClick?: (event: Event) => void; get isReadyToPay(): boolean | undefined; private assertRequiredProperty; /** * Throws an error. * * Used for testing purposes so that the method can be spied on. */ private throwError; static get observedAttributes(): string[]; /** * Registers an attribute to be observed. * * @param name Attribute name to observe. * @internal */ addObservedAttribute(name: string): void; private dispatch; private initializeButton; connectedCallback(): Promise; disconnectedCallback(): void; attributeChangedCallback(name: string): Promise; notifyPropertyChanged(property: string): Promise; } interface GooglePayButton { addEventListener(type: 'loadpaymentdata', listener: (event: CustomEvent) => void): void; addEventListener(type: 'error', listener: (event: ErrorEvent) => void): void; addEventListener(type: 'cancel', listener: (event: CustomEvent) => void): void; addEventListener(type: 'readytopaychange', listener: (event: CustomEvent) => void): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: 'loadpaymentdata', listener: (event: CustomEvent) => void): void; removeEventListener(type: 'error', listener: (event: ErrorEvent) => void): void; removeEventListener(type: 'cancel', listener: (event: CustomEvent) => void): void; removeEventListener(type: 'readytopaychange', listener: (event: CustomEvent) => void): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } export { ReadyToPayChangeResponse, GooglePayButton as default };