@umituz/react-native-ai-generation-content 1.23.1 → 1.23.3
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/features/couple-future/domain/wizard.types.ts +1 -0
- package/src/features/couple-future/presentation/components/CoupleFutureWizard.tsx +18 -1
- package/src/infrastructure/flow/useFlowStore.ts +11 -0
- package/src/presentation/components/flows/AIGenerateWizardFlow.tsx +2 -1
- package/src/presentation/components/flows/AIGenerateWizardFlow.types.ts +1 -0
- package/src/presentation/components/flows/useAIGenerateWizardFlow.ts +14 -0
- package/src/presentation/components/index.ts +1 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.3",
|
|
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",
|
|
@@ -93,6 +93,7 @@ export interface CoupleFutureWizardCallbacks extends FlowCallbacks {
|
|
|
93
93
|
readonly onPartnerUpload?: (partnerId: "A" | "B", image: FlowUploadedImageData) => void;
|
|
94
94
|
readonly onBackToScenarioSelection?: () => void;
|
|
95
95
|
readonly requireFeature?: (callback: () => void) => boolean;
|
|
96
|
+
readonly onStepChange?: (stepId: string, stepType: StepType) => void;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
/** Wizard props */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Complete wizard component for couple future generation flow
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React, { useCallback, useMemo } from "react";
|
|
6
|
+
import React, { useCallback, useMemo, useEffect } from "react";
|
|
7
7
|
import { View, StyleSheet } from "react-native";
|
|
8
8
|
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
9
|
import { useFlow, resetFlowStore } from "../../../../infrastructure/flow";
|
|
@@ -48,7 +48,24 @@ export const CoupleFutureWizard: React.FC<CoupleFutureWizardProps> = ({
|
|
|
48
48
|
initialStepIndex,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
+
// Notify parent app when step changes
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (flow.currentStep && callbacks?.onStepChange) {
|
|
54
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
55
|
+
console.log("[CoupleFutureWizard] Step changed", {
|
|
56
|
+
stepId: flow.currentStep.id,
|
|
57
|
+
stepType: flow.currentStep.type,
|
|
58
|
+
currentStepIndex: flow.currentStepIndex,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
callbacks.onStepChange(flow.currentStep.id, flow.currentStep.type);
|
|
62
|
+
}
|
|
63
|
+
}, [flow.currentStep, flow.currentStepIndex, callbacks]);
|
|
64
|
+
|
|
51
65
|
const handleScenarioPreviewContinue = useCallback(() => {
|
|
66
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
67
|
+
console.log("[CoupleFutureWizard] Preview Continue clicked");
|
|
68
|
+
}
|
|
52
69
|
// No auth check needed here - just proceed to photo upload
|
|
53
70
|
flow.nextStep();
|
|
54
71
|
}, [flow]);
|
|
@@ -79,6 +79,17 @@ export const createFlowStore = (config: FlowStoreConfig) => {
|
|
|
79
79
|
const newCompleted = completedSteps.includes(currentStepId)
|
|
80
80
|
? completedSteps
|
|
81
81
|
: [...completedSteps, currentStepId];
|
|
82
|
+
|
|
83
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
84
|
+
console.log("[FlowStore] nextStep", {
|
|
85
|
+
fromIndex: currentStepIndex,
|
|
86
|
+
toIndex: nextIndex,
|
|
87
|
+
fromStep: currentStepId,
|
|
88
|
+
toStep: nextStep.id,
|
|
89
|
+
toStepType: nextStep.type,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
82
93
|
set({ currentStepId: nextStep.id, currentStepIndex: nextIndex, completedSteps: newCompleted });
|
|
83
94
|
}
|
|
84
95
|
},
|
|
@@ -29,6 +29,7 @@ export const AIGenerateWizardFlow: React.FC<AIGenerateWizardFlowProps> = ({
|
|
|
29
29
|
onBack: onBackProp,
|
|
30
30
|
onSave,
|
|
31
31
|
onShare,
|
|
32
|
+
onStepChange,
|
|
32
33
|
t,
|
|
33
34
|
}) => {
|
|
34
35
|
const tokens = useAppDesignTokens();
|
|
@@ -74,7 +75,7 @@ export const AIGenerateWizardFlow: React.FC<AIGenerateWizardFlowProps> = ({
|
|
|
74
75
|
handleBack,
|
|
75
76
|
handleNext,
|
|
76
77
|
handleGenerate,
|
|
77
|
-
} = useAIGenerateWizardFlow({ featureType, onGenerate, onBack: onBackProp });
|
|
78
|
+
} = useAIGenerateWizardFlow({ featureType, onGenerate, onBack: onBackProp, onStepChange });
|
|
78
79
|
|
|
79
80
|
switch (currentStep) {
|
|
80
81
|
case AIGenerateStep.UPLOAD_1:
|
|
@@ -61,5 +61,6 @@ export interface AIGenerateWizardFlowProps {
|
|
|
61
61
|
readonly onBack?: () => void;
|
|
62
62
|
readonly onSave?: (uri: string) => Promise<void>;
|
|
63
63
|
readonly onShare?: (uri: string) => Promise<void>;
|
|
64
|
+
readonly onStepChange?: (stepId: string) => void;
|
|
64
65
|
readonly t: (key: string) => string;
|
|
65
66
|
}
|
|
@@ -14,12 +14,14 @@ interface UseAIGenerateWizardFlowProps {
|
|
|
14
14
|
featureType: string;
|
|
15
15
|
onGenerate: (data: GenerationData) => Promise<string | null | void>;
|
|
16
16
|
onBack?: () => void;
|
|
17
|
+
onStepChange?: (stepId: string) => void;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export function useAIGenerateWizardFlow({
|
|
20
21
|
featureType,
|
|
21
22
|
onGenerate,
|
|
22
23
|
onBack: onBackProp,
|
|
24
|
+
onStepChange,
|
|
23
25
|
}: UseAIGenerateWizardFlowProps) {
|
|
24
26
|
const state = useAIGenerateState();
|
|
25
27
|
const {
|
|
@@ -28,6 +30,18 @@ export function useAIGenerateWizardFlow({
|
|
|
28
30
|
selectedDuration
|
|
29
31
|
} = state;
|
|
30
32
|
|
|
33
|
+
// Notify parent app when step changes
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (onStepChange) {
|
|
36
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
37
|
+
console.log("[AIGenerateWizardFlow] Step changed", {
|
|
38
|
+
currentStep,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
onStepChange(currentStep);
|
|
42
|
+
}
|
|
43
|
+
}, [currentStep, onStepChange]);
|
|
44
|
+
|
|
31
45
|
const imageCountRequired = useMemo(() => {
|
|
32
46
|
if (!featureType || !hasAIFeature(featureType)) return 0;
|
|
33
47
|
const config = getAIFeatureConfig(featureType as Parameters<typeof getAIFeatureConfig>[0]);
|
|
@@ -29,18 +29,11 @@ export type { AIGenerationHeroProps } from "./AIGenerationHero";
|
|
|
29
29
|
export * from "./result";
|
|
30
30
|
export * from "./photo-step";
|
|
31
31
|
export * from "./modals/SettingsSheet";
|
|
32
|
-
export * from "./selectors
|
|
33
|
-
export * from "./selectors/DurationSelector";
|
|
34
|
-
export * from "./selectors/GridSelector";
|
|
35
|
-
export * from "./selectors/StyleSelector";
|
|
36
|
-
export * from "./selectors/factories";
|
|
37
|
-
export * from "./selectors/types";
|
|
38
|
-
export * from "./PromptInput";
|
|
32
|
+
export * from "./selectors";
|
|
39
33
|
export * from "./image-picker";
|
|
40
34
|
export * from "./buttons";
|
|
41
35
|
export * from "./display";
|
|
42
36
|
export * from "./headers";
|
|
43
37
|
export * from "./PhotoUploadCard";
|
|
44
|
-
export * from "./selectors";
|
|
45
38
|
export * from "./prompts/ExamplePrompts";
|
|
46
39
|
export * from "./moderation/ModerationSummary";
|