From 658649fb1bba2c6807993e031d69b72086a59a91 Mon Sep 17 00:00:00 2001 From: Bartosz Grajdek Date: Tue, 29 Aug 2023 12:09:30 +0200 Subject: [PATCH] [TS migration] Migrate 'getPlaidOAuthReceivedRedirectURI' lib to TypeScript --- src/libs/getPlaidOAuthReceivedRedirectURI/index.native.js | 1 - src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts | 5 +++++ .../{index.js => index.ts} | 7 +++++-- src/libs/getPlaidOAuthReceivedRedirectURI/types.ts | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) delete mode 100644 src/libs/getPlaidOAuthReceivedRedirectURI/index.native.js create mode 100644 src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts rename src/libs/getPlaidOAuthReceivedRedirectURI/{index.js => index.ts} (77%) create mode 100644 src/libs/getPlaidOAuthReceivedRedirectURI/types.ts diff --git a/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.js b/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.js deleted file mode 100644 index 461f67a0a4bc..000000000000 --- a/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.js +++ /dev/null @@ -1 +0,0 @@ -export default () => null; diff --git a/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts b/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts new file mode 100644 index 000000000000..c435d1799cb8 --- /dev/null +++ b/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts @@ -0,0 +1,5 @@ +import GetPlaidOAuthReceivedRedirectURI from './types'; + +const getPlaidOAuthReceivedRedirectURI: GetPlaidOAuthReceivedRedirectURI = () => null; + +export default getPlaidOAuthReceivedRedirectURI; diff --git a/src/libs/getPlaidOAuthReceivedRedirectURI/index.js b/src/libs/getPlaidOAuthReceivedRedirectURI/index.ts similarity index 77% rename from src/libs/getPlaidOAuthReceivedRedirectURI/index.js rename to src/libs/getPlaidOAuthReceivedRedirectURI/index.ts index 849332a12895..8492a2d9c91e 100644 --- a/src/libs/getPlaidOAuthReceivedRedirectURI/index.js +++ b/src/libs/getPlaidOAuthReceivedRedirectURI/index.ts @@ -1,10 +1,11 @@ +import GetPlaidOAuthReceivedRedirectURI from './types'; + /** * After a user authenticates their bank in the Plaid OAuth flow, Plaid returns us to the redirectURI we * gave them along with a stateID param. We hand off the receivedRedirectUri to PlaidLink to finish connecting * the user's account. - * @returns {String | null} */ -export default () => { +const getPlaidOAuthReceivedRedirectURI: GetPlaidOAuthReceivedRedirectURI = () => { const receivedRedirectURI = window.location.href; const receivedRedirectSearchParams = new URL(window.location.href).searchParams; const oauthStateID = receivedRedirectSearchParams.get('oauth_state_id'); @@ -15,3 +16,5 @@ export default () => { } return receivedRedirectURI; }; + +export default getPlaidOAuthReceivedRedirectURI; diff --git a/src/libs/getPlaidOAuthReceivedRedirectURI/types.ts b/src/libs/getPlaidOAuthReceivedRedirectURI/types.ts new file mode 100644 index 000000000000..b89f023e05d3 --- /dev/null +++ b/src/libs/getPlaidOAuthReceivedRedirectURI/types.ts @@ -0,0 +1,3 @@ +type GetPlaidOAuthReceivedRedirectURI = () => null | string; + +export default GetPlaidOAuthReceivedRedirectURI;