Skip to content

Commit

Permalink
fix type def amazonpay
Browse files Browse the repository at this point in the history
  • Loading branch information
m1aw committed Feb 5, 2024
1 parent b5ed5f9 commit 4d1b1cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/lib/src/components/AmazonPay/AmazonPay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class AmazonPayElement extends UIElement<AmazonPayConfiguration> {
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.');

Expand Down Expand Up @@ -96,6 +96,10 @@ export class AmazonPayElement extends UIElement<AmazonPayConfiguration> {
ref={ref => {
this.componentRef = ref;
}}
showPayButton={this.props.showPayButton}
onClick={this.props.onClick}
onError={this.props.onError}
onSignOut={this.props.onSignOut}
{...this.props}
/>
</CoreProvider>
Expand Down
12 changes: 10 additions & 2 deletions packages/lib/src/components/AmazonPay/types.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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<void>;
onError: (error, component) => void;
onSignOut: (resolve, reject) => Promise<void>;
ref: any;
}

Expand Down

0 comments on commit 4d1b1cb

Please sign in to comment.