mirror of
https://github.com/selfxyz/self.git
synced 2026-02-19 02:24:25 -05:00
* integrate sumsub into error flows * formatting * fix test * format * clean up * udpate flows * agent feedback * updates * save wip updates * clean up design * updates * lint * agent feedback * formatting * fix
28 lines
844 B
TypeScript
28 lines
844 B
TypeScript
// SPDX-FileCopyrightText: 2025 Social Connect Labs, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
// NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE.
|
|
|
|
import { useCallback } from 'react';
|
|
|
|
import type { InjectedErrorType } from '@/stores/errorInjectionStore';
|
|
import { useErrorInjectionStore } from '@/stores/errorInjectionStore';
|
|
import { IS_DEV_MODE } from '@/utils/devUtils';
|
|
|
|
/**
|
|
* Hook for checking if a specific error should be injected
|
|
* Only active in dev mode
|
|
*/
|
|
export function useErrorInjection() {
|
|
const injectedErrors = useErrorInjectionStore(state => state.injectedErrors);
|
|
|
|
const shouldInjectError = useCallback(
|
|
(errorType: InjectedErrorType): boolean => {
|
|
if (!IS_DEV_MODE) return false;
|
|
return injectedErrors.includes(errorType);
|
|
},
|
|
[injectedErrors],
|
|
);
|
|
|
|
return { shouldInjectError };
|
|
}
|