From 04a975cbcf7a6e426a50cdf42e0e941d44e4adff Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 11 Jan 2024 14:59:52 -0600 Subject: [PATCH] add attach/renderButton to instance --- types/lib/amazon-pay.d.ts | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/types/lib/amazon-pay.d.ts b/types/lib/amazon-pay.d.ts index f65f13360..f2e6b32c1 100644 --- a/types/lib/amazon-pay.d.ts +++ b/types/lib/amazon-pay.d.ts @@ -7,28 +7,42 @@ export type AmazonPayOptions = { region: string; /** - * The customer's locale. This is used to set the language rendered in the UI. + * Specify which Payment Gateway in Recurly must handle the payment. */ - locale: string; + gatewayCode?: string /** - * The currency of the payment. + * Sets button to Sandbox environment */ - currency: string; + sandbox?: boolean; - /** - * Specify which Payment Gateway in Recurly must handle the payment. - */ - gatewayCode?: string + merchantId?: string; +}; + +export type AmazonPayRenderButtonOptions = { + productType?: string; + placement?: string; + buttonColor?: string; }; -export type AmazonPayEvent = 'token' | 'error' | 'close'; +export type AmazonPayEvent = 'ready' | 'token' | 'error' | 'close' | 'done'; export interface AmazonPayInstance extends Emitter { /** * Invokes the Amazon Payment Modal */ start: (amazonPayOptions: AmazonPayOptions) => void; + + /** + * Attaches an Element to the DOM, as a child of the specified parent target. + * + */ + attach: (defaultEventName: string, gatewayCode?: string) => AmazonPayInstance; + + /** + * Renders Amazon Pay button to the page + */ + renderButton: (element: string | HTMLElement, amazonPayRenderButtonOptions: AmazonPayOptions & AmazonPayRenderButtonOptions) => AmazonPayInstance; } export type AmazonPay = (amazonPayOptions?: AmazonPayOptions) => AmazonPayInstance;