@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,251 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
import { Linking, ScrollView, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { LeftArrow, Help } from "@bigbinary/neeto-icons-rn";
|
|
5
|
+
import {
|
|
6
|
+
Typography,
|
|
7
|
+
Container,
|
|
8
|
+
Alert,
|
|
9
|
+
ParentView,
|
|
10
|
+
Button,
|
|
11
|
+
Loader,
|
|
12
|
+
Touchable,
|
|
13
|
+
lightTheme,
|
|
14
|
+
} from "@bigbinary/neetoui-rn";
|
|
15
|
+
import { GoogleSignin } from "@react-native-google-signin/google-signin";
|
|
16
|
+
import Config from "react-native-config";
|
|
17
|
+
import DeviceInfo from "react-native-device-info";
|
|
18
|
+
|
|
19
|
+
import { UserData } from "./UserData";
|
|
20
|
+
|
|
21
|
+
import { Header } from "../../components";
|
|
22
|
+
import {
|
|
23
|
+
NotificationPreferenceList,
|
|
24
|
+
type NotificationPreference,
|
|
25
|
+
} from "../../components/NotificationPreferenceList";
|
|
26
|
+
import { STORAGE_KEYS } from "../../constants";
|
|
27
|
+
import { getItem } from "../../helpers/asyncStore";
|
|
28
|
+
import { removeSecureValue } from "../../helpers/keychain";
|
|
29
|
+
import { moderateScale } from "../../helpers/scale";
|
|
30
|
+
import { useLocalization } from "../../hooks";
|
|
31
|
+
import { useNotification } from "../../hooks/query/useNotification";
|
|
32
|
+
import { useFetchProfileDetails } from "../../hooks/query/useProfile";
|
|
33
|
+
import { logoutUserAction } from "../../slices/auth";
|
|
34
|
+
import { useAppDispatch } from "../../store/hooks";
|
|
35
|
+
|
|
36
|
+
export interface ProfileScreenProps {
|
|
37
|
+
canGoBack?: boolean;
|
|
38
|
+
notificationPreferencesData?: NotificationPreference[];
|
|
39
|
+
hasNotificationPermission?: boolean;
|
|
40
|
+
isNotificationPreferencesUpdating?: boolean;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
openChatWidget?: (() => void) | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const ProfileScreen = ({
|
|
46
|
+
canGoBack = false,
|
|
47
|
+
notificationPreferencesData,
|
|
48
|
+
hasNotificationPermission,
|
|
49
|
+
isNotificationPreferencesUpdating,
|
|
50
|
+
children,
|
|
51
|
+
openChatWidget = null,
|
|
52
|
+
}: ProfileScreenProps) => {
|
|
53
|
+
const { strings } = useLocalization();
|
|
54
|
+
const dispatch = useAppDispatch();
|
|
55
|
+
|
|
56
|
+
const { useDeleteTokenMutation } = useNotification();
|
|
57
|
+
const { mutate: deleteToken, isPending: isDeletingToken } =
|
|
58
|
+
useDeleteTokenMutation();
|
|
59
|
+
|
|
60
|
+
const { data: userDetails } = useFetchProfileDetails();
|
|
61
|
+
|
|
62
|
+
const handleNotificationSettings = async () => await Linking.openSettings();
|
|
63
|
+
|
|
64
|
+
const handleLogout = async () => {
|
|
65
|
+
const googleSignedIn = GoogleSignin.hasPreviousSignIn();
|
|
66
|
+
|
|
67
|
+
if (googleSignedIn) {
|
|
68
|
+
await GoogleSignin.signOut();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const deviceNotificationId = await getItem<string>(
|
|
72
|
+
STORAGE_KEYS.DEVICE_TOKEN
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (deviceNotificationId) {
|
|
76
|
+
deleteToken(deviceNotificationId);
|
|
77
|
+
} else {
|
|
78
|
+
await removeSecureValue("userAuth");
|
|
79
|
+
dispatch(logoutUserAction());
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const openConfirmLogoutAlert = () => {
|
|
84
|
+
Alert.show({
|
|
85
|
+
title: strings.commons.confirmMessage.Logout.title,
|
|
86
|
+
description: strings.commons.confirmMessage.Logout.message,
|
|
87
|
+
buttons: [
|
|
88
|
+
{
|
|
89
|
+
label: strings.commons.confirmMessage.Logout.title,
|
|
90
|
+
onPress: handleLogout,
|
|
91
|
+
variant: "danger",
|
|
92
|
+
},
|
|
93
|
+
{ label: strings.commons.buttons.noCancel, onPress: () => {} },
|
|
94
|
+
],
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
// v2's `flex={1}` is dropped: v3's ParentView already fills its parent.
|
|
100
|
+
<ParentView barStyle="dark-content" bottomInset={false}>
|
|
101
|
+
<Header canGoBack={canGoBack} title={strings.commons.headers.Settings} />
|
|
102
|
+
<ScrollView
|
|
103
|
+
contentContainerStyle={styles.scrollContentContainer}
|
|
104
|
+
showsVerticalScrollIndicator={false}
|
|
105
|
+
>
|
|
106
|
+
<Container>
|
|
107
|
+
<UserData {...{ userDetails }} />
|
|
108
|
+
{hasNotificationPermission ? (
|
|
109
|
+
<NotificationPreferenceList
|
|
110
|
+
data={notificationPreferencesData}
|
|
111
|
+
isLoading={isNotificationPreferencesUpdating}
|
|
112
|
+
title={strings.commons.profileScreen.notifyTitle}
|
|
113
|
+
/>
|
|
114
|
+
) : (
|
|
115
|
+
!isNotificationPreferencesUpdating && (
|
|
116
|
+
<Container style={styles.notificationsDisabled}>
|
|
117
|
+
<Typography
|
|
118
|
+
size="3xl"
|
|
119
|
+
style={styles.notificationsDisabledTitle}
|
|
120
|
+
weight="semibold"
|
|
121
|
+
>
|
|
122
|
+
{strings.commons.disabledNotifications.title}
|
|
123
|
+
</Typography>
|
|
124
|
+
<Typography
|
|
125
|
+
color={lightTheme.colors.palette.grey500}
|
|
126
|
+
size="s"
|
|
127
|
+
style={styles.notificationsDisabledDescription}
|
|
128
|
+
>
|
|
129
|
+
{strings.commons.disabledNotifications.description.replace(
|
|
130
|
+
"{0}",
|
|
131
|
+
Config.APP_DISPLAY_NAME as string
|
|
132
|
+
)}
|
|
133
|
+
</Typography>
|
|
134
|
+
<Button
|
|
135
|
+
label={strings.commons.disabledNotifications.button}
|
|
136
|
+
labelStyle={styles.notificationSettingsButtonLabel}
|
|
137
|
+
style={styles.notificationSettingsButton}
|
|
138
|
+
onPress={handleNotificationSettings}
|
|
139
|
+
/>
|
|
140
|
+
</Container>
|
|
141
|
+
)
|
|
142
|
+
)}
|
|
143
|
+
{children}
|
|
144
|
+
{openChatWidget && (
|
|
145
|
+
<Touchable style={styles.helpButton} onPress={openChatWidget}>
|
|
146
|
+
<Typography style={styles.helpButtonLabel}>
|
|
147
|
+
{strings.commons.buttons.helpAndSupport}
|
|
148
|
+
</Typography>
|
|
149
|
+
<Help
|
|
150
|
+
color={lightTheme.colors.text.primary}
|
|
151
|
+
size={moderateScale(22)}
|
|
152
|
+
viewBox="0 0 25 25"
|
|
153
|
+
/>
|
|
154
|
+
</Touchable>
|
|
155
|
+
)}
|
|
156
|
+
</Container>
|
|
157
|
+
<Container style={styles.footer}>
|
|
158
|
+
<Typography
|
|
159
|
+
color={lightTheme.colors.palette.grey600}
|
|
160
|
+
size="s"
|
|
161
|
+
weight="regular"
|
|
162
|
+
>
|
|
163
|
+
{Config.APP_DISPLAY_NAME} {strings.commons.common.version}
|
|
164
|
+
{DeviceInfo.getVersion()}
|
|
165
|
+
</Typography>
|
|
166
|
+
<Touchable
|
|
167
|
+
disabled={isDeletingToken}
|
|
168
|
+
style={styles.logoutButton}
|
|
169
|
+
onPress={openConfirmLogoutAlert}
|
|
170
|
+
>
|
|
171
|
+
{isDeletingToken ? (
|
|
172
|
+
<Loader size="s" />
|
|
173
|
+
) : (
|
|
174
|
+
<LeftArrow
|
|
175
|
+
color={lightTheme.colors.text.primary}
|
|
176
|
+
size={moderateScale(20)}
|
|
177
|
+
viewBox="0 0 20 20"
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
180
|
+
<Typography style={styles.logoutButtonLabel}>
|
|
181
|
+
{isDeletingToken
|
|
182
|
+
? strings.commons.buttons.loggingOut
|
|
183
|
+
: strings.commons.buttons.Logout}
|
|
184
|
+
</Typography>
|
|
185
|
+
</Touchable>
|
|
186
|
+
</Container>
|
|
187
|
+
</ScrollView>
|
|
188
|
+
</ParentView>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const styles = StyleSheet.create({
|
|
193
|
+
scrollContentContainer: {
|
|
194
|
+
flexGrow: 1,
|
|
195
|
+
justifyContent: "space-between",
|
|
196
|
+
paddingBottom: moderateScale(16),
|
|
197
|
+
paddingHorizontal: moderateScale(16),
|
|
198
|
+
},
|
|
199
|
+
notificationsDisabled: {
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
borderColor: lightTheme.colors.palette.grey300,
|
|
202
|
+
borderRadius: moderateScale(15),
|
|
203
|
+
borderWidth: moderateScale(1),
|
|
204
|
+
marginTop: moderateScale(10),
|
|
205
|
+
padding: moderateScale(18),
|
|
206
|
+
},
|
|
207
|
+
notificationsDisabledTitle: {
|
|
208
|
+
marginTop: moderateScale(10),
|
|
209
|
+
},
|
|
210
|
+
notificationsDisabledDescription: {
|
|
211
|
+
marginTop: moderateScale(10),
|
|
212
|
+
textAlign: "center",
|
|
213
|
+
},
|
|
214
|
+
notificationSettingsButton: {
|
|
215
|
+
borderRadius: moderateScale(10),
|
|
216
|
+
marginTop: moderateScale(24),
|
|
217
|
+
width: moderateScale(192),
|
|
218
|
+
},
|
|
219
|
+
notificationSettingsButtonLabel: {
|
|
220
|
+
fontSize: lightTheme.fontSizes.m,
|
|
221
|
+
},
|
|
222
|
+
helpButton: {
|
|
223
|
+
alignItems: "center",
|
|
224
|
+
flexDirection: "row",
|
|
225
|
+
backgroundColor: lightTheme.colors.background.secondary,
|
|
226
|
+
justifyContent: "space-between",
|
|
227
|
+
paddingVertical: moderateScale(12),
|
|
228
|
+
marginTop: moderateScale(24),
|
|
229
|
+
paddingHorizontal: moderateScale(12),
|
|
230
|
+
},
|
|
231
|
+
helpButtonLabel: {
|
|
232
|
+
fontFamily: lightTheme.fonts.regular,
|
|
233
|
+
fontSize: lightTheme.fontSizes.l,
|
|
234
|
+
textAlign: "left",
|
|
235
|
+
},
|
|
236
|
+
footer: {
|
|
237
|
+
marginTop: moderateScale(16),
|
|
238
|
+
},
|
|
239
|
+
logoutButton: {
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
flexDirection: "row",
|
|
242
|
+
alignSelf: "flex-start",
|
|
243
|
+
marginLeft: -1,
|
|
244
|
+
},
|
|
245
|
+
logoutButtonLabel: {
|
|
246
|
+
color: lightTheme.colors.text.primary,
|
|
247
|
+
fontFamily: lightTheme.fonts.regular,
|
|
248
|
+
fontSize: lightTheme.fontSizes.xl,
|
|
249
|
+
marginLeft: moderateScale(6),
|
|
250
|
+
},
|
|
251
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { type ComponentType } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Avatar as UIAvatar,
|
|
6
|
+
Typography,
|
|
7
|
+
Container,
|
|
8
|
+
lightTheme,
|
|
9
|
+
type AvatarProps,
|
|
10
|
+
} from "@bigbinary/neetoui-rn";
|
|
11
|
+
import Config from "react-native-config";
|
|
12
|
+
|
|
13
|
+
import { type Profile } from "../../api/profile";
|
|
14
|
+
import { OrganizationItem } from "../../components/OrganizationItem";
|
|
15
|
+
import { moderateScale } from "../../helpers/scale";
|
|
16
|
+
|
|
17
|
+
// The profile endpoint sends `null` for users without a picture; v3 narrowed
|
|
18
|
+
// `imageUrl` to `string | undefined`.
|
|
19
|
+
const Avatar = UIAvatar as ComponentType<
|
|
20
|
+
Omit<AvatarProps, "imageUrl"> & { imageUrl?: string | null }
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The profile endpoint also returns the split name fields and the
|
|
25
|
+
* organization block; `Profile` only declares the subset commons consumed
|
|
26
|
+
* before. See the migration report.
|
|
27
|
+
*/
|
|
28
|
+
export type ProfileDetails = Profile & {
|
|
29
|
+
first_name?: string;
|
|
30
|
+
last_name?: string;
|
|
31
|
+
organization?: { name?: string; subdomain?: string };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export interface UserDataProps {
|
|
35
|
+
userDetails?: ProfileDetails;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const renderSubdomainURL = (subdomain: string) =>
|
|
39
|
+
`${subdomain}${Config.URL_SUFFIX}`;
|
|
40
|
+
|
|
41
|
+
export const UserData = ({ userDetails }: UserDataProps) => (
|
|
42
|
+
<Container>
|
|
43
|
+
<Container style={styles.identity}>
|
|
44
|
+
<Container>
|
|
45
|
+
<Avatar
|
|
46
|
+
imageUrl={userDetails?.profile_image_url}
|
|
47
|
+
name={`${userDetails?.first_name || ""} ${
|
|
48
|
+
userDetails?.last_name || ""
|
|
49
|
+
}`}
|
|
50
|
+
/>
|
|
51
|
+
</Container>
|
|
52
|
+
<Container style={styles.names}>
|
|
53
|
+
<Typography
|
|
54
|
+
color={lightTheme.colors.text.primary}
|
|
55
|
+
numberOfLines={2}
|
|
56
|
+
size="xl"
|
|
57
|
+
weight="semibold"
|
|
58
|
+
>
|
|
59
|
+
{userDetails?.first_name || ""} {userDetails?.last_name || ""}
|
|
60
|
+
</Typography>
|
|
61
|
+
<Typography color={lightTheme.colors.palette.grey700} weight="regular">
|
|
62
|
+
{userDetails?.email}
|
|
63
|
+
</Typography>
|
|
64
|
+
</Container>
|
|
65
|
+
</Container>
|
|
66
|
+
<Container style={styles.organization}>
|
|
67
|
+
<OrganizationItem
|
|
68
|
+
name={userDetails?.organization?.name || ""}
|
|
69
|
+
subdomain={
|
|
70
|
+
userDetails?.organization?.subdomain
|
|
71
|
+
? renderSubdomainURL(userDetails?.organization?.subdomain)
|
|
72
|
+
: ""
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
</Container>
|
|
76
|
+
</Container>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
identity: {
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
flexDirection: "row",
|
|
83
|
+
},
|
|
84
|
+
names: {
|
|
85
|
+
flex: 1,
|
|
86
|
+
justifyContent: "space-between",
|
|
87
|
+
marginLeft: moderateScale(12),
|
|
88
|
+
},
|
|
89
|
+
organization: {
|
|
90
|
+
marginTop: moderateScale(30),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { findIndexBy } from "@bigbinary/neeto-cist";
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
Container,
|
|
8
|
+
Loader,
|
|
9
|
+
ParentView,
|
|
10
|
+
ScrollView,
|
|
11
|
+
lightTheme,
|
|
12
|
+
} from "@bigbinary/neetoui-rn";
|
|
13
|
+
import { useNavigation, type NavigationProp } from "@react-navigation/native";
|
|
14
|
+
import { Formik, type FormikProps } from "formik";
|
|
15
|
+
import * as Yup from "yup";
|
|
16
|
+
|
|
17
|
+
import { APP_NAME } from "./constants";
|
|
18
|
+
import Email from "./Email";
|
|
19
|
+
import ProductSelect from "./ProductSelect";
|
|
20
|
+
import RolesRadioGroup from "./RolesRadioGroup";
|
|
21
|
+
import SaveButtons from "./SaveButtons";
|
|
22
|
+
import {
|
|
23
|
+
getInitialValues,
|
|
24
|
+
type AddTeamMemberFormValues,
|
|
25
|
+
type GlobalRolesByApp,
|
|
26
|
+
} from "./utils";
|
|
27
|
+
|
|
28
|
+
import { type OrganizationRole } from "../../api/organization_roles";
|
|
29
|
+
import { Header } from "../../components";
|
|
30
|
+
import { moderateScale } from "../../helpers/scale";
|
|
31
|
+
import {
|
|
32
|
+
useFetchGlobalRoles,
|
|
33
|
+
useFetchRoles,
|
|
34
|
+
} from "../../hooks/query/useRolesApi";
|
|
35
|
+
import { useCreateMember } from "../../hooks/query/useTeamMembersApi";
|
|
36
|
+
import { type CommonsParamList } from "../../navigation/types";
|
|
37
|
+
|
|
38
|
+
interface FormContentProps extends Pick<
|
|
39
|
+
FormikProps<AddTeamMemberFormValues>,
|
|
40
|
+
| "handleChange"
|
|
41
|
+
| "handleSubmit"
|
|
42
|
+
| "setFieldValue"
|
|
43
|
+
| "errors"
|
|
44
|
+
| "isValid"
|
|
45
|
+
| "values"
|
|
46
|
+
| "dirty"
|
|
47
|
+
> {
|
|
48
|
+
currentStep: number;
|
|
49
|
+
setCurrentStep: (step: number) => void;
|
|
50
|
+
roles: OrganizationRole[];
|
|
51
|
+
globalRoles: GlobalRolesByApp;
|
|
52
|
+
isLoadingCreateMember: boolean;
|
|
53
|
+
navigation: NavigationProp<CommonsParamList>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const FormContent = ({
|
|
57
|
+
currentStep,
|
|
58
|
+
setCurrentStep,
|
|
59
|
+
roles,
|
|
60
|
+
globalRoles,
|
|
61
|
+
isLoadingCreateMember,
|
|
62
|
+
handleChange,
|
|
63
|
+
handleSubmit,
|
|
64
|
+
setFieldValue,
|
|
65
|
+
errors,
|
|
66
|
+
isValid,
|
|
67
|
+
values,
|
|
68
|
+
dirty,
|
|
69
|
+
navigation,
|
|
70
|
+
}: FormContentProps) => {
|
|
71
|
+
const handleRoleChange = (role: string) => {
|
|
72
|
+
setFieldValue("role", role);
|
|
73
|
+
|
|
74
|
+
const currentAppIndex = findIndexBy(
|
|
75
|
+
{ app_name: APP_NAME },
|
|
76
|
+
values.products
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if (currentAppIndex !== -1) {
|
|
80
|
+
setFieldValue(`products.${currentAppIndex}.active_role`, role);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<ScrollView>
|
|
87
|
+
<Container style={styles.container}>
|
|
88
|
+
{currentStep === 1 ? (
|
|
89
|
+
<>
|
|
90
|
+
<Email
|
|
91
|
+
autoFocus
|
|
92
|
+
email={values?.email}
|
|
93
|
+
error={errors?.email}
|
|
94
|
+
updateEmail={handleChange("email")}
|
|
95
|
+
/>
|
|
96
|
+
<RolesRadioGroup
|
|
97
|
+
roles={roles}
|
|
98
|
+
selectedRole={values?.role}
|
|
99
|
+
updateRole={handleRoleChange}
|
|
100
|
+
/>
|
|
101
|
+
</>
|
|
102
|
+
) : (
|
|
103
|
+
<ProductSelect
|
|
104
|
+
globalRoles={globalRoles}
|
|
105
|
+
setFieldValue={setFieldValue}
|
|
106
|
+
values={values}
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
</Container>
|
|
110
|
+
</ScrollView>
|
|
111
|
+
{currentStep === 1 ? (
|
|
112
|
+
<Container style={styles.footer}>
|
|
113
|
+
<Button
|
|
114
|
+
disabled={!isValid || !dirty}
|
|
115
|
+
label="Continue"
|
|
116
|
+
labelStyle={styles.continueButtonLabel}
|
|
117
|
+
style={styles.continueButton}
|
|
118
|
+
onPress={() => setCurrentStep(2)}
|
|
119
|
+
/>
|
|
120
|
+
</Container>
|
|
121
|
+
) : (
|
|
122
|
+
<SaveButtons
|
|
123
|
+
disabled={!isValid || !dirty}
|
|
124
|
+
isLoading={isLoadingCreateMember}
|
|
125
|
+
onCancel={() => navigation.goBack()}
|
|
126
|
+
onSave={handleSubmit}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const AddTeamMemberScreen = () => {
|
|
134
|
+
const navigation = useNavigation<NavigationProp<CommonsParamList>>();
|
|
135
|
+
const [currentStep, setCurrentStep] = useState(1);
|
|
136
|
+
|
|
137
|
+
const { mutate: createMember, isPending: isLoadingCreateMember } =
|
|
138
|
+
useCreateMember({ onSuccess: () => navigation.goBack() });
|
|
139
|
+
|
|
140
|
+
const { data: roles = [], isPending: isLoadingRoles } = useFetchRoles();
|
|
141
|
+
const { data: globalRoles = {}, isPending: isLoadingGlobalRoles } =
|
|
142
|
+
useFetchGlobalRoles();
|
|
143
|
+
|
|
144
|
+
const handleBackPress = () => {
|
|
145
|
+
if (currentStep === 2) {
|
|
146
|
+
setCurrentStep(1);
|
|
147
|
+
} else {
|
|
148
|
+
navigation.goBack();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const handleCreateMember = (values: AddTeamMemberFormValues) => {
|
|
153
|
+
const payload = {
|
|
154
|
+
emails: [values.email],
|
|
155
|
+
products: values.products,
|
|
156
|
+
organization_role: values.role,
|
|
157
|
+
};
|
|
158
|
+
createMember({ payload });
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
if (isLoadingRoles || isLoadingGlobalRoles) {
|
|
162
|
+
return (
|
|
163
|
+
// v2's `bg`/`flex` are dropped: v3's ParentView already fills its parent
|
|
164
|
+
// and paints the active theme's primary background by default.
|
|
165
|
+
<ParentView barStyle="dark-content">
|
|
166
|
+
<Header canGoBack title="Add team member" />
|
|
167
|
+
<Container style={styles.loader}>
|
|
168
|
+
<Loader color={lightTheme.colors.primary} size="l" />
|
|
169
|
+
</Container>
|
|
170
|
+
</ParentView>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<ParentView barStyle="dark-content">
|
|
176
|
+
<Header canGoBack title="Add team member" onBackPress={handleBackPress} />
|
|
177
|
+
<Formik
|
|
178
|
+
enableReinitialize
|
|
179
|
+
validateOnBlur
|
|
180
|
+
initialValues={getInitialValues(roles?.[1]?.name, globalRoles)}
|
|
181
|
+
validationSchema={Yup.object().shape({
|
|
182
|
+
email: Yup.string().email().required(),
|
|
183
|
+
})}
|
|
184
|
+
onSubmit={handleCreateMember}
|
|
185
|
+
>
|
|
186
|
+
{({
|
|
187
|
+
handleChange,
|
|
188
|
+
handleSubmit,
|
|
189
|
+
setFieldValue,
|
|
190
|
+
errors,
|
|
191
|
+
isValid,
|
|
192
|
+
values,
|
|
193
|
+
dirty,
|
|
194
|
+
}) => (
|
|
195
|
+
<FormContent
|
|
196
|
+
currentStep={currentStep}
|
|
197
|
+
dirty={dirty}
|
|
198
|
+
errors={errors}
|
|
199
|
+
globalRoles={globalRoles}
|
|
200
|
+
handleChange={handleChange}
|
|
201
|
+
handleSubmit={handleSubmit}
|
|
202
|
+
isLoadingCreateMember={isLoadingCreateMember}
|
|
203
|
+
isValid={isValid}
|
|
204
|
+
navigation={navigation}
|
|
205
|
+
roles={roles}
|
|
206
|
+
setCurrentStep={setCurrentStep}
|
|
207
|
+
setFieldValue={setFieldValue}
|
|
208
|
+
values={values}
|
|
209
|
+
/>
|
|
210
|
+
)}
|
|
211
|
+
</Formik>
|
|
212
|
+
</ParentView>
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const styles = StyleSheet.create({
|
|
217
|
+
container: {
|
|
218
|
+
flex: 1,
|
|
219
|
+
paddingHorizontal: moderateScale(16),
|
|
220
|
+
rowGap: moderateScale(16),
|
|
221
|
+
marginBottom: moderateScale(48),
|
|
222
|
+
},
|
|
223
|
+
loader: {
|
|
224
|
+
alignItems: "center",
|
|
225
|
+
flex: 1,
|
|
226
|
+
justifyContent: "center",
|
|
227
|
+
},
|
|
228
|
+
footer: {
|
|
229
|
+
backgroundColor: lightTheme.colors.white,
|
|
230
|
+
bottom: 10,
|
|
231
|
+
columnGap: moderateScale(16),
|
|
232
|
+
flex: 1,
|
|
233
|
+
flexDirection: "row",
|
|
234
|
+
left: 0,
|
|
235
|
+
padding: moderateScale(16),
|
|
236
|
+
position: "absolute",
|
|
237
|
+
right: 0,
|
|
238
|
+
width: "100%",
|
|
239
|
+
},
|
|
240
|
+
continueButton: {
|
|
241
|
+
height: moderateScale(48),
|
|
242
|
+
},
|
|
243
|
+
continueButtonLabel: {
|
|
244
|
+
fontSize: lightTheme.fontSizes.m,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
export default AddTeamMemberScreen;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { type ComponentType } from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { MenuVertical } from "@bigbinary/neeto-icons-rn";
|
|
5
|
+
import {
|
|
6
|
+
Avatar as UIAvatar,
|
|
7
|
+
Container,
|
|
8
|
+
Touchable,
|
|
9
|
+
lightTheme,
|
|
10
|
+
Typography,
|
|
11
|
+
type AvatarProps,
|
|
12
|
+
} from "@bigbinary/neetoui-rn";
|
|
13
|
+
|
|
14
|
+
import { DEFAULT_ROLE_COLOR, ROLE_COLORS } from "./constants";
|
|
15
|
+
|
|
16
|
+
import { type TeamMember } from "../../api/team_members";
|
|
17
|
+
import { moderateScale } from "../../helpers/scale";
|
|
18
|
+
|
|
19
|
+
// The list endpoint sends `null` for members without a picture; v3 narrowed
|
|
20
|
+
// `imageUrl` to `string | undefined`.
|
|
21
|
+
const Avatar = UIAvatar as ComponentType<
|
|
22
|
+
Omit<AvatarProps, "imageUrl"> & { imageUrl?: string | null }
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
interface RolePillProps {
|
|
26
|
+
role: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const RolePill = ({ role }: RolePillProps) => {
|
|
30
|
+
const colors = ROLE_COLORS[role] || DEFAULT_ROLE_COLOR;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View style={[styles.pill, { backgroundColor: colors.bg }]}>
|
|
34
|
+
<Typography size="2xs" style={{ color: colors.text }} weight="medium">
|
|
35
|
+
{role}
|
|
36
|
+
</Typography>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
interface CardProps {
|
|
42
|
+
member: TeamMember;
|
|
43
|
+
onPress: (member: TeamMember) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const Card = ({ member, onPress }: CardProps) => (
|
|
47
|
+
<View style={styles.card}>
|
|
48
|
+
<Avatar
|
|
49
|
+
imageUrl={member?.profile_image_url}
|
|
50
|
+
name={member?.display_name || member?.name}
|
|
51
|
+
/>
|
|
52
|
+
<Container style={styles.cardContent}>
|
|
53
|
+
<Container style={styles.nameRow}>
|
|
54
|
+
<Typography
|
|
55
|
+
numberOfLines={1}
|
|
56
|
+
size="l"
|
|
57
|
+
style={styles.name}
|
|
58
|
+
weight="medium"
|
|
59
|
+
>
|
|
60
|
+
{member?.display_name || member.name}
|
|
61
|
+
</Typography>
|
|
62
|
+
{member.role && <RolePill role={member.role} />}
|
|
63
|
+
</Container>
|
|
64
|
+
<Typography
|
|
65
|
+
color={lightTheme.colors.palette.grey500}
|
|
66
|
+
numberOfLines={1}
|
|
67
|
+
size="s"
|
|
68
|
+
weight="regular"
|
|
69
|
+
>
|
|
70
|
+
{member.email}
|
|
71
|
+
</Typography>
|
|
72
|
+
</Container>
|
|
73
|
+
<Touchable
|
|
74
|
+
rippleConfig={{ shouldOverflowContainer: true }}
|
|
75
|
+
style={styles.menuButton}
|
|
76
|
+
onPress={() => onPress(member)}
|
|
77
|
+
>
|
|
78
|
+
<MenuVertical
|
|
79
|
+
color={lightTheme.colors.palette.grey500}
|
|
80
|
+
size={moderateScale(20)}
|
|
81
|
+
/>
|
|
82
|
+
</Touchable>
|
|
83
|
+
</View>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const styles = StyleSheet.create({
|
|
87
|
+
card: {
|
|
88
|
+
backgroundColor: "transparent",
|
|
89
|
+
borderRadius: moderateScale(12),
|
|
90
|
+
borderWidth: 1,
|
|
91
|
+
borderColor: lightTheme.colors.border.primary,
|
|
92
|
+
flexDirection: "row",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
paddingVertical: moderateScale(16),
|
|
95
|
+
paddingHorizontal: moderateScale(12),
|
|
96
|
+
columnGap: moderateScale(12),
|
|
97
|
+
},
|
|
98
|
+
cardContent: {
|
|
99
|
+
flex: 1,
|
|
100
|
+
rowGap: moderateScale(4),
|
|
101
|
+
},
|
|
102
|
+
nameRow: {
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
columnGap: moderateScale(8),
|
|
105
|
+
flexDirection: "row",
|
|
106
|
+
flexShrink: 1,
|
|
107
|
+
},
|
|
108
|
+
name: {
|
|
109
|
+
flexShrink: 1,
|
|
110
|
+
},
|
|
111
|
+
menuButton: {
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
justifyContent: "center",
|
|
114
|
+
paddingHorizontal: moderateScale(12),
|
|
115
|
+
paddingVertical: moderateScale(8),
|
|
116
|
+
},
|
|
117
|
+
pill: {
|
|
118
|
+
paddingHorizontal: moderateScale(8),
|
|
119
|
+
paddingVertical: moderateScale(2),
|
|
120
|
+
borderRadius: moderateScale(4),
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export default Card;
|