@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,88 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
StyleSheet,
|
|
4
|
+
Image,
|
|
5
|
+
Pressable,
|
|
6
|
+
Text,
|
|
7
|
+
View,
|
|
8
|
+
type PressableProps,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
|
|
11
|
+
import { lightTheme } from "@bigbinary/neetoui-rn";
|
|
12
|
+
|
|
13
|
+
const checkmarkBase64 =
|
|
14
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAACXBIWXMAFxGDABcRgwEFErJzAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAADY1JREFUeJzt3TuOrOtZhuGnFyKxnSMYgGWJKeBgyxFj2EhIZgxMAuQpIO0IOwXJ2hEQMAUSJEIExJDin4D12+vUq+vwvf93uq6wg9KjDvrWW9VVlQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAso7j+P3eGwCYzHEcPz2O49+O4/jj3lsAmMT7ePz38f/+U0QAeNMn8ThEBIA3vRIPEQHgdW/EQ0QA+NyN8RARAH7nzniICAAPx0NEAHb2ZDxEBGBHjeIhIgA7aRwPEQHYQVE8RARgZcXxEBGAFV0UDxEBWMnF8RARgBV0ioeIAMysczxEBGBGg8TjNEVEXnoPAOjtOI6fJvl1kh/13vKB/0rys5eXl3/pPeQ1AgJsbdB4nIaOiIAA2xo8HqdhIyIgwJYmicdpyIgICLCdyeJxGi4iAgJsZdJ4nIaKiIAA25g8HqdhIiIgwBYWicdpiIgICLC8xeJx6h4RAQGWtmg8Tl0jIiDAshaPx6lbRAQEWNIm8Th1iYiAAMvZLB6nyyMiIMBSNo3H6dKICAiwjM3jcbosIgICLEE8PnJJRAQEmJ54fFF5RAQEmJp4fFVpRAQEmJZ43KQsIgICTEk87lISEQEBpiMeD2keE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5kIgMSTzgQgLyBBEZinjAxQTkSSIyBPGADgSkARHpSjygEwFpRES6EA/oSEAaEpFLiQd0JiCNicglxAMGICAFRKSUeMAg3vUesKKXl5d/TfKzJP/Re8tivkvyrXjAGFwghVwiTbk8YDACUkxEmhAPGJCAXEBEniIeMCgBuYiIPEQ8YGACciERuYt4wOAE5GIichPxgAkISAci8lXiAZMQkE5E5IvEAyYiIB2JyEfEAyYjIJ2JSBLxgCkJyAA2j4h4wKQEZBCbRkQ8YGICMpDNIiIeMDkBGcwmEREPWICADGjxiIgHLEJABrVoRMQDFiIgA1ssIuIBixGQwS0SEfGABQnIBCaPiHjAogRkEpNGRDxgYQIykckiIh6wOAGZzCQREQ+AER3H8ePjOP79GNPfHsfxe71/RwC84hgzIuIBMINjrIiIB8BMjjEiIh4AM+ocEfEAmFmniIgHwAoujoh4AKzkooiIB8CKiiMiHgArK4qIeADsoHFExANgJ40iIh4AO3oyIuIBsLMHIyIeANwdEfEA4HdujIh4APC5NyIiHgC87pWIiAcAb/skIuIBwO2O4/jJcRy/OI7jXe8tAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA5/4PiZTk2kr08uAAAAAASUVORK5CYII=";
|
|
15
|
+
|
|
16
|
+
interface CheckboxProps extends Omit<PressableProps, "onPress" | "style"> {
|
|
17
|
+
onValueChange?: (value: boolean) => void;
|
|
18
|
+
value?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Checkbox = ({
|
|
24
|
+
onValueChange,
|
|
25
|
+
value,
|
|
26
|
+
label,
|
|
27
|
+
disabled = false,
|
|
28
|
+
...other
|
|
29
|
+
}: CheckboxProps) => {
|
|
30
|
+
const handleChange = () => {
|
|
31
|
+
onValueChange?.(!value);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Pressable
|
|
36
|
+
{...other}
|
|
37
|
+
accessibilityRole="checkbox"
|
|
38
|
+
accessibilityState={{ checked: value, disabled }}
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
style={styles.root}
|
|
41
|
+
onPress={handleChange}
|
|
42
|
+
>
|
|
43
|
+
<View style={[styles.checkRoot, value && styles.checked]}>
|
|
44
|
+
{value && (
|
|
45
|
+
<Image
|
|
46
|
+
style={StyleSheet.absoluteFill}
|
|
47
|
+
source={{
|
|
48
|
+
uri: checkmarkBase64,
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</View>
|
|
53
|
+
<Text
|
|
54
|
+
style={[styles.checkboxLabel, disabled && styles.checkboxLabelDisabled]}
|
|
55
|
+
>
|
|
56
|
+
{label}
|
|
57
|
+
</Text>
|
|
58
|
+
</Pressable>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const styles = StyleSheet.create({
|
|
63
|
+
root: {
|
|
64
|
+
flexDirection: "row",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
columnGap: 12,
|
|
67
|
+
},
|
|
68
|
+
checkRoot: {
|
|
69
|
+
height: 20,
|
|
70
|
+
width: 20,
|
|
71
|
+
borderRadius: 4,
|
|
72
|
+
borderWidth: 2,
|
|
73
|
+
borderColor: lightTheme.colors.palette.grey400,
|
|
74
|
+
},
|
|
75
|
+
checked: {
|
|
76
|
+
backgroundColor: lightTheme.colors.primary,
|
|
77
|
+
borderColor: lightTheme.colors.primary,
|
|
78
|
+
},
|
|
79
|
+
checkboxLabel: {
|
|
80
|
+
fontSize: 16,
|
|
81
|
+
color: lightTheme.colors.text.primary,
|
|
82
|
+
},
|
|
83
|
+
checkboxLabelDisabled: {
|
|
84
|
+
color: lightTheme.colors.palette.grey600,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export default Checkbox;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { type ComponentType } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Button as UIButton,
|
|
6
|
+
Container,
|
|
7
|
+
Input,
|
|
8
|
+
Loader,
|
|
9
|
+
ParentView,
|
|
10
|
+
ScrollView,
|
|
11
|
+
lightTheme,
|
|
12
|
+
type ButtonProps,
|
|
13
|
+
} from "@bigbinary/neetoui-rn";
|
|
14
|
+
import { useNavigation, type NavigationProp } from "@react-navigation/native";
|
|
15
|
+
import { Formik } from "formik";
|
|
16
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
17
|
+
import * as Yup from "yup";
|
|
18
|
+
|
|
19
|
+
import Email from "./Email";
|
|
20
|
+
import RolesRadioGroup, { type RoleOption } from "./RolesRadioGroup";
|
|
21
|
+
|
|
22
|
+
import { Header } from "../../components";
|
|
23
|
+
import { moderateScale } from "../../helpers/scale";
|
|
24
|
+
import { useFetchRoles } from "../../hooks/query/useRolesApi";
|
|
25
|
+
import { useUpdateTeamMember } from "../../hooks/query/useTeamMembersApi";
|
|
26
|
+
import {
|
|
27
|
+
type CommonsParamList,
|
|
28
|
+
type CommonsScreenProps,
|
|
29
|
+
} from "../../navigation/types";
|
|
30
|
+
|
|
31
|
+
// `onPress` is widened from Pressable's event handler so formik's web-typed
|
|
32
|
+
// `handleSubmit` keeps flowing straight through, as it does today.
|
|
33
|
+
const Button = UIButton as ComponentType<
|
|
34
|
+
Omit<ButtonProps, "onPress"> & { onPress?: () => void }
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
// A type alias rather than an interface so the object keeps an implicit index
|
|
38
|
+
// signature and stays assignable to the update payload.
|
|
39
|
+
type EditTeamMemberFormValues = {
|
|
40
|
+
first_name?: string;
|
|
41
|
+
last_name?: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
organization_role?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const EditTeamMemberScreen = ({
|
|
47
|
+
route,
|
|
48
|
+
}: CommonsScreenProps<"EditTeamMemberScreen">) => {
|
|
49
|
+
// The navigator types params as required, but a host app can still push
|
|
50
|
+
// this route without them; the fallback keeps the pre-TypeScript
|
|
51
|
+
// behaviour of an undefined member instead of throwing here.
|
|
52
|
+
const { member } =
|
|
53
|
+
route.params ?? ({} as CommonsParamList["EditTeamMemberScreen"]);
|
|
54
|
+
const navigation = useNavigation<NavigationProp<CommonsParamList>>();
|
|
55
|
+
const { bottom } = useSafeAreaInsets();
|
|
56
|
+
|
|
57
|
+
const { mutate: updateTeamMember, isPending: isUpdating } =
|
|
58
|
+
useUpdateTeamMember({ onSuccess: () => navigation.goBack() });
|
|
59
|
+
const { data: roles, isPending: isLoadingRoles } = useFetchRoles();
|
|
60
|
+
|
|
61
|
+
const handleUpdateTeamMember = (payload: EditTeamMemberFormValues) =>
|
|
62
|
+
updateTeamMember({ id: member.id, payload });
|
|
63
|
+
|
|
64
|
+
if (isLoadingRoles) {
|
|
65
|
+
return (
|
|
66
|
+
// v2's `bg`/`flex` are dropped: v3's ParentView already fills its parent
|
|
67
|
+
// and paints the active theme's primary background by default.
|
|
68
|
+
<ParentView barStyle="dark-content">
|
|
69
|
+
<Header canGoBack title="Edit team member" />
|
|
70
|
+
<Container style={styles.loader}>
|
|
71
|
+
<Loader color={lightTheme.colors.primary} size="l" />
|
|
72
|
+
</Container>
|
|
73
|
+
</ParentView>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<ParentView barStyle="dark-content">
|
|
79
|
+
<Header canGoBack title="Edit team member" />
|
|
80
|
+
<Formik<EditTeamMemberFormValues>
|
|
81
|
+
enableReinitialize
|
|
82
|
+
validateOnBlur
|
|
83
|
+
initialValues={{
|
|
84
|
+
first_name: member?.first_name,
|
|
85
|
+
last_name: member?.last_name,
|
|
86
|
+
email: member?.email,
|
|
87
|
+
organization_role: member?.role,
|
|
88
|
+
}}
|
|
89
|
+
validationSchema={Yup.object().shape({
|
|
90
|
+
email: Yup.string().email().required(),
|
|
91
|
+
})}
|
|
92
|
+
onSubmit={values => handleUpdateTeamMember(values)}
|
|
93
|
+
>
|
|
94
|
+
{({ handleChange, handleSubmit, errors, isValid, values, dirty }) => (
|
|
95
|
+
<>
|
|
96
|
+
<ScrollView>
|
|
97
|
+
<Container style={styles.container}>
|
|
98
|
+
<Input
|
|
99
|
+
label="First name"
|
|
100
|
+
value={values?.first_name}
|
|
101
|
+
onChangeText={handleChange("first_name")}
|
|
102
|
+
/>
|
|
103
|
+
<Input
|
|
104
|
+
label="Last name"
|
|
105
|
+
value={values?.last_name}
|
|
106
|
+
onChangeText={handleChange("last_name")}
|
|
107
|
+
/>
|
|
108
|
+
<Email
|
|
109
|
+
email={values?.email}
|
|
110
|
+
error={errors?.email}
|
|
111
|
+
updateEmail={handleChange("email")}
|
|
112
|
+
/>
|
|
113
|
+
<RolesRadioGroup
|
|
114
|
+
// `roles` is narrowed by the isLoadingRoles early return
|
|
115
|
+
// above, which the compiler cannot see through.
|
|
116
|
+
roles={roles as RoleOption[]}
|
|
117
|
+
selectedRole={values?.organization_role}
|
|
118
|
+
updateRole={handleChange("organization_role")}
|
|
119
|
+
/>
|
|
120
|
+
</Container>
|
|
121
|
+
</ScrollView>
|
|
122
|
+
<Container
|
|
123
|
+
style={[
|
|
124
|
+
styles.footer,
|
|
125
|
+
{ paddingBottom: Math.max(bottom, moderateScale(12)) },
|
|
126
|
+
]}
|
|
127
|
+
>
|
|
128
|
+
<Button
|
|
129
|
+
disabled={!isValid || !dirty}
|
|
130
|
+
isLoading={isUpdating}
|
|
131
|
+
label="Continue"
|
|
132
|
+
labelStyle={styles.buttonLabel}
|
|
133
|
+
style={styles.button}
|
|
134
|
+
onPress={handleSubmit}
|
|
135
|
+
/>
|
|
136
|
+
</Container>
|
|
137
|
+
</>
|
|
138
|
+
)}
|
|
139
|
+
</Formik>
|
|
140
|
+
</ParentView>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const styles = StyleSheet.create({
|
|
145
|
+
container: {
|
|
146
|
+
flex: 1,
|
|
147
|
+
paddingHorizontal: moderateScale(16),
|
|
148
|
+
rowGap: moderateScale(16),
|
|
149
|
+
marginBottom: moderateScale(16),
|
|
150
|
+
},
|
|
151
|
+
footer: {
|
|
152
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
153
|
+
borderTopColor: lightTheme.colors.palette.grey200,
|
|
154
|
+
paddingTop: moderateScale(12),
|
|
155
|
+
paddingHorizontal: moderateScale(16),
|
|
156
|
+
},
|
|
157
|
+
button: {
|
|
158
|
+
borderRadius: moderateScale(12),
|
|
159
|
+
height: moderateScale(48),
|
|
160
|
+
},
|
|
161
|
+
buttonLabel: {
|
|
162
|
+
fontSize: lightTheme.fontSizes.m,
|
|
163
|
+
},
|
|
164
|
+
loader: {
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
flex: 1,
|
|
167
|
+
justifyContent: "center",
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
export default EditTeamMemberScreen;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Container,
|
|
6
|
+
Input,
|
|
7
|
+
Typography,
|
|
8
|
+
lightTheme,
|
|
9
|
+
} from "@bigbinary/neetoui-rn";
|
|
10
|
+
|
|
11
|
+
import { moderateScale } from "../../helpers/scale";
|
|
12
|
+
|
|
13
|
+
interface EmailProps {
|
|
14
|
+
/** Optional so the edit form can hand over a member without an email. */
|
|
15
|
+
email?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
updateEmail: (text: string) => void;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// v2 drew the border on Input's outer container (hence `containerProps`);
|
|
22
|
+
// v3 draws it on the TextInput itself, so the outline colour goes to `style`.
|
|
23
|
+
const Email = ({
|
|
24
|
+
email,
|
|
25
|
+
error = "",
|
|
26
|
+
updateEmail,
|
|
27
|
+
autoFocus = false,
|
|
28
|
+
}: EmailProps) => (
|
|
29
|
+
<Container>
|
|
30
|
+
<Input
|
|
31
|
+
autoCapitalize="none"
|
|
32
|
+
autoFocus={autoFocus}
|
|
33
|
+
keyboardType="email-address"
|
|
34
|
+
label="Email"
|
|
35
|
+
style={error ? styles.inputError : styles.input}
|
|
36
|
+
value={email}
|
|
37
|
+
onChangeText={updateEmail}
|
|
38
|
+
/>
|
|
39
|
+
{!!error && (
|
|
40
|
+
<Typography color={lightTheme.colors.danger} style={styles.error}>
|
|
41
|
+
{error}
|
|
42
|
+
</Typography>
|
|
43
|
+
)}
|
|
44
|
+
</Container>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
input: {
|
|
49
|
+
borderColor: lightTheme.colors.palette.grey400,
|
|
50
|
+
},
|
|
51
|
+
inputError: {
|
|
52
|
+
borderColor: lightTheme.colors.danger,
|
|
53
|
+
},
|
|
54
|
+
error: {
|
|
55
|
+
paddingTop: moderateScale(2),
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export default Email;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { StyleSheet, useWindowDimensions } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { Container, lightTheme } from "@bigbinary/neetoui-rn";
|
|
5
|
+
import ContentLoader, { Rect, Circle } from "react-content-loader/native";
|
|
6
|
+
|
|
7
|
+
import { LOADING_CARD } from "./constants";
|
|
8
|
+
|
|
9
|
+
import { moderateScale } from "../../helpers/scale";
|
|
10
|
+
|
|
11
|
+
export const LoadingCard = () => {
|
|
12
|
+
const { width } = useWindowDimensions();
|
|
13
|
+
|
|
14
|
+
const dimensions = useMemo(
|
|
15
|
+
() => ({
|
|
16
|
+
width: moderateScale(width * 0.7),
|
|
17
|
+
titleWidth: moderateScale(width * 0.6),
|
|
18
|
+
subtitleWidth: moderateScale(width * 0.4),
|
|
19
|
+
}),
|
|
20
|
+
[width]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Container style={styles.card}>
|
|
25
|
+
<ContentLoader
|
|
26
|
+
backgroundColor={lightTheme.colors.background.primary}
|
|
27
|
+
foregroundColor={lightTheme.colors.palette.grey200}
|
|
28
|
+
height={moderateScale(LOADING_CARD.CARD_HEIGHT)}
|
|
29
|
+
speed={1.2}
|
|
30
|
+
width={dimensions.width}
|
|
31
|
+
>
|
|
32
|
+
<Circle
|
|
33
|
+
cx={moderateScale(24)}
|
|
34
|
+
cy={moderateScale(24)}
|
|
35
|
+
r={moderateScale(24)}
|
|
36
|
+
/>
|
|
37
|
+
<Rect
|
|
38
|
+
height={moderateScale(LOADING_CARD.TITLE_HEIGHT)}
|
|
39
|
+
rx={moderateScale(5)}
|
|
40
|
+
ry={moderateScale(5)}
|
|
41
|
+
width={dimensions.titleWidth}
|
|
42
|
+
x={moderateScale(60)}
|
|
43
|
+
y={moderateScale(5)}
|
|
44
|
+
/>
|
|
45
|
+
<Rect
|
|
46
|
+
height={moderateScale(LOADING_CARD.SUBTITLE_HEIGHT)}
|
|
47
|
+
rx={moderateScale(5)}
|
|
48
|
+
ry={moderateScale(5)}
|
|
49
|
+
width={dimensions.subtitleWidth}
|
|
50
|
+
x={moderateScale(60)}
|
|
51
|
+
y={moderateScale(27)}
|
|
52
|
+
/>
|
|
53
|
+
<Rect
|
|
54
|
+
height={moderateScale(LOADING_CARD.SUBTITLE_HEIGHT)}
|
|
55
|
+
rx={moderateScale(5)}
|
|
56
|
+
ry={moderateScale(5)}
|
|
57
|
+
width={dimensions.subtitleWidth}
|
|
58
|
+
x={moderateScale(60)}
|
|
59
|
+
y={moderateScale(45)}
|
|
60
|
+
/>
|
|
61
|
+
</ContentLoader>
|
|
62
|
+
</Container>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
LoadingCard.displayName = "LoadingCard";
|
|
67
|
+
|
|
68
|
+
const styles = StyleSheet.create({
|
|
69
|
+
card: {
|
|
70
|
+
backgroundColor: lightTheme.colors.background.secondary,
|
|
71
|
+
borderRadius: moderateScale(8),
|
|
72
|
+
marginBottom: moderateScale(12),
|
|
73
|
+
padding: moderateScale(12),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import React, { useState, type ComponentType } from "react";
|
|
2
|
+
import { Pressable, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { findIndexBy } from "@bigbinary/neeto-cist";
|
|
5
|
+
import { Down } from "@bigbinary/neeto-icons-rn";
|
|
6
|
+
import {
|
|
7
|
+
BottomSheet as UIBottomSheet,
|
|
8
|
+
Container,
|
|
9
|
+
Divider,
|
|
10
|
+
lightTheme,
|
|
11
|
+
Typography,
|
|
12
|
+
Touchable,
|
|
13
|
+
type BottomSheetProps,
|
|
14
|
+
} from "@bigbinary/neetoui-rn";
|
|
15
|
+
import { type FormikProps } from "formik";
|
|
16
|
+
import { mergeRight } from "ramda";
|
|
17
|
+
|
|
18
|
+
import Checkbox from "./Checkbox";
|
|
19
|
+
import { APP_NAME } from "./constants";
|
|
20
|
+
import {
|
|
21
|
+
type AddTeamMemberFormValues,
|
|
22
|
+
type GlobalRolesByApp,
|
|
23
|
+
type ProductRole,
|
|
24
|
+
} from "./utils";
|
|
25
|
+
|
|
26
|
+
import { ToggleSwitch } from "../../components/ToggleSwitch";
|
|
27
|
+
import { moderateScale } from "../../helpers/scale";
|
|
28
|
+
|
|
29
|
+
/** One selectable role inside the per-product dropdown sheet. */
|
|
30
|
+
interface RoleSheetItem {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// `isVisible` starts out null here, which v3 narrowed to `boolean`.
|
|
36
|
+
const BottomSheet = UIBottomSheet as ComponentType<
|
|
37
|
+
Omit<BottomSheetProps<RoleSheetItem>, "isVisible"> & {
|
|
38
|
+
isVisible: boolean | null;
|
|
39
|
+
}
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
interface ProductSelectProps {
|
|
43
|
+
values: AddTeamMemberFormValues;
|
|
44
|
+
globalRoles: GlobalRolesByApp;
|
|
45
|
+
setFieldValue: FormikProps<AddTeamMemberFormValues>["setFieldValue"];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const ProductSelect = ({
|
|
49
|
+
// The empty defaults have never been exercised — Add always supplies both.
|
|
50
|
+
values = {} as AddTeamMemberFormValues,
|
|
51
|
+
globalRoles = {},
|
|
52
|
+
setFieldValue,
|
|
53
|
+
}: ProductSelectProps) => {
|
|
54
|
+
const otherProducts = values?.otherProducts ?? true;
|
|
55
|
+
const [openDropdown, setOpenDropdown] = useState<boolean | null>(null);
|
|
56
|
+
const [selectedAppName, setSelectedAppName] = useState<string | null>(null);
|
|
57
|
+
|
|
58
|
+
const updateProduct = (appName: string, object: Partial<ProductRole>) => {
|
|
59
|
+
const products = values?.products || [];
|
|
60
|
+
const selectedProductIndex = findIndexBy({ app_name: appName }, products);
|
|
61
|
+
|
|
62
|
+
if (selectedProductIndex !== -1) {
|
|
63
|
+
const newValues = mergeRight(products[selectedProductIndex], object);
|
|
64
|
+
setFieldValue(`products.${selectedProductIndex}`, newValues);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleProductSelect = (appName: string, selected: boolean) => {
|
|
69
|
+
updateProduct(appName, { is_enabled: selected });
|
|
70
|
+
|
|
71
|
+
const hasAnyEnabled = values?.products
|
|
72
|
+
?.filter(product => product.app_name !== APP_NAME)
|
|
73
|
+
?.some(product =>
|
|
74
|
+
product.app_name === appName ? selected : product.is_enabled
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
if (values.otherProducts !== hasAnyEnabled) {
|
|
78
|
+
setFieldValue("otherProducts", hasAnyEnabled);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const handleRoleSelect = (appName: string, role: string) => {
|
|
83
|
+
updateProduct(appName, { active_role: role });
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleToggleOtherProducts = (selected: boolean) => {
|
|
87
|
+
setFieldValue("otherProducts", selected);
|
|
88
|
+
setFieldValue(
|
|
89
|
+
"products",
|
|
90
|
+
values?.products?.map(product => ({
|
|
91
|
+
...product,
|
|
92
|
+
is_enabled: product.app_name === APP_NAME ? true : selected,
|
|
93
|
+
}))
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Container style={styles.container}>
|
|
99
|
+
<Container style={styles.toggleRow}>
|
|
100
|
+
<ToggleSwitch
|
|
101
|
+
value={otherProducts}
|
|
102
|
+
onValueChange={handleToggleOtherProducts}
|
|
103
|
+
/>
|
|
104
|
+
<Typography style={styles.toggleLabel}>
|
|
105
|
+
Add <Typography weight="bold">{values?.email}</Typography> to the
|
|
106
|
+
following Neeto products.
|
|
107
|
+
</Typography>
|
|
108
|
+
</Container>
|
|
109
|
+
<Divider style={styles.divider} />
|
|
110
|
+
{values?.products.map(({ app_name, active_role, is_enabled }) => (
|
|
111
|
+
<Container key={app_name} style={styles.productList}>
|
|
112
|
+
<Checkbox
|
|
113
|
+
disabled={app_name === APP_NAME}
|
|
114
|
+
label={app_name}
|
|
115
|
+
value={is_enabled}
|
|
116
|
+
onValueChange={value => handleProductSelect(app_name, value)}
|
|
117
|
+
/>
|
|
118
|
+
<Pressable
|
|
119
|
+
disabled={app_name === APP_NAME || !is_enabled}
|
|
120
|
+
style={styles.dropdown}
|
|
121
|
+
onPress={() => {
|
|
122
|
+
setSelectedAppName(app_name);
|
|
123
|
+
setOpenDropdown(true);
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<Typography
|
|
127
|
+
style={{
|
|
128
|
+
color: is_enabled
|
|
129
|
+
? lightTheme.colors.text.primary
|
|
130
|
+
: lightTheme.colors.palette.grey600,
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{active_role}
|
|
134
|
+
</Typography>
|
|
135
|
+
<Down
|
|
136
|
+
size={moderateScale(22)}
|
|
137
|
+
color={
|
|
138
|
+
is_enabled
|
|
139
|
+
? lightTheme.colors.text.primary
|
|
140
|
+
: lightTheme.colors.palette.grey600
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
</Pressable>
|
|
144
|
+
</Container>
|
|
145
|
+
))}
|
|
146
|
+
<BottomSheet
|
|
147
|
+
isVisible={openDropdown}
|
|
148
|
+
ContentRow={({ item: { label }, onPress }) => (
|
|
149
|
+
<Touchable style={styles.roleRow} onPress={onPress}>
|
|
150
|
+
<Typography>{label}</Typography>
|
|
151
|
+
</Touchable>
|
|
152
|
+
)}
|
|
153
|
+
// `selectedAppName` is only null while the sheet is closed; the lookup
|
|
154
|
+
// and the role update below both ran with null before too (JS coerces
|
|
155
|
+
// it to the "null" key, which never matches).
|
|
156
|
+
data={globalRoles[selectedAppName as string]?.map(role => ({
|
|
157
|
+
label: role.name,
|
|
158
|
+
value: role.name,
|
|
159
|
+
}))}
|
|
160
|
+
hide={() => {
|
|
161
|
+
setSelectedAppName(null);
|
|
162
|
+
setOpenDropdown(false);
|
|
163
|
+
}}
|
|
164
|
+
onBackdropPress={() => {
|
|
165
|
+
setSelectedAppName(null);
|
|
166
|
+
setOpenDropdown(false);
|
|
167
|
+
}}
|
|
168
|
+
onItemPress={({ item }) =>
|
|
169
|
+
handleRoleSelect(selectedAppName as string, item.value)
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
172
|
+
</Container>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const styles = StyleSheet.create({
|
|
177
|
+
container: {
|
|
178
|
+
paddingHorizontal: moderateScale(8),
|
|
179
|
+
},
|
|
180
|
+
toggleRow: {
|
|
181
|
+
alignItems: "center",
|
|
182
|
+
columnGap: moderateScale(16),
|
|
183
|
+
flex: 1,
|
|
184
|
+
flexDirection: "row",
|
|
185
|
+
marginBottom: moderateScale(16),
|
|
186
|
+
maxWidth: "80%",
|
|
187
|
+
},
|
|
188
|
+
toggleLabel: {
|
|
189
|
+
flexWrap: "wrap",
|
|
190
|
+
},
|
|
191
|
+
divider: {
|
|
192
|
+
backgroundColor: lightTheme.colors.palette.grey200,
|
|
193
|
+
},
|
|
194
|
+
roleRow: {
|
|
195
|
+
paddingVertical: moderateScale(12),
|
|
196
|
+
},
|
|
197
|
+
productList: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
flexDirection: "row",
|
|
200
|
+
maxWidth: "100%",
|
|
201
|
+
borderBottomWidth: 2,
|
|
202
|
+
paddingVertical: moderateScale(16),
|
|
203
|
+
borderBottomColor: lightTheme.colors.palette.grey200,
|
|
204
|
+
justifyContent: "space-between",
|
|
205
|
+
alignContent: "space-between",
|
|
206
|
+
alignItems: "center",
|
|
207
|
+
},
|
|
208
|
+
dropdown: {
|
|
209
|
+
flex: 1,
|
|
210
|
+
minWidth: 200,
|
|
211
|
+
flexDirection: "row",
|
|
212
|
+
justifyContent: "flex-end",
|
|
213
|
+
alignItems: "center",
|
|
214
|
+
columnGap: moderateScale(6),
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
export default ProductSelect;
|