From 7d24049910fd2a68c160821f66003d6b96f12d86 Mon Sep 17 00:00:00 2001 From: Shiva Nandan Date: Tue, 20 Aug 2024 12:49:03 +0530 Subject: [PATCH] chore: use promise instead of Promise.t --- src/Components/AddressPaymentInput.res | 2 +- src/Payments/KlarnaSDKTypes.res | 2 +- src/Types/GooglePayType.res | 4 ++-- src/Types/PaypalSDKTypes.res | 4 ++-- src/Types/PostalCodeType.res | 2 +- src/Types/ThemeImporter.res | 2 +- src/Utilities/PaymentHelpers.res | 2 +- src/libraries/Promise.res | 2 +- src/orca-loader/Elements.res | 4 ++-- src/orca-loader/LoaderPaymentElement.res | 2 +- src/orca-loader/Types.res | 24 ++++++++++++------------ 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Components/AddressPaymentInput.res b/src/Components/AddressPaymentInput.res index 6588dda36..df5dff24f 100644 --- a/src/Components/AddressPaymentInput.res +++ b/src/Components/AddressPaymentInput.res @@ -7,7 +7,7 @@ type addressType = Line1 | Line2 | City | Postal | State | Country type dataModule = {states: JSON.t} @val -external importStates: string => Promise.t = "import" +external importStates: string => promise = "import" let getShowType = str => { switch str { diff --git a/src/Payments/KlarnaSDKTypes.res b/src/Payments/KlarnaSDKTypes.res index f8db1adf7..2f5e1c906 100644 --- a/src/Payments/KlarnaSDKTypes.res +++ b/src/Payments/KlarnaSDKTypes.res @@ -37,7 +37,7 @@ type loadType = { payment_method_category?: string, theme?: string, shape?: string, - on_click?: authorize => Promise.t, + on_click?: authorize => promise, } type some = { init: token => unit, diff --git a/src/Types/GooglePayType.res b/src/Types/GooglePayType.res index f018a61e0..a2d99aaf6 100644 --- a/src/Types/GooglePayType.res +++ b/src/Types/GooglePayType.res @@ -26,9 +26,9 @@ type document @val external document: document = "document" @send external getElementById: (document, string) => element = "getElementById" type client = { - isReadyToPay: JSON.t => Promise.t, + isReadyToPay: JSON.t => promise, createButton: JSON.t => Dom.element, - loadPaymentData: JSON.t => Promise.t, + loadPaymentData: JSON.t => promise, } @new external google: JSON.t => client = "google.payments.api.PaymentsClient" let getLabel = (var: PaymentType.googlePayStyleType) => { diff --git a/src/Types/PaypalSDKTypes.res b/src/Types/PaypalSDKTypes.res index c525de989..854cfae44 100644 --- a/src/Types/PaypalSDKTypes.res +++ b/src/Types/PaypalSDKTypes.res @@ -2,7 +2,7 @@ type clientErr = bool type clientInstance type paypalCheckoutErr = {message: string} type data -type order = {get: unit => RescriptCore.Promise.t} +type order = {get: unit => promise} type actions = {order: order} type err type vault = {vault: bool} @@ -75,7 +75,7 @@ type buttons = { style: style, fundingSource: string, createBillingAgreement?: unit => unit, - createOrder?: unit => RescriptCore.Promise.t, + createOrder?: unit => promise, onApprove: (data, actions) => unit, onCancel: data => unit, onError?: err => unit, diff --git a/src/Types/PostalCodeType.res b/src/Types/PostalCodeType.res index 90ab3d25d..10884e9b0 100644 --- a/src/Types/PostalCodeType.res +++ b/src/Types/PostalCodeType.res @@ -12,4 +12,4 @@ let defaultPostalCode = { type themeDataModule = {default: array} @val -external importPostalCode: string => Promise.t = "import" +external importPostalCode: string => promise = "import" diff --git a/src/Types/ThemeImporter.res b/src/Types/ThemeImporter.res index f9f1becc4..a9d9503c4 100644 --- a/src/Types/ThemeImporter.res +++ b/src/Types/ThemeImporter.res @@ -4,4 +4,4 @@ type themeDataModule = { } @val -external importTheme: string => Promise.t = "import" +external importTheme: string => promise = "import" diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index 34532a849..36e85ad34 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -313,7 +313,7 @@ let rec intentCall = ( ~bodyStr: string=?, ~headers: Dict.t=?, ~method: Fetch.method, - ) => Promise.t, + ) => promise, ~uri, ~headers, ~bodyStr, diff --git a/src/libraries/Promise.res b/src/libraries/Promise.res index 8b7707576..bb99f6f05 100644 --- a/src/libraries/Promise.res +++ b/src/libraries/Promise.res @@ -1,4 +1,4 @@ -type t<+'a> = Promise.t<'a> +type t<+'a> = promise<'a> exception JsError(Exn.t) diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 1537c2370..9723d7d8e 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -6,8 +6,8 @@ open EventListenerManager open ApplePayTypes type trustPayFunctions = { - finishApplePaymentV2: (string, paymentRequestData) => Promise.t, - executeGooglePayment: (string, GooglePayType.paymentDataRequest) => Promise.t, + finishApplePaymentV2: (string, paymentRequestData) => promise, + executeGooglePayment: (string, GooglePayType.paymentDataRequest) => promise, } @new external trustPayApi: JSON.t => trustPayFunctions = "TrustPayApi" diff --git a/src/orca-loader/LoaderPaymentElement.res b/src/orca-loader/LoaderPaymentElement.res index 7c6bdf2bc..94f7a1c33 100644 --- a/src/orca-loader/LoaderPaymentElement.res +++ b/src/orca-loader/LoaderPaymentElement.res @@ -4,7 +4,7 @@ open EventListenerManager open Identity @val @scope(("navigator", "clipboard")) -external writeText: string => Promise.t<'a> = "writeText" +external writeText: string => promise<'a> = "writeText" let make = ( componentType, diff --git a/src/orca-loader/Types.res b/src/orca-loader/Types.res index 3617051c0..5186769da 100644 --- a/src/orca-loader/Types.res +++ b/src/orca-loader/Types.res @@ -13,7 +13,7 @@ type eventData = { type event = {key: string, data: eventData, source: Dom.element} type eventParam = Event(event) | EventData(eventData) | Empty type eventHandler = option => unit -@send external onload: (Dom.element, unit => Promise.t<'a>) => Promise.t<'a> = "onload" +@send external onload: (Dom.element, unit => promise<'a>) => promise<'a> = "onload" module This = { type t @get @@ -35,25 +35,25 @@ type paymentElement = { type element = { getElement: string => option, update: JSON.t => unit, - fetchUpdates: unit => Promise.t, + fetchUpdates: unit => promise, create: (string, JSON.t) => paymentElement, } type getCustomerSavedPaymentMethods = { getCustomerDefaultSavedPaymentMethodData: unit => JSON.t, getCustomerLastUsedPaymentMethodData: unit => JSON.t, - confirmWithCustomerDefaultPaymentMethod: JSON.t => Promise.t, - confirmWithLastUsedPaymentMethod: JSON.t => Promise.t, + confirmWithCustomerDefaultPaymentMethod: JSON.t => promise, + confirmWithLastUsedPaymentMethod: JSON.t => promise, } type getPaymentManagementMethods = { - getSavedPaymentManagementMethodsList: unit => Promise.t, - deleteSavedPaymentMethod: JSON.t => Promise.t, + getSavedPaymentManagementMethodsList: unit => promise, + deleteSavedPaymentMethod: JSON.t => promise, } type initPaymentSession = { - getCustomerSavedPaymentMethods: unit => Promise.t, - getPaymentManagementMethods: unit => Promise.t, + getCustomerSavedPaymentMethods: unit => promise, + getPaymentManagementMethods: unit => promise, } type confirmParams = {return_url: string} @@ -64,11 +64,11 @@ type confirmPaymentParams = { } type hyperInstance = { - confirmOneClickPayment: (JSON.t, bool) => Promise.t, - confirmPayment: JSON.t => Promise.t, + confirmOneClickPayment: (JSON.t, bool) => promise, + confirmPayment: JSON.t => promise, elements: JSON.t => element, - confirmCardPayment: (string, option, option) => Promise.t, - retrievePaymentIntent: string => Promise.t, + confirmCardPayment: (string, option, option) => promise, + retrievePaymentIntent: string => promise, widgets: JSON.t => element, paymentRequest: JSON.t => JSON.t, initPaymentSession: JSON.t => initPaymentSession,