From 739a82cff31b427b6236b40ac2423fa504ae1795 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 | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/types/lib/amazon-pay.d.ts b/types/lib/amazon-pay.d.ts index f65f13360..058ee3e8e 100644 --- a/types/lib/amazon-pay.d.ts +++ b/types/lib/amazon-pay.d.ts @@ -7,28 +7,45 @@ 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 AmazonPayEvent = 'token' | 'error' | 'close'; +export type AmazonPayRenderButtonOptions = { + productType?: string; + placement?: string; + buttonColor?: string; +} + +export type Attach = (el: string | HTMLElement) => ElementType; + +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: Attach; + + /** + * Renders Amazon Pay button to the page + */ + renderButton: (amazonPayRenderButtonOption: AmazonPayRenderButtonOptions & AmazonPayOptions) => AmazonPayInstance; + } export type AmazonPay = (amazonPayOptions?: AmazonPayOptions) => AmazonPayInstance;