@replyke/core 5.1.6-beta.0 → 5.1.6-beta.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/cjs/context/index.d.ts +0 -1
- package/dist/cjs/context/index.js +3 -3
- package/dist/cjs/context/index.js.map +1 -1
- package/dist/cjs/helpers/addNotificationsMessages.js +7 -7
- package/dist/cjs/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/cjs/hooks/app-notifications-redux/index.d.ts +1 -2
- package/dist/cjs/hooks/app-notifications-redux/index.js +1 -3
- package/dist/cjs/hooks/app-notifications-redux/index.js.map +1 -1
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.d.ts +18 -4
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.js +78 -8
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.js.map +1 -1
- package/dist/cjs/hooks/lists-redux/index.d.ts +2 -0
- package/dist/cjs/hooks/lists-redux/index.js +12 -0
- package/dist/cjs/hooks/lists-redux/index.js.map +1 -0
- package/dist/cjs/hooks/lists-redux/useListsActionsRedux.d.ts +21 -0
- package/dist/cjs/hooks/lists-redux/useListsActionsRedux.js +329 -0
- package/dist/cjs/hooks/lists-redux/useListsActionsRedux.js.map +1 -0
- package/dist/cjs/hooks/{lists/useListsData.d.ts → lists-redux/useListsRedux.d.ts} +9 -5
- package/dist/cjs/hooks/lists-redux/useListsRedux.js +239 -0
- package/dist/cjs/hooks/lists-redux/useListsRedux.js.map +1 -0
- package/dist/cjs/hooks/user-redux/index.d.ts +2 -0
- package/dist/cjs/hooks/user-redux/index.js +12 -0
- package/dist/cjs/hooks/user-redux/index.js.map +1 -0
- package/dist/cjs/hooks/user-redux/useUserActionsRedux.d.ts +12 -0
- package/dist/cjs/hooks/user-redux/useUserActionsRedux.js +125 -0
- package/dist/cjs/hooks/user-redux/useUserActionsRedux.js.map +1 -0
- package/dist/cjs/hooks/user-redux/useUserRedux.d.ts +18 -0
- package/dist/cjs/hooks/user-redux/useUserRedux.js +116 -0
- package/dist/cjs/hooks/user-redux/useUserRedux.js.map +1 -0
- package/dist/cjs/hooks/users/index.d.ts +0 -2
- package/dist/cjs/hooks/users/index.js +4 -5
- package/dist/cjs/hooks/users/index.js.map +1 -1
- package/dist/cjs/index.d.ts +7 -6
- package/dist/cjs/index.js +11 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/api/appNotificationsApi.d.ts +144 -141
- package/dist/cjs/store/api/appNotificationsApi.js +11 -0
- package/dist/cjs/store/api/appNotificationsApi.js.map +1 -1
- package/dist/cjs/store/api/baseApi.d.ts +1 -1
- package/dist/cjs/store/api/baseApi.js +2 -2
- package/dist/cjs/store/api/baseApi.js.map +1 -1
- package/dist/cjs/store/api/index.d.ts +1 -0
- package/dist/cjs/store/api/index.js +2 -1
- package/dist/cjs/store/api/index.js.map +1 -1
- package/dist/cjs/store/api/listsApi.d.ts +3044 -0
- package/dist/cjs/store/api/listsApi.js +288 -0
- package/dist/cjs/store/api/listsApi.js.map +1 -0
- package/dist/cjs/store/api/userApi.d.ts +183 -0
- package/dist/cjs/store/api/userApi.js +38 -0
- package/dist/cjs/store/api/userApi.js.map +1 -0
- package/dist/cjs/store/index.d.ts +6 -2
- package/dist/cjs/store/rootReducer.d.ts +6 -2
- package/dist/cjs/store/rootReducer.js +4 -0
- package/dist/cjs/store/rootReducer.js.map +1 -1
- package/dist/cjs/store/slices/authThunks.js +6 -0
- package/dist/cjs/store/slices/authThunks.js.map +1 -1
- package/dist/cjs/store/slices/listsSlice.d.ts +66 -0
- package/dist/cjs/store/slices/listsSlice.js +213 -0
- package/dist/cjs/store/slices/listsSlice.js.map +1 -0
- package/dist/cjs/store/slices/userSlice.d.ts +29 -0
- package/dist/cjs/store/slices/userSlice.js +87 -0
- package/dist/cjs/store/slices/userSlice.js.map +1 -0
- package/dist/esm/context/index.d.ts +0 -1
- package/dist/esm/context/index.js +2 -1
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/helpers/addNotificationsMessages.js +7 -7
- package/dist/esm/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/esm/hooks/app-notifications-redux/index.d.ts +1 -2
- package/dist/esm/hooks/app-notifications-redux/index.js +0 -1
- package/dist/esm/hooks/app-notifications-redux/index.js.map +1 -1
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.d.ts +18 -4
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.js +77 -9
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.js.map +1 -1
- package/dist/esm/hooks/lists-redux/index.d.ts +2 -0
- package/dist/esm/hooks/lists-redux/index.js +4 -0
- package/dist/esm/hooks/lists-redux/index.js.map +1 -0
- package/dist/esm/hooks/lists-redux/useListsActionsRedux.d.ts +21 -0
- package/dist/esm/hooks/lists-redux/useListsActionsRedux.js +326 -0
- package/dist/esm/hooks/lists-redux/useListsActionsRedux.js.map +1 -0
- package/dist/esm/hooks/{lists/useListsData.d.ts → lists-redux/useListsRedux.d.ts} +9 -5
- package/dist/esm/hooks/lists-redux/useListsRedux.js +234 -0
- package/dist/esm/hooks/lists-redux/useListsRedux.js.map +1 -0
- package/dist/esm/hooks/user-redux/index.d.ts +2 -0
- package/dist/esm/hooks/user-redux/index.js +4 -0
- package/dist/esm/hooks/user-redux/index.js.map +1 -0
- package/dist/esm/hooks/user-redux/useUserActionsRedux.d.ts +12 -0
- package/dist/esm/hooks/user-redux/useUserActionsRedux.js +122 -0
- package/dist/esm/hooks/user-redux/useUserActionsRedux.js.map +1 -0
- package/dist/esm/hooks/user-redux/useUserRedux.d.ts +18 -0
- package/dist/esm/hooks/user-redux/useUserRedux.js +111 -0
- package/dist/esm/hooks/user-redux/useUserRedux.js.map +1 -0
- package/dist/esm/hooks/users/index.d.ts +0 -2
- package/dist/esm/hooks/users/index.js +3 -2
- package/dist/esm/hooks/users/index.js.map +1 -1
- package/dist/esm/index.d.ts +7 -6
- package/dist/esm/index.js +9 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/store/api/appNotificationsApi.d.ts +144 -141
- package/dist/esm/store/api/appNotificationsApi.js +11 -0
- package/dist/esm/store/api/appNotificationsApi.js.map +1 -1
- package/dist/esm/store/api/baseApi.d.ts +1 -1
- package/dist/esm/store/api/baseApi.js +2 -2
- package/dist/esm/store/api/baseApi.js.map +1 -1
- package/dist/esm/store/api/index.d.ts +1 -0
- package/dist/esm/store/api/index.js +2 -1
- package/dist/esm/store/api/index.js.map +1 -1
- package/dist/esm/store/api/listsApi.d.ts +3044 -0
- package/dist/esm/store/api/listsApi.js +285 -0
- package/dist/esm/store/api/listsApi.js.map +1 -0
- package/dist/esm/store/api/userApi.d.ts +183 -0
- package/dist/esm/store/api/userApi.js +35 -0
- package/dist/esm/store/api/userApi.js.map +1 -0
- package/dist/esm/store/index.d.ts +6 -2
- package/dist/esm/store/rootReducer.d.ts +6 -2
- package/dist/esm/store/rootReducer.js +4 -0
- package/dist/esm/store/rootReducer.js.map +1 -1
- package/dist/esm/store/slices/authThunks.js +6 -0
- package/dist/esm/store/slices/authThunks.js.map +1 -1
- package/dist/esm/store/slices/listsSlice.d.ts +66 -0
- package/dist/esm/store/slices/listsSlice.js +203 -0
- package/dist/esm/store/slices/listsSlice.js.map +1 -0
- package/dist/esm/store/slices/userSlice.d.ts +29 -0
- package/dist/esm/store/slices/userSlice.js +78 -0
- package/dist/esm/store/slices/userSlice.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/context/lists-context.d.ts +0 -9
- package/dist/cjs/context/lists-context.js +0 -17
- package/dist/cjs/context/lists-context.js.map +0 -1
- package/dist/cjs/context/user-context.d.ts +0 -8
- package/dist/cjs/context/user-context.js +0 -28
- package/dist/cjs/context/user-context.js.map +0 -1
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.d.ts +0 -21
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.js +0 -108
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.js.map +0 -1
- package/dist/cjs/hooks/lists/index.d.ts +0 -10
- package/dist/cjs/hooks/lists/index.js +0 -27
- package/dist/cjs/hooks/lists/index.js.map +0 -1
- package/dist/cjs/hooks/lists/useAddToList.d.ts +0 -6
- package/dist/cjs/hooks/lists/useAddToList.js +0 -70
- package/dist/cjs/hooks/lists/useAddToList.js.map +0 -1
- package/dist/cjs/hooks/lists/useCreateList.d.ts +0 -6
- package/dist/cjs/hooks/lists/useCreateList.js +0 -70
- package/dist/cjs/hooks/lists/useCreateList.js.map +0 -1
- package/dist/cjs/hooks/lists/useDeleteList.d.ts +0 -4
- package/dist/cjs/hooks/lists/useDeleteList.js +0 -69
- package/dist/cjs/hooks/lists/useDeleteList.js.map +0 -1
- package/dist/cjs/hooks/lists/useFetchRootList.d.ts +0 -3
- package/dist/cjs/hooks/lists/useFetchRootList.js +0 -69
- package/dist/cjs/hooks/lists/useFetchRootList.js.map +0 -1
- package/dist/cjs/hooks/lists/useFetchSubLists.d.ts +0 -5
- package/dist/cjs/hooks/lists/useFetchSubLists.js +0 -68
- package/dist/cjs/hooks/lists/useFetchSubLists.js.map +0 -1
- package/dist/cjs/hooks/lists/useIsEntitySaved.d.ts +0 -5
- package/dist/cjs/hooks/lists/useIsEntitySaved.js +0 -78
- package/dist/cjs/hooks/lists/useIsEntitySaved.js.map +0 -1
- package/dist/cjs/hooks/lists/useLists.d.ts +0 -2
- package/dist/cjs/hooks/lists/useLists.js +0 -9
- package/dist/cjs/hooks/lists/useLists.js.map +0 -1
- package/dist/cjs/hooks/lists/useListsData.js +0 -391
- package/dist/cjs/hooks/lists/useListsData.js.map +0 -1
- package/dist/cjs/hooks/lists/useRemoveFromList.d.ts +0 -6
- package/dist/cjs/hooks/lists/useRemoveFromList.js +0 -70
- package/dist/cjs/hooks/lists/useRemoveFromList.js.map +0 -1
- package/dist/cjs/hooks/lists/useUpdateList.d.ts +0 -8
- package/dist/cjs/hooks/lists/useUpdateList.js +0 -70
- package/dist/cjs/hooks/lists/useUpdateList.js.map +0 -1
- package/dist/cjs/hooks/users/useUser.d.ts +0 -2
- package/dist/cjs/hooks/users/useUser.js +0 -9
- package/dist/cjs/hooks/users/useUser.js.map +0 -1
- package/dist/cjs/hooks/users/useUserData.d.ts +0 -12
- package/dist/cjs/hooks/users/useUserData.js +0 -76
- package/dist/cjs/hooks/users/useUserData.js.map +0 -1
- package/dist/cjs/legacy/context/app-notifications-context.d.ts +0 -8
- package/dist/cjs/legacy/context/app-notifications-context.js +0 -28
- package/dist/cjs/legacy/context/app-notifications-context.js.map +0 -1
- package/dist/cjs/legacy/context/auth-context.d.ts +0 -8
- package/dist/cjs/legacy/context/auth-context.js +0 -29
- package/dist/cjs/legacy/context/auth-context.js.map +0 -1
- package/dist/cjs/legacy/hooks/app-notifications/index.d.ts +0 -5
- package/dist/cjs/legacy/hooks/app-notifications/index.js +0 -17
- package/dist/cjs/legacy/hooks/app-notifications/index.js.map +0 -1
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotifications.d.ts +0 -2
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotifications.js +0 -9
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotifications.js.map +0 -1
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotificationsData.d.ts +0 -16
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotificationsData.js +0 -225
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotificationsData.js.map +0 -1
- package/dist/cjs/legacy/hooks/app-notifications/useCountUnreadNotifications.d.ts +0 -2
- package/dist/cjs/legacy/hooks/app-notifications/useCountUnreadNotifications.js +0 -72
- package/dist/cjs/legacy/hooks/app-notifications/useCountUnreadNotifications.js.map +0 -1
- package/dist/cjs/legacy/hooks/app-notifications/useFetchAppNotifications.d.ts +0 -6
- package/dist/cjs/legacy/hooks/app-notifications/useFetchAppNotifications.js +0 -79
- package/dist/cjs/legacy/hooks/app-notifications/useFetchAppNotifications.js.map +0 -1
- package/dist/cjs/legacy/hooks/app-notifications/useMarkNotificationAsRead.d.ts +0 -2
- package/dist/cjs/legacy/hooks/app-notifications/useMarkNotificationAsRead.js +0 -74
- package/dist/cjs/legacy/hooks/app-notifications/useMarkNotificationAsRead.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/index.d.ts +0 -8
- package/dist/cjs/legacy/hooks/auth/index.js +0 -23
- package/dist/cjs/legacy/hooks/auth/index.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useAuth.d.ts +0 -2
- package/dist/cjs/legacy/hooks/auth/useAuth.js +0 -9
- package/dist/cjs/legacy/hooks/auth/useAuth.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useAuthData.d.ts +0 -41
- package/dist/cjs/legacy/hooks/auth/useAuthData.js +0 -271
- package/dist/cjs/legacy/hooks/auth/useAuthData.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useChangePassword.d.ts +0 -5
- package/dist/cjs/legacy/hooks/auth/useChangePassword.js +0 -70
- package/dist/cjs/legacy/hooks/auth/useChangePassword.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useRequestNewAccessToken.d.ts +0 -7
- package/dist/cjs/legacy/hooks/auth/useRequestNewAccessToken.js +0 -71
- package/dist/cjs/legacy/hooks/auth/useRequestNewAccessToken.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useSignInWithEmailAndPassword.d.ts +0 -9
- package/dist/cjs/legacy/hooks/auth/useSignInWithEmailAndPassword.js +0 -72
- package/dist/cjs/legacy/hooks/auth/useSignInWithEmailAndPassword.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useSignOut.d.ts +0 -4
- package/dist/cjs/legacy/hooks/auth/useSignOut.js +0 -67
- package/dist/cjs/legacy/hooks/auth/useSignOut.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useSignUpWithEmailAndPassword.d.ts +0 -20
- package/dist/cjs/legacy/hooks/auth/useSignUpWithEmailAndPassword.js +0 -80
- package/dist/cjs/legacy/hooks/auth/useSignUpWithEmailAndPassword.js.map +0 -1
- package/dist/cjs/legacy/hooks/auth/useVerifyExternalUser.d.ts +0 -8
- package/dist/cjs/legacy/hooks/auth/useVerifyExternalUser.js +0 -70
- package/dist/cjs/legacy/hooks/auth/useVerifyExternalUser.js.map +0 -1
- package/dist/esm/context/lists-context.d.ts +0 -9
- package/dist/esm/context/lists-context.js +0 -10
- package/dist/esm/context/lists-context.js.map +0 -1
- package/dist/esm/context/user-context.d.ts +0 -8
- package/dist/esm/context/user-context.js +0 -21
- package/dist/esm/context/user-context.js.map +0 -1
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.d.ts +0 -21
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.js +0 -103
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.js.map +0 -1
- package/dist/esm/hooks/lists/index.d.ts +0 -10
- package/dist/esm/hooks/lists/index.js +0 -11
- package/dist/esm/hooks/lists/index.js.map +0 -1
- package/dist/esm/hooks/lists/useAddToList.d.ts +0 -6
- package/dist/esm/hooks/lists/useAddToList.js +0 -65
- package/dist/esm/hooks/lists/useAddToList.js.map +0 -1
- package/dist/esm/hooks/lists/useCreateList.d.ts +0 -6
- package/dist/esm/hooks/lists/useCreateList.js +0 -65
- package/dist/esm/hooks/lists/useCreateList.js.map +0 -1
- package/dist/esm/hooks/lists/useDeleteList.d.ts +0 -4
- package/dist/esm/hooks/lists/useDeleteList.js +0 -64
- package/dist/esm/hooks/lists/useDeleteList.js.map +0 -1
- package/dist/esm/hooks/lists/useFetchRootList.d.ts +0 -3
- package/dist/esm/hooks/lists/useFetchRootList.js +0 -64
- package/dist/esm/hooks/lists/useFetchRootList.js.map +0 -1
- package/dist/esm/hooks/lists/useFetchSubLists.d.ts +0 -5
- package/dist/esm/hooks/lists/useFetchSubLists.js +0 -63
- package/dist/esm/hooks/lists/useFetchSubLists.js.map +0 -1
- package/dist/esm/hooks/lists/useIsEntitySaved.d.ts +0 -5
- package/dist/esm/hooks/lists/useIsEntitySaved.js +0 -73
- package/dist/esm/hooks/lists/useIsEntitySaved.js.map +0 -1
- package/dist/esm/hooks/lists/useLists.d.ts +0 -2
- package/dist/esm/hooks/lists/useLists.js +0 -6
- package/dist/esm/hooks/lists/useLists.js.map +0 -1
- package/dist/esm/hooks/lists/useListsData.js +0 -386
- package/dist/esm/hooks/lists/useListsData.js.map +0 -1
- package/dist/esm/hooks/lists/useRemoveFromList.d.ts +0 -6
- package/dist/esm/hooks/lists/useRemoveFromList.js +0 -65
- package/dist/esm/hooks/lists/useRemoveFromList.js.map +0 -1
- package/dist/esm/hooks/lists/useUpdateList.d.ts +0 -8
- package/dist/esm/hooks/lists/useUpdateList.js +0 -65
- package/dist/esm/hooks/lists/useUpdateList.js.map +0 -1
- package/dist/esm/hooks/users/useUser.d.ts +0 -2
- package/dist/esm/hooks/users/useUser.js +0 -6
- package/dist/esm/hooks/users/useUser.js.map +0 -1
- package/dist/esm/hooks/users/useUserData.d.ts +0 -12
- package/dist/esm/hooks/users/useUserData.js +0 -71
- package/dist/esm/hooks/users/useUserData.js.map +0 -1
- package/dist/esm/legacy/context/app-notifications-context.d.ts +0 -8
- package/dist/esm/legacy/context/app-notifications-context.js +0 -21
- package/dist/esm/legacy/context/app-notifications-context.js.map +0 -1
- package/dist/esm/legacy/context/auth-context.d.ts +0 -8
- package/dist/esm/legacy/context/auth-context.js +0 -22
- package/dist/esm/legacy/context/auth-context.js.map +0 -1
- package/dist/esm/legacy/hooks/app-notifications/index.d.ts +0 -5
- package/dist/esm/legacy/hooks/app-notifications/index.js +0 -6
- package/dist/esm/legacy/hooks/app-notifications/index.js.map +0 -1
- package/dist/esm/legacy/hooks/app-notifications/useAppNotifications.d.ts +0 -2
- package/dist/esm/legacy/hooks/app-notifications/useAppNotifications.js +0 -6
- package/dist/esm/legacy/hooks/app-notifications/useAppNotifications.js.map +0 -1
- package/dist/esm/legacy/hooks/app-notifications/useAppNotificationsData.d.ts +0 -16
- package/dist/esm/legacy/hooks/app-notifications/useAppNotificationsData.js +0 -220
- package/dist/esm/legacy/hooks/app-notifications/useAppNotificationsData.js.map +0 -1
- package/dist/esm/legacy/hooks/app-notifications/useCountUnreadNotifications.d.ts +0 -2
- package/dist/esm/legacy/hooks/app-notifications/useCountUnreadNotifications.js +0 -67
- package/dist/esm/legacy/hooks/app-notifications/useCountUnreadNotifications.js.map +0 -1
- package/dist/esm/legacy/hooks/app-notifications/useFetchAppNotifications.d.ts +0 -6
- package/dist/esm/legacy/hooks/app-notifications/useFetchAppNotifications.js +0 -74
- package/dist/esm/legacy/hooks/app-notifications/useFetchAppNotifications.js.map +0 -1
- package/dist/esm/legacy/hooks/app-notifications/useMarkNotificationAsRead.d.ts +0 -2
- package/dist/esm/legacy/hooks/app-notifications/useMarkNotificationAsRead.js +0 -69
- package/dist/esm/legacy/hooks/app-notifications/useMarkNotificationAsRead.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/index.d.ts +0 -8
- package/dist/esm/legacy/hooks/auth/index.js +0 -9
- package/dist/esm/legacy/hooks/auth/index.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useAuth.d.ts +0 -2
- package/dist/esm/legacy/hooks/auth/useAuth.js +0 -6
- package/dist/esm/legacy/hooks/auth/useAuth.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useAuthData.d.ts +0 -41
- package/dist/esm/legacy/hooks/auth/useAuthData.js +0 -266
- package/dist/esm/legacy/hooks/auth/useAuthData.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useChangePassword.d.ts +0 -5
- package/dist/esm/legacy/hooks/auth/useChangePassword.js +0 -65
- package/dist/esm/legacy/hooks/auth/useChangePassword.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useRequestNewAccessToken.d.ts +0 -7
- package/dist/esm/legacy/hooks/auth/useRequestNewAccessToken.js +0 -66
- package/dist/esm/legacy/hooks/auth/useRequestNewAccessToken.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useSignInWithEmailAndPassword.d.ts +0 -9
- package/dist/esm/legacy/hooks/auth/useSignInWithEmailAndPassword.js +0 -67
- package/dist/esm/legacy/hooks/auth/useSignInWithEmailAndPassword.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useSignOut.d.ts +0 -4
- package/dist/esm/legacy/hooks/auth/useSignOut.js +0 -62
- package/dist/esm/legacy/hooks/auth/useSignOut.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useSignUpWithEmailAndPassword.d.ts +0 -20
- package/dist/esm/legacy/hooks/auth/useSignUpWithEmailAndPassword.js +0 -75
- package/dist/esm/legacy/hooks/auth/useSignUpWithEmailAndPassword.js.map +0 -1
- package/dist/esm/legacy/hooks/auth/useVerifyExternalUser.d.ts +0 -8
- package/dist/esm/legacy/hooks/auth/useVerifyExternalUser.js +0 -65
- package/dist/esm/legacy/hooks/auth/useVerifyExternalUser.js.map +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { useCallback } from "react";
|
|
38
|
-
import useAxiosPrivate from "../../../config/useAxiosPrivate";
|
|
39
|
-
import useProject from "../../../hooks/projects/useProject";
|
|
40
|
-
import { useUserRedux } from "../../../hooks/auth-redux";
|
|
41
|
-
function useMarkNotificationAsRead() {
|
|
42
|
-
var _this = this;
|
|
43
|
-
var axios = useAxiosPrivate();
|
|
44
|
-
var projectId = useProject().projectId;
|
|
45
|
-
var user = useUserRedux().user;
|
|
46
|
-
var markNotificationAsRead = useCallback(function (notificationId) { return __awaiter(_this, void 0, void 0, function () {
|
|
47
|
-
return __generator(this, function (_a) {
|
|
48
|
-
switch (_a.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
if (!user) {
|
|
51
|
-
throw new Error("No authenticated user");
|
|
52
|
-
}
|
|
53
|
-
if (!projectId) {
|
|
54
|
-
throw new Error("No projectId available.");
|
|
55
|
-
}
|
|
56
|
-
if (!notificationId) {
|
|
57
|
-
throw new Error("No notification ID provided.");
|
|
58
|
-
}
|
|
59
|
-
return [4 /*yield*/, axios.patch("/".concat(projectId, "/app-notifications/").concat(notificationId, "/mark-as-read"), {}, { withCredentials: true })];
|
|
60
|
-
case 1:
|
|
61
|
-
_a.sent();
|
|
62
|
-
return [2 /*return*/];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}); }, [projectId, axios, user]);
|
|
66
|
-
return markNotificationAsRead;
|
|
67
|
-
}
|
|
68
|
-
export default useMarkNotificationAsRead;
|
|
69
|
-
//# sourceMappingURL=useMarkNotificationAsRead.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMarkNotificationAsRead.js","sourceRoot":"","sources":["../../../../../src/legacy/hooks/app-notifications/useMarkNotificationAsRead.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,SAAS,yBAAyB;IAAlC,iBA6BC;IA5BC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IACxB,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,YAAY,EAAE,KAAnB,CAAoB;IAEhC,IAAM,sBAAsB,GAAG,WAAW,CACxC,UAAO,cAAsB;;;;oBAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBAC3C,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,IAAI,CAAC,cAAc,EAAE,CAAC;wBACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;oBAClD,CAAC;oBAED,qBAAM,KAAK,CAAC,KAAK,CACf,WAAI,SAAS,gCAAsB,cAAc,kBAAe,EAChE,EAAE,EACF,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,EAAA;;oBAJD,SAIC,CAAC;;;;SACH,EACD,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CACzB,CAAC;IAEF,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as useAuth } from "./useAuth";
|
|
2
|
-
export { default as useAuthData } from "./useAuthData";
|
|
3
|
-
export { default as useRequestNewAccessToken } from "./useRequestNewAccessToken";
|
|
4
|
-
export { default as useSignUpWithEmailAndPassword } from "./useSignUpWithEmailAndPassword";
|
|
5
|
-
export { default as useSignInWithEmailAndPassword } from "./useSignInWithEmailAndPassword";
|
|
6
|
-
export { default as useSignOut } from "./useSignOut";
|
|
7
|
-
export { default as useChangePassword } from "./useChangePassword";
|
|
8
|
-
export { default as useVerifyExternalUser } from "./useVerifyExternalUser";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as useAuth } from "./useAuth";
|
|
2
|
-
export { default as useAuthData } from "./useAuthData";
|
|
3
|
-
export { default as useRequestNewAccessToken } from "./useRequestNewAccessToken";
|
|
4
|
-
export { default as useSignUpWithEmailAndPassword } from "./useSignUpWithEmailAndPassword";
|
|
5
|
-
export { default as useSignInWithEmailAndPassword } from "./useSignInWithEmailAndPassword";
|
|
6
|
-
export { default as useSignOut } from "./useSignOut";
|
|
7
|
-
export { default as useChangePassword } from "./useChangePassword";
|
|
8
|
-
export { default as useVerifyExternalUser } from "./useVerifyExternalUser";
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/legacy/hooks/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../../../../src/legacy/hooks/auth/useAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AuthUser } from "../../../interfaces/models/User";
|
|
2
|
-
export interface UseAuthDataProps {
|
|
3
|
-
signedToken?: string | null | undefined;
|
|
4
|
-
}
|
|
5
|
-
export interface UseAuthDataValues {
|
|
6
|
-
loadingInitial: boolean;
|
|
7
|
-
user: AuthUser | null;
|
|
8
|
-
setUser: (newUser: AuthUser) => void;
|
|
9
|
-
accessToken: string | null;
|
|
10
|
-
refreshToken: string | null;
|
|
11
|
-
setRefreshToken: React.Dispatch<React.SetStateAction<string | null>>;
|
|
12
|
-
signUpWithEmailAndPassword: (props: {
|
|
13
|
-
email: string;
|
|
14
|
-
password: string;
|
|
15
|
-
name?: string;
|
|
16
|
-
username?: string;
|
|
17
|
-
avatar?: string;
|
|
18
|
-
bio?: string;
|
|
19
|
-
location?: {
|
|
20
|
-
latitude: number;
|
|
21
|
-
longitude: number;
|
|
22
|
-
};
|
|
23
|
-
birthdate?: Date;
|
|
24
|
-
metadata?: Record<string, any>;
|
|
25
|
-
secureMetadata?: Record<string, any>;
|
|
26
|
-
}) => Promise<void>;
|
|
27
|
-
signInWithEmailAndPassword: (props: {
|
|
28
|
-
email: string;
|
|
29
|
-
password: string;
|
|
30
|
-
}) => Promise<void>;
|
|
31
|
-
signOut: () => Promise<void>;
|
|
32
|
-
changePassword: (props: {
|
|
33
|
-
publicKeyBase64: string | null;
|
|
34
|
-
email: string;
|
|
35
|
-
password: string;
|
|
36
|
-
newPassword: string;
|
|
37
|
-
}) => Promise<void>;
|
|
38
|
-
requestNewAccessToken: () => Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
declare function useAuthData({ signedToken }: UseAuthDataProps): UseAuthDataValues;
|
|
41
|
-
export default useAuthData;
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { useState, useEffect, useCallback } from "react";
|
|
49
|
-
import { handleError } from "../../../utils/handleError";
|
|
50
|
-
import { isReactNative } from "../../../utils/isReactNative";
|
|
51
|
-
import useSignUpWithEmailAndPassword from "./useSignUpWithEmailAndPassword";
|
|
52
|
-
import useSignInWithEmailAndPassword from "./useSignInWithEmailAndPassword";
|
|
53
|
-
import useSignOut from "./useSignOut";
|
|
54
|
-
import useRequestNewAccessToken from "./useRequestNewAccessToken";
|
|
55
|
-
import useVerifyExternalUser from "./useVerifyExternalUser";
|
|
56
|
-
import useChangePassword from "./useChangePassword";
|
|
57
|
-
function useAuthData(_a) {
|
|
58
|
-
var _this = this;
|
|
59
|
-
var signedToken = _a.signedToken;
|
|
60
|
-
var _b = useState(null), accessToken = _b[0], setAccessToken = _b[1];
|
|
61
|
-
var _c = useState(null), refreshToken = _c[0], setRefreshToken = _c[1];
|
|
62
|
-
var _d = useState(null), user = _d[0], setUser = _d[1];
|
|
63
|
-
var _e = useState(true), loadingInitial = _e[0], setLoadingInitial = _e[1];
|
|
64
|
-
var signUpWithEmailAndPassword = useSignUpWithEmailAndPassword();
|
|
65
|
-
var signInWithEmailAndPassword = useSignInWithEmailAndPassword();
|
|
66
|
-
var signOut = useSignOut();
|
|
67
|
-
var changePassword = useChangePassword();
|
|
68
|
-
var requestNewAccessToken = useRequestNewAccessToken();
|
|
69
|
-
var verifyExternalUser = useVerifyExternalUser();
|
|
70
|
-
var handleSignUpWithEmailAndPassword = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
71
|
-
var response, err_1;
|
|
72
|
-
return __generator(this, function (_a) {
|
|
73
|
-
switch (_a.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
_a.trys.push([0, 2, , 3]);
|
|
76
|
-
return [4 /*yield*/, signUpWithEmailAndPassword(__assign({}, props))];
|
|
77
|
-
case 1:
|
|
78
|
-
response = _a.sent();
|
|
79
|
-
if (response) {
|
|
80
|
-
setRefreshToken(response.refreshToken);
|
|
81
|
-
setAccessToken(response.accessToken);
|
|
82
|
-
setUser(response.user);
|
|
83
|
-
}
|
|
84
|
-
return [3 /*break*/, 3];
|
|
85
|
-
case 2:
|
|
86
|
-
err_1 = _a.sent();
|
|
87
|
-
handleError(err_1, "Failed to register user with email and password: ");
|
|
88
|
-
if (err_1 instanceof Error) {
|
|
89
|
-
throw err_1;
|
|
90
|
-
}
|
|
91
|
-
return [3 /*break*/, 3];
|
|
92
|
-
case 3: return [2 /*return*/];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}); }, [signUpWithEmailAndPassword]);
|
|
96
|
-
var handleSignInWithEmailAndPassword = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
97
|
-
var response, err_2;
|
|
98
|
-
return __generator(this, function (_a) {
|
|
99
|
-
switch (_a.label) {
|
|
100
|
-
case 0:
|
|
101
|
-
_a.trys.push([0, 2, , 3]);
|
|
102
|
-
return [4 /*yield*/, signInWithEmailAndPassword(__assign({}, props))];
|
|
103
|
-
case 1:
|
|
104
|
-
response = _a.sent();
|
|
105
|
-
if (response) {
|
|
106
|
-
setRefreshToken(response.refreshToken);
|
|
107
|
-
setAccessToken(response.accessToken);
|
|
108
|
-
setUser(response.user);
|
|
109
|
-
}
|
|
110
|
-
return [3 /*break*/, 3];
|
|
111
|
-
case 2:
|
|
112
|
-
err_2 = _a.sent();
|
|
113
|
-
handleError(err_2, "Failed to log user in: ");
|
|
114
|
-
if (err_2 instanceof Error) {
|
|
115
|
-
throw err_2;
|
|
116
|
-
}
|
|
117
|
-
return [3 /*break*/, 3];
|
|
118
|
-
case 3: return [2 /*return*/];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}); }, [signInWithEmailAndPassword]);
|
|
122
|
-
var handleSignOut = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
123
|
-
var tempUser, tempAccessToken, tempRefreshToken, err_3;
|
|
124
|
-
return __generator(this, function (_a) {
|
|
125
|
-
switch (_a.label) {
|
|
126
|
-
case 0:
|
|
127
|
-
if (isReactNative() && !refreshToken)
|
|
128
|
-
throw new Error("No refresh token");
|
|
129
|
-
tempUser = user;
|
|
130
|
-
tempAccessToken = accessToken;
|
|
131
|
-
tempRefreshToken = refreshToken;
|
|
132
|
-
_a.label = 1;
|
|
133
|
-
case 1:
|
|
134
|
-
_a.trys.push([1, 3, , 4]);
|
|
135
|
-
setUser(null);
|
|
136
|
-
setAccessToken(null);
|
|
137
|
-
setRefreshToken(null);
|
|
138
|
-
return [4 /*yield*/, signOut({ refreshToken: refreshToken })];
|
|
139
|
-
case 2:
|
|
140
|
-
_a.sent();
|
|
141
|
-
return [3 /*break*/, 4];
|
|
142
|
-
case 3:
|
|
143
|
-
err_3 = _a.sent();
|
|
144
|
-
handleError(err_3, "Failed to log user out: ");
|
|
145
|
-
setUser(tempUser);
|
|
146
|
-
setAccessToken(tempAccessToken);
|
|
147
|
-
setRefreshToken(tempRefreshToken);
|
|
148
|
-
if (err_3 instanceof Error) {
|
|
149
|
-
throw err_3;
|
|
150
|
-
}
|
|
151
|
-
return [3 /*break*/, 4];
|
|
152
|
-
case 4: return [2 /*return*/];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}); }, [signOut, user, accessToken, refreshToken]);
|
|
156
|
-
var handleChangePassword = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
157
|
-
var err_4;
|
|
158
|
-
return __generator(this, function (_a) {
|
|
159
|
-
switch (_a.label) {
|
|
160
|
-
case 0:
|
|
161
|
-
if (!user)
|
|
162
|
-
throw new Error("No user is authenticated");
|
|
163
|
-
_a.label = 1;
|
|
164
|
-
case 1:
|
|
165
|
-
_a.trys.push([1, 3, , 4]);
|
|
166
|
-
return [4 /*yield*/, changePassword(__assign({}, props))];
|
|
167
|
-
case 2:
|
|
168
|
-
_a.sent();
|
|
169
|
-
return [3 /*break*/, 4];
|
|
170
|
-
case 3:
|
|
171
|
-
err_4 = _a.sent();
|
|
172
|
-
handleError(err_4, "Failed to log user in: ");
|
|
173
|
-
return [3 /*break*/, 4];
|
|
174
|
-
case 4: return [2 /*return*/];
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}); }, [changePassword, user]);
|
|
178
|
-
var handleRequestNewAccessToken = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
179
|
-
var response, err_5;
|
|
180
|
-
return __generator(this, function (_a) {
|
|
181
|
-
switch (_a.label) {
|
|
182
|
-
case 0:
|
|
183
|
-
if (isReactNative() && !refreshToken)
|
|
184
|
-
return [2 /*return*/];
|
|
185
|
-
_a.label = 1;
|
|
186
|
-
case 1:
|
|
187
|
-
_a.trys.push([1, 3, , 4]);
|
|
188
|
-
return [4 /*yield*/, requestNewAccessToken({ refreshToken: refreshToken })];
|
|
189
|
-
case 2:
|
|
190
|
-
response = _a.sent();
|
|
191
|
-
if (response) {
|
|
192
|
-
setUser(response.user);
|
|
193
|
-
setAccessToken(response.accessToken);
|
|
194
|
-
return [2 /*return*/, response.accessToken];
|
|
195
|
-
}
|
|
196
|
-
return [3 /*break*/, 4];
|
|
197
|
-
case 3:
|
|
198
|
-
err_5 = _a.sent();
|
|
199
|
-
handleError(err_5, "Request new access token error: ");
|
|
200
|
-
return [3 /*break*/, 4];
|
|
201
|
-
case 4: return [2 /*return*/];
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}); }, [requestNewAccessToken, refreshToken]);
|
|
205
|
-
var handleVerifyExternalUser = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
206
|
-
var response, err_6;
|
|
207
|
-
return __generator(this, function (_a) {
|
|
208
|
-
switch (_a.label) {
|
|
209
|
-
case 0:
|
|
210
|
-
if (!signedToken)
|
|
211
|
-
return [2 /*return*/];
|
|
212
|
-
_a.label = 1;
|
|
213
|
-
case 1:
|
|
214
|
-
_a.trys.push([1, 3, , 4]);
|
|
215
|
-
return [4 /*yield*/, verifyExternalUser({ userJwt: signedToken })];
|
|
216
|
-
case 2:
|
|
217
|
-
response = _a.sent();
|
|
218
|
-
if (response) {
|
|
219
|
-
setRefreshToken(response.refreshToken);
|
|
220
|
-
setAccessToken(response.accessToken);
|
|
221
|
-
setUser(response.user);
|
|
222
|
-
}
|
|
223
|
-
return [3 /*break*/, 4];
|
|
224
|
-
case 3:
|
|
225
|
-
err_6 = _a.sent();
|
|
226
|
-
handleError(err_6, "Verify external user error: ");
|
|
227
|
-
return [3 /*break*/, 4];
|
|
228
|
-
case 4: return [2 /*return*/];
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}); }, [signedToken, verifyExternalUser]);
|
|
232
|
-
useEffect(function () {
|
|
233
|
-
handleVerifyExternalUser();
|
|
234
|
-
}, [handleVerifyExternalUser]);
|
|
235
|
-
useEffect(function () {
|
|
236
|
-
var fetchInitial = function () {
|
|
237
|
-
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
238
|
-
return __generator(this, function (_a) {
|
|
239
|
-
switch (_a.label) {
|
|
240
|
-
case 0: return [4 /*yield*/, handleRequestNewAccessToken()];
|
|
241
|
-
case 1:
|
|
242
|
-
_a.sent();
|
|
243
|
-
setLoadingInitial(false);
|
|
244
|
-
return [2 /*return*/];
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}); }, 0);
|
|
248
|
-
};
|
|
249
|
-
fetchInitial();
|
|
250
|
-
}, [handleRequestNewAccessToken]);
|
|
251
|
-
return {
|
|
252
|
-
loadingInitial: loadingInitial,
|
|
253
|
-
user: user,
|
|
254
|
-
setUser: function (newUser) { return setUser(newUser); },
|
|
255
|
-
accessToken: accessToken,
|
|
256
|
-
refreshToken: refreshToken,
|
|
257
|
-
setRefreshToken: setRefreshToken,
|
|
258
|
-
signUpWithEmailAndPassword: handleSignUpWithEmailAndPassword,
|
|
259
|
-
signInWithEmailAndPassword: handleSignInWithEmailAndPassword,
|
|
260
|
-
signOut: handleSignOut,
|
|
261
|
-
changePassword: handleChangePassword,
|
|
262
|
-
requestNewAccessToken: handleRequestNewAccessToken,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
export default useAuthData;
|
|
266
|
-
//# sourceMappingURL=useAuthData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthData.js","sourceRoot":"","sources":["../../../../../src/legacy/hooks/auth/useAuthData.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { useCallback } from "react";
|
|
38
|
-
import useProject from "../../../hooks/projects/useProject";
|
|
39
|
-
import axios from "../../../config/axios";
|
|
40
|
-
import { isReactNative } from "../../../utils/isReactNative";
|
|
41
|
-
function useChangePassword() {
|
|
42
|
-
var _this = this;
|
|
43
|
-
var projectId = useProject().projectId;
|
|
44
|
-
var changePassword = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
45
|
-
var password = _b.password, newPassword = _b.newPassword;
|
|
46
|
-
return __generator(this, function (_c) {
|
|
47
|
-
switch (_c.label) {
|
|
48
|
-
case 0:
|
|
49
|
-
if (!projectId) {
|
|
50
|
-
throw new Error("No projectId available.");
|
|
51
|
-
}
|
|
52
|
-
return [4 /*yield*/, axios.post("/".concat(projectId, "/auth/change-password"), {
|
|
53
|
-
password: password,
|
|
54
|
-
newPassword: newPassword,
|
|
55
|
-
}, { withCredentials: !isReactNative() })];
|
|
56
|
-
case 1:
|
|
57
|
-
_c.sent();
|
|
58
|
-
return [2 /*return*/];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}); }, [projectId]);
|
|
62
|
-
return changePassword;
|
|
63
|
-
}
|
|
64
|
-
export default useChangePassword;
|
|
65
|
-
//# sourceMappingURL=useChangePassword.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChangePassword.js","sourceRoot":"","sources":["../../../../../src/legacy/hooks/auth/useChangePassword.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,SAAS,iBAAiB;IAA1B,iBA4BC;IA3BS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAEnC,IAAM,cAAc,GAAG,WAAW,CAChC,gEAAO,EAMN;YALC,QAAQ,cAAA,EACR,WAAW,iBAAA;;;;oBAKX,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,qBAAM,KAAK,CAAC,IAAI,CACd,WAAI,SAAS,0BAAuB,EACpC;4BACE,QAAQ,UAAA;4BACR,WAAW,aAAA;yBACZ,EACD,EAAE,eAAe,EAAE,CAAC,aAAa,EAAE,EAAE,CACtC,EAAA;;oBAPD,SAOC,CAAC;;;;SACH,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { useCallback } from "react";
|
|
38
|
-
import useProject from "../../../hooks/projects/useProject";
|
|
39
|
-
import axios from "../../../config/axios";
|
|
40
|
-
import { isReactNative } from "../../../utils/isReactNative";
|
|
41
|
-
function useRequestNewAccessToken() {
|
|
42
|
-
var _this = this;
|
|
43
|
-
var projectId = useProject().projectId;
|
|
44
|
-
var requestNewAccessToken = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
45
|
-
var response, _c, accessToken, user;
|
|
46
|
-
var refreshToken = _b.refreshToken;
|
|
47
|
-
return __generator(this, function (_d) {
|
|
48
|
-
switch (_d.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
if (!projectId) {
|
|
51
|
-
throw new Error("No projectId available.");
|
|
52
|
-
}
|
|
53
|
-
return [4 /*yield*/, axios.post("/".concat(projectId, "/auth/request-new-access-token"), { refreshToken: refreshToken }, {
|
|
54
|
-
withCredentials: !isReactNative(), // Only use cookies for web
|
|
55
|
-
})];
|
|
56
|
-
case 1:
|
|
57
|
-
response = _d.sent();
|
|
58
|
-
_c = response.data, accessToken = _c.accessToken, user = _c.user;
|
|
59
|
-
return [2 /*return*/, { accessToken: accessToken, user: user }];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}); }, [projectId]);
|
|
63
|
-
return requestNewAccessToken;
|
|
64
|
-
}
|
|
65
|
-
export default useRequestNewAccessToken;
|
|
66
|
-
//# sourceMappingURL=useRequestNewAccessToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRequestNewAccessToken.js","sourceRoot":"","sources":["../../../../../src/legacy/hooks/auth/useRequestNewAccessToken.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,SAAS,wBAAwB;IAAjC,iBAwBC;IAvBS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAEnC,IAAM,qBAAqB,GAAG,WAAW,CACvC,gEAAO,EAAiD;;YAA/C,YAAY,kBAAA;;;;oBACnB,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAEgB,qBAAM,KAAK,CAAC,IAAI,CAC/B,WAAI,SAAS,mCAAgC,EAC7C,EAAE,YAAY,cAAA,EAAE,EAChB;4BACE,eAAe,EAAE,CAAC,aAAa,EAAE,EAAE,2BAA2B;yBAC/D,CACF,EAAA;;oBANK,QAAQ,GAAG,SAMhB;oBAEK,KAAwB,QAAQ,CAAC,IAAI,EAAnC,WAAW,iBAAA,EAAE,IAAI,UAAA,CAAmB;oBAC5C,sBAAO,EAAE,WAAW,aAAA,EAAE,IAAI,MAAA,EAAE,EAAC;;;SAC9B,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|