From 1173a0a1b9faaf83a389675e6b319a69b32e99a8 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Tue, 5 Dec 2023 15:55:47 +0530 Subject: [PATCH] fix: Comments Addressed --- config/FeatureFlag.json | 36 ++++----- .../hyperswitch/HyperSwitchApp.res | 75 +++++++++---------- .../hyperswitch/HyperSwitchEntry.res | 22 ++++-- .../Developer/Webhooks/WebhookList.res | 58 ++++++-------- .../Developer/Webhooks/WebhookListEntity.res | 11 --- .../Developer/Webhooks/Webhooks.res | 27 +++++-- .../SetupConnectorCredentials.res | 6 +- .../BusinessMapping/BusinessProfile.res | 6 +- 8 files changed, 117 insertions(+), 124 deletions(-) diff --git a/config/FeatureFlag.json b/config/FeatureFlag.json index 99a695198..e312b72b4 100644 --- a/config/FeatureFlag.json +++ b/config/FeatureFlag.json @@ -1,23 +1,23 @@ { - "test_live_toggle": false, + "test_live_toggle": true, "test_live_mode": false, - "magic_link": false, - "production_access": false, - "quick_start": false, - "open_sdk": false, - "switch_merchant": false, - "audit_trail": false, - "system_metrics": false, - "sample_data": false, - "frm": false, - "payout": false, - "recon": false, - "user_management": false, + "magic_link": true, + "production_access": true, + "quick_start": true, + "open_sdk": true, + "switch_merchant": true, + "audit_trail": true, + "system_metrics": true, + "sample_data": true, + "frm": true, + "payout": true, + "recon": true, + "user_management": true, "test_processors": true, - "feedback": false, - "verify_connector": false, + "feedback": true, + "verify_connector": true, "mixpanel": false, - "business_profile": false, - "generate_report": false, - "forgot_password": false + "business_profile": true, + "generate_report": true, + "forgot_password": true } diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index 5cd926272..19cf92ed6 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -93,7 +93,6 @@ let make = () => { } else { setDashboardPageState(_ => #AGREEMENT_SIGNATURE) } - setScreenState(_ => PageLoaderWrapper.Success) } catch { | _ => setDashboardPageState(_ => #HOME) @@ -123,6 +122,21 @@ let make = () => { let _profileDetails = await fetchBusinessProfiles() let _connectorList = await fetchConnectorListResponse() let _merchantDetails = await fetchMerchantAccountDetails() + + if featureFlagDetails.quickStart { + let _featureFlag = await fetchInitialEnums() + } + + switch featureFlagDetails.testLiveMode { + | Some(val) => + if val { + getAgreementEnum()->ignore + } else { + setDashboardPageState(_ => #HOME) + } + | None => () + } + setScreenState(_ => PageLoaderWrapper.Success) } catch { | _ => setDashboardPageState(_ => #HOME) @@ -135,27 +149,6 @@ let make = () => { None }) - React.useEffect1(() => { - switch featureFlagDetails.testLiveMode { - | Some(val) => - if val { - getAgreementEnum()->ignore - } else { - setDashboardPageState(_ => #HOME) - setScreenState(_ => PageLoaderWrapper.Success) - } - | None => () - } - None - }, [featureFlagDetails.testLiveMode]) - - React.useEffect1(() => { - if featureFlagDetails.quickStart { - fetchInitialEnums()->ignore - } - None - }, [featureFlagDetails.quickStart]) - let setPageState = (pageState: ProviderTypes.dashboardPageStateTypes) => { setDashboardPageState(_ => pageState) React.null @@ -192,16 +185,16 @@ let make = () => { } } -
- {switch dashboardPageState { - | #POST_LOGIN_QUES_NOT_DONE => - | #AUTO_CONNECTOR_INTEGRATION => - | #INTEGRATION_DOC => - | #AGREEMENT_SIGNATURE => - | #PROD_ONBOARDING => - | #QUICK_START => - | #HOME => - + +
+ {switch dashboardPageState { + | #POST_LOGIN_QUES_NOT_DONE => + | #AUTO_CONNECTOR_INTEGRATION => + | #INTEGRATION_DOC => + | #AGREEMENT_SIGNATURE => + | #PROD_ONBOARDING => + | #QUICK_START => + | #HOME =>
@@ -385,13 +378,13 @@ let make = () => {
- - | #WOOCOMMERCE_FLOW => - | #DEFAULT => -
- -
- | #STRIPE_PLUS_PAYPAL => - }} -
+ | #WOOCOMMERCE_FLOW => + | #DEFAULT => +
+ +
+ | #STRIPE_PLUS_PAYPAL => + }} +
+
} diff --git a/src/entryPoints/hyperswitch/HyperSwitchEntry.res b/src/entryPoints/hyperswitch/HyperSwitchEntry.res index 08f76fcd6..fcdf9bca9 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchEntry.res +++ b/src/entryPoints/hyperswitch/HyperSwitchEntry.res @@ -9,6 +9,7 @@ module HyperSwitchEntryComponent = { let url = RescriptReactRouter.useUrl() let (_zone, setZone) = React.useContext(UserTimeZoneProvider.userTimeContext) let setFeatureFlag = HyperswitchAtom.featureFlagAtom->Recoil.useSetRecoilState + let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let featureFlagDetails = HyperswitchAtom.featureFlagAtom ->Recoil.useRecoilValueFromAtom @@ -74,8 +75,11 @@ module HyperSwitchEntryComponent = { let stringifiedResponse = (await postDetails(url, Js.Dict.empty()->Js.Json.object_, Post))->Js.Json.stringify setFeatureFlag(._ => stringifiedResponse) + setScreenState(_ => PageLoaderWrapper.Success) } catch { - | _ => () + | Js.Exn.Error(e) => + let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong!") + setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -84,13 +88,15 @@ module HyperSwitchEntryComponent = { None }) -
- - - - - -
+ +
+ + + + + +
+
} } diff --git a/src/screens/HyperSwitch/Developer/Webhooks/WebhookList.res b/src/screens/HyperSwitch/Developer/Webhooks/WebhookList.res index 45b12a44e..f88d2ad9f 100644 --- a/src/screens/HyperSwitch/Developer/Webhooks/WebhookList.res +++ b/src/screens/HyperSwitch/Developer/Webhooks/WebhookList.res @@ -6,45 +6,33 @@ let make = ( ) => { open WebhookListEntity let (offset, setOffset) = React.useState(_ => 0) - let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let businessProfileValues = - Recoil.useRecoilValueFromAtom( - HyperswitchAtom.businessProfilesAtom, - )->HSwitchMerchantAccountUtils.getArrayOfBusinessProfile - - React.useEffect1(() => { - if businessProfileValues->Js.Array2.length === 0 { - setScreenState(_ => PageLoaderWrapper.Loading) - } else { - setScreenState(_ => PageLoaderWrapper.Success) - } - None - }, [businessProfileValues->Js.Array2.length]) + HyperswitchAtom.businessProfilesAtom + ->Recoil.useRecoilValueFromAtom + ->HSwitchMerchantAccountUtils.getArrayOfBusinessProfile - -
-
- - Js.Array2.map(Js.Nullable.return)} - totalResults={businessProfileValues->Js.Array2.length} - offset - setOffset - currrentFetchCount={businessProfileValues->Js.Array2.length} - /> -
+
+
+ + Js.Array2.map(Js.Nullable.return)} + totalResults={businessProfileValues->Js.Array2.length} + offset + setOffset + currrentFetchCount={businessProfileValues->Js.Array2.length} + />
- +
} diff --git a/src/screens/HyperSwitch/Developer/Webhooks/WebhookListEntity.res b/src/screens/HyperSwitch/Developer/Webhooks/WebhookListEntity.res index 9c0c32301..ef9db5be0 100644 --- a/src/screens/HyperSwitch/Developer/Webhooks/WebhookListEntity.res +++ b/src/screens/HyperSwitch/Developer/Webhooks/WebhookListEntity.res @@ -48,17 +48,6 @@ let getItems: Js.Json.t => array = json => { LogicUtils.getArrayDataFromJson(json, itemToObjMapper) } -let apiKeysTableEntity = EntityType.makeEntity( - ~uri="", - ~getObjects=getItems, - ~defaultColumns, - ~allColumns, - ~getHeading, - ~dataKey="", - ~getCell, - (), -) - let businessProfileTabelEntity = () => EntityType.makeEntity( ~uri="", diff --git a/src/screens/HyperSwitch/Developer/Webhooks/Webhooks.res b/src/screens/HyperSwitch/Developer/Webhooks/Webhooks.res index 5d06ae35e..557a36454 100644 --- a/src/screens/HyperSwitch/Developer/Webhooks/Webhooks.res +++ b/src/screens/HyperSwitch/Developer/Webhooks/Webhooks.res @@ -1,11 +1,27 @@ module InfoViewForWebhooks = { @react.component - let make = (~heading, ~subHeading) => { + let make = (~heading, ~subHeading, ~isCopy=false) => { + let showToast = ToastState.useShowToast() + let onCopyClick = ev => { + ev->ReactEvent.Mouse.stopPropagation + Clipboard.writeText(subHeading) + showToast(~message="Copied to Clipboard!", ~toastType=ToastSuccess, ()) + } +

{heading->React.string}

-

- {subHeading->React.string} -

+
+

{subHeading->React.string}

+ + { + onCopyClick(ev) + }} + /> + +
} } @@ -105,7 +121,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { : "px-2 py-4"} flex flex-col gap-7 overflow-hidden`}>
{ subHeading={businessProfileDetails.payment_response_hash_key->Belt.Option.getWithDefault( "NA", )} + isCopy=true />
diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res index e6f70932c..2735e6f24 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res @@ -121,9 +121,9 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { ) let {profile_id} = - Recoil.useRecoilValueFromAtom( - HyperswitchAtom.businessProfilesAtom, - )->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + HyperswitchAtom.businessProfilesAtom + ->Recoil.useRecoilValueFromAtom + ->HSwitchMerchantAccountUtils.getValueFromBusinessProfile let updateSetupConnectorCredentials = async connectorId => { try { diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res index 9fd6c2a82..721ff4d82 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res @@ -80,9 +80,9 @@ let make = ( let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let businessProfileValues = - Recoil.useRecoilValueFromAtom( - HyperswitchAtom.businessProfilesAtom, - )->HSwitchMerchantAccountUtils.getArrayOfBusinessProfile + HyperswitchAtom.businessProfilesAtom + ->Recoil.useRecoilValueFromAtom + ->HSwitchMerchantAccountUtils.getArrayOfBusinessProfile let fetchBusinessProfiles = HSwitchMerchantAccountUtils.useFetchBusinessProfiles()