@onairos/react-native 3.0.1 → 3.0.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/commonjs/api/index.js +105 -86
- package/lib/commonjs/api/index.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +20 -12
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +18 -0
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/secureStorage.js +129 -42
- package/lib/commonjs/utils/secureStorage.js.map +1 -1
- package/lib/module/api/index.js +105 -86
- package/lib/module/api/index.js.map +1 -1
- package/lib/module/components/OnairosButton.js +21 -13
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +19 -1
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/utils/secureStorage.js +129 -42
- package/lib/module/utils/secureStorage.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +86 -101
- package/src/components/OnairosButton.tsx +22 -13
- package/src/components/UniversalOnboarding.tsx +13 -0
- package/src/index.ts +1 -2
- package/src/utils/secureStorage.ts +140 -57
|
@@ -4,18 +4,113 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.verifyCredentials = exports.updateCredentials = exports.storeCredentials = exports.hasCredentials = exports.getCredentials = exports.generateDeviceUsername = exports.deleteCredentials = void 0;
|
|
7
|
+
var Keychain = _interopRequireWildcard(require("react-native-keychain"));
|
|
7
8
|
var _reactNative = require("react-native");
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
var _constants = require("../constants");
|
|
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); }
|
|
11
|
+
// Define OnairosCredentials interface locally to avoid circular dependencies
|
|
12
|
+
|
|
13
|
+
// Create a mock storage for environments without Keychain access (like Expo Go)
|
|
14
|
+
const mockStorage = {};
|
|
15
|
+
|
|
16
|
+
// Check if running in Expo Go or environments without native module access
|
|
17
|
+
const isKeychainAvailable = () => {
|
|
18
|
+
try {
|
|
19
|
+
return typeof Keychain.getGenericPassword === 'function';
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Wrapper for getGenericPassword that falls back to mock storage
|
|
26
|
+
const safeGetGenericPassword = async options => {
|
|
27
|
+
try {
|
|
28
|
+
if (isKeychainAvailable()) {
|
|
29
|
+
return await Keychain.getGenericPassword(options);
|
|
30
|
+
} else {
|
|
31
|
+
// Fall back to mock storage in memory
|
|
32
|
+
const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
|
|
33
|
+
return mockStorage[key] || null;
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.warn('Keychain access failed, using mock storage', error);
|
|
37
|
+
// Fall back to mock storage on error
|
|
38
|
+
const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
|
|
39
|
+
return mockStorage[key] || null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Wrapper for setGenericPassword that falls back to mock storage
|
|
44
|
+
const safeSetGenericPassword = async (username, password, options) => {
|
|
45
|
+
try {
|
|
46
|
+
if (isKeychainAvailable()) {
|
|
47
|
+
return await Keychain.setGenericPassword(username, password, options);
|
|
48
|
+
} else {
|
|
49
|
+
// Fall back to mock storage in memory
|
|
50
|
+
const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
|
|
51
|
+
mockStorage[key] = {
|
|
52
|
+
username,
|
|
53
|
+
password
|
|
54
|
+
};
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.warn('Keychain access failed, using mock storage', error);
|
|
59
|
+
// Fall back to mock storage on error
|
|
60
|
+
const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
|
|
61
|
+
mockStorage[key] = {
|
|
62
|
+
username,
|
|
63
|
+
password
|
|
64
|
+
};
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Wrapper for resetGenericPassword that falls back to mock storage
|
|
70
|
+
const safeResetGenericPassword = async options => {
|
|
71
|
+
try {
|
|
72
|
+
if (isKeychainAvailable()) {
|
|
73
|
+
return await Keychain.resetGenericPassword(options);
|
|
74
|
+
} else {
|
|
75
|
+
// Fall back to mock storage in memory
|
|
76
|
+
const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
|
|
77
|
+
delete mockStorage[key];
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn('Keychain access failed, using mock storage', error);
|
|
82
|
+
// Fall back to mock storage on error
|
|
83
|
+
const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
|
|
84
|
+
delete mockStorage[key];
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
11
88
|
|
|
12
89
|
/**
|
|
13
90
|
* Store credentials in memory (temporary solution)
|
|
14
91
|
*/
|
|
15
|
-
const storeCredentials = async
|
|
92
|
+
const storeCredentials = async credentials => {
|
|
16
93
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
94
|
+
const existingCredentials = await getCredentials();
|
|
95
|
+
const updatedCredentials = {
|
|
96
|
+
...existingCredentials,
|
|
97
|
+
...credentials,
|
|
98
|
+
createdAt: (existingCredentials === null || existingCredentials === void 0 ? void 0 : existingCredentials.createdAt) || Date.now()
|
|
99
|
+
};
|
|
100
|
+
const username = updatedCredentials.username;
|
|
101
|
+
if (!username) {
|
|
102
|
+
throw new Error('Username is required for storing credentials');
|
|
103
|
+
}
|
|
104
|
+
const options = {
|
|
105
|
+
service: _constants.STORAGE_KEYS.credentials
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Only use secure storage options on real devices
|
|
109
|
+
if (_reactNative.Platform.OS !== 'web' && isKeychainAvailable()) {
|
|
110
|
+
options.accessControl = Keychain.ACCESS_CONTROL.BIOMETRY_ANY_OR_DEVICE_PASSCODE;
|
|
111
|
+
options.accessible = Keychain.ACCESSIBLE.WHEN_UNLOCKED;
|
|
112
|
+
}
|
|
113
|
+
await safeSetGenericPassword(username, JSON.stringify(updatedCredentials), options);
|
|
19
114
|
return true;
|
|
20
115
|
} catch (error) {
|
|
21
116
|
console.error('Error storing credentials:', error);
|
|
@@ -27,16 +122,17 @@ const storeCredentials = async (credentials, options = {}) => {
|
|
|
27
122
|
* Retrieve credentials from memory (temporary solution)
|
|
28
123
|
*/
|
|
29
124
|
exports.storeCredentials = storeCredentials;
|
|
30
|
-
const getCredentials = async (
|
|
125
|
+
const getCredentials = async () => {
|
|
31
126
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
127
|
+
const credentials = await safeGetGenericPassword({
|
|
128
|
+
service: _constants.STORAGE_KEYS.credentials
|
|
129
|
+
});
|
|
130
|
+
if (credentials) {
|
|
131
|
+
return JSON.parse(credentials.password);
|
|
36
132
|
}
|
|
37
|
-
return
|
|
133
|
+
return null;
|
|
38
134
|
} catch (error) {
|
|
39
|
-
console.error('Error
|
|
135
|
+
console.error('Error getting credentials:', error);
|
|
40
136
|
return null;
|
|
41
137
|
}
|
|
42
138
|
};
|
|
@@ -47,9 +143,12 @@ const getCredentials = async (options = {}) => {
|
|
|
47
143
|
exports.getCredentials = getCredentials;
|
|
48
144
|
const hasCredentials = async () => {
|
|
49
145
|
try {
|
|
50
|
-
|
|
146
|
+
const credentials = await safeGetGenericPassword({
|
|
147
|
+
service: _constants.STORAGE_KEYS.credentials
|
|
148
|
+
});
|
|
149
|
+
return !!credentials;
|
|
51
150
|
} catch (error) {
|
|
52
|
-
console.error('Error checking
|
|
151
|
+
console.error('Error checking credentials:', error);
|
|
53
152
|
return false;
|
|
54
153
|
}
|
|
55
154
|
};
|
|
@@ -60,7 +159,9 @@ const hasCredentials = async () => {
|
|
|
60
159
|
exports.hasCredentials = hasCredentials;
|
|
61
160
|
const deleteCredentials = async () => {
|
|
62
161
|
try {
|
|
63
|
-
|
|
162
|
+
await safeResetGenericPassword({
|
|
163
|
+
service: _constants.STORAGE_KEYS.credentials
|
|
164
|
+
});
|
|
64
165
|
return true;
|
|
65
166
|
} catch (error) {
|
|
66
167
|
console.error('Error deleting credentials:', error);
|
|
@@ -72,45 +173,31 @@ const deleteCredentials = async () => {
|
|
|
72
173
|
* Update specific fields in the stored credentials
|
|
73
174
|
*/
|
|
74
175
|
exports.deleteCredentials = deleteCredentials;
|
|
75
|
-
const updateCredentials = async
|
|
76
|
-
|
|
77
|
-
const currentCredentials = await getCredentials(options);
|
|
78
|
-
if (!currentCredentials) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const updatedCredentials = {
|
|
82
|
-
...currentCredentials,
|
|
83
|
-
...updates
|
|
84
|
-
};
|
|
85
|
-
return await storeCredentials(updatedCredentials, options);
|
|
86
|
-
} catch (error) {
|
|
87
|
-
console.error('Error updating credentials:', error);
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
176
|
+
const updateCredentials = async credentials => {
|
|
177
|
+
return storeCredentials(credentials);
|
|
90
178
|
};
|
|
91
179
|
|
|
92
180
|
/**
|
|
93
181
|
* Generate a device-specific unique username
|
|
94
182
|
*/
|
|
95
183
|
exports.updateCredentials = updateCredentials;
|
|
96
|
-
const generateDeviceUsername =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const username = `onairos_${(0, _crypto.sha256)(deviceInfo).substring(0, 10)}`;
|
|
100
|
-
return username;
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error('Error generating device username:', error);
|
|
103
|
-
return `onairos_${Date.now().toString(36)}`;
|
|
104
|
-
}
|
|
184
|
+
const generateDeviceUsername = () => {
|
|
185
|
+
const randomId = Math.random().toString(36).substring(2, 10);
|
|
186
|
+
return `dev_${randomId}`;
|
|
105
187
|
};
|
|
106
188
|
|
|
107
189
|
/**
|
|
108
190
|
* Verify credentials (temporary mock implementation)
|
|
109
191
|
*/
|
|
110
192
|
exports.generateDeviceUsername = generateDeviceUsername;
|
|
111
|
-
const verifyCredentials = async
|
|
193
|
+
const verifyCredentials = async username => {
|
|
112
194
|
try {
|
|
113
|
-
|
|
195
|
+
// For Expo Go or development, always return true
|
|
196
|
+
if (!isKeychainAvailable()) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// TODO: Implement actual verification with API
|
|
114
201
|
return true;
|
|
115
202
|
} catch (error) {
|
|
116
203
|
console.error('Error verifying credentials:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Keychain","_interopRequireWildcard","require","_reactNative","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","mockStorage","isKeychainAvailable","getGenericPassword","safeGetGenericPassword","options","key","service","error","console","warn","safeSetGenericPassword","username","password","setGenericPassword","safeResetGenericPassword","resetGenericPassword","storeCredentials","credentials","existingCredentials","getCredentials","updatedCredentials","createdAt","Date","now","Error","STORAGE_KEYS","Platform","OS","accessControl","ACCESS_CONTROL","BIOMETRY_ANY_OR_DEVICE_PASSCODE","accessible","ACCESSIBLE","WHEN_UNLOCKED","JSON","stringify","exports","parse","hasCredentials","deleteCredentials","updateCredentials","generateDeviceUsername","randomId","Math","random","toString","substring","verifyCredentials"],"sourceRoot":"..\\..\\..\\src","sources":["utils/secureStorage.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAA4C,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAE5C;;AAqBA;AACA,MAAMkB,WAAmE,GAAG,CAAC,CAAC;;AAE9E;A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OAAO,IAAI;EACb,CAAC,CAAC,OAAOM,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,8BAA8B,EAAEA,KAAK,CAAC;IACpD,OAAO,KAAK;EACd;AACF,CAAC;AAAC6B,OAAA,CAAAW,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/lib/module/api/index.js
CHANGED
|
@@ -1,114 +1,133 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { API_ENDPOINTS } from '../constants';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
// Check if running in development mode
|
|
6
|
+
const isDevelopmentMode = () => {
|
|
7
|
+
return __DEV__ || process.env.NODE_ENV === 'development';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Create mock response helper
|
|
11
|
+
const createMockResponse = data => {
|
|
12
|
+
return Promise.resolve({
|
|
13
|
+
data
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Create API instance
|
|
18
|
+
const apiInstance = axios.create({
|
|
19
|
+
baseURL: API_ENDPOINTS.base,
|
|
20
|
+
timeout: 10000,
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'Accept': 'application/json'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Add error handling interceptor
|
|
28
|
+
apiInstance.interceptors.response.use(response => response, error => {
|
|
29
|
+
if (isDevelopmentMode()) {
|
|
30
|
+
console.warn('API error in development mode, using fallback:', error);
|
|
31
|
+
return createMockResponse({
|
|
32
|
+
success: true,
|
|
33
|
+
data: {
|
|
34
|
+
mockData: true
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return Promise.reject(error);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// API service with Expo compatibility
|
|
6
42
|
export const onairosApi = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Make a GET request to the API
|
|
10
|
-
* @param endpoint The endpoint to request
|
|
11
|
-
* @returns The response data
|
|
12
|
-
*/
|
|
13
|
-
get: async endpoint => {
|
|
43
|
+
// Core API methods with fallbacks
|
|
44
|
+
async get(url) {
|
|
14
45
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
46
|
+
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
47
|
+
return createMockResponse({
|
|
48
|
+
success: true,
|
|
49
|
+
data: {
|
|
50
|
+
mockData: true
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return await apiInstance.get(url);
|
|
17
55
|
} catch (error) {
|
|
18
|
-
console.error(`GET ${
|
|
56
|
+
console.error(`GET ${url} error:`, error);
|
|
57
|
+
if (isDevelopmentMode()) {
|
|
58
|
+
return createMockResponse({
|
|
59
|
+
success: true,
|
|
60
|
+
data: {
|
|
61
|
+
mockData: true
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
19
65
|
throw error;
|
|
20
66
|
}
|
|
21
67
|
},
|
|
22
|
-
|
|
23
|
-
* Make a POST request to the API
|
|
24
|
-
* @param endpoint The endpoint to request
|
|
25
|
-
* @param data The data to send
|
|
26
|
-
* @returns The response data
|
|
27
|
-
*/
|
|
28
|
-
post: async (endpoint, data) => {
|
|
68
|
+
async post(url, data) {
|
|
29
69
|
try {
|
|
30
|
-
|
|
31
|
-
|
|
70
|
+
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
71
|
+
return createMockResponse({
|
|
72
|
+
success: true,
|
|
73
|
+
data: {
|
|
74
|
+
mockData: true
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return await apiInstance.post(url, data);
|
|
32
79
|
} catch (error) {
|
|
33
|
-
console.error(`POST ${
|
|
80
|
+
console.error(`POST ${url} error:`, error);
|
|
81
|
+
if (isDevelopmentMode()) {
|
|
82
|
+
return createMockResponse({
|
|
83
|
+
success: true,
|
|
84
|
+
data: {
|
|
85
|
+
mockData: true
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
34
89
|
throw error;
|
|
35
90
|
}
|
|
36
91
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* @returns The server's public key
|
|
40
|
-
*/
|
|
41
|
-
getServerPublicKey: async () => {
|
|
92
|
+
// Helper methods for specific API endpoints
|
|
93
|
+
async validateCredentials(username) {
|
|
42
94
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* Validate credentials with the server
|
|
52
|
-
* @param username The username to validate
|
|
53
|
-
* @returns Whether the credentials are valid
|
|
54
|
-
*/
|
|
55
|
-
validateCredentials: async username => {
|
|
56
|
-
try {
|
|
57
|
-
const response = await onairosApi.post('validate', {
|
|
95
|
+
var _response$data;
|
|
96
|
+
if (isDevelopmentMode()) {
|
|
97
|
+
console.log('Using mock validation for:', username);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
const response = await this.post('validate', {
|
|
58
101
|
username
|
|
59
102
|
});
|
|
60
|
-
return response.
|
|
103
|
+
return ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.success) || false;
|
|
61
104
|
} catch (error) {
|
|
62
105
|
console.error('Error validating credentials:', error);
|
|
63
|
-
return
|
|
106
|
+
return isDevelopmentMode(); // Return true in dev mode to allow flow to continue
|
|
64
107
|
}
|
|
65
108
|
},
|
|
66
|
-
|
|
67
|
-
* Get account information for a user
|
|
68
|
-
* @param username The username to get account info for
|
|
69
|
-
* @returns The account information
|
|
70
|
-
*/
|
|
71
|
-
getAccountInfo: async username => {
|
|
109
|
+
async getUserProfile(token) {
|
|
72
110
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
username
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return response.AccountInfo;
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error('Error getting account info:', error);
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* Get API URL and token for a user
|
|
86
|
-
* @param params The parameters for the request
|
|
87
|
-
* @returns The API URL and token
|
|
88
|
-
*/
|
|
89
|
-
getApiUrl: async params => {
|
|
90
|
-
try {
|
|
91
|
-
const response = await onairosApi.post('getAPIUrlMobile', {
|
|
92
|
-
Info: {
|
|
93
|
-
storage: 'local',
|
|
94
|
-
appId: params.appId,
|
|
95
|
-
confirmations: params.confirmations,
|
|
96
|
-
developerURL: 'devURL',
|
|
97
|
-
EncryptedUserPin: params.encryptedModelKey,
|
|
98
|
-
account: params.username,
|
|
99
|
-
proofMode: false
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
if (response && response.apiUrl && response.token) {
|
|
111
|
+
var _response$data2;
|
|
112
|
+
if (isDevelopmentMode()) {
|
|
103
113
|
return {
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
username: 'demo_user',
|
|
115
|
+
platforms: ['instagram', 'youtube'],
|
|
116
|
+
createdAt: Date.now()
|
|
106
117
|
};
|
|
107
|
-
} else {
|
|
108
|
-
throw new Error('Invalid response from getAPIUrlMobile');
|
|
109
118
|
}
|
|
119
|
+
apiInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
120
|
+
const response = await this.get('user/profile');
|
|
121
|
+
return (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.data;
|
|
110
122
|
} catch (error) {
|
|
111
|
-
console.error('Error
|
|
123
|
+
console.error('Error fetching user profile:', error);
|
|
124
|
+
if (isDevelopmentMode()) {
|
|
125
|
+
return {
|
|
126
|
+
username: 'demo_user',
|
|
127
|
+
platforms: ['instagram', 'youtube'],
|
|
128
|
+
createdAt: Date.now()
|
|
129
|
+
};
|
|
130
|
+
}
|
|
112
131
|
throw error;
|
|
113
132
|
}
|
|
114
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["axios","
|
|
1
|
+
{"version":3,"names":["axios","Platform","API_ENDPOINTS","isDevelopmentMode","__DEV__","process","env","NODE_ENV","createMockResponse","data","Promise","resolve","apiInstance","create","baseURL","base","timeout","headers","interceptors","response","use","error","console","warn","success","mockData","reject","onairosApi","get","url","OS","post","validateCredentials","username","_response$data","log","getUserProfile","token","_response$data2","platforms","createdAt","Date","now","defaults","common"],"sourceRoot":"..\\..\\..\\src","sources":["api/index.ts"],"mappings":"AAAA,OAAOA,KAAK,MAA6C,OAAO;AAChE,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,aAAa,QAAQ,cAAc;;AAE5C;AACA,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,OAAOC,OAAO,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa;AAC1D,CAAC;;AAED;AACA,MAAMC,kBAAkB,GAAIC,IAAS,IAAK;EACxC,OAAOC,OAAO,CAACC,OAAO,CAAC;IAAEF;EAAK,CAAC,CAAC;AAClC,CAAC;;AAED;AACA,MAAMG,WAA0B,GAAGZ,KAAK,CAACa,MAAM,CAAC;EAC9CC,OAAO,EAAEZ,aAAa,CAACa,IAAI;EAC3BC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE;IACP,cAAc,EAAE,kBAAkB;IAClC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;;AAEF;AACAL,WAAW,CAACM,YAAY,CAACC,QAAQ,CAACC,GAAG,CAClCD,QAAQ,IAAKA,QAAQ,EACrBE,KAAK,IAAK;EACT,IAAIlB,iBAAiB,CAAC,CAAC,EAAE;IACvBmB,OAAO,CAACC,IAAI,CAAC,gDAAgD,EAAEF,KAAK,CAAC;IACrE,OAAOb,kBAAkB,CAAC;MAAEgB,OAAO,EAAE,IAAI;MAAEf,IAAI,EAAE;QAAEgB,QAAQ,EAAE;MAAK;IAAE,CAAC,CAAC;EACxE;EACA,OAAOf,OA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,OAAOY,KAAK,EAAE;MACdC,OAAO,CAACD,KAAK,CAAC,8BAA8B,EAAEA,KAAK,CAAC;MACpD,IAAIlB,iBAAiB,CAAC,CAAC,EAAE;QACvB,OAAO;UACL8B,QAAQ,EAAE,WAAW;UACrBM,SAAS,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;UACnCC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC;QACtB,CAAC;MACH;MACA,MAAMrB,KAAK;IACb;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import { TouchableOpacity, Text, StyleSheet, View, ActivityIndicator
|
|
2
|
+
import { TouchableOpacity, Text, StyleSheet, View, ActivityIndicator } from 'react-native';
|
|
3
3
|
import { UniversalOnboarding } from './UniversalOnboarding';
|
|
4
4
|
import { Overlay } from './Overlay';
|
|
5
5
|
import { hasCredentials, getCredentials, deleteCredentials as clearCredentials } from '../utils/secureStorage';
|
|
@@ -41,6 +41,7 @@ export const OnairosButton = ({
|
|
|
41
41
|
const shouldProceed = await preCheck();
|
|
42
42
|
if (!shouldProceed) {
|
|
43
43
|
onRejection === null || onRejection === void 0 || onRejection('Precheck validation failed');
|
|
44
|
+
setIsLoading(false);
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -50,32 +51,39 @@ export const OnairosButton = ({
|
|
|
50
51
|
if (hasStoredCreds) {
|
|
51
52
|
// If credentials exist, fetch them and verify
|
|
52
53
|
const credentials = await getCredentials();
|
|
53
|
-
if (!credentials || !credentials.username
|
|
54
|
+
if (!credentials || !credentials.username) {
|
|
54
55
|
// Invalid credentials, clear and start fresh
|
|
55
56
|
await clearCredentials();
|
|
56
57
|
setShowOnboarding(true);
|
|
58
|
+
setIsLoading(false);
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
61
|
+
try {
|
|
62
|
+
// Validate credentials with server - catch errors here to prevent crashing
|
|
63
|
+
const isValid = await onairosApi.validateCredentials(credentials.username);
|
|
64
|
+
if (!isValid) {
|
|
65
|
+
// Clear invalid credentials
|
|
66
|
+
await clearCredentials();
|
|
67
|
+
setShowOnboarding(true);
|
|
68
|
+
setIsLoading(false);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
// Store and display overlay with valid credentials
|
|
73
|
+
setStoredCredentials(credentials);
|
|
74
|
+
setShowOverlay(true);
|
|
75
|
+
} catch (validationError) {
|
|
76
|
+
console.warn('Validation error, proceeding to onboarding:', validationError);
|
|
65
77
|
setShowOnboarding(true);
|
|
66
|
-
return;
|
|
67
78
|
}
|
|
68
|
-
|
|
69
|
-
// Store and display overlay with valid credentials
|
|
70
|
-
setStoredCredentials(credentials);
|
|
71
|
-
setShowOverlay(true);
|
|
72
79
|
} else {
|
|
73
80
|
// If no credentials, show onboarding
|
|
74
81
|
setShowOnboarding(true);
|
|
75
82
|
}
|
|
76
83
|
} catch (error) {
|
|
77
84
|
console.error('Error during button press flow:', error);
|
|
78
|
-
|
|
85
|
+
// Fall back to onboarding on error
|
|
86
|
+
setShowOnboarding(true);
|
|
79
87
|
onRejection === null || onRejection === void 0 || onRejection(error instanceof Error ? error.message : 'Unknown error');
|
|
80
88
|
} finally {
|
|
81
89
|
setIsLoading(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useCallback","TouchableOpacity","Text","StyleSheet","View","ActivityIndicator","
|
|
1
|
+
{"version":3,"names":["React","useState","useCallback","TouchableOpacity","Text","StyleSheet","View","ActivityIndicator","UniversalOnboarding","Overlay","hasCredentials","getCredentials","deleteCredentials","clearCredentials","onairosApi","OnairosButton","returnLink","prefillUrl","AppName","buttonType","requestData","buttonWidth","buttonHeight","hasStroke","enabled","buttonForm","onRejection","onResolved","preCheck","color","swerv","debug","preferredPlatform","testMode","showOnboarding","setShowOnboarding","showOverlay","setShowOverlay","storedCredentials","setStoredCredentials","isLoading","setIsLoading","isDarkMode","handlePress","shouldProceed","hasStoredCreds","credentials","username","isValid","validateCredentials","validationError","console","warn","error","Error","message","handleOnboardingComplete","apiUrl","token","data","handleOverlayResolved","buttonStyle","styles","button","pillButton","strokedButton","width","height","backgroundColor","darkButton","lightButton","swervButton","disabledButton","filter","Boolean","textStyle","buttonText","lightText","darkText","disabledText","createElement","style","onPress","disabled","accessibilityLabel","size","Fragment","visible","onClose","onComplete","test","modelKey","userPin","create","flexDirection","alignItems","justifyContent","paddingVertical","paddingHorizontal","borderRadius","borderWidth","borderColor","transform","rotate","opacity","fontSize","fontWeight","textAlign"],"sourceRoot":"..\\..\\..\\src","sources":["components/OnairosButton.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACpD,SACEC,gBAAgB,EAChBC,IAAI,EACJC,UAAU,EACVC,IAAI,EAIJC,iBAAiB,QAEZ,cAAc;AACrB,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,OAAO,QAAQ,WAAW;AAGnC,SAASC,cAAc,EAAEC,cAAc,EAAEC,iBAAiB,IAAIC,gBAAgB,QAAQ,wBAAwB;AAC9G,SAASC,UAAU,QAAQ,QAAQ;;AAEnC;AACA;AACA;AACA,OAAO,MAAMC,aAA2C,GAAGA,CAAC;EAC1DC,UAAU;EACVC,UAAU;EACVC,OAAO;EACPC,UAAU,GAAG,QAAQ;EACrBC,WAAW;EACXC,WAAW,GAAG,GAAG;EACjBC,YAAY,GAAG,EAAE;EACjBC,SAAS,GAAG,IAAI;EAChBC,OAAO,GAAG,IAAI;EACdC,UAAU,GAAG,SAAS;EACtBC,WAAW;EACXC,UAAU;EACVC,QAAQ;EACRC,KAAK;EACLC,KAAK,GAAG,KAAK;EACbC,KAAK,GAAG,KAAK;EACbC,iBAAiB;EACjBC,QAAQ,GAAG;AACb,CAAC,KAAK;EACJ,MAAM,C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