@finos_sdk/sdk-ekyc 1.5.0 → 1.5.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.
@@ -0,0 +1,123 @@
1
+ /**
2
+ * ExitConfirmConfig — bottom sheet xác nhận thoát khi user nhấn back trong liveness.
3
+ * Map 1-1 với native ExitConfirmConfig (sdkcore 1.5.2+).
4
+ *
5
+ * Mọi field đều optional — null/undefined = giữ giá trị mặc định của SDK.
6
+ * Xem EXIT_CONFIRM_CONFIG.md để biết chi tiết và giá trị mặc định.
7
+ */
8
+
9
+ /** Hướng gradient cho ViewStyle.backgroundGradient*. Map android.graphics.drawable.GradientDrawable.Orientation. */
10
+ export enum ExitConfirmGradientOrientation {
11
+ LEFT_RIGHT = "LEFT_RIGHT",
12
+ RIGHT_LEFT = "RIGHT_LEFT",
13
+ TOP_BOTTOM = "TOP_BOTTOM",
14
+ BOTTOM_TOP = "BOTTOM_TOP",
15
+ TL_BR = "TL_BR",
16
+ TR_BL = "TR_BL",
17
+ BL_TR = "BL_TR",
18
+ BR_TL = "BR_TL",
19
+ }
20
+
21
+ /** Text style cho title/content/button label. */
22
+ export interface ExitConfirmTextStyles {
23
+ /** Hex màu chữ, vd "#1A1A1A" hoặc "#FF1A1A1A". */
24
+ textColor?: string;
25
+ /** Cỡ chữ đơn vị sp. */
26
+ textSize?: number;
27
+ /** Tên font resource trong res/font/, vd "inter_medium". */
28
+ textFont?: string;
29
+ /** 0 Normal · 1 Bold · 2 Italic · 3 Bold+Italic. */
30
+ textStyle?: number;
31
+ /** android.view.Gravity flag, vd Gravity.CENTER = 17. */
32
+ textAlign?: number;
33
+ }
34
+
35
+ /** View style cho background, kích thước, margin, padding, bo góc của container/button. */
36
+ export interface ExitConfirmViewStyle {
37
+ /** Hex màu nền. Bị bỏ qua nếu set gradient. */
38
+ backgroundColor?: string;
39
+ /** Tối thiểu 2 màu hex cho gradient. */
40
+ backgroundGradientColors?: string[];
41
+ /**
42
+ * Vị trí [0.0–1.0] tương ứng từng màu (Android 10+).
43
+ * null = phân bổ đều. Bắt buộc cùng size với backgroundGradientColors.
44
+ */
45
+ backgroundGradientPositions?: number[];
46
+ /** Hướng gradient. Mặc định LEFT_RIGHT. */
47
+ backgroundGradientOrientation?: ExitConfirmGradientOrientation;
48
+ /** dp — null = giữ constraint layout. */
49
+ width?: number;
50
+ /** dp. */
51
+ height?: number;
52
+ marginTop?: number;
53
+ marginBottom?: number;
54
+ marginStart?: number;
55
+ marginEnd?: number;
56
+ paddingTop?: number;
57
+ paddingBottom?: number;
58
+ paddingStart?: number;
59
+ paddingEnd?: number;
60
+ /** android.view.Gravity flag cho nội dung bên trong. */
61
+ gravity?: number;
62
+ /** Bo góc dp. 100f = pill shape. */
63
+ cornerRadius?: number;
64
+ }
65
+
66
+ /**
67
+ * Icon phía trên bottom sheet.
68
+ * Native field `icon: Int?` là R.drawable resource ID — RN không truy cập trực tiếp được.
69
+ * Truyền `iconResName` (vd "ic_warning") để native resolve qua getIdentifier().
70
+ * Bỏ qua / null = dùng icon mặc định SDK (ic_bell).
71
+ */
72
+ export interface ExitConfirmIconProps {
73
+ /** Tên drawable resource trong res/drawable/. null/omitted = icon mặc định SDK. */
74
+ iconResName?: string;
75
+ iconViewStyle?: ExitConfirmViewStyle;
76
+ }
77
+
78
+ export interface ExitConfirmTitleProps {
79
+ title?: string;
80
+ titleStyles?: ExitConfirmTextStyles;
81
+ }
82
+
83
+ export interface ExitConfirmContentProps {
84
+ content?: string;
85
+ contentStyles?: ExitConfirmTextStyles;
86
+ }
87
+
88
+ export interface ExitConfirmButtonProps {
89
+ buttonTitle?: string;
90
+ buttonTextStyles?: ExitConfirmTextStyles;
91
+ buttonStyles?: ExitConfirmViewStyle;
92
+ }
93
+
94
+ /**
95
+ * Config bottom sheet xác nhận thoát. Truyền vào FinosEKYC.startEkycUI / startLiveness.
96
+ * Mọi field optional — null = SDK default.
97
+ *
98
+ * @example
99
+ * exitConfirmConfig: {
100
+ * titleProps: { title: "Thông báo" },
101
+ * contentProps: { content: "Quý khách muốn thoát?" },
102
+ * confirmButtonProps: {
103
+ * buttonTitle: "Có",
104
+ * buttonStyles: {
105
+ * backgroundGradientColors: ["#DA2128", "#F9A61C", "#FFDD00"],
106
+ * cornerRadius: 100,
107
+ * },
108
+ * },
109
+ * cancelButtonProps: {
110
+ * buttonTitle: "Không",
111
+ * buttonStyles: { backgroundColor: "#F3F4F6", cornerRadius: 100 },
112
+ * },
113
+ * }
114
+ */
115
+ export interface ExitConfirmConfig {
116
+ iconProps?: ExitConfirmIconProps;
117
+ titleProps?: ExitConfirmTitleProps;
118
+ contentProps?: ExitConfirmContentProps;
119
+ /** Nút xác nhận thoát (vd "Có") — chỉ nút này mới trigger callback thoát SDK. */
120
+ confirmButtonProps?: ExitConfirmButtonProps;
121
+ /** Nút huỷ (vd "Không") — đóng sheet, ở lại SDK. */
122
+ cancelButtonProps?: ExitConfirmButtonProps;
123
+ }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const ExitConfirmSheet: (props: any) => React.JSX.Element;
3
- export default ExitConfirmSheet;
@@ -1,164 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
7
- const react_native_1 = require("react-native");
8
- const FinosEKYCModule_1 = require("../modules/FinosEKYCModule");
9
- const BellIcon = () => (<react_native_1.View style={styles.bellWrapper}>
10
- <react_native_1.View style={styles.bellMount}/>
11
- <react_native_1.View style={styles.bellBody}/>
12
- <react_native_1.View style={styles.bellSkirt}/>
13
- <react_native_1.View style={styles.bellClapper}/>
14
- </react_native_1.View>);
15
- const ExitConfirmSheet = (props) => {
16
- const message = props.message || 'Giao dịch bị hủy khi điều hướng sang tính năng tiếp theo. Quý khách có chắc chắn hủy giao dịch?';
17
- const confirmText = props.confirmText || 'Đồng ý';
18
- const cancelText = props.cancelText || 'Ở lại';
19
- const handleConfirm = async () => {
20
- await FinosEKYCModule_1.FinosEKYC.resolveExit('CONFIRM');
21
- };
22
- const handleCancel = async () => {
23
- await FinosEKYCModule_1.FinosEKYC.resolveExit('CANCEL');
24
- };
25
- return (<react_native_1.View style={styles.container} onLayout={(e) => {
26
- var _a, _b;
27
- const h = e.nativeEvent.layout.height;
28
- if (h > 0)
29
- (_b = (_a = react_native_1.NativeModules.EKYCModule) === null || _a === void 0 ? void 0 : _a.setExitSheetHeight) === null || _b === void 0 ? void 0 : _b.call(_a, h);
30
- }}>
31
- <react_native_1.View style={styles.handle}/>
32
-
33
- <react_native_1.View style={styles.content}>
34
- <BellIcon />
35
- <react_native_1.Text style={styles.message}>{message}</react_native_1.Text>
36
- </react_native_1.View>
37
-
38
- <react_native_1.View style={styles.footer}>
39
- <react_native_1.TouchableOpacity style={styles.confirmButton} onPress={handleConfirm} activeOpacity={0.8}>
40
- <react_native_1.View style={styles.gradientContainer}>
41
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#E53935' }]}/>
42
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#EA4F28' }]}/>
43
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#EF6519' }]}/>
44
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#F47A0B' }]}/>
45
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#F98F00' }]}/>
46
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#FCA300' }]}/>
47
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#FFB800' }]}/>
48
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#FFCC00' }]}/>
49
- <react_native_1.View style={[styles.gradientStep, { backgroundColor: '#FFD600' }]}/>
50
- </react_native_1.View>
51
- <react_native_1.Text style={styles.confirmText}>{confirmText}</react_native_1.Text>
52
- </react_native_1.TouchableOpacity>
53
-
54
- <react_native_1.TouchableOpacity style={styles.cancelButton} onPress={handleCancel} activeOpacity={0.7}>
55
- <react_native_1.Text style={styles.cancelText}>{cancelText}</react_native_1.Text>
56
- </react_native_1.TouchableOpacity>
57
- </react_native_1.View>
58
- </react_native_1.View>);
59
- };
60
- const styles = react_native_1.StyleSheet.create({
61
- container: {
62
- backgroundColor: 'white',
63
- paddingHorizontal: 24,
64
- paddingBottom: 32,
65
- borderTopLeftRadius: 32,
66
- borderTopRightRadius: 32,
67
- },
68
- handle: {
69
- width: 40,
70
- height: 4,
71
- backgroundColor: '#CCCCCC',
72
- borderRadius: 2,
73
- alignSelf: 'center',
74
- marginTop: 12,
75
- marginBottom: 20,
76
- },
77
- content: {
78
- alignItems: 'center',
79
- marginBottom: 28,
80
- },
81
- bellWrapper: {
82
- alignItems: 'center',
83
- width: 72,
84
- height: 72,
85
- marginBottom: 20,
86
- },
87
- bellMount: {
88
- width: 9,
89
- height: 7,
90
- borderRadius: 4,
91
- backgroundColor: '#E53935',
92
- marginTop: 7,
93
- },
94
- bellBody: {
95
- width: 36,
96
- height: 34,
97
- borderTopLeftRadius: 18,
98
- borderTopRightRadius: 18,
99
- backgroundColor: '#E53935',
100
- marginTop: -1,
101
- },
102
- bellSkirt: {
103
- width: 48,
104
- height: 9,
105
- borderBottomLeftRadius: 5,
106
- borderBottomRightRadius: 5,
107
- backgroundColor: '#E53935',
108
- },
109
- bellClapper: {
110
- width: 12,
111
- height: 7,
112
- borderBottomLeftRadius: 6,
113
- borderBottomRightRadius: 6,
114
- backgroundColor: '#E53935',
115
- marginTop: 2,
116
- },
117
- message: {
118
- fontSize: 15,
119
- color: '#1A1A1A',
120
- textAlign: 'center',
121
- lineHeight: 19.5,
122
- },
123
- footer: {
124
- width: '100%',
125
- gap: 12,
126
- },
127
- confirmButton: {
128
- width: '100%',
129
- height: 52,
130
- borderRadius: 24,
131
- alignItems: 'center',
132
- justifyContent: 'center',
133
- overflow: 'hidden',
134
- elevation: 4,
135
- shadowColor: '#E53935',
136
- shadowOffset: { width: 0, height: 4 },
137
- shadowOpacity: 0.3,
138
- shadowRadius: 8,
139
- },
140
- gradientContainer: Object.assign(Object.assign({}, react_native_1.StyleSheet.absoluteFillObject), { flexDirection: 'row' }),
141
- gradientStep: {
142
- flex: 1,
143
- },
144
- confirmText: {
145
- fontSize: 16,
146
- fontWeight: '700',
147
- color: '#fff',
148
- },
149
- cancelButton: {
150
- width: '100%',
151
- height: 52,
152
- borderRadius: 24,
153
- borderWidth: 1.5,
154
- borderColor: '#CCCCCC',
155
- alignItems: 'center',
156
- justifyContent: 'center',
157
- },
158
- cancelText: {
159
- fontSize: 16,
160
- fontWeight: '600',
161
- color: '#555555',
162
- },
163
- });
164
- exports.default = ExitConfirmSheet;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * Set custom exit sheet component.
4
- * Gọi trước khi showRNExitSheet để override default ExitConfirmSheet.
5
- */
6
- export declare function setCustomExitComponent(component: React.ComponentType<any> | null): void;
7
- /**
8
- * Wrapper component được SDK auto-register với tên 'SDKExitSheetWrapper'.
9
- * Render custom component nếu được set, fallback về ExitConfirmSheet mặc định.
10
- */
11
- declare const ExitSheetWrapper: (props: any) => React.JSX.Element;
12
- export default ExitSheetWrapper;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setCustomExitComponent = setCustomExitComponent;
7
- const react_1 = __importDefault(require("react"));
8
- const ExitConfirmSheet_1 = __importDefault(require("./ExitConfirmSheet"));
9
- // Module-level variable — set bởi FinosEKYC.setExitSheetComponent()
10
- let _customComponent = null;
11
- /**
12
- * Set custom exit sheet component.
13
- * Gọi trước khi showRNExitSheet để override default ExitConfirmSheet.
14
- */
15
- function setCustomExitComponent(component) {
16
- _customComponent = component;
17
- }
18
- /**
19
- * Wrapper component được SDK auto-register với tên 'SDKExitSheetWrapper'.
20
- * Render custom component nếu được set, fallback về ExitConfirmSheet mặc định.
21
- */
22
- const ExitSheetWrapper = (props) => {
23
- const Component = _customComponent || ExitConfirmSheet_1.default;
24
- return <Component {...props}/>;
25
- };
26
- exports.default = ExitSheetWrapper;
@@ -1,180 +0,0 @@
1
- import React from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- TouchableOpacity,
7
- NativeModules,
8
- } from 'react-native';
9
- import { FinosEKYC } from '../modules/FinosEKYCModule';
10
-
11
- const BellIcon = () => (
12
- <View style={styles.bellWrapper}>
13
- <View style={styles.bellMount} />
14
- <View style={styles.bellBody} />
15
- <View style={styles.bellSkirt} />
16
- <View style={styles.bellClapper} />
17
- </View>
18
- );
19
-
20
- const ExitConfirmSheet = (props: any) => {
21
- const message = props.message || 'Giao dịch bị hủy khi điều hướng sang tính năng tiếp theo. Quý khách có chắc chắn hủy giao dịch?';
22
- const confirmText = props.confirmText || 'Đồng ý';
23
- const cancelText = props.cancelText || 'Ở lại';
24
-
25
- const handleConfirm = async () => {
26
- await FinosEKYC.resolveExit('CONFIRM');
27
- };
28
-
29
- const handleCancel = async () => {
30
- await FinosEKYC.resolveExit('CANCEL');
31
- };
32
-
33
- return (
34
- <View
35
- style={styles.container}
36
- onLayout={(e) => {
37
- const h = e.nativeEvent.layout.height;
38
- if (h > 0) NativeModules.EKYCModule?.setExitSheetHeight?.(h);
39
- }}
40
- >
41
- <View style={styles.handle} />
42
-
43
- <View style={styles.content}>
44
- <BellIcon />
45
- <Text style={styles.message}>{message}</Text>
46
- </View>
47
-
48
- <View style={styles.footer}>
49
- <TouchableOpacity style={styles.confirmButton} onPress={handleConfirm} activeOpacity={0.8}>
50
- <View style={styles.gradientContainer}>
51
- <View style={[styles.gradientStep, { backgroundColor: '#E53935' }]} />
52
- <View style={[styles.gradientStep, { backgroundColor: '#EA4F28' }]} />
53
- <View style={[styles.gradientStep, { backgroundColor: '#EF6519' }]} />
54
- <View style={[styles.gradientStep, { backgroundColor: '#F47A0B' }]} />
55
- <View style={[styles.gradientStep, { backgroundColor: '#F98F00' }]} />
56
- <View style={[styles.gradientStep, { backgroundColor: '#FCA300' }]} />
57
- <View style={[styles.gradientStep, { backgroundColor: '#FFB800' }]} />
58
- <View style={[styles.gradientStep, { backgroundColor: '#FFCC00' }]} />
59
- <View style={[styles.gradientStep, { backgroundColor: '#FFD600' }]} />
60
- </View>
61
- <Text style={styles.confirmText}>{confirmText}</Text>
62
- </TouchableOpacity>
63
-
64
- <TouchableOpacity style={styles.cancelButton} onPress={handleCancel} activeOpacity={0.7}>
65
- <Text style={styles.cancelText}>{cancelText}</Text>
66
- </TouchableOpacity>
67
- </View>
68
- </View>
69
- );
70
- };
71
-
72
- const styles = StyleSheet.create({
73
- container: {
74
- backgroundColor: 'white',
75
- paddingHorizontal: 24,
76
- paddingBottom: 32,
77
- borderTopLeftRadius: 32,
78
- borderTopRightRadius: 32,
79
- },
80
- handle: {
81
- width: 40,
82
- height: 4,
83
- backgroundColor: '#CCCCCC',
84
- borderRadius: 2,
85
- alignSelf: 'center',
86
- marginTop: 12,
87
- marginBottom: 20,
88
- },
89
- content: {
90
- alignItems: 'center',
91
- marginBottom: 28,
92
- },
93
- bellWrapper: {
94
- alignItems: 'center',
95
- width: 72,
96
- height: 72,
97
- marginBottom: 20,
98
- },
99
- bellMount: {
100
- width: 9,
101
- height: 7,
102
- borderRadius: 4,
103
- backgroundColor: '#E53935',
104
- marginTop: 7,
105
- },
106
- bellBody: {
107
- width: 36,
108
- height: 34,
109
- borderTopLeftRadius: 18,
110
- borderTopRightRadius: 18,
111
- backgroundColor: '#E53935',
112
- marginTop: -1,
113
- },
114
- bellSkirt: {
115
- width: 48,
116
- height: 9,
117
- borderBottomLeftRadius: 5,
118
- borderBottomRightRadius: 5,
119
- backgroundColor: '#E53935',
120
- },
121
- bellClapper: {
122
- width: 12,
123
- height: 7,
124
- borderBottomLeftRadius: 6,
125
- borderBottomRightRadius: 6,
126
- backgroundColor: '#E53935',
127
- marginTop: 2,
128
- },
129
- message: {
130
- fontSize: 15,
131
- color: '#1A1A1A',
132
- textAlign: 'center',
133
- lineHeight: 19.5,
134
- },
135
- footer: {
136
- width: '100%',
137
- gap: 12,
138
- },
139
- confirmButton: {
140
- width: '100%',
141
- height: 52,
142
- borderRadius: 24,
143
- alignItems: 'center',
144
- justifyContent: 'center',
145
- overflow: 'hidden',
146
- elevation: 4,
147
- shadowColor: '#E53935',
148
- shadowOffset: { width: 0, height: 4 },
149
- shadowOpacity: 0.3,
150
- shadowRadius: 8,
151
- },
152
- gradientContainer: {
153
- ...StyleSheet.absoluteFillObject,
154
- flexDirection: 'row',
155
- },
156
- gradientStep: {
157
- flex: 1,
158
- },
159
- confirmText: {
160
- fontSize: 16,
161
- fontWeight: '700',
162
- color: '#fff',
163
- },
164
- cancelButton: {
165
- width: '100%',
166
- height: 52,
167
- borderRadius: 24,
168
- borderWidth: 1.5,
169
- borderColor: '#CCCCCC',
170
- alignItems: 'center',
171
- justifyContent: 'center',
172
- },
173
- cancelText: {
174
- fontSize: 16,
175
- fontWeight: '600',
176
- color: '#555555',
177
- },
178
- });
179
-
180
- export default ExitConfirmSheet;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import ExitConfirmSheet from './ExitConfirmSheet';
3
-
4
- // Module-level variable — set bởi FinosEKYC.setExitSheetComponent()
5
- let _customComponent: React.ComponentType<any> | null = null;
6
-
7
- /**
8
- * Set custom exit sheet component.
9
- * Gọi trước khi showRNExitSheet để override default ExitConfirmSheet.
10
- */
11
- export function setCustomExitComponent(component: React.ComponentType<any> | null) {
12
- _customComponent = component;
13
- }
14
-
15
- /**
16
- * Wrapper component được SDK auto-register với tên 'SDKExitSheetWrapper'.
17
- * Render custom component nếu được set, fallback về ExitConfirmSheet mặc định.
18
- */
19
- const ExitSheetWrapper = (props: any) => {
20
- const Component = _customComponent || ExitConfirmSheet;
21
- return <Component {...props} />;
22
- };
23
-
24
- export default ExitSheetWrapper;