@onairos/react-native 1.0.3 → 2.0.1
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/commonjs/api/index.js +34 -0
- package/lib/commonjs/api/index.js.map +1 -0
- package/lib/commonjs/components/OnairosButton.js +59 -20
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/Overlay.js +180 -197
- package/lib/commonjs/components/Overlay.js.map +1 -1
- package/lib/commonjs/constants/index.js +13 -9
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/index.js +220 -0
- package/lib/commonjs/utils/encryption.js +32 -0
- package/lib/commonjs/utils/encryption.js.map +1 -0
- package/lib/module/api/index.js +27 -0
- package/lib/module/api/index.js.map +1 -0
- package/lib/module/components/OnairosButton.js +59 -20
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/Overlay.js +182 -198
- package/lib/module/components/Overlay.js.map +1 -1
- package/lib/module/constants/index.js +13 -9
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/utils/encryption.js +24 -0
- package/lib/module/utils/encryption.js.map +1 -0
- package/package.json +2 -1
- package/src/api/index.ts +33 -0
- package/src/components/OnairosButton.tsx +66 -22
- package/src/components/Overlay.tsx +198 -185
- package/src/constants/index.ts +12 -8
- package/src/types/index.ts +20 -14
- package/src/utils/encryption.ts +25 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.onairosApi = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const BASE_URL = 'https://api2.onairos.uk';
|
|
10
|
+
class OnairosApi {
|
|
11
|
+
constructor(baseUrl = BASE_URL) {
|
|
12
|
+
this.baseUrl = baseUrl;
|
|
13
|
+
}
|
|
14
|
+
async get(endpoint) {
|
|
15
|
+
try {
|
|
16
|
+
const response = await _axios.default.get(`${this.baseUrl}/${endpoint}`);
|
|
17
|
+
return response.data;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error('API GET Error:', error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async post(endpoint, data) {
|
|
24
|
+
try {
|
|
25
|
+
const response = await _axios.default.post(`${this.baseUrl}/${endpoint}`, data);
|
|
26
|
+
return response.data;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('API POST Error:', error);
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const onairosApi = exports.onairosApi = new OnairosApi();
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_axios","_interopRequireDefault","require","e","__esModule","default","BASE_URL","OnairosApi","constructor","baseUrl","get","endpoint","response","axios","data","error","console","post","onairosApi","exports"],"sourceRoot":"..\\..\\..\\src","sources":["api/index.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1B,MAAMG,QAAQ,GAAG,yBAAyB;AAE1C,MAAMC,UAAU,CAAC;EAGfC,WAAWA,CAACC,OAAe,GAAGH,QAAQ,EAAE;IACtC,IAAI,CAACG,OAAO,GAAGA,OAAO;EACxB;EAEA,MAAMC,GAAGA,CAACC,QAAgB,EAAE;IAC1B,IAAI;MACF,MAAMC,QAAQ,GAAG,MAAMC,cAAK,CAACH,GAAG,CAAC,GAAG,IAAI,CAACD,OAAO,IAAIE,QAAQ,EAAE,CAAC;MAC/D,OAAOC,QAAQ,CAACE,IAAI;IACtB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACD,KAAK,CAAC,gBAAgB,EAAEA,KAAK,CAAC;MACtC,MAAMA,KAAK;IACb;EACF;EAEA,MAAME,IAAIA,CAACN,QAAgB,EAAEG,IAAS,EAAE;IACtC,IAAI;MACF,MAAMF,QAAQ,GAAG,MAAMC,cAAK,CAACI,IAAI,CAAC,GAAG,IAAI,CAACR,OAAO,IAAIE,QAAQ,EAAE,EAAEG,IAAI,CAAC;MACtE,OAAOF,QAAQ,CAACE,IAAI;IACtB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACD,KAAK,CAAC,iBAAiB,EAAEA,KAAK,CAAC;MACvC,MAAMA,KAAK;IACb;EACF;AACF;AAEO,MAAMG,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,IAAIX,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -7,55 +7,78 @@ exports.OnairosButton = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _UniversalOnboarding = require("./UniversalOnboarding");
|
|
10
|
-
var _constants = require("../constants");
|
|
11
10
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
11
|
const OnairosButton = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
style,
|
|
16
|
-
buttonType = 'default',
|
|
17
|
-
buttonForm = 'signup',
|
|
12
|
+
returnLink,
|
|
13
|
+
prefillUrl,
|
|
18
14
|
AppName,
|
|
15
|
+
buttonType = 'normal',
|
|
19
16
|
requestData,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
buttonWidth = 180,
|
|
18
|
+
buttonHeight,
|
|
19
|
+
hasStroke = false,
|
|
20
|
+
enabled = true,
|
|
21
|
+
buttonForm = 'default',
|
|
22
|
+
onRejection,
|
|
23
|
+
onResolved,
|
|
24
|
+
preCheck,
|
|
25
|
+
color,
|
|
26
|
+
swerv = false,
|
|
23
27
|
debug = false,
|
|
24
|
-
|
|
28
|
+
preferredPlatform,
|
|
29
|
+
testMode = false
|
|
25
30
|
}) => {
|
|
26
31
|
const [showOnboarding, setShowOnboarding] = (0, _react.useState)(false);
|
|
27
|
-
const handlePress = () => {
|
|
32
|
+
const handlePress = async () => {
|
|
33
|
+
if (!enabled) return;
|
|
34
|
+
if (preCheck) {
|
|
35
|
+
const shouldProceed = await preCheck();
|
|
36
|
+
if (!shouldProceed) {
|
|
37
|
+
onRejection === null || onRejection === void 0 || onRejection();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
28
41
|
if (buttonForm === 'signup') {
|
|
29
42
|
setShowOnboarding(true);
|
|
30
43
|
} else {
|
|
31
|
-
|
|
44
|
+
// Handle login flow
|
|
45
|
+
// TODO: Implement login flow according to account.md
|
|
32
46
|
}
|
|
33
47
|
};
|
|
34
48
|
const handleOnboardingComplete = (apiUrl, token, data) => {
|
|
35
49
|
setShowOnboarding(false);
|
|
36
|
-
|
|
50
|
+
onResolved === null || onResolved === void 0 || onResolved(apiUrl, token, data);
|
|
37
51
|
};
|
|
52
|
+
const buttonStyle = [styles.button, buttonType === 'pill' && styles.pillButton, hasStroke && styles.strokedButton, {
|
|
53
|
+
width: buttonWidth
|
|
54
|
+
}, buttonHeight && {
|
|
55
|
+
height: buttonHeight
|
|
56
|
+
}, color && {
|
|
57
|
+
backgroundColor: color
|
|
58
|
+
}, swerv && styles.swervButton];
|
|
59
|
+
const textStyle = [styles.buttonText, hasStroke && styles.strokedButtonText, color && styles.customColorText];
|
|
38
60
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
39
|
-
style:
|
|
40
|
-
onPress: handlePress
|
|
61
|
+
style: buttonStyle,
|
|
62
|
+
onPress: handlePress,
|
|
63
|
+
disabled: !enabled
|
|
41
64
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
42
|
-
style:
|
|
43
|
-
},
|
|
65
|
+
style: textStyle
|
|
66
|
+
}, AppName)), /*#__PURE__*/_react.default.createElement(_UniversalOnboarding.UniversalOnboarding, {
|
|
44
67
|
visible: showOnboarding,
|
|
45
68
|
onClose: () => setShowOnboarding(false),
|
|
46
69
|
AppName: AppName,
|
|
47
70
|
requestData: requestData,
|
|
48
71
|
returnLink: returnLink,
|
|
49
72
|
onComplete: handleOnboardingComplete,
|
|
50
|
-
|
|
73
|
+
preferredPlatform: preferredPlatform,
|
|
51
74
|
debug: debug,
|
|
52
|
-
test:
|
|
75
|
+
test: testMode
|
|
53
76
|
}));
|
|
54
77
|
};
|
|
55
78
|
exports.OnairosButton = OnairosButton;
|
|
56
79
|
const styles = _reactNative.StyleSheet.create({
|
|
57
80
|
button: {
|
|
58
|
-
backgroundColor:
|
|
81
|
+
backgroundColor: '#000',
|
|
59
82
|
paddingVertical: 12,
|
|
60
83
|
paddingHorizontal: 24,
|
|
61
84
|
borderRadius: 8,
|
|
@@ -65,10 +88,26 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
65
88
|
pillButton: {
|
|
66
89
|
borderRadius: 20
|
|
67
90
|
},
|
|
91
|
+
strokedButton: {
|
|
92
|
+
backgroundColor: 'transparent',
|
|
93
|
+
borderWidth: 1,
|
|
94
|
+
borderColor: '#000'
|
|
95
|
+
},
|
|
96
|
+
swervButton: {
|
|
97
|
+
transform: [{
|
|
98
|
+
rotate: '-2deg'
|
|
99
|
+
}]
|
|
100
|
+
},
|
|
68
101
|
buttonText: {
|
|
69
102
|
color: '#fff',
|
|
70
103
|
fontSize: 16,
|
|
71
104
|
fontWeight: '600'
|
|
105
|
+
},
|
|
106
|
+
strokedButtonText: {
|
|
107
|
+
color: '#000'
|
|
108
|
+
},
|
|
109
|
+
customColorText: {
|
|
110
|
+
color: '#fff'
|
|
72
111
|
}
|
|
73
112
|
});
|
|
74
113
|
//# sourceMappingURL=OnairosButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_UniversalOnboarding","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_UniversalOnboarding","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OnairosButton","returnLink","prefillUrl","AppName","buttonType","requestData","buttonWidth","buttonHeight","hasStroke","enabled","buttonForm","onRejection","onResolved","preCheck","color","swerv","debug","preferredPlatform","testMode","showOnboarding","setShowOnboarding","useState","handlePress","shouldProceed","handleOnboardingComplete","apiUrl","token","data","buttonStyle","styles","button","pillButton","strokedButton","width","height","backgroundColor","swervButton","textStyle","buttonText","strokedButtonText","customColorText","createElement","View","TouchableOpacity","style","onPress","disabled","Text","UniversalOnboarding","visible","onClose","onComplete","test","exports","StyleSheet","create","paddingVertical","paddingHorizontal","borderRadius","alignItems","justifyContent","borderWidth","borderColor","transform","rotate","fontSize","fontWeight"],"sourceRoot":"..\\..\\..\\src","sources":["components/OnairosButton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAA4D,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA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EACd,CAAC;EACD3B,iBAAiB,EAAE;IACjBzB,KAAK,EAAE;EACT,CAAC;EACD0B,eAAe,EAAE;IACf1B,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,264 +6,247 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Overlay = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _bottomSheet =
|
|
10
|
-
var _MaterialIcons = _interopRequireDefault(require("react-native-vector-icons/MaterialIcons"));
|
|
9
|
+
var _bottomSheet = require("@gorhom/bottom-sheet");
|
|
11
10
|
var _constants = require("../constants");
|
|
12
|
-
|
|
11
|
+
var _api = require("../api");
|
|
12
|
+
var _encryption = require("../utils/encryption");
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
-
|
|
15
|
-
height
|
|
16
|
-
} = _reactNative.Dimensions.get('window');
|
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
15
|
const Overlay = ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
requestData,
|
|
23
|
-
biometricType = _reactNative.Platform.OS === 'ios' ? 'FaceID' : 'BiometricID'
|
|
16
|
+
data,
|
|
17
|
+
username,
|
|
18
|
+
modelKey,
|
|
19
|
+
onResolved
|
|
24
20
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
// Expand or collapse the bottom sheet based on visibility
|
|
21
|
+
const [selections, setSelections] = (0, _react.useState)({});
|
|
22
|
+
const [details, setDetails] = (0, _react.useState)('');
|
|
23
|
+
const bottomSheetRef = _react.default.useRef(null);
|
|
29
24
|
(0, _react.useEffect)(() => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
// Initialize selection state
|
|
26
|
+
const initialSelections = {};
|
|
27
|
+
Object.keys(data).forEach(key => {
|
|
28
|
+
initialSelections[key] = false;
|
|
29
|
+
});
|
|
30
|
+
setSelections(initialSelections);
|
|
31
|
+
getDetails();
|
|
32
|
+
}, []);
|
|
33
|
+
const getDetails = async () => {
|
|
34
|
+
try {
|
|
35
|
+
const response = await _api.onairosApi.post('getAccountInfo', {
|
|
36
|
+
Info: {
|
|
37
|
+
username: username
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
setDetails(response.AccountInfo);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
console.error('Error getting account info:', e);
|
|
36
43
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
};
|
|
45
|
+
const closeOverlay = () => {
|
|
46
|
+
var _bottomSheetRef$curre;
|
|
47
|
+
(_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 || _bottomSheetRef$curre.dismiss();
|
|
48
|
+
};
|
|
49
|
+
const confirmSelection = async () => {
|
|
50
|
+
try {
|
|
51
|
+
let appId = 'unknown';
|
|
52
|
+
try {
|
|
53
|
+
// Try to get package info, but don't fail if it's not available
|
|
54
|
+
const PackageInfo = require('react-native-package-info');
|
|
55
|
+
const packageInfo = await PackageInfo.getPackageInfo();
|
|
56
|
+
appId = packageInfo.packageName;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.warn('Package info not available:', e);
|
|
59
|
+
}
|
|
60
|
+
const serverPublicKey = await (0, _encryption.getServerPublicKey)();
|
|
61
|
+
const encryptedModelKey = (0, _encryption.encryptModelKey)(serverPublicKey, modelKey);
|
|
62
|
+
const response = await _api.onairosApi.post('getAPIUrlMobile', {
|
|
63
|
+
Info: {
|
|
64
|
+
storage: 'local',
|
|
65
|
+
appId: appId,
|
|
66
|
+
confirmations: selections,
|
|
67
|
+
developerURL: 'devURL',
|
|
68
|
+
EncryptedUserPin: encryptedModelKey,
|
|
69
|
+
account: username,
|
|
70
|
+
proofMode: false
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (response.apiUrl && response.token) {
|
|
74
|
+
onResolved(response.apiUrl, response.token, {
|
|
75
|
+
username
|
|
76
|
+
});
|
|
77
|
+
closeOverlay();
|
|
78
|
+
}
|
|
79
|
+
} catch (e) {
|
|
80
|
+
console.error('Error in confirmSelection:', e);
|
|
81
|
+
showErrorModal('Failed to confirm selection. Please try again.');
|
|
48
82
|
}
|
|
49
|
-
}, [biometricType]);
|
|
50
|
-
|
|
51
|
-
// Render the requested data sections
|
|
52
|
-
const renderDataCategories = () => {
|
|
53
|
-
return Object.entries(requestData).map(([category, items]) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
54
|
-
key: category,
|
|
55
|
-
style: styles.categoryContainer
|
|
56
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
57
|
-
style: styles.categoryTitle
|
|
58
|
-
}, category), Object.entries(items).map(([item, description]) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
59
|
-
key: item,
|
|
60
|
-
style: styles.itemContainer
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(_MaterialIcons.default, {
|
|
62
|
-
name: "check-circle",
|
|
63
|
-
size: 20,
|
|
64
|
-
color: _constants.COLORS.primary
|
|
65
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
66
|
-
style: styles.itemContent
|
|
67
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
68
|
-
style: styles.itemTitle
|
|
69
|
-
}, item), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
70
|
-
style: styles.itemDescription
|
|
71
|
-
}, description))))));
|
|
72
83
|
};
|
|
73
|
-
|
|
84
|
+
const showErrorModal = errorMessage => {
|
|
85
|
+
_reactNative.Alert.alert('Notice', errorMessage, [{
|
|
86
|
+
text: 'OK'
|
|
87
|
+
}]);
|
|
88
|
+
};
|
|
89
|
+
const selectedCount = Object.values(selections).filter(Boolean).length;
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetModal, {
|
|
74
91
|
ref: bottomSheetRef,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
animatedIndex
|
|
81
|
-
}) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
82
|
-
style: [styles.backdrop, {
|
|
83
|
-
opacity: animatedIndex.interpolate({
|
|
84
|
-
inputRange: [0, 1],
|
|
85
|
-
outputRange: [0.5, 0]
|
|
86
|
-
})
|
|
87
|
-
}]
|
|
88
|
-
})
|
|
92
|
+
snapPoints: ['80%'],
|
|
93
|
+
backdropComponent: props => /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetBackdrop, _extends({}, props, {
|
|
94
|
+
appearsOnIndex: 0,
|
|
95
|
+
disappearsOnIndex: -1
|
|
96
|
+
}))
|
|
89
97
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
90
98
|
style: styles.container
|
|
91
99
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
92
100
|
style: styles.header
|
|
93
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
94
|
-
name: "shield",
|
|
95
|
-
size: 24,
|
|
96
|
-
color: _constants.COLORS.primary
|
|
97
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
98
102
|
style: styles.headerTitle
|
|
99
|
-
}, "
|
|
100
|
-
onPress:
|
|
103
|
+
}, "Onairos"), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
104
|
+
onPress: closeOverlay
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
101
106
|
style: styles.closeButton
|
|
102
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
color: "#000"
|
|
106
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
|
|
107
|
+
}, "\xD7")), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
108
|
+
style: styles.username
|
|
109
|
+
}, username)), /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
|
|
107
110
|
style: styles.content
|
|
111
|
+
}, Object.entries(data).map(([key, value]) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
112
|
+
key: key,
|
|
113
|
+
style: styles.card
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
115
|
+
style: styles.checkboxContainer,
|
|
116
|
+
onPress: () => setSelections(prev => ({
|
|
117
|
+
...prev,
|
|
118
|
+
[key]: !prev[key]
|
|
119
|
+
}))
|
|
108
120
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
109
|
-
style: styles.
|
|
121
|
+
style: [styles.checkbox, selections[key] && styles.checkboxSelected]
|
|
122
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
123
|
+
style: styles.cardContent
|
|
110
124
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
111
|
-
style: styles.
|
|
112
|
-
},
|
|
113
|
-
style: styles.
|
|
114
|
-
}, "
|
|
115
|
-
style: styles.
|
|
116
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
117
|
-
name: "security",
|
|
118
|
-
size: 20,
|
|
119
|
-
color: "#666"
|
|
120
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
121
|
-
style: styles.securityText
|
|
122
|
-
}, "Your data is securely processed and never shared with third parties."))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
125
|
+
style: styles.cardTitle
|
|
126
|
+
}, value.type, " Insight"), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
127
|
+
style: styles.cardDescription
|
|
128
|
+
}, "Description: ", value.descriptions), value.reward && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
129
|
+
style: styles.cardReward
|
|
130
|
+
}, "Reward: ", value.reward)))))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
123
131
|
style: styles.footer
|
|
124
132
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
125
|
-
style: styles.
|
|
126
|
-
onPress:
|
|
133
|
+
style: styles.footerButton,
|
|
134
|
+
onPress: closeOverlay
|
|
127
135
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
128
|
-
style: styles.
|
|
129
|
-
}, "
|
|
130
|
-
style: styles.
|
|
131
|
-
|
|
136
|
+
style: styles.footerButtonText
|
|
137
|
+
}, "Cancel")), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
138
|
+
style: styles.selectedCount
|
|
139
|
+
}, "Selected: ", selectedCount), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
140
|
+
style: styles.footerButton,
|
|
141
|
+
onPress: confirmSelection
|
|
132
142
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
133
|
-
style: styles.
|
|
134
|
-
}, "
|
|
135
|
-
name: getBiometricIcon(),
|
|
136
|
-
size: 20,
|
|
137
|
-
color: "#fff",
|
|
138
|
-
style: styles.buttonIcon
|
|
139
|
-
})))));
|
|
143
|
+
style: styles.footerButtonText
|
|
144
|
+
}, "Confirm")))));
|
|
140
145
|
};
|
|
141
146
|
exports.Overlay = Overlay;
|
|
142
147
|
const styles = _reactNative.StyleSheet.create({
|
|
143
148
|
container: {
|
|
144
149
|
flex: 1,
|
|
145
|
-
backgroundColor:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
..._reactNative.StyleSheet.absoluteFillObject,
|
|
149
|
-
backgroundColor: '#000'
|
|
150
|
+
backgroundColor: _constants.COLORS.white,
|
|
151
|
+
borderTopLeftRadius: 10,
|
|
152
|
+
borderTopRightRadius: 10
|
|
150
153
|
},
|
|
151
154
|
header: {
|
|
152
155
|
flexDirection: 'row',
|
|
153
156
|
alignItems: 'center',
|
|
157
|
+
justifyContent: 'space-between',
|
|
154
158
|
padding: 16,
|
|
155
|
-
backgroundColor: _constants.COLORS.
|
|
156
|
-
borderTopLeftRadius:
|
|
157
|
-
borderTopRightRadius:
|
|
159
|
+
backgroundColor: _constants.COLORS.primary,
|
|
160
|
+
borderTopLeftRadius: 10,
|
|
161
|
+
borderTopRightRadius: 10
|
|
158
162
|
},
|
|
159
163
|
headerTitle: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
fontWeight: '
|
|
163
|
-
marginLeft: 12,
|
|
164
|
-
color: '#000'
|
|
164
|
+
fontSize: 24,
|
|
165
|
+
color: _constants.COLORS.white,
|
|
166
|
+
fontWeight: 'bold'
|
|
165
167
|
},
|
|
166
168
|
closeButton: {
|
|
169
|
+
fontSize: 24,
|
|
170
|
+
color: _constants.COLORS.white,
|
|
167
171
|
padding: 8
|
|
168
172
|
},
|
|
173
|
+
username: {
|
|
174
|
+
fontSize: 18,
|
|
175
|
+
color: _constants.COLORS.primary
|
|
176
|
+
},
|
|
169
177
|
content: {
|
|
170
178
|
flex: 1,
|
|
171
179
|
padding: 16
|
|
172
180
|
},
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
card: {
|
|
182
|
+
backgroundColor: _constants.COLORS.white,
|
|
183
|
+
borderRadius: 8,
|
|
184
|
+
marginBottom: 12,
|
|
185
|
+
shadowColor: _constants.COLORS.black,
|
|
186
|
+
shadowOffset: {
|
|
187
|
+
width: 0,
|
|
188
|
+
height: 2
|
|
189
|
+
},
|
|
190
|
+
shadowOpacity: 0.1,
|
|
191
|
+
shadowRadius: 4,
|
|
192
|
+
elevation: 3
|
|
193
|
+
},
|
|
194
|
+
checkboxContainer: {
|
|
195
|
+
flexDirection: 'row',
|
|
196
|
+
padding: 16,
|
|
197
|
+
alignItems: 'center'
|
|
175
198
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
199
|
+
checkbox: {
|
|
200
|
+
width: 24,
|
|
201
|
+
height: 24,
|
|
202
|
+
borderRadius: 4,
|
|
203
|
+
borderWidth: 2,
|
|
204
|
+
borderColor: _constants.COLORS.primary,
|
|
205
|
+
marginRight: 12
|
|
181
206
|
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
color: '#666'
|
|
207
|
+
checkboxSelected: {
|
|
208
|
+
backgroundColor: _constants.COLORS.primary
|
|
185
209
|
},
|
|
186
|
-
|
|
187
|
-
|
|
210
|
+
cardContent: {
|
|
211
|
+
flex: 1
|
|
188
212
|
},
|
|
189
|
-
|
|
213
|
+
cardTitle: {
|
|
190
214
|
fontSize: 18,
|
|
191
|
-
fontWeight: '
|
|
192
|
-
|
|
193
|
-
marginBottom: 12
|
|
194
|
-
},
|
|
195
|
-
itemContainer: {
|
|
196
|
-
flexDirection: 'row',
|
|
197
|
-
marginBottom: 12,
|
|
198
|
-
paddingLeft: 8
|
|
199
|
-
},
|
|
200
|
-
itemContent: {
|
|
201
|
-
flex: 1,
|
|
202
|
-
marginLeft: 12
|
|
203
|
-
},
|
|
204
|
-
itemTitle: {
|
|
205
|
-
fontSize: 16,
|
|
206
|
-
fontWeight: '500',
|
|
207
|
-
color: '#000',
|
|
208
|
-
marginBottom: 2
|
|
215
|
+
fontWeight: 'bold',
|
|
216
|
+
marginBottom: 4
|
|
209
217
|
},
|
|
210
|
-
|
|
218
|
+
cardDescription: {
|
|
211
219
|
fontSize: 14,
|
|
212
|
-
color:
|
|
213
|
-
|
|
214
|
-
securityNotice: {
|
|
215
|
-
flexDirection: 'row',
|
|
216
|
-
alignItems: 'flex-start',
|
|
217
|
-
backgroundColor: '#f5f5f5',
|
|
218
|
-
padding: 12,
|
|
219
|
-
borderRadius: 8,
|
|
220
|
-
marginBottom: 24
|
|
220
|
+
color: _constants.COLORS.gray,
|
|
221
|
+
marginBottom: 4
|
|
221
222
|
},
|
|
222
|
-
|
|
223
|
-
flex: 1,
|
|
223
|
+
cardReward: {
|
|
224
224
|
fontSize: 14,
|
|
225
|
-
color:
|
|
226
|
-
|
|
225
|
+
color: _constants.COLORS.success,
|
|
226
|
+
fontWeight: 'bold'
|
|
227
227
|
},
|
|
228
228
|
footer: {
|
|
229
229
|
flexDirection: 'row',
|
|
230
|
+
justifyContent: 'space-between',
|
|
231
|
+
alignItems: 'center',
|
|
230
232
|
padding: 16,
|
|
231
233
|
borderTopWidth: 1,
|
|
232
|
-
borderTopColor:
|
|
234
|
+
borderTopColor: _constants.COLORS.lightGray
|
|
233
235
|
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
borderWidth: 1,
|
|
240
|
-
borderColor: '#ddd',
|
|
241
|
-
borderRadius: 25,
|
|
242
|
-
marginRight: 8
|
|
236
|
+
footerButton: {
|
|
237
|
+
paddingVertical: 8,
|
|
238
|
+
paddingHorizontal: 16,
|
|
239
|
+
borderRadius: 8,
|
|
240
|
+
backgroundColor: _constants.COLORS.primary
|
|
243
241
|
},
|
|
244
|
-
|
|
242
|
+
footerButtonText: {
|
|
243
|
+
color: _constants.COLORS.white,
|
|
245
244
|
fontSize: 16,
|
|
246
|
-
fontWeight: '600'
|
|
247
|
-
color: '#666'
|
|
245
|
+
fontWeight: '600'
|
|
248
246
|
},
|
|
249
|
-
|
|
250
|
-
flex: 2,
|
|
251
|
-
flexDirection: 'row',
|
|
252
|
-
justifyContent: 'center',
|
|
253
|
-
alignItems: 'center',
|
|
254
|
-
paddingVertical: 12,
|
|
255
|
-
backgroundColor: _constants.COLORS.primary,
|
|
256
|
-
borderRadius: 25,
|
|
257
|
-
marginLeft: 8
|
|
258
|
-
},
|
|
259
|
-
acceptButtonText: {
|
|
247
|
+
selectedCount: {
|
|
260
248
|
fontSize: 16,
|
|
261
|
-
|
|
262
|
-
color: '#fff',
|
|
263
|
-
marginRight: 8
|
|
264
|
-
},
|
|
265
|
-
buttonIcon: {
|
|
266
|
-
marginLeft: 4
|
|
249
|
+
color: _constants.COLORS.gray
|
|
267
250
|
}
|
|
268
251
|
});
|
|
269
252
|
//# sourceMappingURL=Overlay.js.map
|