@onairos/react-native 3.1.15 → 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/OnairosSignInButton.js +32 -74
- 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 +5 -12
- 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/OnairosSignInButton.js +32 -74
- 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 +5 -6
- 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/OnairosSignInButton.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -1
- 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 -339
- package/src/components/OnairosSignInButton.tsx +130 -166
- 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 -14
- package/src/index.ts +94 -95
- 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
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import Svg, {Path} from 'react-native-svg';
|
|
3
|
-
import type {SvgProps} from 'react-native-svg';
|
|
4
|
-
const SvgUserpreferences = (props: SvgProps) => (
|
|
5
|
-
<Svg
|
|
6
|
-
width={263}
|
|
7
|
-
height={22}
|
|
8
|
-
fill="none"
|
|
9
|
-
viewBox="0 0 263 22"
|
|
10
|
-
{...props}>
|
|
11
|
-
<Path
|
|
12
|
-
fill="#1F242F"
|
|
13
|
-
d="M7.423 5.818h1.844v6.652q0 1.094-.517 1.924a3.5 3.5 0 0 1-1.442 1.298q-.93.462-2.172.462-1.248 0-2.178-.462a3.5 3.5 0 0 1-1.442-1.298q-.512-.83-.512-1.924V5.818H2.85v6.498q0 .636.278 1.134.284.497.796.78.511.279 1.213.278.7 0 1.213-.278.517-.284.795-.78a2.3 2.3 0 0 0 .279-1.134zm9.565 4.564-1.64.18a1.3 1.3 0 0 0-.244-.468 1.2 1.2 0 0 0-.458-.353 1.7 1.7 0 0 0-.706-.134q-.562 0-.944.243-.379.243-.373.632a.66.66 0 0 0 .243.541q.255.21.836.344l1.302.278q1.085.234 1.61.74.534.508.538 1.328-.004.72-.423 1.273-.413.547-1.148.855-.736.308-1.69.308-1.402 0-2.258-.587-.855-.59-1.019-1.645l1.755-.17q.12.519.507.781.388.264 1.01.264.64 0 1.029-.264.393-.263.392-.65q0-.33-.253-.543-.248-.213-.776-.328l-1.302-.273q-1.1-.23-1.626-.77-.527-.548-.522-1.383-.005-.705.383-1.223.393-.522 1.089-.805.7-.29 1.615-.289 1.343 0 2.113.572.776.571.96 1.546m4.789 5.767q-1.149 0-1.984-.477a3.23 3.23 0 0 1-1.278-1.362q-.447-.886-.447-2.083 0-1.178.447-2.069a3.4 3.4 0 0 1 1.263-1.392q.81-.502 1.904-.502.706 0 1.333.229.63.223 1.113.696.487.473.766 1.203.278.726.278 1.73v.552h-6.26v-1.213h4.535a1.94 1.94 0 0 0-.224-.92 1.63 1.63 0 0 0-.611-.641 1.7 1.7 0 0 0-.905-.234q-.552 0-.97.269a1.85 1.85 0 0 0-.65.696q-.23.427-.234.94v1.058q0 .666.243 1.144.244.472.681.726.438.248 1.024.248.394 0 .711-.11.318-.113.552-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.606 1.163 2.96 2.96 0 0 1-1.133.766q-.691.268-1.581.268M26.455 16V8.364H28.2v1.272h.08q.208-.66.715-1.019a1.97 1.97 0 0 1 1.168-.363q.15 0 .334.015.189.01.313.035V9.96a2 2 0 0 0-.363-.07 3 3 0 0 0-.472-.035 1.8 1.8 0 0 0-.885.214q-.389.21-.612.582-.224.372-.224.86V16zm8.623 0V5.818h3.818q1.173 0 1.969.438.8.437 1.208 1.203.412.76.412 1.73 0 .98-.412 1.74a2.95 2.95 0 0 1-1.218 1.198q-.805.433-1.984.433h-2.53v-1.517h2.281q.687 0 1.124-.238.438-.24.646-.657.214-.417.214-.96 0-.54-.214-.954a1.45 1.45 0 0 0-.65-.641q-.439-.234-1.13-.234h-1.69V16zm8.69 0V8.364h1.745v1.272h.08q.208-.66.715-1.019a1.97 1.97 0 0 1 1.169-.363q.15 0 .333.015.189.01.313.035V9.96a2 2 0 0 0-.363-.07 3 3 0 0 0-.472-.035 1.8 1.8 0 0 0-.885.214q-.388.21-.612.582t-.223.86V16zm8.377.15q-1.149 0-1.984-.478a3.23 3.23 0 0 1-1.277-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.262-1.392q.81-.502 1.904-.502.706 0 1.333.229.63.223 1.113.696.487.473.766 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.534a1.94 1.94 0 0 0-.223-.92 1.63 1.63 0 0 0-.612-.641 1.7 1.7 0 0 0-.905-.234q-.551 0-.97.269a1.85 1.85 0 0 0-.65.696q-.229.427-.234.94v1.058q0 .666.244 1.144.243.472.68.726.438.248 1.025.248.393 0 .71-.11.32-.113.553-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.607 1.163 2.96 2.96 0 0 1-1.133.766q-.69.268-1.581.268m8.546-7.786v1.392h-4.514V8.364zM57.305 16V7.643q0-.771.319-1.283.322-.512.865-.766a2.8 2.8 0 0 1 1.203-.253q.467 0 .83.074.362.075.537.135L60.7 6.942a3 3 0 0 0-.288-.07 1.7 1.7 0 0 0-.388-.04q-.502 0-.711.244-.204.24-.204.686V16zm7.649.15q-1.149 0-1.984-.478a3.23 3.23 0 0 1-1.277-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.262-1.392q.81-.502 1.904-.502.706 0 1.333.229.63.223 1.114.696.487.473.765 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.534a1.94 1.94 0 0 0-.223-.92 1.63 1.63 0 0 0-.612-.641 1.7 1.7 0 0 0-.905-.234q-.551 0-.97.269a1.85 1.85 0 0 0-.65.696q-.229.427-.234.94v1.058q0 .666.244 1.144.243.472.68.726.438.248 1.025.248.393 0 .71-.11.32-.113.553-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.607 1.163 2.96 2.96 0 0 1-1.133.766q-.69.268-1.581.268m4.678-.15V8.364h1.745v1.272h.08q.209-.66.716-1.019a1.97 1.97 0 0 1 1.168-.363q.15 0 .333.015.189.01.313.035V9.96a2 2 0 0 0-.363-.07 3 3 0 0 0-.472-.035 1.8 1.8 0 0 0-.885.214q-.387.21-.611.582-.225.372-.224.86V16zm8.377.15q-1.149 0-1.984-.478a3.23 3.23 0 0 1-1.277-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.263-1.392q.81-.502 1.904-.502.705 0 1.332.229.631.223 1.114.696.487.473.765 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.535a1.94 1.94 0 0 0-.224-.92 1.63 1.63 0 0 0-.612-.641 1.7 1.7 0 0 0-.904-.234q-.552 0-.97.269a1.85 1.85 0 0 0-.651.696q-.229.427-.234.94v1.058q0 .666.244 1.144.244.472.68.726.439.248 1.025.248.393 0 .71-.11.32-.113.553-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.606 1.163 2.96 2.96 0 0 1-1.134.766q-.691.268-1.58.268m6.478-4.624V16h-1.8V8.364h1.72V9.66h.09q.264-.64.84-1.019.582-.378 1.437-.378.79 0 1.377.338.593.338.915.98.328.64.323 1.556V16h-1.8v-4.584q0-.765-.397-1.198-.393-.432-1.09-.432-.471 0-.84.208a1.45 1.45 0 0 0-.571.592q-.204.387-.204.94m9.823 4.623q-1.144 0-1.964-.502a3.35 3.35 0 0 1-1.258-1.387q-.438-.89-.438-2.048 0-1.163.448-2.054a3.34 3.34 0 0 1 1.263-1.392q.82-.502 1.939-.502.93 0 1.645.343.72.338 1.149.96.427.615.487 1.441h-1.72a1.64 1.64 0 0 0-.498-.92q-.387-.372-1.039-.372-.55 0-.969.298-.418.294-.651.845-.23.553-.229 1.323q0 .78.229 1.342.228.557.641.86.417.299.98.298.398 0 .71-.149.32-.153.532-.442.214-.288.294-.701h1.72a3 3 0 0 1-.478 1.437q-.413.621-1.123.974-.71.348-1.67.348m7.889 0q-1.148 0-1.983-.477a3.23 3.23 0 0 1-1.278-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.263-1.392q.81-.502 1.904-.502.706 0 1.332.229.631.223 1.114.696.488.473.765 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.535a1.94 1.94 0 0 0-.224-.92 1.63 1.63 0 0 0-.611-.641 1.7 1.7 0 0 0-.905-.234q-.552 0-.97.269a1.85 1.85 0 0 0-.651.696q-.228.427-.234.94v1.058q0 .666.244 1.144.243.472.681.726.438.248 1.024.248.393 0 .711-.11.318-.113.552-.332a1.4 1.4 0 0 0 .353-.542l1.68.189a2.6 2.6 0 0 1-.606 1.163 2.96 2.96 0 0 1-1.134.766q-.69.268-1.581.268m10.714-5.767-1.641.18a1.3 1.3 0 0 0-.243-.468 1.2 1.2 0 0 0-.458-.353 1.7 1.7 0 0 0-.706-.134q-.561 0-.944.243-.378.243-.373.632a.66.66 0 0 0 .244.541q.253.21.835.344l1.302.278q1.084.234 1.611.74.533.508.537 1.328-.005.72-.423 1.273-.412.547-1.148.855t-1.69.308q-1.402 0-2.257-.587-.856-.59-1.02-1.645l1.755-.17q.12.519.507.781.388.264 1.01.264.64 0 1.029-.264.393-.263.393-.65q0-.33-.254-.543-.248-.213-.776-.328l-1.302-.273q-1.099-.23-1.626-.77-.526-.548-.522-1.383-.005-.705.383-1.223.393-.522 1.089-.805.7-.29 1.616-.289 1.342 0 2.112.572.775.571.96 1.546"
|
|
14
|
-
/>
|
|
15
|
-
</Svg>
|
|
16
|
-
);
|
|
17
|
-
export default SvgUserpreferences;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Svg, {Path} from 'react-native-svg';
|
|
3
|
+
import type {SvgProps} from 'react-native-svg';
|
|
4
|
+
const SvgUserpreferences = (props: SvgProps) => (
|
|
5
|
+
<Svg
|
|
6
|
+
width={263}
|
|
7
|
+
height={22}
|
|
8
|
+
fill="none"
|
|
9
|
+
viewBox="0 0 263 22"
|
|
10
|
+
{...props}>
|
|
11
|
+
<Path
|
|
12
|
+
fill="#1F242F"
|
|
13
|
+
d="M7.423 5.818h1.844v6.652q0 1.094-.517 1.924a3.5 3.5 0 0 1-1.442 1.298q-.93.462-2.172.462-1.248 0-2.178-.462a3.5 3.5 0 0 1-1.442-1.298q-.512-.83-.512-1.924V5.818H2.85v6.498q0 .636.278 1.134.284.497.796.78.511.279 1.213.278.7 0 1.213-.278.517-.284.795-.78a2.3 2.3 0 0 0 .279-1.134zm9.565 4.564-1.64.18a1.3 1.3 0 0 0-.244-.468 1.2 1.2 0 0 0-.458-.353 1.7 1.7 0 0 0-.706-.134q-.562 0-.944.243-.379.243-.373.632a.66.66 0 0 0 .243.541q.255.21.836.344l1.302.278q1.085.234 1.61.74.534.508.538 1.328-.004.72-.423 1.273-.413.547-1.148.855-.736.308-1.69.308-1.402 0-2.258-.587-.855-.59-1.019-1.645l1.755-.17q.12.519.507.781.388.264 1.01.264.64 0 1.029-.264.393-.263.392-.65q0-.33-.253-.543-.248-.213-.776-.328l-1.302-.273q-1.1-.23-1.626-.77-.527-.548-.522-1.383-.005-.705.383-1.223.393-.522 1.089-.805.7-.29 1.615-.289 1.343 0 2.113.572.776.571.96 1.546m4.789 5.767q-1.149 0-1.984-.477a3.23 3.23 0 0 1-1.278-1.362q-.447-.886-.447-2.083 0-1.178.447-2.069a3.4 3.4 0 0 1 1.263-1.392q.81-.502 1.904-.502.706 0 1.333.229.63.223 1.113.696.487.473.766 1.203.278.726.278 1.73v.552h-6.26v-1.213h4.535a1.94 1.94 0 0 0-.224-.92 1.63 1.63 0 0 0-.611-.641 1.7 1.7 0 0 0-.905-.234q-.552 0-.97.269a1.85 1.85 0 0 0-.65.696q-.23.427-.234.94v1.058q0 .666.243 1.144.244.472.681.726.438.248 1.024.248.394 0 .711-.11.318-.113.552-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.606 1.163 2.96 2.96 0 0 1-1.133.766q-.691.268-1.581.268M26.455 16V8.364H28.2v1.272h.08q.208-.66.715-1.019a1.97 1.97 0 0 1 1.168-.363q.15 0 .334.015.189.01.313.035V9.96a2 2 0 0 0-.363-.07 3 3 0 0 0-.472-.035 1.8 1.8 0 0 0-.885.214q-.389.21-.612.582-.224.372-.224.86V16zm8.623 0V5.818h3.818q1.173 0 1.969.438.8.437 1.208 1.203.412.76.412 1.73 0 .98-.412 1.74a2.95 2.95 0 0 1-1.218 1.198q-.805.433-1.984.433h-2.53v-1.517h2.281q.687 0 1.124-.238.438-.24.646-.657.214-.417.214-.96 0-.54-.214-.954a1.45 1.45 0 0 0-.65-.641q-.439-.234-1.13-.234h-1.69V16zm8.69 0V8.364h1.745v1.272h.08q.208-.66.715-1.019a1.97 1.97 0 0 1 1.169-.363q.15 0 .333.015.189.01.313.035V9.96a2 2 0 0 0-.363-.07 3 3 0 0 0-.472-.035 1.8 1.8 0 0 0-.885.214q-.388.21-.612.582t-.223.86V16zm8.377.15q-1.149 0-1.984-.478a3.23 3.23 0 0 1-1.277-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.262-1.392q.81-.502 1.904-.502.706 0 1.333.229.63.223 1.113.696.487.473.766 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.534a1.94 1.94 0 0 0-.223-.92 1.63 1.63 0 0 0-.612-.641 1.7 1.7 0 0 0-.905-.234q-.551 0-.97.269a1.85 1.85 0 0 0-.65.696q-.229.427-.234.94v1.058q0 .666.244 1.144.243.472.68.726.438.248 1.025.248.393 0 .71-.11.32-.113.553-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.607 1.163 2.96 2.96 0 0 1-1.133.766q-.69.268-1.581.268m8.546-7.786v1.392h-4.514V8.364zM57.305 16V7.643q0-.771.319-1.283.322-.512.865-.766a2.8 2.8 0 0 1 1.203-.253q.467 0 .83.074.362.075.537.135L60.7 6.942a3 3 0 0 0-.288-.07 1.7 1.7 0 0 0-.388-.04q-.502 0-.711.244-.204.24-.204.686V16zm7.649.15q-1.149 0-1.984-.478a3.23 3.23 0 0 1-1.277-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.262-1.392q.81-.502 1.904-.502.706 0 1.333.229.63.223 1.114.696.487.473.765 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.534a1.94 1.94 0 0 0-.223-.92 1.63 1.63 0 0 0-.612-.641 1.7 1.7 0 0 0-.905-.234q-.551 0-.97.269a1.85 1.85 0 0 0-.65.696q-.229.427-.234.94v1.058q0 .666.244 1.144.243.472.68.726.438.248 1.025.248.393 0 .71-.11.32-.113.553-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.607 1.163 2.96 2.96 0 0 1-1.133.766q-.69.268-1.581.268m4.678-.15V8.364h1.745v1.272h.08q.209-.66.716-1.019a1.97 1.97 0 0 1 1.168-.363q.15 0 .333.015.189.01.313.035V9.96a2 2 0 0 0-.363-.07 3 3 0 0 0-.472-.035 1.8 1.8 0 0 0-.885.214q-.387.21-.611.582-.225.372-.224.86V16zm8.377.15q-1.149 0-1.984-.478a3.23 3.23 0 0 1-1.277-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.263-1.392q.81-.502 1.904-.502.705 0 1.332.229.631.223 1.114.696.487.473.765 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.535a1.94 1.94 0 0 0-.224-.92 1.63 1.63 0 0 0-.612-.641 1.7 1.7 0 0 0-.904-.234q-.552 0-.97.269a1.85 1.85 0 0 0-.651.696q-.229.427-.234.94v1.058q0 .666.244 1.144.244.472.68.726.439.248 1.025.248.393 0 .71-.11.32-.113.553-.332t.353-.542l1.68.189a2.6 2.6 0 0 1-.606 1.163 2.96 2.96 0 0 1-1.134.766q-.691.268-1.58.268m6.478-4.624V16h-1.8V8.364h1.72V9.66h.09q.264-.64.84-1.019.582-.378 1.437-.378.79 0 1.377.338.593.338.915.98.328.64.323 1.556V16h-1.8v-4.584q0-.765-.397-1.198-.393-.432-1.09-.432-.471 0-.84.208a1.45 1.45 0 0 0-.571.592q-.204.387-.204.94m9.823 4.623q-1.144 0-1.964-.502a3.35 3.35 0 0 1-1.258-1.387q-.438-.89-.438-2.048 0-1.163.448-2.054a3.34 3.34 0 0 1 1.263-1.392q.82-.502 1.939-.502.93 0 1.645.343.72.338 1.149.96.427.615.487 1.441h-1.72a1.64 1.64 0 0 0-.498-.92q-.387-.372-1.039-.372-.55 0-.969.298-.418.294-.651.845-.23.553-.229 1.323q0 .78.229 1.342.228.557.641.86.417.299.98.298.398 0 .71-.149.32-.153.532-.442.214-.288.294-.701h1.72a3 3 0 0 1-.478 1.437q-.413.621-1.123.974-.71.348-1.67.348m7.889 0q-1.148 0-1.983-.477a3.23 3.23 0 0 1-1.278-1.362q-.448-.886-.448-2.083 0-1.178.448-2.069a3.4 3.4 0 0 1 1.263-1.392q.81-.502 1.904-.502.706 0 1.332.229.631.223 1.114.696.488.473.765 1.203.279.726.279 1.73v.552h-6.26v-1.213h4.535a1.94 1.94 0 0 0-.224-.92 1.63 1.63 0 0 0-.611-.641 1.7 1.7 0 0 0-.905-.234q-.552 0-.97.269a1.85 1.85 0 0 0-.651.696q-.228.427-.234.94v1.058q0 .666.244 1.144.243.472.681.726.438.248 1.024.248.393 0 .711-.11.318-.113.552-.332a1.4 1.4 0 0 0 .353-.542l1.68.189a2.6 2.6 0 0 1-.606 1.163 2.96 2.96 0 0 1-1.134.766q-.69.268-1.581.268m10.714-5.767-1.641.18a1.3 1.3 0 0 0-.243-.468 1.2 1.2 0 0 0-.458-.353 1.7 1.7 0 0 0-.706-.134q-.561 0-.944.243-.378.243-.373.632a.66.66 0 0 0 .244.541q.253.21.835.344l1.302.278q1.084.234 1.611.74.533.508.537 1.328-.005.72-.423 1.273-.412.547-1.148.855t-1.69.308q-1.402 0-2.257-.587-.856-.59-1.02-1.645l1.755-.17q.12.519.507.781.388.264 1.01.264.64 0 1.029-.264.393-.263.393-.65q0-.33-.254-.543-.248-.213-.776-.328l-1.302-.273q-1.099-.23-1.626-.77-.526-.548-.522-1.383-.005-.705.383-1.223.393-.522 1.089-.805.7-.29 1.616-.289 1.342 0 2.112.572.775.571.96 1.546"
|
|
14
|
+
/>
|
|
15
|
+
</Svg>
|
|
16
|
+
);
|
|
17
|
+
export default SvgUserpreferences;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// SVG Icon Components - Auto-generated from @svgr/cli with React Native support
|
|
2
|
-
export { default as EnochE } from './EnochE';
|
|
3
|
-
export { default as Basicproficon } from './Basicproficon';
|
|
4
|
-
export { default as Basicprofile } from './Basicprofile';
|
|
5
|
-
export { default as Contenticon } from './Contenticon';
|
|
6
|
-
export { default as Contentanalysis } from './Contentanalysis';
|
|
7
|
-
export { default as Personalityicon } from './Personalityicon';
|
|
8
|
-
export { default as Personalityprofile } from './Personalityprofile';
|
|
9
|
-
export { default as Personalitytraits } from './Personalitytraits';
|
|
10
|
-
export { default as Userpreferences } from './Userpreferences';
|
|
11
|
-
export { default as Checkbox } from './Checkbox';
|
|
12
|
-
export { default as Checkmark } from './Checkmark';
|
|
1
|
+
// SVG Icon Components - Auto-generated from @svgr/cli with React Native support
|
|
2
|
+
export { default as EnochE } from './EnochE';
|
|
3
|
+
export { default as Basicproficon } from './Basicproficon';
|
|
4
|
+
export { default as Basicprofile } from './Basicprofile';
|
|
5
|
+
export { default as Contenticon } from './Contenticon';
|
|
6
|
+
export { default as Contentanalysis } from './Contentanalysis';
|
|
7
|
+
export { default as Personalityicon } from './Personalityicon';
|
|
8
|
+
export { default as Personalityprofile } from './Personalityprofile';
|
|
9
|
+
export { default as Personalitytraits } from './Personalitytraits';
|
|
10
|
+
export { default as Userpreferences } from './Userpreferences';
|
|
11
|
+
export { default as Checkbox } from './Checkbox';
|
|
12
|
+
export { default as Checkmark } from './Checkmark';
|
|
@@ -1,232 +1,232 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
ActivityIndicator,
|
|
8
|
-
SafeAreaView,
|
|
9
|
-
Dimensions,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import { WebView } from 'react-native-webview';
|
|
12
|
-
|
|
13
|
-
const { width, height } = Dimensions.get('window');
|
|
14
|
-
|
|
15
|
-
export interface OAuthWebViewProps {
|
|
16
|
-
url: string;
|
|
17
|
-
onClose: () => void;
|
|
18
|
-
onSuccess: (code: string) => void;
|
|
19
|
-
platform?: string;
|
|
20
|
-
onComplete?: () => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const OAuthWebView: React.FC<OAuthWebViewProps> = ({
|
|
24
|
-
url,
|
|
25
|
-
onClose,
|
|
26
|
-
onSuccess,
|
|
27
|
-
platform = 'platform',
|
|
28
|
-
onComplete,
|
|
29
|
-
}) => {
|
|
30
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
31
|
-
const [timeoutReached, setTimeoutReached] = useState(false);
|
|
32
|
-
|
|
33
|
-
console.log('Opening OAuth WebView with URL:', url);
|
|
34
|
-
|
|
35
|
-
// Set up a timeout to prevent infinite waiting
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const timeout = setTimeout(() => {
|
|
38
|
-
console.log(`⏰ OAuth timeout reached for ${platform} after 1 minutes`);
|
|
39
|
-
setTimeoutReached(true);
|
|
40
|
-
}, 60000); // 1 minutes timeout
|
|
41
|
-
|
|
42
|
-
return () => clearTimeout(timeout);
|
|
43
|
-
}, [platform]);
|
|
44
|
-
|
|
45
|
-
const handleNavigationStateChange = (navState: any) => {
|
|
46
|
-
console.log(`Navigation state changed for ${platform}:`, navState.url);
|
|
47
|
-
|
|
48
|
-
// Check for the final redirect to onairos.uk domain (this means backend callback completed)
|
|
49
|
-
const isFinalRedirect = (
|
|
50
|
-
navState.url.includes('onairos.uk/Home') ||
|
|
51
|
-
navState.url.includes('onairos.uk/home') ||
|
|
52
|
-
navState.url.includes('onairos.uk/success') ||
|
|
53
|
-
navState.url.startsWith('https://onairos.uk/Home') ||
|
|
54
|
-
navState.url.startsWith('https://onairos.uk/home')
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
// For all platforms, we need to wait for the backend callback to complete
|
|
58
|
-
// The backend processes the OAuth callback and then redirects to onairos.uk/Home
|
|
59
|
-
if (isFinalRedirect) {
|
|
60
|
-
console.log(`${platform} OAuth completed - backend callback finished and redirected to Home`);
|
|
61
|
-
onSuccess('success');
|
|
62
|
-
|
|
63
|
-
// Close the OAuth window after a small delay to ensure redirect is processed
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
if (onComplete) {
|
|
66
|
-
console.log(`Closing ${platform} OAuth window after callback completion`);
|
|
67
|
-
onComplete();
|
|
68
|
-
}
|
|
69
|
-
}, 1000); // Increased delay to ensure backend processing completes
|
|
70
|
-
return; // Exit early to avoid other triggers
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Log intermediate callback URLs for debugging but don't close yet
|
|
74
|
-
const isIntermediateCallback = (
|
|
75
|
-
navState.url.includes('/callback') ||
|
|
76
|
-
navState.url.includes('code=') ||
|
|
77
|
-
navState.url.includes('token=') ||
|
|
78
|
-
navState.url.includes('access_token=')
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
if (isIntermediateCallback && !isFinalRedirect) {
|
|
82
|
-
console.log(`Detected intermediate callback URL for ${platform}:`, navState.url);
|
|
83
|
-
console.log('Waiting for backend processing to complete and final redirect...');
|
|
84
|
-
|
|
85
|
-
// Extract authorization code for logging purposes
|
|
86
|
-
const codeMatch = navState.url.match(/code=([^&]+)/);
|
|
87
|
-
if (codeMatch && codeMatch[1]) {
|
|
88
|
-
console.log('OAuth code detected:', codeMatch[1]);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Don't close yet - wait for the backend to process and redirect
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<View style={styles.modalContainer}>
|
|
98
|
-
<SafeAreaView style={styles.container}>
|
|
99
|
-
<View style={styles.header}>
|
|
100
|
-
<Text style={styles.title}>Connect {platform.charAt(0).toUpperCase() + platform.slice(1)}</Text>
|
|
101
|
-
{timeoutReached && (
|
|
102
|
-
<Text style={styles.timeoutText}>Taking longer than expected...</Text>
|
|
103
|
-
)}
|
|
104
|
-
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
105
|
-
<Text style={styles.closeButtonText}>✕</Text>
|
|
106
|
-
</TouchableOpacity>
|
|
107
|
-
</View>
|
|
108
|
-
|
|
109
|
-
<View style={styles.webViewContainer}>
|
|
110
|
-
{isLoading && (
|
|
111
|
-
<View style={styles.loadingContainer}>
|
|
112
|
-
<ActivityIndicator size="large" color="#1BA9D4" />
|
|
113
|
-
<Text style={styles.loadingText}>Loading...</Text>
|
|
114
|
-
</View>
|
|
115
|
-
)}
|
|
116
|
-
|
|
117
|
-
<WebView
|
|
118
|
-
source={{ uri: url }}
|
|
119
|
-
onNavigationStateChange={handleNavigationStateChange}
|
|
120
|
-
onLoadStart={() => setIsLoading(true)}
|
|
121
|
-
onLoadEnd={() => setIsLoading(false)}
|
|
122
|
-
style={styles.webView}
|
|
123
|
-
javaScriptEnabled={true}
|
|
124
|
-
domStorageEnabled={true}
|
|
125
|
-
cacheEnabled={true} // Enable cache to remember previous logins
|
|
126
|
-
incognito={false} // Disable incognito mode to remember previous logins
|
|
127
|
-
thirdPartyCookiesEnabled={true}
|
|
128
|
-
sharedCookiesEnabled={true} // Enable shared cookies for Google sign-in
|
|
129
|
-
userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"
|
|
130
|
-
onError={(syntheticEvent) => {
|
|
131
|
-
const { nativeEvent } = syntheticEvent;
|
|
132
|
-
console.error(`WebView error for ${platform}:`, nativeEvent);
|
|
133
|
-
// Don't automatically close on error - let user retry or manually close
|
|
134
|
-
}}
|
|
135
|
-
onHttpError={(syntheticEvent) => {
|
|
136
|
-
const { nativeEvent } = syntheticEvent;
|
|
137
|
-
console.error(`WebView HTTP error for ${platform}: ${nativeEvent.statusCode}`, nativeEvent.url);
|
|
138
|
-
|
|
139
|
-
// If we get a 404 or similar error on the final redirect, it might still be successful
|
|
140
|
-
if (nativeEvent.url && nativeEvent.url.includes('onairos.uk')) {
|
|
141
|
-
console.log('HTTP error on onairos.uk domain - treating as potential success');
|
|
142
|
-
onSuccess('success');
|
|
143
|
-
if (onComplete) {
|
|
144
|
-
setTimeout(() => onComplete(), 1000);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}}
|
|
148
|
-
/>
|
|
149
|
-
</View>
|
|
150
|
-
</SafeAreaView>
|
|
151
|
-
</View>
|
|
152
|
-
);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const styles = StyleSheet.create({
|
|
156
|
-
modalContainer: {
|
|
157
|
-
position: 'absolute',
|
|
158
|
-
top: 0,
|
|
159
|
-
left: 0,
|
|
160
|
-
right: 0,
|
|
161
|
-
bottom: 0,
|
|
162
|
-
width: width,
|
|
163
|
-
height: height,
|
|
164
|
-
backgroundColor: '#fff',
|
|
165
|
-
zIndex: 9999,
|
|
166
|
-
},
|
|
167
|
-
container: {
|
|
168
|
-
flex: 1,
|
|
169
|
-
backgroundColor: '#fff',
|
|
170
|
-
width: width,
|
|
171
|
-
height: height,
|
|
172
|
-
position: 'absolute',
|
|
173
|
-
top: 0,
|
|
174
|
-
left: 0,
|
|
175
|
-
right: 0,
|
|
176
|
-
bottom: 0,
|
|
177
|
-
zIndex: 999,
|
|
178
|
-
},
|
|
179
|
-
header: {
|
|
180
|
-
flexDirection: 'row',
|
|
181
|
-
alignItems: 'center',
|
|
182
|
-
justifyContent: 'space-between',
|
|
183
|
-
paddingHorizontal: 16,
|
|
184
|
-
paddingVertical: 12,
|
|
185
|
-
borderBottomWidth: 1,
|
|
186
|
-
borderBottomColor: '#E5E5E5',
|
|
187
|
-
backgroundColor: '#fff',
|
|
188
|
-
zIndex: 1000,
|
|
189
|
-
},
|
|
190
|
-
title: {
|
|
191
|
-
fontSize: 18,
|
|
192
|
-
fontWeight: '600',
|
|
193
|
-
color: '#333',
|
|
194
|
-
flex: 1,
|
|
195
|
-
textAlign: 'center',
|
|
196
|
-
},
|
|
197
|
-
closeButton: {
|
|
198
|
-
padding: 8,
|
|
199
|
-
},
|
|
200
|
-
closeButtonText: {
|
|
201
|
-
fontSize: 20,
|
|
202
|
-
color: '#666',
|
|
203
|
-
},
|
|
204
|
-
webViewContainer: {
|
|
205
|
-
flex: 1,
|
|
206
|
-
width: width,
|
|
207
|
-
height: height - 60, // Adjust for header height
|
|
208
|
-
},
|
|
209
|
-
webView: {
|
|
210
|
-
flex: 1,
|
|
211
|
-
width: '100%',
|
|
212
|
-
height: '100%',
|
|
213
|
-
},
|
|
214
|
-
loadingContainer: {
|
|
215
|
-
...StyleSheet.absoluteFillObject,
|
|
216
|
-
alignItems: 'center',
|
|
217
|
-
justifyContent: 'center',
|
|
218
|
-
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
|
219
|
-
zIndex: 1,
|
|
220
|
-
},
|
|
221
|
-
loadingText: {
|
|
222
|
-
marginTop: 12,
|
|
223
|
-
fontSize: 16,
|
|
224
|
-
color: '#666',
|
|
225
|
-
},
|
|
226
|
-
timeoutText: {
|
|
227
|
-
fontSize: 12,
|
|
228
|
-
color: '#FF6B6B',
|
|
229
|
-
textAlign: 'center',
|
|
230
|
-
marginTop: 4,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
ActivityIndicator,
|
|
8
|
+
SafeAreaView,
|
|
9
|
+
Dimensions,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { WebView } from 'react-native-webview';
|
|
12
|
+
|
|
13
|
+
const { width, height } = Dimensions.get('window');
|
|
14
|
+
|
|
15
|
+
export interface OAuthWebViewProps {
|
|
16
|
+
url: string;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onSuccess: (code: string) => void;
|
|
19
|
+
platform?: string;
|
|
20
|
+
onComplete?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const OAuthWebView: React.FC<OAuthWebViewProps> = ({
|
|
24
|
+
url,
|
|
25
|
+
onClose,
|
|
26
|
+
onSuccess,
|
|
27
|
+
platform = 'platform',
|
|
28
|
+
onComplete,
|
|
29
|
+
}) => {
|
|
30
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
31
|
+
const [timeoutReached, setTimeoutReached] = useState(false);
|
|
32
|
+
|
|
33
|
+
console.log('Opening OAuth WebView with URL:', url);
|
|
34
|
+
|
|
35
|
+
// Set up a timeout to prevent infinite waiting
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
const timeout = setTimeout(() => {
|
|
38
|
+
console.log(`⏰ OAuth timeout reached for ${platform} after 1 minutes`);
|
|
39
|
+
setTimeoutReached(true);
|
|
40
|
+
}, 60000); // 1 minutes timeout
|
|
41
|
+
|
|
42
|
+
return () => clearTimeout(timeout);
|
|
43
|
+
}, [platform]);
|
|
44
|
+
|
|
45
|
+
const handleNavigationStateChange = (navState: any) => {
|
|
46
|
+
console.log(`Navigation state changed for ${platform}:`, navState.url);
|
|
47
|
+
|
|
48
|
+
// Check for the final redirect to onairos.uk domain (this means backend callback completed)
|
|
49
|
+
const isFinalRedirect = (
|
|
50
|
+
navState.url.includes('onairos.uk/Home') ||
|
|
51
|
+
navState.url.includes('onairos.uk/home') ||
|
|
52
|
+
navState.url.includes('onairos.uk/success') ||
|
|
53
|
+
navState.url.startsWith('https://onairos.uk/Home') ||
|
|
54
|
+
navState.url.startsWith('https://onairos.uk/home')
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// For all platforms, we need to wait for the backend callback to complete
|
|
58
|
+
// The backend processes the OAuth callback and then redirects to onairos.uk/Home
|
|
59
|
+
if (isFinalRedirect) {
|
|
60
|
+
console.log(`${platform} OAuth completed - backend callback finished and redirected to Home`);
|
|
61
|
+
onSuccess('success');
|
|
62
|
+
|
|
63
|
+
// Close the OAuth window after a small delay to ensure redirect is processed
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
if (onComplete) {
|
|
66
|
+
console.log(`Closing ${platform} OAuth window after callback completion`);
|
|
67
|
+
onComplete();
|
|
68
|
+
}
|
|
69
|
+
}, 1000); // Increased delay to ensure backend processing completes
|
|
70
|
+
return; // Exit early to avoid other triggers
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Log intermediate callback URLs for debugging but don't close yet
|
|
74
|
+
const isIntermediateCallback = (
|
|
75
|
+
navState.url.includes('/callback') ||
|
|
76
|
+
navState.url.includes('code=') ||
|
|
77
|
+
navState.url.includes('token=') ||
|
|
78
|
+
navState.url.includes('access_token=')
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (isIntermediateCallback && !isFinalRedirect) {
|
|
82
|
+
console.log(`Detected intermediate callback URL for ${platform}:`, navState.url);
|
|
83
|
+
console.log('Waiting for backend processing to complete and final redirect...');
|
|
84
|
+
|
|
85
|
+
// Extract authorization code for logging purposes
|
|
86
|
+
const codeMatch = navState.url.match(/code=([^&]+)/);
|
|
87
|
+
if (codeMatch && codeMatch[1]) {
|
|
88
|
+
console.log('OAuth code detected:', codeMatch[1]);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Don't close yet - wait for the backend to process and redirect
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<View style={styles.modalContainer}>
|
|
98
|
+
<SafeAreaView style={styles.container}>
|
|
99
|
+
<View style={styles.header}>
|
|
100
|
+
<Text style={styles.title}>Connect {platform.charAt(0).toUpperCase() + platform.slice(1)}</Text>
|
|
101
|
+
{timeoutReached && (
|
|
102
|
+
<Text style={styles.timeoutText}>Taking longer than expected...</Text>
|
|
103
|
+
)}
|
|
104
|
+
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
105
|
+
<Text style={styles.closeButtonText}>✕</Text>
|
|
106
|
+
</TouchableOpacity>
|
|
107
|
+
</View>
|
|
108
|
+
|
|
109
|
+
<View style={styles.webViewContainer}>
|
|
110
|
+
{isLoading && (
|
|
111
|
+
<View style={styles.loadingContainer}>
|
|
112
|
+
<ActivityIndicator size="large" color="#1BA9D4" />
|
|
113
|
+
<Text style={styles.loadingText}>Loading...</Text>
|
|
114
|
+
</View>
|
|
115
|
+
)}
|
|
116
|
+
|
|
117
|
+
<WebView
|
|
118
|
+
source={{ uri: url }}
|
|
119
|
+
onNavigationStateChange={handleNavigationStateChange}
|
|
120
|
+
onLoadStart={() => setIsLoading(true)}
|
|
121
|
+
onLoadEnd={() => setIsLoading(false)}
|
|
122
|
+
style={styles.webView}
|
|
123
|
+
javaScriptEnabled={true}
|
|
124
|
+
domStorageEnabled={true}
|
|
125
|
+
cacheEnabled={true} // Enable cache to remember previous logins
|
|
126
|
+
incognito={false} // Disable incognito mode to remember previous logins
|
|
127
|
+
thirdPartyCookiesEnabled={true}
|
|
128
|
+
sharedCookiesEnabled={true} // Enable shared cookies for Google sign-in
|
|
129
|
+
userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"
|
|
130
|
+
onError={(syntheticEvent) => {
|
|
131
|
+
const { nativeEvent } = syntheticEvent;
|
|
132
|
+
console.error(`WebView error for ${platform}:`, nativeEvent);
|
|
133
|
+
// Don't automatically close on error - let user retry or manually close
|
|
134
|
+
}}
|
|
135
|
+
onHttpError={(syntheticEvent) => {
|
|
136
|
+
const { nativeEvent } = syntheticEvent;
|
|
137
|
+
console.error(`WebView HTTP error for ${platform}: ${nativeEvent.statusCode}`, nativeEvent.url);
|
|
138
|
+
|
|
139
|
+
// If we get a 404 or similar error on the final redirect, it might still be successful
|
|
140
|
+
if (nativeEvent.url && nativeEvent.url.includes('onairos.uk')) {
|
|
141
|
+
console.log('HTTP error on onairos.uk domain - treating as potential success');
|
|
142
|
+
onSuccess('success');
|
|
143
|
+
if (onComplete) {
|
|
144
|
+
setTimeout(() => onComplete(), 1000);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
</View>
|
|
150
|
+
</SafeAreaView>
|
|
151
|
+
</View>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const styles = StyleSheet.create({
|
|
156
|
+
modalContainer: {
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
top: 0,
|
|
159
|
+
left: 0,
|
|
160
|
+
right: 0,
|
|
161
|
+
bottom: 0,
|
|
162
|
+
width: width,
|
|
163
|
+
height: height,
|
|
164
|
+
backgroundColor: '#fff',
|
|
165
|
+
zIndex: 9999,
|
|
166
|
+
},
|
|
167
|
+
container: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
backgroundColor: '#fff',
|
|
170
|
+
width: width,
|
|
171
|
+
height: height,
|
|
172
|
+
position: 'absolute',
|
|
173
|
+
top: 0,
|
|
174
|
+
left: 0,
|
|
175
|
+
right: 0,
|
|
176
|
+
bottom: 0,
|
|
177
|
+
zIndex: 999,
|
|
178
|
+
},
|
|
179
|
+
header: {
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
justifyContent: 'space-between',
|
|
183
|
+
paddingHorizontal: 16,
|
|
184
|
+
paddingVertical: 12,
|
|
185
|
+
borderBottomWidth: 1,
|
|
186
|
+
borderBottomColor: '#E5E5E5',
|
|
187
|
+
backgroundColor: '#fff',
|
|
188
|
+
zIndex: 1000,
|
|
189
|
+
},
|
|
190
|
+
title: {
|
|
191
|
+
fontSize: 18,
|
|
192
|
+
fontWeight: '600',
|
|
193
|
+
color: '#333',
|
|
194
|
+
flex: 1,
|
|
195
|
+
textAlign: 'center',
|
|
196
|
+
},
|
|
197
|
+
closeButton: {
|
|
198
|
+
padding: 8,
|
|
199
|
+
},
|
|
200
|
+
closeButtonText: {
|
|
201
|
+
fontSize: 20,
|
|
202
|
+
color: '#666',
|
|
203
|
+
},
|
|
204
|
+
webViewContainer: {
|
|
205
|
+
flex: 1,
|
|
206
|
+
width: width,
|
|
207
|
+
height: height - 60, // Adjust for header height
|
|
208
|
+
},
|
|
209
|
+
webView: {
|
|
210
|
+
flex: 1,
|
|
211
|
+
width: '100%',
|
|
212
|
+
height: '100%',
|
|
213
|
+
},
|
|
214
|
+
loadingContainer: {
|
|
215
|
+
...StyleSheet.absoluteFillObject,
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
|
219
|
+
zIndex: 1,
|
|
220
|
+
},
|
|
221
|
+
loadingText: {
|
|
222
|
+
marginTop: 12,
|
|
223
|
+
fontSize: 16,
|
|
224
|
+
color: '#666',
|
|
225
|
+
},
|
|
226
|
+
timeoutText: {
|
|
227
|
+
fontSize: 12,
|
|
228
|
+
color: '#FF6B6B',
|
|
229
|
+
textAlign: 'center',
|
|
230
|
+
marginTop: 4,
|
|
231
|
+
},
|
|
232
|
+
});
|
package/src/config/api.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API Configuration for Onairos SDK
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export const API_CONFIG = {
|
|
6
|
-
BASE_URL: 'https://api.onairos.com',
|
|
7
|
-
ENDPOINTS: {
|
|
8
|
-
AUTH: '/auth',
|
|
9
|
-
USER: '/user',
|
|
10
|
-
CONNECTIONS: '/connections',
|
|
11
|
-
TRAINING: '/training',
|
|
12
|
-
OAUTH: '/oauth',
|
|
13
|
-
},
|
|
14
|
-
TIMEOUT: 30000,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const getApiHeaders = () => ({
|
|
18
|
-
'Content-Type': 'application/json',
|
|
19
|
-
'Accept': 'application/json',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const getAuthHeaders = (token?: string) => ({
|
|
23
|
-
...getApiHeaders(),
|
|
24
|
-
...(token && { 'Authorization': `Bearer ${token}` }),
|
|
25
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* API Configuration for Onairos SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const API_CONFIG = {
|
|
6
|
+
BASE_URL: 'https://api.onairos.com',
|
|
7
|
+
ENDPOINTS: {
|
|
8
|
+
AUTH: '/auth',
|
|
9
|
+
USER: '/user',
|
|
10
|
+
CONNECTIONS: '/connections',
|
|
11
|
+
TRAINING: '/training',
|
|
12
|
+
OAUTH: '/oauth',
|
|
13
|
+
},
|
|
14
|
+
TIMEOUT: 30000,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const getApiHeaders = () => ({
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'Accept': 'application/json',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const getAuthHeaders = (token?: string) => ({
|
|
23
|
+
...getApiHeaders(),
|
|
24
|
+
...(token && { 'Authorization': `Bearer ${token}` }),
|
|
25
|
+
});
|