From 7b0e4dd30e499a7561f1aabefed83ef7e0ad665f Mon Sep 17 00:00:00 2001 From: Soc Sieng Date: Thu, 18 Jun 2020 22:23:38 -0700 Subject: [PATCH] feat: add prefetchPaymentData integration --- src/lib/__mocks__/google-pay-mock.ts | 4 +--- src/lib/button-manager.ts | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/__mocks__/google-pay-mock.ts b/src/lib/__mocks__/google-pay-mock.ts index d324e53..4bb663f 100644 --- a/src/lib/__mocks__/google-pay-mock.ts +++ b/src/lib/__mocks__/google-pay-mock.ts @@ -45,9 +45,7 @@ class PaymentsClient { return document.createElement('div'); } - prefetchPaymentData(request: google.payments.api.PaymentDataRequest): void { - throw new Error('Not implemented'); - } + prefetchPaymentData(request: google.payments.api.PaymentDataRequest): void {} } window.google = { diff --git a/src/lib/button-manager.ts b/src/lib/button-manager.ts index d7e8686..ada3243 100644 --- a/src/lib/button-manager.ts +++ b/src/lib/button-manager.ts @@ -244,6 +244,8 @@ export class ButtonManager { if (!this.isMounted()) return; if (showButton) { + this.client.prefetchPaymentData(this.createLoadPaymentDataRequest(this.config)); + // remove hidden className this.setClassName( element,