@refinedev/core 4.47.2 → 4.48.0
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/CHANGELOG.md +2944 -2919
- package/dist/components/authenticated/index.d.ts.map +1 -1
- package/dist/components/autoSaveIndicator/index.d.ts.map +1 -1
- package/dist/components/canAccess/index.d.ts.map +1 -1
- package/dist/components/containers/refine/index.d.ts.map +1 -1
- package/dist/components/layoutWrapper/index.d.ts.map +1 -1
- package/dist/components/pages/auth/components/forgotPassword/index.d.ts.map +1 -1
- package/dist/components/pages/auth/components/login/index.d.ts.map +1 -1
- package/dist/components/pages/auth/components/register/index.d.ts.map +1 -1
- package/dist/components/pages/auth/components/updatePassword/index.d.ts.map +1 -1
- package/dist/components/pages/auth/index.d.ts.map +1 -1
- package/dist/components/pages/config-error/index.d.ts.map +1 -1
- package/dist/components/pages/config-success/index.d.ts.map +1 -1
- package/dist/components/pages/login/index.d.ts.map +1 -1
- package/dist/components/pages/ready/index.d.ts.map +1 -1
- package/dist/components/undoableQueue/index.d.ts.map +1 -1
- package/dist/contexts/accessControl/IAccessControlContext.d.ts.map +1 -1
- package/dist/contexts/accessControl/index.d.ts.map +1 -1
- package/dist/contexts/auditLog/IAuditLogContext.d.ts.map +1 -1
- package/dist/contexts/auditLog/index.d.ts.map +1 -1
- package/dist/contexts/auth/IAuthContext.d.ts +1 -1
- package/dist/contexts/auth/IAuthContext.d.ts.map +1 -1
- package/dist/contexts/auth/index.d.ts.map +1 -1
- package/dist/contexts/data/IDataContext.d.ts.map +1 -1
- package/dist/contexts/data/index.d.ts.map +1 -1
- package/dist/contexts/legacy-router/IRouterContext.d.ts.map +1 -1
- package/dist/contexts/legacy-router/index.d.ts.map +1 -1
- package/dist/contexts/live/ILiveContext.d.ts.map +1 -1
- package/dist/contexts/live/index.d.ts.map +1 -1
- package/dist/contexts/notification/INotificationContext.d.ts.map +1 -1
- package/dist/contexts/notification/index.d.ts.map +1 -1
- package/dist/contexts/refine/IRefineContext.d.ts.map +1 -1
- package/dist/contexts/refine/index.d.ts.map +1 -1
- package/dist/contexts/resource/IResourceContext.d.ts.map +1 -1
- package/dist/contexts/resource/index.d.ts.map +1 -1
- package/dist/contexts/router/index.d.ts.map +1 -1
- package/dist/contexts/translation/ITranslationContext.d.ts.map +1 -1
- package/dist/contexts/translation/index.d.ts.map +1 -1
- package/dist/contexts/undoableQueue/IUndoableQueueContext.d.ts.map +1 -1
- package/dist/contexts/undoableQueue/actionTypes.d.ts.map +1 -1
- package/dist/contexts/undoableQueue/index.d.ts.map +1 -1
- package/dist/contexts/undoableQueue/undoableQueueContext.d.ts.map +1 -1
- package/dist/contexts/unsavedWarn/IUnsavedWarnContext.d.ts.map +1 -1
- package/dist/definitions/helpers/check-router-prop-misuse/index.d.ts.map +1 -1
- package/dist/definitions/helpers/downloadInBrowser/index.d.ts.map +1 -1
- package/dist/definitions/helpers/flatten-object-keys/index.d.ts.map +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.ts.map +1 -1
- package/dist/definitions/helpers/handlePaginationParams/index.d.ts.map +1 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.ts.map +1 -1
- package/dist/definitions/helpers/hasPermission/index.d.ts.map +1 -1
- package/dist/definitions/helpers/importCSVMapper/index.d.ts.map +1 -1
- package/dist/definitions/helpers/index.d.ts.map +1 -1
- package/dist/definitions/helpers/keys/index.d.ts +0 -11
- package/dist/definitions/helpers/keys/index.d.ts.map +1 -1
- package/dist/definitions/helpers/legacy-resource-transform/index.d.ts.map +1 -1
- package/dist/definitions/helpers/menu/create-resource-key.d.ts.map +1 -1
- package/dist/definitions/helpers/menu/create-tree.d.ts.map +1 -1
- package/dist/definitions/helpers/pick-resource/index.d.ts.map +1 -1
- package/dist/definitions/helpers/pickDataProvider/index.d.ts.map +1 -1
- package/dist/definitions/helpers/queryKeys/index.d.ts.map +1 -1
- package/dist/definitions/helpers/redirectPage/index.d.ts.map +1 -1
- package/dist/definitions/helpers/routeGenerator/index.d.ts.map +1 -1
- package/dist/definitions/helpers/router/compose-route.d.ts.map +1 -1
- package/dist/definitions/helpers/router/get-action-routes-from-resource.d.ts.map +1 -1
- package/dist/definitions/helpers/router/get-default-action-path.d.ts.map +1 -1
- package/dist/definitions/helpers/router/get-parent-prefix-for-resource.d.ts.map +1 -1
- package/dist/definitions/helpers/router/get-parent-resource.d.ts.map +1 -1
- package/dist/definitions/helpers/router/match-resource-from-route.d.ts.map +1 -1
- package/dist/definitions/helpers/router/pick-matched-route.d.ts.map +1 -1
- package/dist/definitions/helpers/router/prepare-route-params.d.ts.map +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.ts.map +1 -1
- package/dist/definitions/helpers/sanitize-resource/index.d.ts.map +1 -1
- package/dist/definitions/helpers/sequentialPromises/index.d.ts.map +1 -1
- package/dist/definitions/helpers/treeView/createTreeView/index.d.ts.map +1 -1
- package/dist/definitions/helpers/useActiveAuthProvider/index.d.ts +2 -2
- package/dist/definitions/helpers/useUserFriendlyName/index.d.ts.map +1 -1
- package/dist/definitions/helpers/userFriendlyResourceName/index.d.ts.map +1 -1
- package/dist/definitions/table/index.d.ts.map +1 -1
- package/dist/esm/index.js +18 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/accessControl/useCan/index.d.ts.map +1 -1
- package/dist/hooks/accessControl/useCanWithoutCache.d.ts.map +1 -1
- package/dist/hooks/auditLog/useLog/index.d.ts.map +1 -1
- package/dist/hooks/auditLog/useLogList/index.d.ts.map +1 -1
- package/dist/hooks/auth/useForgotPassword/index.d.ts.map +1 -1
- package/dist/hooks/auth/useGetIdentity/index.d.ts.map +1 -1
- package/dist/hooks/auth/useIsAuthenticated/index.d.ts.map +1 -1
- package/dist/hooks/auth/useLogin/index.d.ts.map +1 -1
- package/dist/hooks/auth/useLogout/index.d.ts.map +1 -1
- package/dist/hooks/auth/useOnError/index.d.ts.map +1 -1
- package/dist/hooks/auth/usePermissions/index.d.ts +9 -6
- package/dist/hooks/auth/usePermissions/index.d.ts.map +1 -1
- package/dist/hooks/auth/useRegister/index.d.ts.map +1 -1
- package/dist/hooks/auth/useUpdatePassword/index.d.ts.map +1 -1
- package/dist/hooks/breadcrumb/index.d.ts.map +1 -1
- package/dist/hooks/data/useApiUrl.d.ts.map +1 -1
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useCustom.d.ts.map +1 -1
- package/dist/hooks/data/useCustomMutation.d.ts.map +1 -1
- package/dist/hooks/data/useDataProvider.d.ts.map +1 -1
- package/dist/hooks/data/useDelete.d.ts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
- package/dist/hooks/data/useList.d.ts.map +1 -1
- package/dist/hooks/data/useMany.d.ts.map +1 -1
- package/dist/hooks/data/useOne.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/export/csvDownload.interface.d.ts.map +1 -1
- package/dist/hooks/export/index.d.ts +1 -1
- package/dist/hooks/export/index.d.ts.map +1 -1
- package/dist/hooks/form/useForm.d.ts.map +1 -1
- package/dist/hooks/import/index.d.ts.map +1 -1
- package/dist/hooks/invalidate/index.d.ts.map +1 -1
- package/dist/hooks/live/useLiveMode/index.d.ts.map +1 -1
- package/dist/hooks/live/useResourceSubscription/index.d.ts.map +1 -1
- package/dist/hooks/live/useSubscription/index.d.ts.map +1 -1
- package/dist/hooks/menu/useMenu.d.ts.map +1 -1
- package/dist/hooks/modal/useModal/index.d.ts.map +1 -1
- package/dist/hooks/navigation/index.d.ts.map +1 -1
- package/dist/hooks/notification/useCancelNotification/index.d.ts.map +1 -1
- package/dist/hooks/notification/useHandleNotification/index.d.ts.map +1 -1
- package/dist/hooks/redirection/index.d.ts.map +1 -1
- package/dist/hooks/refine/useMutationMode.d.ts.map +1 -1
- package/dist/hooks/refine/useSyncWithLocation.d.ts.map +1 -1
- package/dist/hooks/refine/useWarnAboutChange/index.d.ts.map +1 -1
- package/dist/hooks/resource/useResource/index.d.ts.map +1 -1
- package/dist/hooks/router/use-get-to-path/index.d.ts.map +1 -1
- package/dist/hooks/router/use-go/index.d.ts.map +1 -1
- package/dist/hooks/router/use-link/index.d.ts.map +1 -1
- package/dist/hooks/router/use-parse/index.d.ts.map +1 -1
- package/dist/hooks/router/use-to-path/index.d.ts.map +1 -1
- package/dist/hooks/show/useShow.d.ts.map +1 -1
- package/dist/hooks/translate/useSetLocale.d.ts.map +1 -1
- package/dist/hooks/translate/useTranslate.d.ts.map +1 -1
- package/dist/hooks/useLoadingOvertime/index.d.ts.map +1 -1
- package/dist/hooks/useSelect/index.d.ts +18 -4
- package/dist/hooks/useSelect/index.d.ts.map +1 -1
- package/dist/hooks/useTable/index.d.ts.map +1 -1
- package/dist/iife/index.js +18 -18
- package/dist/iife/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/interfaces/actions.d.ts.map +1 -1
- package/dist/interfaces/auditLog/logData.d.ts.map +1 -1
- package/dist/interfaces/auth.d.ts.map +1 -1
- package/dist/interfaces/autoSave.d.ts.map +1 -1
- package/dist/interfaces/bindings/access-control.d.ts.map +1 -1
- package/dist/interfaces/bindings/auth.d.ts +1 -1
- package/dist/interfaces/bindings/auth.d.ts.map +1 -1
- package/dist/interfaces/bindings/data.d.ts.map +1 -1
- package/dist/interfaces/bindings/i18n.d.ts.map +1 -1
- package/dist/interfaces/bindings/index.d.ts.map +1 -1
- package/dist/interfaces/bindings/live.d.ts.map +1 -1
- package/dist/interfaces/bindings/notifications.d.ts.map +1 -1
- package/dist/interfaces/bindings/resource.d.ts.map +1 -1
- package/dist/interfaces/bindings/router.d.ts.map +1 -1
- package/dist/interfaces/customComponents.d.ts.map +1 -1
- package/dist/interfaces/errors/HttpError.d.ts.map +1 -1
- package/dist/interfaces/form-url-params.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/live/LiveEvent.d.ts.map +1 -1
- package/dist/interfaces/live/LiveModeProps.d.ts.map +1 -1
- package/dist/interfaces/mapDataFn.d.ts.map +1 -1
- package/dist/interfaces/metaData/graphqlQueryOptions.d.ts.map +1 -1
- package/dist/interfaces/metaData/metaDataQuery.d.ts.map +1 -1
- package/dist/interfaces/metaData/metaQuery.d.ts.map +1 -1
- package/dist/interfaces/metaData/nestedField.d.ts.map +1 -1
- package/dist/interfaces/metaData/queryBuilderOptions.d.ts.map +1 -1
- package/dist/interfaces/metaData/variableOptions.d.ts.map +1 -1
- package/dist/interfaces/mutationMode.d.ts.map +1 -1
- package/dist/interfaces/notification.d.ts.map +1 -1
- package/dist/interfaces/optimistic-update-map.d.ts.map +1 -1
- package/dist/interfaces/prettify.d.ts.map +1 -1
- package/dist/interfaces/queryKey.d.ts.map +1 -1
- package/dist/interfaces/resourceErrorRouterParams.d.ts.map +1 -1
- package/dist/interfaces/resourceRouterParams.d.ts.map +1 -1
- package/dist/interfaces/successErrorNotification.d.ts +4 -4
- package/dist/interfaces/successErrorNotification.d.ts.map +1 -1
- package/dist/interfaces/telemetry.d.ts.map +1 -1
- package/dist/interfaces/textTransformers.d.ts.map +1 -1
- package/package.json +2 -2
- package/refine.config.js +99 -102
- package/src/components/authenticated/index.tsx +157 -159
- package/src/components/autoSaveIndicator/index.tsx +23 -27
- package/src/components/canAccess/index.tsx +93 -93
- package/src/components/containers/refine/index.tsx +312 -353
- package/src/components/gh-banner/index.tsx +235 -242
- package/src/components/gh-banner/styles.ts +5 -5
- package/src/components/layoutWrapper/defaultLayout/index.tsx +1 -1
- package/src/components/layoutWrapper/index.tsx +87 -87
- package/src/components/pages/auth/components/forgotPassword/index.tsx +87 -96
- package/src/components/pages/auth/components/login/index.tsx +166 -181
- package/src/components/pages/auth/components/register/index.tsx +141 -159
- package/src/components/pages/auth/components/updatePassword/index.tsx +81 -87
- package/src/components/pages/auth/index.tsx +28 -28
- package/src/components/pages/config-error/index.tsx +422 -422
- package/src/components/pages/config-success/index.tsx +249 -260
- package/src/components/pages/error/index.tsx +48 -48
- package/src/components/pages/login/index.tsx +59 -73
- package/src/components/pages/ready/index.tsx +21 -29
- package/src/components/pages/welcome/index.tsx +7 -7
- package/src/components/routeChangeHandler/index.tsx +7 -7
- package/src/components/telemetry/index.tsx +31 -31
- package/src/components/undoableQueue/index.tsx +49 -49
- package/src/contexts/accessControl/IAccessControlContext.ts +34 -34
- package/src/contexts/accessControl/index.tsx +35 -35
- package/src/contexts/auditLog/IAuditLogContext.ts +22 -22
- package/src/contexts/auditLog/index.tsx +8 -8
- package/src/contexts/auth/IAuthContext.ts +10 -10
- package/src/contexts/auth/index.tsx +169 -169
- package/src/contexts/data/IDataContext.ts +203 -203
- package/src/contexts/data/index.tsx +18 -18
- package/src/contexts/legacy-router/IRouterContext.ts +23 -27
- package/src/contexts/legacy-router/index.tsx +30 -30
- package/src/contexts/live/ILiveContext.ts +49 -49
- package/src/contexts/live/index.tsx +5 -7
- package/src/contexts/notification/INotificationContext.ts +8 -8
- package/src/contexts/notification/index.tsx +8 -8
- package/src/contexts/refine/IRefineContext.ts +119 -119
- package/src/contexts/refine/index.tsx +80 -80
- package/src/contexts/resource/IResourceContext.ts +35 -35
- package/src/contexts/resource/index.tsx +16 -16
- package/src/contexts/router/index.tsx +7 -7
- package/src/contexts/router-picker/index.tsx +2 -2
- package/src/contexts/translation/ITranslationContext.ts +7 -7
- package/src/contexts/translation/index.tsx +12 -12
- package/src/contexts/undoableQueue/IUndoableQueueContext.ts +2 -2
- package/src/contexts/undoableQueue/actionTypes.ts +3 -3
- package/src/contexts/undoableQueue/index.ts +2 -2
- package/src/contexts/undoableQueue/undoableQueueContext.tsx +59 -60
- package/src/contexts/unsavedWarn/IUnsavedWarnContext.ts +2 -2
- package/src/contexts/unsavedWarn/index.tsx +7 -7
- package/src/definitions/helpers/check-router-prop-misuse/index.ts +20 -20
- package/src/definitions/helpers/downloadInBrowser/index.ts +19 -20
- package/src/definitions/helpers/flatten-object-keys/index.ts +26 -29
- package/src/definitions/helpers/generateDocumentTitle/index.ts +39 -45
- package/src/definitions/helpers/handleMultiple/index.ts +4 -4
- package/src/definitions/helpers/handlePaginationParams/index.ts +17 -18
- package/src/definitions/helpers/handleRefineOptions/index.ts +88 -90
- package/src/definitions/helpers/handleUseParams/index.tsx +7 -7
- package/src/definitions/helpers/hasPermission/index.ts +6 -6
- package/src/definitions/helpers/humanizeString/index.ts +9 -9
- package/src/definitions/helpers/importCSVMapper/index.ts +8 -8
- package/src/definitions/helpers/index.ts +2 -2
- package/src/definitions/helpers/keys/index.ts +205 -258
- package/src/definitions/helpers/legacy-resource-transform/index.ts +14 -14
- package/src/definitions/helpers/menu/create-resource-key.ts +20 -23
- package/src/definitions/helpers/menu/create-tree.ts +61 -63
- package/src/definitions/helpers/pick-resource/index.ts +25 -25
- package/src/definitions/helpers/pickDataProvider/index.ts +15 -15
- package/src/definitions/helpers/pickNotDeprecated/index.ts +2 -2
- package/src/definitions/helpers/property-path-to-array/index.ts +3 -3
- package/src/definitions/helpers/queryKeys/index.ts +92 -92
- package/src/definitions/helpers/redirectPage/index.ts +19 -19
- package/src/definitions/helpers/routeGenerator/index.ts +15 -15
- package/src/definitions/helpers/router/__tests__/check-by-segments.ts +12 -15
- package/src/definitions/helpers/router/__tests__/compose-route.ts +48 -48
- package/src/definitions/helpers/router/__tests__/get-action-routes-from-resource.ts +152 -152
- package/src/definitions/helpers/router/__tests__/get-default-action-path.ts +39 -41
- package/src/definitions/helpers/router/__tests__/get-parent-prefix-for-resource.ts +69 -73
- package/src/definitions/helpers/router/__tests__/get-parent-resource.ts +40 -40
- package/src/definitions/helpers/router/__tests__/is-segment-counts-same.ts +11 -14
- package/src/definitions/helpers/router/__tests__/match-resource-from-route.ts +55 -55
- package/src/definitions/helpers/router/__tests__/pick-matched-route.ts +74 -74
- package/src/definitions/helpers/router/__tests__/pick-route-params.ts +12 -12
- package/src/definitions/helpers/router/__tests__/prepare-route-params.ts +18 -18
- package/src/definitions/helpers/router/__tests__/remove-leading-trailing-slashes.ts +9 -9
- package/src/definitions/helpers/router/__tests__/split-to-segments.ts +9 -9
- package/src/definitions/helpers/router/check-by-segments.ts +12 -12
- package/src/definitions/helpers/router/compose-route.ts +25 -27
- package/src/definitions/helpers/router/get-action-routes-from-resource.ts +41 -47
- package/src/definitions/helpers/router/get-default-action-path.ts +19 -19
- package/src/definitions/helpers/router/get-parent-prefix-for-resource.ts +22 -24
- package/src/definitions/helpers/router/get-parent-resource.ts +18 -18
- package/src/definitions/helpers/router/is-parameter.ts +1 -1
- package/src/definitions/helpers/router/is-segment-counts-same.ts +3 -3
- package/src/definitions/helpers/router/match-resource-from-route.ts +19 -19
- package/src/definitions/helpers/router/pick-matched-route.ts +44 -44
- package/src/definitions/helpers/router/pick-route-params.ts +7 -7
- package/src/definitions/helpers/router/prepare-route-params.ts +13 -10
- package/src/definitions/helpers/router/remove-leading-trailing-slashes.ts +1 -1
- package/src/definitions/helpers/router/split-to-segments.ts +2 -2
- package/src/definitions/helpers/safe-translate/index.ts +12 -12
- package/src/definitions/helpers/sanitize-resource/index.ts +26 -27
- package/src/definitions/helpers/sequentialPromises/index.ts +21 -21
- package/src/definitions/helpers/treeView/createTreeView/index.ts +33 -33
- package/src/definitions/helpers/useActiveAuthProvider/index.ts +18 -18
- package/src/definitions/helpers/useInfinitePagination/index.ts +16 -16
- package/src/definitions/helpers/useMediaQuery/index.ts +11 -11
- package/src/definitions/helpers/useUserFriendlyName/index.ts +11 -14
- package/src/definitions/helpers/userFriendlyResourceName/index.ts +7 -7
- package/src/definitions/helpers/userFriendlySeconds/index.ts +1 -1
- package/src/definitions/table/index.ts +127 -130
- package/src/definitions/upload/file2Base64/index.ts +15 -15
- package/src/hooks/accessControl/useCan/index.ts +52 -54
- package/src/hooks/accessControl/useCanWithoutCache.ts +25 -26
- package/src/hooks/auditLog/useLog/index.ts +114 -114
- package/src/hooks/auditLog/useLogList/index.ts +44 -44
- package/src/hooks/auth/useForgotPassword/index.ts +158 -163
- package/src/hooks/auth/useGetIdentity/index.ts +55 -57
- package/src/hooks/auth/useInvalidateAuthStore/index.ts +12 -12
- package/src/hooks/auth/useIsAuthenticated/index.ts +44 -48
- package/src/hooks/auth/useIsExistAuthentication/index.ts +3 -3
- package/src/hooks/auth/useLogin/index.ts +181 -194
- package/src/hooks/auth/useLogout/index.ts +175 -177
- package/src/hooks/auth/useOnError/index.ts +76 -76
- package/src/hooks/auth/usePermissions/index.ts +94 -61
- package/src/hooks/auth/useRegister/index.ts +166 -178
- package/src/hooks/auth/useUpdatePassword/index.ts +183 -194
- package/src/hooks/breadcrumb/index.ts +99 -106
- package/src/hooks/data/useApiUrl.ts +7 -8
- package/src/hooks/data/useCreate.ts +241 -241
- package/src/hooks/data/useCreateMany.ts +219 -226
- package/src/hooks/data/useCustom.ts +181 -182
- package/src/hooks/data/useCustomMutation.ts +174 -174
- package/src/hooks/data/useDataProvider.tsx +27 -29
- package/src/hooks/data/useDelete.ts +447 -454
- package/src/hooks/data/useDeleteMany.ts +475 -484
- package/src/hooks/data/useInfiniteList.ts +280 -280
- package/src/hooks/data/useList.ts +280 -283
- package/src/hooks/data/useMany.ts +215 -216
- package/src/hooks/data/useOne.ts +210 -211
- package/src/hooks/data/useUpdate.ts +529 -556
- package/src/hooks/data/useUpdateMany.ts +556 -584
- package/src/hooks/deepMemo/index.tsx +5 -5
- package/src/hooks/export/csvDownload.interface.ts +13 -13
- package/src/hooks/export/index.ts +223 -217
- package/src/hooks/form/useForm.ts +543 -560
- package/src/hooks/import/index.tsx +254 -260
- package/src/hooks/invalidate/index.tsx +75 -75
- package/src/hooks/legacy-router/useRouterContext.ts +11 -11
- package/src/hooks/live/useLiveMode/index.ts +4 -4
- package/src/hooks/live/usePublish/index.ts +2 -2
- package/src/hooks/live/useResourceSubscription/index.ts +103 -103
- package/src/hooks/live/useSubscription/index.ts +77 -77
- package/src/hooks/memoized/index.tsx +6 -6
- package/src/hooks/menu/useMenu.tsx +113 -120
- package/src/hooks/modal/useModal/index.tsx +16 -16
- package/src/hooks/navigation/index.ts +362 -392
- package/src/hooks/notification/useCancelNotification/index.tsx +5 -5
- package/src/hooks/notification/useHandleNotification/index.ts +17 -17
- package/src/hooks/notification/useNotification/index.ts +2 -2
- package/src/hooks/redirection/index.ts +45 -46
- package/src/hooks/refine/useMutationMode.ts +4 -4
- package/src/hooks/refine/useRefineContext.ts +36 -36
- package/src/hooks/refine/useSyncWithLocation.ts +3 -3
- package/src/hooks/refine/useTitle.tsx +2 -2
- package/src/hooks/refine/useWarnAboutChange/index.ts +12 -12
- package/src/hooks/resource/useResource/index.ts +141 -146
- package/src/hooks/resource/useResourceWithRoute/index.ts +12 -12
- package/src/hooks/router/use-back/index.tsx +7 -7
- package/src/hooks/router/use-get-to-path/index.ts +35 -35
- package/src/hooks/router/use-go/index.tsx +66 -66
- package/src/hooks/router/use-link/index.tsx +8 -9
- package/src/hooks/router/use-parse/index.tsx +13 -13
- package/src/hooks/router/use-parsed/index.tsx +4 -4
- package/src/hooks/router/use-router-misuse-warning/index.ts +10 -10
- package/src/hooks/router/use-to-path/index.ts +10 -10
- package/src/hooks/show/useShow.ts +135 -135
- package/src/hooks/translate/useGetLocale.ts +2 -2
- package/src/hooks/translate/useSetLocale.ts +2 -2
- package/src/hooks/translate/useTranslate.ts +24 -25
- package/src/hooks/useKeys/index.tsx +7 -7
- package/src/hooks/useLoadingOvertime/index.ts +74 -76
- package/src/hooks/useMeta/index.ts +20 -20
- package/src/hooks/useSelect/index.ts +317 -277
- package/src/hooks/useTable/index.ts +483 -507
- package/src/hooks/useTelemetryData/index.ts +48 -48
- package/src/index.tsx +125 -125
- package/src/interfaces/actions.ts +2 -2
- package/src/interfaces/auditLog/logData.ts +9 -9
- package/src/interfaces/auth.tsx +176 -176
- package/src/interfaces/autoSave.ts +37 -37
- package/src/interfaces/bindings/access-control.ts +21 -21
- package/src/interfaces/bindings/auth.ts +27 -25
- package/src/interfaces/bindings/data.ts +2 -2
- package/src/interfaces/bindings/i18n.ts +8 -8
- package/src/interfaces/bindings/index.ts +15 -15
- package/src/interfaces/bindings/live.ts +28 -28
- package/src/interfaces/bindings/notifications.ts +8 -8
- package/src/interfaces/bindings/resource.ts +127 -127
- package/src/interfaces/bindings/router.ts +26 -26
- package/src/interfaces/customComponents.ts +17 -17
- package/src/interfaces/errors/HttpError.ts +8 -8
- package/src/interfaces/form-url-params.ts +6 -6
- package/src/interfaces/index.ts +8 -10
- package/src/interfaces/live/LiveEvent.ts +10 -10
- package/src/interfaces/live/LiveModeProps.ts +21 -21
- package/src/interfaces/mapDataFn.ts +1 -1
- package/src/interfaces/metaData/graphqlQueryOptions.ts +49 -49
- package/src/interfaces/metaData/metaDataQuery.ts +2 -2
- package/src/interfaces/metaData/metaQuery.ts +3 -3
- package/src/interfaces/metaData/nestedField.ts +3 -3
- package/src/interfaces/metaData/queryBuilderOptions.ts +3 -3
- package/src/interfaces/metaData/variableOptions.ts +8 -8
- package/src/interfaces/mutationMode.ts +14 -14
- package/src/interfaces/notification.ts +7 -7
- package/src/interfaces/optimistic-update-map.ts +42 -42
- package/src/interfaces/prettify.ts +1 -1
- package/src/interfaces/queryKey.ts +16 -16
- package/src/interfaces/resourceErrorRouterParams.ts +2 -2
- package/src/interfaces/resourceRouterParams.ts +3 -3
- package/src/interfaces/successErrorNotification.ts +24 -24
- package/src/interfaces/telemetry.ts +13 -13
- package/src/interfaces/textTransformers.ts +18 -18
- package/tsconfig.json +26 -26
|
@@ -6,18 +6,18 @@ import { CheckResponse } from "../../../interfaces";
|
|
|
6
6
|
import { useKeys } from "@hooks/useKeys";
|
|
7
7
|
|
|
8
8
|
export type UseIsAuthenticatedLegacyProps = {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
v3LegacyAuthProviderCompatible: true;
|
|
10
|
+
params?: any;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export type UseIsAuthenticatedProps = {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
v3LegacyAuthProviderCompatible?: false;
|
|
15
|
+
params?: any;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export type UseIsAuthenticatedCombinedProps = {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
v3LegacyAuthProviderCompatible: boolean;
|
|
20
|
+
params?: any;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export type UseIsAuthenticatedLegacyReturnType = UseQueryResult<any, any>;
|
|
@@ -25,20 +25,20 @@ export type UseIsAuthenticatedLegacyReturnType = UseQueryResult<any, any>;
|
|
|
25
25
|
export type UseIsAuthenticatedReturnType = UseQueryResult<CheckResponse, any>;
|
|
26
26
|
|
|
27
27
|
export type UseIsAuthenticatedCombinedReturnType = UseQueryResult<
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
CheckResponse | any,
|
|
29
|
+
any
|
|
30
30
|
>;
|
|
31
31
|
|
|
32
32
|
export function useIsAuthenticated(
|
|
33
|
-
|
|
33
|
+
props: UseIsAuthenticatedLegacyProps,
|
|
34
34
|
): UseIsAuthenticatedLegacyReturnType;
|
|
35
35
|
|
|
36
36
|
export function useIsAuthenticated(
|
|
37
|
-
|
|
37
|
+
props?: UseIsAuthenticatedProps,
|
|
38
38
|
): UseIsAuthenticatedReturnType;
|
|
39
39
|
|
|
40
40
|
export function useIsAuthenticated(
|
|
41
|
-
|
|
41
|
+
props?: UseIsAuthenticatedCombinedProps,
|
|
42
42
|
): UseIsAuthenticatedCombinedReturnType;
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -47,47 +47,43 @@ export function useIsAuthenticated(
|
|
|
47
47
|
* @see {@link https://refine.dev/docs/api-reference/core/hooks/auth/useAuthenticated} for more details.
|
|
48
48
|
*/
|
|
49
49
|
export function useIsAuthenticated({
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
v3LegacyAuthProviderCompatible = false,
|
|
51
|
+
params,
|
|
52
52
|
}: UseIsAuthenticatedProps | UseIsAuthenticatedLegacyProps = {}):
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
| UseIsAuthenticatedReturnType
|
|
54
|
+
| UseIsAuthenticatedLegacyReturnType {
|
|
55
|
+
const { checkAuth } = useLegacyAuthContext();
|
|
56
|
+
const { check } = useAuthBindingsContext();
|
|
57
|
+
const { keys, preferLegacyKeys } = useKeys();
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
const queryResponse = useQuery({
|
|
60
|
+
queryKey: keys()
|
|
61
|
+
.auth()
|
|
62
|
+
.action("check")
|
|
63
|
+
.params(params)
|
|
64
|
+
.get(preferLegacyKeys),
|
|
65
|
+
queryFn: async () => (await check?.(params)) ?? {},
|
|
66
|
+
retry: false,
|
|
67
|
+
enabled: !v3LegacyAuthProviderCompatible,
|
|
68
|
+
meta: {
|
|
69
|
+
...getXRay("useIsAuthenticated", preferLegacyKeys),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
meta: {
|
|
86
|
-
...getXRay("useIsAuthenticated", preferLegacyKeys),
|
|
87
|
-
},
|
|
88
|
-
});
|
|
73
|
+
const legacyQueryResponse = useQuery({
|
|
74
|
+
queryKey: [
|
|
75
|
+
...keys().auth().action("check").params(params).get(preferLegacyKeys),
|
|
76
|
+
"v3LegacyAuthProviderCompatible",
|
|
77
|
+
],
|
|
78
|
+
queryFn: async () => (await checkAuth?.(params)) ?? {},
|
|
79
|
+
retry: false,
|
|
80
|
+
enabled: v3LegacyAuthProviderCompatible,
|
|
81
|
+
meta: {
|
|
82
|
+
...getXRay("useIsAuthenticated", preferLegacyKeys),
|
|
83
|
+
},
|
|
84
|
+
});
|
|
89
85
|
|
|
90
|
-
|
|
86
|
+
return v3LegacyAuthProviderCompatible ? legacyQueryResponse : queryResponse;
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
/**
|
|
@@ -5,8 +5,8 @@ import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
7
|
export const useIsExistAuthentication = (): boolean => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const { isProvided: legacyIsProvided } = useLegacyAuthContext();
|
|
9
|
+
const { isProvided } = useAuthBindingsContext();
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
return Boolean(isProvided || legacyIsProvided);
|
|
12
12
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
useMutation,
|
|
4
|
+
UseMutationOptions,
|
|
5
|
+
UseMutationResult,
|
|
6
6
|
} from "@tanstack/react-query";
|
|
7
7
|
import { getXRay } from "@refinedev/devtools-internal";
|
|
8
8
|
import qs from "qs";
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
useNavigation,
|
|
12
|
+
useRouterContext,
|
|
13
|
+
useNotification,
|
|
14
|
+
useRouterType,
|
|
15
|
+
useParsed,
|
|
16
|
+
useGo,
|
|
17
17
|
} from "@hooks";
|
|
18
18
|
import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
RefineError,
|
|
22
|
+
OpenNotificationParams,
|
|
23
|
+
TLoginData,
|
|
24
24
|
} from "../../../interfaces";
|
|
25
25
|
import { AuthActionResponse } from "src/interfaces/bindings/auth";
|
|
26
26
|
import { SuccessNotificationResponse } from "src/interfaces/bindings/auth";
|
|
@@ -28,75 +28,70 @@ import { useInvalidateAuthStore } from "../useInvalidateAuthStore";
|
|
|
28
28
|
import { useKeys } from "@hooks/useKeys";
|
|
29
29
|
|
|
30
30
|
export type UseLoginLegacyProps<TVariables> = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
TVariables,
|
|
37
|
-
unknown
|
|
38
|
-
>,
|
|
39
|
-
"mutationFn" | "onError" | "onSuccess"
|
|
40
|
-
>;
|
|
31
|
+
v3LegacyAuthProviderCompatible: true;
|
|
32
|
+
mutationOptions?: Omit<
|
|
33
|
+
UseMutationOptions<TLoginData, Error | RefineError, TVariables, unknown>,
|
|
34
|
+
"mutationFn" | "onError" | "onSuccess"
|
|
35
|
+
>;
|
|
41
36
|
};
|
|
42
37
|
|
|
43
38
|
export type UseLoginProps<TVariables> = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
v3LegacyAuthProviderCompatible?: false;
|
|
40
|
+
mutationOptions?: Omit<
|
|
41
|
+
UseMutationOptions<
|
|
42
|
+
AuthActionResponse,
|
|
43
|
+
Error | RefineError,
|
|
44
|
+
TVariables,
|
|
45
|
+
unknown
|
|
46
|
+
>,
|
|
47
|
+
"mutationFn"
|
|
48
|
+
>;
|
|
54
49
|
};
|
|
55
50
|
|
|
56
51
|
export type UseLoginCombinedProps<TVariables> = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
v3LegacyAuthProviderCompatible: boolean;
|
|
53
|
+
mutationOptions?: Omit<
|
|
54
|
+
UseMutationOptions<
|
|
55
|
+
AuthActionResponse | TLoginData,
|
|
56
|
+
Error | RefineError,
|
|
57
|
+
TVariables,
|
|
58
|
+
unknown
|
|
59
|
+
>,
|
|
60
|
+
"mutationFn"
|
|
61
|
+
>;
|
|
67
62
|
};
|
|
68
63
|
|
|
69
64
|
export type UseLoginLegacyReturnType<TVariables> = UseMutationResult<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
TLoginData,
|
|
66
|
+
Error | RefineError,
|
|
67
|
+
TVariables,
|
|
68
|
+
unknown
|
|
74
69
|
>;
|
|
75
70
|
|
|
76
71
|
export type UseLoginReturnType<TVariables> = UseMutationResult<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
AuthActionResponse,
|
|
73
|
+
Error | RefineError,
|
|
74
|
+
TVariables,
|
|
75
|
+
unknown
|
|
81
76
|
>;
|
|
82
77
|
|
|
83
78
|
export type UseLoginCombinedReturnType<TVariables> = UseMutationResult<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
AuthActionResponse | TLoginData,
|
|
80
|
+
Error | RefineError,
|
|
81
|
+
TVariables,
|
|
82
|
+
unknown
|
|
88
83
|
>;
|
|
89
84
|
|
|
90
85
|
export function useLogin<TVariables = {}>(
|
|
91
|
-
|
|
86
|
+
props: UseLoginLegacyProps<TVariables>,
|
|
92
87
|
): UseLoginLegacyReturnType<TVariables>;
|
|
93
88
|
|
|
94
89
|
export function useLogin<TVariables = {}>(
|
|
95
|
-
|
|
90
|
+
props?: UseLoginProps<TVariables>,
|
|
96
91
|
): UseLoginReturnType<TVariables>;
|
|
97
92
|
|
|
98
93
|
export function useLogin<TVariables = {}>(
|
|
99
|
-
|
|
94
|
+
props?: UseLoginCombinedProps<TVariables>,
|
|
100
95
|
): UseLoginCombinedReturnType<TVariables>;
|
|
101
96
|
|
|
102
97
|
/**
|
|
@@ -109,165 +104,157 @@ export function useLogin<TVariables = {}>(
|
|
|
109
104
|
*
|
|
110
105
|
*/
|
|
111
106
|
export function useLogin<TVariables = {}>({
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
v3LegacyAuthProviderCompatible,
|
|
108
|
+
mutationOptions,
|
|
114
109
|
}: UseLoginProps<TVariables> | UseLoginLegacyProps<TVariables> = {}):
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
| UseLoginLegacyReturnType<TVariables>
|
|
111
|
+
| UseLoginReturnType<TVariables> {
|
|
112
|
+
const invalidateAuthStore = useInvalidateAuthStore();
|
|
113
|
+
const routerType = useRouterType();
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
const go = useGo();
|
|
116
|
+
const { replace } = useNavigation();
|
|
122
117
|
|
|
123
|
-
|
|
118
|
+
const parsed = useParsed();
|
|
124
119
|
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
const { useLocation } = useRouterContext();
|
|
121
|
+
const { search } = useLocation();
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
const { close, open } = useNotification();
|
|
124
|
+
const { login: legacyLoginFromContext } = useLegacyAuthContext();
|
|
125
|
+
const { login: loginFromContext } = useAuthBindingsContext();
|
|
126
|
+
const { keys, preferLegacyKeys } = useKeys();
|
|
132
127
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}, [routerType, parsed.params, search]);
|
|
128
|
+
const to = React.useMemo(() => {
|
|
129
|
+
if (routerType === "legacy") {
|
|
130
|
+
const legacySearch = qs.parse(search, {
|
|
131
|
+
ignoreQueryPrefix: true,
|
|
132
|
+
});
|
|
133
|
+
return legacySearch.to;
|
|
134
|
+
}
|
|
135
|
+
return parsed.params?.to;
|
|
136
|
+
}, [routerType, parsed.params, search]);
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
error,
|
|
156
|
-
successNotification,
|
|
157
|
-
}) => {
|
|
158
|
-
if (success) {
|
|
159
|
-
close?.("login-error");
|
|
138
|
+
const mutation = useMutation<
|
|
139
|
+
AuthActionResponse,
|
|
140
|
+
Error | RefineError,
|
|
141
|
+
TVariables,
|
|
142
|
+
unknown
|
|
143
|
+
>({
|
|
144
|
+
mutationKey: keys().auth().action("login").get(preferLegacyKeys),
|
|
145
|
+
mutationFn: loginFromContext,
|
|
146
|
+
onSuccess: async ({ success, redirectTo, error, successNotification }) => {
|
|
147
|
+
if (success) {
|
|
148
|
+
close?.("login-error");
|
|
160
149
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
if (successNotification) {
|
|
151
|
+
open?.(buildSuccessNotification(successNotification));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
165
154
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
155
|
+
if (error || !success) {
|
|
156
|
+
open?.(buildNotification(error));
|
|
157
|
+
}
|
|
169
158
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
159
|
+
if (to && success) {
|
|
160
|
+
if (routerType === "legacy") {
|
|
161
|
+
replace(to as string);
|
|
162
|
+
} else {
|
|
163
|
+
go({ to: to as string, type: "replace" });
|
|
164
|
+
}
|
|
165
|
+
} else if (redirectTo) {
|
|
166
|
+
if (routerType === "legacy") {
|
|
167
|
+
replace(redirectTo);
|
|
168
|
+
} else {
|
|
169
|
+
go({ to: redirectTo, type: "replace" });
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
if (routerType === "legacy") {
|
|
173
|
+
replace("/");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
187
176
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
});
|
|
177
|
+
await invalidateAuthStore();
|
|
178
|
+
},
|
|
179
|
+
onError: (error: any) => {
|
|
180
|
+
open?.(buildNotification(error));
|
|
181
|
+
},
|
|
182
|
+
...(v3LegacyAuthProviderCompatible === true ? {} : mutationOptions),
|
|
183
|
+
meta: {
|
|
184
|
+
...(v3LegacyAuthProviderCompatible === true ? {} : mutationOptions?.meta),
|
|
185
|
+
...getXRay("useLogin", preferLegacyKeys),
|
|
186
|
+
},
|
|
187
|
+
});
|
|
201
188
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
189
|
+
const v3LegacyAuthProviderCompatibleMutation = useMutation<
|
|
190
|
+
TLoginData,
|
|
191
|
+
Error | RefineError,
|
|
192
|
+
TVariables,
|
|
193
|
+
unknown
|
|
194
|
+
>({
|
|
195
|
+
mutationKey: [
|
|
196
|
+
...keys().auth().action("login").get(preferLegacyKeys),
|
|
197
|
+
"v3LegacyAuthProviderCompatible",
|
|
198
|
+
],
|
|
199
|
+
mutationFn: legacyLoginFromContext,
|
|
200
|
+
onSuccess: async (redirectPathFromAuth) => {
|
|
201
|
+
if (to) {
|
|
202
|
+
replace(to as string);
|
|
203
|
+
}
|
|
217
204
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
205
|
+
if (redirectPathFromAuth !== false && !to) {
|
|
206
|
+
if (typeof redirectPathFromAuth === "string") {
|
|
207
|
+
if (routerType === "legacy") {
|
|
208
|
+
replace(redirectPathFromAuth);
|
|
209
|
+
} else {
|
|
210
|
+
go({ to: redirectPathFromAuth, type: "replace" });
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
if (routerType === "legacy") {
|
|
214
|
+
replace("/");
|
|
215
|
+
} else {
|
|
216
|
+
go({ to: "/", type: "replace" });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
233
220
|
|
|
234
|
-
|
|
221
|
+
await invalidateAuthStore();
|
|
235
222
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
223
|
+
close?.("login-error");
|
|
224
|
+
},
|
|
225
|
+
onError: (error: any) => {
|
|
226
|
+
open?.(buildNotification(error));
|
|
227
|
+
},
|
|
228
|
+
...(v3LegacyAuthProviderCompatible ? mutationOptions : {}),
|
|
229
|
+
meta: {
|
|
230
|
+
...(v3LegacyAuthProviderCompatible ? mutationOptions?.meta : {}),
|
|
231
|
+
...getXRay("useLogin", preferLegacyKeys),
|
|
232
|
+
},
|
|
233
|
+
});
|
|
247
234
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
235
|
+
return v3LegacyAuthProviderCompatible
|
|
236
|
+
? v3LegacyAuthProviderCompatibleMutation
|
|
237
|
+
: mutation;
|
|
251
238
|
}
|
|
252
239
|
|
|
253
240
|
const buildNotification = (
|
|
254
|
-
|
|
241
|
+
error?: Error | RefineError,
|
|
255
242
|
): OpenNotificationParams => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
243
|
+
return {
|
|
244
|
+
message: error?.name || "Login Error",
|
|
245
|
+
description: error?.message || "Invalid credentials",
|
|
246
|
+
key: "login-error",
|
|
247
|
+
type: "error",
|
|
248
|
+
};
|
|
262
249
|
};
|
|
263
250
|
|
|
264
251
|
const buildSuccessNotification = (
|
|
265
|
-
|
|
252
|
+
successNotification: SuccessNotificationResponse,
|
|
266
253
|
): OpenNotificationParams => {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
254
|
+
return {
|
|
255
|
+
message: successNotification.message,
|
|
256
|
+
description: successNotification.description,
|
|
257
|
+
key: "login-success",
|
|
258
|
+
type: "success",
|
|
259
|
+
};
|
|
273
260
|
};
|