@bigbinary/neeto-commons-rn 1.8.5 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,291 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { Toast } from "@bigbinary/neetoui-rn";
|
|
4
|
+
import Bugsnag from "@bugsnag/react-native";
|
|
5
|
+
import axios, {
|
|
6
|
+
type AxiosError,
|
|
7
|
+
type AxiosResponse,
|
|
8
|
+
type InternalAxiosRequestConfig,
|
|
9
|
+
} from "axios";
|
|
10
|
+
import Config from "react-native-config";
|
|
11
|
+
import DeviceInfo from "react-native-device-info";
|
|
12
|
+
|
|
13
|
+
import { convertRequestKeys, convertResponseKeys } from "./caseConversion";
|
|
14
|
+
import { handleNetworkError } from "./networkErrorHandler";
|
|
15
|
+
import setParamsSerializer from "./paramsSerializer";
|
|
16
|
+
|
|
17
|
+
import { STORAGE_KEYS } from "../../constants";
|
|
18
|
+
import { removeItem } from "../../helpers/asyncStore";
|
|
19
|
+
import { getSecureValue, removeSecureValue } from "../../helpers/keychain";
|
|
20
|
+
import { strings } from "../../localization";
|
|
21
|
+
import { reset } from "../../navigation/navigationService";
|
|
22
|
+
import { SCREEN_NAMES } from "../../navigation/screenNames";
|
|
23
|
+
import { logoutUserAction } from "../../slices/auth";
|
|
24
|
+
import { Store } from "../../store";
|
|
25
|
+
|
|
26
|
+
// The error bodies neeto services return: a single message, a field-keyed map
|
|
27
|
+
// of messages, or a list.
|
|
28
|
+
export interface ApiErrorData {
|
|
29
|
+
error?: string | Record<string, string>;
|
|
30
|
+
errors?: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const filterSensitiveData = (data: unknown) => {
|
|
34
|
+
if (!data) return null;
|
|
35
|
+
|
|
36
|
+
const sensitiveKeys = [
|
|
37
|
+
"x-auth-token",
|
|
38
|
+
"x-auth-email",
|
|
39
|
+
"password",
|
|
40
|
+
"password_confirmation",
|
|
41
|
+
"current_password",
|
|
42
|
+
"token",
|
|
43
|
+
"access_token",
|
|
44
|
+
"refresh_token",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const filteredData = { ...(data as Record<string, unknown>) };
|
|
48
|
+
|
|
49
|
+
const filterNestedData = (obj: Record<string, unknown>) => {
|
|
50
|
+
Object.keys(obj).forEach(key => {
|
|
51
|
+
if (sensitiveKeys.includes(key)) {
|
|
52
|
+
delete obj[key];
|
|
53
|
+
} else if (obj[key] && typeof obj[key] === "object") {
|
|
54
|
+
filterNestedData(obj[key] as Record<string, unknown>);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
filterNestedData(filteredData);
|
|
60
|
+
|
|
61
|
+
return filteredData;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const isAuthEndpoint = (url: string) =>
|
|
65
|
+
url.includes("/api/mobile/v1/verify_otp") ||
|
|
66
|
+
url.includes("/api/mobile/v1/generate_otp") ||
|
|
67
|
+
url.includes("/api/mobile/v1/google_login") ||
|
|
68
|
+
url.includes("/api/mobile/v1/apple_login");
|
|
69
|
+
|
|
70
|
+
axios.defaults.headers.common = {
|
|
71
|
+
accept: "application/json",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const rootUrlCreator = ({ subdomain }: { subdomain: string }) =>
|
|
75
|
+
`http${Config.IS_DEV ? "" : "s"}://${subdomain}${Config.URL_SUFFIX}`;
|
|
76
|
+
|
|
77
|
+
const getUnauthorizedErrorMessage = (error: AxiosError<ApiErrorData>) => {
|
|
78
|
+
if (error.config?.url?.includes("/api/mobile/v1/generate_otp")) {
|
|
79
|
+
return strings.en.errors.axios.spamLimit;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const rawError = error.response?.data?.error;
|
|
83
|
+
|
|
84
|
+
if (typeof rawError === "object" && rawError !== null) {
|
|
85
|
+
return Object.values(rawError)[0] || strings.en.errors.axios.unauthorized;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return (rawError ||
|
|
89
|
+
error.response?.data?.errors?.join(", ") ||
|
|
90
|
+
strings.en.errors.axios.unauthorized) as string;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const handleUnauthorizedAccess = async (errorMessage: string) => {
|
|
94
|
+
Toast.show({
|
|
95
|
+
type: "error",
|
|
96
|
+
text2: Store.getState().auth.name
|
|
97
|
+
? strings.en.errors.axios.sessionExpired
|
|
98
|
+
: errorMessage,
|
|
99
|
+
});
|
|
100
|
+
removeItem(STORAGE_KEYS.DEVICE_TOKEN);
|
|
101
|
+
await removeSecureValue("userAuth");
|
|
102
|
+
Store.dispatch(logoutUserAction());
|
|
103
|
+
|
|
104
|
+
reset({ name: SCREEN_NAMES.Login });
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const getErrorMessage = (
|
|
108
|
+
data: ApiErrorData | undefined,
|
|
109
|
+
error: AxiosError
|
|
110
|
+
): string => {
|
|
111
|
+
if (typeof data?.error === "object" && data.error !== null) {
|
|
112
|
+
return Object.values(data.error)[0] || strings.en.errors.axios.generic;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return data?.error || error.message || strings.en.errors.axios.generic;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
interface UserAuthData {
|
|
119
|
+
authToken: string;
|
|
120
|
+
email: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const getUserAuthData = async (): Promise<UserAuthData | null> => {
|
|
124
|
+
const authValue = await getSecureValue("userAuth");
|
|
125
|
+
|
|
126
|
+
return authValue ? (JSON.parse(authValue) as UserAuthData) : null;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleSuccessResponse = (response: AxiosResponse) => {
|
|
130
|
+
// Convert response data keys from snake_case to camelCase
|
|
131
|
+
if (response.data) {
|
|
132
|
+
response.data = convertResponseKeys(
|
|
133
|
+
response.data,
|
|
134
|
+
response.config?.caseConversionOptions
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return response;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// eslint-disable-next-line no-console
|
|
142
|
+
const handleErrorRequest = (error: unknown) => console.error(error);
|
|
143
|
+
|
|
144
|
+
const handleErrorResponse = async (error: AxiosError<ApiErrorData>) => {
|
|
145
|
+
const { response } = error;
|
|
146
|
+
const status = response?.status;
|
|
147
|
+
const data = response?.data;
|
|
148
|
+
|
|
149
|
+
if (handleNetworkError(error)) {
|
|
150
|
+
return Promise.reject(error);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (status === 401) {
|
|
154
|
+
if (isAuthEndpoint(error.config?.url || "")) return Promise.reject(error);
|
|
155
|
+
|
|
156
|
+
// Handle unauthorized access
|
|
157
|
+
const errorMessage = getUnauthorizedErrorMessage(error);
|
|
158
|
+
await handleUnauthorizedAccess(errorMessage);
|
|
159
|
+
} else if (data?.errors) {
|
|
160
|
+
// Handle multiple errors
|
|
161
|
+
data.errors.forEach(errorMessage => {
|
|
162
|
+
Toast.show({ type: "error", text2: errorMessage });
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
// Handle general errors
|
|
166
|
+
const errorMessage = getErrorMessage(data, error);
|
|
167
|
+
Toast.show({ type: "error", text2: errorMessage });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return Promise.reject(error);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
let responseInterceptorId: number | null = null;
|
|
174
|
+
let requestInterceptorId: number | null = null;
|
|
175
|
+
|
|
176
|
+
const registerResponseIntercept = () => {
|
|
177
|
+
if (responseInterceptorId !== null) {
|
|
178
|
+
axios.interceptors.response.eject(responseInterceptorId);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
responseInterceptorId = axios.interceptors.response.use(
|
|
182
|
+
response => handleSuccessResponse(response),
|
|
183
|
+
// eslint-disable-next-line require-await, promise/prefer-await-to-callbacks
|
|
184
|
+
async (error: AxiosError<ApiErrorData>) => {
|
|
185
|
+
const { config, response, message, name, code } = error;
|
|
186
|
+
const status = response?.status;
|
|
187
|
+
|
|
188
|
+
// Only report non-network errors to Bugsnag
|
|
189
|
+
if (!__DEV__ && status !== 401 && !handleNetworkError(error, false)) {
|
|
190
|
+
try {
|
|
191
|
+
Bugsnag.notify(new Error(`Axios Error: ${message}`), report => {
|
|
192
|
+
report.addMetadata("axios_error_details", {
|
|
193
|
+
message,
|
|
194
|
+
name,
|
|
195
|
+
code,
|
|
196
|
+
requestUrl: config?.url,
|
|
197
|
+
requestMethod: config?.method?.toUpperCase(),
|
|
198
|
+
baseURL: config?.baseURL,
|
|
199
|
+
requestHeaders: filterSensitiveData(config?.headers),
|
|
200
|
+
requestParams: filterSensitiveData(config?.params),
|
|
201
|
+
responseStatus: status,
|
|
202
|
+
responseStatusText: response?.statusText,
|
|
203
|
+
responseData: filterSensitiveData(response?.data),
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
report.context = `Axios Request Failed: ${config?.method?.toUpperCase()} ${
|
|
207
|
+
config?.url
|
|
208
|
+
}`;
|
|
209
|
+
report.groupingHash = `axios-${config?.method}-${config?.url}`;
|
|
210
|
+
});
|
|
211
|
+
} catch (bugsnagError) {
|
|
212
|
+
// eslint-disable-next-line no-console
|
|
213
|
+
console.error(
|
|
214
|
+
"Error reporting Axios error to Bugsnag:",
|
|
215
|
+
bugsnagError
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return handleErrorResponse(error);
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const registerRequestIntercept = () => {
|
|
226
|
+
if (requestInterceptorId !== null) {
|
|
227
|
+
axios.interceptors.request.eject(requestInterceptorId);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
requestInterceptorId = axios.interceptors.request.use(async request => {
|
|
231
|
+
const config = await configureAxiosHeaders(request);
|
|
232
|
+
|
|
233
|
+
const store = Store.getState();
|
|
234
|
+
const subdomain = store?.auth?.subdomain || "app";
|
|
235
|
+
config.baseURL = rootUrlCreator({ subdomain });
|
|
236
|
+
|
|
237
|
+
// Convert request data keys from camelCase to snake_case
|
|
238
|
+
if (config.data) {
|
|
239
|
+
config.data = convertRequestKeys(
|
|
240
|
+
config.data,
|
|
241
|
+
config.caseConversionOptions
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Convert request params keys from camelCase to snake_case
|
|
246
|
+
if (config.params) {
|
|
247
|
+
config.params = convertRequestKeys(
|
|
248
|
+
config.params,
|
|
249
|
+
config.caseConversionOptions
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return config;
|
|
254
|
+
}, handleErrorRequest);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const cleanupAxiosInterceptors = () => {
|
|
258
|
+
if (responseInterceptorId !== null) {
|
|
259
|
+
axios.interceptors.response.eject(responseInterceptorId);
|
|
260
|
+
responseInterceptorId = null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (requestInterceptorId !== null) {
|
|
264
|
+
axios.interceptors.request.eject(requestInterceptorId);
|
|
265
|
+
requestInterceptorId = null;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export const configureAxiosHeaders = async (
|
|
270
|
+
request: InternalAxiosRequestConfig
|
|
271
|
+
) => {
|
|
272
|
+
const userAuthData = await getUserAuthData();
|
|
273
|
+
if (userAuthData) {
|
|
274
|
+
const { authToken, email } = userAuthData;
|
|
275
|
+
const headers = {
|
|
276
|
+
"x-auth-token": authToken,
|
|
277
|
+
"x-auth-email": email,
|
|
278
|
+
"x-client-version": DeviceInfo.getVersion(),
|
|
279
|
+
"x-client-name": `${Platform.OS} ${Config.APP_DISPLAY_NAME}`,
|
|
280
|
+
};
|
|
281
|
+
Object.assign(request.headers, headers);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return request;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const configureAxios = () => {
|
|
288
|
+
registerResponseIntercept();
|
|
289
|
+
registerRequestIntercept();
|
|
290
|
+
setParamsSerializer();
|
|
291
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Toast } from "@bigbinary/neetoui-rn";
|
|
2
|
+
import { type Event } from "@bugsnag/react-native";
|
|
3
|
+
|
|
4
|
+
import { strings } from "../../localization";
|
|
5
|
+
|
|
6
|
+
// Callers pass axios errors, Bugsnag's NotifiableError (which may be a bare
|
|
7
|
+
// string) and plain `{ message }` shims, so the check stays structural.
|
|
8
|
+
export const isNetworkError = (error: unknown) => {
|
|
9
|
+
const networkErrorPatterns = [
|
|
10
|
+
/network\s*error/i, //"network error"
|
|
11
|
+
/network\s*request\s*failed/i, //"network request failed"
|
|
12
|
+
/no\s*internet\s*connection/i, //"no internet connection"
|
|
13
|
+
/timeout/i, //"timeout"
|
|
14
|
+
/econnrefused/i, //"econnrefused" - connection refused
|
|
15
|
+
/econnreset/i, //"econnreset" - connection reset
|
|
16
|
+
/enetdown/i, //"enetdown" - network down
|
|
17
|
+
/enetunreach/i, //"enetunreach" - network unreachable
|
|
18
|
+
/ehostdown/i, //"ehostdown" - host down
|
|
19
|
+
/ehostunreach/i, //"ehostunreach" - host unreachable
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const message = (error as { message?: unknown })?.message;
|
|
23
|
+
|
|
24
|
+
return networkErrorPatterns.some(
|
|
25
|
+
pattern => pattern.test(String(message)) || pattern.test(String(error))
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const isEventErrorsNetworkRelated = (event: Event) =>
|
|
30
|
+
event.errors.some(error => isNetworkError({ message: error.errorMessage }));
|
|
31
|
+
|
|
32
|
+
export const handleNetworkError = (error: unknown, showToast = true) => {
|
|
33
|
+
if (isNetworkError(error)) {
|
|
34
|
+
if (showToast) {
|
|
35
|
+
Toast.show({
|
|
36
|
+
type: "error",
|
|
37
|
+
text2:
|
|
38
|
+
strings.en.errors.axios.networkError ||
|
|
39
|
+
"Please check your internet connection and try again",
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "axios";
|
|
2
|
+
|
|
3
|
+
export interface CaseConversionOptions {
|
|
4
|
+
enableCaseConversion?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Requests may opt in or out of the snake_case/camelCase conversion the
|
|
8
|
+
// interceptors apply, so the option travels on the axios config itself.
|
|
9
|
+
declare module "axios" {
|
|
10
|
+
interface AxiosRequestConfig {
|
|
11
|
+
caseConversionOptions?: CaseConversionOptions;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import BugsnagPluginReactNavigation from "@bugsnag/plugin-react-navigation";
|
|
2
|
+
import Bugsnag, { type NotifiableError } from "@bugsnag/react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
isEventErrorsNetworkRelated,
|
|
6
|
+
isNetworkError,
|
|
7
|
+
} from "./axios/networkErrorHandler";
|
|
8
|
+
|
|
9
|
+
import { Store } from "../store";
|
|
10
|
+
|
|
11
|
+
export const bugsnagErrorHandler = (err: NotifiableError, origin: string) => {
|
|
12
|
+
if (!__DEV__) {
|
|
13
|
+
Bugsnag.notify(err, event => {
|
|
14
|
+
if (isNetworkError(err)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
event.severity = "warning";
|
|
19
|
+
event.context = origin;
|
|
20
|
+
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const configureBugsnag = () => {
|
|
27
|
+
if (!__DEV__) {
|
|
28
|
+
Bugsnag.start({
|
|
29
|
+
onError: event => {
|
|
30
|
+
const auth = Store.getState().auth;
|
|
31
|
+
if (auth.email) {
|
|
32
|
+
event.setUser(auth.userId, auth.email, auth.name);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (event.device?.emulator) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (isEventErrorsNetworkRelated(event)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true;
|
|
44
|
+
},
|
|
45
|
+
plugins: [new BugsnagPluginReactNavigation()],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import calendar from "dayjs/plugin/calendar";
|
|
3
|
+
import isToday from "dayjs/plugin/isToday";
|
|
4
|
+
import isYesterday from "dayjs/plugin/isYesterday";
|
|
5
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
6
|
+
import updateLocale from "dayjs/plugin/updateLocale";
|
|
7
|
+
|
|
8
|
+
export const configureDayJS = () => {
|
|
9
|
+
dayjs.extend(isYesterday);
|
|
10
|
+
dayjs.extend(isToday);
|
|
11
|
+
dayjs.extend(calendar);
|
|
12
|
+
dayjs.extend(relativeTime);
|
|
13
|
+
dayjs.extend(updateLocale);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const dateTimeFormats = Object.freeze({
|
|
17
|
+
time: "h:mm A",
|
|
18
|
+
date: "MMM D, YYYY",
|
|
19
|
+
dateWeek: "MMM D, YYYY ddd",
|
|
20
|
+
dateWeekWithoutYear: "MMM D, ddd",
|
|
21
|
+
dateTime: "MMM D, YYYY h:mm A",
|
|
22
|
+
dateWeekTime: "MMM D, YYYY ddd h:mm A",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
type DateInput = dayjs.ConfigType;
|
|
26
|
+
|
|
27
|
+
export const formatDateTime = Object.freeze({
|
|
28
|
+
fromNow: (time: DateInput) => dayjs(time).fromNow(),
|
|
29
|
+
time: (time: DateInput) => dayjs(time).format("h:mm A"),
|
|
30
|
+
date: (time: DateInput) => dayjs(time).format("MMM D, YYYY"),
|
|
31
|
+
dateWeek: (time: DateInput) => dayjs(time).format("MMM D, YYYY ddd"),
|
|
32
|
+
dateWeekWithoutYear: (time: DateInput) => dayjs(time).format("MMM D, ddd"),
|
|
33
|
+
dateTime: (time: DateInput) => dayjs(time).format("MMM D, YYYY h:mm A"),
|
|
34
|
+
dateWeekTime: (time: DateInput) =>
|
|
35
|
+
dayjs(time).format("MMM D, YYYY ddd h:mm A"),
|
|
36
|
+
extended: (time: DateInput) => {
|
|
37
|
+
const dateTime = dayjs(time).format("ddd, MMM D YYYY h:mm A");
|
|
38
|
+
const fromNow = dayjs(time).fromNow();
|
|
39
|
+
|
|
40
|
+
return `${dateTime} (${fromNow})`;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Bugsnag from "@bugsnag/react-native";
|
|
2
|
+
import { GoogleSignin } from "@react-native-google-signin/google-signin";
|
|
3
|
+
import Config from "react-native-config";
|
|
4
|
+
|
|
5
|
+
const { GOOGLE_WEB_CLIENT_ID, IOS_CLIENT_ID } = Config;
|
|
6
|
+
|
|
7
|
+
export const configureGoogleSignin = () => {
|
|
8
|
+
if (GOOGLE_WEB_CLIENT_ID && typeof GOOGLE_WEB_CLIENT_ID === "string") {
|
|
9
|
+
GoogleSignin.configure({
|
|
10
|
+
webClientId: GOOGLE_WEB_CLIENT_ID,
|
|
11
|
+
iosClientId: IOS_CLIENT_ID,
|
|
12
|
+
offlineAccess: true,
|
|
13
|
+
});
|
|
14
|
+
} else {
|
|
15
|
+
if (!__DEV__) {
|
|
16
|
+
Bugsnag.notify(
|
|
17
|
+
new Error(
|
|
18
|
+
"Google Sign-In Configuration Error: GOOGLE_WEB_CLIENT_ID is missing or invalid in environment configuration (.env). Please ensure it is set correctly in the consuming application."
|
|
19
|
+
),
|
|
20
|
+
event => {
|
|
21
|
+
event.severity = "error";
|
|
22
|
+
event.context = "google_signin_configuration";
|
|
23
|
+
event.addMetadata("configuration", {
|
|
24
|
+
feature: "google_signin",
|
|
25
|
+
configuration: "web_client_id",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
} else {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.error(
|
|
32
|
+
"Google Sign-In Configuration Error: GOOGLE_WEB_CLIENT_ID is missing or invalid in environment configuration (.env). Please ensure it is set correctly in the consuming application."
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { configureAxios } from "./axios";
|
|
2
|
+
import { configureDayJS } from "./dayjs";
|
|
3
|
+
import { configureGoogleSignin } from "./googleSignin";
|
|
4
|
+
import { configureValidationsLocales } from "./validations";
|
|
5
|
+
|
|
6
|
+
export const initializeConfigs = () => {
|
|
7
|
+
configureAxios();
|
|
8
|
+
configureGoogleSignin();
|
|
9
|
+
configureValidationsLocales();
|
|
10
|
+
configureDayJS();
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Yup from "yup";
|
|
2
|
+
|
|
3
|
+
import { toTitleCase } from "../helpers/utils";
|
|
4
|
+
|
|
5
|
+
export const configureValidationsLocales = () => {
|
|
6
|
+
Yup.setLocale({
|
|
7
|
+
mixed: {
|
|
8
|
+
required: ({ path }: { path: string }) =>
|
|
9
|
+
`${toTitleCase(path)} is a required field.`,
|
|
10
|
+
},
|
|
11
|
+
string: {
|
|
12
|
+
email: "Please enter valid email address.",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { dateTimeFormats } from "../config/dayjs";
|
|
2
|
+
|
|
3
|
+
export const STORAGE_KEYS = {
|
|
4
|
+
DEVICE_TOKEN: "devicetoken",
|
|
5
|
+
IS_VISITED: "isVisited",
|
|
6
|
+
NOTIFICATION_PERMISSION_REQUESTED: "notificationPermissionRequested",
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_PAGE_SIZE = 30;
|