Skip to content

Commit

Permalink
add promotional banner for upsell module (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbents authored Jun 29, 2023
1 parent b20d180 commit ce88ee5
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> | 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<string, any>
__metadata?: Record<string, any>
Expand Down Expand Up @@ -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 */
Expand All @@ -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<CustomerDetails>
/** Style object for customisation */
style?: {
border?: string
borderRadius?: string
backgroundColor?: string
primaryColor?: string
}
}

export interface RevolutUpsellModuleOptions {
publicToken: string
locale?: string | 'auto'
Expand Down

0 comments on commit ce88ee5

Please sign in to comment.