@umituz/react-native-ai-generation-content 1.12.6 → 1.12.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.12.6",
3
+ "version": "1.12.7",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -9,9 +9,14 @@ import type {
9
9
  FaceValidationState,
10
10
  FaceDetectionResult,
11
11
  } from "../../domain/entities/FaceDetection";
12
- import { analyzeImageForFace } from "../../infrastructure/analyzers/faceAnalyzer";
12
+ import { analyzeImageForFace, type AIAnalyzerFunction } from "../../infrastructure/analyzers/faceAnalyzer";
13
13
  import { isValidFace } from "../../infrastructure/validators/faceValidator";
14
14
 
15
+ interface UseFaceDetectionProps {
16
+ aiAnalyzer: AIAnalyzerFunction;
17
+ model: string;
18
+ }
19
+
15
20
  interface UseFaceDetectionReturn {
16
21
  state: FaceValidationState;
17
22
  validateImage: (base64Image: string) => Promise<FaceDetectionResult>;
@@ -25,14 +30,14 @@ const initialState: FaceValidationState = {
25
30
  error: null,
26
31
  };
27
32
 
28
- export const useFaceDetection = (): UseFaceDetectionReturn => {
33
+ export const useFaceDetection = ({ aiAnalyzer, model }: UseFaceDetectionProps): UseFaceDetectionReturn => {
29
34
  const [state, setState] = useState<FaceValidationState>(initialState);
30
35
 
31
36
  const validateImage = useCallback(async (base64Image: string) => {
32
37
  setState({ isValidating: true, result: null, error: null });
33
38
 
34
39
  try {
35
- const result = await analyzeImageForFace(base64Image);
40
+ const result = await analyzeImageForFace(base64Image, aiAnalyzer, model);
36
41
  setState({ isValidating: false, result, error: null });
37
42
  return result;
38
43
  } catch (error) {
@@ -41,7 +46,7 @@ export const useFaceDetection = (): UseFaceDetectionReturn => {
41
46
  setState({ isValidating: false, result: null, error: message });
42
47
  throw error;
43
48
  }
44
- }, []);
49
+ }, [aiAnalyzer, model]);
45
50
 
46
51
  const reset = useCallback(() => {
47
52
  setState(initialState);