@finspringinnovations/fdsdk 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,10 @@ import React from 'react';
|
|
|
2
2
|
interface InterestRateCardProps {
|
|
3
3
|
interestRate: string;
|
|
4
4
|
maturityAmount: string;
|
|
5
|
+
/** Interest payout amount (e.g. from sdrCalc[0].intPayAmt), shown below Interest Rate */
|
|
6
|
+
intPayAmt?: string;
|
|
7
|
+
/** Total interest earnings (e.g. from sdrCalc[0].totalInterestEarnings), shown below On Maturity */
|
|
8
|
+
totalInterestEarnings?: string;
|
|
5
9
|
children?: React.ReactNode;
|
|
6
10
|
}
|
|
7
11
|
declare const InterestRateCard: React.FC<InterestRateCardProps>;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const react_native_1 = require("react-native");
|
|
8
8
|
const ThemeContext_1 = require("../theme/ThemeContext");
|
|
9
|
-
const InterestRateCard = ({ interestRate, maturityAmount, children, }) => {
|
|
9
|
+
const InterestRateCard = ({ interestRate, maturityAmount, intPayAmt, totalInterestEarnings, children, }) => {
|
|
10
10
|
const colors = (0, ThemeContext_1.useColors)();
|
|
11
11
|
const typography = (0, ThemeContext_1.useTypography)();
|
|
12
12
|
const { themeName } = (0, ThemeContext_1.useTheme)();
|
|
@@ -17,8 +17,15 @@ const InterestRateCard = ({ interestRate, maturityAmount, children, }) => {
|
|
|
17
17
|
react_1.default.createElement(react_native_1.Text, { style: styles.label }, "Interest Rate"),
|
|
18
18
|
react_1.default.createElement(react_native_1.Text, { style: styles.value }, interestRate)),
|
|
19
19
|
react_1.default.createElement(react_native_1.View, { style: styles.right },
|
|
20
|
-
react_1.default.createElement(react_native_1.Text, { style: styles.label }, "On Maturity"),
|
|
20
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.label }, "Amount On Maturity"),
|
|
21
21
|
react_1.default.createElement(react_native_1.Text, { style: styles.valueRight }, maturityAmount))),
|
|
22
|
+
(intPayAmt != null || totalInterestEarnings != null) && (react_1.default.createElement(react_native_1.View, { style: [styles.row, styles.secondRow] },
|
|
23
|
+
react_1.default.createElement(react_native_1.View, { style: styles.left }, intPayAmt != null && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
24
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.label }, "Total Interest"),
|
|
25
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.value }, intPayAmt)))),
|
|
26
|
+
react_1.default.createElement(react_native_1.View, { style: styles.right }, totalInterestEarnings != null && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
27
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.label }, "On Maturity Interest"),
|
|
28
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.valueRight }, totalInterestEarnings)))))),
|
|
22
29
|
children));
|
|
23
30
|
};
|
|
24
31
|
const createStyles = (colors, typography, themeName) => react_native_1.StyleSheet.create({
|
|
@@ -33,6 +40,9 @@ const createStyles = (colors, typography, themeName) => react_native_1.StyleShee
|
|
|
33
40
|
flexDirection: 'row',
|
|
34
41
|
justifyContent: 'space-between',
|
|
35
42
|
},
|
|
43
|
+
secondRow: {
|
|
44
|
+
marginTop: 12,
|
|
45
|
+
},
|
|
36
46
|
left: {
|
|
37
47
|
flex: 1,
|
|
38
48
|
},
|
|
@@ -42,6 +52,6 @@ const createStyles = (colors, typography, themeName) => react_native_1.StyleShee
|
|
|
42
52
|
},
|
|
43
53
|
label: Object.assign(Object.assign({}, typography.styles.bodySmall), { color: colors.textLight, marginBottom: 4 }),
|
|
44
54
|
value: Object.assign(Object.assign({}, typography.styles.bodyLarge), { fontWeight: '600', color: colors.text }),
|
|
45
|
-
valueRight: Object.assign(Object.assign({}, typography.styles.bodyLarge), { fontWeight: '700', color: colors.text }),
|
|
55
|
+
valueRight: Object.assign(Object.assign({}, typography.styles.bodyLarge), { fontWeight: '700', color: colors.text, alignItems: 'center', justifyContent: 'center', marginRight: 10 }),
|
|
46
56
|
});
|
|
47
57
|
exports.default = InterestRateCard;
|
|
@@ -617,7 +617,31 @@ const FDCalculator = ({ onGoBack, onExitSDK, onPanRequired, onNavigateToReviewKY
|
|
|
617
617
|
? (_a = data === null || data === void 0 ? void 0 : data.sdrCalc) === null || _a === void 0 ? void 0 : _a[0]
|
|
618
618
|
: (_b = data === null || data === void 0 ? void 0 : data.fdrCalc) === null || _b === void 0 ? void 0 : _b[0];
|
|
619
619
|
const maturityAmount = (calcData === null || calcData === void 0 ? void 0 : calcData.maturityAmount) || (data === null || data === void 0 ? void 0 : data.maturityAmount) || (data === null || data === void 0 ? void 0 : data.totalAmount) || (data === null || data === void 0 ? void 0 : data.finalAmount) || (data === null || data === void 0 ? void 0 : data.amount);
|
|
620
|
-
return maturityAmount ? `₹${maturityAmount.toLocaleString()}` : "";
|
|
620
|
+
return maturityAmount ? `₹${Number(maturityAmount).toLocaleString()}` : "";
|
|
621
|
+
})(), intPayAmt: (() => {
|
|
622
|
+
var _a, _b;
|
|
623
|
+
const data = calculationResult === null || calculationResult === void 0 ? void 0 : calculationResult.data;
|
|
624
|
+
const investmentType = payoutValue === 'On Maturity' ? 'SDR' : 'FDR';
|
|
625
|
+
const calcData = investmentType === 'SDR'
|
|
626
|
+
? (_a = data === null || data === void 0 ? void 0 : data.sdrCalc) === null || _a === void 0 ? void 0 : _a[0]
|
|
627
|
+
: (_b = data === null || data === void 0 ? void 0 : data.fdrCalc) === null || _b === void 0 ? void 0 : _b[0];
|
|
628
|
+
const val = calcData === null || calcData === void 0 ? void 0 : calcData.intPayAmt;
|
|
629
|
+
if (val == null)
|
|
630
|
+
return undefined;
|
|
631
|
+
const num = Number(val);
|
|
632
|
+
return Number.isFinite(num) ? `₹ ${num.toLocaleString()}` : String(val);
|
|
633
|
+
})(), totalInterestEarnings: (() => {
|
|
634
|
+
var _a, _b;
|
|
635
|
+
const data = calculationResult === null || calculationResult === void 0 ? void 0 : calculationResult.data;
|
|
636
|
+
const investmentType = payoutValue === 'On Maturity' ? 'SDR' : 'FDR';
|
|
637
|
+
const calcData = investmentType === 'SDR'
|
|
638
|
+
? (_a = data === null || data === void 0 ? void 0 : data.sdrCalc) === null || _a === void 0 ? void 0 : _a[0]
|
|
639
|
+
: (_b = data === null || data === void 0 ? void 0 : data.fdrCalc) === null || _b === void 0 ? void 0 : _b[0];
|
|
640
|
+
const val = calcData === null || calcData === void 0 ? void 0 : calcData.totalInterestEarnings;
|
|
641
|
+
if (val == null)
|
|
642
|
+
return undefined;
|
|
643
|
+
const num = Number(val);
|
|
644
|
+
return Number.isFinite(num) ? `₹ ${num.toLocaleString()}` : String(val);
|
|
621
645
|
})() },
|
|
622
646
|
react_1.default.createElement(components_1.CheckboxOption, { label: strings_1.FD_STRINGS.SENIOR_CITIZEN_BENEFIT, checked: seniorCitizen, onPress: () => setSeniorCitizen(!seniorCitizen), numberOfLines: 1, containerStyle: { marginTop: 12 }, disabled: true })),
|
|
623
647
|
react_1.default.createElement(react_native_1.View, { style: [styles.checkboxCard, !taxResident && styles.checkboxCardError] },
|
package/package.json
CHANGED
|
@@ -5,12 +5,18 @@ import { useColors, useTypography, useTheme } from '../theme/ThemeContext';
|
|
|
5
5
|
interface InterestRateCardProps {
|
|
6
6
|
interestRate: string;
|
|
7
7
|
maturityAmount: string;
|
|
8
|
+
/** Interest payout amount (e.g. from sdrCalc[0].intPayAmt), shown below Interest Rate */
|
|
9
|
+
intPayAmt?: string;
|
|
10
|
+
/** Total interest earnings (e.g. from sdrCalc[0].totalInterestEarnings), shown below On Maturity */
|
|
11
|
+
totalInterestEarnings?: string;
|
|
8
12
|
children?: React.ReactNode;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
const InterestRateCard: React.FC<InterestRateCardProps> = ({
|
|
12
16
|
interestRate,
|
|
13
17
|
maturityAmount,
|
|
18
|
+
intPayAmt,
|
|
19
|
+
totalInterestEarnings,
|
|
14
20
|
children,
|
|
15
21
|
}) => {
|
|
16
22
|
const colors = useColors();
|
|
@@ -26,15 +32,31 @@ const InterestRateCard: React.FC<InterestRateCardProps> = ({
|
|
|
26
32
|
<Text style={styles.value}>{interestRate}</Text>
|
|
27
33
|
</View>
|
|
28
34
|
<View style={styles.right}>
|
|
29
|
-
|
|
30
|
-
<Text style={styles.label}>On Maturity</Text>
|
|
35
|
+
<Text style={styles.label}>Amount On Maturity</Text>
|
|
31
36
|
<Text style={styles.valueRight}>{maturityAmount}</Text>
|
|
32
|
-
|
|
33
37
|
</View>
|
|
34
|
-
|
|
35
38
|
</View>
|
|
39
|
+
{(intPayAmt != null || totalInterestEarnings != null) && (
|
|
40
|
+
<View style={[styles.row, styles.secondRow]}>
|
|
41
|
+
<View style={styles.left}>
|
|
42
|
+
{intPayAmt != null && (
|
|
43
|
+
<>
|
|
44
|
+
<Text style={styles.label}>Total Interest</Text>
|
|
45
|
+
<Text style={styles.value}>{intPayAmt}</Text>
|
|
46
|
+
</>
|
|
47
|
+
)}
|
|
48
|
+
</View>
|
|
49
|
+
<View style={styles.right}>
|
|
50
|
+
{totalInterestEarnings != null && (
|
|
51
|
+
<>
|
|
52
|
+
<Text style={styles.label}>On Maturity Interest</Text>
|
|
53
|
+
<Text style={styles.valueRight}>{totalInterestEarnings}</Text>
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
)}
|
|
36
59
|
{children}
|
|
37
|
-
|
|
38
60
|
</View>
|
|
39
61
|
);
|
|
40
62
|
};
|
|
@@ -51,6 +73,9 @@ const createStyles = (colors: any, typography: any, themeName: string) => StyleS
|
|
|
51
73
|
flexDirection: 'row',
|
|
52
74
|
justifyContent: 'space-between',
|
|
53
75
|
},
|
|
76
|
+
secondRow: {
|
|
77
|
+
marginTop: 12,
|
|
78
|
+
},
|
|
54
79
|
left: {
|
|
55
80
|
flex: 1,
|
|
56
81
|
},
|
|
@@ -72,6 +97,9 @@ const createStyles = (colors: any, typography: any, themeName: string) => StyleS
|
|
|
72
97
|
...typography.styles.bodyLarge,
|
|
73
98
|
fontWeight: '700',
|
|
74
99
|
color: colors.text,
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
marginRight: 10,
|
|
75
103
|
},
|
|
76
104
|
});
|
|
77
105
|
|
|
@@ -757,7 +757,29 @@ const FDCalculator: React.FC<FDCalculatorProps> = ({ onGoBack, onExitSDK, onPanR
|
|
|
757
757
|
? data?.sdrCalc?.[0]
|
|
758
758
|
: data?.fdrCalc?.[0];
|
|
759
759
|
const maturityAmount = calcData?.maturityAmount || data?.maturityAmount || data?.totalAmount || data?.finalAmount || data?.amount;
|
|
760
|
-
return maturityAmount ? `₹${maturityAmount.toLocaleString()}` : "";
|
|
760
|
+
return maturityAmount ? `₹${Number(maturityAmount).toLocaleString()}` : "";
|
|
761
|
+
})()}
|
|
762
|
+
intPayAmt={(() => {
|
|
763
|
+
const data = calculationResult?.data;
|
|
764
|
+
const investmentType = payoutValue === 'On Maturity' ? 'SDR' : 'FDR';
|
|
765
|
+
const calcData = investmentType === 'SDR'
|
|
766
|
+
? data?.sdrCalc?.[0]
|
|
767
|
+
: data?.fdrCalc?.[0];
|
|
768
|
+
const val = calcData?.intPayAmt;
|
|
769
|
+
if (val == null) return undefined;
|
|
770
|
+
const num = Number(val);
|
|
771
|
+
return Number.isFinite(num) ? `₹ ${num.toLocaleString()}` : String(val);
|
|
772
|
+
})()}
|
|
773
|
+
totalInterestEarnings={(() => {
|
|
774
|
+
const data = calculationResult?.data;
|
|
775
|
+
const investmentType = payoutValue === 'On Maturity' ? 'SDR' : 'FDR';
|
|
776
|
+
const calcData = investmentType === 'SDR'
|
|
777
|
+
? data?.sdrCalc?.[0]
|
|
778
|
+
: data?.fdrCalc?.[0];
|
|
779
|
+
const val = calcData?.totalInterestEarnings;
|
|
780
|
+
if (val == null) return undefined;
|
|
781
|
+
const num = Number(val);
|
|
782
|
+
return Number.isFinite(num) ? `₹ ${num.toLocaleString()}` : String(val);
|
|
761
783
|
})()}
|
|
762
784
|
>
|
|
763
785
|
<CheckboxOption
|