diff --git a/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphTypes.res b/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphTypes.res index 1a7527d1b..fda5413d2 100644 --- a/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphTypes.res +++ b/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphTypes.res @@ -66,6 +66,7 @@ type yAxis = { gridLineColor: gridLineColor, gridLineDashStyle: gridLineDashStyle, min: min, + max?: option, } type xAxis = { @@ -115,5 +116,6 @@ type lineGraphPayload = { categories: categories, data: data, title: title, + yAxisMaxValue: option, tooltipFormatter: pointFormatter => string, } diff --git a/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphUtils.res b/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphUtils.res index 08103d41f..14a289cdc 100644 --- a/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphUtils.res +++ b/src/screens/NewAnalytics/Graphs/LineGraph/LineGraphUtils.res @@ -1,13 +1,21 @@ open LineGraphTypes let getLineGraphOptions = (lineGraphOptions: lineGraphPayload) => { - let {categories, data, title, tooltipFormatter} = lineGraphOptions + let {categories, data, title, tooltipFormatter, yAxisMaxValue} = lineGraphOptions let stepInterval = Js.Math.max_int( Js.Math.ceil_int(categories->Array.length->Int.toFloat /. 20.0), 1, ) + let yAxis: LineGraphTypes.yAxis = { + title, + gridLineWidth: 1, + gridLineColor: "#e6e6e6", + gridLineDashStyle: "Dash", + min: 0, + } + { chart: { \"type": "line", @@ -52,11 +60,13 @@ let getLineGraphOptions = (lineGraphOptions: lineGraphPayload) => { shared: true, // Allows multiple series' data to be shown in a single tooltip }, yAxis: { - title, - gridLineWidth: 1, - gridLineColor: "#e6e6e6", - gridLineDashStyle: "Dash", - min: 0, + switch yAxisMaxValue { + | Some(val) => { + ...yAxis, + max: val->Some, + } + | _ => yAxis + } }, plotOptions: { line: { diff --git a/src/screens/NewAnalytics/PaymentAnalytics/NewPaymentAnalyticsUtils.res b/src/screens/NewAnalytics/PaymentAnalytics/NewPaymentAnalyticsUtils.res index 105d5d824..7cc2eb4f2 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/NewPaymentAnalyticsUtils.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/NewPaymentAnalyticsUtils.res @@ -6,7 +6,7 @@ let getCategories = (data: JSON.t, index: int, key: string) => { ->getValueFromArray(index, []->JSON.Encode.array) ->getArrayFromJson([]) ->Array.map(item => { - let value = item->getDictFromJsonObject->getString(key, "") + let value = item->getDictFromJsonObject->getString(key, "NA") if value->isNonEmptyString && key == "time_bucket" { let dateObj = value->DayJs.getDayJsForString @@ -142,12 +142,15 @@ let tooltipFormatter = ( let primartPoint = this.points->getValueFromArray(0, defaultValue) let secondaryPoint = this.points->getValueFromArray(1, defaultValue) + // TODO:Currency need to be picked from filter + let suffix = metricType == NewAnalyticsTypes.Amount ? "USD" : "" + let getRowsHtml = (~iconColor, ~date, ~value, ~comparisionComponent="") => { let valueString = valueFormatter(value, metricType) `
${date}${comparisionComponent}
-
${valueString}
+
${valueString} ${suffix}
` } diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionHelper.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionHelper.res index 1771749de..92b380ef6 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionHelper.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionHelper.res @@ -20,7 +20,7 @@ module SmartRetryCard = { connector-list
- {`Saved ${valueFormatter(primaryValue, config.valueType)}`->React.string} + {`Saved ${valueFormatter(primaryValue, config.valueType)} USD`->React.string} // TODO:Currency need to be picked from filter
@@ -57,7 +57,12 @@ module OverViewStat = {
- {valueFormatter(primaryValue, config.valueType)->React.string} + { + let value = valueFormatter(primaryValue, config.valueType) + let suffix = config.valueType == Amount ? "USD" : "" + + `${value} ${suffix}`->React.string + }
diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionTypes.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionTypes.res index fec32d4fd..afb0f40cc 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionTypes.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionTypes.res @@ -9,13 +9,13 @@ type overviewColumns = | Total_Dispute type dataObj = { - total_smart_retried_amount_usd: float, - total_smart_retried_amount_without_smart_retries_usd: float, + total_smart_retried_amount_in_usd: float, + total_smart_retried_amount_without_smart_retries_in_usd: float, total_success_rate: float, total_success_rate_without_smart_retries: float, - total_payment_processed_amount_usd: float, + total_payment_processed_amount_in_usd: float, total_payment_processed_count: int, - total_payment_processed_amount_without_smart_retries_usd: float, + total_payment_processed_amount_without_smart_retries_in_usd: float, total_payment_processed_count_without_smart_retries: int, refund_processed_amount: float, total_dispute: int, diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionUtils.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionUtils.res index c2d189625..1e2722563 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionUtils.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsOverviewSection/NewPaymentsOverviewSectionUtils.res @@ -2,12 +2,12 @@ open NewPaymentsOverviewSectionTypes let getStringFromVariant = value => { switch value { - | Total_Smart_Retried_Amount => "total_smart_retried_amount_usd" - | Total_Smart_Retried_Amount_Without_Smart_Retries => "total_smart_retried_amount_without_smart_retries_usd" + | Total_Smart_Retried_Amount => "total_smart_retried_amount_in_usd" + | Total_Smart_Retried_Amount_Without_Smart_Retries => "total_smart_retried_amount_without_smart_retries_in_usd" | Total_Success_Rate => "total_success_rate" | Total_Success_Rate_Without_Smart_Retries => "total_success_rate_without_smart_retries" - | Total_Payment_Processed_Amount => "total_payment_processed_amount_usd" - | Total_Payment_Processed_Amount_Without_Smart_Retries => "total_payment_processed_amount_without_smart_retries_usd" + | Total_Payment_Processed_Amount => "total_payment_processed_amount_in_usd" + | Total_Payment_Processed_Amount_Without_Smart_Retries => "total_payment_processed_amount_without_smart_retries_in_usd" | Refund_Processed_Amount => "refund_processed_amount" | Total_Dispute => "total_dispute" } @@ -15,13 +15,13 @@ let getStringFromVariant = value => { let defaultValue = { - total_smart_retried_amount_usd: 0.0, - total_smart_retried_amount_without_smart_retries_usd: 0.0, + total_smart_retried_amount_in_usd: 0.0, + total_smart_retried_amount_without_smart_retries_in_usd: 0.0, total_success_rate: 0.0, total_success_rate_without_smart_retries: 0.0, - total_payment_processed_amount_usd: 0.0, + total_payment_processed_amount_in_usd: 0.0, total_payment_processed_count: 0, - total_payment_processed_amount_without_smart_retries_usd: 0.0, + total_payment_processed_amount_without_smart_retries_in_usd: 0.0, total_payment_processed_count_without_smart_retries: 0, refund_processed_amount: 0.0, total_dispute: 0, diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessed.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessed.res index 97fd72968..22e3c4393 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessed.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessed.res @@ -112,7 +112,7 @@ module PaymentsProcessedHeader = {
- {primaryValue->valueFormatter(Amount)->React.string} + {`${primaryValue->valueFormatter(Amount)} USD`->React.string} // TODO:Currency need to be picked from filter
diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedTypes.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedTypes.res index 1add17f7c..0029235c6 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedTypes.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedTypes.res @@ -10,13 +10,13 @@ type paymentsProcessedCols = | Time_Bucket type paymentsProcessedObject = { - payment_processed_amount_usd: float, + payment_processed_amount_in_usd: float, payment_processed_count: int, - payment_processed_amount_without_smart_retries_usd: float, + payment_processed_amount_without_smart_retries_in_usd: float, payment_processed_count_without_smart_retries: int, - total_payment_processed_amount_usd: float, + total_payment_processed_amount_in_usd: float, total_payment_processed_count: int, - total_payment_processed_amount_without_smart_retries_usd: float, + total_payment_processed_amount_without_smart_retries_in_usd: float, total_payment_processed_count_without_smart_retries: int, time_bucket: string, } diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedUtils.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedUtils.res index f908e8b45..9e3af23ef 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedUtils.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsProcessed/PaymentsProcessedUtils.res @@ -4,13 +4,13 @@ open LogicUtils let getStringFromVariant = value => { switch value { - | Payment_Processed_Amount => "payment_processed_amount_usd" + | Payment_Processed_Amount => "payment_processed_amount_in_usd" | Payment_Processed_Count => "payment_processed_count" - | Payment_Processed_Amount_Without_Smart_Retries => "payment_processed_amount_without_smart_retries_usd" + | Payment_Processed_Amount_Without_Smart_Retries => "payment_processed_amount_without_smart_retries_in_usd" | Payment_Processed_Count_Without_Smart_Retries => "payment_processed_count_without_smart_retries" - | Total_Payment_Processed_Amount => "total_payment_processed_amount_usd" + | Total_Payment_Processed_Amount => "total_payment_processed_amount_in_usd" | Total_Payment_Processed_Count => "total_payment_processed_count" - | Total_Payment_Processed_Amount_Without_Smart_Retries => "total_payment_processed_amount_without_smart_retries_usd" + | Total_Payment_Processed_Amount_Without_Smart_Retries => "total_payment_processed_amount_without_smart_retries_in_usd" | Total_Payment_Processed_Count_Without_Smart_Retriess => "total_payment_processed_count_without_smart_retries" | Time_Bucket => "time_bucket" } @@ -18,14 +18,14 @@ let getStringFromVariant = value => { let getVariantValueFromString = value => { switch value { - | "payment_processed_amount_usd" => Payment_Processed_Amount + | "payment_processed_amount_in_usd" => Payment_Processed_Amount | "payment_processed_count" => Payment_Processed_Count - | "payment_processed_amount_without_smart_retries_usd" => + | "payment_processed_amount_without_smart_retries_in_usd" => Payment_Processed_Amount_Without_Smart_Retries | "payment_processed_count_without_smart_retries" => Payment_Processed_Count_Without_Smart_Retries - | "total_payment_processed_amount_usd" => Total_Payment_Processed_Amount + | "total_payment_processed_amount_in_usd" => Total_Payment_Processed_Amount | "total_payment_processed_count" => Total_Payment_Processed_Count - | "total_payment_processed_amount_without_smart_retries_usd" => + | "total_payment_processed_amount_without_smart_retries_in_usd" => Total_Payment_Processed_Amount_Without_Smart_Retries | "total_payment_processed_count_without_smart_retries" => Total_Payment_Processed_Count_Without_Smart_Retriess @@ -76,6 +76,7 @@ let paymentsProcessedMapper = ( categories: primaryCategories, data: lineGraphData, title, + yAxisMaxValue: None, tooltipFormatter: tooltipFormatter( ~secondaryCategories, ~title="Payments Processed", @@ -98,25 +99,25 @@ let visibleColumns = [Time_Bucket] let tableItemToObjMapper: Dict.t => paymentsProcessedObject = dict => { { - payment_processed_amount_usd: dict->getAmountValue( + payment_processed_amount_in_usd: dict->getAmountValue( ~id=Payment_Processed_Amount->getStringFromVariant, ), payment_processed_count: dict->getInt(Payment_Processed_Count->getStringFromVariant, 0), - payment_processed_amount_without_smart_retries_usd: dict->getAmountValue( + payment_processed_amount_without_smart_retries_in_usd: dict->getAmountValue( ~id=Payment_Processed_Amount_Without_Smart_Retries->getStringFromVariant, ), payment_processed_count_without_smart_retries: dict->getInt( Payment_Processed_Count_Without_Smart_Retries->getStringFromVariant, 0, ), - total_payment_processed_amount_usd: dict->getAmountValue( + total_payment_processed_amount_in_usd: dict->getAmountValue( ~id=Total_Payment_Processed_Amount->getStringFromVariant, ), total_payment_processed_count: dict->getInt( Total_Payment_Processed_Count->getStringFromVariant, 0, ), - total_payment_processed_amount_without_smart_retries_usd: dict->getAmountValue( + total_payment_processed_amount_without_smart_retries_in_usd: dict->getAmountValue( ~id=Total_Payment_Processed_Amount_Without_Smart_Retries->getStringFromVariant, ), total_payment_processed_count_without_smart_retries: dict->getInt( @@ -175,9 +176,9 @@ let getHeading = colType => { let getCell = (obj, colType): Table.cell => { open NewAnalyticsUtils switch colType { - | Payment_Processed_Amount => Text(obj.payment_processed_amount_usd->valueFormatter(Amount)) + | Payment_Processed_Amount => Text(obj.payment_processed_amount_in_usd->valueFormatter(Amount)) | Payment_Processed_Amount_Without_Smart_Retries => - Text(obj.payment_processed_amount_without_smart_retries_usd->valueFormatter(Amount)) + Text(obj.payment_processed_amount_without_smart_retries_in_usd->valueFormatter(Amount)) | Payment_Processed_Count => Text(obj.payment_processed_count->Int.toString) | Payment_Processed_Count_Without_Smart_Retries => Text(obj.payment_processed_count_without_smart_retries->Int.toString) diff --git a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsSuccessRate/PaymentsSuccessRateUtils.res b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsSuccessRate/PaymentsSuccessRateUtils.res index 856b1a74b..1abb0c3ec 100644 --- a/src/screens/NewAnalytics/PaymentAnalytics/PaymentsSuccessRate/PaymentsSuccessRateUtils.res +++ b/src/screens/NewAnalytics/PaymentAnalytics/PaymentsSuccessRate/PaymentsSuccessRateUtils.res @@ -55,6 +55,7 @@ let paymentsSuccessRateMapper = ( categories: primaryCategories, data: lineGraphData, title, + yAxisMaxValue: 100->Some, tooltipFormatter: tooltipFormatter( ~secondaryCategories, ~title="Payments Success Rate",