Files
self/app/src/hooks/useErrorInjection.ts
Justin Hernandez c7c9985d91 SELF-1889: Initiate Sumsub during onboarding error flows (#1662)
* 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
2026-01-28 20:10:50 -08:00

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 };
}