@bigbinary/neeto-commons-rn 1.8.4 → 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 +366 -0
- package/eslint-config/rules/no-dangling-constants.js +35 -0
- package/eslint-config/rules/no-redundant-string-templates.js +85 -0
- 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 -71
- 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,154 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { AppState, Linking, Platform } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { Alert } from "@bigbinary/neetoui-rn";
|
|
5
|
+
import { compare } from "compare-versions";
|
|
6
|
+
import Config from "react-native-config";
|
|
7
|
+
import { getVersion } from "react-native-device-info";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ANDROID_APP_LINK,
|
|
11
|
+
IOS_PROD_APP_LINK,
|
|
12
|
+
IOS_STAGING_APP_LINK,
|
|
13
|
+
} from "./constants";
|
|
14
|
+
|
|
15
|
+
import { useLocalization } from "../contexts/localization";
|
|
16
|
+
import { getItem, setItem } from "../helpers/asyncStore";
|
|
17
|
+
import { useFetchAppVersionApi } from "../hooks/query/useAppVersionApi";
|
|
18
|
+
import { Store } from "../store";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `AppVersionInfo` (@api/app_version) types only the envelope; the
|
|
22
|
+
* per-platform fields read below live under its index signature.
|
|
23
|
+
*/
|
|
24
|
+
interface AppVersionPayload {
|
|
25
|
+
android_minimum_supported_version?: string;
|
|
26
|
+
android_current_version?: string;
|
|
27
|
+
ios_minimum_supported_version?: string;
|
|
28
|
+
ios_current_version?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const AppVersion = () => {
|
|
32
|
+
const [isMajorUpdate, setIsMajorUpdate] = useState(false);
|
|
33
|
+
const [isMinorUpdate, setIsMinorUpdate] = useState(false);
|
|
34
|
+
|
|
35
|
+
const { strings } = useLocalization();
|
|
36
|
+
|
|
37
|
+
const appName = Store.getState().auth.appName;
|
|
38
|
+
|
|
39
|
+
const { data: appVersionData, refetch } = useFetchAppVersionApi();
|
|
40
|
+
const data = (appVersionData ?? {}) as AppVersionPayload;
|
|
41
|
+
|
|
42
|
+
const iOSAppLink =
|
|
43
|
+
Config.ENVIRONMENT === "staging" ? IOS_STAGING_APP_LINK : IOS_PROD_APP_LINK;
|
|
44
|
+
|
|
45
|
+
const handleAppUpdate = async () => {
|
|
46
|
+
try {
|
|
47
|
+
setIsMinorUpdate(false);
|
|
48
|
+
setIsMajorUpdate(false);
|
|
49
|
+
const url = Platform.select({
|
|
50
|
+
ios: iOSAppLink,
|
|
51
|
+
android: ANDROID_APP_LINK,
|
|
52
|
+
default: ANDROID_APP_LINK,
|
|
53
|
+
}).toLowerCase();
|
|
54
|
+
|
|
55
|
+
await Linking.openURL(url);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
58
|
+
console.log((error as Error).message);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const compareVersions = () => {
|
|
63
|
+
if (Platform.OS === "android") {
|
|
64
|
+
const {
|
|
65
|
+
android_minimum_supported_version: androidMinimumSupportedVersion,
|
|
66
|
+
android_current_version: androidCurrentVersion,
|
|
67
|
+
} = data;
|
|
68
|
+
if (androidMinimumSupportedVersion && androidCurrentVersion) {
|
|
69
|
+
if (compare(getVersion(), androidMinimumSupportedVersion, "<")) {
|
|
70
|
+
setIsMajorUpdate(true);
|
|
71
|
+
} else if (compare(getVersion(), androidCurrentVersion, "<")) {
|
|
72
|
+
setIsMinorUpdate(true);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
const {
|
|
77
|
+
ios_minimum_supported_version: iOSMinimumSupportedVersion,
|
|
78
|
+
ios_current_version: iOSCurrentVersion,
|
|
79
|
+
} = data;
|
|
80
|
+
if (iOSMinimumSupportedVersion && iOSCurrentVersion) {
|
|
81
|
+
if (compare(getVersion(), iOSMinimumSupportedVersion, "<")) {
|
|
82
|
+
setIsMajorUpdate(true);
|
|
83
|
+
} else if (compare(getVersion(), iOSCurrentVersion, "<")) {
|
|
84
|
+
setIsMinorUpdate(true);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const showAlert = async () => {
|
|
91
|
+
const {
|
|
92
|
+
android_current_version: androidCurrentVersion,
|
|
93
|
+
ios_current_version: iOSCurrentVersion,
|
|
94
|
+
} = data;
|
|
95
|
+
|
|
96
|
+
const version = Platform.select({
|
|
97
|
+
ios: iOSCurrentVersion,
|
|
98
|
+
android: androidCurrentVersion,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const buttons = [
|
|
102
|
+
{
|
|
103
|
+
label: strings.commons.buttons.update,
|
|
104
|
+
onPress: handleAppUpdate,
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
if (isMinorUpdate) {
|
|
108
|
+
buttons.push({
|
|
109
|
+
label: strings.commons.alertMessage.mayBeLater,
|
|
110
|
+
onPress: async () => {
|
|
111
|
+
await setItem("appVersion", version);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
const currentVersion = await getItem<string>("appVersion");
|
|
115
|
+
if (currentVersion === version) return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return Alert.show({
|
|
119
|
+
buttons,
|
|
120
|
+
// `formatString` widens to an array only when handed React elements;
|
|
121
|
+
// `appName` is a plain string, so this is always a string.
|
|
122
|
+
description: strings.formatString(
|
|
123
|
+
strings.commons.alertMessage.updateAvailableDescription,
|
|
124
|
+
appName
|
|
125
|
+
) as string,
|
|
126
|
+
isCancelable: !isMajorUpdate,
|
|
127
|
+
title: strings.commons.alertMessage.updateAvailable,
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (data) {
|
|
133
|
+
compareVersions();
|
|
134
|
+
}
|
|
135
|
+
}, [data]);
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (isMinorUpdate || isMajorUpdate) {
|
|
139
|
+
showAlert();
|
|
140
|
+
}
|
|
141
|
+
}, [isMinorUpdate, isMajorUpdate]);
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
const subscription = AppState.addEventListener("change", state => {
|
|
145
|
+
if (state === "active") {
|
|
146
|
+
refetch();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return () => subscription.remove();
|
|
151
|
+
}, []);
|
|
152
|
+
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BottomSheet } from "@bigbinary/neetoui-rn";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Moved to @bigbinary/neetoui-rn v3 (gorhom-based, same
|
|
5
|
+
* isVisible/hide/data/ContentRow facade). This re-export keeps one
|
|
6
|
+
* deprecation cycle of compatibility and disappears in the next commons
|
|
7
|
+
* major — import BottomSheet from the UI library instead.
|
|
8
|
+
*/
|
|
9
|
+
export default BottomSheet;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Moved to @bigbinary/neetoui-rn v3. This re-export keeps one
|
|
3
|
+
* deprecation cycle of compatibility and disappears in the next commons
|
|
4
|
+
* major — import BottomSheetMenu from the UI library instead.
|
|
5
|
+
*/
|
|
6
|
+
export { BottomSheetMenu } from "@bigbinary/neetoui-rn";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Alert, type AlertParams } from "@bigbinary/neetoui-rn";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Collapsed into the UI library's Alert (v3 presents every
|
|
5
|
+
* confirm as this bottom sheet). Same params: { title, description,
|
|
6
|
+
* isCancelable, buttons, onDismiss }. NeetoUIProvider hosts it, so
|
|
7
|
+
* rendering <ConfirmSheet /> is a no-op kept for compatibility. Call
|
|
8
|
+
* Alert.show directly once call sites migrate; this alias disappears in
|
|
9
|
+
* the next commons major.
|
|
10
|
+
*/
|
|
11
|
+
const ConfirmSheet = () => null;
|
|
12
|
+
|
|
13
|
+
ConfirmSheet.show = (params: AlertParams) => Alert.show(params);
|
|
14
|
+
|
|
15
|
+
export default ConfirmSheet;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { EmptyView as UIEmptyView } from "@bigbinary/neetoui-rn";
|
|
4
|
+
|
|
5
|
+
import EmptyGraphic from "../assets/images/empty.svg";
|
|
6
|
+
import { moderateScale } from "../helpers/scale";
|
|
7
|
+
|
|
8
|
+
export interface EmptyViewProps {
|
|
9
|
+
title?: string | null;
|
|
10
|
+
showCTA?: boolean;
|
|
11
|
+
ctaLabel?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Historically optional even with showCTA set; the library's primaryAction
|
|
14
|
+
* requires a handler, hence the cast below.
|
|
15
|
+
*/
|
|
16
|
+
onCTAPress?: (() => void) | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Compat wrapper over the UI library's EmptyView: keeps the historical
|
|
21
|
+
* commons prop API (showCTA/ctaLabel/onCTAPress) and the commons empty
|
|
22
|
+
* illustration. New code should use the library EmptyView directly
|
|
23
|
+
* ({ title, description, Illustration, primaryAction }).
|
|
24
|
+
*/
|
|
25
|
+
export const EmptyView = ({
|
|
26
|
+
title = null,
|
|
27
|
+
showCTA = false,
|
|
28
|
+
ctaLabel = null,
|
|
29
|
+
onCTAPress = null,
|
|
30
|
+
}: EmptyViewProps) => (
|
|
31
|
+
<UIEmptyView
|
|
32
|
+
Illustration={<EmptyGraphic height={moderateScale(200)} />}
|
|
33
|
+
title={title ?? ""}
|
|
34
|
+
primaryAction={
|
|
35
|
+
showCTA && ctaLabel
|
|
36
|
+
? { label: ctaLabel, onPress: onCTAPress as () => void }
|
|
37
|
+
: undefined
|
|
38
|
+
}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Moved to @bigbinary/neetoui-rn v3. This re-export keeps one
|
|
3
|
+
* deprecation cycle of compatibility and disappears in the next commons
|
|
4
|
+
* major — import BaseHeader from the UI library instead.
|
|
5
|
+
*/
|
|
6
|
+
export { BaseHeader } from "@bigbinary/neetoui-rn";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Moved to @bigbinary/neetoui-rn v3. This re-export keeps one
|
|
3
|
+
* deprecation cycle of compatibility and disappears in the next commons
|
|
4
|
+
* major — import ScreenHeader from the UI library instead.
|
|
5
|
+
*/
|
|
6
|
+
export { ScreenHeader } from "@bigbinary/neetoui-rn";
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React, { useState, type ComponentType } from "react";
|
|
2
|
+
|
|
3
|
+
import { HamburgerMenu, MenuVertical, Search } from "@bigbinary/neeto-icons-rn";
|
|
4
|
+
import {
|
|
5
|
+
Avatar,
|
|
6
|
+
BottomSheetMenu,
|
|
7
|
+
Header as UIHeader,
|
|
8
|
+
Touchable,
|
|
9
|
+
useNeetoTheme,
|
|
10
|
+
} from "@bigbinary/neetoui-rn";
|
|
11
|
+
import { useNavigation, type NavigationProp } from "@react-navigation/native";
|
|
12
|
+
|
|
13
|
+
import { moderateScale } from "../helpers/scale";
|
|
14
|
+
import { debounce } from "../helpers/utils";
|
|
15
|
+
import { type CommonsParamList } from "../navigation/types";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Host apps mount this header inside their drawer navigator, so `openDrawer`
|
|
19
|
+
* is available at runtime even though commons' own param list cannot name it.
|
|
20
|
+
*/
|
|
21
|
+
type HeaderNavigation = NavigationProp<CommonsParamList> & {
|
|
22
|
+
openDrawer: () => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface HeaderProps {
|
|
26
|
+
title: string;
|
|
27
|
+
subTitle?: string;
|
|
28
|
+
canGoBack?: boolean;
|
|
29
|
+
onBackPress?: () => void;
|
|
30
|
+
showSideMenu?: boolean;
|
|
31
|
+
handleSearch?: () => void;
|
|
32
|
+
RightComponent?: ComponentType;
|
|
33
|
+
isLoading?: boolean;
|
|
34
|
+
showWorkspaceLogo?: boolean;
|
|
35
|
+
onMarkAllAsRead?: () => void;
|
|
36
|
+
showMarkAllOption?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Compat wrapper over the UI library's navigation-agnostic Header: keeps
|
|
41
|
+
* the historical commons prop API (canGoBack/showSideMenu/RightComponent/
|
|
42
|
+
* onMarkAllAsRead) and wires react-navigation + the mark-all menu on top.
|
|
43
|
+
* New code should use the library Header with onBack and slots directly.
|
|
44
|
+
*/
|
|
45
|
+
export const Header = ({
|
|
46
|
+
title,
|
|
47
|
+
subTitle,
|
|
48
|
+
canGoBack = false,
|
|
49
|
+
onBackPress,
|
|
50
|
+
showSideMenu,
|
|
51
|
+
handleSearch,
|
|
52
|
+
RightComponent,
|
|
53
|
+
isLoading = false,
|
|
54
|
+
showWorkspaceLogo = false,
|
|
55
|
+
onMarkAllAsRead,
|
|
56
|
+
showMarkAllOption = false,
|
|
57
|
+
}: HeaderProps) => {
|
|
58
|
+
const navigation = useNavigation<HeaderNavigation>();
|
|
59
|
+
const theme = useNeetoTheme();
|
|
60
|
+
const [isMenuVisible, setIsMenuVisible] = useState(false);
|
|
61
|
+
|
|
62
|
+
const handleBack =
|
|
63
|
+
onBackPress || canGoBack
|
|
64
|
+
? debounce(onBackPress || navigation.goBack)
|
|
65
|
+
: undefined;
|
|
66
|
+
|
|
67
|
+
const LeftSlot = (
|
|
68
|
+
<>
|
|
69
|
+
{showWorkspaceLogo && (
|
|
70
|
+
<Touchable onPress={() => navigation.openDrawer()}>
|
|
71
|
+
<Avatar name="S" variant="extra-small" />
|
|
72
|
+
</Touchable>
|
|
73
|
+
)}
|
|
74
|
+
{showSideMenu && (
|
|
75
|
+
<Touchable
|
|
76
|
+
accessibilityLabel="Open side menu"
|
|
77
|
+
hitSlop={moderateScale(8)}
|
|
78
|
+
onPress={() => navigation.openDrawer()}
|
|
79
|
+
>
|
|
80
|
+
<HamburgerMenu
|
|
81
|
+
color={theme.colors.text.primary}
|
|
82
|
+
size={moderateScale(24)}
|
|
83
|
+
/>
|
|
84
|
+
</Touchable>
|
|
85
|
+
)}
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const RightSlot = (
|
|
90
|
+
<>
|
|
91
|
+
{handleSearch && (
|
|
92
|
+
<Touchable
|
|
93
|
+
accessibilityLabel="Search"
|
|
94
|
+
hitSlop={moderateScale(10)}
|
|
95
|
+
onPress={handleSearch}
|
|
96
|
+
>
|
|
97
|
+
<Search color={theme.colors.text.primary} size={moderateScale(24)} />
|
|
98
|
+
</Touchable>
|
|
99
|
+
)}
|
|
100
|
+
{showMarkAllOption && (
|
|
101
|
+
<Touchable
|
|
102
|
+
accessibilityLabel="Open menu"
|
|
103
|
+
hitSlop={moderateScale(10)}
|
|
104
|
+
onPress={() => setIsMenuVisible(true)}
|
|
105
|
+
>
|
|
106
|
+
<MenuVertical
|
|
107
|
+
color={theme.colors.text.primary}
|
|
108
|
+
size={moderateScale(24)}
|
|
109
|
+
/>
|
|
110
|
+
</Touchable>
|
|
111
|
+
)}
|
|
112
|
+
{RightComponent && <RightComponent />}
|
|
113
|
+
</>
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<UIHeader
|
|
119
|
+
LeftSlot={LeftSlot}
|
|
120
|
+
RightSlot={RightSlot}
|
|
121
|
+
isLoading={isLoading}
|
|
122
|
+
subTitle={subTitle}
|
|
123
|
+
title={title}
|
|
124
|
+
onBack={handleBack}
|
|
125
|
+
/>
|
|
126
|
+
<BottomSheetMenu
|
|
127
|
+
isVisible={isMenuVisible}
|
|
128
|
+
items={[
|
|
129
|
+
{
|
|
130
|
+
key: "mark-all-read",
|
|
131
|
+
label: "Mark all as read",
|
|
132
|
+
onPress: () => onMarkAllAsRead && onMarkAllAsRead(),
|
|
133
|
+
},
|
|
134
|
+
]}
|
|
135
|
+
onClose={() => setIsMenuVisible(false)}
|
|
136
|
+
/>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type TextStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { Typography, type TypographyProps } from "@bigbinary/neetoui-rn";
|
|
5
|
+
import Hyperlink from "react-native-hyperlink";
|
|
6
|
+
|
|
7
|
+
export interface HyperlinkTextProps {
|
|
8
|
+
/**
|
|
9
|
+
* Rendered as Typography children, so anything `formatString` returns
|
|
10
|
+
* (a string, or a mixed string/element array) is accepted.
|
|
11
|
+
*/
|
|
12
|
+
text: ReactNode;
|
|
13
|
+
linkMapping: Record<string, string>;
|
|
14
|
+
linkStyleProps?: StyleProp<TextStyle>;
|
|
15
|
+
/** v3 Typography props — layout goes through its `style` entry. */
|
|
16
|
+
textStyleProps?: TypographyProps;
|
|
17
|
+
onPress?: (url: string, text?: string) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const HyperlinkText = ({
|
|
21
|
+
text,
|
|
22
|
+
onPress,
|
|
23
|
+
linkMapping,
|
|
24
|
+
linkStyleProps,
|
|
25
|
+
textStyleProps,
|
|
26
|
+
}: HyperlinkTextProps) => (
|
|
27
|
+
<Hyperlink
|
|
28
|
+
linkStyle={linkStyleProps}
|
|
29
|
+
linkText={url => linkMapping?.[url]}
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
>
|
|
32
|
+
<Typography {...textStyleProps}>{text}</Typography>
|
|
33
|
+
</Hyperlink>
|
|
34
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { Skeleton } from "@bigbinary/neetoui-rn";
|
|
4
|
+
|
|
5
|
+
import { moderateScale } from "../helpers/scale";
|
|
6
|
+
|
|
7
|
+
export interface LineLoaderProps {
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
height?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Absorbed by the UI library's Skeleton
|
|
14
|
+
* (<Skeleton variant="line" animated />). This shim keeps the v2 prop
|
|
15
|
+
* contract for one deprecation cycle and disappears in the next commons
|
|
16
|
+
* major.
|
|
17
|
+
*/
|
|
18
|
+
export const LineLoader = ({
|
|
19
|
+
isLoading,
|
|
20
|
+
height = moderateScale(1.5),
|
|
21
|
+
}: LineLoaderProps) => (
|
|
22
|
+
<Skeleton animated={Boolean(isLoading)} height={height} variant="line" />
|
|
23
|
+
);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { Notification } from "@bigbinary/neeto-icons-rn";
|
|
5
|
+
import {
|
|
6
|
+
Container,
|
|
7
|
+
Touchable,
|
|
8
|
+
lightTheme,
|
|
9
|
+
useNeetoTheme,
|
|
10
|
+
} from "@bigbinary/neetoui-rn";
|
|
11
|
+
|
|
12
|
+
import { moderateScale } from "../helpers/scale";
|
|
13
|
+
import { useNotification } from "../hooks/query/useNotification";
|
|
14
|
+
|
|
15
|
+
export interface NotificationIconProps {
|
|
16
|
+
handleClick?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const NotificationIcon = ({
|
|
20
|
+
handleClick = () => {},
|
|
21
|
+
}: NotificationIconProps) => {
|
|
22
|
+
const theme = useNeetoTheme();
|
|
23
|
+
|
|
24
|
+
const { useFetchNotifications } = useNotification();
|
|
25
|
+
const { data } = useFetchNotifications();
|
|
26
|
+
const unreadNotifications = data?.unreadNotifications ?? 0;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Container>
|
|
30
|
+
<Touchable
|
|
31
|
+
hitSlop={{ top: 10, right: 10, bottom: 10, left: 10 }}
|
|
32
|
+
onPress={handleClick}
|
|
33
|
+
>
|
|
34
|
+
<Notification
|
|
35
|
+
color={theme.colors.text.primary}
|
|
36
|
+
size={moderateScale(22)}
|
|
37
|
+
/>
|
|
38
|
+
</Touchable>
|
|
39
|
+
{unreadNotifications > 0 && <Container style={styles.unreadBadge} />}
|
|
40
|
+
</Container>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
unreadBadge: {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
right: 0,
|
|
48
|
+
backgroundColor: lightTheme.colors.danger,
|
|
49
|
+
borderRadius: 5,
|
|
50
|
+
height: 10,
|
|
51
|
+
width: 10,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React, { type ComponentType } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Container,
|
|
6
|
+
Divider,
|
|
7
|
+
Loader,
|
|
8
|
+
Typography,
|
|
9
|
+
lightTheme,
|
|
10
|
+
} from "@bigbinary/neetoui-rn";
|
|
11
|
+
|
|
12
|
+
import { PREFERENCE_TITLE_LINE_HEIGHT } from "./constants";
|
|
13
|
+
import { ToggleSwitch } from "./ToggleSwitch";
|
|
14
|
+
|
|
15
|
+
import { moderateScale } from "../helpers/scale";
|
|
16
|
+
|
|
17
|
+
export interface NotificationPreference {
|
|
18
|
+
label: string;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
LeftIcon?: ComponentType;
|
|
21
|
+
onSwitch: (item: NotificationPreference, index: number) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// neetoui-rn v2 shipped this; v3 dropped it. Reproduced here against the v3
|
|
25
|
+
// primitives, with the styled-system shorthands the original used rewritten
|
|
26
|
+
// as styles.
|
|
27
|
+
export interface NotificationPreferenceListProps {
|
|
28
|
+
data?: NotificationPreference[];
|
|
29
|
+
title?: string;
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const NotificationPreferenceList = ({
|
|
34
|
+
data,
|
|
35
|
+
title,
|
|
36
|
+
isLoading,
|
|
37
|
+
}: NotificationPreferenceListProps) => (
|
|
38
|
+
<Container style={styles.root}>
|
|
39
|
+
<Container style={styles.header}>
|
|
40
|
+
{!!title && (
|
|
41
|
+
<Typography
|
|
42
|
+
color={lightTheme.colors.palette.grey600}
|
|
43
|
+
size="m"
|
|
44
|
+
style={styles.title}
|
|
45
|
+
>
|
|
46
|
+
{title}
|
|
47
|
+
</Typography>
|
|
48
|
+
)}
|
|
49
|
+
{isLoading && (
|
|
50
|
+
<Container style={styles.loader}>
|
|
51
|
+
<Loader />
|
|
52
|
+
</Container>
|
|
53
|
+
)}
|
|
54
|
+
</Container>
|
|
55
|
+
<Container style={styles.list}>
|
|
56
|
+
{data?.map((item, index) => {
|
|
57
|
+
const { label, enabled, onSwitch, LeftIcon } = item;
|
|
58
|
+
const isLastItem = index === data.length - 1;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Container key={index} style={styles.itemWrapper}>
|
|
62
|
+
<Container style={styles.item}>
|
|
63
|
+
<Container style={styles.labelRow}>
|
|
64
|
+
{LeftIcon && (
|
|
65
|
+
<Container style={styles.leftIcon}>
|
|
66
|
+
<LeftIcon />
|
|
67
|
+
</Container>
|
|
68
|
+
)}
|
|
69
|
+
<Typography size="l" style={styles.label}>
|
|
70
|
+
{label}
|
|
71
|
+
</Typography>
|
|
72
|
+
</Container>
|
|
73
|
+
<ToggleSwitch
|
|
74
|
+
value={enabled}
|
|
75
|
+
onValueChange={() => onSwitch(item, index)}
|
|
76
|
+
/>
|
|
77
|
+
</Container>
|
|
78
|
+
{!isLastItem && <Divider style={styles.divider} />}
|
|
79
|
+
</Container>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
</Container>
|
|
83
|
+
</Container>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const styles = StyleSheet.create({
|
|
87
|
+
root: {
|
|
88
|
+
width: "100%",
|
|
89
|
+
},
|
|
90
|
+
header: {
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
flexDirection: "row",
|
|
93
|
+
paddingBottom: moderateScale(8),
|
|
94
|
+
paddingTop: moderateScale(20),
|
|
95
|
+
},
|
|
96
|
+
title: {
|
|
97
|
+
lineHeight: PREFERENCE_TITLE_LINE_HEIGHT,
|
|
98
|
+
},
|
|
99
|
+
loader: {
|
|
100
|
+
justifyContent: "center",
|
|
101
|
+
height: PREFERENCE_TITLE_LINE_HEIGHT,
|
|
102
|
+
marginHorizontal: moderateScale(8),
|
|
103
|
+
},
|
|
104
|
+
list: {
|
|
105
|
+
backgroundColor: lightTheme.colors.background.secondary,
|
|
106
|
+
borderRadius: moderateScale(8),
|
|
107
|
+
},
|
|
108
|
+
itemWrapper: {
|
|
109
|
+
paddingHorizontal: moderateScale(16),
|
|
110
|
+
},
|
|
111
|
+
item: {
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
flexDirection: "row",
|
|
114
|
+
justifyContent: "space-between",
|
|
115
|
+
paddingVertical: moderateScale(12),
|
|
116
|
+
},
|
|
117
|
+
labelRow: {
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
flex: 1,
|
|
120
|
+
flexDirection: "row",
|
|
121
|
+
},
|
|
122
|
+
leftIcon: {
|
|
123
|
+
marginRight: moderateScale(8),
|
|
124
|
+
},
|
|
125
|
+
label: {
|
|
126
|
+
flex: 1,
|
|
127
|
+
marginRight: moderateScale(8),
|
|
128
|
+
},
|
|
129
|
+
divider: {
|
|
130
|
+
backgroundColor: lightTheme.colors.palette.grey300,
|
|
131
|
+
},
|
|
132
|
+
});
|