Skip to content

Commit

Permalink
Add support for 'auto' locale (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbents authored May 10, 2023
1 parent 1fd22ed commit 8b80e20
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function RevolutCheckoutLoader(
RevolutCheckoutLoader.mode = MODE.PRODUCTION

type PaymentModuleParams = {
locale: Locale
locale: Locale | 'auto'
publicToken: string
mode?: Mode
}
Expand Down
2 changes: 1 addition & 1 deletion src/paymentsLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let loadedPaymentInstance: RevolutCheckout['payments'] = null
export function RevolutPaymentsLoader(
token: string,
mode: Mode = RevolutPaymentsLoader.mode,
locale?: Locale
locale?: Locale | 'auto'
): Promise<RevolutPaymentsModuleInstance> {
if (loadedPaymentInstance) {
const instance = loadedPaymentInstance({ publicToken: token, locale })
Expand Down
8 changes: 4 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export interface CustomerDetails {

export interface CommonOptions {
/** Controls the language of the text in the widget method */
locale?: Locale
locale?: Locale | 'auto'
/** Callback will be called when the payment is completed successfully */
onSuccess?: () => void
/** Callback if transaction is failed to complete, the reason should be available in the message parameter */
Expand Down Expand Up @@ -631,7 +631,7 @@ export interface RevolutCheckoutInstance {
/** Manually destroy popup or card field if needed */
destroy: () => void
/** Controls the language of the text in the widget */
setDefaultLocale: (lang: Locale) => void
setDefaultLocale: (lang: Locale | 'auto') => void
/** The payments module returned as part of the checkout instance */
payments: (
option: RevolutPaymentsModuleOptions
Expand All @@ -644,7 +644,7 @@ export interface RevolutPaymentsModuleInstance {
/** Manually destroy the instance */
destroy: () => void
/** Controls the language of the text in the widget */
setDefaultLocale: (lang: Locale) => void
setDefaultLocale: (lang: Locale | 'auto') => void
/** Poll and react to the status of an order payment */
pollPaymentState: (
orderToken: string,
Expand All @@ -659,7 +659,7 @@ export interface RevolutPaymentsModuleInstance {

export interface RevolutPaymentsModuleOptions {
publicToken: string
locale?: string
locale?: string | 'auto'
}

export interface RevolutCheckout {
Expand Down

0 comments on commit 8b80e20

Please sign in to comment.