@os-team/profile 1.2.1 → 1.2.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/dist/@types/emotion.d.js +1 -0
- package/dist/@types/i18next.d.js +1 -0
- package/dist/@types/relay.d.js +0 -0
- package/dist/{types/components → components}/profile/ProfileButton.d.ts +1 -1
- package/dist/components/profile/ProfileButton.d.ts.map +1 -0
- package/dist/components/profile/ProfileButton.js +9 -0
- package/dist/components/profile/ProfileConfigContext.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProfileConfigContext.js +1 -2
- package/dist/components/profile/ProfileContext.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProfileContext.js +1 -2
- package/dist/{types/components → components}/profile/ProfileDrawer.d.ts +2 -2
- package/dist/components/profile/ProfileDrawer.d.ts.map +1 -0
- package/dist/components/profile/ProfileDrawer.js +28 -0
- package/dist/{types/components → components}/profile/ProfileDrawerContent.d.ts +7 -0
- package/dist/components/profile/ProfileDrawerContent.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProfileDrawerContent.js +66 -41
- package/dist/{types/components → components}/profile/ProfileNavigationItem.d.ts +1 -1
- package/dist/components/profile/ProfileNavigationItem.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProfileNavigationItem.js +8 -7
- package/dist/components/profile/ProfileUpdateNameModal.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProfileUpdateNameModal.js +38 -31
- package/dist/components/profile/ProfileUpdatePasswordModal.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProfileUpdatePasswordModal.js +40 -33
- package/dist/components/profile/ProtectedWrapper.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/ProtectedWrapper.js +19 -14
- package/dist/{types/components → components}/profile/UserAvatar.d.ts +1 -1
- package/dist/components/profile/UserAvatar.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/UserAvatar.js +7 -6
- package/dist/{types/components → components}/profile/UserAvatarAddon.d.ts +1 -1
- package/dist/components/profile/UserAvatarAddon.d.ts.map +1 -0
- package/dist/components/profile/UserAvatarAddon.js +50 -0
- package/dist/{types/components → components}/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts +5 -0
- package/dist/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js +2 -3
- package/dist/{types/components → components}/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts +5 -0
- package/dist/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js +2 -3
- package/dist/{types/components → components}/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts +5 -0
- package/dist/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js +2 -3
- package/dist/{types/components → components}/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts +5 -0
- package/dist/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js +2 -3
- package/dist/{types/components → components}/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts +5 -0
- package/dist/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/profile/__generated__/ProtectedWrapperQuery.graphql.js +2 -3
- package/dist/{types/components → components}/session/SessionDrawer.d.ts +1 -1
- package/dist/components/session/SessionDrawer.d.ts.map +1 -0
- package/dist/components/session/SessionDrawer.js +45 -0
- package/dist/components/session/SessionDrawerContent.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/SessionDrawerContent.js +12 -10
- package/dist/{types/components → components}/session/SessionList.d.ts +5 -5
- package/dist/components/session/SessionList.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/SessionList.js +33 -17
- package/dist/{types/components → components}/session/SessionListItem.d.ts +9 -9
- package/dist/components/session/SessionListItem.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/SessionListItem.js +37 -19
- package/dist/components/session/SessionListSkeleton.d.ts.map +1 -0
- package/dist/components/session/SessionListSkeleton.js +43 -0
- package/dist/{types/components → components}/session/__generated__/SessionDrawerContentQuery.graphql.d.ts +5 -0
- package/dist/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/__generated__/SessionDrawerContentQuery.graphql.js +2 -3
- package/dist/{types/components → components}/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts +5 -0
- package/dist/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js +2 -3
- package/dist/{types/components → components}/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts +5 -0
- package/dist/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/__generated__/SessionListItemDestroySessionMutation.graphql.js +2 -3
- package/dist/{types/components → components}/session/__generated__/SessionListItem_session.graphql.d.ts +5 -0
- package/dist/components/session/__generated__/SessionListItem_session.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/__generated__/SessionListItem_session.graphql.js +2 -3
- package/dist/{types/components → components}/session/__generated__/SessionListRefetchQuery.graphql.d.ts +5 -0
- package/dist/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/__generated__/SessionListRefetchQuery.graphql.js +2 -3
- package/dist/{types/components → components}/session/__generated__/SessionList_sessions.graphql.d.ts +5 -0
- package/dist/components/session/__generated__/SessionList_sessions.graphql.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/__generated__/SessionList_sessions.graphql.js +2 -3
- package/dist/{types/components → components}/session/formatDate.d.ts +1 -1
- package/dist/components/session/formatDate.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/formatDate.js +1 -2
- package/dist/components/session/getLastSeen.d.ts +3 -0
- package/dist/components/session/getLastSeen.d.ts.map +1 -0
- package/dist/{esm/components → components}/session/getLastSeen.js +1 -2
- package/dist/{types/components → components}/shared/ButtonUpdate.d.ts +1 -1
- package/dist/components/shared/ButtonUpdate.d.ts.map +1 -0
- package/dist/{esm/components → components}/shared/ButtonUpdate.js +6 -3
- package/dist/components/shared/ErrorResult.d.ts.map +1 -0
- package/dist/{esm/components → components}/shared/ErrorResult.js +4 -4
- package/dist/components/shared/FormError.d.ts.map +1 -0
- package/dist/{esm/components → components}/shared/FormError.js +6 -5
- package/dist/components/shared/MainLoader.d.ts.map +1 -0
- package/dist/{esm/components → components}/shared/MainLoader.js +5 -3
- package/dist/{types/components → components}/shared/icons/AndroidIcon.d.ts +1 -1
- package/dist/components/shared/icons/AndroidIcon.d.ts.map +1 -0
- package/dist/components/shared/icons/AndroidIcon.js +12 -0
- package/dist/{types/components → components}/shared/icons/AppleIcon.d.ts +1 -1
- package/dist/components/shared/icons/AppleIcon.d.ts.map +1 -0
- package/dist/components/shared/icons/AppleIcon.js +12 -0
- package/dist/{types/components → components}/shared/icons/BrowserIcon.d.ts +1 -1
- package/dist/components/shared/icons/BrowserIcon.d.ts.map +1 -0
- package/dist/components/shared/icons/BrowserIcon.js +12 -0
- package/dist/{types/components → components}/shared/icons/ProfileIcon.d.ts +1 -1
- package/dist/components/shared/icons/ProfileIcon.d.ts.map +1 -0
- package/dist/components/shared/icons/ProfileIcon.js +12 -0
- package/dist/{types/components → components}/shared/icons/UnknownDeviceIcon.d.ts +1 -1
- package/dist/components/shared/icons/UnknownDeviceIcon.d.ts.map +1 -0
- package/dist/components/shared/icons/UnknownDeviceIcon.js +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/utils/getError.d.ts.map +1 -0
- package/dist/{esm/utils → utils}/getError.js +1 -2
- package/dist/utils/getUserFullName.d.ts.map +1 -0
- package/dist/{esm/utils → utils}/getUserFullName.js +1 -2
- package/dist/{types/utils → utils}/handleFormErrors.d.ts +1 -1
- package/dist/utils/handleFormErrors.d.ts.map +1 -0
- package/dist/{esm/utils → utils}/handleFormErrors.js +1 -2
- package/package.json +50 -56
- package/src/@types/react-app-env.d.ts +3 -0
- package/src/App.tsx +42 -0
- package/src/AppRouter.tsx +12 -0
- package/src/components/ErrorResult.tsx +23 -0
- package/src/components/Layout.tsx +70 -0
- package/src/components/MainLoader.tsx +22 -0
- package/src/components/icons/HomeIcon.tsx +12 -0
- package/src/i18next.ts +34 -0
- package/src/index.tsx +6 -0
- package/src/lib/@types/emotion.d.ts +7 -0
- package/src/lib/@types/i18next.d.ts +12 -0
- package/src/lib/@types/relay.d.ts +3 -0
- package/src/lib/components/profile/ProfileButton.tsx +8 -0
- package/src/lib/components/profile/ProfileConfigContext.ts +16 -0
- package/src/lib/components/profile/ProfileContext.ts +20 -0
- package/src/lib/components/profile/ProfileDrawer.tsx +31 -0
- package/src/lib/components/profile/ProfileDrawerContent.tsx +276 -0
- package/src/lib/components/profile/ProfileNavigationItem.tsx +36 -0
- package/src/lib/components/profile/ProfileUpdateNameModal.tsx +117 -0
- package/src/lib/components/profile/ProfileUpdatePasswordModal.tsx +129 -0
- package/src/lib/components/profile/ProtectedWrapper.tsx +81 -0
- package/src/lib/components/profile/UserAvatar.tsx +23 -0
- package/src/lib/components/profile/UserAvatarAddon.tsx +62 -0
- package/src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.ts +74 -0
- package/src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.ts +100 -0
- package/src/lib/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.ts +124 -0
- package/src/lib/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.ts +93 -0
- package/src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.ts +106 -0
- package/src/lib/components/session/SessionDrawer.tsx +50 -0
- package/src/lib/components/session/SessionDrawerContent.tsx +34 -0
- package/src/lib/components/session/SessionList.tsx +138 -0
- package/src/lib/components/session/SessionListItem.tsx +318 -0
- package/src/lib/components/session/SessionListSkeleton.tsx +48 -0
- package/src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.ts +181 -0
- package/src/lib/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.ts +74 -0
- package/src/lib/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.ts +92 -0
- package/src/lib/components/session/__generated__/SessionListItem_session.graphql.ts +154 -0
- package/src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.ts +181 -0
- package/src/lib/components/session/__generated__/SessionList_sessions.graphql.ts +83 -0
- package/src/lib/components/session/formatDate.ts +21 -0
- package/{dist/cjs/components/session/getLastSeen.js → src/lib/components/session/getLastSeen.ts} +9 -9
- package/src/lib/components/shared/ButtonUpdate.tsx +10 -0
- package/src/lib/components/shared/ErrorResult.tsx +28 -0
- package/src/lib/components/shared/FormError.tsx +11 -0
- package/src/lib/components/shared/MainLoader.tsx +22 -0
- package/src/lib/components/shared/icons/AndroidIcon.tsx +12 -0
- package/src/lib/components/shared/icons/AppleIcon.tsx +12 -0
- package/src/lib/components/shared/icons/BrowserIcon.tsx +12 -0
- package/src/lib/components/shared/icons/ProfileIcon.tsx +12 -0
- package/src/lib/components/shared/icons/UnknownDeviceIcon.tsx +14 -0
- package/{dist/esm/index.js → src/lib/index.ts} +1 -1
- package/src/lib/utils/getError.ts +101 -0
- package/src/lib/utils/getUserFullName.ts +14 -0
- package/src/lib/utils/handleFormErrors.ts +16 -0
- package/src/pages/HomePage.tsx +11 -0
- package/src/schema.graphql +2494 -0
- package/src/utils/createRelayEnvironment.ts +22 -0
- package/src/utils/getError.ts +101 -0
- package/dist/cjs/@types/emotion.d.js +0 -4
- package/dist/cjs/@types/emotion.d.js.map +0 -1
- package/dist/cjs/@types/i18next.d.js +0 -4
- package/dist/cjs/@types/i18next.d.js.map +0 -1
- package/dist/cjs/components/profile/ProfileButton.js +0 -16
- package/dist/cjs/components/profile/ProfileButton.js.map +0 -1
- package/dist/cjs/components/profile/ProfileConfigContext.js +0 -17
- package/dist/cjs/components/profile/ProfileConfigContext.js.map +0 -1
- package/dist/cjs/components/profile/ProfileContext.js +0 -18
- package/dist/cjs/components/profile/ProfileContext.js.map +0 -1
- package/dist/cjs/components/profile/ProfileDrawer.js +0 -35
- package/dist/cjs/components/profile/ProfileDrawer.js.map +0 -1
- package/dist/cjs/components/profile/ProfileDrawerContent.js +0 -167
- package/dist/cjs/components/profile/ProfileDrawerContent.js.map +0 -1
- package/dist/cjs/components/profile/ProfileNavigationItem.js +0 -35
- package/dist/cjs/components/profile/ProfileNavigationItem.js.map +0 -1
- package/dist/cjs/components/profile/ProfileUpdateNameModal.js +0 -106
- package/dist/cjs/components/profile/ProfileUpdateNameModal.js.map +0 -1
- package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js +0 -106
- package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js.map +0 -1
- package/dist/cjs/components/profile/ProtectedWrapper.js +0 -54
- package/dist/cjs/components/profile/ProtectedWrapper.js.map +0 -1
- package/dist/cjs/components/profile/UserAvatar.js +0 -42
- package/dist/cjs/components/profile/UserAvatar.js.map +0 -1
- package/dist/cjs/components/profile/UserAvatarAddon.js +0 -41
- package/dist/cjs/components/profile/UserAvatarAddon.js.map +0 -1
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js +0 -63
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +0 -1
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js +0 -78
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +0 -1
- package/dist/cjs/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js +0 -95
- package/dist/cjs/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js.map +0 -1
- package/dist/cjs/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js +0 -72
- package/dist/cjs/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js.map +0 -1
- package/dist/cjs/components/profile/__generated__/ProtectedWrapperQuery.graphql.js +0 -87
- package/dist/cjs/components/profile/__generated__/ProtectedWrapperQuery.graphql.js.map +0 -1
- package/dist/cjs/components/session/SessionDrawer.js +0 -46
- package/dist/cjs/components/session/SessionDrawer.js.map +0 -1
- package/dist/cjs/components/session/SessionDrawerContent.js +0 -39
- package/dist/cjs/components/session/SessionDrawerContent.js.map +0 -1
- package/dist/cjs/components/session/SessionList.js +0 -73
- package/dist/cjs/components/session/SessionList.js.map +0 -1
- package/dist/cjs/components/session/SessionListItem.js +0 -150
- package/dist/cjs/components/session/SessionListItem.js.map +0 -1
- package/dist/cjs/components/session/SessionListSkeleton.js +0 -31
- package/dist/cjs/components/session/SessionListSkeleton.js.map +0 -1
- package/dist/cjs/components/session/__generated__/SessionDrawerContentQuery.graphql.js +0 -154
- package/dist/cjs/components/session/__generated__/SessionDrawerContentQuery.graphql.js.map +0 -1
- package/dist/cjs/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js +0 -63
- package/dist/cjs/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js.map +0 -1
- package/dist/cjs/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js +0 -72
- package/dist/cjs/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js.map +0 -1
- package/dist/cjs/components/session/__generated__/SessionListItem_session.graphql.js +0 -118
- package/dist/cjs/components/session/__generated__/SessionListItem_session.graphql.js.map +0 -1
- package/dist/cjs/components/session/__generated__/SessionListRefetchQuery.graphql.js +0 -154
- package/dist/cjs/components/session/__generated__/SessionListRefetchQuery.graphql.js.map +0 -1
- package/dist/cjs/components/session/__generated__/SessionList_sessions.graphql.js +0 -65
- package/dist/cjs/components/session/__generated__/SessionList_sessions.graphql.js.map +0 -1
- package/dist/cjs/components/session/formatDate.js +0 -19
- package/dist/cjs/components/session/formatDate.js.map +0 -1
- package/dist/cjs/components/session/getLastSeen.js.map +0 -1
- package/dist/cjs/components/shared/ButtonUpdate.js +0 -18
- package/dist/cjs/components/shared/ButtonUpdate.js.map +0 -1
- package/dist/cjs/components/shared/ErrorResult.js +0 -31
- package/dist/cjs/components/shared/ErrorResult.js.map +0 -1
- package/dist/cjs/components/shared/FormError.js +0 -21
- package/dist/cjs/components/shared/FormError.js.map +0 -1
- package/dist/cjs/components/shared/MainLoader.js +0 -17
- package/dist/cjs/components/shared/MainLoader.js.map +0 -1
- package/dist/cjs/components/shared/icons/AndroidIcon.js +0 -18
- package/dist/cjs/components/shared/icons/AndroidIcon.js.map +0 -1
- package/dist/cjs/components/shared/icons/AppleIcon.js +0 -18
- package/dist/cjs/components/shared/icons/AppleIcon.js.map +0 -1
- package/dist/cjs/components/shared/icons/BrowserIcon.js +0 -18
- package/dist/cjs/components/shared/icons/BrowserIcon.js.map +0 -1
- package/dist/cjs/components/shared/icons/ProfileIcon.js +0 -18
- package/dist/cjs/components/shared/icons/ProfileIcon.js.map +0 -1
- package/dist/cjs/components/shared/icons/UnknownDeviceIcon.js +0 -18
- package/dist/cjs/components/shared/icons/UnknownDeviceIcon.js.map +0 -1
- package/dist/cjs/index.js +0 -142
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/utils/getError.js +0 -59
- package/dist/cjs/utils/getError.js.map +0 -1
- package/dist/cjs/utils/getUserFullName.js +0 -19
- package/dist/cjs/utils/getUserFullName.js.map +0 -1
- package/dist/cjs/utils/handleFormErrors.js +0 -25
- package/dist/cjs/utils/handleFormErrors.js.map +0 -1
- package/dist/esm/@types/emotion.d.js +0 -2
- package/dist/esm/@types/emotion.d.js.map +0 -1
- package/dist/esm/@types/i18next.d.js +0 -2
- package/dist/esm/@types/i18next.d.js.map +0 -1
- package/dist/esm/components/profile/ProfileButton.js +0 -9
- package/dist/esm/components/profile/ProfileButton.js.map +0 -1
- package/dist/esm/components/profile/ProfileConfigContext.js.map +0 -1
- package/dist/esm/components/profile/ProfileContext.js.map +0 -1
- package/dist/esm/components/profile/ProfileDrawer.js +0 -25
- package/dist/esm/components/profile/ProfileDrawer.js.map +0 -1
- package/dist/esm/components/profile/ProfileDrawerContent.js.map +0 -1
- package/dist/esm/components/profile/ProfileNavigationItem.js.map +0 -1
- package/dist/esm/components/profile/ProfileUpdateNameModal.js.map +0 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordModal.js.map +0 -1
- package/dist/esm/components/profile/ProtectedWrapper.js.map +0 -1
- package/dist/esm/components/profile/UserAvatar.js.map +0 -1
- package/dist/esm/components/profile/UserAvatarAddon.js +0 -47
- package/dist/esm/components/profile/UserAvatarAddon.js.map +0 -1
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +0 -1
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +0 -1
- package/dist/esm/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js.map +0 -1
- package/dist/esm/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js.map +0 -1
- package/dist/esm/components/profile/__generated__/ProtectedWrapperQuery.graphql.js.map +0 -1
- package/dist/esm/components/session/SessionDrawer.js +0 -39
- package/dist/esm/components/session/SessionDrawer.js.map +0 -1
- package/dist/esm/components/session/SessionDrawerContent.js.map +0 -1
- package/dist/esm/components/session/SessionList.js.map +0 -1
- package/dist/esm/components/session/SessionListItem.js.map +0 -1
- package/dist/esm/components/session/SessionListSkeleton.js +0 -31
- package/dist/esm/components/session/SessionListSkeleton.js.map +0 -1
- package/dist/esm/components/session/__generated__/SessionDrawerContentQuery.graphql.js.map +0 -1
- package/dist/esm/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js.map +0 -1
- package/dist/esm/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js.map +0 -1
- package/dist/esm/components/session/__generated__/SessionListItem_session.graphql.js.map +0 -1
- package/dist/esm/components/session/__generated__/SessionListRefetchQuery.graphql.js.map +0 -1
- package/dist/esm/components/session/__generated__/SessionList_sessions.graphql.js.map +0 -1
- package/dist/esm/components/session/formatDate.js.map +0 -1
- package/dist/esm/components/session/getLastSeen.js.map +0 -1
- package/dist/esm/components/shared/ButtonUpdate.js.map +0 -1
- package/dist/esm/components/shared/ErrorResult.js.map +0 -1
- package/dist/esm/components/shared/FormError.js.map +0 -1
- package/dist/esm/components/shared/MainLoader.js.map +0 -1
- package/dist/esm/components/shared/icons/AndroidIcon.js +0 -11
- package/dist/esm/components/shared/icons/AndroidIcon.js.map +0 -1
- package/dist/esm/components/shared/icons/AppleIcon.js +0 -11
- package/dist/esm/components/shared/icons/AppleIcon.js.map +0 -1
- package/dist/esm/components/shared/icons/BrowserIcon.js +0 -11
- package/dist/esm/components/shared/icons/BrowserIcon.js.map +0 -1
- package/dist/esm/components/shared/icons/ProfileIcon.js +0 -11
- package/dist/esm/components/shared/icons/ProfileIcon.js.map +0 -1
- package/dist/esm/components/shared/icons/UnknownDeviceIcon.js +0 -11
- package/dist/esm/components/shared/icons/UnknownDeviceIcon.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/utils/getError.js.map +0 -1
- package/dist/esm/utils/getUserFullName.js.map +0 -1
- package/dist/esm/utils/handleFormErrors.js.map +0 -1
- package/dist/types/components/profile/ProfileButton.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileConfigContext.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileContext.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileDrawer.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileDrawerContent.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileNavigationItem.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileUpdateNameModal.d.ts.map +0 -1
- package/dist/types/components/profile/ProfileUpdatePasswordModal.d.ts.map +0 -1
- package/dist/types/components/profile/ProtectedWrapper.d.ts.map +0 -1
- package/dist/types/components/profile/UserAvatar.d.ts.map +0 -1
- package/dist/types/components/profile/UserAvatarAddon.d.ts.map +0 -1
- package/dist/types/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts.map +0 -1
- package/dist/types/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts.map +0 -1
- package/dist/types/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts.map +0 -1
- package/dist/types/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts.map +0 -1
- package/dist/types/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts.map +0 -1
- package/dist/types/components/session/SessionDrawer.d.ts.map +0 -1
- package/dist/types/components/session/SessionDrawerContent.d.ts.map +0 -1
- package/dist/types/components/session/SessionList.d.ts.map +0 -1
- package/dist/types/components/session/SessionListItem.d.ts.map +0 -1
- package/dist/types/components/session/SessionListSkeleton.d.ts.map +0 -1
- package/dist/types/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts.map +0 -1
- package/dist/types/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts.map +0 -1
- package/dist/types/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts.map +0 -1
- package/dist/types/components/session/__generated__/SessionListItem_session.graphql.d.ts.map +0 -1
- package/dist/types/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts.map +0 -1
- package/dist/types/components/session/__generated__/SessionList_sessions.graphql.d.ts.map +0 -1
- package/dist/types/components/session/formatDate.d.ts.map +0 -1
- package/dist/types/components/session/getLastSeen.d.ts +0 -3
- package/dist/types/components/session/getLastSeen.d.ts.map +0 -1
- package/dist/types/components/shared/ButtonUpdate.d.ts.map +0 -1
- package/dist/types/components/shared/ErrorResult.d.ts.map +0 -1
- package/dist/types/components/shared/FormError.d.ts.map +0 -1
- package/dist/types/components/shared/MainLoader.d.ts.map +0 -1
- package/dist/types/components/shared/icons/AndroidIcon.d.ts.map +0 -1
- package/dist/types/components/shared/icons/AppleIcon.d.ts.map +0 -1
- package/dist/types/components/shared/icons/BrowserIcon.d.ts.map +0 -1
- package/dist/types/components/shared/icons/ProfileIcon.d.ts.map +0 -1
- package/dist/types/components/shared/icons/UnknownDeviceIcon.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/utils/getError.d.ts.map +0 -1
- package/dist/types/utils/getUserFullName.d.ts.map +0 -1
- package/dist/types/utils/handleFormErrors.d.ts.map +0 -1
- /package/dist/{types/components → components}/profile/ProfileConfigContext.d.ts +0 -0
- /package/dist/{types/components → components}/profile/ProfileContext.d.ts +0 -0
- /package/dist/{types/components → components}/profile/ProfileUpdateNameModal.d.ts +0 -0
- /package/dist/{types/components → components}/profile/ProfileUpdatePasswordModal.d.ts +0 -0
- /package/dist/{types/components → components}/profile/ProtectedWrapper.d.ts +0 -0
- /package/dist/{types/components → components}/session/SessionDrawerContent.d.ts +0 -0
- /package/dist/{types/components → components}/session/SessionListSkeleton.d.ts +0 -0
- /package/dist/{types/components → components}/shared/ErrorResult.d.ts +0 -0
- /package/dist/{types/components → components}/shared/FormError.d.ts +0 -0
- /package/dist/{types/components → components}/shared/MainLoader.d.ts +0 -0
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
- /package/dist/{types/utils → utils}/getError.d.ts +0 -0
- /package/dist/{types/utils → utils}/getUserFullName.d.ts +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Environment, RecordSource, Store } from 'relay-runtime';
|
|
2
|
+
import createRelayNetwork from '@os-team/relay-network-creator';
|
|
3
|
+
import upload from '@os-team/relay-network-mw-upload';
|
|
4
|
+
|
|
5
|
+
let environment: Environment;
|
|
6
|
+
|
|
7
|
+
const createRelayEnvironment = (): Environment => {
|
|
8
|
+
if (!environment) {
|
|
9
|
+
environment = new Environment({
|
|
10
|
+
network: createRelayNetwork({
|
|
11
|
+
url: 'http://localhost:4000/graphql',
|
|
12
|
+
middlewares: [upload],
|
|
13
|
+
timeout: 30000,
|
|
14
|
+
}),
|
|
15
|
+
store: new Store(new RecordSource()),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return environment;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default createRelayEnvironment;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
interface Constraint {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface ErrorObject {
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
data?: Record<string, Constraint>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const DEFAULT_CODE = 'no_code';
|
|
13
|
+
const DEFAULT_MESSAGE = 'Error';
|
|
14
|
+
|
|
15
|
+
const isObject = (value: unknown): value is object =>
|
|
16
|
+
typeof value === 'object' && !Array.isArray(value) && value !== null;
|
|
17
|
+
|
|
18
|
+
const isData = (value: unknown): value is Record<string, Constraint> =>
|
|
19
|
+
isObject(value) &&
|
|
20
|
+
Object.values(value).every(
|
|
21
|
+
(constraint: unknown) =>
|
|
22
|
+
isObject(constraint) &&
|
|
23
|
+
'code' in constraint &&
|
|
24
|
+
typeof constraint.code === 'string' &&
|
|
25
|
+
'message' in constraint &&
|
|
26
|
+
typeof constraint.message === 'string'
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const getError = (error: unknown): ErrorObject => {
|
|
30
|
+
// Trying to find the message of an error
|
|
31
|
+
if (
|
|
32
|
+
!isObject(error) ||
|
|
33
|
+
!('message' in error) ||
|
|
34
|
+
typeof error.message !== 'string'
|
|
35
|
+
) {
|
|
36
|
+
return {
|
|
37
|
+
code: DEFAULT_CODE,
|
|
38
|
+
message: DEFAULT_MESSAGE,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Trying to find the first GraphQL error
|
|
43
|
+
if (
|
|
44
|
+
!('source' in error) ||
|
|
45
|
+
!isObject(error.source) ||
|
|
46
|
+
!('errors' in error.source) ||
|
|
47
|
+
!Array.isArray(error.source.errors) ||
|
|
48
|
+
error.source.errors.length === 0
|
|
49
|
+
) {
|
|
50
|
+
return {
|
|
51
|
+
code: DEFAULT_CODE,
|
|
52
|
+
message: error.message,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const firstError = error.source.errors[0] as unknown;
|
|
57
|
+
|
|
58
|
+
// Trying to find the message of the GraphQL error
|
|
59
|
+
if (
|
|
60
|
+
!isObject(firstError) ||
|
|
61
|
+
!('message' in firstError) ||
|
|
62
|
+
typeof firstError.message !== 'string'
|
|
63
|
+
) {
|
|
64
|
+
return {
|
|
65
|
+
code: DEFAULT_CODE,
|
|
66
|
+
message: error.message,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Trying to find the code of the GraphQL message
|
|
71
|
+
if (
|
|
72
|
+
!('extensions' in firstError) ||
|
|
73
|
+
!isObject(firstError.extensions) ||
|
|
74
|
+
!('code' in firstError.extensions) ||
|
|
75
|
+
typeof firstError.extensions.code !== 'string'
|
|
76
|
+
) {
|
|
77
|
+
return {
|
|
78
|
+
code: DEFAULT_CODE,
|
|
79
|
+
message: firstError.message,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Trying to find the data in the GraphQL message
|
|
84
|
+
if (
|
|
85
|
+
!('data' in firstError.extensions) ||
|
|
86
|
+
!isData(firstError.extensions.data)
|
|
87
|
+
) {
|
|
88
|
+
return {
|
|
89
|
+
code: firstError.extensions.code,
|
|
90
|
+
message: firstError.message,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
code: firstError.extensions.code,
|
|
96
|
+
message: firstError.message,
|
|
97
|
+
data: firstError.extensions.data,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default getError;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emotion.d.js","names":["require"],"sources":["../../../src/lib/@types/emotion.d.ts"],"sourcesContent":["import '@emotion/react';\nimport { Theme as BaseTheme } from '@os-design/theming';\n\ndeclare module '@emotion/react' {\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n export interface Theme extends BaseTheme {}\n}\n"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18next.d.js","names":["require"],"sources":["../../../src/lib/@types/i18next.d.ts"],"sourcesContent":["import 'i18next';\nimport common from '../../../public/locales/en/common.json';\nimport profile from '../../../public/locales/en/profile.json';\n\ndeclare module 'i18next' {\n interface CustomTypeOptions {\n resources: {\n common: typeof common;\n profile: typeof profile;\n };\n }\n}\n"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _core = require("@os-design/core");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
-
const ProfileButton = props => /*#__PURE__*/_react.default.createElement(_core.Button, _extends({
|
|
12
|
-
type: "ghost",
|
|
13
|
-
wide: "always"
|
|
14
|
-
}, props));
|
|
15
|
-
var _default = exports.default = ProfileButton;
|
|
16
|
-
//# sourceMappingURL=ProfileButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileButton.js","names":["_react","_interopRequireDefault","require","_core","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","ProfileButton","props","createElement","Button","type","wide","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonProps } from '@os-design/core';\n\nconst ProfileButton: React.FC<ButtonProps> = (props) => (\n <Button type='ghost' wide='always' {...props} />\n);\n\nexport default ProfileButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAsD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAEtD,MAAMO,aAAoC,GAAIC,KAAK,iBACjDpB,MAAA,CAAAM,OAAA,CAAAe,aAAA,CAAClB,KAAA,CAAAmB,MAAM,EAAAf,QAAA;EAACgB,IAAI,EAAC,OAAO;EAACC,IAAI,EAAC;AAAQ,GAAKJ,KAAK,CAAG,CAChD;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEaa,aAAa","ignoreList":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useProfileConfig = exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
-
const ProfileConfig = /*#__PURE__*/_react.default.createContext({
|
|
11
|
-
bucketId: ''
|
|
12
|
-
});
|
|
13
|
-
ProfileConfig.displayName = 'ProfileConfig';
|
|
14
|
-
const useProfileConfig = () => (0, _react.useContext)(ProfileConfig);
|
|
15
|
-
exports.useProfileConfig = useProfileConfig;
|
|
16
|
-
var _default = exports.default = ProfileConfig;
|
|
17
|
-
//# sourceMappingURL=ProfileConfigContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileConfigContext.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ProfileConfig","React","createContext","bucketId","displayName","useProfileConfig","useContext","exports","_default"],"sources":["../../../../src/lib/components/profile/ProfileConfigContext.ts"],"sourcesContent":["import React, { useContext } from 'react';\n\nexport interface ProfileConfigProps {\n bucketId: string;\n}\n\nconst ProfileConfig = React.createContext<ProfileConfigProps>({\n bucketId: '',\n});\n\nProfileConfig.displayName = 'ProfileConfig';\n\nexport const useProfileConfig = (): ProfileConfigProps =>\n useContext(ProfileConfig);\n\nexport default ProfileConfig;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAM1C,MAAMW,aAAa,gBAAGC,cAAK,CAACC,aAAa,CAAqB;EAC5DC,QAAQ,EAAE;AACZ,CAAC,CAAC;AAEFH,aAAa,CAACI,WAAW,GAAG,eAAe;AAEpC,MAAMC,gBAAgB,GAAGA,CAAA,KAC9B,IAAAC,iBAAU,EAACN,aAAa,CAAC;AAACO,OAAA,CAAAF,gBAAA,GAAAA,gBAAA;AAAA,IAAAG,QAAA,GAAAD,OAAA,CAAArB,OAAA,GAEbc,aAAa","ignoreList":[]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useProfile = exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
-
const ProfileContext = /*#__PURE__*/_react.default.createContext({
|
|
11
|
-
id: '',
|
|
12
|
-
email: ''
|
|
13
|
-
});
|
|
14
|
-
ProfileContext.displayName = 'ProfileContext';
|
|
15
|
-
const useProfile = () => (0, _react.useContext)(ProfileContext);
|
|
16
|
-
exports.useProfile = useProfile;
|
|
17
|
-
var _default = exports.default = ProfileContext;
|
|
18
|
-
//# sourceMappingURL=ProfileContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileContext.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ProfileContext","React","createContext","id","email","displayName","useProfile","useContext","exports","_default"],"sources":["../../../../src/lib/components/profile/ProfileContext.ts"],"sourcesContent":["import React, { useContext } from 'react';\n\nexport interface ProfileContextProps {\n id: string;\n email: string;\n firstName?: string;\n lastName?: string;\n avatar?: string;\n}\n\nconst ProfileContext = React.createContext<ProfileContextProps>({\n id: '',\n email: '',\n});\n\nProfileContext.displayName = 'ProfileContext';\n\nexport const useProfile = (): ProfileContextProps => useContext(ProfileContext);\n\nexport default ProfileContext;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAU1C,MAAMW,cAAc,gBAAGC,cAAK,CAACC,aAAa,CAAsB;EAC9DC,EAAE,EAAE,EAAE;EACNC,KAAK,EAAE;AACT,CAAC,CAAC;AAEFJ,cAAc,CAACK,WAAW,GAAG,gBAAgB;AAEtC,MAAMC,UAAU,GAAGA,CAAA,KAA2B,IAAAC,iBAAU,EAACP,cAAc,CAAC;AAACQ,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAAA,IAAAG,QAAA,GAAAD,OAAA,CAAAtB,OAAA,GAEjEc,cAAc","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _core = require("@os-design/core");
|
|
9
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
-
var _MainLoader = _interopRequireDefault(require("../shared/MainLoader"));
|
|
11
|
-
var _templateObject;
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
15
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
const LazyProfileDrawerContent = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./ProfileDrawerContent'))));
|
|
18
|
-
const StyledDrawer = (0, _styled.default)(_core.Drawer)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 2em 1em;\n"])));
|
|
19
|
-
const ProfileDrawer = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
actions,
|
|
22
|
-
children,
|
|
23
|
-
...rest
|
|
24
|
-
} = _ref;
|
|
25
|
-
return /*#__PURE__*/_react.default.createElement(StyledDrawer, _extends({
|
|
26
|
-
placement: "right",
|
|
27
|
-
width: "15em"
|
|
28
|
-
}, rest), /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
29
|
-
fallback: /*#__PURE__*/_react.default.createElement(_MainLoader.default, null)
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(LazyProfileDrawerContent, {
|
|
31
|
-
actions: actions
|
|
32
|
-
}, children)));
|
|
33
|
-
};
|
|
34
|
-
var _default = exports.default = ProfileDrawer;
|
|
35
|
-
//# sourceMappingURL=ProfileDrawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawer.js","names":["_react","_interopRequireWildcard","require","_core","_styled","_interopRequireDefault","_MainLoader","_templateObject","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_taggedTemplateLiteral","slice","freeze","defineProperties","raw","value","_getRequireWildcardCache","WeakMap","has","get","__proto__","a","defineProperty","getOwnPropertyDescriptor","u","i","set","LazyProfileDrawerContent","lazy","Promise","resolve","then","StyledDrawer","styled","Drawer","ProfileDrawer","_ref","actions","children","rest","createElement","placement","width","Suspense","fallback","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileDrawer.tsx"],"sourcesContent":["import React, { lazy, Suspense } from 'react';\nimport { Drawer, DrawerProps } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { ProfileDrawerContentProps } from './ProfileDrawerContent';\nimport MainLoader from '../shared/MainLoader';\n\nconst LazyProfileDrawerContent = lazy(() => import('./ProfileDrawerContent'));\n\nexport type ProfileDrawerProps = ProfileDrawerContentProps & DrawerProps;\n\nconst StyledDrawer = styled(Drawer)`\n display: flex;\n flex-direction: column;\n padding: 2em 1em;\n`;\n\nconst ProfileDrawer: React.FC<ProfileDrawerProps> = ({\n actions,\n children,\n ...rest\n}) => (\n <StyledDrawer placement='right' width='15em' {...rest}>\n <Suspense fallback={<MainLoader />}>\n <LazyProfileDrawerContent actions={actions}>\n {children}\n </LazyProfileDrawerContent>\n </Suspense>\n </StyledDrawer>\n);\n\nexport default ProfileDrawer;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,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EAAM,GAAKH,IAAI,gBACnDpD,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAACrD,MAAA,CAAAwD,QAAQ;IAACC,QAAQ,eAAEzD,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAAC/C,WAAA,CAAAI,OAAU,MAAE;EAAE,gBACjCV,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAACb,wBAAwB;IAACU,OAAO,EAAEA;EAAQ,GACxCC,QACuB,CAClB,CACE,CAAC;AAAA,CAChB;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAjD,OAAA,GAEasC,aAAa","ignoreList":[]}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
8
|
-
var _core = require("@os-design/core");
|
|
9
|
-
var _theming = require("@os-design/theming");
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _reactI18next = require("react-i18next");
|
|
12
|
-
var _hooks = require("react-relay/hooks");
|
|
13
|
-
var _getError = _interopRequireDefault(require("../../utils/getError"));
|
|
14
|
-
var _ProfileButton = _interopRequireDefault(require("./ProfileButton"));
|
|
15
|
-
var _ProfileContext = require("./ProfileContext");
|
|
16
|
-
var _ProfileUpdateNameModal = _interopRequireDefault(require("./ProfileUpdateNameModal"));
|
|
17
|
-
var _ProfileUpdatePasswordModal = _interopRequireDefault(require("./ProfileUpdatePasswordModal"));
|
|
18
|
-
var _UserAvatar = _interopRequireDefault(require("./UserAvatar"));
|
|
19
|
-
var _ProfileDrawerContentUpdateAvatarMutation, _ProfileDrawerContentSignOutMutation, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
20
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
24
|
-
const AvatarContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
|
|
25
|
-
const UserContent = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-top: 1em;\n"])));
|
|
26
|
-
const FullName = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: ", "em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n"])), p => p.theme.sizes.large);
|
|
27
|
-
const Email = _styled.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n margin-top: 0.2em;\n text-align: center;\n"])), p => (0, _theming.clr)(p.theme.inputColorPlaceholder));
|
|
28
|
-
const ActionsContainer = _styled.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-top: 1.5em;\n"])));
|
|
29
|
-
const Footer = _styled.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n"])));
|
|
30
|
-
const HiddenInput = _styled.default.input(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: none;\n"])));
|
|
31
|
-
const query = _ProfileDrawerContentUpdateAvatarMutation !== void 0 ? _ProfileDrawerContentUpdateAvatarMutation : (_ProfileDrawerContentUpdateAvatarMutation = require("./__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql"), _ProfileDrawerContentUpdateAvatarMutation.hash && _ProfileDrawerContentUpdateAvatarMutation.hash !== "cf72a6314772ed0d1f182b197c858505" && console.error("The definition of 'ProfileDrawerContentUpdateAvatarMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileDrawerContentUpdateAvatarMutation);
|
|
32
|
-
const DeleteAvatarButton = () => {
|
|
33
|
-
const {
|
|
34
|
-
t
|
|
35
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
36
|
-
const [commit, loading] = (0, _hooks.useMutation)(query);
|
|
37
|
-
const handler = (0, _react.useCallback)(() => {
|
|
38
|
-
commit({
|
|
39
|
-
variables: {
|
|
40
|
-
input: {
|
|
41
|
-
avatar: null
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
onError: e => _core.message.error((0, _getError.default)(e).message),
|
|
45
|
-
onCompleted: () => {
|
|
46
|
-
_core.message.success(t('profile:updated'));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}, [commit, t]);
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement(_ProfileButton.default, {
|
|
51
|
-
loading: loading,
|
|
52
|
-
onClick: handler
|
|
53
|
-
}, t('profile:deleteAvatar'));
|
|
54
|
-
};
|
|
55
|
-
const UpdateAvatarButton = _ref => {
|
|
56
|
-
let {
|
|
57
|
-
hasAvatar
|
|
58
|
-
} = _ref;
|
|
59
|
-
const {
|
|
60
|
-
t
|
|
61
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
62
|
-
const fileInputRef = (0, _react.useRef)(null);
|
|
63
|
-
const [commit, loading] = (0, _hooks.useMutation)(query);
|
|
64
|
-
const handler = (0, _react.useCallback)(e => {
|
|
65
|
-
const target = e.target;
|
|
66
|
-
if (!target) return;
|
|
67
|
-
const {
|
|
68
|
-
files
|
|
69
|
-
} = target;
|
|
70
|
-
if (!files) return;
|
|
71
|
-
const file = files[0];
|
|
72
|
-
commit({
|
|
73
|
-
variables: {
|
|
74
|
-
input: {}
|
|
75
|
-
},
|
|
76
|
-
uploadables: {
|
|
77
|
-
avatar: file
|
|
78
|
-
},
|
|
79
|
-
onError: error => _core.message.error((0, _getError.default)(error).message),
|
|
80
|
-
onCompleted: () => {
|
|
81
|
-
_core.message.success(t('profile:updated'));
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}, [commit, t]);
|
|
85
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ProfileButton.default, {
|
|
86
|
-
loading: loading,
|
|
87
|
-
onClick: () => {
|
|
88
|
-
if (!fileInputRef.current) return;
|
|
89
|
-
fileInputRef.current.value = '';
|
|
90
|
-
fileInputRef.current.click();
|
|
91
|
-
}
|
|
92
|
-
}, t("profile:".concat(hasAvatar ? 'changeAvatar' : 'setAvatar'))), /*#__PURE__*/_react.default.createElement(HiddenInput, {
|
|
93
|
-
type: "file",
|
|
94
|
-
accept: "image/jpeg,image/png,image/webp",
|
|
95
|
-
onChange: handler,
|
|
96
|
-
ref: fileInputRef
|
|
97
|
-
}));
|
|
98
|
-
};
|
|
99
|
-
const UpdateNameButton = _ref2 => {
|
|
100
|
-
let {
|
|
101
|
-
hasName
|
|
102
|
-
} = _ref2;
|
|
103
|
-
const {
|
|
104
|
-
t
|
|
105
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
106
|
-
const [modalVisible, setModalVisible] = (0, _react.useState)(false);
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ProfileButton.default, {
|
|
108
|
-
onClick: () => setModalVisible(true)
|
|
109
|
-
}, t("profile:".concat(hasName ? 'changeName' : 'setName'))), /*#__PURE__*/_react.default.createElement(_ProfileUpdateNameModal.default, {
|
|
110
|
-
visible: modalVisible,
|
|
111
|
-
onClose: () => setModalVisible(false)
|
|
112
|
-
}));
|
|
113
|
-
};
|
|
114
|
-
const ChangePasswordButton = () => {
|
|
115
|
-
const {
|
|
116
|
-
t
|
|
117
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
118
|
-
const [modalVisible, setModalVisible] = (0, _react.useState)(false);
|
|
119
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ProfileButton.default, {
|
|
120
|
-
onClick: () => setModalVisible(true)
|
|
121
|
-
}, t('profile:changePassword')), /*#__PURE__*/_react.default.createElement(_ProfileUpdatePasswordModal.default, {
|
|
122
|
-
visible: modalVisible,
|
|
123
|
-
onClose: () => setModalVisible(false)
|
|
124
|
-
}));
|
|
125
|
-
};
|
|
126
|
-
const SignOutButton = () => {
|
|
127
|
-
const {
|
|
128
|
-
t
|
|
129
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
130
|
-
const [commit, loading] = (0, _hooks.useMutation)(_ProfileDrawerContentSignOutMutation !== void 0 ? _ProfileDrawerContentSignOutMutation : (_ProfileDrawerContentSignOutMutation = require("./__generated__/ProfileDrawerContentSignOutMutation.graphql"), _ProfileDrawerContentSignOutMutation.hash && _ProfileDrawerContentSignOutMutation.hash !== "c7ca96e9e713315606b0c22d196b6f7b" && console.error("The definition of 'ProfileDrawerContentSignOutMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileDrawerContentSignOutMutation));
|
|
131
|
-
const handler = (0, _react.useCallback)(() => {
|
|
132
|
-
commit({
|
|
133
|
-
variables: {},
|
|
134
|
-
onError: e => _core.message.error((0, _getError.default)(e).message),
|
|
135
|
-
onCompleted: () => {
|
|
136
|
-
window.location.href = '/auth/';
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}, [commit]);
|
|
140
|
-
return /*#__PURE__*/_react.default.createElement(_ProfileButton.default, {
|
|
141
|
-
danger: true,
|
|
142
|
-
loading: loading,
|
|
143
|
-
onClick: handler
|
|
144
|
-
}, t('profile:signOut'));
|
|
145
|
-
};
|
|
146
|
-
const ProfileDrawerContent = _ref3 => {
|
|
147
|
-
let {
|
|
148
|
-
actions,
|
|
149
|
-
children
|
|
150
|
-
} = _ref3;
|
|
151
|
-
const {
|
|
152
|
-
email,
|
|
153
|
-
firstName,
|
|
154
|
-
lastName,
|
|
155
|
-
avatar
|
|
156
|
-
} = (0, _ProfileContext.useProfile)();
|
|
157
|
-
const fullName = (0, _react.useMemo)(() => [firstName, lastName].filter(i => i).join(' '), [firstName, lastName]);
|
|
158
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(AvatarContainer, null, /*#__PURE__*/_react.default.createElement(_UserAvatar.default, {
|
|
159
|
-
size: "10em"
|
|
160
|
-
}), /*#__PURE__*/_react.default.createElement(UserContent, null, fullName && /*#__PURE__*/_react.default.createElement(FullName, null, fullName), /*#__PURE__*/_react.default.createElement(Email, null, email))), /*#__PURE__*/_react.default.createElement(ActionsContainer, null, avatar && /*#__PURE__*/_react.default.createElement(DeleteAvatarButton, null), /*#__PURE__*/_react.default.createElement(UpdateAvatarButton, {
|
|
161
|
-
hasAvatar: !!avatar
|
|
162
|
-
}), /*#__PURE__*/_react.default.createElement(UpdateNameButton, {
|
|
163
|
-
hasName: !!fullName
|
|
164
|
-
}), /*#__PURE__*/_react.default.createElement(ChangePasswordButton, null), actions, /*#__PURE__*/_react.default.createElement(SignOutButton, null), children), /*#__PURE__*/_react.default.createElement(Footer, null, /*#__PURE__*/_react.default.createElement(_core.ThemeSwitcher, null)));
|
|
165
|
-
};
|
|
166
|
-
var _default = exports.default = ProfileDrawerContent;
|
|
167
|
-
//# sourceMappingURL=ProfileDrawerContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContent.js","names":["_styled","_interopRequireDefault","require","_core","_theming","_react","_interopRequireWildcard","_reactI18next","_hooks","_getError","_ProfileButton","_ProfileContext","_ProfileUpdateNameModal","_ProfileUpdatePasswordModal","_UserAvatar","_ProfileDrawerContentUpdateAvatarMutation","_ProfileDrawerContentSignOutMutation","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_taggedTemplateLiteral","slice","freeze","defineProperties","raw","value","AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","clr","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","query","hash","console","error","DeleteAvatarButton","useTranslation","commit","loading","useMutation","handler","useCallback","variables","avatar","onError","message","getError","onCompleted","success","createElement","onClick","UpdateAvatarButton","_ref","hasAvatar","fileInputRef","useRef","target","files","file","uploadables","Fragment","current","click","concat","type","accept","onChange","ref","UpdateNameButton","_ref2","hasName","modalVisible","setModalVisible","useState","visible","onClose","ChangePasswordButton","SignOutButton","window","location","href","danger","ProfileDrawerContent","_ref3","actions","children","email","firstName","lastName","useProfile","fullName","useMemo","filter","join","size","ThemeSwitcher","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { ThemeSwitcher, message } from '@os-design/core';\nimport { clr } from '@os-design/theming';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport getError from '../../utils/getError';\nimport ProfileButton from './ProfileButton';\nimport { useProfile } from './ProfileContext';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport UserAvatar from './UserAvatar';\nimport { ProfileDrawerContentSignOutMutation } from './__generated__/ProfileDrawerContentSignOutMutation.graphql';\nimport { ProfileDrawerContentUpdateAvatarMutation } from './__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql';\n\nexport interface ProfileDrawerContentProps {\n /**\n * Additional actions placed under the avatar.\n * @default undefined\n */\n actions?: React.ReactNode;\n /**\n * The children.\n */\n children?: React.ReactNode;\n}\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst UserContent = styled.div`\n margin-top: 1em;\n`;\n\nconst FullName = styled.div`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n`;\n\nconst Email = styled.div`\n color: ${(p) => clr(p.theme.inputColorPlaceholder)};\n margin-top: 0.2em;\n text-align: center;\n`;\n\nconst ActionsContainer = styled.div`\n margin-top: 1.5em;\n`;\n\nconst Footer = styled.div`\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n`;\n\nconst HiddenInput = styled.input`\n display: none;\n`;\n\nconst query = graphql`\n mutation ProfileDrawerContentUpdateAvatarMutation(\n $input: UpdateAvatarInput!\n ) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n }\n`;\n\nconst DeleteAvatarButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(query);\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (e) => message.error(getError(e).message),\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n }, [commit, t]);\n\n return (\n <ProfileButton loading={loading} onClick={handler}>\n {t('profile:deleteAvatar')}\n </ProfileButton>\n );\n};\n\ninterface UpdateAvatarButtonProps {\n hasAvatar: boolean;\n}\n\nconst UpdateAvatarButton: React.FC<UpdateAvatarButtonProps> = ({\n hasAvatar,\n}) => {\n const { t } = useTranslation(['profile']);\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(query);\n\n const handler = useCallback(\n (e) => {\n const target = e.target as HTMLInputElement | null;\n if (!target) return;\n\n const { files } = target;\n if (!files) return;\n\n const file = files[0];\n\n commit({\n variables: {\n input: {},\n },\n uploadables: { avatar: file },\n onError: (error) => message.error(getError(error).message),\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n },\n [commit, t]\n );\n\n return (\n <>\n <ProfileButton\n loading={loading}\n onClick={() => {\n if (!fileInputRef.current) return;\n fileInputRef.current.value = '';\n fileInputRef.current.click();\n }}\n >\n {t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)}\n </ProfileButton>\n\n <HiddenInput\n type='file'\n accept='image/jpeg,image/png,image/webp'\n onChange={handler}\n ref={fileInputRef}\n />\n </>\n );\n};\n\ninterface UpdateNameButtonProps {\n hasName: boolean;\n}\n\nconst UpdateNameButton: React.FC<UpdateNameButtonProps> = ({ hasName }) => {\n const { t } = useTranslation(['profile']);\n const [modalVisible, setModalVisible] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisible(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n const [modalVisible, setModalVisible] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisible(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n\n const [commit, loading] = useMutation<ProfileDrawerContentSignOutMutation>(\n graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (e) => message.error(getError(e).message),\n onCompleted: () => {\n window.location.href = '/auth/';\n },\n });\n }, [commit]);\n\n return (\n <ProfileButton danger loading={loading} onClick={handler}>\n {t('profile:signOut')}\n </ProfileButton>\n );\n};\n\nconst ProfileDrawerContent: React.FC<ProfileDrawerContentProps> = ({\n actions,\n children,\n}) => {\n const { email, firstName, lastName, avatar } = useProfile();\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' '),\n [firstName, lastName]\n );\n\n return (\n <>\n <AvatarContainer>\n <UserAvatar size='10em' />\n <UserContent>\n {fullName && <FullName>{fullName}</FullName>}\n <Email>{email}</Email>\n </UserContent>\n </AvatarContainer>\n\n <ActionsContainer>\n {avatar && <DeleteAvatarButton />}\n\n <UpdateAvatarButton hasAvatar={!!avatar} />\n <UpdateNameButton hasName={!!fullName} />\n <ChangePasswordButton />\n\n {actions}\n\n <SignOutButton />\n\n {children}\n </ActionsContainer>\n\n <Footer>\n <ThemeSwitcher />\n </Footer>\n </>\n );\n};\n\nexport default ProfileDrawerContent;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,2BAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,WAAA,GAAAb,sBAAA,CAAAC,OAAA;AAAsC,IAAAa,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gBAAgB;IAACE,OAAO,EAAE,CAAC,CAACoB;EAAS,CAAE,CAAC,eACzCxH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAAC2B,oBAAoB,MAAE,CAAC,EAEvBQ,OAAO,eAERlH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAAC4B,aAAa,MAAE,CAAC,EAEhBQ,QACe,CAAC,eAEnBnH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACrB,MAAM,qBACL1D,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACjF,KAAA,CAAA+H,aAAa,MAAE,CACV,CACR,CAAC;AAEP,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtG,OAAA,GAEauF,oBAAoB","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _media = require("@os-design/media");
|
|
9
|
-
var _core = require("@os-design/core");
|
|
10
|
-
var _reactI18next = require("react-i18next");
|
|
11
|
-
var _ProfileIcon = _interopRequireDefault(require("../shared/icons/ProfileIcon"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
-
const ProfileNavigationItem = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
onClick = () => {},
|
|
17
|
-
...rest
|
|
18
|
-
} = _ref;
|
|
19
|
-
const {
|
|
20
|
-
t
|
|
21
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
22
|
-
const isMinMd = (0, _media.useIsMinWidth)('md');
|
|
23
|
-
if (isMinMd) return null;
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement(_core.NavigationItem, _extends({
|
|
25
|
-
href: "#" // To make focusable
|
|
26
|
-
,
|
|
27
|
-
icon: /*#__PURE__*/_react.default.createElement(_ProfileIcon.default, null),
|
|
28
|
-
onClick: onClick,
|
|
29
|
-
onKeyDown: e => {
|
|
30
|
-
if (e.key === 'Enter') onClick();
|
|
31
|
-
}
|
|
32
|
-
}, rest), t('profile:menu'));
|
|
33
|
-
};
|
|
34
|
-
var _default = exports.default = ProfileNavigationItem;
|
|
35
|
-
//# sourceMappingURL=ProfileNavigationItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileNavigationItem.js","names":["_react","_interopRequireDefault","require","_media","_core","_reactI18next","_ProfileIcon","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","ProfileNavigationItem","_ref","onClick","rest","useTranslation","isMinMd","useIsMinWidth","createElement","NavigationItem","href","icon","onKeyDown","key","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileNavigationItem.tsx"],"sourcesContent":["import React from 'react';\nimport { useIsMinWidth } from '@os-design/media';\nimport { NavigationItem, NavigationItemProps } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport ProfileIcon from '../shared/icons/ProfileIcon';\n\nexport interface ProfileNavigationItemProps\n extends Partial<NavigationItemProps> {\n onClick?: () => void;\n}\n\nconst ProfileNavigationItem: React.FC<ProfileNavigationItemProps> = ({\n onClick = () => {},\n ...rest\n}) => {\n const { t } = useTranslation(['profile']);\n const isMinMd = useIsMinWidth('md');\n\n if (isMinMd) return null;\n\n return (\n <NavigationItem\n href='#' // To make focusable\n icon={<ProfileIcon />}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onClick();\n }}\n {...rest}\n >\n {t('profile:menu')}\n </NavigationItem>\n );\n};\n\nexport default ProfileNavigationItem;\n"],"mapp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,MAAE,CAAE;IACtBe,OAAO,EAAEA,OAAQ;IACjBS,SAAS,EAAG1B,CAAC,IAAK;MAChB,IAAIA,CAAC,CAAC2B,GAAG,KAAK,OAAO,EAAEV,OAAO,CAAC,CAAC;IAClC;EAAE,GACEC,IAAI,GAEPR,CAAC,CAAC,cAAc,CACH,CAAC;AAErB,CAAC;AAAC,IAAAkB,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEaa,qBAAqB","ignoreList":[]}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _core = require("@os-design/core");
|
|
8
|
-
var _form = require("@os-design/form");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactI18next = require("react-i18next");
|
|
11
|
-
var _hooks = require("react-relay/hooks");
|
|
12
|
-
var _handleFormErrors = _interopRequireDefault(require("../../utils/handleFormErrors"));
|
|
13
|
-
var _FormError = _interopRequireDefault(require("../shared/FormError"));
|
|
14
|
-
var _ProfileContext = require("./ProfileContext");
|
|
15
|
-
var _ProfileUpdateNameModalMutation;
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
|
-
const ProfileUpdateNameModal = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
visible,
|
|
23
|
-
onClose
|
|
24
|
-
} = _ref;
|
|
25
|
-
const {
|
|
26
|
-
t
|
|
27
|
-
} = (0, _reactI18next.useTranslation)(['profile']);
|
|
28
|
-
const {
|
|
29
|
-
firstName = '',
|
|
30
|
-
lastName = ''
|
|
31
|
-
} = (0, _ProfileContext.useProfile)();
|
|
32
|
-
const initValues = (0, _react.useMemo)(() => ({
|
|
33
|
-
firstName,
|
|
34
|
-
lastName
|
|
35
|
-
}), [firstName, lastName]);
|
|
36
|
-
const {
|
|
37
|
-
form,
|
|
38
|
-
Field
|
|
39
|
-
} = (0, _form.useForm)(initValues);
|
|
40
|
-
const [commit, loading] = (0, _hooks.useMutation)(_ProfileUpdateNameModalMutation !== void 0 ? _ProfileUpdateNameModalMutation : (_ProfileUpdateNameModalMutation = require("./__generated__/ProfileUpdateNameModalMutation.graphql"), _ProfileUpdateNameModalMutation.hash && _ProfileUpdateNameModalMutation.hash !== "7264a05b6738d5417df9f1dc462486aa" && console.error("The definition of 'ProfileUpdateNameModalMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileUpdateNameModalMutation));
|
|
41
|
-
|
|
42
|
-
// Reset the form when the modal is opened
|
|
43
|
-
(0, _react.useEffect)(() => {
|
|
44
|
-
if (visible) form.reset();
|
|
45
|
-
}, [form, visible]);
|
|
46
|
-
const onSubmit = (0, _react.useCallback)(() => {
|
|
47
|
-
commit({
|
|
48
|
-
variables: {
|
|
49
|
-
input: form.values.getAll()
|
|
50
|
-
},
|
|
51
|
-
onError: error => (0, _handleFormErrors.default)(form, error),
|
|
52
|
-
onCompleted: () => {
|
|
53
|
-
_core.message.success(t('profile:updated'));
|
|
54
|
-
onClose();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}, [commit, form, onClose, t]);
|
|
58
|
-
const firstNameData = (0, _react.useMemo)(() => ({
|
|
59
|
-
label: t('profile:updateNameModal.firstName.label'),
|
|
60
|
-
placeholder: t('profile:updateNameModal.firstName.placeholder')
|
|
61
|
-
}), [t]);
|
|
62
|
-
const lastNameData = (0, _react.useMemo)(() => ({
|
|
63
|
-
label: t('profile:updateNameModal.lastName.label'),
|
|
64
|
-
placeholder: t('profile:updateNameModal.lastName.placeholder')
|
|
65
|
-
}), [t]);
|
|
66
|
-
return /*#__PURE__*/_react.default.createElement(_core.Modal, {
|
|
67
|
-
title: t('profile:updateNameModal.title'),
|
|
68
|
-
visible: visible,
|
|
69
|
-
okText: t('profile:update'),
|
|
70
|
-
okLoading: loading,
|
|
71
|
-
onOk: onSubmit,
|
|
72
|
-
onClose: onClose
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(_form.FormProvider, {
|
|
74
|
-
form: form
|
|
75
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Form, null, /*#__PURE__*/_react.default.createElement(Field, {
|
|
76
|
-
name: "firstName",
|
|
77
|
-
data: firstNameData,
|
|
78
|
-
render: (props, _ref2, data) => {
|
|
79
|
-
let {
|
|
80
|
-
error
|
|
81
|
-
} = _ref2;
|
|
82
|
-
return /*#__PURE__*/_react.default.createElement(_core.FormItem, {
|
|
83
|
-
label: data.label,
|
|
84
|
-
error: error
|
|
85
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Input, _extends({
|
|
86
|
-
placeholder: data.placeholder
|
|
87
|
-
}, props)));
|
|
88
|
-
}
|
|
89
|
-
}), /*#__PURE__*/_react.default.createElement(Field, {
|
|
90
|
-
name: "lastName",
|
|
91
|
-
data: lastNameData,
|
|
92
|
-
render: (props, _ref3, data) => {
|
|
93
|
-
let {
|
|
94
|
-
error
|
|
95
|
-
} = _ref3;
|
|
96
|
-
return /*#__PURE__*/_react.default.createElement(_core.FormItem, {
|
|
97
|
-
label: data.label,
|
|
98
|
-
error: error
|
|
99
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Input, _extends({
|
|
100
|
-
placeholder: data.placeholder
|
|
101
|
-
}, props)));
|
|
102
|
-
}
|
|
103
|
-
}), /*#__PURE__*/_react.default.createElement(_FormError.default, null))));
|
|
104
|
-
};
|
|
105
|
-
var _default = exports.default = ProfileUpdateNameModal;
|
|
106
|
-
//# sourceMappingURL=ProfileUpdateNameModal.js.map
|