@onairos/react-native 3.0.2 → 3.0.5
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/README.md +23 -3
- package/lib/commonjs/api/index.js +5 -1
- package/lib/commonjs/api/index.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +5 -3
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/Overlay.js +274 -104
- package/lib/commonjs/components/Overlay.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +12 -0
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/components/onboarding/OAuthWebView.js +28 -9
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js +6 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +1 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js +3 -2
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +1 -1
- package/lib/commonjs/constants/index.js +1 -1
- package/lib/commonjs/hooks/useConnections.js +77 -15
- package/lib/commonjs/hooks/useConnections.js.map +1 -1
- package/lib/commonjs/hooks/useCredentials.js +2 -0
- package/lib/commonjs/hooks/useCredentials.js.map +1 -1
- package/lib/commonjs/index.js +51 -56
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/oauthService.js +26 -51
- package/lib/commonjs/services/oauthService.js.map +1 -1
- package/lib/commonjs/types/ambient.d.js +2 -0
- package/lib/commonjs/types/ambient.d.js.map +1 -0
- package/lib/commonjs/types/node-fix.d.js +2 -0
- package/lib/commonjs/types/node-fix.d.js.map +1 -0
- package/lib/commonjs/types/node-override.d.js +2 -0
- package/lib/commonjs/types/node-override.d.js.map +1 -0
- package/lib/commonjs/types/types.d.js +2 -0
- package/lib/commonjs/types/types.d.js.map +1 -0
- package/lib/commonjs/utils/encryption.js +8 -2
- package/lib/commonjs/utils/encryption.js.map +1 -1
- package/lib/commonjs/utils/secureStorage.js +23 -4
- package/lib/commonjs/utils/secureStorage.js.map +1 -1
- package/lib/module/api/index.js +5 -1
- package/lib/module/api/index.js.map +1 -1
- package/lib/module/components/OnairosButton.js +6 -4
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/Overlay.js +275 -107
- package/lib/module/components/Overlay.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +12 -0
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/components/onboarding/OAuthWebView.js +28 -9
- package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/module/components/onboarding/PlatformConnector.js +6 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +1 -1
- package/lib/module/components/screens/ConnectorScreen.js +3 -2
- package/lib/module/components/screens/ConnectorScreen.js.map +1 -1
- package/lib/module/constants/index.js +1 -1
- package/lib/module/hooks/useConnections.js +77 -14
- package/lib/module/hooks/useConnections.js.map +1 -1
- package/lib/module/hooks/useCredentials.js +2 -0
- package/lib/module/hooks/useCredentials.js.map +1 -1
- package/lib/module/index.js +27 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/oauthService.js +26 -33
- package/lib/module/services/oauthService.js.map +1 -1
- package/lib/module/types/ambient.d.js +2 -0
- package/lib/module/types/ambient.d.js.map +1 -0
- package/lib/module/types/node-fix.d.js +2 -0
- package/lib/module/types/node-fix.d.js.map +1 -0
- package/lib/module/types/node-override.d.js +2 -0
- package/lib/module/types/node-override.d.js.map +1 -0
- package/lib/module/types/types.d.js +2 -0
- package/lib/module/types/types.d.js.map +1 -0
- package/lib/module/utils/encryption.js +8 -2
- package/lib/module/utils/encryption.js.map +1 -1
- package/lib/module/utils/secureStorage.js +23 -3
- package/lib/module/utils/secureStorage.js.map +1 -1
- package/lib/typescript/api/index.d.ts +8 -0
- package/lib/typescript/api/index.d.ts.map +1 -0
- package/lib/typescript/components/DataRequestModal.d.ts +11 -0
- package/lib/typescript/components/DataRequestModal.d.ts.map +1 -0
- package/lib/typescript/components/Onairos.d.ts +29 -0
- package/lib/typescript/components/Onairos.d.ts.map +1 -0
- package/lib/typescript/components/OnairosButton.d.ts +7 -0
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -0
- package/lib/typescript/components/Overlay.d.ts +18 -0
- package/lib/typescript/components/Overlay.d.ts.map +1 -0
- package/lib/typescript/components/PinInput.d.ts +4 -0
- package/lib/typescript/components/PinInput.d.ts.map +1 -0
- package/lib/typescript/components/PlatformList.d.ts +4 -0
- package/lib/typescript/components/PlatformList.d.ts.map +1 -0
- package/lib/typescript/components/TrainingModal.d.ts +4 -0
- package/lib/typescript/components/TrainingModal.d.ts.map +1 -0
- package/lib/typescript/components/UniversalOnboarding.d.ts +4 -0
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +4 -0
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +11 -0
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/PinInput.d.ts +4 -0
- package/lib/typescript/components/onboarding/PinInput.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +13 -0
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +1 -0
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +9 -0
- package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/LoadingScreen.d.ts +9 -0
- package/lib/typescript/components/screens/LoadingScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +10 -0
- package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +1 -0
- package/lib/typescript/constants/index.d.ts +52 -0
- package/lib/typescript/constants/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useConnections.d.ts +9 -0
- package/lib/typescript/hooks/useConnections.d.ts.map +1 -0
- package/lib/typescript/hooks/useCredentials.d.ts +9 -0
- package/lib/typescript/hooks/useCredentials.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +45 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/services/oauthService.d.ts +50 -0
- package/lib/typescript/services/oauthService.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +145 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +135 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/api.d.ts +6 -0
- package/lib/typescript/utils/api.d.ts.map +1 -0
- package/lib/typescript/utils/auth.d.ts +6 -0
- package/lib/typescript/utils/auth.d.ts.map +1 -0
- package/lib/typescript/utils/crypto.d.ts +4 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -0
- package/lib/typescript/utils/debugHelper.d.ts +29 -0
- package/lib/typescript/utils/debugHelper.d.ts.map +1 -0
- package/lib/typescript/utils/encryption.d.ts +19 -0
- package/lib/typescript/utils/encryption.d.ts.map +1 -0
- package/lib/typescript/utils/onairosApi.d.ts +72 -0
- package/lib/typescript/utils/onairosApi.d.ts.map +1 -0
- package/lib/typescript/utils/secureStorage.d.ts +63 -0
- package/lib/typescript/utils/secureStorage.d.ts.map +1 -0
- package/package.json +16 -4
- package/src/api/index.ts +11 -11
- package/src/components/OnairosButton.tsx +5 -3
- package/src/components/Overlay.tsx +319 -135
- package/src/components/UniversalOnboarding.tsx +12 -0
- package/src/components/onboarding/OAuthWebView.tsx +27 -7
- package/src/components/onboarding/PlatformConnector.tsx +5 -0
- package/src/components/screens/ConnectorScreen.tsx +3 -2
- package/src/constants/index.ts +81 -81
- package/src/hooks/useConnections.ts +76 -16
- package/src/hooks/useCredentials.ts +5 -1
- package/src/index.ts +29 -1
- package/src/services/oauthService.ts +412 -419
- package/src/types/ambient.d.ts +29 -0
- package/src/types/index.d.ts +48 -8
- package/src/types/index.ts +21 -15
- package/src/types/node-fix.d.ts +19 -0
- package/src/types/node-override.d.ts +24 -0
- package/src/types/types.d.ts +18 -0
- package/src/types.ts +121 -1
- package/src/utils/encryption.ts +7 -2
- package/src/utils/secureStorage.ts +25 -9
- package/types/index.d.ts +210 -0
- package/types/node-env.d.ts +15 -0
package/src/api/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
1
|
+
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import { API_ENDPOINTS } from '../constants';
|
|
4
4
|
|
|
@@ -8,8 +8,8 @@ const isDevelopmentMode = () => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// Create mock response helper
|
|
11
|
-
const createMockResponse = (data:
|
|
12
|
-
return Promise.resolve({ data });
|
|
11
|
+
const createMockResponse = <T>(data: T): Promise<AxiosResponse<T>> => {
|
|
12
|
+
return Promise.resolve({ data, status: 200, statusText: 'OK', headers: {}, config: {} as any });
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
// Create API instance
|
|
@@ -37,31 +37,31 @@ apiInstance.interceptors.response.use(
|
|
|
37
37
|
// API service with Expo compatibility
|
|
38
38
|
export const onairosApi = {
|
|
39
39
|
// Core API methods with fallbacks
|
|
40
|
-
async get(url: string) {
|
|
40
|
+
async get<T = any>(url: string): Promise<AxiosResponse<T>> {
|
|
41
41
|
try {
|
|
42
42
|
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
43
|
-
return createMockResponse({ success: true, data: { mockData: true } });
|
|
43
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
44
44
|
}
|
|
45
|
-
return await apiInstance.get(url);
|
|
45
|
+
return await apiInstance.get<T>(url);
|
|
46
46
|
} catch (error) {
|
|
47
47
|
console.error(`GET ${url} error:`, error);
|
|
48
48
|
if (isDevelopmentMode()) {
|
|
49
|
-
return createMockResponse({ success: true, data: { mockData: true } });
|
|
49
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
50
50
|
}
|
|
51
51
|
throw error;
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
|
|
55
|
-
async post(url: string, data: any) {
|
|
55
|
+
async post<T = any>(url: string, data: any): Promise<AxiosResponse<T>> {
|
|
56
56
|
try {
|
|
57
57
|
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
58
|
-
return createMockResponse({ success: true, data: { mockData: true } });
|
|
58
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
59
59
|
}
|
|
60
|
-
return await apiInstance.post(url, data);
|
|
60
|
+
return await apiInstance.post<T>(url, data);
|
|
61
61
|
} catch (error) {
|
|
62
62
|
console.error(`POST ${url} error:`, error);
|
|
63
63
|
if (isDevelopmentMode()) {
|
|
64
|
-
return createMockResponse({ success: true, data: { mockData: true } });
|
|
64
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
65
65
|
}
|
|
66
66
|
throw error;
|
|
67
67
|
}
|
|
@@ -146,8 +146,9 @@ export const OnairosButton: React.FC<OnairosButtonProps> = ({
|
|
|
146
146
|
!enabled && styles.disabledText
|
|
147
147
|
].filter(Boolean) as TextStyle[];
|
|
148
148
|
|
|
149
|
+
// Render components
|
|
149
150
|
return (
|
|
150
|
-
|
|
151
|
+
<>
|
|
151
152
|
<TouchableOpacity
|
|
152
153
|
style={buttonStyle}
|
|
153
154
|
onPress={handlePress}
|
|
@@ -167,6 +168,7 @@ export const OnairosButton: React.FC<OnairosButtonProps> = ({
|
|
|
167
168
|
)}
|
|
168
169
|
</TouchableOpacity>
|
|
169
170
|
|
|
171
|
+
{/* Overlay and Onboarding components rendered outside the button */}
|
|
170
172
|
{showOnboarding && (
|
|
171
173
|
<UniversalOnboarding
|
|
172
174
|
visible={showOnboarding}
|
|
@@ -178,7 +180,6 @@ export const OnairosButton: React.FC<OnairosButtonProps> = ({
|
|
|
178
180
|
requestData={requestData}
|
|
179
181
|
returnLink={returnLink}
|
|
180
182
|
onComplete={handleOnboardingComplete}
|
|
181
|
-
preferredPlatform={preferredPlatform}
|
|
182
183
|
debug={debug}
|
|
183
184
|
test={testMode}
|
|
184
185
|
/>
|
|
@@ -190,9 +191,10 @@ export const OnairosButton: React.FC<OnairosButtonProps> = ({
|
|
|
190
191
|
username={storedCredentials.username}
|
|
191
192
|
modelKey={storedCredentials.userPin || ''}
|
|
192
193
|
onResolved={handleOverlayResolved}
|
|
194
|
+
appName={AppName}
|
|
193
195
|
/>
|
|
194
196
|
)}
|
|
195
|
-
|
|
197
|
+
</>
|
|
196
198
|
);
|
|
197
199
|
};
|
|
198
200
|
|