From 4d1b1cbf75ec4def43837d2b9df18d8a66535932 Mon Sep 17 00:00:00 2001 From: antoniof Date: Mon, 5 Feb 2024 16:49:06 +0100 Subject: [PATCH] fix type def amazonpay --- packages/lib/src/components/AmazonPay/AmazonPay.tsx | 6 +++++- packages/lib/src/components/AmazonPay/types.ts | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/lib/src/components/AmazonPay/AmazonPay.tsx b/packages/lib/src/components/AmazonPay/AmazonPay.tsx index b9398a1671..6c458f8f04 100644 --- a/packages/lib/src/components/AmazonPay/AmazonPay.tsx +++ b/packages/lib/src/components/AmazonPay/AmazonPay.tsx @@ -52,7 +52,7 @@ export class AmazonPayElement extends UIElement { return getCheckoutDetails(loadingContext, clientKey, request); } - handleDeclineFlow() { + public handleDeclineFlow() { const { amazonCheckoutSessionId, configuration = {}, loadingContext, clientKey } = this.props; if (!amazonCheckoutSessionId) return console.error('Could handle the decline flow. Missing checkoutSessionId.'); @@ -96,6 +96,10 @@ export class AmazonPayElement extends UIElement { ref={ref => { this.componentRef = ref; }} + showPayButton={this.props.showPayButton} + onClick={this.props.onClick} + onError={this.props.onError} + onSignOut={this.props.onSignOut} {...this.props} /> diff --git a/packages/lib/src/components/AmazonPay/types.ts b/packages/lib/src/components/AmazonPay/types.ts index dab8eac1dc..8faf8655d5 100644 --- a/packages/lib/src/components/AmazonPay/types.ts +++ b/packages/lib/src/components/AmazonPay/types.ts @@ -1,7 +1,7 @@ import { SUPPORTED_LOCALES_EU, SUPPORTED_LOCALES_US } from './config'; -import UIElement from '../internal/UIElement/UIElement'; import { UIElementProps } from '../internal/UIElement/types'; import { BrowserInfo, PaymentAmount } from '../../types/global-types'; +import AmazonPayElement from './AmazonPay'; declare global { interface Window { @@ -52,7 +52,7 @@ export interface AmazonPayConfiguration extends UIElementProps { loadingContext?: string; locale?: string; merchantMetadata?: MerchantMetadata; - onSubmit?: (state: any, element: UIElement) => void; + onSubmit?: (state: any, element: AmazonPayElement) => void; payButton?: any; placement?: Placement; productType?: ProductType; @@ -69,6 +69,14 @@ export interface AmazonPayConfiguration extends UIElementProps { } export interface AmazonPayComponentProps extends AmazonPayConfiguration { + showPayButton: boolean; + showSignOutButton?: boolean; + amazonCheckoutSessionId?: string; + showOrderButton?: boolean; + showChangePaymentDetailsButton?: boolean; + onClick: (resolve, reject) => Promise; + onError: (error, component) => void; + onSignOut: (resolve, reject) => Promise; ref: any; }