@networkinternational/ni-card-management-sdk 2.0.0 → 2.1.0
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.
- package/README.md +49 -1
- package/android/build.gradle +0 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/nicardmanagement/NiCardManagementModule.kt +17 -5
- package/lib/commonjs/NICardManagementComponents/CardDetailsComponent.js +11 -1
- package/lib/commonjs/NICardManagementComponents/CardDetailsComponent.js.map +1 -1
- package/lib/commonjs/NICardManagementComponents/ViewPinComponent.js +10 -5
- package/lib/commonjs/NICardManagementComponents/ViewPinComponent.js.map +1 -1
- package/lib/commonjs/components/CardDetails/CardHolderNameGroups.js +4 -5
- package/lib/commonjs/components/CardDetails/CardHolderNameGroups.js.map +1 -1
- package/lib/commonjs/components/CardDetails/CardNumberGroup.js +4 -5
- package/lib/commonjs/components/CardDetails/CardNumberGroup.js.map +1 -1
- package/lib/commonjs/components/FeedbackPopup/FeedbackPopup.js +106 -0
- package/lib/commonjs/components/FeedbackPopup/FeedbackPopup.js.map +1 -0
- package/lib/commonjs/config/localization.js +10 -0
- package/lib/commonjs/config/localization.js.map +1 -1
- package/lib/module/NICardManagementComponents/CardDetailsComponent.js +11 -1
- package/lib/module/NICardManagementComponents/CardDetailsComponent.js.map +1 -1
- package/lib/module/NICardManagementComponents/ViewPinComponent.js +10 -5
- package/lib/module/NICardManagementComponents/ViewPinComponent.js.map +1 -1
- package/lib/module/components/CardDetails/CardHolderNameGroups.js +4 -5
- package/lib/module/components/CardDetails/CardHolderNameGroups.js.map +1 -1
- package/lib/module/components/CardDetails/CardNumberGroup.js +4 -5
- package/lib/module/components/CardDetails/CardNumberGroup.js.map +1 -1
- package/lib/module/components/FeedbackPopup/FeedbackPopup.js +97 -0
- package/lib/module/components/FeedbackPopup/FeedbackPopup.js.map +1 -0
- package/lib/module/config/localization.js +10 -0
- package/lib/module/config/localization.js.map +1 -1
- package/lib/typescript/src/NICardManagementComponents/CardDetailsComponent.d.ts.map +1 -1
- package/lib/typescript/src/NICardManagementComponents/ViewPinComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/CardDetails/CardHolderNameGroups.d.ts.map +1 -1
- package/lib/typescript/src/components/CardDetails/CardNumberGroup.d.ts.map +1 -1
- package/lib/typescript/src/components/FeedbackPopup/FeedbackPopup.d.ts +13 -0
- package/lib/typescript/src/components/FeedbackPopup/FeedbackPopup.d.ts.map +1 -0
- package/lib/typescript/src/config/localization.d.ts +10 -0
- package/lib/typescript/src/config/localization.d.ts.map +1 -1
- package/lib/typescript/src/utils/localization.d.ts +5 -0
- package/lib/typescript/src/utils/localization.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NICardManagementComponents/CardDetailsComponent.tsx +11 -0
- package/src/NICardManagementComponents/ViewPinComponent.tsx +11 -7
- package/src/components/CardDetails/CardHolderNameGroups.tsx +4 -6
- package/src/components/CardDetails/CardNumberGroup.tsx +4 -6
- package/src/components/FeedbackPopup/FeedbackPopup.tsx +117 -0
- package/src/config/localization.ts +10 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Modal, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { themeType } from '../../interfaces/NiInputInterfaces';
|
|
5
|
+
import type { NIErrorResponse } from '../../interfaces/NiCardManagementInterfaces';
|
|
6
|
+
import { themeColors } from '../../config/themeColors';
|
|
7
|
+
import localLabels from '../../utils/localization';
|
|
8
|
+
|
|
9
|
+
interface FeedbackPopupProps {
|
|
10
|
+
error?: NIErrorResponse | null;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
isSuccess: boolean;
|
|
13
|
+
successMessage: string;
|
|
14
|
+
theme: themeType;
|
|
15
|
+
language: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function FeedbackPopup({
|
|
19
|
+
error,
|
|
20
|
+
isLoading,
|
|
21
|
+
isSuccess,
|
|
22
|
+
successMessage,
|
|
23
|
+
theme,
|
|
24
|
+
language,
|
|
25
|
+
}: FeedbackPopupProps): JSX.Element {
|
|
26
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
27
|
+
const labels = localLabels(language);
|
|
28
|
+
const isError = !!error;
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isLoading) {
|
|
32
|
+
setIsVisible(false);
|
|
33
|
+
} else if (error || isSuccess) {
|
|
34
|
+
setIsVisible(true);
|
|
35
|
+
}
|
|
36
|
+
}, [error, isLoading, isSuccess]);
|
|
37
|
+
|
|
38
|
+
const colors = themeColors[theme];
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Modal
|
|
42
|
+
animationType="fade"
|
|
43
|
+
onRequestClose={() => setIsVisible(false)}
|
|
44
|
+
transparent={true}
|
|
45
|
+
visible={isVisible}
|
|
46
|
+
>
|
|
47
|
+
<View style={styles.backdrop}>
|
|
48
|
+
<View
|
|
49
|
+
accessibilityRole="alert"
|
|
50
|
+
style={[styles.popup, { backgroundColor: colors.background }]}
|
|
51
|
+
>
|
|
52
|
+
<Text style={[styles.title, isError ? styles.error : styles.success]}>
|
|
53
|
+
{isError ? labels.errorTitle : labels.successTitle}
|
|
54
|
+
</Text>
|
|
55
|
+
<Text style={[styles.message, { color: colors.color }]}>
|
|
56
|
+
{error?.message || successMessage}
|
|
57
|
+
</Text>
|
|
58
|
+
<Pressable
|
|
59
|
+
accessibilityRole="button"
|
|
60
|
+
onPress={() => setIsVisible(false)}
|
|
61
|
+
style={styles.button}
|
|
62
|
+
>
|
|
63
|
+
<Text style={styles.buttonText}>{labels.ok}</Text>
|
|
64
|
+
</Pressable>
|
|
65
|
+
</View>
|
|
66
|
+
</View>
|
|
67
|
+
</Modal>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
backdrop: {
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
backgroundColor: 'rgba(0, 0, 0, 0.45)',
|
|
75
|
+
flex: 1,
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
padding: 24,
|
|
78
|
+
},
|
|
79
|
+
popup: {
|
|
80
|
+
borderRadius: 8,
|
|
81
|
+
maxWidth: 420,
|
|
82
|
+
padding: 24,
|
|
83
|
+
width: '100%',
|
|
84
|
+
},
|
|
85
|
+
title: {
|
|
86
|
+
fontSize: 20,
|
|
87
|
+
fontWeight: '600',
|
|
88
|
+
marginBottom: 12,
|
|
89
|
+
textAlign: 'center',
|
|
90
|
+
},
|
|
91
|
+
error: {
|
|
92
|
+
color: '#C62828',
|
|
93
|
+
},
|
|
94
|
+
success: {
|
|
95
|
+
color: '#2E7D32',
|
|
96
|
+
},
|
|
97
|
+
message: {
|
|
98
|
+
fontSize: 16,
|
|
99
|
+
lineHeight: 22,
|
|
100
|
+
marginBottom: 24,
|
|
101
|
+
textAlign: 'center',
|
|
102
|
+
},
|
|
103
|
+
button: {
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
alignSelf: 'center',
|
|
106
|
+
backgroundColor: '#202124',
|
|
107
|
+
borderRadius: 6,
|
|
108
|
+
minWidth: 96,
|
|
109
|
+
paddingHorizontal: 20,
|
|
110
|
+
paddingVertical: 12,
|
|
111
|
+
},
|
|
112
|
+
buttonText: {
|
|
113
|
+
color: 'white',
|
|
114
|
+
fontSize: 16,
|
|
115
|
+
fontWeight: '600',
|
|
116
|
+
},
|
|
117
|
+
});
|
|
@@ -12,6 +12,11 @@ const english = {
|
|
|
12
12
|
setPinButtonLabel: 'Set PIN',
|
|
13
13
|
changePinButtonLabel: 'Change PIN',
|
|
14
14
|
copiedToClipboard: 'Copied to clipboard',
|
|
15
|
+
successTitle: 'Success',
|
|
16
|
+
errorTitle: 'Error',
|
|
17
|
+
ok: 'OK',
|
|
18
|
+
cardDetailsSuccess: 'Card details retrieved successfully.',
|
|
19
|
+
viewPinSuccess: 'PIN retrieved successfully.',
|
|
15
20
|
viewPinCountdownLabel: (count: number) =>
|
|
16
21
|
'PIN will be hidden in ' + count + ' seconds',
|
|
17
22
|
show: 'Show',
|
|
@@ -33,6 +38,11 @@ const arabic = {
|
|
|
33
38
|
setPinButtonLabel: 'تعيين الرقم السري',
|
|
34
39
|
changePinButtonLabel: '\u200Eتغيير الرقم السري (PIN)',
|
|
35
40
|
copiedToClipboard: 'تم النسخ إلى الحافظة',
|
|
41
|
+
successTitle: 'تم بنجاح',
|
|
42
|
+
errorTitle: 'خطأ',
|
|
43
|
+
ok: 'حسنًا',
|
|
44
|
+
cardDetailsSuccess: 'تم استرداد تفاصيل البطاقة بنجاح.',
|
|
45
|
+
viewPinSuccess: 'تم استرداد الرقم السري بنجاح.',
|
|
36
46
|
viewPinCountdownLabel: (count: number) =>
|
|
37
47
|
'\u200Eثواني\u200E ' + count + '\u200E سيتم إخفاء الرقم السري للبطاقة خلال',
|
|
38
48
|
show: '\u200Eعرض',
|