From ce88ee55276c8b27c732a50c60d9c09f10bf835b Mon Sep 17 00:00:00 2001 From: andrewbents Date: Thu, 29 Jun 2023 09:22:33 +0100 Subject: [PATCH] add promotional banner for upsell module (#66) --- src/types.ts | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index 36f3ff7..a8260b7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -517,10 +517,10 @@ type CommonPaymentsRevolutPayOptions = { buttonStyle?: ButtonStyleOptions /** Prefill your customer details within the Revolut pay popup */ customer?: CustomerDetails - /** Validation promise to be resolved before a user can make payments. + /** Validation function to be resolved before a user can make payments. * Throw an error and the error message will be displayed in the Revolut pay popup */ validate?: () => Promise | boolean - /** A promise to create a Revolut order at a later time within the Revolut pay flow */ + /** A function to create a Revolut order at a later time within the Revolut pay flow */ createOrder: () => Promise<{ publicId: string }> __features?: Record __metadata?: Record @@ -677,6 +677,8 @@ export interface RevolutPaymentsModuleOptions { export interface RevolutUpsellModuleInstance { /** Card gateway upsell banner */ cardGatewayBanner: UpsellModuleCardGatewayBannerInstance + /** Promotional banner */ + promotionalBanner: UpsellModulePromotionalBannerInstance /** Manually destroy the instance */ destroy: () => void /** Controls the language of the text in the widget */ @@ -695,6 +697,32 @@ export interface WidgetUpsellCardGatewayBannerOptions { orderToken: string } +export interface UpsellModulePromotionalBannerInstance { + mount: ( + target: string | HTMLElement, + options: WidgetUpsellPromotionalBannerOptions + ) => void + destroy: () => void +} + +export interface WidgetUpsellPromotionalBannerOptions { + /** Unique id of transaction user has just performed */ + transactionId: string + /** Max cashback amount */ + amount?: number + /** Cashback currency */ + currency: string + /** Prefilled customer details within the banner */ + customer?: Partial + /** Style object for customisation */ + style?: { + border?: string + borderRadius?: string + backgroundColor?: string + primaryColor?: string + } +} + export interface RevolutUpsellModuleOptions { publicToken: string locale?: string | 'auto'