@onairos/react-native 3.1.16 → 3.1.17
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 +404 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -3
- package/lib/commonjs/assets/images/EnochE.svg +19 -19
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -3
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -3
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -3
- package/lib/commonjs/assets/images/arrow.svg +20 -20
- package/lib/commonjs/assets/images/basicproficon.svg +43 -43
- package/lib/commonjs/assets/images/basicprofile.svg +3 -3
- package/lib/commonjs/assets/images/checkmark.svg +4 -4
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -3
- package/lib/commonjs/assets/images/contenticon.svg +23 -23
- package/lib/commonjs/assets/images/personalityicon.svg +18 -18
- package/lib/commonjs/assets/images/x-close.svg +3 -3
- package/lib/commonjs/components/OnairosButton.js +290 -0
- package/lib/commonjs/components/OnairosButton.js.map +1 -0
- package/lib/commonjs/components/OnairosSignInButton.js +30 -8
- package/lib/commonjs/components/OnairosSignInButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +4 -4
- package/lib/commonjs/config/api.js +2 -2
- package/lib/commonjs/hooks/useConnections.js +6 -6
- package/lib/commonjs/hooks/useUserConnections.js +10 -10
- package/lib/commonjs/index.js +9 -10
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/apiClient.js +35 -35
- package/lib/commonjs/services/apiKeyService.js +99 -99
- package/lib/commonjs/services/authService.js +82 -82
- package/lib/commonjs/services/biometricPinService.js +10 -10
- package/lib/commonjs/services/connectedAccountsService.js +32 -32
- package/lib/commonjs/services/googleAuthService.js +15 -15
- package/lib/commonjs/services/imageCompressionService.js +15 -15
- package/lib/commonjs/services/jwtStorageService.js +59 -59
- package/lib/commonjs/services/mobileTrainingService.js +14 -14
- package/lib/commonjs/services/pinEncryptionService.js +10 -10
- package/lib/commonjs/services/pinStorageUtils.js +15 -15
- package/lib/commonjs/services/platformAuthService.js +47 -47
- package/lib/commonjs/services/storageService.js +31 -31
- package/lib/commonjs/services/trainingApiHelpers.js +33 -33
- package/lib/commonjs/services/userConnectionsService.js +24 -24
- package/lib/commonjs/utils/Portal.js +4 -4
- package/lib/commonjs/utils/api.js +24 -24
- package/lib/commonjs/utils/auth.js +18 -18
- package/lib/commonjs/utils/crypto.js +13 -13
- package/lib/commonjs/utils/encryption.js +12 -12
- package/lib/commonjs/utils/eventUtils.js +52 -52
- package/lib/commonjs/utils/programmaticFlow.js +16 -16
- package/lib/commonjs/utils/retryHelper.js +27 -27
- package/lib/module/assets/images/Checkbox.svg +3 -3
- package/lib/module/assets/images/EnochE.svg +19 -19
- package/lib/module/assets/images/Personalityprofile.svg +3 -3
- package/lib/module/assets/images/Personalitytraits.svg +3 -3
- package/lib/module/assets/images/Userpreferences.svg +3 -3
- package/lib/module/assets/images/arrow.svg +20 -20
- package/lib/module/assets/images/basicproficon.svg +43 -43
- package/lib/module/assets/images/basicprofile.svg +3 -3
- package/lib/module/assets/images/checkmark.svg +4 -4
- package/lib/module/assets/images/contentanalysis.svg +3 -3
- package/lib/module/assets/images/contenticon.svg +23 -23
- package/lib/module/assets/images/personalityicon.svg +18 -18
- package/lib/module/assets/images/x-close.svg +3 -3
- package/lib/module/components/OnairosButton.js +282 -0
- package/lib/module/components/OnairosButton.js.map +1 -0
- package/lib/module/components/OnairosSignInButton.js +30 -8
- package/lib/module/components/OnairosSignInButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +4 -4
- package/lib/module/config/api.js +2 -2
- package/lib/module/hooks/useConnections.js +6 -6
- package/lib/module/hooks/useUserConnections.js +10 -10
- package/lib/module/index.js +8 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/apiClient.js +35 -35
- package/lib/module/services/apiKeyService.js +99 -99
- package/lib/module/services/authService.js +82 -82
- package/lib/module/services/biometricPinService.js +10 -10
- package/lib/module/services/connectedAccountsService.js +32 -32
- package/lib/module/services/googleAuthService.js +15 -15
- package/lib/module/services/imageCompressionService.js +15 -15
- package/lib/module/services/jwtStorageService.js +59 -59
- package/lib/module/services/mobileTrainingService.js +14 -14
- package/lib/module/services/pinEncryptionService.js +10 -10
- package/lib/module/services/pinStorageUtils.js +15 -15
- package/lib/module/services/platformAuthService.js +47 -47
- package/lib/module/services/storageService.js +31 -31
- package/lib/module/services/trainingApiHelpers.js +33 -33
- package/lib/module/services/userConnectionsService.js +24 -24
- package/lib/module/utils/Portal.js +4 -4
- package/lib/module/utils/api.js +24 -24
- package/lib/module/utils/auth.js +18 -18
- package/lib/module/utils/crypto.js +13 -13
- package/lib/module/utils/encryption.js +12 -12
- package/lib/module/utils/eventUtils.js +52 -52
- package/lib/module/utils/programmaticFlow.js +16 -16
- package/lib/module/utils/retryHelper.js +27 -27
- package/lib/typescript/components/OnairosButton.d.ts +37 -0
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -0
- package/lib/typescript/components/OnairosSignInButton.d.ts +2 -1
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +163 -163
- package/src/api/index.ts +151 -151
- package/src/assets/images/Checkbox.svg +3 -3
- package/src/assets/images/EnochE.svg +19 -19
- package/src/assets/images/Personalityprofile.svg +3 -3
- package/src/assets/images/Personalitytraits.svg +3 -3
- package/src/assets/images/Userpreferences.svg +3 -3
- package/src/assets/images/arrow.svg +20 -20
- package/src/assets/images/basicproficon.svg +43 -43
- package/src/assets/images/basicprofile.svg +3 -3
- package/src/assets/images/checkmark.svg +4 -4
- package/src/assets/images/contentanalysis.svg +3 -3
- package/src/assets/images/contenticon.svg +23 -23
- package/src/assets/images/personalityicon.svg +18 -18
- package/src/assets/images/x-close.svg +3 -3
- package/src/components/BodyText.tsx +33 -33
- package/src/components/BrandMark.tsx +62 -62
- package/src/components/CodeInput.tsx +32 -32
- package/src/components/DataRequestScreen.tsx +355 -355
- package/src/components/EmailInput.tsx +31 -31
- package/src/components/EmailVerificationModal.tsx +363 -363
- package/src/components/ExistingUserDataConfirmation.tsx +506 -506
- package/src/components/GoogleButton.tsx +55 -55
- package/src/components/HeadingGroup.tsx +49 -49
- package/src/components/ModalHeader.tsx +125 -125
- package/src/components/ModalSheet.tsx +57 -57
- package/src/components/Onairos.tsx +422 -422
- package/src/components/OnairosButton.tsx +339 -0
- package/src/components/OnairosSignInButton.tsx +30 -10
- package/src/components/Overlay.tsx +506 -506
- package/src/components/PersonaImage.tsx +79 -79
- package/src/components/PersonaLoadingScreen.tsx +201 -201
- package/src/components/PersonalizationConsentScreen.tsx +410 -410
- package/src/components/PinCreationScreen.tsx +492 -492
- package/src/components/PinInput.tsx +555 -555
- package/src/components/PlatformConnectorsStep.tsx +891 -891
- package/src/components/PlatformList.tsx +144 -144
- package/src/components/PlatformToggle.tsx +226 -226
- package/src/components/PrimaryButton.tsx +213 -213
- package/src/components/SignInMatchAnimation.tsx +225 -225
- package/src/components/SignInStep.tsx +217 -217
- package/src/components/TrainingModal.tsx +1047 -1047
- package/src/components/UniversalOnboarding.tsx +2887 -2887
- package/src/components/VerificationStep.tsx +198 -198
- package/src/components/WelcomeScreen.tsx +473 -473
- package/src/components/icons/Basicproficon.tsx +30 -30
- package/src/components/icons/Basicprofile.tsx +17 -17
- package/src/components/icons/Checkbox.tsx +17 -17
- package/src/components/icons/Checkmark.tsx +24 -24
- package/src/components/icons/Contentanalysis.tsx +17 -17
- package/src/components/icons/Contenticon.tsx +30 -30
- package/src/components/icons/EnochE.tsx +39 -39
- package/src/components/icons/Personalityicon.tsx +22 -22
- package/src/components/icons/Personalityprofile.tsx +17 -17
- package/src/components/icons/Personalitytraits.tsx +17 -17
- package/src/components/icons/Userpreferences.tsx +17 -17
- package/src/components/icons/index.ts +12 -12
- package/src/components/onboarding/OAuthWebView.tsx +232 -232
- package/src/config/api.ts +25 -25
- package/src/context/AuthContext.tsx +393 -393
- package/src/hooks/useConnectedAccounts.ts +138 -138
- package/src/hooks/useConnections.ts +161 -161
- package/src/hooks/useCredentials.ts +174 -174
- package/src/hooks/useUserConnections.ts +165 -165
- package/src/index.js +14 -0
- package/src/index.ts +94 -96
- package/src/services/apiClient.ts +336 -336
- package/src/services/apiKeyService.ts +919 -919
- package/src/services/authService.ts +1008 -1008
- package/src/services/biometricPinService.ts +192 -192
- package/src/services/connectedAccountsService.ts +289 -289
- package/src/services/googleAuthService.ts +279 -279
- package/src/services/imageCompressionService.ts +302 -302
- package/src/services/jwtStorageService.ts +256 -256
- package/src/services/mobileTrainingService.ts +203 -203
- package/src/services/pinEncryptionService.ts +75 -75
- package/src/services/pinStorageUtils.ts +96 -96
- package/src/services/platformAuthService.ts +1346 -1346
- package/src/services/storageService.ts +451 -451
- package/src/services/trainingApiHelpers.ts +66 -66
- package/src/services/userConnectionsService.ts +556 -556
- package/src/services/youtubeMigrationService.ts +453 -453
- package/src/theme/index.ts +239 -239
- package/src/types/ambient.d.ts +28 -28
- package/src/types/index.ts +265 -265
- package/src/types/node-fix.d.ts +18 -18
- package/src/types/node-override.d.ts +23 -23
- package/src/types/opacity.d.ts +15 -15
- package/src/types/types.d.ts +17 -17
- package/src/utils/Portal.tsx +82 -82
- package/src/utils/api.js +111 -111
- package/src/utils/auth.js +103 -103
- package/src/utils/crypto.js +59 -59
- package/src/utils/encryption.ts +68 -68
- package/src/utils/eventUtils.ts +302 -302
- package/src/utils/haptics.ts +58 -58
- package/src/utils/imagePreloader.ts +2 -2
- package/src/utils/programmaticFlow.ts +112 -112
- package/src/utils/retryHelper.ts +274 -274
package/package.json
CHANGED
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@onairos/react-native",
|
|
3
|
-
"version": "3.1.
|
|
4
|
-
"description": "Onairos React Native SDK for social media authentication and AI model training",
|
|
5
|
-
"main": "lib/commonjs/index.js",
|
|
6
|
-
"module": "lib/module/index.js",
|
|
7
|
-
"types": "lib/typescript/index.d.ts",
|
|
8
|
-
"react-native": "lib/module/index.js",
|
|
9
|
-
"source": "src/index",
|
|
10
|
-
"files": [
|
|
11
|
-
"src",
|
|
12
|
-
"lib",
|
|
13
|
-
"types",
|
|
14
|
-
"android",
|
|
15
|
-
"ios",
|
|
16
|
-
"cpp",
|
|
17
|
-
"*.podspec",
|
|
18
|
-
"!lib/typescript/example",
|
|
19
|
-
"!ios/build",
|
|
20
|
-
"!android/build",
|
|
21
|
-
"!android/gradle",
|
|
22
|
-
"!android/gradlew",
|
|
23
|
-
"!android/gradlew.bat",
|
|
24
|
-
"!android/local.properties",
|
|
25
|
-
"!**/__tests__",
|
|
26
|
-
"!**/__fixtures__",
|
|
27
|
-
"!**/__mocks__",
|
|
28
|
-
"!**/.*"
|
|
29
|
-
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"test": "jest",
|
|
32
|
-
"test:sdk": "node tests/test-runner.js",
|
|
33
|
-
"test:oauth": "node tests/test-runner.js --suite \"OAuth WebView\"",
|
|
34
|
-
"test:api-key": "node tests/test-runner.js --suite \"API Key Initialization\"",
|
|
35
|
-
"test:api-validation": "node tests/test-runner.js --suite \"API Validation\"",
|
|
36
|
-
"test:list": "node tests/test-runner.js --list",
|
|
37
|
-
"diagnose:api": "node diagnose-api-validation.js",
|
|
38
|
-
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
39
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
-
"prepare": "bob build",
|
|
41
|
-
"release": "release-it",
|
|
42
|
-
"example": "npm --prefix example",
|
|
43
|
-
"bootstrap": "npm run example && npm install",
|
|
44
|
-
"build": "npm run clean && bob build",
|
|
45
|
-
"build:js": "bob build --targets commonjs,module",
|
|
46
|
-
"build:types": "bob build --targets typescript",
|
|
47
|
-
"build:all": "npm run clean && bob build",
|
|
48
|
-
"clean": "del-cli lib",
|
|
49
|
-
"prebuild": "npm run clean"
|
|
50
|
-
},
|
|
51
|
-
"keywords": [
|
|
52
|
-
"react-native",
|
|
53
|
-
"ios",
|
|
54
|
-
"android",
|
|
55
|
-
"oauth",
|
|
56
|
-
"social-media",
|
|
57
|
-
"authentication",
|
|
58
|
-
"onairos",
|
|
59
|
-
"user data",
|
|
60
|
-
"personalization",
|
|
61
|
-
"user context",
|
|
62
|
-
"context",
|
|
63
|
-
"context window"
|
|
64
|
-
],
|
|
65
|
-
"repository": {
|
|
66
|
-
"type": "git",
|
|
67
|
-
"url": "git+https://github.com/onairos/onairos-react-native.git"
|
|
68
|
-
},
|
|
69
|
-
"author": "Onairos",
|
|
70
|
-
"license": "MIT",
|
|
71
|
-
"bugs": {
|
|
72
|
-
"url": "https://github.com/onairos/onairos-react-native/issues"
|
|
73
|
-
},
|
|
74
|
-
"homepage": "https://www.npmjs.com/package/@onairos/react-native",
|
|
75
|
-
"publishConfig": {
|
|
76
|
-
"access": "public",
|
|
77
|
-
"registry": "https://registry.npmjs.org/"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"@bam.tech/react-native-image-resizer": "^3.0.11",
|
|
81
|
-
"@gorhom/bottom-sheet": "^4.6.4",
|
|
82
|
-
"@opacity-labs/react-native-opacity": "^5.6.2",
|
|
83
|
-
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
84
|
-
"@react-native-community/netinfo": "^9.5.0",
|
|
85
|
-
"@react-native-google-signin/google-signin": "^14.0.1",
|
|
86
|
-
"axios": "^1.6.2",
|
|
87
|
-
"expo-linear-gradient": "~14.0.2",
|
|
88
|
-
"expo-secure-store": "~14.2.3",
|
|
89
|
-
"js-sha256": "^0.11.0",
|
|
90
|
-
"jwt-decode": "^4.0.0",
|
|
91
|
-
"moti": "^0.30.0",
|
|
92
|
-
"react-native-crypto-js": "^1.0.0",
|
|
93
|
-
"react-native-device-info": "^10.8.0",
|
|
94
|
-
"react-native-gesture-handler": "^2.28.0",
|
|
95
|
-
"react-native-get-random-values": "^1.11.0",
|
|
96
|
-
"react-native-haptic-feedback": "^2.3.3",
|
|
97
|
-
"react-native-keychain": "^8.2.0",
|
|
98
|
-
"react-native-linear-gradient": "^2.8.3",
|
|
99
|
-
"react-native-reanimated": "^2.17.0",
|
|
100
|
-
"react-native-rsa-native": "^2.0.5",
|
|
101
|
-
"react-native-safe-area-context": "^4.14.1",
|
|
102
|
-
"react-native-securerandom": "^1.0.1",
|
|
103
|
-
"react-native-svg": "^15.12.1",
|
|
104
|
-
"react-native-vector-icons": "^9.2.0",
|
|
105
|
-
"react-native-webview": "^13.16.0",
|
|
106
|
-
"socket.io-client": "^4.8.1"
|
|
107
|
-
},
|
|
108
|
-
"devDependencies": {
|
|
109
|
-
"@react-native-community/eslint-config": "^3.0.0",
|
|
110
|
-
"@release-it/conventional-changelog": "^5.0.0",
|
|
111
|
-
"@tsconfig/react-native": "^3.0.6",
|
|
112
|
-
"@types/jest": "^28.1.2",
|
|
113
|
-
"@types/node": "^22.15.21",
|
|
114
|
-
"@types/react": "^18.0.0",
|
|
115
|
-
"@types/react-native": "^0.70.0",
|
|
116
|
-
"@types/react-native-vector-icons": "^6.4.13",
|
|
117
|
-
"@types/socket.io-client": "^3.0.0",
|
|
118
|
-
"babel-plugin-module-resolver": "^4.1.0",
|
|
119
|
-
"del-cli": "^5.1.0",
|
|
120
|
-
"eslint": "^8.4.1",
|
|
121
|
-
"eslint-config-prettier": "^8.5.0",
|
|
122
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
123
|
-
"jest": "^28.1.1",
|
|
124
|
-
"metro-react-native-babel-preset": "^0.73.10",
|
|
125
|
-
"prettier": "^2.0.5",
|
|
126
|
-
"react": "18.2.0",
|
|
127
|
-
"react-native": "0.71.0",
|
|
128
|
-
"react-native-builder-bob": "^0.20.0",
|
|
129
|
-
"release-it": "^15.0.0",
|
|
130
|
-
"typescript": "^4.9.5"
|
|
131
|
-
},
|
|
132
|
-
"resolutions": {
|
|
133
|
-
"@types/react": "17.0.21"
|
|
134
|
-
},
|
|
135
|
-
"peerDependencies": {
|
|
136
|
-
"react": ">=17.0.0",
|
|
137
|
-
"react-native": ">=0.65.0"
|
|
138
|
-
},
|
|
139
|
-
"jest": {
|
|
140
|
-
"preset": "react-native",
|
|
141
|
-
"modulePathIgnorePatterns": [
|
|
142
|
-
"<rootDir>/example/node_modules",
|
|
143
|
-
"<rootDir>/lib/"
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
"react-native-builder-bob": {
|
|
147
|
-
"source": "src",
|
|
148
|
-
"output": "lib",
|
|
149
|
-
"targets": [
|
|
150
|
-
"commonjs",
|
|
151
|
-
"module",
|
|
152
|
-
[
|
|
153
|
-
"typescript",
|
|
154
|
-
{
|
|
155
|
-
"project": "tsconfig.build.json",
|
|
156
|
-
"tscFlags": [
|
|
157
|
-
"--skipLibCheck"
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@onairos/react-native",
|
|
3
|
+
"version": "3.1.17",
|
|
4
|
+
"description": "Onairos React Native SDK for social media authentication and AI model training",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "lib/module/index.js",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"types",
|
|
14
|
+
"android",
|
|
15
|
+
"ios",
|
|
16
|
+
"cpp",
|
|
17
|
+
"*.podspec",
|
|
18
|
+
"!lib/typescript/example",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!android/build",
|
|
21
|
+
"!android/gradle",
|
|
22
|
+
"!android/gradlew",
|
|
23
|
+
"!android/gradlew.bat",
|
|
24
|
+
"!android/local.properties",
|
|
25
|
+
"!**/__tests__",
|
|
26
|
+
"!**/__fixtures__",
|
|
27
|
+
"!**/__mocks__",
|
|
28
|
+
"!**/.*"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"test:sdk": "node tests/test-runner.js",
|
|
33
|
+
"test:oauth": "node tests/test-runner.js --suite \"OAuth WebView\"",
|
|
34
|
+
"test:api-key": "node tests/test-runner.js --suite \"API Key Initialization\"",
|
|
35
|
+
"test:api-validation": "node tests/test-runner.js --suite \"API Validation\"",
|
|
36
|
+
"test:list": "node tests/test-runner.js --list",
|
|
37
|
+
"diagnose:api": "node diagnose-api-validation.js",
|
|
38
|
+
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"prepare": "bob build",
|
|
41
|
+
"release": "release-it",
|
|
42
|
+
"example": "npm --prefix example",
|
|
43
|
+
"bootstrap": "npm run example && npm install",
|
|
44
|
+
"build": "npm run clean && bob build",
|
|
45
|
+
"build:js": "bob build --targets commonjs,module",
|
|
46
|
+
"build:types": "bob build --targets typescript",
|
|
47
|
+
"build:all": "npm run clean && bob build",
|
|
48
|
+
"clean": "del-cli lib",
|
|
49
|
+
"prebuild": "npm run clean"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"react-native",
|
|
53
|
+
"ios",
|
|
54
|
+
"android",
|
|
55
|
+
"oauth",
|
|
56
|
+
"social-media",
|
|
57
|
+
"authentication",
|
|
58
|
+
"onairos",
|
|
59
|
+
"user data",
|
|
60
|
+
"personalization",
|
|
61
|
+
"user context",
|
|
62
|
+
"context",
|
|
63
|
+
"context window"
|
|
64
|
+
],
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "git+https://github.com/onairos/onairos-react-native.git"
|
|
68
|
+
},
|
|
69
|
+
"author": "Onairos",
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/onairos/onairos-react-native/issues"
|
|
73
|
+
},
|
|
74
|
+
"homepage": "https://www.npmjs.com/package/@onairos/react-native",
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public",
|
|
77
|
+
"registry": "https://registry.npmjs.org/"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@bam.tech/react-native-image-resizer": "^3.0.11",
|
|
81
|
+
"@gorhom/bottom-sheet": "^4.6.4",
|
|
82
|
+
"@opacity-labs/react-native-opacity": "^5.6.2",
|
|
83
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
84
|
+
"@react-native-community/netinfo": "^9.5.0",
|
|
85
|
+
"@react-native-google-signin/google-signin": "^14.0.1",
|
|
86
|
+
"axios": "^1.6.2",
|
|
87
|
+
"expo-linear-gradient": "~14.0.2",
|
|
88
|
+
"expo-secure-store": "~14.2.3",
|
|
89
|
+
"js-sha256": "^0.11.0",
|
|
90
|
+
"jwt-decode": "^4.0.0",
|
|
91
|
+
"moti": "^0.30.0",
|
|
92
|
+
"react-native-crypto-js": "^1.0.0",
|
|
93
|
+
"react-native-device-info": "^10.8.0",
|
|
94
|
+
"react-native-gesture-handler": "^2.28.0",
|
|
95
|
+
"react-native-get-random-values": "^1.11.0",
|
|
96
|
+
"react-native-haptic-feedback": "^2.3.3",
|
|
97
|
+
"react-native-keychain": "^8.2.0",
|
|
98
|
+
"react-native-linear-gradient": "^2.8.3",
|
|
99
|
+
"react-native-reanimated": "^2.17.0",
|
|
100
|
+
"react-native-rsa-native": "^2.0.5",
|
|
101
|
+
"react-native-safe-area-context": "^4.14.1",
|
|
102
|
+
"react-native-securerandom": "^1.0.1",
|
|
103
|
+
"react-native-svg": "^15.12.1",
|
|
104
|
+
"react-native-vector-icons": "^9.2.0",
|
|
105
|
+
"react-native-webview": "^13.16.0",
|
|
106
|
+
"socket.io-client": "^4.8.1"
|
|
107
|
+
},
|
|
108
|
+
"devDependencies": {
|
|
109
|
+
"@react-native-community/eslint-config": "^3.0.0",
|
|
110
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
111
|
+
"@tsconfig/react-native": "^3.0.6",
|
|
112
|
+
"@types/jest": "^28.1.2",
|
|
113
|
+
"@types/node": "^22.15.21",
|
|
114
|
+
"@types/react": "^18.0.0",
|
|
115
|
+
"@types/react-native": "^0.70.0",
|
|
116
|
+
"@types/react-native-vector-icons": "^6.4.13",
|
|
117
|
+
"@types/socket.io-client": "^3.0.0",
|
|
118
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
119
|
+
"del-cli": "^5.1.0",
|
|
120
|
+
"eslint": "^8.4.1",
|
|
121
|
+
"eslint-config-prettier": "^8.5.0",
|
|
122
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
123
|
+
"jest": "^28.1.1",
|
|
124
|
+
"metro-react-native-babel-preset": "^0.73.10",
|
|
125
|
+
"prettier": "^2.0.5",
|
|
126
|
+
"react": "18.2.0",
|
|
127
|
+
"react-native": "0.71.0",
|
|
128
|
+
"react-native-builder-bob": "^0.20.0",
|
|
129
|
+
"release-it": "^15.0.0",
|
|
130
|
+
"typescript": "^4.9.5"
|
|
131
|
+
},
|
|
132
|
+
"resolutions": {
|
|
133
|
+
"@types/react": "17.0.21"
|
|
134
|
+
},
|
|
135
|
+
"peerDependencies": {
|
|
136
|
+
"react": ">=17.0.0",
|
|
137
|
+
"react-native": ">=0.65.0"
|
|
138
|
+
},
|
|
139
|
+
"jest": {
|
|
140
|
+
"preset": "react-native",
|
|
141
|
+
"modulePathIgnorePatterns": [
|
|
142
|
+
"<rootDir>/example/node_modules",
|
|
143
|
+
"<rootDir>/lib/"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"react-native-builder-bob": {
|
|
147
|
+
"source": "src",
|
|
148
|
+
"output": "lib",
|
|
149
|
+
"targets": [
|
|
150
|
+
"commonjs",
|
|
151
|
+
"module",
|
|
152
|
+
[
|
|
153
|
+
"typescript",
|
|
154
|
+
{
|
|
155
|
+
"project": "tsconfig.build.json",
|
|
156
|
+
"tscFlags": [
|
|
157
|
+
"--skipLibCheck"
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
3
|
-
import { API_ENDPOINTS } from '../constants';
|
|
4
|
-
|
|
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 = <T>(data: T): Promise<AxiosResponse<T>> => {
|
|
12
|
-
return Promise.resolve({ data, status: 200, statusText: 'OK', headers: {}, config: {} as any });
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// Create API instance
|
|
16
|
-
const apiInstance: AxiosInstance = axios.create({
|
|
17
|
-
baseURL: API_ENDPOINTS.base,
|
|
18
|
-
timeout: 10000,
|
|
19
|
-
headers: {
|
|
20
|
-
'Content-Type': 'application/json',
|
|
21
|
-
'Accept': 'application/json',
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Add error handling interceptor
|
|
26
|
-
apiInstance.interceptors.response.use(
|
|
27
|
-
(response) => response,
|
|
28
|
-
(error) => {
|
|
29
|
-
if (isDevelopmentMode()) {
|
|
30
|
-
console.warn('API error in development mode, using fallback:', error);
|
|
31
|
-
return createMockResponse({ success: true, data: { mockData: true } });
|
|
32
|
-
}
|
|
33
|
-
return Promise.reject(error);
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
// API service with Expo compatibility
|
|
38
|
-
export const onairosApi = {
|
|
39
|
-
// Core API methods with fallbacks
|
|
40
|
-
async get<T = any>(url: string): Promise<AxiosResponse<T>> {
|
|
41
|
-
try {
|
|
42
|
-
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
43
|
-
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
44
|
-
}
|
|
45
|
-
return await apiInstance.get<T>(url);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.error(`GET ${url} error:`, error);
|
|
48
|
-
if (isDevelopmentMode()) {
|
|
49
|
-
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
50
|
-
}
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
async post<T = any>(url: string, data: any): Promise<AxiosResponse<T>> {
|
|
56
|
-
try {
|
|
57
|
-
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
58
|
-
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
59
|
-
}
|
|
60
|
-
return await apiInstance.post<T>(url, data);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.error(`POST ${url} error:`, error);
|
|
63
|
-
if (isDevelopmentMode()) {
|
|
64
|
-
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
65
|
-
}
|
|
66
|
-
throw error;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
// Helper methods for specific API endpoints
|
|
71
|
-
async validateCredentials(username: string) {
|
|
72
|
-
try {
|
|
73
|
-
if (isDevelopmentMode()) {
|
|
74
|
-
console.log('Using mock validation for:', username);
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const response = await this.post('validate', { username });
|
|
79
|
-
return response.data?.success || false;
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error('Error validating credentials:', error);
|
|
82
|
-
return isDevelopmentMode(); // Return true in dev mode to allow flow to continue
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
async getUserProfile(token: string) {
|
|
87
|
-
try {
|
|
88
|
-
if (isDevelopmentMode()) {
|
|
89
|
-
return {
|
|
90
|
-
username: 'demo_user',
|
|
91
|
-
platforms: ['instagram', 'youtube'],
|
|
92
|
-
createdAt: Date.now(),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
apiInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
97
|
-
const response = await this.get('user/profile');
|
|
98
|
-
return response.data?.data;
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.error('Error fetching user profile:', error);
|
|
101
|
-
if (isDevelopmentMode()) {
|
|
102
|
-
return {
|
|
103
|
-
username: 'demo_user',
|
|
104
|
-
platforms: ['instagram', 'youtube'],
|
|
105
|
-
createdAt: Date.now(),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// Email verification functions for WelcomeScreen
|
|
114
|
-
export const sendEmailVerificationCode = async (email: string) => {
|
|
115
|
-
try {
|
|
116
|
-
if (isDevelopmentMode()) {
|
|
117
|
-
console.log('Mock: Sending verification code to:', email);
|
|
118
|
-
return { success: true, message: 'Verification code sent successfully' };
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const response = await onairosApi.post('auth/send-verification', { email });
|
|
122
|
-
return { success: true, message: response.data?.message || 'Verification code sent' };
|
|
123
|
-
} catch (error) {
|
|
124
|
-
console.error('Error sending verification code:', error);
|
|
125
|
-
if (isDevelopmentMode()) {
|
|
126
|
-
return { success: true, message: 'Mock verification code sent' };
|
|
127
|
-
}
|
|
128
|
-
return { success: false, message: 'Failed to send verification code' };
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const confirmEmailVerificationCode = async (email: string, code: string) => {
|
|
133
|
-
try {
|
|
134
|
-
if (isDevelopmentMode()) {
|
|
135
|
-
console.log('Mock: Verifying code for:', email, 'code:', code);
|
|
136
|
-
// Accept any 6-digit code in dev mode
|
|
137
|
-
if (code.length === 6 || code === 'reviewer') {
|
|
138
|
-
return { success: true, message: 'Email verified successfully' };
|
|
139
|
-
}
|
|
140
|
-
return { success: false, message: 'Invalid verification code' };
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const response = await onairosApi.post('auth/verify-email', { email, code });
|
|
144
|
-
return { success: true, message: response.data?.message || 'Email verified' };
|
|
145
|
-
} catch (error) {
|
|
146
|
-
console.error('Error verifying email code:', error);
|
|
147
|
-
if (isDevelopmentMode()) {
|
|
148
|
-
return { success: false, message: 'Invalid verification code' };
|
|
149
|
-
}
|
|
150
|
-
return { success: false, message: 'Verification failed' };
|
|
151
|
-
}
|
|
1
|
+
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { API_ENDPOINTS } from '../constants';
|
|
4
|
+
|
|
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 = <T>(data: T): Promise<AxiosResponse<T>> => {
|
|
12
|
+
return Promise.resolve({ data, status: 200, statusText: 'OK', headers: {}, config: {} as any });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Create API instance
|
|
16
|
+
const apiInstance: AxiosInstance = axios.create({
|
|
17
|
+
baseURL: API_ENDPOINTS.base,
|
|
18
|
+
timeout: 10000,
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
'Accept': 'application/json',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Add error handling interceptor
|
|
26
|
+
apiInstance.interceptors.response.use(
|
|
27
|
+
(response) => response,
|
|
28
|
+
(error) => {
|
|
29
|
+
if (isDevelopmentMode()) {
|
|
30
|
+
console.warn('API error in development mode, using fallback:', error);
|
|
31
|
+
return createMockResponse({ success: true, data: { mockData: true } });
|
|
32
|
+
}
|
|
33
|
+
return Promise.reject(error);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// API service with Expo compatibility
|
|
38
|
+
export const onairosApi = {
|
|
39
|
+
// Core API methods with fallbacks
|
|
40
|
+
async get<T = any>(url: string): Promise<AxiosResponse<T>> {
|
|
41
|
+
try {
|
|
42
|
+
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
43
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
44
|
+
}
|
|
45
|
+
return await apiInstance.get<T>(url);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error(`GET ${url} error:`, error);
|
|
48
|
+
if (isDevelopmentMode()) {
|
|
49
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
async post<T = any>(url: string, data: any): Promise<AxiosResponse<T>> {
|
|
56
|
+
try {
|
|
57
|
+
if (Platform.OS === 'web' && isDevelopmentMode()) {
|
|
58
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
59
|
+
}
|
|
60
|
+
return await apiInstance.post<T>(url, data);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error(`POST ${url} error:`, error);
|
|
63
|
+
if (isDevelopmentMode()) {
|
|
64
|
+
return createMockResponse<T>({ success: true, data: { mockData: true } } as unknown as T);
|
|
65
|
+
}
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// Helper methods for specific API endpoints
|
|
71
|
+
async validateCredentials(username: string) {
|
|
72
|
+
try {
|
|
73
|
+
if (isDevelopmentMode()) {
|
|
74
|
+
console.log('Using mock validation for:', username);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const response = await this.post('validate', { username });
|
|
79
|
+
return response.data?.success || false;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error('Error validating credentials:', error);
|
|
82
|
+
return isDevelopmentMode(); // Return true in dev mode to allow flow to continue
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
async getUserProfile(token: string) {
|
|
87
|
+
try {
|
|
88
|
+
if (isDevelopmentMode()) {
|
|
89
|
+
return {
|
|
90
|
+
username: 'demo_user',
|
|
91
|
+
platforms: ['instagram', 'youtube'],
|
|
92
|
+
createdAt: Date.now(),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
apiInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
97
|
+
const response = await this.get('user/profile');
|
|
98
|
+
return response.data?.data;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('Error fetching user profile:', error);
|
|
101
|
+
if (isDevelopmentMode()) {
|
|
102
|
+
return {
|
|
103
|
+
username: 'demo_user',
|
|
104
|
+
platforms: ['instagram', 'youtube'],
|
|
105
|
+
createdAt: Date.now(),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Email verification functions for WelcomeScreen
|
|
114
|
+
export const sendEmailVerificationCode = async (email: string) => {
|
|
115
|
+
try {
|
|
116
|
+
if (isDevelopmentMode()) {
|
|
117
|
+
console.log('Mock: Sending verification code to:', email);
|
|
118
|
+
return { success: true, message: 'Verification code sent successfully' };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const response = await onairosApi.post('auth/send-verification', { email });
|
|
122
|
+
return { success: true, message: response.data?.message || 'Verification code sent' };
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error('Error sending verification code:', error);
|
|
125
|
+
if (isDevelopmentMode()) {
|
|
126
|
+
return { success: true, message: 'Mock verification code sent' };
|
|
127
|
+
}
|
|
128
|
+
return { success: false, message: 'Failed to send verification code' };
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const confirmEmailVerificationCode = async (email: string, code: string) => {
|
|
133
|
+
try {
|
|
134
|
+
if (isDevelopmentMode()) {
|
|
135
|
+
console.log('Mock: Verifying code for:', email, 'code:', code);
|
|
136
|
+
// Accept any 6-digit code in dev mode
|
|
137
|
+
if (code.length === 6 || code === 'reviewer') {
|
|
138
|
+
return { success: true, message: 'Email verified successfully' };
|
|
139
|
+
}
|
|
140
|
+
return { success: false, message: 'Invalid verification code' };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const response = await onairosApi.post('auth/verify-email', { email, code });
|
|
144
|
+
return { success: true, message: response.data?.message || 'Email verified' };
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error('Error verifying email code:', error);
|
|
147
|
+
if (isDevelopmentMode()) {
|
|
148
|
+
return { success: false, message: 'Invalid verification code' };
|
|
149
|
+
}
|
|
150
|
+
return { success: false, message: 'Verification failed' };
|
|
151
|
+
}
|
|
152
152
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M4 0.5H12C13.933 0.5 15.5 2.067 15.5 4V12C15.5 13.933 13.933 15.5 12 15.5H4C2.067 15.5 0.5 13.933 0.5 12V4C0.5 2.067 2.067 0.5 4 0.5Z" stroke="#CECFD2"/>
|
|
3
|
-
</svg>
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4 0.5H12C13.933 0.5 15.5 2.067 15.5 4V12C15.5 13.933 13.933 15.5 12 15.5H4C2.067 15.5 0.5 13.933 0.5 12V4C0.5 2.067 2.067 0.5 4 0.5Z" stroke="#CECFD2"/>
|
|
3
|
+
</svg>
|