@umituz/react-native-ai-generation-content 1.89.39 → 1.89.42
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 +1 -1
- package/src/domains/creations/presentation/components/GalleryScreenHeader.tsx +0 -2
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -2
- package/src/domains/generation/infrastructure/appearance-analysis.ts +2 -2
- package/src/domains/generation/infrastructure/couple-generation-builder.ts +0 -2
- package/src/domains/generation/infrastructure/flow/useFlow.ts +7 -3
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts +2 -1
- package/src/domains/generation/wizard/presentation/components/WizardFlowContent.tsx +12 -1
- package/src/domains/generation/wizard/presentation/screens/SelectionScreen.tsx +14 -1
- package/src/domains/generation/wizard/presentation/screens/TextInputScreen.tsx +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.89.
|
|
3
|
+
"version": "1.89.42",
|
|
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",
|
|
@@ -7,7 +7,6 @@ import React, { useMemo } from "react";
|
|
|
7
7
|
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
8
|
import { AtomicIcon, AtomicText } from "@umituz/react-native-design-system/atoms";
|
|
9
9
|
import { useAppDesignTokens, type DesignTokens } from "@umituz/react-native-design-system/theme";
|
|
10
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
11
10
|
|
|
12
11
|
interface GalleryScreenHeaderProps {
|
|
13
12
|
readonly title: string;
|
|
@@ -16,7 +15,6 @@ interface GalleryScreenHeaderProps {
|
|
|
16
15
|
|
|
17
16
|
export const GalleryScreenHeader: React.FC<GalleryScreenHeaderProps> = ({ title, onBack }) => {
|
|
18
17
|
const tokens = useAppDesignTokens();
|
|
19
|
-
const insets = useSafeAreaInsets();
|
|
20
18
|
const styles = useMemo(() => createStyles(tokens), [tokens]);
|
|
21
19
|
|
|
22
20
|
return (
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useCallback, useState } from "react";
|
|
2
2
|
import { View, FlatList } from "react-native";
|
|
3
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
3
|
import { ScreenLayout } from "@umituz/react-native-design-system/layouts";
|
|
5
4
|
import { FilterSheet, useAppFocusEffect } from "@umituz/react-native-design-system/molecules";
|
|
6
5
|
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
@@ -38,7 +37,6 @@ export function CreationsGalleryScreen({
|
|
|
38
37
|
onShareToFeed,
|
|
39
38
|
}: CreationsGalleryScreenProps) {
|
|
40
39
|
const tokens = useAppDesignTokens();
|
|
41
|
-
const insets = useSafeAreaInsets();
|
|
42
40
|
const [viewMode, setViewMode] = useState<"list" | "grid">("list");
|
|
43
41
|
|
|
44
42
|
const { data: creations, isLoading, refetch } = useCreations({ userId, repository });
|
|
@@ -16,8 +16,8 @@ import { refinePromptForCouple } from "../../../infrastructure/utils/couple-inpu
|
|
|
16
16
|
* @returns Appearance context string (şu an boş)
|
|
17
17
|
*/
|
|
18
18
|
export async function getAppearanceContext(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
_photoUris: string[],
|
|
20
|
+
_isCoupleMode: boolean,
|
|
21
21
|
): Promise<string> {
|
|
22
22
|
// Vision analysis temporarily disabled due to API limitations
|
|
23
23
|
// Future: Implement vision analysis to extract appearance features
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* - Mood filter generation
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { GenerationTarget } from "../../../exports/presentation";
|
|
16
15
|
import {
|
|
17
16
|
resolveCoupleInput,
|
|
18
17
|
prependContext,
|
|
@@ -152,7 +151,6 @@ export async function buildScenarioGenerationInput(
|
|
|
152
151
|
partner2PhotoUri,
|
|
153
152
|
isCoupleMode,
|
|
154
153
|
scenarioPrompt,
|
|
155
|
-
customInstructions,
|
|
156
154
|
} = params;
|
|
157
155
|
|
|
158
156
|
// 1. GET PHOTO URIs
|
|
@@ -11,6 +11,8 @@ interface UseFlowConfig {
|
|
|
11
11
|
steps: readonly StepDefinition[];
|
|
12
12
|
initialStepId?: string;
|
|
13
13
|
initialStepIndex?: number;
|
|
14
|
+
/** Optional key to force flow reset when changed (e.g., scenarioId) */
|
|
15
|
+
resetKey?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
interface UseFlowReturn extends FlowState, FlowActions {
|
|
@@ -27,14 +29,15 @@ interface UseFlowReturn extends FlowState, FlowActions {
|
|
|
27
29
|
|
|
28
30
|
export const useFlow = (config: UseFlowConfig): UseFlowReturn => {
|
|
29
31
|
const storeRef = useRef<FlowStoreType | null>(null);
|
|
30
|
-
const prevConfigRef = useRef<{ initialStepIndex?: number; initialStepId?: string; steps: readonly StepDefinition[] } | undefined>(undefined);
|
|
32
|
+
const prevConfigRef = useRef<{ initialStepIndex?: number; initialStepId?: string; steps: readonly StepDefinition[]; resetKey?: string } | undefined>(undefined);
|
|
31
33
|
|
|
32
|
-
// Detect config changes (initialStepIndex, initialStepId, or
|
|
34
|
+
// Detect config changes (initialStepIndex, initialStepId, steps, or resetKey changed)
|
|
33
35
|
const configChanged =
|
|
34
36
|
prevConfigRef.current !== undefined &&
|
|
35
37
|
(prevConfigRef.current.initialStepIndex !== config.initialStepIndex ||
|
|
36
38
|
prevConfigRef.current.initialStepId !== config.initialStepId ||
|
|
37
|
-
prevConfigRef.current.steps !== config.steps
|
|
39
|
+
prevConfigRef.current.steps !== config.steps ||
|
|
40
|
+
prevConfigRef.current.resetKey !== config.resetKey);
|
|
38
41
|
|
|
39
42
|
// If config changed, reset and recreate store (per-component instance)
|
|
40
43
|
if (configChanged && storeRef.current) {
|
|
@@ -55,6 +58,7 @@ export const useFlow = (config: UseFlowConfig): UseFlowReturn => {
|
|
|
55
58
|
initialStepIndex: config.initialStepIndex,
|
|
56
59
|
initialStepId: config.initialStepId,
|
|
57
60
|
steps: config.steps,
|
|
61
|
+
resetKey: config.resetKey,
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
const store = storeRef.current;
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts
CHANGED
|
@@ -43,7 +43,8 @@ export async function buildImageInput(
|
|
|
43
43
|
finalPrompt = applyStyleEnhancements(prompt, wizardData);
|
|
44
44
|
|
|
45
45
|
// ✅ Apply couple refinement (same logic as Wardrobe)
|
|
46
|
-
//
|
|
46
|
+
// Note: Scenario prompts are already wrapped with createPhotorealisticPrompt
|
|
47
|
+
// in the data files, so we only apply couple refinement here
|
|
47
48
|
const isCoupleMode = photos.length >= 2;
|
|
48
49
|
finalPrompt = await enhancePromptWithAnalysis(finalPrompt, photoUris, isCoupleMode);
|
|
49
50
|
|
|
@@ -112,7 +112,11 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
|
|
|
112
112
|
return steps;
|
|
113
113
|
}, [featureConfig, skipResultStep]);
|
|
114
114
|
|
|
115
|
-
const flow = useFlow({
|
|
115
|
+
const flow = useFlow({
|
|
116
|
+
steps: flowSteps,
|
|
117
|
+
initialStepIndex: 0,
|
|
118
|
+
resetKey: scenario?.id,
|
|
119
|
+
});
|
|
116
120
|
const {
|
|
117
121
|
currentStep,
|
|
118
122
|
currentStepIndex,
|
|
@@ -223,6 +227,13 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
|
|
|
223
227
|
[customData, featureConfig.steps, calculateCredits, creditCost, validatedScenario.outputType, validatedScenario.inputType],
|
|
224
228
|
);
|
|
225
229
|
|
|
230
|
+
// Reset local state when scenario changes
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
setCurrentCreation(null);
|
|
233
|
+
setShowRatingPicker(false);
|
|
234
|
+
setHasRated(false);
|
|
235
|
+
}, [scenario?.id]);
|
|
236
|
+
|
|
226
237
|
useEffect(() => {
|
|
227
238
|
if (currentStep && onStepChange && prevStepIdRef.current !== currentStep.id) {
|
|
228
239
|
prevStepIdRef.current = currentStep.id;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Generic selection step for wizard flows (duration, style, etc.)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React, { useState, useCallback, useMemo } from "react";
|
|
6
|
+
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
|
7
7
|
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
8
|
import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system/atoms";
|
|
9
9
|
import { NavigationHeader } from "@umituz/react-native-design-system/molecules";
|
|
@@ -42,6 +42,19 @@ export const SelectionScreen: React.FC<SelectionScreenProps> = ({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
const isMultiSelect = config?.multiSelect ?? false;
|
|
45
|
+
|
|
46
|
+
// Reset selection when initialValue, options, or config changes (e.g., when scenario changes)
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const optionIds = options.map((opt) => opt.id);
|
|
49
|
+
|
|
50
|
+
if (isMultiSelect) {
|
|
51
|
+
const initialArr = initialValue && Array.isArray(initialValue) ? initialValue : [];
|
|
52
|
+
setSelected(initialArr.filter((id) => optionIds.includes(id)));
|
|
53
|
+
} else {
|
|
54
|
+
const initialStr = typeof initialValue === "string" ? initialValue : "";
|
|
55
|
+
setSelected(optionIds.includes(initialStr) ? initialStr : "");
|
|
56
|
+
}
|
|
57
|
+
}, [initialValue, options, isMultiSelect]);
|
|
45
58
|
const isRequired = config?.required ?? true;
|
|
46
59
|
const canContinue = isRequired
|
|
47
60
|
? isMultiSelect ? (selected as string[]).length > 0 : selected !== ""
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Uses design system: NavigationHeader + ScreenLayout
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, { useState, useCallback, useMemo } from "react";
|
|
7
|
+
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
|
8
8
|
import { View, TextInput, StyleSheet } from "react-native";
|
|
9
9
|
import { AtomicText, AtomicButton } from "@umituz/react-native-design-system/atoms";
|
|
10
10
|
import { ScreenLayout } from "@umituz/react-native-design-system/layouts";
|
|
@@ -36,6 +36,11 @@ export const TextInputScreen: React.FC<TextInputScreenProps> = ({
|
|
|
36
36
|
const alert = useAlert();
|
|
37
37
|
const [text, setText] = useState(initialValue);
|
|
38
38
|
|
|
39
|
+
// Reset text when initialValue changes (e.g., when scenario changes)
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
setText(initialValue);
|
|
42
|
+
}, [initialValue]);
|
|
43
|
+
|
|
39
44
|
// Validate config - REQUIRED, NO DEFAULTS
|
|
40
45
|
if (!config) {
|
|
41
46
|
throw new Error("[TextInputScreen] Config is required but was not provided.");
|