From c28aac93aba0f59e376bd506b24da8cd3076c4c0 Mon Sep 17 00:00:00 2001 From: martinerko Date: Thu, 17 Feb 2022 13:19:26 +1100 Subject: [PATCH] feature: expose click event --- src/StripeBase.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/StripeBase.ts b/src/StripeBase.ts index a73a027..348f3ed 100644 --- a/src/StripeBase.ts +++ b/src/StripeBase.ts @@ -420,13 +420,14 @@ export class StripeBase extends ReadOnlyPropertiesMixin(LitNotify(LitElement)) { } /** - * Adds `ready`, `focus`, and `blur` listeners to the Stripe Element + * Adds `ready`, `focus`, `blur` and `click` listeners to the Stripe Element */ private initElementListeners(): void { if (!this.element) return; this.element.addEventListener('ready', this.onReady); this.element.addEventListener('focus', this.onFocus); this.element.addEventListener('blur', this.onBlur); + this.element.addEventListener('click', this.onClick); } /** @@ -528,6 +529,14 @@ export class StripeBase extends ReadOnlyPropertiesMixin(LitNotify(LitElement)) { this.fire('stripe-ready', event); } + /** + * @param {StripeClickEvent} event + * @private + */ + @bound private async onClick(event: {preventDefault: () => void}): Promise { + this.fire('click', event); + } + /** * POSTs the payment info represenation to the endpoint at `/action` */