@umituz/react-native-ai-generation-content 1.89.38 → 1.89.40

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.89.38",
3
+ "version": "1.89.40",
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",
@@ -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 steps changed)
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;
@@ -84,6 +84,11 @@ export async function extractPhotosAsBase64(
84
84
  // ✅ Direct base64 conversion - no resize or modification
85
85
  const base64 = await readFileAsBase64(uri);
86
86
 
87
+ // Check if base64 conversion succeeded
88
+ if (!base64) {
89
+ throw new Error(`Failed to convert photo to base64: ${uri}`);
90
+ }
91
+
87
92
  if (enableDebugLogs && typeof __DEV__ !== "undefined" && __DEV__) {
88
93
  console.log(`[PhotoExtraction] Photo ${index + 1} processed`, {
89
94
  sizeKB: (base64.length / 1024).toFixed(1),
@@ -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({ steps: flowSteps, initialStepIndex: 0 });
115
+ const flow = useFlow({
116
+ steps: flowSteps,
117
+ initialStepIndex: 0,
118
+ resetKey: scenario?.id,
119
+ });
116
120
  const {
117
121
  currentStep,
118
122
  currentStepIndex,