@bigbinary/neeto-commons-rn 1.8.5 → 2.0.3
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 +64 -0
- package/eslint-config/index.js +84 -17
- package/eslint-config/rules/no-dangling-constants.js +1 -1
- package/lib/typescript/api/app_version.d.ts +10 -0
- package/lib/typescript/api/app_version.d.ts.map +1 -0
- package/lib/typescript/api/auth.d.ts +26 -0
- package/lib/typescript/api/auth.d.ts.map +1 -0
- package/lib/typescript/api/global_roles.d.ts +10 -0
- package/lib/typescript/api/global_roles.d.ts.map +1 -0
- package/lib/typescript/api/notifications.d.ts +38 -0
- package/lib/typescript/api/notifications.d.ts.map +1 -0
- package/lib/typescript/api/organization_roles.d.ts +11 -0
- package/lib/typescript/api/organization_roles.d.ts.map +1 -0
- package/lib/typescript/api/profile.d.ts +15 -0
- package/lib/typescript/api/profile.d.ts.map +1 -0
- package/lib/typescript/api/team_members.d.ts +34 -0
- package/lib/typescript/api/team_members.d.ts.map +1 -0
- package/lib/typescript/auth/index.d.ts +3 -0
- package/lib/typescript/auth/index.d.ts.map +1 -0
- package/lib/typescript/components/AppVersion.d.ts +2 -0
- package/lib/typescript/components/AppVersion.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet.d.ts +9 -0
- package/lib/typescript/components/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheetMenu.d.ts +7 -0
- package/lib/typescript/components/BottomSheetMenu.d.ts.map +1 -0
- package/lib/typescript/components/ConfirmSheet.d.ts +15 -0
- package/lib/typescript/components/ConfirmSheet.d.ts.map +1 -0
- package/lib/typescript/components/EmptyView.d.ts +19 -0
- package/lib/typescript/components/EmptyView.d.ts.map +1 -0
- package/lib/typescript/components/Header/BaseHeader.d.ts +7 -0
- package/lib/typescript/components/Header/BaseHeader.d.ts.map +1 -0
- package/lib/typescript/components/Header/ScreenHeader.d.ts +7 -0
- package/lib/typescript/components/Header/ScreenHeader.d.ts.map +1 -0
- package/lib/typescript/components/Header.d.ts +22 -0
- package/lib/typescript/components/Header.d.ts.map +1 -0
- package/lib/typescript/components/HyperlinkText.d.ts +17 -0
- package/lib/typescript/components/HyperlinkText.d.ts.map +1 -0
- package/lib/typescript/components/LineLoader.d.ts +13 -0
- package/lib/typescript/components/LineLoader.d.ts.map +1 -0
- package/lib/typescript/components/NotificationIcon.d.ts +6 -0
- package/lib/typescript/components/NotificationIcon.d.ts.map +1 -0
- package/lib/typescript/components/NotificationPreferenceList.d.ts +14 -0
- package/lib/typescript/components/NotificationPreferenceList.d.ts.map +1 -0
- package/lib/typescript/components/OfflineScreen.d.ts +7 -0
- package/lib/typescript/components/OfflineScreen.d.ts.map +1 -0
- package/lib/typescript/components/OrganizationItem.d.ts +8 -0
- package/lib/typescript/components/OrganizationItem.d.ts.map +1 -0
- package/lib/typescript/components/SocialButton.d.ts +11 -0
- package/lib/typescript/components/SocialButton.d.ts.map +1 -0
- package/lib/typescript/components/TextWithUrl.d.ts +7 -0
- package/lib/typescript/components/TextWithUrl.d.ts.map +1 -0
- package/lib/typescript/components/ToggleSwitch.d.ts +8 -0
- package/lib/typescript/components/ToggleSwitch.d.ts.map +1 -0
- package/lib/typescript/components/WorkspaceSwitcherPane.d.ts +9 -0
- package/lib/typescript/components/WorkspaceSwitcherPane.d.ts.map +1 -0
- package/lib/typescript/components/constants.d.ts +7 -0
- package/lib/typescript/components/constants.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +14 -0
- package/lib/typescript/components/index.d.ts.map +1 -0
- package/lib/typescript/config/axios/caseConversion.d.ts +4 -0
- package/lib/typescript/config/axios/caseConversion.d.ts.map +1 -0
- package/lib/typescript/config/axios/constants.d.ts +4 -0
- package/lib/typescript/config/axios/constants.d.ts.map +1 -0
- package/lib/typescript/config/axios/index.d.ts +13 -0
- package/lib/typescript/config/axios/index.d.ts.map +1 -0
- package/lib/typescript/config/axios/networkErrorHandler.d.ts +5 -0
- package/lib/typescript/config/axios/networkErrorHandler.d.ts.map +1 -0
- package/lib/typescript/config/axios/paramsSerializer.d.ts +3 -0
- package/lib/typescript/config/axios/paramsSerializer.d.ts.map +1 -0
- package/lib/typescript/config/axios/types.d.ts +10 -0
- package/lib/typescript/config/axios/types.d.ts.map +1 -0
- package/lib/typescript/config/bugsnag.d.ts +4 -0
- package/lib/typescript/config/bugsnag.d.ts.map +1 -0
- package/lib/typescript/config/dayjs.d.ts +23 -0
- package/lib/typescript/config/dayjs.d.ts.map +1 -0
- package/lib/typescript/config/googleSignin.d.ts +2 -0
- package/lib/typescript/config/googleSignin.d.ts.map +1 -0
- package/lib/typescript/config/index.d.ts +2 -0
- package/lib/typescript/config/index.d.ts.map +1 -0
- package/lib/typescript/config/validations.d.ts +2 -0
- package/lib/typescript/config/validations.d.ts.map +1 -0
- package/lib/typescript/constants/index.d.ts +8 -0
- package/lib/typescript/constants/index.d.ts.map +1 -0
- package/lib/typescript/contexts/index.d.ts +2 -0
- package/lib/typescript/contexts/index.d.ts.map +1 -0
- package/lib/typescript/contexts/localization.d.ts +26 -0
- package/lib/typescript/contexts/localization.d.ts.map +1 -0
- package/lib/typescript/helpers/asyncStore.d.ts +6 -0
- package/lib/typescript/helpers/asyncStore.d.ts.map +1 -0
- package/lib/typescript/helpers/index.d.ts +2 -0
- package/lib/typescript/helpers/index.d.ts.map +1 -0
- package/lib/typescript/helpers/keychain.d.ts +4 -0
- package/lib/typescript/helpers/keychain.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/apnsToken.d.ts +2 -0
- package/lib/typescript/helpers/notifications/apnsToken.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/constants.d.ts +5 -0
- package/lib/typescript/helpers/notifications/constants.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/getDeviceToken.d.ts +2 -0
- package/lib/typescript/helpers/notifications/getDeviceToken.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/index.d.ts +4 -0
- package/lib/typescript/helpers/notifications/index.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/registerBackgroundHandlers.d.ts +3 -0
- package/lib/typescript/helpers/notifications/registerBackgroundHandlers.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/types.d.ts +19 -0
- package/lib/typescript/helpers/notifications/types.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/usePushNotification.d.ts +7 -0
- package/lib/typescript/helpers/notifications/usePushNotification.d.ts.map +1 -0
- package/lib/typescript/helpers/scale.d.ts +2 -0
- package/lib/typescript/helpers/scale.d.ts.map +1 -0
- package/lib/typescript/helpers/utils.d.ts +5 -0
- package/lib/typescript/helpers/utils.d.ts.map +1 -0
- package/lib/typescript/hooks/index.d.ts +3 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/query/queryKeys.d.ts +9 -0
- package/lib/typescript/hooks/query/queryKeys.d.ts.map +1 -0
- package/lib/typescript/hooks/query/useAppVersionApi.d.ts +2 -0
- package/lib/typescript/hooks/query/useAppVersionApi.d.ts.map +1 -0
- package/lib/typescript/hooks/query/useAuth.d.ts +27 -0
- package/lib/typescript/hooks/query/useAuth.d.ts.map +1 -0
- package/lib/typescript/hooks/query/useNotification.d.ts +19 -0
- package/lib/typescript/hooks/query/useNotification.d.ts.map +1 -0
- package/lib/typescript/hooks/query/useProfile.d.ts +9 -0
- package/lib/typescript/hooks/query/useProfile.d.ts.map +1 -0
- package/lib/typescript/hooks/query/useRolesApi.d.ts +4 -0
- package/lib/typescript/hooks/query/useRolesApi.d.ts.map +1 -0
- package/lib/typescript/hooks/query/useTeamMembersApi.d.ts +23 -0
- package/lib/typescript/hooks/query/useTeamMembersApi.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppState.d.ts +2 -0
- package/lib/typescript/hooks/useAppState.d.ts.map +1 -0
- package/lib/typescript/hooks/usePushNotificationPermissions.d.ts +2 -0
- package/lib/typescript/hooks/usePushNotificationPermissions.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +9 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/initializers/index.d.ts +3 -0
- package/lib/typescript/initializers/index.d.ts.map +1 -0
- package/lib/typescript/initializers/logRocket.d.ts +2 -0
- package/lib/typescript/initializers/logRocket.d.ts.map +1 -0
- package/lib/typescript/localization/i18n.d.ts +4 -0
- package/lib/typescript/localization/i18n.d.ts.map +1 -0
- package/lib/typescript/localization/index.d.ts +7 -0
- package/lib/typescript/localization/index.d.ts.map +1 -0
- package/lib/typescript/navigation/navigationService.d.ts +14 -0
- package/lib/typescript/navigation/navigationService.d.ts.map +1 -0
- package/lib/typescript/navigation/screenNames.d.ts +10 -0
- package/lib/typescript/navigation/screenNames.d.ts.map +1 -0
- package/lib/typescript/navigation/stacks.d.ts +3 -0
- package/lib/typescript/navigation/stacks.d.ts.map +1 -0
- package/lib/typescript/navigation/types.d.ts +24 -0
- package/lib/typescript/navigation/types.d.ts.map +1 -0
- package/lib/typescript/providers/NeetoCommonsRNProvider.d.ts +14 -0
- package/lib/typescript/providers/NeetoCommonsRNProvider.d.ts.map +1 -0
- package/lib/typescript/providers/index.d.ts +2 -0
- package/lib/typescript/providers/index.d.ts.map +1 -0
- package/lib/typescript/screens/NotificationsScreen.d.ts +11 -0
- package/lib/typescript/screens/NotificationsScreen.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/AuthOptions.d.ts +7 -0
- package/lib/typescript/screens/authentication/AuthOptions.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/IncompleteOnboardingInfo.d.ts +4 -0
- package/lib/typescript/screens/authentication/IncompleteOnboardingInfo.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/LoginScreen.d.ts +3 -0
- package/lib/typescript/screens/authentication/LoginScreen.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/OTPVerificationScreen.d.ts +4 -0
- package/lib/typescript/screens/authentication/OTPVerificationScreen.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/Organization.d.ts +11 -0
- package/lib/typescript/screens/authentication/Organization.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/SubDomainScreen.d.ts +4 -0
- package/lib/typescript/screens/authentication/SubDomainScreen.d.ts.map +1 -0
- package/lib/typescript/screens/authentication/constants.d.ts +17 -0
- package/lib/typescript/screens/authentication/constants.d.ts.map +1 -0
- package/lib/typescript/screens/index.d.ts +11 -0
- package/lib/typescript/screens/index.d.ts.map +1 -0
- package/lib/typescript/screens/profile/ChatWidget.d.ts +3 -0
- package/lib/typescript/screens/profile/ChatWidget.d.ts.map +1 -0
- package/lib/typescript/screens/profile/ProfileScreen.d.ts +12 -0
- package/lib/typescript/screens/profile/ProfileScreen.d.ts.map +1 -0
- package/lib/typescript/screens/profile/UserData.d.ts +21 -0
- package/lib/typescript/screens/profile/UserData.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/Add.d.ts +4 -0
- package/lib/typescript/screens/team_members/Add.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/Card.d.ts +9 -0
- package/lib/typescript/screens/team_members/Card.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/Checkbox.d.ts +11 -0
- package/lib/typescript/screens/team_members/Checkbox.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/Edit.d.ts +5 -0
- package/lib/typescript/screens/team_members/Edit.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/Email.d.ts +11 -0
- package/lib/typescript/screens/team_members/Email.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/LoadingCard.d.ts +6 -0
- package/lib/typescript/screens/team_members/LoadingCard.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/ProductSelect.d.ts +11 -0
- package/lib/typescript/screens/team_members/ProductSelect.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/RolesRadioGroup.d.ts +14 -0
- package/lib/typescript/screens/team_members/RolesRadioGroup.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/SaveButtons.d.ts +10 -0
- package/lib/typescript/screens/team_members/SaveButtons.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/constants.d.ts +16 -0
- package/lib/typescript/screens/team_members/constants.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/index.d.ts +16 -0
- package/lib/typescript/screens/team_members/index.d.ts.map +1 -0
- package/lib/typescript/screens/team_members/utils.d.ts +20 -0
- package/lib/typescript/screens/team_members/utils.d.ts.map +1 -0
- package/lib/typescript/slices/auth.d.ts +31 -0
- package/lib/typescript/slices/auth.d.ts.map +1 -0
- package/lib/typescript/slices/index.d.ts +6 -0
- package/lib/typescript/slices/index.d.ts.map +1 -0
- package/lib/typescript/store/hooks.d.ts +6 -0
- package/lib/typescript/store/hooks.d.ts.map +1 -0
- package/lib/typescript/store/index.d.ts +18 -0
- package/lib/typescript/store/index.d.ts.map +1 -0
- package/lib/typescript/store/utils.d.ts +8 -0
- package/lib/typescript/store/utils.d.ts.map +1 -0
- package/lib/typescript/utils/apiHelpers.d.ts +5 -0
- package/lib/typescript/utils/apiHelpers.d.ts.map +1 -0
- package/package.json +267 -70
- package/src/api/app_version.ts +24 -0
- package/src/api/auth.ts +68 -0
- package/src/api/global_roles.ts +15 -0
- package/src/api/notifications.ts +66 -0
- package/src/api/organization_roles.ts +17 -0
- package/src/api/profile.ts +17 -0
- package/src/api/team_members.ts +39 -0
- package/src/assets/images/apple-logo.svg +3 -0
- package/src/assets/images/google-logo.svg +6 -0
- package/src/auth/index.ts +2 -0
- package/src/components/AppVersion.ts +154 -0
- package/src/components/BottomSheet.ts +9 -0
- package/src/components/BottomSheetMenu.ts +6 -0
- package/src/components/ConfirmSheet.ts +15 -0
- package/src/components/EmptyView.tsx +40 -0
- package/src/components/Header/BaseHeader.ts +6 -0
- package/src/components/Header/ScreenHeader.ts +6 -0
- package/src/components/Header.tsx +139 -0
- package/src/components/HyperlinkText.tsx +34 -0
- package/src/components/LineLoader.tsx +23 -0
- package/src/components/NotificationIcon.tsx +53 -0
- package/src/components/NotificationPreferenceList.tsx +132 -0
- package/src/components/OfflineScreen.tsx +89 -0
- package/src/components/OrganizationItem.tsx +67 -0
- package/src/components/SocialButton.tsx +78 -0
- package/src/components/TextWithUrl.ts +6 -0
- package/src/components/ToggleSwitch.tsx +89 -0
- package/src/components/WorkspaceSwitcherPane.tsx +113 -0
- package/src/components/constants.ts +16 -0
- package/src/components/index.ts +13 -0
- package/src/config/axios/caseConversion.ts +60 -0
- package/src/config/axios/constants.ts +17 -0
- package/src/config/axios/index.ts +291 -0
- package/src/config/axios/networkErrorHandler.ts +47 -0
- package/src/config/axios/paramsSerializer.ts +9 -0
- package/src/config/axios/types.ts +13 -0
- package/src/config/bugsnag.ts +48 -0
- package/src/config/dayjs.ts +42 -0
- package/src/config/googleSignin.ts +36 -0
- package/src/config/index.ts +11 -0
- package/src/config/validations.ts +15 -0
- package/src/constants/index.ts +9 -0
- package/src/contexts/index.ts +4 -0
- package/src/contexts/localization.tsx +183 -0
- package/src/helpers/asyncStore.ts +39 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/keychain.ts +46 -0
- package/src/helpers/notifications/apnsToken.ts +69 -0
- package/src/helpers/notifications/constants.ts +34 -0
- package/src/helpers/notifications/getDeviceToken.ts +17 -0
- package/src/helpers/notifications/index.ts +3 -0
- package/src/helpers/notifications/registerBackgroundHandlers.ts +62 -0
- package/src/helpers/notifications/types.ts +27 -0
- package/src/helpers/notifications/usePushNotification.ts +208 -0
- package/src/helpers/scale.ts +4 -0
- package/src/helpers/utils.ts +68 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/query/queryKeys.ts +8 -0
- package/src/hooks/query/useAppVersionApi.ts +12 -0
- package/src/hooks/query/useAuth.ts +253 -0
- package/src/hooks/query/useNotification.ts +130 -0
- package/src/hooks/query/useProfile.ts +21 -0
- package/src/hooks/query/useRolesApi.ts +25 -0
- package/src/hooks/query/useTeamMembersApi.ts +109 -0
- package/src/hooks/useAppState.ts +16 -0
- package/src/hooks/usePushNotificationPermissions.ts +111 -0
- package/src/index.ts +8 -0
- package/src/initializers/index.ts +3 -0
- package/src/initializers/logRocket.ts +25 -0
- package/src/localization/i18n.ts +19 -0
- package/src/localization/index.ts +14 -0
- package/src/navigation/navigationService.ts +37 -0
- package/src/navigation/screenNames.ts +11 -0
- package/src/navigation/stacks.tsx +30 -0
- package/src/navigation/types.ts +19 -0
- package/src/providers/NeetoCommonsRNProvider.tsx +77 -0
- package/src/providers/index.ts +1 -0
- package/src/screens/NotificationsScreen.tsx +290 -0
- package/src/screens/authentication/AuthOptions.tsx +254 -0
- package/src/screens/authentication/IncompleteOnboardingInfo.tsx +110 -0
- package/src/screens/authentication/LoginScreen.tsx +170 -0
- package/src/screens/authentication/OTPVerificationScreen.tsx +235 -0
- package/src/screens/authentication/Organization.tsx +102 -0
- package/src/screens/authentication/SubDomainScreen.tsx +176 -0
- package/src/screens/authentication/constants.ts +30 -0
- package/src/screens/index.ts +10 -0
- package/src/screens/profile/ChatWidget.tsx +8 -0
- package/src/screens/profile/ProfileScreen.tsx +251 -0
- package/src/screens/profile/UserData.tsx +92 -0
- package/src/screens/team_members/Add.tsx +248 -0
- package/src/screens/team_members/Card.tsx +124 -0
- package/src/screens/team_members/Checkbox.tsx +88 -0
- package/src/screens/team_members/Edit.tsx +171 -0
- package/src/screens/team_members/Email.tsx +59 -0
- package/src/screens/team_members/LoadingCard.tsx +75 -0
- package/src/screens/team_members/ProductSelect.tsx +218 -0
- package/src/screens/team_members/RolesRadioGroup.tsx +135 -0
- package/src/screens/team_members/SaveButtons.tsx +62 -0
- package/src/screens/team_members/constants.ts +33 -0
- package/src/screens/team_members/index.tsx +223 -0
- package/src/screens/team_members/utils.ts +84 -0
- package/src/slices/auth.ts +86 -0
- package/src/slices/index.ts +7 -0
- package/src/store/hooks.ts +8 -0
- package/src/store/index.ts +47 -0
- package/src/store/utils.ts +36 -0
- package/src/utils/apiHelpers.ts +7 -0
- package/types/assets.d.ts +38 -0
- package/types/neeto-icons-rn.d.ts +548 -0
- package/api/app_version.js +0 -1
- package/api/auth.js +0 -1
- package/api/global_roles.js +0 -1
- package/api/notifications.js +0 -1
- package/api/organization_roles.js +0 -1
- package/api/profile.js +0 -1
- package/api/team_members.js +0 -1
- package/auth/index.d.ts +0 -9
- package/auth/index.js +0 -1
- package/components/AppVersion.js +0 -1
- package/components/BottomSheet.js +0 -1
- package/components/BottomSheetMenu.js +0 -1
- package/components/ConfirmSheet.js +0 -1
- package/components/EmptyView.js +0 -1
- package/components/Header/BaseHeader.js +0 -1
- package/components/Header/ScreenHeader.js +0 -1
- package/components/Header.js +0 -1
- package/components/HyperlinkText.js +0 -1
- package/components/LineLoader.js +0 -1
- package/components/NotificationIcon.js +0 -1
- package/components/OfflineScreen.js +0 -1
- package/components/TextWithUrl.js +0 -1
- package/components/WorkspaceSwitcherPane.js +0 -1
- package/components/constants.js +0 -1
- package/components/index.js +0 -1
- package/config/axios/caseConversion.js +0 -1
- package/config/axios/constants.js +0 -1
- package/config/axios/index.js +0 -1
- package/config/axios/networkErrorHandler.js +0 -1
- package/config/axios/paramsSerializer.js +0 -1
- package/config/bugsnag.js +0 -1
- package/config/dayjs.js +0 -1
- package/config/googleSignin.js +0 -1
- package/config/index.js +0 -1
- package/config/validations.js +0 -1
- package/constants/index.d.ts +0 -5
- package/constants/index.js +0 -1
- package/contexts/index.js +0 -0
- package/contexts/localization.js +0 -1
- package/helpers/asyncStore.js +0 -1
- package/helpers/index.d.ts +0 -13
- package/helpers/index.js +0 -1
- package/helpers/keychain.d.ts +0 -4
- package/helpers/keychain.js +0 -1
- package/helpers/notifications/index.d.ts +0 -8
- package/helpers/notifications/index.js +0 -1
- package/helpers/notifications/usePushNotification.js +0 -1
- package/helpers/scale.js +0 -1
- package/helpers/utils.js +0 -1
- package/hooks/index.d.ts +0 -11
- package/hooks/index.js +0 -1
- package/hooks/query/constants.js +0 -1
- package/hooks/query/queryKeys.js +0 -1
- package/hooks/query/useAppVersionApi.js +0 -1
- package/hooks/query/useAuth.js +0 -1
- package/hooks/query/useNotification.js +0 -1
- package/hooks/query/useProfile.js +0 -1
- package/hooks/query/useRolesApi.js +0 -1
- package/hooks/query/useTeamMembersApi.js +0 -1
- package/hooks/useAppState.js +0 -1
- package/hooks/usePushNotificationPermissions.js +0 -1
- package/initializers/index.js +0 -1
- package/initializers/logRocket.js +0 -1
- package/localization/index.js +0 -1
- package/localization/translations/it.json +0 -13
- package/navigation/navigationService.js +0 -1
- package/navigation/screenNames.js +0 -1
- package/navigation/stacks.js +0 -1
- package/providers/NeetoCommonsRNProvider.js +0 -1
- package/providers/index.d.ts +0 -16
- package/providers/index.js +0 -1
- package/screens/NotificationsScreen.js +0 -1
- package/screens/authentication/AuthOptions.js +0 -1
- package/screens/authentication/IncompleteOnboardingInfo.js +0 -1
- package/screens/authentication/LoginScreen.js +0 -1
- package/screens/authentication/OTPVerificationScreen.js +0 -1
- package/screens/authentication/Organization.js +0 -1
- package/screens/authentication/SubDomainScreen.js +0 -1
- package/screens/authentication/constants.js +0 -1
- package/screens/index.js +0 -1
- package/screens/profile/ChatWidget.js +0 -1
- package/screens/profile/ProfileScreen.js +0 -1
- package/screens/profile/UserData.js +0 -1
- package/screens/team_members/Add.js +0 -1
- package/screens/team_members/Card.js +0 -1
- package/screens/team_members/Checkbox.js +0 -1
- package/screens/team_members/Edit.js +0 -1
- package/screens/team_members/Email.js +0 -1
- package/screens/team_members/LoadingCard.js +0 -1
- package/screens/team_members/ProductSelect.js +0 -1
- package/screens/team_members/RolesRadioGroup.js +0 -1
- package/screens/team_members/SaveButtons.js +0 -1
- package/screens/team_members/constants.js +0 -1
- package/screens/team_members/index.js +0 -1
- package/screens/team_members/utils.js +0 -1
- package/slices/auth.js +0 -1
- package/slices/index.js +0 -1
- package/store/index.d.ts +0 -7
- package/store/index.js +0 -1
- package/store/utils.js +0 -1
- package/utils/apiHelpers.js +0 -1
- /package/{assets → src/assets}/images/empty.svg +0 -0
- /package/{assets → src/assets}/images/wifi.png +0 -0
- /package/{localization → src/localization}/translations/en.json +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Platform, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Alert,
|
|
6
|
+
Button,
|
|
7
|
+
Container,
|
|
8
|
+
Divider,
|
|
9
|
+
Typography,
|
|
10
|
+
lightTheme,
|
|
11
|
+
} from "@bigbinary/neetoui-rn";
|
|
12
|
+
import appleAuth from "@invertase/react-native-apple-authentication";
|
|
13
|
+
import {
|
|
14
|
+
GoogleSignin,
|
|
15
|
+
isErrorWithCode,
|
|
16
|
+
isSuccessResponse,
|
|
17
|
+
} from "@react-native-google-signin/google-signin";
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
GOOGLE_LOGIN_ERRORS,
|
|
21
|
+
MAX_RETRY_ATTEMPTS,
|
|
22
|
+
RETRYABLE_ERROR_CODES,
|
|
23
|
+
} from "./constants";
|
|
24
|
+
|
|
25
|
+
import { SocialButton } from "../../components/SocialButton";
|
|
26
|
+
import { bugsnagErrorHandler } from "../../config/bugsnag";
|
|
27
|
+
import { useLocalization } from "../../contexts/localization";
|
|
28
|
+
import { removeSecureValue } from "../../helpers/keychain";
|
|
29
|
+
import { moderateScale } from "../../helpers/scale";
|
|
30
|
+
import { useAuth } from "../../hooks/query/useAuth";
|
|
31
|
+
|
|
32
|
+
type LoginType = "email" | "google" | "apple";
|
|
33
|
+
|
|
34
|
+
export interface AuthOptionsProps {
|
|
35
|
+
handleSubmit: () => void;
|
|
36
|
+
buttonLoading?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const AuthOptions = ({
|
|
40
|
+
handleSubmit,
|
|
41
|
+
buttonLoading = false,
|
|
42
|
+
}: AuthOptionsProps) => {
|
|
43
|
+
const { strings } = useLocalization();
|
|
44
|
+
|
|
45
|
+
const { useLoginViaGoogleMutation, useLoginViaAppleMutation } = useAuth();
|
|
46
|
+
|
|
47
|
+
const { mutate: loginViaGoogle, isPending: isLoginViaGoogleLoading } =
|
|
48
|
+
useLoginViaGoogleMutation();
|
|
49
|
+
|
|
50
|
+
const { mutate: loginViaApple, isPending: isLoginViaAppleLoading } =
|
|
51
|
+
useLoginViaAppleMutation();
|
|
52
|
+
|
|
53
|
+
const onGoogleButtonPress = async (retryCount = 0) => {
|
|
54
|
+
try {
|
|
55
|
+
const signedInUsingGoogle = GoogleSignin.hasPreviousSignIn();
|
|
56
|
+
if (signedInUsingGoogle) {
|
|
57
|
+
await GoogleSignin.signOut();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await GoogleSignin.hasPlayServices({
|
|
61
|
+
showPlayServicesUpdateDialog: true,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const authResponse = await GoogleSignin.signIn();
|
|
65
|
+
|
|
66
|
+
if (isSuccessResponse(authResponse)) {
|
|
67
|
+
const { serverAuthCode } = authResponse.data;
|
|
68
|
+
|
|
69
|
+
// Google types serverAuthCode as nullable. R.isEmpty(null) is false,
|
|
70
|
+
// so the previous isEmpty guard let a null code through to the API.
|
|
71
|
+
if (!serverAuthCode) {
|
|
72
|
+
bugsnagErrorHandler(
|
|
73
|
+
JSON.stringify(authResponse),
|
|
74
|
+
"Empty serverAuthCode in GoogleLogin"
|
|
75
|
+
);
|
|
76
|
+
} else {
|
|
77
|
+
loginViaGoogle({ serverAuthCode });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (isErrorWithCode(error)) {
|
|
82
|
+
if (
|
|
83
|
+
RETRYABLE_ERROR_CODES.includes(error.code) &&
|
|
84
|
+
retryCount < MAX_RETRY_ATTEMPTS
|
|
85
|
+
) {
|
|
86
|
+
Alert.show({
|
|
87
|
+
title: strings.commons.errors.googleSignIn.retryTitle,
|
|
88
|
+
description: strings.commons.errors.googleSignIn.retryableError,
|
|
89
|
+
buttons: [
|
|
90
|
+
{
|
|
91
|
+
label: strings.commons.buttons.retry,
|
|
92
|
+
onPress: () => onGoogleButtonPress(retryCount + 1),
|
|
93
|
+
},
|
|
94
|
+
{ label: strings.commons.buttons.cancel, onPress: () => {} },
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
} else if (retryCount >= MAX_RETRY_ATTEMPTS) {
|
|
98
|
+
Alert.show({
|
|
99
|
+
title: strings.commons.errors.googleSignIn.failureTitle,
|
|
100
|
+
description: strings.commons.errors.googleSignIn.maxRetries,
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
let errorMessage = strings.commons.errors.googleSignIn.default;
|
|
104
|
+
|
|
105
|
+
switch (error.code) {
|
|
106
|
+
case GOOGLE_LOGIN_ERRORS.SIGN_IN_CANCELLED:
|
|
107
|
+
return; // User cancelled the login flow
|
|
108
|
+
case GOOGLE_LOGIN_ERRORS.PLAY_SERVICES_NOT_AVAILABLE:
|
|
109
|
+
errorMessage =
|
|
110
|
+
strings.commons.errors.googleSignIn.playServicesNotAvailable;
|
|
111
|
+
break;
|
|
112
|
+
case GOOGLE_LOGIN_ERRORS.SIGN_IN_REQUIRED:
|
|
113
|
+
errorMessage = strings.commons.errors.googleSignIn.signInRequired;
|
|
114
|
+
break;
|
|
115
|
+
case GOOGLE_LOGIN_ERRORS.INVALID_ACCOUNT:
|
|
116
|
+
errorMessage = strings.commons.errors.googleSignIn.invalidAccount;
|
|
117
|
+
break;
|
|
118
|
+
case GOOGLE_LOGIN_ERRORS.RESOLUTION_REQUIRED:
|
|
119
|
+
errorMessage =
|
|
120
|
+
strings.commons.errors.googleSignIn.resolutionRequired;
|
|
121
|
+
break;
|
|
122
|
+
case GOOGLE_LOGIN_ERRORS.API_NOT_CONNECTED:
|
|
123
|
+
errorMessage =
|
|
124
|
+
strings.commons.errors.googleSignIn.apiNotConnected;
|
|
125
|
+
break;
|
|
126
|
+
case GOOGLE_LOGIN_ERRORS.DEVELOPER_ERROR:
|
|
127
|
+
errorMessage = strings.commons.errors.googleSignIn.developerError;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
Alert.show({
|
|
132
|
+
title: strings.commons.errors.googleSignIn.failureTitle,
|
|
133
|
+
description: errorMessage,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
bugsnagErrorHandler(
|
|
137
|
+
JSON.stringify({
|
|
138
|
+
code: error.code,
|
|
139
|
+
message: error.message,
|
|
140
|
+
}),
|
|
141
|
+
"Google Sign-in API Error in GoogleLogin"
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
bugsnagErrorHandler(error as Error, "Error in GoogleLogin");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const onAppleButtonPress = async () => {
|
|
151
|
+
try {
|
|
152
|
+
const { identityToken, authorizationCode } =
|
|
153
|
+
await appleAuth.performRequest({
|
|
154
|
+
requestedOperation: appleAuth.Operation.LOGIN,
|
|
155
|
+
requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Apple types both credentials as nullable, and the API needs both.
|
|
159
|
+
if (!identityToken || !authorizationCode) {
|
|
160
|
+
bugsnagErrorHandler(
|
|
161
|
+
"Missing identityToken or authorizationCode in AppleLogin",
|
|
162
|
+
"Empty credentials in AppleLogin"
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
loginViaApple({ identityToken, authorizationCode });
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (
|
|
171
|
+
!["1000", "1001"].includes((error as { code?: string })?.code ?? "")
|
|
172
|
+
) {
|
|
173
|
+
bugsnagErrorHandler(error as Error, "AppleLogin");
|
|
174
|
+
await removeSecureValue("userAuth");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const handleOnLogin = async (type: LoginType) => {
|
|
180
|
+
await removeSecureValue("userAuth");
|
|
181
|
+
switch (type) {
|
|
182
|
+
case "email":
|
|
183
|
+
handleSubmit();
|
|
184
|
+
break;
|
|
185
|
+
case "google":
|
|
186
|
+
onGoogleButtonPress();
|
|
187
|
+
break;
|
|
188
|
+
case "apple":
|
|
189
|
+
onAppleButtonPress();
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<Container>
|
|
196
|
+
<Button
|
|
197
|
+
isLoading={buttonLoading}
|
|
198
|
+
label={strings.commons.buttons.continue}
|
|
199
|
+
onPress={() => handleOnLogin("email")}
|
|
200
|
+
/>
|
|
201
|
+
<Container style={styles.separatorRow}>
|
|
202
|
+
<Divider
|
|
203
|
+
orientation="horizontal"
|
|
204
|
+
style={styles.separatorRule}
|
|
205
|
+
thickness={1}
|
|
206
|
+
/>
|
|
207
|
+
<Typography
|
|
208
|
+
style={styles.separatorLabel}
|
|
209
|
+
variant="subtext"
|
|
210
|
+
weight="regular"
|
|
211
|
+
>
|
|
212
|
+
{strings.commons.conditionals.OR}
|
|
213
|
+
</Typography>
|
|
214
|
+
<Divider
|
|
215
|
+
orientation="horizontal"
|
|
216
|
+
style={styles.separatorRule}
|
|
217
|
+
thickness={1}
|
|
218
|
+
/>
|
|
219
|
+
</Container>
|
|
220
|
+
<SocialButton
|
|
221
|
+
isLoading={isLoginViaGoogleLoading}
|
|
222
|
+
variant="google"
|
|
223
|
+
onPress={() => handleOnLogin("google")}
|
|
224
|
+
/>
|
|
225
|
+
{Platform.OS === "ios" && appleAuth.isSupported && (
|
|
226
|
+
<SocialButton
|
|
227
|
+
isLoading={isLoginViaAppleLoading}
|
|
228
|
+
style={styles.appleButton}
|
|
229
|
+
variant="apple"
|
|
230
|
+
onPress={() => handleOnLogin("apple")}
|
|
231
|
+
/>
|
|
232
|
+
)}
|
|
233
|
+
</Container>
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const styles = StyleSheet.create({
|
|
238
|
+
appleButton: {
|
|
239
|
+
marginTop: moderateScale(24),
|
|
240
|
+
},
|
|
241
|
+
separatorRow: {
|
|
242
|
+
alignItems: "center",
|
|
243
|
+
flexDirection: "row",
|
|
244
|
+
justifyContent: "space-between",
|
|
245
|
+
marginVertical: 32,
|
|
246
|
+
},
|
|
247
|
+
separatorRule: {
|
|
248
|
+
backgroundColor: lightTheme.colors.palette.grey400,
|
|
249
|
+
flex: 1,
|
|
250
|
+
},
|
|
251
|
+
separatorLabel: {
|
|
252
|
+
marginHorizontal: 2,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { Linking, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Container,
|
|
6
|
+
ParentView,
|
|
7
|
+
Touchable,
|
|
8
|
+
Typography,
|
|
9
|
+
lightTheme,
|
|
10
|
+
} from "@bigbinary/neetoui-rn";
|
|
11
|
+
import Config from "react-native-config";
|
|
12
|
+
import Icon from "react-native-remix-icon";
|
|
13
|
+
|
|
14
|
+
import { HyperlinkText } from "../../components/HyperlinkText";
|
|
15
|
+
import { useLocalization } from "../../contexts/localization";
|
|
16
|
+
import { moderateScale } from "../../helpers/scale";
|
|
17
|
+
import {
|
|
18
|
+
type CommonsParamList,
|
|
19
|
+
type CommonsScreenProps,
|
|
20
|
+
} from "../../navigation/types";
|
|
21
|
+
|
|
22
|
+
export const IncompleteOnboardingInfo = ({
|
|
23
|
+
navigation,
|
|
24
|
+
route,
|
|
25
|
+
}: CommonsScreenProps<"UnBoarded">) => {
|
|
26
|
+
const {
|
|
27
|
+
strings: {
|
|
28
|
+
commons: { unboardedOrganization },
|
|
29
|
+
formatString,
|
|
30
|
+
},
|
|
31
|
+
} = useLocalization();
|
|
32
|
+
|
|
33
|
+
// The navigator types params as required, but a host app can still push
|
|
34
|
+
// this route without them; the fallback keeps the pre-TypeScript
|
|
35
|
+
// behaviour of rendering with empty values instead of throwing.
|
|
36
|
+
const { name, subdomain } =
|
|
37
|
+
route.params ?? ({} as CommonsParamList["UnBoarded"]);
|
|
38
|
+
|
|
39
|
+
const webAppLink = `https://${subdomain}${Config.URL_SUFFIX}`;
|
|
40
|
+
// Needs to handled once we the implementation in place.
|
|
41
|
+
const helpLink = `https://${subdomain}${Config.URL_SUFFIX}/support`;
|
|
42
|
+
|
|
43
|
+
const onBackPress = useCallback(() => {
|
|
44
|
+
if (navigation.canGoBack()) {
|
|
45
|
+
navigation.goBack();
|
|
46
|
+
}
|
|
47
|
+
}, [navigation]);
|
|
48
|
+
|
|
49
|
+
const handleOnPressURL = useCallback(
|
|
50
|
+
(url: string) => Linking.openURL(url),
|
|
51
|
+
[]
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// ParentView is already `flex: 1` and defaults its background to the
|
|
55
|
+
// theme's `background.primary`, which is what `bg="background.primary"`
|
|
56
|
+
// asked for.
|
|
57
|
+
return (
|
|
58
|
+
<ParentView barStyle="dark-content">
|
|
59
|
+
<Container style={styles.header}>
|
|
60
|
+
{/* v3's ripple config dropped `isCentered`; nothing replaces it. */}
|
|
61
|
+
<Touchable
|
|
62
|
+
hitSlop={10}
|
|
63
|
+
rippleConfig={{ shouldOverflowContainer: true }}
|
|
64
|
+
style={styles.backButton}
|
|
65
|
+
onPress={onBackPress}
|
|
66
|
+
>
|
|
67
|
+
<Icon name="arrow-left-s-line" size={moderateScale(24)} />
|
|
68
|
+
</Touchable>
|
|
69
|
+
</Container>
|
|
70
|
+
<Container style={styles.body}>
|
|
71
|
+
<Typography variant="modalHeader">
|
|
72
|
+
{formatString(unboardedOrganization.title, name)}
|
|
73
|
+
</Typography>
|
|
74
|
+
<HyperlinkText
|
|
75
|
+
linkStyleProps={{ color: lightTheme.colors.primary }}
|
|
76
|
+
textStyleProps={{ style: styles.infoMessage }}
|
|
77
|
+
linkMapping={{
|
|
78
|
+
[helpLink]: unboardedOrganization.supportLabel,
|
|
79
|
+
[webAppLink]: unboardedOrganization.appLinkLabel,
|
|
80
|
+
}}
|
|
81
|
+
text={formatString(
|
|
82
|
+
unboardedOrganization.infoMessage,
|
|
83
|
+
webAppLink,
|
|
84
|
+
helpLink
|
|
85
|
+
)}
|
|
86
|
+
onPress={handleOnPressURL}
|
|
87
|
+
/>
|
|
88
|
+
</Container>
|
|
89
|
+
</ParentView>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const styles = StyleSheet.create({
|
|
94
|
+
header: {
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
flexDirection: "row",
|
|
97
|
+
height: moderateScale(44),
|
|
98
|
+
paddingHorizontal: moderateScale(16),
|
|
99
|
+
},
|
|
100
|
+
backButton: {
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
justifyContent: "center",
|
|
103
|
+
},
|
|
104
|
+
body: {
|
|
105
|
+
marginHorizontal: moderateScale(16),
|
|
106
|
+
},
|
|
107
|
+
infoMessage: {
|
|
108
|
+
marginTop: moderateScale(16),
|
|
109
|
+
},
|
|
110
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Platform, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Container,
|
|
6
|
+
Input,
|
|
7
|
+
ParentView,
|
|
8
|
+
Toast,
|
|
9
|
+
Typography,
|
|
10
|
+
lightTheme,
|
|
11
|
+
} from "@bigbinary/neetoui-rn";
|
|
12
|
+
import { useFormik } from "formik";
|
|
13
|
+
import Config from "react-native-config";
|
|
14
|
+
import DeviceInfo from "react-native-device-info";
|
|
15
|
+
import * as Yup from "yup";
|
|
16
|
+
|
|
17
|
+
import { AuthOptions } from "./AuthOptions";
|
|
18
|
+
|
|
19
|
+
import { ScreenHeader } from "../../components";
|
|
20
|
+
import { useLocalization } from "../../contexts/localization";
|
|
21
|
+
import { getItem } from "../../helpers/asyncStore";
|
|
22
|
+
import {
|
|
23
|
+
getSecureValue,
|
|
24
|
+
setSecureValue,
|
|
25
|
+
removeSecureValue,
|
|
26
|
+
} from "../../helpers/keychain";
|
|
27
|
+
import { moderateScale } from "../../helpers/scale";
|
|
28
|
+
import { useAuth } from "../../hooks/query/useAuth";
|
|
29
|
+
|
|
30
|
+
const logError = (error: unknown) => {
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.error("Error in clearing token:", error);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
screen: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
},
|
|
39
|
+
body: {
|
|
40
|
+
flex: 1,
|
|
41
|
+
marginHorizontal: 16,
|
|
42
|
+
},
|
|
43
|
+
inputWrapper: {
|
|
44
|
+
justifyContent: "space-around",
|
|
45
|
+
marginBottom: 32,
|
|
46
|
+
marginTop: 18,
|
|
47
|
+
},
|
|
48
|
+
versionText: {
|
|
49
|
+
position: "absolute",
|
|
50
|
+
left: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
bottom: moderateScale(50),
|
|
53
|
+
textAlign: "center",
|
|
54
|
+
},
|
|
55
|
+
androidVersionText: {
|
|
56
|
+
lineHeight: moderateScale(25),
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const LoginScreen = () => {
|
|
61
|
+
const { useGenerateOTPMutation } = useAuth();
|
|
62
|
+
const { mutate: generateOTP, isPending: isGeneratingOTP } =
|
|
63
|
+
useGenerateOTPMutation();
|
|
64
|
+
|
|
65
|
+
const { strings } = useLocalization();
|
|
66
|
+
|
|
67
|
+
const {
|
|
68
|
+
handleChange,
|
|
69
|
+
handleSubmit,
|
|
70
|
+
errors,
|
|
71
|
+
values,
|
|
72
|
+
isValid,
|
|
73
|
+
touched,
|
|
74
|
+
setFieldValue,
|
|
75
|
+
} = useFormik({
|
|
76
|
+
validationSchema: Yup.object().shape({
|
|
77
|
+
email: Yup.string().required().email(),
|
|
78
|
+
}),
|
|
79
|
+
validateOnBlur: true,
|
|
80
|
+
initialValues: { email: "" },
|
|
81
|
+
onSubmit: ({ email }) => {
|
|
82
|
+
if (isValid) {
|
|
83
|
+
generateOTP({ email });
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const { email } = values;
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const checkEmaiLExists = async () => {
|
|
92
|
+
try {
|
|
93
|
+
const emailid = await getItem<string>("email");
|
|
94
|
+
if (emailid) handleChange("email")(emailid);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
Toast.show({
|
|
97
|
+
type: "error",
|
|
98
|
+
text2: (error as Error)?.message,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
checkEmaiLExists();
|
|
103
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
|
+
}, []);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const clearToken = async () => {
|
|
108
|
+
try {
|
|
109
|
+
const userAuth = await getSecureValue("userAuth");
|
|
110
|
+
if (userAuth) {
|
|
111
|
+
const parsedAuth = JSON.parse(userAuth);
|
|
112
|
+
const { authToken, ...rest } = parsedAuth || {};
|
|
113
|
+
if (authToken) {
|
|
114
|
+
await setSecureValue("userAuth", JSON.stringify(rest));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (error) {
|
|
118
|
+
logError(error);
|
|
119
|
+
await removeSecureValue("userAuth");
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
clearToken();
|
|
124
|
+
}, []);
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<ParentView
|
|
128
|
+
backgroundColor={lightTheme.colors.white}
|
|
129
|
+
barStyle="dark-content"
|
|
130
|
+
style={styles.screen}
|
|
131
|
+
>
|
|
132
|
+
<Container style={styles.body}>
|
|
133
|
+
{/*
|
|
134
|
+
The v2 `lineHeight` override has no v3 counterpart: ScreenHeader
|
|
135
|
+
takes only `title` and a container `style`, and sets the title's
|
|
136
|
+
line height itself on Android.
|
|
137
|
+
*/}
|
|
138
|
+
<ScreenHeader title={strings.commons.headers.login} />
|
|
139
|
+
<Container style={styles.inputWrapper}>
|
|
140
|
+
<Input
|
|
141
|
+
autoCapitalize="none"
|
|
142
|
+
error={touched?.email ? errors?.email : ""}
|
|
143
|
+
keyboardType="email-address"
|
|
144
|
+
label={strings.commons.labels.Email}
|
|
145
|
+
value={email}
|
|
146
|
+
onBlur={() => setFieldValue("email", email.toLowerCase())}
|
|
147
|
+
onChangeText={handleChange("email")}
|
|
148
|
+
/>
|
|
149
|
+
</Container>
|
|
150
|
+
<AuthOptions
|
|
151
|
+
buttonLoading={isGeneratingOTP}
|
|
152
|
+
handleSubmit={handleSubmit}
|
|
153
|
+
/>
|
|
154
|
+
</Container>
|
|
155
|
+
<Typography
|
|
156
|
+
color={lightTheme.colors.palette.grey600}
|
|
157
|
+
size="xs"
|
|
158
|
+
weight="regular"
|
|
159
|
+
style={StyleSheet.flatten([
|
|
160
|
+
styles.versionText,
|
|
161
|
+
Platform.OS === "android" && styles.androidVersionText,
|
|
162
|
+
])}
|
|
163
|
+
>
|
|
164
|
+
{Config.APP_DISPLAY_NAME}
|
|
165
|
+
{strings.commons.common.version}
|
|
166
|
+
{DeviceInfo.getVersion()}
|
|
167
|
+
</Typography>
|
|
168
|
+
</ParentView>
|
|
169
|
+
);
|
|
170
|
+
};
|