react-native-timacare 3.1.49 → 3.1.51

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.
Files changed (79) hide show
  1. package/lib/commonjs/screens/liveness-v2/index.js +1 -1
  2. package/lib/commonjs/screens/liveness-v2/index.js.flow +7 -14
  3. package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
  4. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js +1 -1
  5. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.flow +3 -11
  6. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  7. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  8. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.flow +6 -18
  9. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  10. package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
  11. package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.flow +3 -10
  12. package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
  13. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js +1 -1
  14. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js.flow +3 -10
  15. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js.map +1 -1
  16. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js +1 -1
  17. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.flow +3 -10
  18. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
  19. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js +1 -1
  20. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.flow +3 -4
  21. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
  22. package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
  23. package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.flow +5 -19
  24. package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
  25. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js +1 -1
  26. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.flow +5 -6
  27. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
  28. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
  29. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.flow +3 -10
  30. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
  31. package/lib/commonjs/utils/index.js +1 -1
  32. package/lib/commonjs/utils/index.js.flow +20 -0
  33. package/lib/commonjs/utils/index.js.map +1 -1
  34. package/lib/module/screens/liveness-v2/index.js +1 -1
  35. package/lib/module/screens/liveness-v2/index.js.map +1 -1
  36. package/lib/module/screens/toan-trinh-so/ReviewInformation.js +1 -1
  37. package/lib/module/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  38. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  39. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  40. package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
  41. package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
  42. package/lib/module/screens/toan-trinh-so/TTSOTP.js +1 -1
  43. package/lib/module/screens/toan-trinh-so/TTSOTP.js.map +1 -1
  44. package/lib/module/screens/toan-trinh-so/TTSSelfie.js +1 -1
  45. package/lib/module/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
  46. package/lib/module/screens/toan-trinh-so/TTSSignLoan.js +1 -1
  47. package/lib/module/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
  48. package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
  49. package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
  50. package/lib/module/screens/toan-trinh-so/VehicleRegistration.js +1 -1
  51. package/lib/module/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
  52. package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
  53. package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
  54. package/lib/module/utils/index.js +1 -1
  55. package/lib/module/utils/index.js.map +1 -1
  56. package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
  57. package/lib/typescript/screens/toan-trinh-so/ReviewInformation.d.ts.map +1 -1
  58. package/lib/typescript/screens/toan-trinh-so/ReviewInformationOther.d.ts.map +1 -1
  59. package/lib/typescript/screens/toan-trinh-so/TTSNationalIDFront.d.ts.map +1 -1
  60. package/lib/typescript/screens/toan-trinh-so/TTSOTP.d.ts.map +1 -1
  61. package/lib/typescript/screens/toan-trinh-so/TTSSelfie.d.ts.map +1 -1
  62. package/lib/typescript/screens/toan-trinh-so/TTSSignLoan.d.ts.map +1 -1
  63. package/lib/typescript/screens/toan-trinh-so/TopupLoanInfo.d.ts.map +1 -1
  64. package/lib/typescript/screens/toan-trinh-so/VehicleRegistration.d.ts.map +1 -1
  65. package/lib/typescript/screens/toan-trinh-so/VehicleRegistrationFront.d.ts.map +1 -1
  66. package/lib/typescript/utils/index.d.ts +2 -0
  67. package/lib/typescript/utils/index.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/src/screens/liveness-v2/index.tsx +7 -14
  70. package/src/screens/toan-trinh-so/ReviewInformation.tsx +3 -11
  71. package/src/screens/toan-trinh-so/ReviewInformationOther.tsx +6 -18
  72. package/src/screens/toan-trinh-so/TTSNationalIDFront.tsx +3 -10
  73. package/src/screens/toan-trinh-so/TTSOTP.tsx +3 -10
  74. package/src/screens/toan-trinh-so/TTSSelfie.tsx +3 -10
  75. package/src/screens/toan-trinh-so/TTSSignLoan.tsx +3 -4
  76. package/src/screens/toan-trinh-so/TopupLoanInfo.tsx +5 -19
  77. package/src/screens/toan-trinh-so/VehicleRegistration.tsx +5 -6
  78. package/src/screens/toan-trinh-so/VehicleRegistrationFront.tsx +3 -10
  79. package/src/utils/index.tsx +20 -0
@@ -1 +1 @@
1
- {"version":3,"file":"TTSSelfie.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/TTSSelfie.tsx"],"names":[],"mappings":"AAiCA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,GAAG,eA6R3C"}
1
+ {"version":3,"file":"TTSSelfie.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/TTSSelfie.tsx"],"names":[],"mappings":"AAgCA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,GAAG,eAuR3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"TTSSignLoan.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/TTSSignLoan.tsx"],"names":[],"mappings":"AAqBA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,KAAA,eA+SxC"}
1
+ {"version":3,"file":"TTSSignLoan.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/TTSSignLoan.tsx"],"names":[],"mappings":"AAoBA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,KAAA,eA+SxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TopupLoanInfo.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/TopupLoanInfo.tsx"],"names":[],"mappings":"AAkCA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,KAAA,eA8wB1C"}
1
+ {"version":3,"file":"TopupLoanInfo.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/TopupLoanInfo.tsx"],"names":[],"mappings":"AAgCA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,KAAA,eAkwB1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"VehicleRegistration.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/VehicleRegistration.tsx"],"names":[],"mappings":"AAqCA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,KAAA,eA0LhD"}
1
+ {"version":3,"file":"VehicleRegistration.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/VehicleRegistration.tsx"],"names":[],"mappings":"AAoCA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,KAAA,eA0LhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"VehicleRegistrationFront.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/VehicleRegistrationFront.tsx"],"names":[],"mappings":"AAsCA,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAK,EAAE,GAAG,eAwN1D"}
1
+ {"version":3,"file":"VehicleRegistrationFront.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/VehicleRegistrationFront.tsx"],"names":[],"mappings":"AAqCA,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAK,EAAE,GAAG,eAkN1D"}
@@ -31,4 +31,6 @@ export declare const EnumRelationshipOption2: {
31
31
  id: number;
32
32
  name: string;
33
33
  }[];
34
+ export declare const logEventFb: (action: string) => void;
35
+ export declare const logEvent: (eventName: string, params?: object) => Promise<void>;
34
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,iBAiBvB,CAAC;AAEF,eAAO,MAAM,QAAQ,oBAOpB,CAAC;AAEF,eAAO,MAAM,YAAY,mBAoBxB,CAAC;AAEF,eAAO,MAAM,aAAa,oBAKzB,CAAC;AAEF,eAAO,MAAM,UAAU;;;GAStB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;GAS7B,CAAC;AAEF,eAAO,MAAM,WAAW;;;GAKvB,CAAC;AAEF,eAAO,MAAM,QAAQ,wCAOpB,CAAC;AAEF,eAAO,MAAM,WAAW;;;GASvB,CAAC;AAEF,eAAO,MAAM,aAAa;;;GASzB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;GAyBnC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;GAsBnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,iBAiBvB,CAAC;AAEF,eAAO,MAAM,QAAQ,oBAOpB,CAAC;AAEF,eAAO,MAAM,YAAY,mBAoBxB,CAAC;AAEF,eAAO,MAAM,aAAa,oBAKzB,CAAC;AAEF,eAAO,MAAM,UAAU;;;GAStB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;GAS7B,CAAC;AAEF,eAAO,MAAM,WAAW;;;GAKvB,CAAC;AAEF,eAAO,MAAM,QAAQ,wCAOpB,CAAC;AAEF,eAAO,MAAM,WAAW;;;GASvB,CAAC;AAEF,eAAO,MAAM,aAAa;;;GASzB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;GAyBnC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;GAsBnC,CAAC;AAEF,eAAO,MAAM,UAAU,WAAY,MAAM,SAOxC,CAAC;AAEF,eAAO,MAAM,QAAQ,cAAqB,MAAM,WAAW,MAAM,kBAOhE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-timacare",
3
- "version": "3.1.49",
3
+ "version": "3.1.51",
4
4
  "description": "SDK Tima Care",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -30,9 +30,8 @@ import { commonStyles } from '../CommonStyles';
30
30
  import { ScreenNames } from '../../navigation';
31
31
  import { color } from '../../theme';
32
32
  import { createThumbnail } from 'react-native-create-thumbnail';
33
- import analytics from '@react-native-firebase/analytics';
34
- import { AppEventsLogger } from 'react-native-fbsdk-next';
35
33
  import appStore from '../../AppStore';
34
+ import { logEvent, logEventFb } from '../../utils';
36
35
 
37
36
  const { width: windowWidth } = Dimensions.get('window');
38
37
 
@@ -268,7 +267,7 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
268
267
  const uploadLiveness = async (template: any) => {
269
268
  setIsLoading(true);
270
269
  try {
271
- if (loan?.typeLoan === 5) {
270
+ if (loan?.typeLoan === 5 || loan?.typeLoan === 6) {
272
271
  await livenessStore.verifyLiveness2(
273
272
  loan?.id,
274
273
  template,
@@ -392,14 +391,14 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
392
391
  };
393
392
 
394
393
  useEffect(async () => {
395
- await analytics().logEvent('ekyc_started', {
394
+ await logEvent('ekyc_started', {
396
395
  event: 'ekyc_started',
397
396
  createdAt: new Date(),
398
397
  deviceId: appStore.deviceId,
399
398
  loanId: loan?.id,
400
399
  utmSource: loan?.utmSource,
401
400
  });
402
- await AppEventsLogger().logEvent('ekyc_started', {
401
+ logEventFb('ekyc_started', {
403
402
  event: 'ekyc_started',
404
403
  createdAt: new Date(),
405
404
  deviceId: appStore.deviceId,
@@ -586,22 +585,16 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
586
585
  justifyContent: 'center',
587
586
  }}
588
587
  onPress={async () => {
589
- await analytics().logEvent('ekyc_completed', {
590
- event: 'ekyc_completed',
591
- createdAt: new Date(),
592
- deviceId: appStore.deviceId,
593
- loanId: loan?.id,
594
- utmSource: loan?.utmSource,
595
- });
596
- await AppEventsLogger().logEvent('ekyc_completed', {
588
+ await logEvent('ekyc_completed', {
597
589
  event: 'ekyc_completed',
598
590
  createdAt: new Date(),
599
591
  deviceId: appStore.deviceId,
600
592
  loanId: loan?.id,
601
593
  utmSource: loan?.utmSource,
602
594
  });
595
+ logEventFb('ekyc_completed');
603
596
  livenessStore.ekycSuccess = false;
604
- if (loan?.typeLoan === 5) {
597
+ if (loan?.typeLoan === 5 || loan?.typeLoan === 6) {
605
598
  navigation.dispatch(
606
599
  CommonActions.reset({
607
600
  index: 1,
@@ -22,14 +22,12 @@ import LinearGradient from 'react-native-linear-gradient';
22
22
  import MButton from '../../components/MButton';
23
23
  import KeyboardSpacer from '../../components/keyboardspace';
24
24
  import * as yup from 'yup';
25
- import { EnumGender, formatDDMMYYY } from '../../utils';
25
+ import { EnumGender, formatDDMMYYY, logEvent, logEventFb } from '../../utils';
26
26
  import ttsStore from './store';
27
27
  import DatePicker from 'react-native-date-picker';
28
28
  import { Api } from '../../services/api';
29
29
  import Loading from '../../components/Loading';
30
30
  import moment from 'moment';
31
- import analytics from '@react-native-firebase/analytics';
32
- import { AppEventsLogger } from 'react-native-fbsdk-next';
33
31
  import appStore from '../../AppStore';
34
32
 
35
33
  export default function ReviewInformation(props) {
@@ -249,20 +247,14 @@ export default function ReviewInformation(props) {
249
247
  getData();
250
248
  ttsStore.getListBank();
251
249
  ttsStore.getRelationship();
252
- await analytics().logEvent('thongtinvay_started', {
253
- event: 'thongtinvay_started',
254
- createdAt: new Date(),
255
- deviceId: appStore.deviceId,
256
- loanId: props.route?.params?.loan?.id,
257
- utmSource: props.route?.params?.loan?.utmSource,
258
- });
259
- await AppEventsLogger().logEvent('thongtinvay_started', {
250
+ await logEvent('thongtinvay_started', {
260
251
  event: 'thongtinvay_started',
261
252
  createdAt: new Date(),
262
253
  deviceId: appStore.deviceId,
263
254
  loanId: props.route?.params?.loan?.id,
264
255
  utmSource: props.route?.params?.loan?.utmSource,
265
256
  });
257
+ logEventFb('thongtinvay_started');
266
258
  }, []);
267
259
 
268
260
  return (
@@ -26,12 +26,12 @@ import {
26
26
  EnumRelationshipOption1,
27
27
  EnumRelationshipOption2,
28
28
  formatMoney,
29
+ logEvent,
30
+ logEventFb,
29
31
  } from '../../utils';
30
32
  import { Api } from '../../services/api';
31
33
  import Loading from '../../components/Loading';
32
34
  import * as yup from 'yup';
33
- import analytics from '@react-native-firebase/analytics';
34
- import { AppEventsLogger } from 'react-native-fbsdk-next';
35
35
  import appStore from '../../AppStore';
36
36
 
37
37
  export default function ReviewInformationOther(props) {
@@ -192,34 +192,22 @@ export default function ReviewInformationOther(props) {
192
192
  setIsLoading(false);
193
193
  if (response.kind === 'ok') {
194
194
  if (response.data?.meta?.errorCode === 200) {
195
- await analytics().logEvent('lead', {
195
+ await logEvent('lead', {
196
196
  event: 'lead',
197
197
  createdAt: new Date(),
198
198
  deviceId: appStore.deviceId,
199
199
  loanId: props.route?.params?.loan?.id,
200
200
  utmSource: props.route?.params?.loan?.utmSource,
201
201
  });
202
- await AppEventsLogger().logEvent('lead', {
203
- event: 'lead',
204
- createdAt: new Date(),
205
- deviceId: appStore.deviceId,
206
- loanId: props.route?.params?.loan?.id,
207
- utmSource: props.route?.params?.loan?.utmSource,
208
- });
209
- await analytics().logEvent('thongtinvay_completed', {
210
- event: 'thongtinvay_completed',
211
- createdAt: new Date(),
212
- deviceId: appStore.deviceId,
213
- loanId: props.route?.params?.loan?.id,
214
- utmSource: props.route?.params?.loan?.utmSource,
215
- });
216
- await AppEventsLogger().logEvent('thongtinvay_completed', {
202
+ logEventFb('lead');
203
+ await logEvent('thongtinvay_completed', {
217
204
  event: 'thongtinvay_completed',
218
205
  createdAt: new Date(),
219
206
  deviceId: appStore.deviceId,
220
207
  loanId: props.route?.params?.loan?.id,
221
208
  utmSource: props.route?.params?.loan?.utmSource,
222
209
  });
210
+ logEventFb('thongtinvay_completed');
223
211
  Alert.alert('Thông báo', 'Cập nhật thông tin thành công', [
224
212
  {
225
213
  text: 'Đồng ý',
@@ -28,9 +28,8 @@ import LinearGradient from 'react-native-linear-gradient';
28
28
  import { ScreenNames } from '../../navigation';
29
29
  import { Api } from '../../services/api';
30
30
  import Loading from '../../components/Loading';
31
- import analytics from '@react-native-firebase/analytics';
32
- import { AppEventsLogger } from 'react-native-fbsdk-next';
33
31
  import appStore from '../../AppStore';
32
+ import { logEvent, logEventFb } from '../../utils';
34
33
 
35
34
  const logoView: ImageStyle = {
36
35
  position: 'absolute',
@@ -52,20 +51,14 @@ export const TTSNationalIDFront = observer(function TTSNationalIDFront(props) {
52
51
  if (props?.route?.params?.uri) {
53
52
  setPhoto(props?.route?.params?.uri);
54
53
  }
55
- await analytics().logEvent('cccd_started', {
56
- event: 'cccd_started',
57
- createdAt: new Date(),
58
- deviceId: appStore.deviceId,
59
- loanId: props.route?.params?.loan?.id,
60
- utmSource: props.route?.params?.loan?.utmSource,
61
- });
62
- await AppEventsLogger().logEvent('cccd_started', {
54
+ await logEvent('cccd_started', {
63
55
  event: 'cccd_started',
64
56
  createdAt: new Date(),
65
57
  deviceId: appStore.deviceId,
66
58
  loanId: props.route?.params?.loan?.id,
67
59
  utmSource: props.route?.params?.loan?.utmSource,
68
60
  });
61
+ logEventFb('cccd_started');
69
62
  }, []);
70
63
 
71
64
  const takePhoto = () => {
@@ -23,9 +23,8 @@ import { Api } from '../../services/api';
23
23
  import Loading from '../../components/Loading';
24
24
  import { ScreenNames } from '../../navigation';
25
25
  import { CommonActions, useNavigation } from '@react-navigation/native';
26
- import analytics from '@react-native-firebase/analytics';
27
- import { AppEventsLogger } from 'react-native-fbsdk-next';
28
26
  import appStore from '../../AppStore';
27
+ import { logEvent, logEventFb } from '../../utils';
29
28
 
30
29
  const logoView: ImageStyle = {
31
30
  position: 'absolute',
@@ -119,20 +118,14 @@ export default function TTSOTP({ route }: any) {
119
118
  Api.getInstance().verifySign({
120
119
  loanBriefId: loan?.id,
121
120
  });
122
- await analytics().logEvent('kyhopdong_completed', {
123
- event: 'kyhopdong_completed',
124
- createdAt: new Date(),
125
- deviceId: appStore.deviceId,
126
- loanId: loan?.id,
127
- utmSource: loan?.utmSource,
128
- });
129
- await AppEventsLogger().logEvent('kyhopdong_completed', {
121
+ await logEvent('kyhopdong_completed', {
130
122
  event: 'kyhopdong_completed',
131
123
  createdAt: new Date(),
132
124
  deviceId: appStore.deviceId,
133
125
  loanId: loan?.id,
134
126
  utmSource: loan?.utmSource,
135
127
  });
128
+ logEventFb('kyhopdong_completed');
136
129
  Alert.alert('Thông báo', 'Ký hợp đồng thành công', [
137
130
  {
138
131
  text: 'Đồng ý',
@@ -27,9 +27,8 @@ import Loading from '../../components/Loading';
27
27
  import { Api } from '../../services/api';
28
28
  import { ScreenNames } from '../../navigation';
29
29
  import DeviceInfo from 'react-native-device-info';
30
- import analytics from '@react-native-firebase/analytics';
31
- import { AppEventsLogger } from 'react-native-fbsdk-next';
32
30
  import appStore from '../../AppStore';
31
+ import { logEvent, logEventFb } from '../../utils';
33
32
 
34
33
  export default function TTSSelfie(props: any) {
35
34
  const isFocused = useIsFocused();
@@ -127,20 +126,14 @@ export default function TTSSelfie(props: any) {
127
126
 
128
127
  useEffect(async () => {
129
128
  requestPermissions();
130
- await analytics().logEvent('cccd_completed', {
131
- event: 'cccd_completed',
132
- createdAt: new Date(),
133
- deviceId: appStore.deviceId,
134
- loanId: props?.route?.params?.loan?.id,
135
- utmSource: props?.route?.params?.loan?.utmSource,
136
- });
137
- await AppEventsLogger().logEvent('cccd_completed', {
129
+ await logEvent('cccd_completed', {
138
130
  event: 'cccd_completed',
139
131
  createdAt: new Date(),
140
132
  deviceId: appStore.deviceId,
141
133
  loanId: props?.route?.params?.loan?.id,
142
134
  utmSource: props?.route?.params?.loan?.utmSource,
143
135
  });
136
+ logEventFb('cccd_completed');
144
137
  }, []);
145
138
 
146
139
  useEffect(() => {
@@ -16,8 +16,7 @@ import Pdf from 'react-native-pdf';
16
16
  import { Api } from '../../services/api';
17
17
  import { is, set } from 'ramda';
18
18
  import Loading from '../../components/Loading';
19
- import analytics from '@react-native-firebase/analytics';
20
- import { AppEventsLogger } from 'react-native-fbsdk-next';
19
+ import { logEvent, logEventFb } from '../../utils';
21
20
 
22
21
  export default function TTSSignLoan(props) {
23
22
  const loan = props?.route?.params?.loan;
@@ -53,14 +52,14 @@ export default function TTSSignLoan(props) {
53
52
  useEffect(async () => {
54
53
  if (loan) {
55
54
  getContract();
56
- await analytics().logEvent('kyhopdong_started', {
55
+ await logEvent('kyhopdong_started', {
57
56
  event: 'kyhopdong_started',
58
57
  createdAt: new Date(),
59
58
  deviceId: appStore.deviceId,
60
59
  loanId: props?.route?.params?.loan?.id,
61
60
  utmSource: props?.route?.params?.loan?.utmSource,
62
61
  });
63
- await AppEventsLogger().logEvent('kyhopdong_started', {
62
+ logEventFb('kyhopdong_started', {
64
63
  event: 'kyhopdong_started',
65
64
  createdAt: new Date(),
66
65
  deviceId: appStore.deviceId,
@@ -19,7 +19,7 @@ import { IconBack } from '../../assets/svgs';
19
19
  import { Formik } from 'formik';
20
20
  import { CheckBox, CheckBoxActive, DropDown2, Tick2 } from '../../assets/icons';
21
21
  import appStore from '../../AppStore';
22
- import { formatDDMMYYY, formatMoney } from '../../utils';
22
+ import { formatDDMMYYY, formatMoney, logEvent, logEventFb } from '../../utils';
23
23
  import { Api } from '../../services/api';
24
24
  import { debounce } from 'lodash';
25
25
  import { color } from '../../theme';
@@ -29,8 +29,6 @@ import MButton from '../../components/MButton';
29
29
  import LinearGradient from 'react-native-linear-gradient';
30
30
  import moment from 'moment';
31
31
  import * as yup from 'yup';
32
- import analytics from '@react-native-firebase/analytics';
33
- import { AppEventsLogger } from 'react-native-fbsdk-next';
34
32
 
35
33
  export default function TopupLoanInfo(props) {
36
34
  const navigation = useNavigation();
@@ -198,20 +196,14 @@ export default function TopupLoanInfo(props) {
198
196
  useEffect(async () => {
199
197
  getData();
200
198
  ttsStore.getFirstPayment(props.route?.params?.loan?.id);
201
- await analytics().logEvent('thongtinvay_started', {
202
- event: 'thongtinvay_started',
203
- createdAt: new Date(),
204
- deviceId: appStore.deviceId,
205
- loanId: props.route?.params?.loan?.id,
206
- utmSource: props.route?.params?.loan?.utmSource,
207
- });
208
- await AppEventsLogger().logEvent('thongtinvay_started', {
199
+ await logEvent('thongtinvay_started', {
209
200
  event: 'thongtinvay_started',
210
201
  createdAt: new Date(),
211
202
  deviceId: appStore.deviceId,
212
203
  loanId: props.route?.params?.loan?.id,
213
204
  utmSource: props.route?.params?.loan?.utmSource,
214
205
  });
206
+ logEventFb('thongtinvay_started');
215
207
  }, []);
216
208
 
217
209
  const onSubmit = async (values) => {
@@ -240,20 +232,14 @@ export default function TopupLoanInfo(props) {
240
232
  {
241
233
  text: 'Đồng ý',
242
234
  onPress: async () => {
243
- await analytics().logEvent('thongtinvay_completed', {
244
- event: 'thongtinvay_completed',
245
- createdAt: new Date(),
246
- deviceId: appStore.deviceId,
247
- loanId: props.route?.params?.loan?.id,
248
- utmSource: props.route?.params?.loan?.utmSource,
249
- });
250
- await AppEventsLogger().logEvent('thongtinvay_completed', {
235
+ await logEvent('thongtinvay_completed', {
251
236
  event: 'thongtinvay_completed',
252
237
  createdAt: new Date(),
253
238
  deviceId: appStore.deviceId,
254
239
  loanId: props.route?.params?.loan?.id,
255
240
  utmSource: props.route?.params?.loan?.utmSource,
256
241
  });
242
+ logEventFb('thongtinvay_completed');
257
243
  navigation.dispatch(
258
244
  CommonActions.reset({
259
245
  index: 1,
@@ -24,9 +24,8 @@ import { ScreenNames } from '../../navigation';
24
24
  import Loading from '../../components/Loading';
25
25
  import MButton from '../../components/MButton';
26
26
  import LinearGradient from 'react-native-linear-gradient';
27
- import analytics from '@react-native-firebase/analytics';
28
- import { AppEventsLogger } from 'react-native-fbsdk-next';
29
27
  import appStore from '../../AppStore';
28
+ import { logEvent, logEventFb } from '../../utils';
30
29
 
31
30
  const logoView: ImageStyle = {
32
31
  position: 'absolute',
@@ -44,28 +43,28 @@ export default function VehicleRegistration(props) {
44
43
  if (props?.route?.params?.uri) {
45
44
  setPhoto(props?.route?.params?.uri);
46
45
  }
47
- await analytics().logEvent('dangky_completed', {
46
+ await logEvent('dangky_completed', {
48
47
  event: 'dangky_completed',
49
48
  createdAt: new Date(),
50
49
  deviceId: appStore.deviceId,
51
50
  loanId: props?.route?.params?.loan?.id,
52
51
  utmSource: props?.route?.params?.loan?.utmSource,
53
52
  });
54
- await AppEventsLogger().logEvent('dangky_completed', {
53
+ logEventFb('dangky_completed', {
55
54
  event: 'dangky_completed',
56
55
  createdAt: new Date(),
57
56
  deviceId: appStore.deviceId,
58
57
  loanId: props?.route?.params?.loan?.id,
59
58
  utmSource: props?.route?.params?.loan?.utmSource,
60
59
  });
61
- await analytics().logEvent('dangkiem_started', {
60
+ await logEvent('dangkiem_started', {
62
61
  event: 'dangkiem_started',
63
62
  createdAt: new Date(),
64
63
  deviceId: appStore.deviceId,
65
64
  loanId: props?.route?.params?.loan?.id,
66
65
  utmSource: props?.route?.params?.loan?.utmSource,
67
66
  });
68
- await AppEventsLogger().logEvent('dangkiem_started', {
67
+ logEventFb('dangkiem_started', {
69
68
  event: 'dangkiem_started',
70
69
  createdAt: new Date(),
71
70
  deviceId: appStore.deviceId,
@@ -25,9 +25,8 @@ import LinearGradient from 'react-native-linear-gradient';
25
25
  import { ScreenNames } from '../../navigation';
26
26
  import { Api } from '../../services/api';
27
27
  import Loading from '../../components/Loading';
28
- import analytics from '@react-native-firebase/analytics';
29
- import { AppEventsLogger } from 'react-native-fbsdk-next';
30
28
  import appStore from '../../AppStore';
29
+ import { logEvent, logEventFb } from '../../utils';
31
30
 
32
31
  const logoView: ImageStyle = {
33
32
  position: 'absolute',
@@ -45,20 +44,14 @@ export default function VehicleRegistrationFront(props: any) {
45
44
  if (props?.route?.params?.uri) {
46
45
  setPhoto(props?.route?.params?.uri);
47
46
  }
48
- await analytics().logEvent('dangky_started', {
49
- event: 'dangky_started',
50
- createdAt: new Date(),
51
- deviceId: appStore.deviceId,
52
- loanId: props?.route?.params?.loan?.id,
53
- utmSource: props?.route?.params?.loan?.utmSource,
54
- });
55
- await AppEventsLogger().logEvent('dangky_started', {
47
+ await logEvent('dangky_started', {
56
48
  event: 'dangky_started',
57
49
  createdAt: new Date(),
58
50
  deviceId: appStore.deviceId,
59
51
  loanId: props?.route?.params?.loan?.id,
60
52
  utmSource: props?.route?.params?.loan?.utmSource,
61
53
  });
54
+ logEventFb('dangky_started');
62
55
  }, []);
63
56
 
64
57
  const takePhoto = () => {
@@ -1,5 +1,7 @@
1
1
  //@ts-nocheck
2
2
  import moment from 'moment';
3
+ import { AppEventsLogger } from 'react-native-fbsdk-next';
4
+ import analytics from '@react-native-firebase/analytics';
3
5
 
4
6
  export const formatMoney = (x) => {
5
7
  try {
@@ -168,3 +170,21 @@ export const EnumRelationshipOption2 = [
168
170
  name: 'Bạn bè',
169
171
  },
170
172
  ];
173
+
174
+ export const logEventFb = (action: string) => {
175
+ try {
176
+ AppEventsLogger.logEvent(action);
177
+ console.log(`Logged action: ${action}`);
178
+ } catch (error) {
179
+ console.error(`Failed to log action: ${action}`, error);
180
+ }
181
+ };
182
+
183
+ export const logEvent = async (eventName: string, params?: object) => {
184
+ try {
185
+ await analytics().logEvent(eventName, params);
186
+ console.log(`Logged event: ${eventName}`, params);
187
+ } catch (error) {
188
+ console.error(`Failed to log event: ${eventName}`, error);
189
+ }
190
+ };