@os-team/profile 1.2.0 → 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/components/profile/ProfileNavigationItem.js +28 -0
- 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 +55 -61
- 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 +0 -27
- 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"}
|
|
@@ -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"}
|
|
@@ -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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, 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","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEtD,MAAMQ,aAAoC,GAAIC,KAAK,iBACjDtB,MAAA,CAAAM,OAAA,CAAAiB,aAAA,CAACpB,KAAA,CAAAqB,MAAM,EAAAjB,QAAA;EAACkB,IAAI,EAAC,OAAO;EAACC,IAAI,EAAC;AAAQ,GAAKJ,KAAK,CAAG,CAChD;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAtB,OAAA,GAEae,aAAa"}
|
|
@@ -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 && Object.prototype.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","prototype","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,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAM1C,MAAMY,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,CAAAtB,OAAA,GAEbe,aAAa"}
|
|
@@ -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 && Object.prototype.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","prototype","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,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAU1C,MAAMY,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,CAAAvB,OAAA,GAEjEe,cAAc"}
|
|
@@ -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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
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 && Object.prototype.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","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","value","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","defineProperty","getOwnPropertyDescriptor","u","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 <LazyProfileD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B,aAA2C,GAAGC,IAAA;EAAA,IAAC;IACnDC,OAAO;IACPC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAH,IAAA;EAAA,oBACCvD,MAAA,CAAAU,OAAA,CAAAiD,aAAA,CAACR,YAAY,EAAAxC,QAAA;IAACiD,SAAS,EAAC,OAAO;IAACC,KAAK,EAAC;EAAM,GAAKH,IAAI,gBACnD1D,MAAA,CAAAU,OAAA,CAAAiD,aAAA,CAAC3D,MAAA,CAAA8D,QAAQ;IAACC,QAAQ,eAAE/D,MAAA,CAAAU,OAAA,CAAAiD,aAAA,CAACrD,WAAA,CAAAI,OAAU,MAAE;EAAE,gBACjCV,MAAA,CAAAU,OAAA,CAAAiD,aAAA,CAACb,wBAAwB;IAACU,OAAO,EAAEA;EAAQ,GACxCC,QACuB,CAClB,CACE,CAAC;AAAA,CAChB;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAvD,OAAA,GAEa4C,aAAa"}
|
|
@@ -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 && Object.prototype.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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
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","prototype","hasOwnProperty","call","i","set","obj","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","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,CAAA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AAA,CAAAyD,aAAA,CAACtB,gBAAgB,QACdgB,MAAM,iBAAI5E,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACd,kBAAkB,MAAE,CAAC,eAEjCpE,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACE,kBAAkB;IAACE,SAAS,EAAE,CAAC,CAACV;EAAO,CAAE,CAAC,eAC3C5E,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACmB,gBAAgB;IAACE,OAAO,EAAE,CAAC,CAACoB;EAAS,CAAE,CAAC,eACzC3H,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAAC2B,oBAAoB,MAAE,CAAC,EAEvBQ,OAAO,eAERrH,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAAC4B,aAAa,MAAE,CAAC,EAEhBQ,QACe,CAAC,eAEnBtH,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACrB,MAAM,qBACL7D,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACpF,KAAA,CAAAkI,aAAa,MAAE,CACV,CACR,CAAC;AAEP,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAEa0F,oBAAoB"}
|
|
@@ -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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, 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","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","ProfileNavigationItem","_ref","onClick","rest","t","useTranslation","isMinMd","useIsMinWidth","createElement","NavigationItem","href","icon","onKeyDown","e","_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"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAsD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAOtD,MAAMQ,qBAA2D,GAAGC,IAAA,IAG9D;EAAA,IAH+D;IACnEC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;IAClB,GAAGC;EACL,CAAC,GAAAF,IAAA;EACC,MAAM;IAAEG;EAAE,CAAC,GAAG,IAAAC,4BAAc,EAAC,CAAC,SAAS,CAAC,CAAC;EACzC,MAAMC,OAAO,GAAG,IAAAC,oBAAa,EAAC,IAAI,CAAC;EAEnC,IAAID,OAAO,EAAE,OAAO,IAAI;EAExB,oBACE9B,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC5B,KAAA,CAAA6B,cAAc,EAAAvB,QAAA;IACbwB,IAAI,EAAC,GAAG,CAAC;IAAA;IACTC,IAAI,eAAEnC,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC1B,YAAA,CAAAG,OAAW,MAAE,CAAE;IACtBiB,OAAO,EAAEA,OAAQ;IACjBU,SAAS,EAAGC,CAAC,IAAK;MAChB,IAAIA,CAAC,CAAClB,GAAG,KAAK,OAAO,EAAEO,OAAO,CAAC,CAAC;IAClC;EAAE,GACEC,IAAI,GAEPC,CAAC,CAAC,cAAc,CACH,CAAC;AAErB,CAAC;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEae,qBAAqB"}
|
|
@@ -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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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 && Object.prototype.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() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, 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
|