react-native-fpay 0.2.9 → 0.3.2
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/lib/module/FountainPayProvider.js +5 -1
- package/lib/module/FountainPayProvider.js.map +1 -1
- package/lib/module/core/api/index.js +22 -12
- package/lib/module/core/api/index.js.map +1 -1
- package/lib/module/engine/BLEReceiverService.js.map +1 -1
- package/lib/module/engine/FPEngine.js +24 -13
- package/lib/module/engine/FPEngine.js.map +1 -1
- package/lib/module/engine/useIsForeground.js +17 -0
- package/lib/module/engine/useIsForeground.js.map +1 -0
- package/lib/module/ui/components/AnimatedDots.js +68 -0
- package/lib/module/ui/components/AnimatedDots.js.map +1 -0
- package/lib/module/ui/components/ConfirmScreen.js +333 -0
- package/lib/module/ui/components/ConfirmScreen.js.map +1 -0
- package/lib/module/ui/modals/FPPaymentRequestModal.js +6 -8
- package/lib/module/ui/modals/FPPaymentRequestModal.js.map +1 -1
- package/lib/module/ui/modals/FPShell.js +7 -4
- package/lib/module/ui/modals/FPShell.js.map +1 -1
- package/lib/module/ui/screens/ReceiveScreen.js +379 -274
- package/lib/module/ui/screens/ReceiveScreen.js.map +1 -1
- package/lib/module/ui/screens/SendScreen.js +154 -45
- package/lib/module/ui/screens/SendScreen.js.map +1 -1
- package/lib/module/ui/screens/styles.js +89 -0
- package/lib/module/ui/screens/styles.js.map +1 -0
- package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js +361 -0
- package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js.map +1 -0
- package/lib/module/ui/screens/sub/receivePayment/Qr/index.js +338 -0
- package/lib/module/ui/screens/sub/receivePayment/Qr/index.js.map +1 -0
- package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js +453 -0
- package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js.map +1 -0
- package/lib/module/ui/screens/sub/{BluetoothSubScreen.js → sendPayment/BluetoothSubScreen.js} +25 -32
- package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js +354 -0
- package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js +440 -0
- package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/{ProximitySubScreen.js → sendPayment/ProximitySubScreen.js} +20 -111
- package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js +327 -0
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js.map +1 -0
- package/lib/typescript/src/FountainPayProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/api/index.d.ts +20 -27
- package/lib/typescript/src/core/api/index.d.ts.map +1 -1
- package/lib/typescript/src/core/types/index.d.ts +56 -13
- package/lib/typescript/src/core/types/index.d.ts.map +1 -1
- package/lib/typescript/src/engine/BLEReceiverService.d.ts +2 -0
- package/lib/typescript/src/engine/BLEReceiverService.d.ts.map +1 -1
- package/lib/typescript/src/engine/FPEngine.d.ts +3 -1
- package/lib/typescript/src/engine/FPEngine.d.ts.map +1 -1
- package/lib/typescript/src/engine/useIsForeground.d.ts +2 -0
- package/lib/typescript/src/engine/useIsForeground.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/AnimatedDots.d.ts +2 -0
- package/lib/typescript/src/ui/components/AnimatedDots.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts +10 -0
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/OtpInput/Styles.d.ts +3 -3
- package/lib/typescript/src/ui/modals/FPPaymentRequestModal.d.ts.map +1 -1
- package/lib/typescript/src/ui/modals/FPShell.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts +2 -9
- package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/SendScreen.d.ts +4 -2
- package/lib/typescript/src/ui/screens/SendScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/styles.d.ts +1390 -0
- package/lib/typescript/src/ui/screens/styles.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts +10 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts +10 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts +5 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/{BluetoothSubScreen.d.ts → sendPayment/BluetoothSubScreen.d.ts} +2 -11
- package/lib/typescript/src/ui/screens/sub/sendPayment/BluetoothSubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts +3 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts +3 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/{ProximitySubScreen.d.ts → sendPayment/ProximitySubScreen.d.ts} +2 -10
- package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts +3 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/FountainPayProvider.tsx +7 -1
- package/src/core/api/index.ts +34 -19
- package/src/core/types/index.ts +67 -13
- package/src/engine/BLEReceiverService.ts +2 -0
- package/src/engine/FPEngine.ts +29 -14
- package/src/engine/useIsForeground.ts +18 -0
- package/src/ui/components/AnimatedDots.tsx +81 -0
- package/src/ui/components/ConfirmScreen.tsx +421 -0
- package/src/ui/modals/FPPaymentRequestModal.tsx +7 -6
- package/src/ui/modals/FPShell.tsx +9 -9
- package/src/ui/screens/ReceiveScreen.tsx +266 -115
- package/src/ui/screens/SendScreen.tsx +141 -19
- package/src/ui/screens/styles.ts +101 -0
- package/src/ui/screens/sub/receivePayment/Nfc/index.tsx +418 -0
- package/src/ui/screens/sub/receivePayment/Qr/index.tsx +391 -0
- package/src/ui/screens/sub/receivePayment/Transfer/index.tsx +512 -0
- package/src/ui/screens/sub/{BluetoothSubScreen.tsx → sendPayment/BluetoothSubScreen.tsx} +27 -46
- package/src/ui/screens/sub/sendPayment/NFCSubScreen.tsx +302 -0
- package/src/ui/screens/sub/sendPayment/NQRSubScreen.tsx +490 -0
- package/src/ui/screens/sub/{ProximitySubScreen.tsx → sendPayment/ProximitySubScreen.tsx} +24 -44
- package/src/ui/screens/sub/sendPayment/TransferSubScreen.tsx +345 -0
- package/lib/module/ui/screens/sub/BluetoothSubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/NFCSubScreen.js +0 -164
- package/lib/module/ui/screens/sub/NFCSubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/NQRSubScreen.js +0 -131
- package/lib/module/ui/screens/sub/NQRSubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/ProximitySubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/TransferSubScreen.js +0 -353
- package/lib/module/ui/screens/sub/TransferSubScreen.js.map +0 -1
- package/lib/typescript/src/ui/screens/sub/BluetoothSubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/NFCSubScreen.d.ts +0 -18
- package/lib/typescript/src/ui/screens/sub/NFCSubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/NQRSubScreen.d.ts +0 -12
- package/lib/typescript/src/ui/screens/sub/NQRSubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/ProximitySubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/TransferSubScreen.d.ts +0 -11
- package/lib/typescript/src/ui/screens/sub/TransferSubScreen.d.ts.map +0 -1
- package/src/ui/screens/sub/NFCSubScreen.tsx +0 -86
- package/src/ui/screens/sub/NQRSubScreen.tsx +0 -62
- package/src/ui/screens/sub/TransferSubScreen.tsx +0 -147
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
4
|
+
import { Animated, Easing, Vibration } from 'react-native';
|
|
5
|
+
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
6
|
+
import styled from 'styled-components/native';
|
|
7
|
+
import NfcManager, { Ndef, NfcTech } from 'react-native-nfc-manager';
|
|
8
|
+
import { PulseAnimation } from "../../../../components/PulseAnimation.js";
|
|
9
|
+
|
|
10
|
+
// Styled Components
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const Container = styled.View`
|
|
13
|
+
flex: 1;
|
|
14
|
+
background-color: #f5f5f5;
|
|
15
|
+
padding-bottom: 60%;
|
|
16
|
+
`;
|
|
17
|
+
const ScrollContainer = styled.ScrollView`
|
|
18
|
+
flex: 1;
|
|
19
|
+
`;
|
|
20
|
+
const Header = styled.View`
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 16px;
|
|
24
|
+
padding-top: 40px;
|
|
25
|
+
background-color: #ffffff;
|
|
26
|
+
border-bottom-width: 1px;
|
|
27
|
+
border-bottom-color: #e0e0e0;
|
|
28
|
+
`;
|
|
29
|
+
const BackButton = styled.TouchableOpacity`
|
|
30
|
+
padding: 8px;
|
|
31
|
+
`;
|
|
32
|
+
const BackIcon = styled.Text`
|
|
33
|
+
font-size: 24px;
|
|
34
|
+
color: #000000;
|
|
35
|
+
`;
|
|
36
|
+
const HeaderTitle = styled.Text`
|
|
37
|
+
flex: 1;
|
|
38
|
+
font-size: 18px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
color: #000000;
|
|
41
|
+
text-align: center;
|
|
42
|
+
margin-right: 40px;
|
|
43
|
+
`;
|
|
44
|
+
const ContentContainer = styled.View`
|
|
45
|
+
flex: 1;
|
|
46
|
+
padding: 24px;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
`;
|
|
50
|
+
const AmountCard = styled.View`
|
|
51
|
+
background-color: #ffffff;
|
|
52
|
+
border-radius: 16px;
|
|
53
|
+
padding: 24px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
align-items: center;
|
|
56
|
+
margin-bottom: 40px;
|
|
57
|
+
shadow-color: #000;
|
|
58
|
+
shadow-offset: 0px 2px;
|
|
59
|
+
shadow-opacity: 0.05;
|
|
60
|
+
shadow-radius: 8px;
|
|
61
|
+
elevation: 3;
|
|
62
|
+
`;
|
|
63
|
+
const AmountLabel = styled.Text`
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
color: #666666;
|
|
66
|
+
margin-bottom: 8px;
|
|
67
|
+
`;
|
|
68
|
+
const AmountText = styled.Text`
|
|
69
|
+
font-size: 42px;
|
|
70
|
+
font-weight: 700;
|
|
71
|
+
color: #0a3d2e;
|
|
72
|
+
`;
|
|
73
|
+
const NFCAnimationContainer = styled.View`
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
margin-bottom: 40px;
|
|
77
|
+
`;
|
|
78
|
+
const NFCIconContainer = styled(Animated.View)`
|
|
79
|
+
width: 140px;
|
|
80
|
+
height: 140px;
|
|
81
|
+
border-radius: 90px;
|
|
82
|
+
background-color: #E8F5F1;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
margin-bottom: 24px;
|
|
86
|
+
`;
|
|
87
|
+
const NFCIcon = styled.Text`
|
|
88
|
+
font-size: 80px;
|
|
89
|
+
`;
|
|
90
|
+
const PulseRing = styled(Animated.View)`
|
|
91
|
+
position: absolute;
|
|
92
|
+
width: 200px;
|
|
93
|
+
height: 200px;
|
|
94
|
+
border-radius: 100%;
|
|
95
|
+
border-width: 2px;
|
|
96
|
+
border-color: #0a3d2e;
|
|
97
|
+
`;
|
|
98
|
+
const StatusTextContainer = styled.View`
|
|
99
|
+
align-items: center;
|
|
100
|
+
margin-bottom: 8px;
|
|
101
|
+
`;
|
|
102
|
+
const StatusText = styled.Text`
|
|
103
|
+
font-size: 18px;
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
color: #333333;
|
|
106
|
+
text-align: center;
|
|
107
|
+
margin-bottom: 8px;
|
|
108
|
+
`;
|
|
109
|
+
const StatusSubText = styled.Text`
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
color: #666666;
|
|
112
|
+
text-align: center;
|
|
113
|
+
`;
|
|
114
|
+
const InstructionCard = styled.View`
|
|
115
|
+
background-color: #ffffff;
|
|
116
|
+
border-radius: 16px;
|
|
117
|
+
padding: 20px;
|
|
118
|
+
width: 100%;
|
|
119
|
+
margin-bottom: 24px;
|
|
120
|
+
shadow-color: #000;
|
|
121
|
+
shadow-offset: 0px 2px;
|
|
122
|
+
shadow-opacity: 0.05;
|
|
123
|
+
shadow-radius: 8px;
|
|
124
|
+
elevation: 3;
|
|
125
|
+
`;
|
|
126
|
+
const InstructionTitle = styled.Text`
|
|
127
|
+
font-size: 15px;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
color: #333333;
|
|
130
|
+
margin-bottom: 12px;
|
|
131
|
+
`;
|
|
132
|
+
const InstructionItem = styled.View`
|
|
133
|
+
flex-direction: row;
|
|
134
|
+
align-items: flex-start;
|
|
135
|
+
margin-bottom: 10px;
|
|
136
|
+
`;
|
|
137
|
+
const InstructionNumber = styled.View`
|
|
138
|
+
width: 24px;
|
|
139
|
+
height: 24px;
|
|
140
|
+
border-radius: 12px;
|
|
141
|
+
background-color: #0a3d2e;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
margin-right: 12px;
|
|
145
|
+
`;
|
|
146
|
+
const InstructionNumberText = styled.Text`
|
|
147
|
+
font-size: 12px;
|
|
148
|
+
font-weight: 600;
|
|
149
|
+
color: #ffffff;
|
|
150
|
+
`;
|
|
151
|
+
const InstructionText = styled.Text`
|
|
152
|
+
flex: 1;
|
|
153
|
+
font-size: 14px;
|
|
154
|
+
color: #666666;
|
|
155
|
+
line-height: 20px;
|
|
156
|
+
`;
|
|
157
|
+
const InfoBanner = styled.View`
|
|
158
|
+
background-color: #FFF3E0;
|
|
159
|
+
border-radius: 12px;
|
|
160
|
+
padding: 16px;
|
|
161
|
+
width: 100%;
|
|
162
|
+
margin-bottom: 24px;
|
|
163
|
+
flex-direction: row;
|
|
164
|
+
align-items: center;
|
|
165
|
+
`;
|
|
166
|
+
const InfoIcon = styled.Text`
|
|
167
|
+
font-size: 20px;
|
|
168
|
+
margin-right: 12px;
|
|
169
|
+
`;
|
|
170
|
+
const InfoText = styled.Text`
|
|
171
|
+
flex: 1;
|
|
172
|
+
font-size: 13px;
|
|
173
|
+
color: #F57C00;
|
|
174
|
+
line-height: 18px;
|
|
175
|
+
`;
|
|
176
|
+
const CancelButton = styled.TouchableOpacity`
|
|
177
|
+
background-color: #ffffff;
|
|
178
|
+
border: 1.5px solid #E0E0E0;
|
|
179
|
+
border-radius: 28px;
|
|
180
|
+
padding: 16px;
|
|
181
|
+
align-items: center;
|
|
182
|
+
width: 100%;
|
|
183
|
+
`;
|
|
184
|
+
const CancelButtonText = styled.Text`
|
|
185
|
+
font-size: 15px;
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
color: #666666;
|
|
188
|
+
`;
|
|
189
|
+
const ConnectionStatusBadge = styled.View`
|
|
190
|
+
background-color: ${props => props.connected ? '#0a3d2e' : '#E0E0E0'};
|
|
191
|
+
border-radius: 20px;
|
|
192
|
+
padding: 8px 16px;
|
|
193
|
+
margin-top: 16px;
|
|
194
|
+
`;
|
|
195
|
+
const ConnectionStatusText = styled.Text`
|
|
196
|
+
font-size: 12px;
|
|
197
|
+
font-weight: 600;
|
|
198
|
+
color: ${props => props.connected ? '#ffffff' : '#666666'};
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
// Main Component
|
|
202
|
+
|
|
203
|
+
const Nfc = ({
|
|
204
|
+
amount = 5000,
|
|
205
|
+
description,
|
|
206
|
+
onClose,
|
|
207
|
+
onPaymentReceived
|
|
208
|
+
}) => {
|
|
209
|
+
const [nfcEnabled, setNfcEnabled] = useState(true);
|
|
210
|
+
const [isConnecting, setIsConnecting] = useState(false);
|
|
211
|
+
const iconScale = useRef(new Animated.Value(1)).current;
|
|
212
|
+
const writeNFC = async (userId, userName) => {
|
|
213
|
+
await NfcManager.requestTechnology(NfcTech.Ndef);
|
|
214
|
+
const bytes = Ndef.encodeMessage([Ndef.textRecord(JSON.stringify({
|
|
215
|
+
userId,
|
|
216
|
+
userName
|
|
217
|
+
}))]);
|
|
218
|
+
await NfcManager.ndefHandler.writeNdefMessage(bytes);
|
|
219
|
+
await NfcManager.cancelTechnologyRequest();
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// Sender reads NFC tag
|
|
223
|
+
const readNFC = async () => {
|
|
224
|
+
await NfcManager.requestTechnology(NfcTech.Ndef);
|
|
225
|
+
const tag = await NfcManager.getTag();
|
|
226
|
+
const paymentInfo = JSON.parse(tag?.ndefMessage[0].payload);
|
|
227
|
+
await NfcManager.cancelTechnologyRequest();
|
|
228
|
+
return paymentInfo;
|
|
229
|
+
};
|
|
230
|
+
const checkNFCAvailability = () => {
|
|
231
|
+
// In production, check actual NFC status
|
|
232
|
+
// For now, simulate it's available
|
|
233
|
+
NfcManager.start().then(() => setNfcEnabled(true)).catch(err => console.log('NFC start error:', err));
|
|
234
|
+
return () => {
|
|
235
|
+
NfcManager.cancelTechnologyRequest().catch(() => {});
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
const formatAmount = value => {
|
|
239
|
+
return value.toLocaleString('en-NG', {
|
|
240
|
+
minimumFractionDigits: 2,
|
|
241
|
+
maximumFractionDigits: 2
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
const handleNFCDetection = () => {
|
|
245
|
+
// Simulate NFC detection
|
|
246
|
+
setIsConnecting(true);
|
|
247
|
+
Vibration.vibrate(100);
|
|
248
|
+
|
|
249
|
+
// In production, handle actual NFC tag detection
|
|
250
|
+
setTimeout(() => {
|
|
251
|
+
setIsConnecting(false);
|
|
252
|
+
// Call onPaymentReceived callback
|
|
253
|
+
}, 2000);
|
|
254
|
+
};
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
// Simulate NFC availability check
|
|
257
|
+
// In production, use actual NFC library to check availability
|
|
258
|
+
checkNFCAvailability();
|
|
259
|
+
|
|
260
|
+
// Icon breathing animation
|
|
261
|
+
Animated.loop(Animated.sequence([Animated.timing(iconScale, {
|
|
262
|
+
toValue: 1.1,
|
|
263
|
+
duration: 1500,
|
|
264
|
+
easing: Easing.inOut(Easing.ease),
|
|
265
|
+
useNativeDriver: true
|
|
266
|
+
}), Animated.timing(iconScale, {
|
|
267
|
+
toValue: 1,
|
|
268
|
+
duration: 1500,
|
|
269
|
+
easing: Easing.inOut(Easing.ease),
|
|
270
|
+
useNativeDriver: true
|
|
271
|
+
})])).start();
|
|
272
|
+
}, []);
|
|
273
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
274
|
+
children: [/*#__PURE__*/_jsxs(Header, {
|
|
275
|
+
children: [/*#__PURE__*/_jsx(BackButton, {
|
|
276
|
+
onPress: onClose,
|
|
277
|
+
children: /*#__PURE__*/_jsx(Ionicons, {
|
|
278
|
+
name: "close",
|
|
279
|
+
size: 24
|
|
280
|
+
})
|
|
281
|
+
}), /*#__PURE__*/_jsx(HeaderTitle, {
|
|
282
|
+
children: "Receive via NFC"
|
|
283
|
+
})]
|
|
284
|
+
}), /*#__PURE__*/_jsx(ScrollContainer, {
|
|
285
|
+
showsVerticalScrollIndicator: false,
|
|
286
|
+
children: /*#__PURE__*/_jsxs(ContentContainer, {
|
|
287
|
+
children: [/*#__PURE__*/_jsxs(AmountCard, {
|
|
288
|
+
children: [/*#__PURE__*/_jsx(AmountLabel, {
|
|
289
|
+
children: "Amount to Receive"
|
|
290
|
+
}), /*#__PURE__*/_jsxs(AmountText, {
|
|
291
|
+
children: ["\u20A6", formatAmount(amount)]
|
|
292
|
+
})]
|
|
293
|
+
}), /*#__PURE__*/_jsxs(NFCAnimationContainer, {
|
|
294
|
+
children: [/*#__PURE__*/_jsx(PulseAnimation, {}), /*#__PURE__*/_jsx(NFCIconContainer, {
|
|
295
|
+
style: {
|
|
296
|
+
transform: [{
|
|
297
|
+
scale: iconScale
|
|
298
|
+
}]
|
|
299
|
+
},
|
|
300
|
+
children: /*#__PURE__*/_jsx(NFCIcon, {
|
|
301
|
+
children: "\uD83D\uDCE1"
|
|
302
|
+
})
|
|
303
|
+
}), /*#__PURE__*/_jsxs(StatusTextContainer, {
|
|
304
|
+
children: [/*#__PURE__*/_jsx(StatusText, {
|
|
305
|
+
children: isConnecting ? 'Connecting...' : 'Ready to Receive'
|
|
306
|
+
}), /*#__PURE__*/_jsx(StatusSubText, {
|
|
307
|
+
children: "Hold devices back-to-back"
|
|
308
|
+
})]
|
|
309
|
+
}), /*#__PURE__*/_jsx(ConnectionStatusBadge, {
|
|
310
|
+
connected: nfcEnabled,
|
|
311
|
+
children: /*#__PURE__*/_jsx(ConnectionStatusText, {
|
|
312
|
+
connected: nfcEnabled,
|
|
313
|
+
children: nfcEnabled ? 'NFC Enabled' : 'NFC Disabled'
|
|
314
|
+
})
|
|
315
|
+
})]
|
|
316
|
+
}), /*#__PURE__*/_jsxs(InstructionCard, {
|
|
317
|
+
children: [/*#__PURE__*/_jsx(InstructionTitle, {
|
|
318
|
+
children: "How to receive payment"
|
|
319
|
+
}), /*#__PURE__*/_jsxs(InstructionItem, {
|
|
320
|
+
children: [/*#__PURE__*/_jsx(InstructionNumber, {
|
|
321
|
+
children: /*#__PURE__*/_jsx(InstructionNumberText, {
|
|
322
|
+
children: "1"
|
|
323
|
+
})
|
|
324
|
+
}), /*#__PURE__*/_jsx(InstructionText, {
|
|
325
|
+
children: "Ask the payer to open their payment app and select \"Pay via NFC\""
|
|
326
|
+
})]
|
|
327
|
+
}), /*#__PURE__*/_jsxs(InstructionItem, {
|
|
328
|
+
children: [/*#__PURE__*/_jsx(InstructionNumber, {
|
|
329
|
+
children: /*#__PURE__*/_jsx(InstructionNumberText, {
|
|
330
|
+
children: "2"
|
|
331
|
+
})
|
|
332
|
+
}), /*#__PURE__*/_jsx(InstructionText, {
|
|
333
|
+
children: "Hold the back of both phones together"
|
|
334
|
+
})]
|
|
335
|
+
}), /*#__PURE__*/_jsxs(InstructionItem, {
|
|
336
|
+
children: [/*#__PURE__*/_jsx(InstructionNumber, {
|
|
337
|
+
children: /*#__PURE__*/_jsx(InstructionNumberText, {
|
|
338
|
+
children: "3"
|
|
339
|
+
})
|
|
340
|
+
}), /*#__PURE__*/_jsx(InstructionText, {
|
|
341
|
+
children: "Keep devices steady until you feel a vibration"
|
|
342
|
+
})]
|
|
343
|
+
})]
|
|
344
|
+
}), !nfcEnabled && /*#__PURE__*/_jsxs(InfoBanner, {
|
|
345
|
+
children: [/*#__PURE__*/_jsx(InfoIcon, {
|
|
346
|
+
children: "\u26A0\uFE0F"
|
|
347
|
+
}), /*#__PURE__*/_jsx(InfoText, {
|
|
348
|
+
children: "NFC is disabled on your device. Please enable it in your phone settings to receive payments."
|
|
349
|
+
})]
|
|
350
|
+
}), /*#__PURE__*/_jsx(CancelButton, {
|
|
351
|
+
onPress: onClose,
|
|
352
|
+
children: /*#__PURE__*/_jsx(CancelButtonText, {
|
|
353
|
+
children: "Cancel"
|
|
354
|
+
})
|
|
355
|
+
})]
|
|
356
|
+
})
|
|
357
|
+
})]
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
export default Nfc;
|
|
361
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useState","useEffect","useRef","Animated","Easing","Vibration","Ionicons","styled","NfcManager","Ndef","NfcTech","PulseAnimation","jsx","_jsx","jsxs","_jsxs","Container","View","ScrollContainer","ScrollView","Header","BackButton","TouchableOpacity","BackIcon","Text","HeaderTitle","ContentContainer","AmountCard","AmountLabel","AmountText","NFCAnimationContainer","NFCIconContainer","NFCIcon","PulseRing","StatusTextContainer","StatusText","StatusSubText","InstructionCard","InstructionTitle","InstructionItem","InstructionNumber","InstructionNumberText","InstructionText","InfoBanner","InfoIcon","InfoText","CancelButton","CancelButtonText","ConnectionStatusBadge","props","connected","ConnectionStatusText","Nfc","amount","description","onClose","onPaymentReceived","nfcEnabled","setNfcEnabled","isConnecting","setIsConnecting","iconScale","Value","current","writeNFC","userId","userName","requestTechnology","bytes","encodeMessage","textRecord","JSON","stringify","ndefHandler","writeNdefMessage","cancelTechnologyRequest","readNFC","tag","getTag","paymentInfo","parse","ndefMessage","payload","checkNFCAvailability","start","then","catch","err","console","log","formatAmount","value","toLocaleString","minimumFractionDigits","maximumFractionDigits","handleNFCDetection","vibrate","setTimeout","loop","sequence","timing","toValue","duration","easing","inOut","ease","useNativeDriver","children","onPress","name","size","showsVerticalScrollIndicator","style","transform","scale"],"sourceRoot":"../../../../../../../src","sources":["ui/screens/sub/receivePayment/Nfc/index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAQ,cAAc;AAC1D,OAAOC,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,MAAM,MAAM,0BAA0B;AAC7C,OAAOC,UAAU,IAAIC,IAAI,EAAEC,OAAO,QAAQ,0BAA0B;AACpE,SAASC,cAAc,QAAQ,0CAAuC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