@replyke/core 5.1.5 → 5.1.6-beta.1
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/config/useAxiosPrivate.js +2 -5
- package/dist/cjs/config/useAxiosPrivate.js.map +1 -1
- package/dist/cjs/context/index.d.ts +1 -2
- package/dist/cjs/context/index.js +3 -5
- package/dist/cjs/context/index.js.map +1 -1
- package/dist/cjs/context/replyke-context.js +2 -2
- package/dist/cjs/context/replyke-context.js.map +1 -1
- package/dist/cjs/context/replyke-store-context.d.ts +13 -0
- package/dist/cjs/context/replyke-store-context.js +37 -0
- package/dist/cjs/context/replyke-store-context.js.map +1 -0
- package/dist/cjs/helpers/addNotificationsMessages.js +9 -11
- package/dist/cjs/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/cjs/hooks/app-notifications-redux/index.d.ts +4 -0
- package/dist/cjs/hooks/app-notifications-redux/index.js +14 -0
- package/dist/cjs/hooks/app-notifications-redux/index.js.map +1 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsActionsRedux.d.ts +13 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js +266 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js.map +1 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.d.ts +21 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.js +108 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.js.map +1 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.d.ts +7 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.js +38 -0
- package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.js.map +1 -0
- package/dist/cjs/hooks/auth-redux/index.d.ts +2 -0
- package/dist/cjs/hooks/auth-redux/index.js +11 -0
- package/dist/cjs/hooks/auth-redux/index.js.map +1 -0
- package/dist/cjs/hooks/auth-redux/useAuthRedux.d.ts +32 -0
- package/dist/cjs/hooks/auth-redux/useAuthRedux.js +180 -0
- package/dist/cjs/hooks/auth-redux/useAuthRedux.js.map +1 -0
- package/dist/cjs/hooks/auth-redux/useUserRedux.d.ts +6 -0
- package/dist/cjs/hooks/auth-redux/useUserRedux.js +20 -0
- package/dist/cjs/hooks/auth-redux/useUserRedux.js.map +1 -0
- package/dist/cjs/hooks/comments/useCommentSectionData.js +2 -2
- package/dist/cjs/hooks/comments/useCommentSectionData.js.map +1 -1
- package/dist/cjs/hooks/comments/useCommentVotes.js +2 -2
- package/dist/cjs/hooks/comments/useCommentVotes.js.map +1 -1
- package/dist/cjs/hooks/comments/useCreateComment.js +2 -2
- package/dist/cjs/hooks/comments/useCreateComment.js.map +1 -1
- package/dist/cjs/hooks/entities/useEntityData.js +2 -2
- package/dist/cjs/hooks/entities/useEntityData.js.map +1 -1
- package/dist/cjs/hooks/entities/useEntityVotes.js +2 -2
- package/dist/cjs/hooks/entities/useEntityVotes.js.map +1 -1
- package/dist/cjs/hooks/lists/useIsEntitySaved.js +2 -2
- package/dist/cjs/hooks/lists/useIsEntitySaved.js.map +1 -1
- package/dist/cjs/hooks/lists/useListsData.js +2 -2
- package/dist/cjs/hooks/lists/useListsData.js.map +1 -1
- package/dist/cjs/hooks/reports/useCreateReport.js +2 -2
- package/dist/cjs/hooks/reports/useCreateReport.js.map +1 -1
- package/dist/cjs/hooks/users/follows/useFetchFollow.js +2 -2
- package/dist/cjs/hooks/users/follows/useFetchFollow.js.map +1 -1
- package/dist/cjs/hooks/users/follows/useUnfollowUser.js +2 -2
- package/dist/cjs/hooks/users/follows/useUnfollowUser.js.map +1 -1
- package/dist/cjs/index.d.ts +6 -4
- package/dist/cjs/index.js +12 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/models/AppNotification.d.ts +1 -1
- package/dist/cjs/legacy/context/app-notifications-context.js.map +1 -0
- package/dist/cjs/{context → legacy/context}/auth-context.js +1 -1
- package/dist/cjs/legacy/context/auth-context.js.map +1 -0
- package/dist/cjs/legacy/hooks/app-notifications/index.js.map +1 -0
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotifications.js.map +1 -0
- package/dist/{esm → cjs/legacy}/hooks/app-notifications/useAppNotificationsData.d.ts +1 -1
- package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useAppNotificationsData.js +2 -2
- package/dist/cjs/legacy/hooks/app-notifications/useAppNotificationsData.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useCountUnreadNotifications.js +4 -4
- package/dist/cjs/legacy/hooks/app-notifications/useCountUnreadNotifications.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useFetchAppNotifications.d.ts +1 -1
- package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useFetchAppNotifications.js +4 -4
- package/dist/cjs/legacy/hooks/app-notifications/useFetchAppNotifications.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useMarkNotificationAsRead.js +4 -4
- package/dist/cjs/legacy/hooks/app-notifications/useMarkNotificationAsRead.js.map +1 -0
- package/dist/cjs/legacy/hooks/auth/index.js.map +1 -0
- package/dist/cjs/legacy/hooks/auth/useAuth.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useAuthData.d.ts +1 -1
- package/dist/cjs/{hooks → legacy/hooks}/auth/useAuthData.js +2 -2
- package/dist/cjs/legacy/hooks/auth/useAuthData.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useChangePassword.js +3 -3
- package/dist/cjs/legacy/hooks/auth/useChangePassword.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useRequestNewAccessToken.js +3 -3
- package/dist/cjs/legacy/hooks/auth/useRequestNewAccessToken.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useSignInWithEmailAndPassword.js +3 -3
- package/dist/cjs/legacy/hooks/auth/useSignInWithEmailAndPassword.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useSignOut.js +3 -3
- package/dist/cjs/legacy/hooks/auth/useSignOut.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useSignUpWithEmailAndPassword.js +3 -3
- package/dist/cjs/legacy/hooks/auth/useSignUpWithEmailAndPassword.js.map +1 -0
- package/dist/cjs/{hooks → legacy/hooks}/auth/useVerifyExternalUser.js +2 -2
- package/dist/cjs/legacy/hooks/auth/useVerifyExternalUser.js.map +1 -0
- package/dist/cjs/store/api/appNotificationsApi.d.ts +2021 -0
- package/dist/cjs/store/api/appNotificationsApi.js +213 -0
- package/dist/cjs/store/api/appNotificationsApi.js.map +1 -0
- package/dist/cjs/store/api/baseApi.d.ts +1 -0
- package/dist/cjs/store/api/baseApi.js +42 -0
- package/dist/cjs/store/api/baseApi.js.map +1 -0
- package/dist/cjs/store/api/index.d.ts +2 -0
- package/dist/cjs/store/api/index.js +27 -0
- package/dist/cjs/store/api/index.js.map +1 -0
- package/dist/cjs/store/index.d.ts +15 -0
- package/dist/cjs/store/index.js +72 -0
- package/dist/cjs/store/index.js.map +1 -0
- package/dist/cjs/store/middleware.d.ts +4 -0
- package/dist/cjs/store/middleware.js +42 -0
- package/dist/cjs/store/middleware.js.map +1 -0
- package/dist/cjs/store/rootReducer.d.ts +10 -0
- package/dist/cjs/store/rootReducer.js +20 -0
- package/dist/cjs/store/rootReducer.js.map +1 -0
- package/dist/cjs/store/slices/appNotificationsSlice.d.ts +58 -0
- package/dist/cjs/store/slices/appNotificationsSlice.js +135 -0
- package/dist/cjs/store/slices/appNotificationsSlice.js.map +1 -0
- package/dist/cjs/store/slices/authSlice.d.ts +24 -0
- package/dist/cjs/store/slices/authSlice.js +79 -0
- package/dist/cjs/store/slices/authSlice.js.map +1 -0
- package/dist/cjs/store/slices/authThunks.d.ts +40 -0
- package/dist/cjs/store/slices/authThunks.js +357 -0
- package/dist/cjs/store/slices/authThunks.js.map +1 -0
- package/dist/cjs/store/slices/index.d.ts +1 -0
- package/dist/cjs/store/slices/index.js +23 -0
- package/dist/cjs/store/slices/index.js.map +1 -0
- package/dist/cjs/store/types/index.d.ts +8 -0
- package/dist/cjs/store/types/index.js +3 -0
- package/dist/cjs/store/types/index.js.map +1 -0
- package/dist/esm/config/useAxiosPrivate.js +2 -2
- package/dist/esm/config/useAxiosPrivate.js.map +1 -1
- package/dist/esm/context/index.d.ts +1 -2
- package/dist/esm/context/index.js +1 -2
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/replyke-context.js +2 -2
- package/dist/esm/context/replyke-context.js.map +1 -1
- package/dist/esm/context/replyke-store-context.d.ts +13 -0
- package/dist/esm/context/replyke-store-context.js +33 -0
- package/dist/esm/context/replyke-store-context.js.map +1 -0
- package/dist/esm/helpers/addNotificationsMessages.js +9 -11
- package/dist/esm/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/esm/hooks/app-notifications-redux/index.d.ts +4 -0
- package/dist/esm/hooks/app-notifications-redux/index.js +5 -0
- package/dist/esm/hooks/app-notifications-redux/index.js.map +1 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsActionsRedux.d.ts +13 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js +260 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js.map +1 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.d.ts +21 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.js +103 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.js.map +1 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.d.ts +7 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.js +35 -0
- package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.js.map +1 -0
- package/dist/esm/hooks/auth-redux/index.d.ts +2 -0
- package/dist/esm/hooks/auth-redux/index.js +3 -0
- package/dist/esm/hooks/auth-redux/index.js.map +1 -0
- package/dist/esm/hooks/auth-redux/useAuthRedux.d.ts +32 -0
- package/dist/esm/hooks/auth-redux/useAuthRedux.js +174 -0
- package/dist/esm/hooks/auth-redux/useAuthRedux.js.map +1 -0
- package/dist/esm/hooks/auth-redux/useUserRedux.d.ts +6 -0
- package/dist/esm/hooks/auth-redux/useUserRedux.js +17 -0
- package/dist/esm/hooks/auth-redux/useUserRedux.js.map +1 -0
- package/dist/esm/hooks/comments/useCommentSectionData.js +2 -2
- package/dist/esm/hooks/comments/useCommentSectionData.js.map +1 -1
- package/dist/esm/hooks/comments/useCommentVotes.js +2 -2
- package/dist/esm/hooks/comments/useCommentVotes.js.map +1 -1
- package/dist/esm/hooks/comments/useCreateComment.js +2 -2
- package/dist/esm/hooks/comments/useCreateComment.js.map +1 -1
- package/dist/esm/hooks/entities/useEntityData.js +2 -2
- package/dist/esm/hooks/entities/useEntityData.js.map +1 -1
- package/dist/esm/hooks/entities/useEntityVotes.js +2 -2
- package/dist/esm/hooks/entities/useEntityVotes.js.map +1 -1
- package/dist/esm/hooks/lists/useIsEntitySaved.js +2 -2
- package/dist/esm/hooks/lists/useIsEntitySaved.js.map +1 -1
- package/dist/esm/hooks/lists/useListsData.js +2 -2
- package/dist/esm/hooks/lists/useListsData.js.map +1 -1
- package/dist/esm/hooks/reports/useCreateReport.js +2 -2
- package/dist/esm/hooks/reports/useCreateReport.js.map +1 -1
- package/dist/esm/hooks/users/follows/useFetchFollow.js +2 -2
- package/dist/esm/hooks/users/follows/useFetchFollow.js.map +1 -1
- package/dist/esm/hooks/users/follows/useUnfollowUser.js +2 -2
- package/dist/esm/hooks/users/follows/useUnfollowUser.js.map +1 -1
- package/dist/esm/index.d.ts +6 -4
- package/dist/esm/index.js +9 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/models/AppNotification.d.ts +1 -1
- package/dist/esm/legacy/context/app-notifications-context.js.map +1 -0
- package/dist/esm/{context → legacy/context}/auth-context.js +1 -1
- package/dist/esm/legacy/context/auth-context.js.map +1 -0
- package/dist/esm/legacy/hooks/app-notifications/index.js.map +1 -0
- package/dist/esm/legacy/hooks/app-notifications/useAppNotifications.js.map +1 -0
- package/dist/{cjs → esm/legacy}/hooks/app-notifications/useAppNotificationsData.d.ts +1 -1
- package/dist/esm/{hooks → legacy/hooks}/app-notifications/useAppNotificationsData.js +2 -2
- package/dist/esm/legacy/hooks/app-notifications/useAppNotificationsData.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/app-notifications/useCountUnreadNotifications.js +4 -4
- package/dist/esm/legacy/hooks/app-notifications/useCountUnreadNotifications.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/app-notifications/useFetchAppNotifications.d.ts +1 -1
- package/dist/esm/{hooks → legacy/hooks}/app-notifications/useFetchAppNotifications.js +4 -4
- package/dist/esm/legacy/hooks/app-notifications/useFetchAppNotifications.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/app-notifications/useMarkNotificationAsRead.js +4 -4
- package/dist/esm/legacy/hooks/app-notifications/useMarkNotificationAsRead.js.map +1 -0
- package/dist/esm/legacy/hooks/auth/index.js.map +1 -0
- package/dist/esm/legacy/hooks/auth/useAuth.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useAuthData.d.ts +1 -1
- package/dist/esm/{hooks → legacy/hooks}/auth/useAuthData.js +2 -2
- package/dist/esm/legacy/hooks/auth/useAuthData.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useChangePassword.js +3 -3
- package/dist/esm/legacy/hooks/auth/useChangePassword.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useRequestNewAccessToken.js +3 -3
- package/dist/esm/legacy/hooks/auth/useRequestNewAccessToken.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useSignInWithEmailAndPassword.js +3 -3
- package/dist/esm/legacy/hooks/auth/useSignInWithEmailAndPassword.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useSignOut.js +3 -3
- package/dist/esm/legacy/hooks/auth/useSignOut.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useSignUpWithEmailAndPassword.js +3 -3
- package/dist/esm/legacy/hooks/auth/useSignUpWithEmailAndPassword.js.map +1 -0
- package/dist/esm/{hooks → legacy/hooks}/auth/useVerifyExternalUser.js +2 -2
- package/dist/esm/legacy/hooks/auth/useVerifyExternalUser.js.map +1 -0
- package/dist/esm/store/api/appNotificationsApi.d.ts +2021 -0
- package/dist/esm/store/api/appNotificationsApi.js +210 -0
- package/dist/esm/store/api/appNotificationsApi.js.map +1 -0
- package/dist/esm/store/api/baseApi.d.ts +1 -0
- package/dist/esm/store/api/baseApi.js +39 -0
- package/dist/esm/store/api/baseApi.js.map +1 -0
- package/dist/esm/store/api/index.d.ts +2 -0
- package/dist/esm/store/api/index.js +9 -0
- package/dist/esm/store/api/index.js.map +1 -0
- package/dist/esm/store/index.d.ts +15 -0
- package/dist/esm/store/index.js +55 -0
- package/dist/esm/store/index.js.map +1 -0
- package/dist/esm/store/middleware.d.ts +4 -0
- package/dist/esm/store/middleware.js +37 -0
- package/dist/esm/store/middleware.js.map +1 -0
- package/dist/esm/store/rootReducer.d.ts +10 -0
- package/dist/esm/store/rootReducer.js +14 -0
- package/dist/esm/store/rootReducer.js.map +1 -0
- package/dist/esm/store/slices/appNotificationsSlice.d.ts +58 -0
- package/dist/esm/store/slices/appNotificationsSlice.js +124 -0
- package/dist/esm/store/slices/appNotificationsSlice.js.map +1 -0
- package/dist/esm/store/slices/authSlice.d.ts +24 -0
- package/dist/esm/store/slices/authSlice.js +69 -0
- package/dist/esm/store/slices/authSlice.js.map +1 -0
- package/dist/esm/store/slices/authThunks.d.ts +40 -0
- package/dist/esm/store/slices/authThunks.js +351 -0
- package/dist/esm/store/slices/authThunks.js.map +1 -0
- package/dist/esm/store/slices/index.d.ts +1 -0
- package/dist/esm/store/slices/index.js +7 -0
- package/dist/esm/store/slices/index.js.map +1 -0
- package/dist/esm/store/types/index.d.ts +8 -0
- package/dist/esm/store/types/index.js +2 -0
- package/dist/esm/store/types/index.js.map +1 -0
- package/package.json +4 -2
- package/dist/cjs/context/app-notifications-context.js.map +0 -1
- package/dist/cjs/context/auth-context.js.map +0 -1
- package/dist/cjs/hooks/app-notifications/index.js.map +0 -1
- package/dist/cjs/hooks/app-notifications/useAppNotifications.js.map +0 -1
- package/dist/cjs/hooks/app-notifications/useAppNotificationsData.js.map +0 -1
- package/dist/cjs/hooks/app-notifications/useCountUnreadNotifications.js.map +0 -1
- package/dist/cjs/hooks/app-notifications/useFetchAppNotifications.js.map +0 -1
- package/dist/cjs/hooks/app-notifications/useMarkNotificationAsRead.js.map +0 -1
- package/dist/cjs/hooks/auth/index.js.map +0 -1
- package/dist/cjs/hooks/auth/useAuth.js.map +0 -1
- package/dist/cjs/hooks/auth/useAuthData.js.map +0 -1
- package/dist/cjs/hooks/auth/useChangePassword.js.map +0 -1
- package/dist/cjs/hooks/auth/useRequestNewAccessToken.js.map +0 -1
- package/dist/cjs/hooks/auth/useSignInWithEmailAndPassword.js.map +0 -1
- package/dist/cjs/hooks/auth/useSignOut.js.map +0 -1
- package/dist/cjs/hooks/auth/useSignUpWithEmailAndPassword.js.map +0 -1
- package/dist/cjs/hooks/auth/useVerifyExternalUser.js.map +0 -1
- package/dist/esm/context/app-notifications-context.js.map +0 -1
- package/dist/esm/context/auth-context.js.map +0 -1
- package/dist/esm/hooks/app-notifications/index.js.map +0 -1
- package/dist/esm/hooks/app-notifications/useAppNotifications.js.map +0 -1
- package/dist/esm/hooks/app-notifications/useAppNotificationsData.js.map +0 -1
- package/dist/esm/hooks/app-notifications/useCountUnreadNotifications.js.map +0 -1
- package/dist/esm/hooks/app-notifications/useFetchAppNotifications.js.map +0 -1
- package/dist/esm/hooks/app-notifications/useMarkNotificationAsRead.js.map +0 -1
- package/dist/esm/hooks/auth/index.js.map +0 -1
- package/dist/esm/hooks/auth/useAuth.js.map +0 -1
- package/dist/esm/hooks/auth/useAuthData.js.map +0 -1
- package/dist/esm/hooks/auth/useChangePassword.js.map +0 -1
- package/dist/esm/hooks/auth/useRequestNewAccessToken.js.map +0 -1
- package/dist/esm/hooks/auth/useSignInWithEmailAndPassword.js.map +0 -1
- package/dist/esm/hooks/auth/useSignOut.js.map +0 -1
- package/dist/esm/hooks/auth/useSignUpWithEmailAndPassword.js.map +0 -1
- package/dist/esm/hooks/auth/useVerifyExternalUser.js.map +0 -1
- /package/dist/cjs/{context → legacy/context}/app-notifications-context.d.ts +0 -0
- /package/dist/cjs/{context → legacy/context}/app-notifications-context.js +0 -0
- /package/dist/cjs/{context → legacy/context}/auth-context.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/app-notifications/index.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/app-notifications/index.js +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useAppNotifications.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useAppNotifications.js +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useCountUnreadNotifications.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/app-notifications/useMarkNotificationAsRead.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/index.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/index.js +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useAuth.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useAuth.js +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useChangePassword.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useRequestNewAccessToken.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useSignInWithEmailAndPassword.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useSignOut.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useSignUpWithEmailAndPassword.d.ts +0 -0
- /package/dist/cjs/{hooks → legacy/hooks}/auth/useVerifyExternalUser.d.ts +0 -0
- /package/dist/esm/{context → legacy/context}/app-notifications-context.d.ts +0 -0
- /package/dist/esm/{context → legacy/context}/app-notifications-context.js +0 -0
- /package/dist/esm/{context → legacy/context}/auth-context.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/app-notifications/index.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/app-notifications/index.js +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/app-notifications/useAppNotifications.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/app-notifications/useAppNotifications.js +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/app-notifications/useCountUnreadNotifications.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/app-notifications/useMarkNotificationAsRead.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/index.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/index.js +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useAuth.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useAuth.js +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useChangePassword.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useRequestNewAccessToken.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useSignInWithEmailAndPassword.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useSignOut.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useSignUpWithEmailAndPassword.d.ts +0 -0
- /package/dist/esm/{hooks → legacy/hooks}/auth/useVerifyExternalUser.d.ts +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.selectCurrentProjectId = exports.selectNotificationTemplates = exports.selectAppNotificationsLimit = exports.selectAppNotificationsPage = exports.selectAppNotificationsHasMore = exports.selectAppNotificationsLoading = exports.selectUnreadCount = exports.selectAppNotifications = exports.handleError = exports.setUnreadCount = exports.markAllAsReadLocally = exports.markAsReadLocally = exports.addNotifications = exports.setLoading = exports.loadMore = exports.resetNotifications = exports.setNotificationTemplates = exports.setLimit = exports.setProjectContext = exports.appNotificationsSlice = void 0;
|
|
5
|
+
var toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
// Initial state
|
|
7
|
+
var initialState = {
|
|
8
|
+
notifications: [],
|
|
9
|
+
unreadCount: 0,
|
|
10
|
+
loading: false,
|
|
11
|
+
hasMore: true,
|
|
12
|
+
page: 1,
|
|
13
|
+
limit: 10,
|
|
14
|
+
notificationTemplates: undefined,
|
|
15
|
+
currentProjectId: undefined,
|
|
16
|
+
};
|
|
17
|
+
// Create the slice
|
|
18
|
+
exports.appNotificationsSlice = (0, toolkit_1.createSlice)({
|
|
19
|
+
name: 'appNotifications',
|
|
20
|
+
initialState: initialState,
|
|
21
|
+
reducers: {
|
|
22
|
+
// Set the current project context
|
|
23
|
+
setProjectContext: function (state, action) {
|
|
24
|
+
state.currentProjectId = action.payload;
|
|
25
|
+
},
|
|
26
|
+
// Set pagination limit
|
|
27
|
+
setLimit: function (state, action) {
|
|
28
|
+
state.limit = action.payload;
|
|
29
|
+
},
|
|
30
|
+
// Set notification templates
|
|
31
|
+
setNotificationTemplates: function (state, action) {
|
|
32
|
+
state.notificationTemplates = action.payload;
|
|
33
|
+
},
|
|
34
|
+
// Reset notifications (clear all and restart pagination)
|
|
35
|
+
resetNotifications: function (state) {
|
|
36
|
+
state.notifications = [];
|
|
37
|
+
state.page = 1;
|
|
38
|
+
state.hasMore = true;
|
|
39
|
+
state.loading = false;
|
|
40
|
+
},
|
|
41
|
+
// Load more notifications (increment page)
|
|
42
|
+
loadMore: function (state) {
|
|
43
|
+
if (state.hasMore && !state.loading) {
|
|
44
|
+
state.page += 1;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
// Set loading state
|
|
48
|
+
setLoading: function (state, action) {
|
|
49
|
+
state.loading = action.payload;
|
|
50
|
+
},
|
|
51
|
+
// Add new notifications (for pagination)
|
|
52
|
+
addNotifications: function (state, action) {
|
|
53
|
+
var _a;
|
|
54
|
+
var _b = action.payload, notifications = _b.notifications, _c = _b.isFirstPage, isFirstPage = _c === void 0 ? false : _c;
|
|
55
|
+
if (isFirstPage) {
|
|
56
|
+
state.notifications = notifications;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Prevent duplicates when adding new pages
|
|
60
|
+
var existingIds_1 = new Set(state.notifications.map(function (n) { return n.id; }));
|
|
61
|
+
var newNotifications = notifications.filter(function (n) { return !existingIds_1.has(n.id); });
|
|
62
|
+
(_a = state.notifications).push.apply(_a, newNotifications);
|
|
63
|
+
}
|
|
64
|
+
// Update hasMore based on returned count vs limit
|
|
65
|
+
if (notifications.length < state.limit) {
|
|
66
|
+
state.hasMore = false;
|
|
67
|
+
}
|
|
68
|
+
state.loading = false;
|
|
69
|
+
},
|
|
70
|
+
// Mark notification as read locally (optimistic update)
|
|
71
|
+
markAsReadLocally: function (state, action) {
|
|
72
|
+
var notificationId = action.payload;
|
|
73
|
+
var notification = state.notifications.find(function (n) { return n.id === notificationId; });
|
|
74
|
+
if (notification && !notification.isRead) {
|
|
75
|
+
notification.isRead = true;
|
|
76
|
+
// Decrease unread count
|
|
77
|
+
state.unreadCount = Math.max(state.unreadCount - 1, 0);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
// Mark all notifications as read locally (optimistic update)
|
|
81
|
+
markAllAsReadLocally: function (state) {
|
|
82
|
+
state.notifications.forEach(function (notification) {
|
|
83
|
+
notification.isRead = true;
|
|
84
|
+
});
|
|
85
|
+
// Set unread count to 0
|
|
86
|
+
state.unreadCount = 0;
|
|
87
|
+
},
|
|
88
|
+
// Set unread count
|
|
89
|
+
setUnreadCount: function (state, action) {
|
|
90
|
+
state.unreadCount = action.payload;
|
|
91
|
+
},
|
|
92
|
+
// Handle errors by stopping loading
|
|
93
|
+
handleError: function (state) {
|
|
94
|
+
state.loading = false;
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
// Export actions
|
|
99
|
+
exports.setProjectContext = (_a = exports.appNotificationsSlice.actions, _a.setProjectContext), exports.setLimit = _a.setLimit, exports.setNotificationTemplates = _a.setNotificationTemplates, exports.resetNotifications = _a.resetNotifications, exports.loadMore = _a.loadMore, exports.setLoading = _a.setLoading, exports.addNotifications = _a.addNotifications, exports.markAsReadLocally = _a.markAsReadLocally, exports.markAllAsReadLocally = _a.markAllAsReadLocally, exports.setUnreadCount = _a.setUnreadCount, exports.handleError = _a.handleError;
|
|
100
|
+
// Export reducer
|
|
101
|
+
exports.default = exports.appNotificationsSlice.reducer;
|
|
102
|
+
// Selectors
|
|
103
|
+
var selectAppNotifications = function (state) {
|
|
104
|
+
return state.appNotifications.notifications;
|
|
105
|
+
};
|
|
106
|
+
exports.selectAppNotifications = selectAppNotifications;
|
|
107
|
+
var selectUnreadCount = function (state) {
|
|
108
|
+
return state.appNotifications.unreadCount;
|
|
109
|
+
};
|
|
110
|
+
exports.selectUnreadCount = selectUnreadCount;
|
|
111
|
+
var selectAppNotificationsLoading = function (state) {
|
|
112
|
+
return state.appNotifications.loading;
|
|
113
|
+
};
|
|
114
|
+
exports.selectAppNotificationsLoading = selectAppNotificationsLoading;
|
|
115
|
+
var selectAppNotificationsHasMore = function (state) {
|
|
116
|
+
return state.appNotifications.hasMore;
|
|
117
|
+
};
|
|
118
|
+
exports.selectAppNotificationsHasMore = selectAppNotificationsHasMore;
|
|
119
|
+
var selectAppNotificationsPage = function (state) {
|
|
120
|
+
return state.appNotifications.page;
|
|
121
|
+
};
|
|
122
|
+
exports.selectAppNotificationsPage = selectAppNotificationsPage;
|
|
123
|
+
var selectAppNotificationsLimit = function (state) {
|
|
124
|
+
return state.appNotifications.limit;
|
|
125
|
+
};
|
|
126
|
+
exports.selectAppNotificationsLimit = selectAppNotificationsLimit;
|
|
127
|
+
var selectNotificationTemplates = function (state) {
|
|
128
|
+
return state.appNotifications.notificationTemplates;
|
|
129
|
+
};
|
|
130
|
+
exports.selectNotificationTemplates = selectNotificationTemplates;
|
|
131
|
+
var selectCurrentProjectId = function (state) {
|
|
132
|
+
return state.appNotifications.currentProjectId;
|
|
133
|
+
};
|
|
134
|
+
exports.selectCurrentProjectId = selectCurrentProjectId;
|
|
135
|
+
//# sourceMappingURL=appNotificationsSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appNotificationsSlice.js","sourceRoot":"","sources":["../../../../src/store/slices/appNotificationsSlice.ts"],"names":[],"mappings":";;;;AAAA,4CAA8D;AAwB9D,gBAAgB;AAChB,IAAM,YAAY,GAA0B;IAC1C,aAAa,EAAE,EAAE;IACjB,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,EAAE;IACT,qBAAqB,EAAE,SAAS;IAChC,gBAAgB,EAAE,SAAS;CAC5B,CAAC;AAEF,mBAAmB;AACN,QAAA,qBAAqB,GAAG,IAAA,qBAAW,EAAC;IAC/C,IAAI,EAAE,kBAAkB;IACxB,YAAY,cAAA;IACZ,QAAQ,EAAE;QACR,kCAAkC;QAClC,iBAAiB,EAAE,UAAC,KAAK,EAAE,MAA6B;YACtD,KAAK,CAAC,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC;QAC1C,CAAC;QAED,uBAAuB;QACvB,QAAQ,EAAE,UAAC,KAAK,EAAE,MAA6B;YAC7C,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;QAED,6BAA6B;QAC7B,wBAAwB,EAAE,UAAC,KAAK,EAAE,MAAqD;YACrF,KAAK,CAAC,qBAAqB,GAAG,MAAM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ExC,IAAM,sBAAsB,GAAG,UAAC,KAAkD;IACvF,OAAA,KAAK,CAAC,gBAAgB,CAAC,gBAAgB;AAAvC,CAAuC,CAAC;AAD7B,QAAA,sBAAsB,0BACO"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RootState } from '../index';
|
|
2
|
+
import type { AuthUser } from '../../interfaces/models/User';
|
|
3
|
+
export interface AuthState {
|
|
4
|
+
accessToken: string | null;
|
|
5
|
+
refreshToken: string | null;
|
|
6
|
+
user: AuthUser | null;
|
|
7
|
+
loadingInitial: boolean;
|
|
8
|
+
isAuthenticating: boolean;
|
|
9
|
+
initialized: boolean;
|
|
10
|
+
signedToken: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const setTokens: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
|
+
accessToken: string | null;
|
|
14
|
+
refreshToken?: string | null;
|
|
15
|
+
}, "auth/setTokens">, clearTokens: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"auth/clearTokens">, setUser: import("@reduxjs/toolkit").ActionCreatorWithPayload<AuthUser | null, "auth/setUser">, setLoadingInitial: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "auth/setLoadingInitial">, setAuthenticating: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "auth/setAuthenticating">, setInitialized: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "auth/setInitialized">, setSignedToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "auth/setSignedToken">, resetAuth: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"auth/resetAuth">, setRefreshToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "auth/setRefreshToken">;
|
|
16
|
+
export declare const selectAccessToken: (state: RootState) => string | null;
|
|
17
|
+
export declare const selectRefreshToken: (state: RootState) => string | null;
|
|
18
|
+
export declare const selectUser: (state: RootState) => AuthUser | null;
|
|
19
|
+
export declare const selectLoadingInitial: (state: RootState) => boolean;
|
|
20
|
+
export declare const selectIsAuthenticating: (state: RootState) => boolean;
|
|
21
|
+
export declare const selectInitialized: (state: RootState) => boolean;
|
|
22
|
+
export declare const selectSignedToken: (state: RootState) => string | null;
|
|
23
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<AuthState>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.selectSignedToken = exports.selectInitialized = exports.selectIsAuthenticating = exports.selectLoadingInitial = exports.selectUser = exports.selectRefreshToken = exports.selectAccessToken = exports.setRefreshToken = exports.resetAuth = exports.setSignedToken = exports.setInitialized = exports.setAuthenticating = exports.setLoadingInitial = exports.setUser = exports.clearTokens = exports.setTokens = void 0;
|
|
5
|
+
var toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
var initialState = {
|
|
7
|
+
accessToken: null,
|
|
8
|
+
refreshToken: null,
|
|
9
|
+
user: null,
|
|
10
|
+
loadingInitial: true,
|
|
11
|
+
isAuthenticating: false,
|
|
12
|
+
initialized: false,
|
|
13
|
+
signedToken: null,
|
|
14
|
+
};
|
|
15
|
+
var authSlice = (0, toolkit_1.createSlice)({
|
|
16
|
+
name: 'auth',
|
|
17
|
+
initialState: initialState,
|
|
18
|
+
reducers: {
|
|
19
|
+
// Token management
|
|
20
|
+
setTokens: function (state, action) {
|
|
21
|
+
state.accessToken = action.payload.accessToken;
|
|
22
|
+
if (action.payload.refreshToken !== undefined) {
|
|
23
|
+
state.refreshToken = action.payload.refreshToken;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
clearTokens: function (state) {
|
|
27
|
+
state.accessToken = null;
|
|
28
|
+
state.refreshToken = null;
|
|
29
|
+
},
|
|
30
|
+
// User management
|
|
31
|
+
setUser: function (state, action) {
|
|
32
|
+
state.user = action.payload;
|
|
33
|
+
},
|
|
34
|
+
// Loading states
|
|
35
|
+
setLoadingInitial: function (state, action) {
|
|
36
|
+
state.loadingInitial = action.payload;
|
|
37
|
+
},
|
|
38
|
+
setAuthenticating: function (state, action) {
|
|
39
|
+
state.isAuthenticating = action.payload;
|
|
40
|
+
},
|
|
41
|
+
// Initialization
|
|
42
|
+
setInitialized: function (state, action) {
|
|
43
|
+
state.initialized = action.payload;
|
|
44
|
+
},
|
|
45
|
+
setSignedToken: function (state, action) {
|
|
46
|
+
state.signedToken = action.payload;
|
|
47
|
+
},
|
|
48
|
+
// Complete auth reset (for signout)
|
|
49
|
+
resetAuth: function (state) {
|
|
50
|
+
state.accessToken = null;
|
|
51
|
+
state.refreshToken = null;
|
|
52
|
+
state.user = null;
|
|
53
|
+
state.isAuthenticating = false;
|
|
54
|
+
// Keep loadingInitial and initialized as they are
|
|
55
|
+
},
|
|
56
|
+
// Individual token setter for compatibility
|
|
57
|
+
setRefreshToken: function (state, action) {
|
|
58
|
+
state.refreshToken = action.payload;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
exports.setTokens = (_a = authSlice.actions, _a.setTokens), exports.clearTokens = _a.clearTokens, exports.setUser = _a.setUser, exports.setLoadingInitial = _a.setLoadingInitial, exports.setAuthenticating = _a.setAuthenticating, exports.setInitialized = _a.setInitialized, exports.setSignedToken = _a.setSignedToken, exports.resetAuth = _a.resetAuth, exports.setRefreshToken = _a.setRefreshToken;
|
|
63
|
+
// Selectors
|
|
64
|
+
var selectAccessToken = function (state) { return state.auth.accessToken; };
|
|
65
|
+
exports.selectAccessToken = selectAccessToken;
|
|
66
|
+
var selectRefreshToken = function (state) { return state.auth.refreshToken; };
|
|
67
|
+
exports.selectRefreshToken = selectRefreshToken;
|
|
68
|
+
var selectUser = function (state) { return state.auth.user; };
|
|
69
|
+
exports.selectUser = selectUser;
|
|
70
|
+
var selectLoadingInitial = function (state) { return state.auth.loadingInitial; };
|
|
71
|
+
exports.selectLoadingInitial = selectLoadingInitial;
|
|
72
|
+
var selectIsAuthenticating = function (state) { return state.auth.isAuthenticating; };
|
|
73
|
+
exports.selectIsAuthenticating = selectIsAuthenticating;
|
|
74
|
+
var selectInitialized = function (state) { return state.auth.initialized; };
|
|
75
|
+
exports.selectInitialized = selectInitialized;
|
|
76
|
+
var selectSignedToken = function (state) { return state.auth.signedToken; };
|
|
77
|
+
exports.selectSignedToken = selectSignedToken;
|
|
78
|
+
exports.default = authSlice.reducer;
|
|
79
|
+
//# sourceMappingURL=authSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authSlice.js","sourceRoot":"","sources":["../../../../src/store/slices/authSlice.ts"],"names":[],"mappings":";;;;AAAA,4CAAgF;AAqBhF,IAAM,YAAY,GAAc;IAC9B,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,KAAK;IACvB,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,IAAM,SAAS,GAAG,IAAA,qBAAW,EAAC;IAC5B,IAAI,EAAE,MAAM;IACZ,YAAY,cAAA;IACZ,QAAQ,EAAE;QACR,mBAAmB;QACnB,SAAS,EAAE,UAAC,KAAK,EAAE,MAAmF;YACpG,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;YAC/C,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC9C,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;YACnD,CAAC;QACH,CAAC;QACD,WAAW,EAAE,UAAC,KAAK;YACjB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,kBAAkB;QAClB,OAAO,EAAE,UAAC,KAAK,EAAE,MAAsC;YACrD,KAAK,CAAC,IAAI,GAA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iBAAiB,qBAAgD;AACvE,IAAM,kBAAkB,GAAG,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,YAAY,EAAvB,CAAuB,CAAC;AAAnE,QAAA,kBAAkB,sBAAiD;AACzE,IAAM,UAAU,GAAG,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,EAAf,CAAe,CAAC;AAAnD,QAAA,UAAU,cAAyC;AACzD,IAAM,oBAAoB,GAAG,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,cAAc,EAAzB,CAAyB,CAAC;AAAvE,QAAA,oBAAoB,wBAAmD;AAC7E,IAAM,sBAAsB,GAAG,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAA3B,CAA2B,CAAC;AAA3E,QAAA,sBAAsB,0BAAqD;AACjF,IAAM,iBAAiB,GAAG,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,WAAW,EAAtB,CAAsB,CAAC;AAAjE,QAAA,iBAAiB,qBAAgD;AACvE,IAAM,iBAAiB,GAAG,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,WAAW,EAAtB,CAAsB,CAAC;AAAjE,QAAA,iBAAiB,qBAAgD;AAE9E,kBAAe,SAAS,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const signUpWithEmailAndPasswordThunk: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
2
|
+
projectId: string;
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
username?: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
bio?: string;
|
|
9
|
+
location?: {
|
|
10
|
+
latitude: number;
|
|
11
|
+
longitude: number;
|
|
12
|
+
};
|
|
13
|
+
birthdate?: Date;
|
|
14
|
+
metadata?: Record<string, any>;
|
|
15
|
+
secureMetadata?: Record<string, any>;
|
|
16
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
17
|
+
export declare const signInWithEmailAndPasswordThunk: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
18
|
+
projectId: string;
|
|
19
|
+
email: string;
|
|
20
|
+
password: string;
|
|
21
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
22
|
+
export declare const signOutThunk: import("@reduxjs/toolkit").AsyncThunk<undefined, {
|
|
23
|
+
projectId: string;
|
|
24
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
25
|
+
export declare const requestNewAccessTokenThunk: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
26
|
+
projectId: string;
|
|
27
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
28
|
+
export declare const verifyExternalUserThunk: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
29
|
+
projectId: string;
|
|
30
|
+
userJwt: string;
|
|
31
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
32
|
+
export declare const changePasswordThunk: import("@reduxjs/toolkit").AsyncThunk<undefined, {
|
|
33
|
+
projectId: string;
|
|
34
|
+
password: string;
|
|
35
|
+
newPassword: string;
|
|
36
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
37
|
+
export declare const initializeAuthThunk: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
38
|
+
projectId: string;
|
|
39
|
+
signedToken?: string | null;
|
|
40
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.initializeAuthThunk = exports.changePasswordThunk = exports.verifyExternalUserThunk = exports.requestNewAccessTokenThunk = exports.signOutThunk = exports.signInWithEmailAndPasswordThunk = exports.signUpWithEmailAndPasswordThunk = void 0;
|
|
43
|
+
var toolkit_1 = require("@reduxjs/toolkit");
|
|
44
|
+
var axios_1 = __importDefault(require("../../config/axios"));
|
|
45
|
+
var isReactNative_1 = require("../../utils/isReactNative");
|
|
46
|
+
var handleError_1 = require("../../utils/handleError");
|
|
47
|
+
var authSlice_1 = require("./authSlice");
|
|
48
|
+
// Auth service functions - calling existing API patterns directly
|
|
49
|
+
var authService = {
|
|
50
|
+
signUpWithEmailAndPassword: function (projectId, data) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
+
var response;
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
return __generator(this, function (_d) {
|
|
55
|
+
switch (_d.label) {
|
|
56
|
+
case 0: return [4 /*yield*/, axios_1.default.post("/".concat(projectId, "/auth/sign-up"), {
|
|
57
|
+
email: data.email,
|
|
58
|
+
password: data.password,
|
|
59
|
+
name: (_a = data.name) === null || _a === void 0 ? void 0 : _a.trim(),
|
|
60
|
+
username: (_b = data.username) === null || _b === void 0 ? void 0 : _b.trim(),
|
|
61
|
+
avatar: data.avatar,
|
|
62
|
+
bio: (_c = data.bio) === null || _c === void 0 ? void 0 : _c.trim(),
|
|
63
|
+
location: data.location,
|
|
64
|
+
birthdate: data.birthdate,
|
|
65
|
+
metadata: data.metadata,
|
|
66
|
+
secureMetadata: data.secureMetadata,
|
|
67
|
+
}, { withCredentials: !(0, isReactNative_1.isReactNative)() })];
|
|
68
|
+
case 1:
|
|
69
|
+
response = _d.sent();
|
|
70
|
+
return [2 /*return*/, response.data];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
signInWithEmailAndPassword: function (projectId, data) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
+
var response;
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0: return [4 /*yield*/, axios_1.default.post("/".concat(projectId, "/auth/sign-in"), data, { withCredentials: !(0, isReactNative_1.isReactNative)() })];
|
|
81
|
+
case 1:
|
|
82
|
+
response = _a.sent();
|
|
83
|
+
return [2 /*return*/, response.data];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
signOut: function (projectId, refreshToken) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, axios_1.default.post("/".concat(projectId, "/auth/sign-out"), { refreshToken: refreshToken }, { withCredentials: !(0, isReactNative_1.isReactNative)() })];
|
|
93
|
+
case 1:
|
|
94
|
+
_a.sent();
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
requestNewAccessToken: function (projectId, refreshToken) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
+
var response;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0: return [4 /*yield*/, axios_1.default.post("/".concat(projectId, "/auth/request-new-access-token"), { refreshToken: refreshToken }, { withCredentials: !(0, isReactNative_1.isReactNative)() })];
|
|
106
|
+
case 1:
|
|
107
|
+
response = _a.sent();
|
|
108
|
+
return [2 /*return*/, response.data];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
verifyExternalUser: function (projectId, userJwt) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
+
var response;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0: return [4 /*yield*/, axios_1.default.post("/".concat(projectId, "/auth/verify-external-user"), { userJwt: userJwt })];
|
|
119
|
+
case 1:
|
|
120
|
+
response = _a.sent();
|
|
121
|
+
return [2 /*return*/, response.data];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
changePassword: function (projectId, data) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
switch (_a.label) {
|
|
130
|
+
case 0: return [4 /*yield*/, axios_1.default.post("/".concat(projectId, "/auth/change-password"), data, { withCredentials: !(0, isReactNative_1.isReactNative)() })];
|
|
131
|
+
case 1:
|
|
132
|
+
_a.sent();
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// Async Thunks
|
|
140
|
+
exports.signUpWithEmailAndPasswordThunk = (0, toolkit_1.createAsyncThunk)('auth/signUpWithEmailAndPassword', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
141
|
+
var result, error_1;
|
|
142
|
+
var dispatch = _b.dispatch, rejectWithValue = _b.rejectWithValue;
|
|
143
|
+
return __generator(this, function (_c) {
|
|
144
|
+
switch (_c.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
_c.trys.push([0, 2, 3, 4]);
|
|
147
|
+
dispatch((0, authSlice_1.setAuthenticating)(true));
|
|
148
|
+
return [4 /*yield*/, authService.signUpWithEmailAndPassword(data.projectId, data)];
|
|
149
|
+
case 1:
|
|
150
|
+
result = _c.sent();
|
|
151
|
+
// Update auth state
|
|
152
|
+
dispatch((0, authSlice_1.setTokens)({
|
|
153
|
+
accessToken: result.accessToken,
|
|
154
|
+
refreshToken: result.refreshToken
|
|
155
|
+
}));
|
|
156
|
+
dispatch((0, authSlice_1.setUser)(result.user));
|
|
157
|
+
return [2 /*return*/, result];
|
|
158
|
+
case 2:
|
|
159
|
+
error_1 = _c.sent();
|
|
160
|
+
(0, handleError_1.handleError)(error_1, "Failed to register user with email and password:");
|
|
161
|
+
return [2 /*return*/, rejectWithValue(error_1 instanceof Error ? error_1.message : 'Unknown error')];
|
|
162
|
+
case 3:
|
|
163
|
+
dispatch((0, authSlice_1.setAuthenticating)(false));
|
|
164
|
+
return [7 /*endfinally*/];
|
|
165
|
+
case 4: return [2 /*return*/];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}); });
|
|
169
|
+
exports.signInWithEmailAndPasswordThunk = (0, toolkit_1.createAsyncThunk)('auth/signInWithEmailAndPassword', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
170
|
+
var result, error_2;
|
|
171
|
+
var dispatch = _b.dispatch, rejectWithValue = _b.rejectWithValue;
|
|
172
|
+
return __generator(this, function (_c) {
|
|
173
|
+
switch (_c.label) {
|
|
174
|
+
case 0:
|
|
175
|
+
_c.trys.push([0, 2, 3, 4]);
|
|
176
|
+
dispatch((0, authSlice_1.setAuthenticating)(true));
|
|
177
|
+
return [4 /*yield*/, authService.signInWithEmailAndPassword(data.projectId, data)];
|
|
178
|
+
case 1:
|
|
179
|
+
result = _c.sent();
|
|
180
|
+
// Update auth state
|
|
181
|
+
dispatch((0, authSlice_1.setTokens)({
|
|
182
|
+
accessToken: result.accessToken,
|
|
183
|
+
refreshToken: result.refreshToken
|
|
184
|
+
}));
|
|
185
|
+
dispatch((0, authSlice_1.setUser)(result.user));
|
|
186
|
+
return [2 /*return*/, result];
|
|
187
|
+
case 2:
|
|
188
|
+
error_2 = _c.sent();
|
|
189
|
+
(0, handleError_1.handleError)(error_2, "Failed to log user in:");
|
|
190
|
+
return [2 /*return*/, rejectWithValue(error_2 instanceof Error ? error_2.message : 'Unknown error')];
|
|
191
|
+
case 3:
|
|
192
|
+
dispatch((0, authSlice_1.setAuthenticating)(false));
|
|
193
|
+
return [7 /*endfinally*/];
|
|
194
|
+
case 4: return [2 /*return*/];
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}); });
|
|
198
|
+
exports.signOutThunk = (0, toolkit_1.createAsyncThunk)('auth/signOut', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
199
|
+
var state, refreshToken, error_3;
|
|
200
|
+
var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
201
|
+
return __generator(this, function (_c) {
|
|
202
|
+
switch (_c.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
state = getState();
|
|
205
|
+
refreshToken = state.auth.refreshToken;
|
|
206
|
+
// If React Native and no refresh token, throw error (matches original logic)
|
|
207
|
+
if ((0, isReactNative_1.isReactNative)() && !refreshToken) {
|
|
208
|
+
throw new Error("No refresh token");
|
|
209
|
+
}
|
|
210
|
+
_c.label = 1;
|
|
211
|
+
case 1:
|
|
212
|
+
_c.trys.push([1, 3, 4, 5]);
|
|
213
|
+
dispatch((0, authSlice_1.setAuthenticating)(true));
|
|
214
|
+
return [4 /*yield*/, authService.signOut(data.projectId, refreshToken)];
|
|
215
|
+
case 2:
|
|
216
|
+
_c.sent();
|
|
217
|
+
// Clear auth state
|
|
218
|
+
dispatch((0, authSlice_1.resetAuth)());
|
|
219
|
+
return [2 /*return*/];
|
|
220
|
+
case 3:
|
|
221
|
+
error_3 = _c.sent();
|
|
222
|
+
(0, handleError_1.handleError)(error_3, "Failed to log user out:");
|
|
223
|
+
return [2 /*return*/, rejectWithValue(error_3 instanceof Error ? error_3.message : 'Unknown error')];
|
|
224
|
+
case 4:
|
|
225
|
+
dispatch((0, authSlice_1.setAuthenticating)(false));
|
|
226
|
+
return [7 /*endfinally*/];
|
|
227
|
+
case 5: return [2 /*return*/];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}); });
|
|
231
|
+
exports.requestNewAccessTokenThunk = (0, toolkit_1.createAsyncThunk)('auth/requestNewAccessToken', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
232
|
+
var state, refreshToken, result, error_4;
|
|
233
|
+
var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
234
|
+
return __generator(this, function (_c) {
|
|
235
|
+
switch (_c.label) {
|
|
236
|
+
case 0:
|
|
237
|
+
state = getState();
|
|
238
|
+
refreshToken = state.auth.refreshToken;
|
|
239
|
+
// If React Native and no refresh token, return early
|
|
240
|
+
if ((0, isReactNative_1.isReactNative)() && !refreshToken) {
|
|
241
|
+
return [2 /*return*/];
|
|
242
|
+
}
|
|
243
|
+
_c.label = 1;
|
|
244
|
+
case 1:
|
|
245
|
+
_c.trys.push([1, 3, , 4]);
|
|
246
|
+
return [4 /*yield*/, authService.requestNewAccessToken(data.projectId, refreshToken)];
|
|
247
|
+
case 2:
|
|
248
|
+
result = _c.sent();
|
|
249
|
+
// Update auth state
|
|
250
|
+
dispatch((0, authSlice_1.setTokens)({ accessToken: result.accessToken }));
|
|
251
|
+
dispatch((0, authSlice_1.setUser)(result.user));
|
|
252
|
+
return [2 /*return*/, result.accessToken];
|
|
253
|
+
case 3:
|
|
254
|
+
error_4 = _c.sent();
|
|
255
|
+
(0, handleError_1.handleError)(error_4, "Request new access token error:");
|
|
256
|
+
return [2 /*return*/, rejectWithValue(error_4 instanceof Error ? error_4.message : 'Unknown error')];
|
|
257
|
+
case 4: return [2 /*return*/];
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}); });
|
|
261
|
+
exports.verifyExternalUserThunk = (0, toolkit_1.createAsyncThunk)('auth/verifyExternalUser', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
262
|
+
var result, error_5;
|
|
263
|
+
var dispatch = _b.dispatch, rejectWithValue = _b.rejectWithValue;
|
|
264
|
+
return __generator(this, function (_c) {
|
|
265
|
+
switch (_c.label) {
|
|
266
|
+
case 0:
|
|
267
|
+
_c.trys.push([0, 2, , 3]);
|
|
268
|
+
return [4 /*yield*/, authService.verifyExternalUser(data.projectId, data.userJwt)];
|
|
269
|
+
case 1:
|
|
270
|
+
result = _c.sent();
|
|
271
|
+
// Update auth state
|
|
272
|
+
dispatch((0, authSlice_1.setTokens)({
|
|
273
|
+
accessToken: result.accessToken,
|
|
274
|
+
refreshToken: result.refreshToken
|
|
275
|
+
}));
|
|
276
|
+
dispatch((0, authSlice_1.setUser)(result.user));
|
|
277
|
+
return [2 /*return*/, result];
|
|
278
|
+
case 2:
|
|
279
|
+
error_5 = _c.sent();
|
|
280
|
+
(0, handleError_1.handleError)(error_5, "Verify external user error:");
|
|
281
|
+
return [2 /*return*/, rejectWithValue(error_5 instanceof Error ? error_5.message : 'Unknown error')];
|
|
282
|
+
case 3: return [2 /*return*/];
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}); });
|
|
286
|
+
exports.changePasswordThunk = (0, toolkit_1.createAsyncThunk)('auth/changePassword', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
287
|
+
var state, error_6;
|
|
288
|
+
var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
289
|
+
return __generator(this, function (_c) {
|
|
290
|
+
switch (_c.label) {
|
|
291
|
+
case 0:
|
|
292
|
+
state = getState();
|
|
293
|
+
if (!state.auth.user) {
|
|
294
|
+
throw new Error("No user is authenticated");
|
|
295
|
+
}
|
|
296
|
+
_c.label = 1;
|
|
297
|
+
case 1:
|
|
298
|
+
_c.trys.push([1, 3, 4, 5]);
|
|
299
|
+
dispatch((0, authSlice_1.setAuthenticating)(true));
|
|
300
|
+
return [4 /*yield*/, authService.changePassword(data.projectId, data)];
|
|
301
|
+
case 2:
|
|
302
|
+
_c.sent();
|
|
303
|
+
return [2 /*return*/];
|
|
304
|
+
case 3:
|
|
305
|
+
error_6 = _c.sent();
|
|
306
|
+
(0, handleError_1.handleError)(error_6, "Failed to change password:");
|
|
307
|
+
return [2 /*return*/, rejectWithValue(error_6 instanceof Error ? error_6.message : 'Unknown error')];
|
|
308
|
+
case 4:
|
|
309
|
+
dispatch((0, authSlice_1.setAuthenticating)(false));
|
|
310
|
+
return [7 /*endfinally*/];
|
|
311
|
+
case 5: return [2 /*return*/];
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}); });
|
|
315
|
+
// Initialize auth - handles the startup flow from useAuthData
|
|
316
|
+
exports.initializeAuthThunk = (0, toolkit_1.createAsyncThunk)('auth/initialize', function (data_1, _a) { return __awaiter(void 0, [data_1, _a], void 0, function (data, _b) {
|
|
317
|
+
var error_7;
|
|
318
|
+
var dispatch = _b.dispatch;
|
|
319
|
+
return __generator(this, function (_c) {
|
|
320
|
+
switch (_c.label) {
|
|
321
|
+
case 0:
|
|
322
|
+
_c.trys.push([0, 3, , 4]);
|
|
323
|
+
dispatch((0, authSlice_1.setLoadingInitial)(true));
|
|
324
|
+
if (!data.signedToken) return [3 /*break*/, 2];
|
|
325
|
+
return [4 /*yield*/, dispatch((0, exports.verifyExternalUserThunk)({
|
|
326
|
+
projectId: data.projectId,
|
|
327
|
+
userJwt: data.signedToken
|
|
328
|
+
}))];
|
|
329
|
+
case 1:
|
|
330
|
+
_c.sent();
|
|
331
|
+
_c.label = 2;
|
|
332
|
+
case 2:
|
|
333
|
+
// Step 2: Try to refresh access token (matches original setTimeout logic)
|
|
334
|
+
setTimeout(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
335
|
+
return __generator(this, function (_a) {
|
|
336
|
+
switch (_a.label) {
|
|
337
|
+
case 0: return [4 /*yield*/, dispatch((0, exports.requestNewAccessTokenThunk)({ projectId: data.projectId }))];
|
|
338
|
+
case 1:
|
|
339
|
+
_a.sent();
|
|
340
|
+
dispatch((0, authSlice_1.setLoadingInitial)(false));
|
|
341
|
+
dispatch((0, authSlice_1.setInitialized)(true));
|
|
342
|
+
return [2 /*return*/];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}); }, 0);
|
|
346
|
+
return [3 /*break*/, 4];
|
|
347
|
+
case 3:
|
|
348
|
+
error_7 = _c.sent();
|
|
349
|
+
dispatch((0, authSlice_1.setLoadingInitial)(false));
|
|
350
|
+
dispatch((0, authSlice_1.setInitialized)(true));
|
|
351
|
+
(0, handleError_1.handleError)(error_7, "Auth initialization failed:");
|
|
352
|
+
return [3 /*break*/, 4];
|
|
353
|
+
case 4: return [2 /*return*/];
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}); });
|
|
357
|
+
//# sourceMappingURL=authThunks.js.map
|