From 8b80e20c55a4deb799583ea56995a25e722d5676 Mon Sep 17 00:00:00 2001 From: andrewbents Date: Wed, 10 May 2023 13:41:10 +0100 Subject: [PATCH] Add support for 'auto' locale (#60) --- src/loader.ts | 2 +- src/paymentsLoader.ts | 2 +- src/types.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/loader.ts b/src/loader.ts index ca26ea1..ca9bfaf 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -62,7 +62,7 @@ export function RevolutCheckoutLoader( RevolutCheckoutLoader.mode = MODE.PRODUCTION type PaymentModuleParams = { - locale: Locale + locale: Locale | 'auto' publicToken: string mode?: Mode } diff --git a/src/paymentsLoader.ts b/src/paymentsLoader.ts index 2cf7f61..01f8a3b 100644 --- a/src/paymentsLoader.ts +++ b/src/paymentsLoader.ts @@ -11,7 +11,7 @@ let loadedPaymentInstance: RevolutCheckout['payments'] = null export function RevolutPaymentsLoader( token: string, mode: Mode = RevolutPaymentsLoader.mode, - locale?: Locale + locale?: Locale | 'auto' ): Promise { if (loadedPaymentInstance) { const instance = loadedPaymentInstance({ publicToken: token, locale }) diff --git a/src/types.ts b/src/types.ts index e957f69..291c48a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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 */ @@ -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 @@ -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, @@ -659,7 +659,7 @@ export interface RevolutPaymentsModuleInstance { export interface RevolutPaymentsModuleOptions { publicToken: string - locale?: string + locale?: string | 'auto' } export interface RevolutCheckout {