@umituz/react-native-ai-generation-content 1.17.296 → 1.17.297

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.17.296",
3
+ "version": "1.17.297",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -4,11 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useState, useCallback, useEffect } from "react";
7
- import {
8
- useAppIsFocused,
9
- AlertService,
10
- } from "@umituz/react-native-design-system";
11
- import { useLocalization } from "@umituz/react-native-localization";
7
+ import { useAppIsFocused } from "@umituz/react-native-design-system";
12
8
  import { MessageType, MessageTone } from "../../domain/types";
13
9
  import { generateLoveMessage } from "../../infrastructure/services/LoveMessageService";
14
10
  import { PartnerProfileRepository } from "../../infrastructure/persistence/PartnerProfileRepository";
@@ -23,9 +19,10 @@ export enum GeneratorStep {
23
19
  export const useLoveMessageGenerator = (config: {
24
20
  onBack: () => void;
25
21
  initialType?: MessageType;
22
+ onSuccess?: () => void;
23
+ onError?: () => void;
26
24
  }) => {
27
25
  const isFocused = useAppIsFocused();
28
- const { t } = useLocalization();
29
26
 
30
27
  const [currentStep, setCurrentStep] = useState<GeneratorStep>(GeneratorStep.PARTNER);
31
28
  const [partnerName, setPartnerName] = useState("");
@@ -81,20 +78,13 @@ export const useLoveMessageGenerator = (config: {
81
78
 
82
79
  setGeneratedMessage(message);
83
80
  setCurrentStep(GeneratorStep.RESULT);
84
-
85
- AlertService.createSuccessAlert(
86
- t("loveMessage.generator.successTitle"),
87
- t("loveMessage.generator.successMessage")
88
- );
81
+ config.onSuccess?.();
89
82
  } catch (error) {
90
- AlertService.createErrorAlert(
91
- t("loveMessage.generator.errorTitle"),
92
- t("loveMessage.generator.errorMessage")
93
- );
83
+ config.onError?.();
94
84
  } finally {
95
85
  setIsGenerating(false);
96
86
  }
97
- }, [partnerName, selectedType, selectedTone, details, useProfile, isGenerating, t]);
87
+ }, [partnerName, selectedType, selectedTone, details, useProfile, isGenerating, config]);
98
88
 
99
89
  const startOver = useCallback(() => {
100
90
  setCurrentStep(GeneratorStep.PARTNER);
@@ -3,7 +3,7 @@
3
3
  * Multi-step wizard flow
4
4
  */
5
5
 
6
- import { FC, useMemo } from "react";
6
+ import { FC, useMemo, useCallback } from "react";
7
7
  import { View, ScrollView, StyleSheet, Animated } from "react-native";
8
8
  import {
9
9
  AtomicText,
@@ -12,6 +12,7 @@ import {
12
12
  useSafeAreaInsets,
13
13
  AppNavigation,
14
14
  useAppRoute,
15
+ AlertService,
15
16
  } from "@umituz/react-native-design-system";
16
17
  import { useLocalization } from "@umituz/react-native-localization";
17
18
  import { ProgressDots } from "../components/ProgressDots";
@@ -32,7 +33,27 @@ export const LoveMessageGeneratorScreen: FC = () => {
32
33
  const route = useAppRoute<{ params: RouteParams }, "params">();
33
34
 
34
35
  const initialType = route.params?.initialType;
35
- const gen = useLoveMessageGenerator({ onBack: () => AppNavigation.goBack(), initialType });
36
+
37
+ const handleSuccess = useCallback(() => {
38
+ AlertService.createSuccessAlert(
39
+ t("loveMessage.generator.successTitle"),
40
+ t("loveMessage.generator.successMessage")
41
+ );
42
+ }, [t]);
43
+
44
+ const handleError = useCallback(() => {
45
+ AlertService.createErrorAlert(
46
+ t("loveMessage.generator.errorTitle"),
47
+ t("loveMessage.generator.errorMessage")
48
+ );
49
+ }, [t]);
50
+
51
+ const gen = useLoveMessageGenerator({
52
+ onBack: () => AppNavigation.goBack(),
53
+ initialType,
54
+ onSuccess: handleSuccess,
55
+ onError: handleError,
56
+ });
36
57
 
37
58
  const handleNavigateToProfile = () => AppNavigation.navigate("PartnerProfile");
38
59