From 0e59c4a6e80fe9d03c8f289810f7796e3da23cb1 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> Date: Fri, 8 Dec 2023 15:32:35 +0530 Subject: [PATCH 01/13] feat: New connector addition Helcim (#80) --- .githooks/commit-msg | 15 ++++--------- public/hyperswitch/Gateway/HELCIM.svg | 22 +++++++++++++++++++ .../HyperSwitch/Connectors/ConnectorTypes.res | 1 + .../HyperSwitch/Connectors/ConnectorUtils.res | 8 +++++++ 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 public/hyperswitch/Gateway/HELCIM.svg diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 3a1276348..b5f79a6af 100755 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -33,17 +33,10 @@ echo commit_regex="^(Merge branch|(feat|fix|chore|refactor|docs|test|style|enhancement):).+" -if git log --show-signature -n 1 | grep -q 'gpg:'; then - if ! echo "$commit_msg" | grep -Ei "$commit_regex" ; then - echo "Aborting commit. Your commit message does not follow the conventional format." - echo "The commit message should begin with one of the following keywords followed by a colon: 'feat', 'fix', 'chore', 'refactor', 'docs', 'test' or 'style'. For example, it should be formatted like this: 'feat: - '" - exit 1 - fi -else - echo "~~~~**** Error: Commit Signature Missing. ****~~~~" - echo "Please make sure to sign your commits. You can sign your commit by using the '-S' option with 'git commit'." - echo "Example: git commit -S -m 'Your commit message'" - echo "Signing commits is crucial for verifying contributions. Consult GitHub's documentation on commit signature verification for guidance: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits" + +if ! echo "$commit_msg" | grep -Ei "$commit_regex" ; then + echo "Aborting commit. Your commit message does not follow the conventional format." + echo "The commit message should begin with one of the following keywords followed by a colon: 'feat', 'fix', 'chore', 'refactor', 'docs', 'test' or 'style'. For example, it should be formatted like this: 'feat: - '" exit 1 fi diff --git a/public/hyperswitch/Gateway/HELCIM.svg b/public/hyperswitch/Gateway/HELCIM.svg new file mode 100644 index 000000000..42781a58b --- /dev/null +++ b/public/hyperswitch/Gateway/HELCIM.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/src/screens/HyperSwitch/Connectors/ConnectorTypes.res b/src/screens/HyperSwitch/Connectors/ConnectorTypes.res index 6fad11800..160af42a5 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorTypes.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorTypes.res @@ -74,6 +74,7 @@ type connectorName = | GOCARDLESS | VOLT | PROPHETPAY + | HELCIM | UnknownConnector(string) type paymentMethod = diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res index 8b08ba1b4..e28212c72 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res @@ -167,6 +167,7 @@ let connectorList: array = [ GLOBALPAY, GLOBEPAY, GOCARDLESS, + HELCIM, IATAPAY, KLARNA, MOLLIE, @@ -457,6 +458,10 @@ let prophetpayInfo = { description: "A secure, affordable, and easy-to-use credit card processing platform for any business.", } +let helcimInfo = { + description: "Helcim is the easy and affordable solution for small businesses accepting credit card payments.", +} + let unknownConnectorInfo = { description: "unkown connector", } @@ -517,6 +522,7 @@ let getConnectorNameString = connector => { | VOLT => "volt" | PROPHETPAY => "prophetpay" | BANKOFAMERICA => "bankofamerica" + | HELCIM => "helcim" | UnknownConnector(str) => str } } @@ -573,6 +579,7 @@ let getConnectorNameTypeFromString = connector => { | "volt" => VOLT | "bankofamerica" => BANKOFAMERICA | "prophetpay" => PROPHETPAY + | "helcim" => HELCIM | _ => UnknownConnector("Not known") } } @@ -629,6 +636,7 @@ let getConnectorInfo = (connector: connectorName) => { | VOLT => voltInfo | PROPHETPAY => prophetpayInfo | BANKOFAMERICA => bankOfAmericaInfo + | HELCIM => helcimInfo | UnknownConnector(_) => unknownConnectorInfo } } From 0880fd8757f46236caff8783eb3154ec88b286c2 Mon Sep 17 00:00:00 2001 From: Sagar naik Date: Fri, 8 Dec 2023 16:27:31 +0530 Subject: [PATCH 02/13] fix: hide connector sr (#81) --- .../PaymentsAnalytics/PaymentAnalytics.res | 7 ++- .../PaymentAnalyticsEntity.res | 46 +++++++++++-------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res index b4229a0e0..b6745796c 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res @@ -8,6 +8,11 @@ let make = () => { let (metrics, setMetrics) = React.useState(_ => []) let (dimensions, setDimensions) = React.useState(_ => []) let fetchDetails = useGetMethod() + let {isLiveMode} = + HyperswitchAtom.featureFlagAtom + ->Recoil.useRecoilValueFromAtom + ->LogicUtils.safeParse + ->FeatureFlagUtils.featureFlagType let loadInfo = async () => { open LogicUtils @@ -73,7 +78,7 @@ let make = () => { tabKeys tabValues options - singleStatEntity={getSingleStatEntity(metrics)} + singleStatEntity={getSingleStatEntity(metrics, !isLiveMode)} getTable={getPaymentTable} colMapper tableEntity={paymentTableEntity} diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res index c6988eccd..02f1bad32 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res @@ -319,19 +319,29 @@ type colT = | RetriesAmountProcessed | ConnectorSuccessRate -let defaultColumns: array> = [ +let getColumns: bool => array> = connector_success_rate => [ { sectionName: "", - columns: [ - SuccessRate, - Count, - SuccessCount, - ProcessedAmount, - AvgTicketSize, - RetriesCount, - RetriesAmountProcessed, - ConnectorSuccessRate, - ], + columns: connector_success_rate + ? [ + SuccessRate, + Count, + SuccessCount, + ProcessedAmount, + AvgTicketSize, + RetriesCount, + RetriesAmountProcessed, + ConnectorSuccessRate, + ] + : [ + SuccessRate, + Count, + SuccessCount, + ProcessedAmount, + AvgTicketSize, + RetriesCount, + RetriesAmountProcessed, + ], }, ] @@ -413,7 +423,7 @@ let getStatData = ( ) => { switch colType { | SuccessRate => { - title: "Overall conversion rate", + title: "Overall Conversion Rate", tooltipText: "Total successful payments processed out of total payments created (This includes user dropouts at shopping cart and checkout page)", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( singleStatData.payment_success_rate, @@ -504,7 +514,7 @@ let getStatData = ( } | RetriesCount => { title: "Smart Retries made", - tooltipText: "Total number of retries that were attempted after a failed payment attempt", + tooltipText: "Total number of retries that were attempted after a failed payment attempt (Note: Only date range filters are supoorted currently)", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( singleStatData.retries_count->Belt.Int.toFloat, deltaTimestampData.currentSr, @@ -518,8 +528,8 @@ let getStatData = ( showDelta: false, } | RetriesAmountProcessed => { - title: `Smart retries savings`, - tooltipText: "Total savings in amount terms from retrying failed payments again through a second processor", + title: `Smart Retries Savings`, + tooltipText: "Total savings in amount terms from retrying failed payments again through a second processor (Note: Only date range filters are supoorted currently)", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( singleStatData.retries_amount_processe /. 100.00, deltaTimestampData.currentSr, @@ -538,7 +548,7 @@ let getStatData = ( showDelta: false, } | ConnectorSuccessRate => { - title: "Payment success rate", + title: "Payment Success Rate", tooltipText: "Total successful payments processed out of all user confirmed payments", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( singleStatData.connector_success_rate, @@ -555,7 +565,7 @@ let getStatData = ( } } -let getSingleStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> = metrics => { +let getSingleStatEntity = (metrics, connector_success_rate) => { urlConfig: [ { uri: `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`, @@ -564,7 +574,7 @@ let getSingleStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> = ], getObjects: itemToObjMapper, getTimeSeriesObject: timeSeriesObjMapper, - defaultColumns, + defaultColumns: getColumns(connector_success_rate), getData: getStatData, totalVolumeCol: None, matrixUriMapper: _ => `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`, From 7aee90922411057d712bd9eaa896e43ee7190e80 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:00:20 +0000 Subject: [PATCH 03/13] chore(version): v1.4.0 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a7ad669e..13ad1ec53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,21 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.4.0 (2023-12-08) + +### Features + +- New connector addition Helcim ([#80](https://github.com/juspay/hyperswitch-control-center/pull/80)) ([`0e59c4a`](https://github.com/juspay/hyperswitch-control-center/commit/0e59c4a6e80fe9d03c8f289810f7796e3da23cb1)) + +### Bug Fixes + +- Hide connector sr ([#81](https://github.com/juspay/hyperswitch-control-center/pull/81)) ([`0880fd8`](https://github.com/juspay/hyperswitch-control-center/commit/0880fd8757f46236caff8783eb3154ec88b286c2)) + +**Full Changelog:** [`v1.3.1...v1.4.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.3.1...v1.4.0) + +- - - + + ## 1.3.1 (2023-12-07) ### Bug Fixes From f5363b4ac3547232bd637884bd8a9fad85056608 Mon Sep 17 00:00:00 2001 From: Sagar naik Date: Mon, 11 Dec 2023 11:44:13 +0530 Subject: [PATCH 04/13] feat: refunds search based on refunds id (#83) --- src/screens/HyperSwitch/Refunds/Refund.res | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/screens/HyperSwitch/Refunds/Refund.res b/src/screens/HyperSwitch/Refunds/Refund.res index 9901de56a..8e4ec90ed 100644 --- a/src/screens/HyperSwitch/Refunds/Refund.res +++ b/src/screens/HyperSwitch/Refunds/Refund.res @@ -24,6 +24,7 @@ let make = () => { filters->Js.Dict.set("offset", offset->Belt.Int.toFloat->Js.Json.number) if !(searchText->isEmptyString) { filters->Js.Dict.set("payment_id", searchText->Js.Json.string) + filters->Js.Dict.set("refund_id", searchText->Js.Json.string) } dict @@ -63,7 +64,7 @@ let make = () => { Date: Mon, 11 Dec 2023 15:54:47 +0530 Subject: [PATCH 05/13] fix: Recoil value for feature flag updated (#85) --- .../hyperswitch/HyperSwitchApp.res | 6 +----- .../hyperswitch/HyperSwitchEntry.res | 14 ++++++-------- .../hyperswitch/HyperswitchAtom.res | 5 ++++- .../HyperSwitch/Analytics/Analytics.res | 6 +----- .../HomePageOverviewComponent.res | 12 ++---------- .../PaymentsAnalytics/PaymentAnalytics.res | 6 +----- .../Connectors/ConnectorAccountDetails.res | 6 +----- .../ConnectorAccountDetailsHelper.res | 6 +----- .../HyperSwitch/Connectors/ConnectorList.res | 6 +----- .../Connectors/ConnectorPreview.res | 6 +----- src/screens/HyperSwitch/Disputes/Disputes.res | 6 +----- .../HyperSwitch/FraudAndRisk/FRMConfigure.res | 6 +----- .../FraudAndRisk/FRMIntegrationFields.res | 6 +----- src/screens/HyperSwitch/HSMixPanel.res | 6 +----- .../CommonConnectorFlow/SetupConnector.res | 6 +----- src/screens/HyperSwitch/Home/HomeUtils.res | 6 +----- src/screens/HyperSwitch/Home/HomeV2.res | 2 +- .../HyperSwitch/Order/OrderUIUtils.res | 19 ++++--------------- src/screens/HyperSwitch/Order/Orders.res | 6 +----- src/screens/HyperSwitch/Order/ShowOrder.res | 6 +----- src/screens/HyperSwitch/Refunds/Refund.res | 6 +----- .../SetupConnectorCredentials.res | 6 +----- .../HyperSwitch/Settings/HSwitchSettings.res | 6 +----- .../Utils/HSwitchGlobalSearchBar.res | 6 +----- .../HSwitchLoginFlow/HyperSwitchAuth.res | 5 +---- .../HyperSwitchAuthScreen.res | 12 +++--------- .../HSwitchLoginFlow/HyperSwitchAuthUtils.res | 5 +---- 27 files changed, 41 insertions(+), 147 deletions(-) diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index e8f6b0dcf..4f1d22e63 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -41,11 +41,7 @@ let make = () => { ->LogicUtils.safeParse ->QuickStartUtils.getTypedValueFromDict - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let getEnumDetails = EnumVariantHook.useFetchEnumDetails() let verificationDays = getFromMerchantDetails("verification")->LogicUtils.getIntFromString(-1) diff --git a/src/entryPoints/hyperswitch/HyperSwitchEntry.res b/src/entryPoints/hyperswitch/HyperSwitchEntry.res index 2ab9ea88c..cbace0eeb 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchEntry.res +++ b/src/entryPoints/hyperswitch/HyperSwitchEntry.res @@ -10,11 +10,7 @@ module HyperSwitchEntryComponent = { 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 - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom React.useEffect0(() => { HSiwtchTimeZoneUtils.getUserTimeZone()->setZone None @@ -71,9 +67,11 @@ module HyperSwitchEntryComponent = { let fetchFeatureFlags = async () => { try { let url = `${HSwitchGlobalVars.hyperSwitchFEPrefix}/config/merchant-access` - let stringifiedResponse = - (await postDetails(url, Js.Dict.empty()->Js.Json.object_, Post))->Js.Json.stringify - setFeatureFlag(._ => stringifiedResponse) + let typedResponse = + ( + await postDetails(url, Js.Dict.empty()->Js.Json.object_, Post) + )->FeatureFlagUtils.featureFlagType + setFeatureFlag(._ => typedResponse) setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => diff --git a/src/entryPoints/hyperswitch/HyperswitchAtom.res b/src/entryPoints/hyperswitch/HyperswitchAtom.res index 1a8ba1eb6..d04ef04af 100644 --- a/src/entryPoints/hyperswitch/HyperswitchAtom.res +++ b/src/entryPoints/hyperswitch/HyperswitchAtom.res @@ -6,4 +6,7 @@ let connectorListAtom: Recoil.recoilAtom = Recoil.atom(. "connectorListA let enumVariantAtom = Recoil.atom(. "enumVariantDetails", "") -let featureFlagAtom = Recoil.atom(. "featureFlag", "") +let featureFlagAtom: Recoil.recoilAtom = Recoil.atom(. + "featureFlag", + Js.Json.null->FeatureFlagUtils.featureFlagType, +) diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index 9f54e85ec..defa06c4c 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -518,11 +518,7 @@ let make = ( ~weeklyTableMetricsCols=?, ~distributionArray=None, ) => { - let {generateReport} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {generateReport} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let analyticsType = moduleName->getAnalyticsType let {filterValue, updateExistingKeys} = React.useContext( AnalyticsUrlUpdaterContext.urlUpdaterContext, diff --git a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res index 66e65800b..d7567dfcb 100644 --- a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res +++ b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res @@ -203,11 +203,7 @@ module OverviewInfo = { open APIUtils @react.component let make = () => { - let {sampleData} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {sampleData} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let updateDetails = useUpdateMethod() let showToast = ToastState.useShowToast() @@ -245,11 +241,7 @@ module OverviewInfo = { @react.component let make = () => { - let {systemMetrics} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {systemMetrics} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom

{"Overview"->React.string}

diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res index b6745796c..027b55053 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res @@ -8,11 +8,7 @@ let make = () => { let (metrics, setMetrics) = React.useState(_ => []) let (dimensions, setDimensions) = React.useState(_ => []) let fetchDetails = useGetMethod() - let {isLiveMode} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {isLiveMode} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let loadInfo = async () => { open LogicUtils diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index 05be61eba..077f07a3a 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res @@ -204,11 +204,7 @@ let make = ( let connector = UrlUtils.useGetFilterDictFromUrl("")->LogicUtils.getString("name", "") let connectorID = url.path->Belt.List.toArray->Belt.Array.get(1)->Belt.Option.getWithDefault("") let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let updateDetails = useUpdateMethod(~showErrorToast=false, ()) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res index 9bbb1c54e..d334e81cb 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res @@ -94,11 +94,7 @@ module RenderConnectorInputFields = { ~isLabelNested=true, ~disabled=false, ) => { - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom open ConnectorUtils open LogicUtils let keys = diff --git a/src/screens/HyperSwitch/Connectors/ConnectorList.res b/src/screens/HyperSwitch/Connectors/ConnectorList.res index eff322ee2..0025cfc0e 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorList.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorList.res @@ -29,11 +29,7 @@ module NewProcessorCards = { ~showIcons: bool, ~isPayoutFlow: bool, ) => { - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let connectorsAvailableForIntegration = featureFlagDetails.isLiveMode ? ConnectorUtils.connectorListForLive diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index 3aa47e30d..c3ea22bfc 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -231,11 +231,7 @@ let make = ( ~isPayoutFlow, ~showMenuOption=true, ) => { - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom open APIUtils let hyperswitchMixPanel = HSMixPanel.useSendEvent() let url = RescriptReactRouter.useUrl() diff --git a/src/screens/HyperSwitch/Disputes/Disputes.res b/src/screens/HyperSwitch/Disputes/Disputes.res index 9f7bd78af..1b0a53f69 100644 --- a/src/screens/HyperSwitch/Disputes/Disputes.res +++ b/src/screens/HyperSwitch/Disputes/Disputes.res @@ -74,11 +74,7 @@ let make = () => { /> - let {generateReport} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {generateReport} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom
diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res index b6df5589b..f1cce8246 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res @@ -5,11 +5,7 @@ let make = () => { open ConnectorTypes open LogicUtils open FRMInfo - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let url = RescriptReactRouter.useUrl() let hyperswitchMixPanel = HSMixPanel.useSendEvent() let fetchDetails = useGetMethod() diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res index 6e9cfb80e..648298560 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res @@ -198,11 +198,7 @@ let make = ( let fetchApi = useUpdateMethod() let url = RescriptReactRouter.useUrl() let frmName = UrlUtils.useGetFilterDictFromUrl("")->LogicUtils.getString("name", "") - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let (pageState, setPageState) = React.useState(_ => PageLoaderWrapper.Success) diff --git a/src/screens/HyperSwitch/HSMixPanel.res b/src/screens/HyperSwitch/HSMixPanel.res index 0714c40b6..0b452cf30 100644 --- a/src/screens/HyperSwitch/HSMixPanel.res +++ b/src/screens/HyperSwitch/HSMixPanel.res @@ -30,11 +30,7 @@ let useSendEvent = () => { email->Js.String.length == 0 ? getFromMerchantDetails("email") : email } - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let environment = switch HSwitchGlobalVars.hostType { | Live => "production" diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res index 76e261097..84e126a53 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res @@ -56,11 +56,7 @@ module ConfigureProcessor = { ~setConnectorConfigureState, ~isBackButtonVisible=true, ) => { - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom open ConnectorUtils let connectorName = selectedConnector->ConnectorUtils.getConnectorNameString diff --git a/src/screens/HyperSwitch/Home/HomeUtils.res b/src/screens/HyperSwitch/Home/HomeUtils.res index e5f9b2d7b..c4eb737dd 100644 --- a/src/screens/HyperSwitch/Home/HomeUtils.res +++ b/src/screens/HyperSwitch/Home/HomeUtils.res @@ -269,11 +269,7 @@ module ControlCenter = { let url = RescriptReactRouter.useUrl() let hyperswitchMixPanel = HSMixPanel.useSendEvent() let merchantDetailsValue = useMerchantDetailsValue() - let {isLiveMode} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {isLiveMode} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let pageName = url.path->getPageNameFromUrl diff --git a/src/screens/HyperSwitch/Home/HomeV2.res b/src/screens/HyperSwitch/Home/HomeV2.res index bc8adecaa..e715aede1 100644 --- a/src/screens/HyperSwitch/Home/HomeV2.res +++ b/src/screens/HyperSwitch/Home/HomeV2.res @@ -47,7 +47,7 @@ module HomePageHorizontalStepper = {
{stepperItemsArray ->Array.mapWithIndex((value, index) => { -
+
string_of_int}>
getStepperStyle} ${getTextStyle}`}> diff --git a/src/screens/HyperSwitch/Order/OrderUIUtils.res b/src/screens/HyperSwitch/Order/OrderUIUtils.res index 24a37eb6b..661ca040a 100644 --- a/src/screens/HyperSwitch/Order/OrderUIUtils.res +++ b/src/screens/HyperSwitch/Order/OrderUIUtils.res @@ -17,11 +17,7 @@ module EventLogMobileView = { module PaymentLogs = { @react.component let make = (~id, ~createdAt) => { - let {auditTrail} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {auditTrail} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let isSmallDevice = MatchMedia.useMatchMedia("(max-width: 700px)") let showPaymentLogsComp = auditTrail @@ -45,11 +41,7 @@ module GenerateSampleDataButton = { let make = (~previewOnly, ~getOrdersList) => { let updateDetails = useUpdateMethod() let showToast = ToastState.useShowToast() - let {sampleData} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {sampleData} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let generateSampleData = async () => { try { @@ -81,11 +73,8 @@ module GenerateSampleDataButton = { module NoData = { @react.component let make = (~isConfigureConnector, ~paymentModal, ~setPaymentModal) => { - let {isLiveMode} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {isLiveMode} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom + { let pageDetailDict = Recoil.useRecoilValueFromAtom(LoadedTable.table_pageDetails) let pageDetail = pageDetailDict->Js.Dict.get("Orders")->Belt.Option.getWithDefault(defaultValue) let (offset, setOffset) = React.useState(_ => pageDetail.offset) - let {generateReport} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {generateReport} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let fetchOrders = () => { if !previewOnly { diff --git a/src/screens/HyperSwitch/Order/ShowOrder.res b/src/screens/HyperSwitch/Order/ShowOrder.res index e11e8ab91..444ea6366 100644 --- a/src/screens/HyperSwitch/Order/ShowOrder.res +++ b/src/screens/HyperSwitch/Order/ShowOrder.res @@ -635,11 +635,7 @@ module FraudRiskBanner = { @react.component let make = (~id) => { open APIUtils - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let hyperswitchMixPanel = HSMixPanel.useSendEvent() let fetchDetails = useGetMethod() let showToast = ToastState.useShowToast() diff --git a/src/screens/HyperSwitch/Refunds/Refund.res b/src/screens/HyperSwitch/Refunds/Refund.res index 8e4ec90ed..eabd78b3e 100644 --- a/src/screens/HyperSwitch/Refunds/Refund.res +++ b/src/screens/HyperSwitch/Refunds/Refund.res @@ -49,11 +49,7 @@ let make = () => { None }, (offset, filters, searchText)) - let {generateReport} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {generateReport} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom
diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res index eb78baa61..505ce095b 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res @@ -77,11 +77,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { open ConnectorUtils open APIUtils let showToast = ToastState.useShowToast() - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let connectorName = selectedConnector->ConnectorUtils.getConnectorNameString let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let (isCheckboxSelected, setIsCheckboxSelected) = React.useState(_ => false) diff --git a/src/screens/HyperSwitch/Settings/HSwitchSettings.res b/src/screens/HyperSwitch/Settings/HSwitchSettings.res index 70dff45bf..325a76cb0 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchSettings.res @@ -128,11 +128,7 @@ module TileComponent = { module PersonalSettings = { @react.component let make = () => { - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let personalSettings = if featureFlagDetails.sampleData { [deleteSampleData] } else { diff --git a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res index d25db93ec..568902e8f 100644 --- a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res +++ b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res @@ -62,11 +62,7 @@ let make = () => { let (showModal, setShowModal) = React.useState(_ => false) let (searchText, setSearchText) = React.useState(_ => "") let (arr, setArr) = React.useState(_ => []) - let featureFlagDetails = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let merchentDetails = HSwitchUtils.useMerchantDetailsValue() let userRole = HSLocalStorage.getFromUserDetails("user_role") let isReconEnabled = diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res index 223f1c818..c37f40fec 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res @@ -16,10 +16,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let updateDetails = useUpdateMethod(~showErrorToast=false, ()) let (email, setEmail) = React.useState(_ => "") let {magicLink: isMagicLinkEnabled, forgetPassword, ossBuild: isOssBuild} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let handleAuthError = e => { let error = e->parseErrorMessage diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res index ab716ea83..0499b3cb8 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res @@ -5,11 +5,7 @@ module AuthPage = { open HyperSwitchAuth @react.component let make = (~authType, ~setAuthType, ~setAuthStatus, ~mode, ~setMode) => { - let {testLiveToggle} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + let {testLiveToggle} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let screen =
@@ -48,10 +44,8 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit) => { let url = RescriptReactRouter.useUrl() let (mode, setMode) = React.useState(_ => TestButtonMode) let {isLiveMode, magicLink: isMagicLinkEnabled} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom + let authInitState = isMagicLinkEnabled ? LoginWithEmail : LoginWithPassword let (authType, setAuthType) = React.useState(_ => authInitState) diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res index 7a102d294..8e2c7905a 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res @@ -311,10 +311,7 @@ module Header = { let make = (~authType, ~setAuthType, ~email) => { let form = ReactFinalForm.useForm() let {magicLink: isMagicLinkEnabled, isLiveMode} = - HyperswitchAtom.featureFlagAtom - ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse - ->FeatureFlagUtils.featureFlagType + HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let headerStyle = switch authType { | MagicLinkEmailSent | ForgetPasswordEmailSent From ade63aa8177d6269e02ac0db4f6e63867511b661 Mon Sep 17 00:00:00 2001 From: Riddhiagrawal001 <50551695+Riddhiagrawal001@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:17:04 +0530 Subject: [PATCH 06/13] fix: Added configure return url after business profile (#82) Co-authored-by: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> --- .../BusinessMapping/BusinessMappingUtils.res | 2 +- .../BusinessMapping/BusinessProfile.res | 86 +++++++++++++++++-- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res index 6a21fd6cd..6d2cdafd2 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res @@ -17,7 +17,7 @@ let labelField = FormRenderer.makeFieldInfo( (), ) -type modalState = Loading | Edit +type modalState = Loading | Edit | Successful let validateEmptyValue = (key, errors) => { switch key { diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res index 4cea24ef1..ad54c171b 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res @@ -1,9 +1,30 @@ +module WarningArea = { + @react.component + let make = (~warningText) => { +

+ {"NOTE:"->React.string} + {warningText->React.string} +

+ } +} module AddEntryBtn = { @react.component - let make = (~onSubmit, ~modalState, ~showModal, ~setShowModal, ~list, ~isFromSettings=true) => { + let make = ( + ~onSubmit, + ~modalState, + ~showModal, + ~setShowModal, + ~list, + ~isFromSettings=true, + ~updatedProfileId, + ~setModalState, + ) => { open HSwitchUtils open BusinessMappingUtils - let initialValues = [("profile_name", "Default"->Js.Json.string)]->Js.Dict.fromArray + let initialValues = + [ + ("profile_name", `default${list->Js.Array2.length->string_of_int}`->Js.Json.string), + ]->Js.Dict.fromArray let modalBody =
{switch modalState { @@ -37,9 +58,34 @@ module AddEntryBtn = {
+ | Successful => +
+ +

+ {"Business Profile successfully created! Set up your payments settings like webhooks, return url for your new profile before trying a payment."->React.string} +

+
}}
+ let modalHeaderText = switch modalState { + | Edit | Loading => "Add Business Profile Name" + | Successful => "Configure payment settings" + } +
-
-
-
-

- {`Setup Webhook on ${connectorName->LogicUtils.capitalizeString}`->React.string} -

-

- {"Configure hyperswitch's webhook on your processor's end"->React.string} -

-
- } - /> -
-
-} diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res index f1cce8246..8a804ac3f 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res @@ -120,8 +120,7 @@ let make = () => { setCurrentStep retrivedValues=Some(initialValues) setInitialValues isUpdateFlow /> | SummaryAndTest - | Preview - | _ => + | Preview => }}
diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMInfo.res b/src/screens/HyperSwitch/FraudAndRisk/FRMInfo.res index d613284a0..4c07a6c31 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMInfo.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMInfo.res @@ -77,7 +77,7 @@ let getNextStep: ConnectorTypes.steps => ConnectorTypes.steps = currentStep => { | PaymentMethods => IntegFields | IntegFields => SummaryAndTest | SummaryAndTest => SummaryAndTest - | Preview | _ => Preview + | Preview => Preview } } diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res index 56c3db9d8..33224ae07 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res @@ -2,7 +2,7 @@ module AdvanceSettings = { @react.component let make = (~isUpdateFlow, ~frmName, ~renderCountrySelector) => { let (isFRMSettings, setIsFRMSettings) = React.useState(_ => isUpdateFlow) - + let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let form = ReactFinalForm.useForm() let hyperswitchMixPanel = HSMixPanel.useSendEvent() let url = RescriptReactRouter.useUrl() @@ -40,7 +40,7 @@ module AdvanceSettings = { None }, [businessProfileValue.profile_id]) - <> +

@@ -50,7 +50,7 @@ module AdvanceSettings = { - + } } diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res index 255e5eff6..a967599f2 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res @@ -130,20 +130,6 @@ let make = (~initialValues, ~currentStep, ~setCurrentStep, ~isUpdateFlow) => { }}

-
-

{"Processor Mode"->React.string}

-
- {if frmInfo.test_mode { - - {"TEST MODE"->React.string} - - } else { - - {"LIVE MODE"->React.string} - - }} -
-

{"Profile id"->React.string}

{frmInfo.profile_id->React.string}
diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res index 84e126a53..82cdf8b01 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res @@ -133,9 +133,11 @@ module ConfigureProcessor = { nextButton={}> - + + + Date: Mon, 11 Dec 2023 14:34:54 +0000 Subject: [PATCH 11/13] chore(version): v1.5.0 --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ad1ec53..bd6b18d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.5.0 (2023-12-11) + +### Features + +- Refunds search based on refunds id ([#83](https://github.com/juspay/hyperswitch-control-center/pull/83)) ([`f5363b4`](https://github.com/juspay/hyperswitch-control-center/commit/f5363b4ac3547232bd637884bd8a9fad85056608)) +- Identity file changes in Codebase. ([#89](https://github.com/juspay/hyperswitch-control-center/pull/89)) ([`9e3aec7`](https://github.com/juspay/hyperswitch-control-center/commit/9e3aec7f7434cf4610db50a716653e73693aec94)) +- Webhook Section Update - In Connector Preview ([#90](https://github.com/juspay/hyperswitch-control-center/pull/90)) ([`07a2cf1`](https://github.com/juspay/hyperswitch-control-center/commit/07a2cf1d5f36541e69dcf701c38fce33697f0df0)) + +### Bug Fixes + +- Recoil value for feature flag updated ([#85](https://github.com/juspay/hyperswitch-control-center/pull/85)) ([`d7bb46e`](https://github.com/juspay/hyperswitch-control-center/commit/d7bb46e26c766ab8b43488ff42c6a0ad4eb21864)) +- Added configure return url after business profile ([#82](https://github.com/juspay/hyperswitch-control-center/pull/82)) ([`ade63aa`](https://github.com/juspay/hyperswitch-control-center/commit/ade63aa8177d6269e02ac0db4f6e63867511b661)) +- SDK Processing - Go to payments not working fix ([#88](https://github.com/juspay/hyperswitch-control-center/pull/88)) ([`f45d8dd`](https://github.com/juspay/hyperswitch-control-center/commit/f45d8dd6016f859b76013364c83c0758e5a42114)) + +### Refactors + +- Common file for all identity functions ([#86](https://github.com/juspay/hyperswitch-control-center/pull/86)) ([`6ad715f`](https://github.com/juspay/hyperswitch-control-center/commit/6ad715fb11da557f4f07ff35e8f616b69684ff0c)) + +**Full Changelog:** [`v1.4.0...v1.5.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.4.0...v1.5.0) + +- - - + + ## 1.4.0 (2023-12-08) ### Features From 706a414e4e3f455ebdc9a0cbf792b240e6f1b384 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:05:22 +0530 Subject: [PATCH 12/13] feat: Identity file changes (#91) --- src/components/ButtonGroupIp.res | 3 +- src/components/CsvFileUpload.res | 6 ---- .../CustomCharts/HighchartBarChart.res | 4 +-- .../CustomCharts/LineChartUtils.res | 14 ++++----- src/components/DatePicker.res | 2 -- .../DistributionDonut/DistributionDonut.res | 31 +++++++++---------- src/components/ExportTable.res | 3 +- src/components/HSwitchSingleStatWidget.res | 24 ++++++++------ src/components/HighchartFunnelChart.res | 27 ++++++++-------- src/components/InputFields.res | 4 +-- src/components/InputFields.resi | 2 -- src/components/RedirectSearchInput.res | 2 -- src/components/SelectBox.res | 26 ++++++---------- src/components/SelectBox.resi | 6 ---- src/components/form/MultipleTextInput.res | 4 +-- src/components/form/SelectBoxCard.res | 3 +- .../analytics/EulerAnalyticsLogUtils.res | 1 - src/genericUtils/Identity.res | 4 +++ src/libraries/Highcharts.res | 2 -- src/libraries/SankeyHighcharts.res | 6 ++-- .../HyperSwitch/Analytics/Analytics.res | 3 -- .../RoutingRevamp/AdvancedRouting.res | 7 ++--- .../RoutingRevamp/AdvancedRoutingUIUtils.res | 14 +++++++-- .../HyperSwitch/SDKPayment/SDKPage.res | 4 +-- .../ThreeDSFlow/HSwitchThreeDS.res | 7 ++--- .../AnalyticsCommonComponents.res | 11 ++----- 26 files changed, 95 insertions(+), 125 deletions(-) diff --git a/src/components/ButtonGroupIp.res b/src/components/ButtonGroupIp.res index 5e649003a..58fd16ccb 100644 --- a/src/components/ButtonGroupIp.res +++ b/src/components/ButtonGroupIp.res @@ -1,4 +1,3 @@ -external strToFormEvent: Js.String.t => ReactEvent.Form.t = "%identity" open SelectBox @react.component let make = ( @@ -9,7 +8,7 @@ let make = ( ~isSeparate=false, ~buttonSize=?, ) => { - let onChange = str => input.onChange(str->strToFormEvent) + let onChange = str => input.onChange(str->Identity.stringToFormReactEvent) let buttonState = {isDisabled ? Button.Disabled : Button.Normal} let buttons = diff --git a/src/components/CsvFileUpload.res b/src/components/CsvFileUpload.res index 30629d66a..03548e79e 100644 --- a/src/components/CsvFileUpload.res +++ b/src/components/CsvFileUpload.res @@ -1,12 +1,6 @@ type t - type formData -external formDataToStr: t => string = "%identity" - -external toString: 't => string = "%identity" -external toRef: 'a => 't = "%identity" @new external formData: unit => t = "FormData" - @send external append: (t, string, 'a) => unit = "append" @send external delete: (t, string) => unit = "delete" @send external get: (t, string) => 'k = "get" diff --git a/src/components/CustomCharts/HighchartBarChart.res b/src/components/CustomCharts/HighchartBarChart.res index 81a46ab95..5d5c409c2 100644 --- a/src/components/CustomCharts/HighchartBarChart.res +++ b/src/components/CustomCharts/HighchartBarChart.res @@ -1,5 +1,3 @@ -external objToJson: {..} => Js.Json.t = "%identity" - module RawBarChart = { @react.component let make = (~options: Js.Json.t) => { @@ -59,7 +57,7 @@ module HighBarChart1D = { }, "series": barSeries, "legend": {"enabled": false}, - }->objToJson + }->Identity.genericObjectOrRecordToJson barOption }, (barSeries, gridLineColor)) if barSeries->Js.Array2.length > 0 { diff --git a/src/components/CustomCharts/LineChartUtils.res b/src/components/CustomCharts/LineChartUtils.res index fa44abd58..11075cee5 100644 --- a/src/components/CustomCharts/LineChartUtils.res +++ b/src/components/CustomCharts/LineChartUtils.res @@ -1,8 +1,8 @@ external legendItemAsBool: Highcharts.legendItem => Highcharts.element = "%identity" -external objToJson: {..} => Js.Json.t = "%identity" open LogicUtils open Highcharts +open Identity let defaultColor = "#7cb5ec" let legendColor = [ defaultColor, @@ -804,7 +804,7 @@ let legendItemStyle = (theme: ThemeProvider.theme, legendFontFamilyClass, legend "fontWeight": "500", "fontFamily": legendFontFamilyClass, "fontStyle": "normal", - }->objToJson + }->genericObjectOrRecordToJson | Light => { "color": "rgba(53, 64, 82, 0.8)", @@ -813,7 +813,7 @@ let legendItemStyle = (theme: ThemeProvider.theme, legendFontFamilyClass, legend "fontWeight": "500", "fontFamily": legendFontFamilyClass, "fontStyle": "normal", - }->objToJson + }->genericObjectOrRecordToJson } } @@ -831,7 +831,7 @@ let legendHiddenStyle = ( "fontWeight": "500", "fontFamily": legendFontFamilyClass, "fontStyle": "normal", - }->objToJson + }->genericObjectOrRecordToJson | Light => { "color": "rgba(53, 64, 82, 0.2)", @@ -840,7 +840,7 @@ let legendHiddenStyle = ( "fontWeight": "500", "fontFamily": legendFontFamilyClass, "fontStyle": "normal", - }->objToJson + }->genericObjectOrRecordToJson } } @@ -853,7 +853,7 @@ let chartTitleStyle = (theme: ThemeProvider.theme) => { "fontWeight": "500", "fontFamily": "IBM Plex Sans", "fontStyle": "normal", - }->objToJson + }->genericObjectOrRecordToJson | Light => { "color": "#354052", @@ -861,7 +861,7 @@ let chartTitleStyle = (theme: ThemeProvider.theme) => { "fontWeight": "500", "fontFamily": "IBM Plex Sans", "fontStyle": "normal", - }->objToJson + }->genericObjectOrRecordToJson } } diff --git a/src/components/DatePicker.res b/src/components/DatePicker.res index 83f694b19..f77716bb1 100644 --- a/src/components/DatePicker.res +++ b/src/components/DatePicker.res @@ -1,5 +1,3 @@ -external jsonToForm: Js.Json.t => ReactEvent.Form.t = "%identity" - @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, diff --git a/src/components/DistributionDonut/DistributionDonut.res b/src/components/DistributionDonut/DistributionDonut.res index 6a056d565..4611f2a6e 100644 --- a/src/components/DistributionDonut/DistributionDonut.res +++ b/src/components/DistributionDonut/DistributionDonut.res @@ -1,5 +1,3 @@ -external objToJson: {..} => Js.Json.t = "%identity" - type dataPoint = {y: int, name: string} module LegendField = { @@ -50,6 +48,7 @@ let make = ( ~data: array, ~getGroupBasedData: (array, string) => array, ) => { + open Identity let (groupBy, setGroupBy) = React.useState(_ => "") let (groupBasedData, setGroupBasedData) = React.useState((_): array => []) let getDonutOptions = (_): Js.Json.t => { @@ -58,37 +57,37 @@ let make = ( "text": Js.Json.null, "align": "center", "margin": 0, - }->objToJson, + }->genericObjectOrRecordToJson, "colors": colors, "credits": { "enabled": false, - }->objToJson, + }->genericObjectOrRecordToJson, "subtitle": { "useHTML": true, "text": getSubtilteHtml(groupBasedData), "floating": true, "verticalAlign": "middle", "y": 10, - }->objToJson, + }->genericObjectOrRecordToJson, "legend": { "enabled": false, - }->objToJson, + }->genericObjectOrRecordToJson, "chart": { "backgroundColor": Js.Json.null, "className": "h-60", "height": 260, "width": 260, "borderColor": Js.Json.null, - }->objToJson, + }->genericObjectOrRecordToJson, "tooltip": { "valueDecimals": 0, "valueSuffix": "", - }->objToJson, + }->genericObjectOrRecordToJson, "plotOptions": { "series": { "animation": { "duration": 0, - }->objToJson, + }->genericObjectOrRecordToJson, "borderWidth": 5, "colorByPoint": true, "type": "pie", @@ -101,23 +100,23 @@ let make = ( "style": { "fontWeight": "bold", "fontSize": "16px", - }->objToJson, + }->genericObjectOrRecordToJson, "connectorWidth": 0, - }->objToJson, - }->objToJson, - }->objToJson, + }->genericObjectOrRecordToJson, + }->genericObjectOrRecordToJson, + }->genericObjectOrRecordToJson, "series": [ { "color": "black", "type": "pie", "name": tooltipTitle, "data": Js.Array.map( - (d: dataPoint): Js.Json.t => {"y": d.y, "name": d.name}->objToJson, + (d: dataPoint): Js.Json.t => {"y": d.y, "name": d.name}->genericObjectOrRecordToJson, groupBasedData, ), - }->objToJson, + }->genericObjectOrRecordToJson, ], - }->objToJson + }->genericObjectOrRecordToJson } React.useEffect1(() => { setGroupBy(_ => diff --git a/src/components/ExportTable.res b/src/components/ExportTable.res index 67a0f834f..452db359a 100644 --- a/src/components/ExportTable.res +++ b/src/components/ExportTable.res @@ -1,4 +1,3 @@ -external convertToStrDict: 't => Js.Json.t = "%identity" @react.component let make = ( ~title: string, @@ -11,7 +10,7 @@ let make = ( let actualDataOrig = tableData ->Belt.Array.keepMap(item => item->Js.Nullable.toOption) - ->Js.Array2.map(convertToStrDict) + ->Js.Array2.map(Identity.genericTypeToJson) let headerNames = visibleColumns->Belt.Array.keepMap(head => { let item = head->getHeading diff --git a/src/components/HSwitchSingleStatWidget.res b/src/components/HSwitchSingleStatWidget.res index f6a4ffa04..1a3666ad9 100644 --- a/src/components/HSwitchSingleStatWidget.res +++ b/src/components/HSwitchSingleStatWidget.res @@ -17,6 +17,7 @@ let make = ( ~statThreshold: Js.Dict.t=Js.Dict.empty(), ~isHomePage=false, ) => { + open Identity let (updateKey, setUpdateKey) = React.useState(_ => false) let sortedData = React.useMemo1(() => { @@ -85,21 +86,21 @@ let make = ( "height": (isHomePage ? "80" : "50")->Some, "width": isHomePage ? None : Some("105"), "events": None, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, ), title: { "text": "", "style": Js.Json.object_(Js.Dict.empty()), - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, credits: { "enabled": false, }, legend: { "enabled": false, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, tooltip: { "enabled": false, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, plotOptions: Some( { "area": { @@ -114,7 +115,7 @@ let make = ( }, }, "lineWidth": 3, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, "boxplot": { "visible": false, }, @@ -129,21 +130,24 @@ let make = ( "legendItemClick": None, "mouseOver": Some(""), }), - }->LineChartUtils.objToJson, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, + }->genericObjectOrRecordToJson, ), xAxis: { "type": "datetime", "zoomEnabled": false, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, yAxis: { "tickPositioner": None, "plotLines": None, "visible": false, - "title": {"text": "", "style": Js.Json.object_(Js.Dict.empty())}->LineChartUtils.objToJson, + "title": { + "text": "", + "style": Js.Json.object_(Js.Dict.empty()), + }->genericObjectOrRecordToJson, "labels": {"formatter": None, "enabled": false, "useHTML": false}->Some, "zoomEnabled": false, - }->LineChartUtils.objToJson, + }->genericObjectOrRecordToJson, series: [ { color: Some(strokeColor), diff --git a/src/components/HighchartFunnelChart.res b/src/components/HighchartFunnelChart.res index 8367ffff4..7f006d707 100644 --- a/src/components/HighchartFunnelChart.res +++ b/src/components/HighchartFunnelChart.res @@ -1,6 +1,5 @@ open Highcharts open LogicUtils -external objToJson: {..} => Js.Json.t = "%identity" type options = {x: int} type tooltipPoints = { name: string, @@ -50,7 +49,7 @@ let make = ( ->Belt.Array.get(0) ->Belt.Option.getWithDefault("")}${opacity}`, "color": `${chartColors->Belt.Array.get(0)->Belt.Option.getWithDefault("")}`, - }->LineChartUtils.objToJson + }->Identity.genericObjectOrRecordToJson }), "area", ) @@ -70,7 +69,7 @@ let make = ( { "name": key, "y": item->Js.Nullable.return, - }->LineChartUtils.objToJson + }->Identity.genericObjectOrRecordToJson }) let values = { "name": key, @@ -78,7 +77,7 @@ let make = ( "color": chartColors->Belt.Array.get(chartItemIndex), "pointPlacement": "on", "legendIndex": chartItemIndex, - }->LineChartUtils.objToJson + }->Identity.genericObjectOrRecordToJson if zonesFor1D->Js.Array2.length !== 0 { Js.Array2.concat( values->getDictFromJsonObject->Js.Dict.entries, @@ -102,12 +101,12 @@ let make = ( "backgroundColor": Js.Nullable.null, "events": None, "marginBottom": 50, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, ), title: { "text": "", "style": Js.Json.object_(Js.Dict.empty()), - }->objToJson, + }->Identity.genericObjectOrRecordToJson, credits: { "enabled": false, }, @@ -129,13 +128,13 @@ let make = ( "style": { "color": theme === Light ? "rgba(246, 248, 249, 1)" : "rgba(25, 26, 26, 1)", }, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, plotOptions: Some( { "area": { "inverted": true, "lineWidth": 2, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, "boxplot": { "visible": false, }, @@ -153,12 +152,12 @@ let make = ( "legendItemClick": None, "mouseOver": Some(""), }), - }->objToJson, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, + }->Identity.genericObjectOrRecordToJson, ), legend: { "enabled": false, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, xAxis: { "visible": true, "lineWidth": 0, @@ -175,7 +174,7 @@ let make = ( }, }, "categories": categories, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, yAxis: { "title": "", "max": maxValueForTheDataSet, @@ -195,8 +194,8 @@ let make = ( "letterSpacing": "1px", "color": theme === Light ? "#4B5468" : "rgba(246, 248, 249, 0.25)", }, - }->objToJson, - }->objToJson, + }->Identity.genericObjectOrRecordToJson, + }->Identity.genericObjectOrRecordToJson, series: chartData, } }, (dataSet, categories, formatter)) diff --git a/src/components/InputFields.res b/src/components/InputFields.res index c6743ee56..d784b24dd 100644 --- a/src/components/InputFields.res +++ b/src/components/InputFields.res @@ -12,7 +12,6 @@ type comboCustomInputRecord = { } module DOBPicker = { - external jsonToForm: Js.Json.t => ReactEvent.Form.t = "%identity" @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, @@ -154,7 +153,6 @@ module DOBPicker = { } } module NumericArrayInput = { - external jsonToForm: Js.Json.t => ReactEvent.Form.t = "%identity" @react.component let make = (~input: ReactFinalForm.fieldRenderPropsInput, ~placeholder) => { let (localValue, setLocalValue) = React.useState(() => input.value) @@ -173,7 +171,7 @@ module NumericArrayInput = { value->Js.Json.string } setLocalValue(_ => value) - input.onChange(value->jsonToForm) + input.onChange(value->Identity.jsonToFormReactEvent) }, } }, (input, localValue, setLocalValue)) diff --git a/src/components/InputFields.resi b/src/components/InputFields.resi index 9b4cc6ce2..548a553cf 100644 --- a/src/components/InputFields.resi +++ b/src/components/InputFields.resi @@ -5,7 +5,6 @@ type customInputFn = ( type comboCustomInputFn = array => React.element type comboCustomInputRecord = {fn: comboCustomInputFn, names: array} module DOBPicker: { - external jsonToForm: Js.Json.t => ReactEvent.Form.t = "%identity" @react.component let make: ( ~input: ReactFinalForm.fieldRenderPropsInput, @@ -16,7 +15,6 @@ module DOBPicker: { ) => React.element } module NumericArrayInput: { - external jsonToForm: Js.Json.t => ReactEvent.Form.t = "%identity" @react.component let make: (~input: ReactFinalForm.fieldRenderPropsInput, ~placeholder: string) => React.element } diff --git a/src/components/RedirectSearchInput.res b/src/components/RedirectSearchInput.res index b97607155..2cb6408c6 100644 --- a/src/components/RedirectSearchInput.res +++ b/src/components/RedirectSearchInput.res @@ -1,5 +1,3 @@ -external toReactForm: Js.Json.t => ReactEvent.Form.t = "%identity" - module SearchInput = { @react.component let make = ( diff --git a/src/components/SelectBox.res b/src/components/SelectBox.res index 2454906fc..6e36e5bcd 100644 --- a/src/components/SelectBox.res +++ b/src/components/SelectBox.res @@ -434,7 +434,6 @@ let makeOptions = (options: array): array => { } module BaseSelect = { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make = ( ~showSelectAll=true, @@ -554,7 +553,8 @@ module BaseSelect = { } onSelect(data) switch onBlur { - | Some(fn) => "blur"->Webapi.Dom.FocusEvent.make->toReactFocusEv->fn + | Some(fn) => + "blur"->Webapi.Dom.FocusEvent.make->Identity.webAPIFocusEventToReactEventFocus->fn | None => () } } @@ -577,7 +577,8 @@ module BaseSelect = { onSelect(newValues) switch onBlur { - | Some(fn) => "blur"->Webapi.Dom.FocusEvent.make->toReactFocusEv->fn + | Some(fn) => + "blur"->Webapi.Dom.FocusEvent.make->Identity.webAPIFocusEventToReactEventFocus->fn | None => () } } @@ -942,8 +943,6 @@ module BaseSelect = { } module BaseSelectButton = { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" - @react.component let make = ( ~showDropDown=false, @@ -985,7 +984,8 @@ module BaseSelectButton = { setAssignButtonState(_ => true) switch onBlur { - | Some(fn) => "blur"->Webapi.Dom.FocusEvent.make->toReactFocusEv->fn + | Some(fn) => + "blur"->Webapi.Dom.FocusEvent.make->Identity.webAPIFocusEventToReactEventFocus->fn | None => () } } @@ -1105,8 +1105,6 @@ module BaseSelectButton = { } } module BaseRadio = { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" - @react.component let make = ( ~showDropDown=false, @@ -1184,7 +1182,8 @@ module BaseRadio = { } setSearchString(_ => "") switch onBlur { - | Some(fn) => "blur"->Webapi.Dom.FocusEvent.make->toReactFocusEv->fn + | Some(fn) => + "blur"->Webapi.Dom.FocusEvent.make->Identity.webAPIFocusEventToReactEventFocus->fn | None => () } } @@ -1362,8 +1361,6 @@ module BaseRadio = { } module CustomUISearchOptionUI = { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" - @react.component let make = ( ~showDropDown=false, @@ -1415,7 +1412,8 @@ module CustomUISearchOptionUI = { } setSearchString(_ => "") switch onBlur { - | Some(fn) => "blur"->Webapi.Dom.FocusEvent.make->toReactFocusEv->fn + | Some(fn) => + "blur"->Webapi.Dom.FocusEvent.make->Identity.webAPIFocusEventToReactEventFocus->fn | None => () } } @@ -2115,8 +2113,6 @@ module BaseDropdown = { } module InfraSelectBox = { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" - @react.component let make = ( ~options: array, @@ -2186,8 +2182,6 @@ module InfraSelectBox = { } module ChipFilterSelectBox = { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" - @react.component let make = ( ~options: array, diff --git a/src/components/SelectBox.resi b/src/components/SelectBox.resi index c35d29b27..d51532307 100644 --- a/src/components/SelectBox.resi +++ b/src/components/SelectBox.resi @@ -76,7 +76,6 @@ type opt = {name_: string} let makeUpdatedOptions: (array, array) => array let makeOptions: array => array module BaseSelect: { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make: ( ~showSelectAll: bool=?, @@ -133,7 +132,6 @@ module BaseSelect: { ) => React.element } module BaseSelectButton: { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make: ( ~showDropDown: bool=?, @@ -158,7 +156,6 @@ module BaseSelectButton: { ) => React.element } module BaseRadio: { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make: ( ~showDropDown: bool=?, @@ -197,7 +194,6 @@ module BaseRadio: { ) => React.element } module CustomUISearchOptionUI: { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make: ( ~showDropDown: bool=?, @@ -298,7 +294,6 @@ module BaseDropdown: { ) => React.element } module InfraSelectBox: { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make: ( ~options: array, @@ -312,7 +307,6 @@ module InfraSelectBox: { ) => React.element } module ChipFilterSelectBox: { - external toReactFocusEv: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = "%identity" @react.component let make: ( ~options: array, diff --git a/src/components/form/MultipleTextInput.res b/src/components/form/MultipleTextInput.res index 82e0744b5..ae847738a 100644 --- a/src/components/form/MultipleTextInput.res +++ b/src/components/form/MultipleTextInput.res @@ -27,7 +27,7 @@ module Tag = { } } } -external toForm: Js.Array2.t => ReactEvent.Form.t = "%identity" + @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, @@ -49,7 +49,7 @@ let make = ( }, [input.value]) let setTags = tags => { - tags->toForm->input.onChange + tags->Identity.arrayOfGenericTypeToFormReactEvent->input.onChange } let (text, setText) = React.useState(_ => "") diff --git a/src/components/form/SelectBoxCard.res b/src/components/form/SelectBoxCard.res index 6033b9a67..a91ae97d2 100644 --- a/src/components/form/SelectBoxCard.res +++ b/src/components/form/SelectBoxCard.res @@ -1,6 +1,5 @@ module CustomViewSection = { external formEventToInt: ReactEvent.Form.t => int = "%identity" - external arrToFormEvent: array<'a> => ReactEvent.Form.t = "%identity" external jsonArrToa: array => array<'a> = "%identity" @react.component @@ -60,7 +59,7 @@ module CustomViewSection = { ->ignore } } - onChange(finalArr->arrToFormEvent) + onChange(finalArr->Identity.arrayOfGenericTypeToFormReactEvent) }, } input diff --git a/src/entities/analytics/EulerAnalyticsLogUtils.res b/src/entities/analytics/EulerAnalyticsLogUtils.res index 03a1740dc..8fe7d7585 100644 --- a/src/entities/analytics/EulerAnalyticsLogUtils.res +++ b/src/entities/analytics/EulerAnalyticsLogUtils.res @@ -2,7 +2,6 @@ external location: {..} = "location" external toJson: exn => Js.Json.t = "%identity" external toExn: string => exn = "%identity" -external objToJson: {..} => Js.Json.t = "%identity" let useAddLogsAroundFetch = () => { let addLogsAroundFetch = (~setStatusDict=?, ~logTitle, fetchPromise) => { diff --git a/src/genericUtils/Identity.res b/src/genericUtils/Identity.res index b23176438..008ac1180 100644 --- a/src/genericUtils/Identity.res +++ b/src/genericUtils/Identity.res @@ -10,3 +10,7 @@ external formReactEventToBool: ReactEvent.Form.t => bool = "%identity" external genericObjectOrRecordToJson: {..} => Js.Json.t = "%identity" external genericTypeToDictOfJson: 't => Js.Dict.t = "%identity" external formReactEventToArrayOfString: ReactEvent.Form.t => array = "%identity" +external jsonToFormReactEvent: Js.Json.t => ReactEvent.Form.t = "%identity" +external arrayOfGenericTypeToFormReactEvent: array<'a> => ReactEvent.Form.t = "%identity" +external webAPIFocusEventToReactEventFocus: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t = + "%identity" diff --git a/src/libraries/Highcharts.res b/src/libraries/Highcharts.res index 6f0b19fb4..6da586eb3 100644 --- a/src/libraries/Highcharts.res +++ b/src/libraries/Highcharts.res @@ -50,8 +50,6 @@ external makeSomethingSeries: (~\"type": string, ~something: (float, int, string let x = makeAreaSeries(~\"type"="hello", ~something=false) let y = makeSomethingSeries(~\"type"="hello", ~something=(2., 1, "heloo")) -external makeAttribute: {..} => Js.Json.t = "%identity" - type gridLine = {attr: (. Js.Json.t) => unit} type pos type tick = { diff --git a/src/libraries/SankeyHighcharts.res b/src/libraries/SankeyHighcharts.res index a680a6bdc..e32490914 100644 --- a/src/libraries/SankeyHighcharts.res +++ b/src/libraries/SankeyHighcharts.res @@ -205,9 +205,9 @@ let init = (data: array<(string, string, int, int, int)>, nodes) => { "fontStyle": "normal", "fontWeight": 600, }, - }->LineChartUtils.objToJson, + }->Identity.genericObjectOrRecordToJson, "connectEnds": false, - }->LineChartUtils.objToJson, + }->Identity.genericObjectOrRecordToJson, ], "chart": { "height": 698, @@ -225,7 +225,7 @@ let init = (data: array<(string, string, int, int, int)>, nodes) => { "valueDecimals": 2, "backgroundColor": theme === Dark ? "white" : "black", }, - }->LineChartUtils.objToJson + }->Identity.genericObjectOrRecordToJson options } diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index 2be798615..e4ee6760e 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -1,6 +1,3 @@ -external toString: option => string = "%identity" -external convertToStrDict: 't => Js.Json.t = "%identity" -external sankeyTest: string => SankeyCharts.sankeyEntity = "%identity" @get external keyCode: 'a => int = "keyCode" type window @val external window: window = "window" diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res index 86954f45b..076b6c8cd 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res @@ -3,7 +3,6 @@ open AdvancedRoutingTypes open AdvancedRoutingUtils open LogicUtils -external arrToFormEvent: array<'a> => ReactEvent.Form.t = "%identity" external toWasm: Js.Dict.t => RoutingTypes.wasmModule = "%identity" let defaultRule = { @@ -240,7 +239,7 @@ module RuleBasedUI = { let (rules, setRules) = React.useState(_ => ruleInput.value->getArrayFromJson([])) React.useEffect1(() => { - ruleInput.onChange(rules->arrToFormEvent) + ruleInput.onChange(rules->Identity.arrayOfGenericTypeToFormReactEvent) None }, [rules]) @@ -250,13 +249,13 @@ module RuleBasedUI = { ? existingRules[index]->Belt.Option.getWithDefault(defaultRule->Identity.genericTypeToJson) : defaultRule->Identity.genericTypeToJson let newRules = existingRules->Js.Array2.concat([newRule]) - ruleInput.onChange(newRules->arrToFormEvent) + ruleInput.onChange(newRules->Identity.arrayOfGenericTypeToFormReactEvent) } let removeRule = index => { let existingRules = ruleInput.value->getArrayFromJson([]) let newRules = existingRules->Array.filterWithIndex((_, i) => i !== index) - ruleInput.onChange(newRules->arrToFormEvent) + ruleInput.onChange(newRules->Identity.arrayOfGenericTypeToFormReactEvent) }
diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res index 61ef2af65..10d32844e 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res @@ -2,7 +2,6 @@ open AdvancedRoutingTypes open AdvancedRoutingUtils open FormRenderer -external arrToFormEvent: array<'a> => ReactEvent.Form.t = "%identity" external strToFormEvent: Js.String.t => ReactEvent.Form.t = "%identity" module LogicalOps = { @@ -398,12 +397,21 @@ module MakeRuleField = { let onPlusClick = _ => { if plusBtnEnabled { let toAdd = Js.Dict.empty() - conditionsInput.onChange(Js.Array2.concat(fields, [toAdd->Js.Json.object_])->arrToFormEvent) + conditionsInput.onChange( + Js.Array2.concat( + fields, + [toAdd->Js.Json.object_], + )->Identity.arrayOfGenericTypeToFormReactEvent, + ) } } let onCrossClick = index => { - conditionsInput.onChange(fields->Array.filterWithIndex((_, i) => index !== i)->arrToFormEvent) + conditionsInput.onChange( + fields + ->Array.filterWithIndex((_, i) => index !== i) + ->Identity.arrayOfGenericTypeToFormReactEvent, + ) }
diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPage.res b/src/screens/HyperSwitch/SDKPayment/SDKPage.res index a4712dd51..4c37a06ed 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPage.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPage.res @@ -1,5 +1,4 @@ let h3Leading2Style = HSwitchUtils.getTextClass(~textVariant=H3, ~h3TextVariant=Leading_2, ()) -external strToFormEvent: Js.String.t => ReactEvent.Form.t = "%identity" module SDKConfiguarationFields = { open MerchantAccountUtils @@ -55,7 +54,8 @@ module SDKConfiguarationFields = { ev => { let eventValueToInt = ev->Identity.formReactEventToString->LogicUtils.getIntFromString(0) - let valInCents = (eventValueToInt * 100)->string_of_int->strToFormEvent + let valInCents = + (eventValueToInt * 100)->string_of_int->Identity.stringToFormReactEvent input.onChange(valInCents) } }, diff --git a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res index 96183969f..fc7e3f54f 100644 --- a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res +++ b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res @@ -1,6 +1,5 @@ open RoutingTypes external toWasm: Js.Dict.t => wasmModule = "%identity" -external arrToFormEvent: array<'a> => ReactEvent.Form.t = "%identity" module ActiveRulePreview = { open LogicUtils @@ -42,20 +41,20 @@ module Configure3DSRule = { let ruleInput = ReactFinalForm.useField("algorithm.rules").input let (rules, setRules) = React.useState(_ => ruleInput.value->LogicUtils.getArrayFromJson([])) React.useEffect1(() => { - ruleInput.onChange(rules->arrToFormEvent) + ruleInput.onChange(rules->Identity.arrayOfGenericTypeToFormReactEvent) None }, [rules]) let addRule = (index, _copy) => { let existingRules = ruleInput.value->LogicUtils.getArrayFromJson([]) let newRule = existingRules[index]->Belt.Option.getWithDefault(Js.Json.null) let newRules = existingRules->Js.Array2.concat([newRule]) - ruleInput.onChange(newRules->arrToFormEvent) + ruleInput.onChange(newRules->Identity.arrayOfGenericTypeToFormReactEvent) } let removeRule = index => { let existingRules = ruleInput.value->LogicUtils.getArrayFromJson([]) let newRules = existingRules->Array.filterWithIndex((_, i) => i !== index) - ruleInput.onChange(newRules->arrToFormEvent) + ruleInput.onChange(newRules->Identity.arrayOfGenericTypeToFormReactEvent) }
diff --git a/src/screens/analyticsScreens/AnalyticsCommonComponents.res b/src/screens/analyticsScreens/AnalyticsCommonComponents.res index e4a35f44d..e0af3a513 100644 --- a/src/screens/analyticsScreens/AnalyticsCommonComponents.res +++ b/src/screens/analyticsScreens/AnalyticsCommonComponents.res @@ -1,8 +1,3 @@ -external toString: option => string = "%identity" -external convertToStrDict: 't => Js.Json.t = "%identity" -external objToJson: {..} => Js.Json.t = "%identity" -external toJson: exn => Js.Json.t = "%identity" -external toRespJson: Fetch.Response.t => Js.Json.t = "%identity" @get external keyCode: 'a => int = "keyCode" type window @@ -887,7 +882,7 @@ module FiltersComponent = { filteredTabKeys->Js.Array2.includes(dimension) }) ->Js.Json.array, - }->LineChartUtils.objToJson, + }->Identity.genericObjectOrRecordToJson, ) | None => None } @@ -1090,7 +1085,7 @@ module DownloadCsv = { let actualDataOrig = tableData ->Belt.Array.keepMap(item => item->Js.Nullable.toOption) - ->Js.Array2.map(convertToStrDict) + ->Js.Array2.map(Identity.genericTypeToJson) let headerNames = visibleColumns->Belt.Array.keepMap(head => { let item = head->getHeading @@ -1512,7 +1507,7 @@ module ErrorModalContent = { "credits": { "enabled": false, }, - }->objToJson + }->Identity.genericObjectOrRecordToJson }, (chartData, categoryData, colName, theme)) if showModalBarChart == "Table" {
From 6c3f3cf326c31b3bd2aa8931c169c86238d9ad88 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> Date: Tue, 12 Dec 2023 12:20:09 +0530 Subject: [PATCH 13/13] refactor: dead code removal. (#92) --- src/components/MultiLineInputBox.res | 140 - src/components/NProgressIndicator.res | 6 - src/components/Navbar.res | 100 - src/components/NewCalendarList.res | 12 - src/components/NewDateRangePicker.res | 2 +- src/components/NewPagination.res | 7 - src/components/NoDataFound.res | 14 +- src/components/NoteUI.res | 8 - src/components/Pagination.res | 6 - src/components/PaginationRevamp.res | 203 -- src/components/PopOver.res | 50 - src/components/RedirectSearchInput.res | 11 - src/components/RemoteFiltersUtils.res | 168 +- src/components/RouterTabs.res | 68 - src/components/SDKFunnelChart.res | 732 ----- src/components/SankeyUtils.res | 37 +- src/components/SectionAccordion.res | 105 - src/components/ServerComponent.res | 14 - src/components/SidebarStyleUtils.res | 55 - src/components/StagedProgressBar.res | 93 - src/components/StaticTable.res | 211 -- src/components/SynchronizedCharts.res | 294 -- src/components/ThemeSelector.res | 82 - src/components/ThemeToggle.res | 41 - src/components/TimeInput.res | 17 - src/components/TimeRangeInput.res | 242 -- src/components/TimeRangeInputUtils.res | 33 - src/components/Timer.res | 27 - src/components/TopActions.res | 146 - src/components/UploadImage.res | 50 - .../hyperswitch/HyperSwitchApp.res | 11 +- src/genericUtils/AtomsStorage.res | 8 - src/genericUtils/BreadCrumbNavigation.res | 2 - src/genericUtils/UseEvent.res | 12 - src/hooks/AnalyticsHooks.res | 174 - src/hooks/AuthHooks.res | 227 +- src/hooks/DateRefreshHooks.res | 2 +- src/hooks/ModalsState.res | 13 - src/hooks/NewThemeHooks.res | 42 - .../AnalyticsCommonComponents.res | 2809 ----------------- 40 files changed, 31 insertions(+), 6243 deletions(-) delete mode 100644 src/components/MultiLineInputBox.res delete mode 100644 src/components/NProgressIndicator.res delete mode 100644 src/components/NoteUI.res delete mode 100644 src/components/PaginationRevamp.res delete mode 100644 src/components/PopOver.res delete mode 100644 src/components/RouterTabs.res delete mode 100644 src/components/SDKFunnelChart.res delete mode 100644 src/components/SectionAccordion.res delete mode 100644 src/components/ServerComponent.res delete mode 100644 src/components/SidebarStyleUtils.res delete mode 100644 src/components/StagedProgressBar.res delete mode 100644 src/components/StaticTable.res delete mode 100644 src/components/SynchronizedCharts.res delete mode 100644 src/components/ThemeSelector.res delete mode 100644 src/components/ThemeToggle.res delete mode 100644 src/components/TimeRangeInput.res delete mode 100644 src/components/TimeRangeInputUtils.res delete mode 100644 src/components/Timer.res delete mode 100644 src/components/TopActions.res delete mode 100644 src/components/UploadImage.res delete mode 100644 src/genericUtils/AtomsStorage.res delete mode 100644 src/hooks/NewThemeHooks.res delete mode 100644 src/screens/analyticsScreens/AnalyticsCommonComponents.res diff --git a/src/components/MultiLineInputBox.res b/src/components/MultiLineInputBox.res deleted file mode 100644 index 166cffabc..000000000 --- a/src/components/MultiLineInputBox.res +++ /dev/null @@ -1,140 +0,0 @@ -@react.component -let make = ( - ~input: ReactFinalForm.fieldRenderPropsInput, - ~placeholder, - ~isDisabled, - ~rows=?, - ~cols=?, - ~customClass="", - ~readOnly=?, - ~maxLength=?, - ~class="", - ~roundedBorder=false, - ~prefix=?, - ~handleRemove=_ => (), - ~setShow=_ => (), -) => { - let (focus, setFocus) = React.useState(_ => false) - let (error, setError) = React.useState(_ => None) - let cursorClass = if isDisabled { - "cursor-not-allowed" - } else { - "" - } - - let handleRemove = _ => { - input.onChange(""->Identity.stringToFormReactEvent) - setError(_ => None) - setFocus(_ => false) - handleRemove() - } - - let className = `rounded-md border border-jp-gray-lightmode_steelgray border-opacity-75 font-normal p-2 text-jp-gray-900 text-opacity-75 placeholder-jp-gray-900 placeholder-opacity-25 hover:bg-jp-gray-lightmode_steelgray hover:bg-opacity-20 hover:border-jp-gray-900 hover:border-opacity-20 focus:text-opacity-100 focus:outline-none focus:border-blue-800 focus:border-opacity-100 dark:text-jp-gray-text_darktheme dark:text-opacity-75 dark:border-jp-gray-960 dark:hover:border-jp-gray-960 dark:hover:bg-jp-gray-970 dark:bg-jp-gray-darkgray_background dark:placeholder-jp-gray-text_darktheme dark:placeholder-opacity-25 dark:focus:text-opacity-100 dark:focus:border-blue-800 ${cursorClass} ${customClass}` - let value = switch input.value->Js.Json.classify { - | JSONString(str) => str - | JSONNumber(num) => num->Belt.Float.toString - | _ => "" - } - - let onBlur = _ => { - let value = value->Js_string.trim - - let lengthError = - maxLength->Belt.Option.flatMap(length => - value->Js_string.length <= length - ? None - : Some(`Maximum length should be ${length->Belt.Int.toString}`) - ) - - let error = lengthError - - if value === "" || error->Belt.Option.isNone { - setFocus(_ => false) - input.onChange(value->Identity.stringToFormReactEvent) - setShow(_ => false) - } else { - setError(_ => error) - setShow(_ => false) - } - } - - let isError = error->Belt.Option.isSome - - let borderColor = isError - ? "border rounded-md border-red-600 dark:border-red-600" - : focus - ? "border-opacity-100 border-blue-800" - : roundedBorder - ? "border-gray-300 dark:border-jp-gray-800" - : "border-opacity-75 border-gray-300 dark:border-jp-gray-800" - - let textAreaComponent = -