@umituz/react-native-ai-generation-content 1.26.73 → 1.27.0

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.26.73",
3
+ "version": "1.27.0",
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",
@@ -46,11 +46,11 @@
46
46
  "@tanstack/react-query": ">=5.0.0",
47
47
  "@umituz/react-native-subscription": ">=2.23.0",
48
48
  "@umituz/react-native-video-editor": ">=1.0.0",
49
+ "expo-video": ">=1.0.0",
49
50
  "firebase": ">=10.0.0",
50
51
  "react": ">=18.0.0",
51
52
  "react-native": ">=0.74.0",
52
- "react-native-safe-area-context": ">=4.0.0",
53
- "expo-video": ">=1.0.0"
53
+ "react-native-safe-area-context": ">=4.0.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@expo/vector-icons": "^15.0.3",
@@ -67,7 +67,7 @@
67
67
  "@types/react": "~19.1.10",
68
68
  "@typescript-eslint/eslint-plugin": "^8.0.0",
69
69
  "@typescript-eslint/parser": "^8.0.0",
70
- "@umituz/react-native-design-system": "*",
70
+ "@umituz/react-native-design-system": "^2.9.44",
71
71
  "@umituz/react-native-firebase": "*",
72
72
  "@umituz/react-native-localization": "*",
73
73
  "@umituz/react-native-subscription": "*",
@@ -99,6 +99,7 @@
99
99
  "react-i18next": "^16.5.0",
100
100
  "react-native": "0.81.5",
101
101
  "react-native-gesture-handler": "^2.30.0",
102
+ "react-native-purchases": "^9.7.1",
102
103
  "react-native-safe-area-context": "^5.6.2",
103
104
  "react-native-svg": "^15.15.1",
104
105
  "rn-emoji-keyboard": "^1.7.0",
@@ -138,20 +138,35 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
138
138
  }
139
139
  }, [currentStepIndex, previousStep, onBack]);
140
140
 
141
- const handlePhotoContinue = useCallback((stepId: string, image: UploadedImage) => {
142
- setCustomData(stepId, image);
143
-
144
- if (currentStepIndex === flowSteps.length - 2) {
141
+ // Wrapper for nextStep that checks onGenerationStart before transitioning to GENERATING
142
+ const handleNextStep = useCallback(() => {
143
+ const nextIndex = currentStepIndex + 1;
144
+ const nextStepDef = flowSteps[nextIndex];
145
+
146
+ // If next step is GENERATING, we must call onGenerationStart for feature gating
147
+ if (nextStepDef?.type === StepType.GENERATING) {
148
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
149
+ console.log("[GenericWizardFlow] About to enter GENERATING step, calling onGenerationStart");
150
+ }
145
151
  if (onGenerationStart) {
146
- onGenerationStart({ ...customData, [stepId]: image }, () => {
152
+ onGenerationStart(customData, () => {
153
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
154
+ console.log("[GenericWizardFlow] onGenerationStart callback invoked, proceeding to generation");
155
+ }
147
156
  nextStep();
148
157
  });
158
+ return;
149
159
  }
150
- return;
151
160
  }
152
161
 
153
162
  nextStep();
154
- }, [currentStepIndex, flowSteps.length, customData, setCustomData, nextStep, onGenerationStart]);
163
+ }, [currentStepIndex, flowSteps, customData, onGenerationStart, nextStep]);
164
+
165
+ const handlePhotoContinue = useCallback((stepId: string, image: UploadedImage) => {
166
+ setCustomData(stepId, image);
167
+ // Use handleNextStep which handles onGenerationStart check
168
+ handleNextStep();
169
+ }, [setCustomData, handleNextStep]);
155
170
 
156
171
  const handleOpenRatingPicker = useCallback(() => {
157
172
  setShowRatingPicker(true);
@@ -177,7 +192,7 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
177
192
  isSaving={isSaving}
178
193
  isSharing={isSharing}
179
194
  showRating={showRatingButton}
180
- onNext={nextStep}
195
+ onNext={handleNextStep}
181
196
  onBack={handleBack}
182
197
  onPhotoContinue={handlePhotoContinue}
183
198
  onDownload={handleDownload}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { getMediaTypeFromUrl, extractMediaUrl } from "@umituz/react-native-design-system";
2
+ import { extractMediaUrl, getMediaTypeFromUrl } from "@umituz/react-native-design-system";
3
3
  import { StepType } from "../../../../../domain/entities/flow-config.types";
4
4
  import { GenericPhotoUploadScreen } from "../screens/GenericPhotoUploadScreen";
5
5
  import { GeneratingScreen } from "../screens/GeneratingScreen";
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { useState, useCallback, useEffect } from "react";
8
8
  import { Alert } from "react-native";
9
- import { useMedia, MediaValidationError, MediaQuality, MEDIA_CONSTANTS } from "@umituz/react-native-design-system";
9
+ import { useMedia, MediaQuality, MediaValidationError, MEDIA_CONSTANTS } from "@umituz/react-native-design-system";
10
10
  import type { UploadedImage } from "../../../../../presentation/hooks/generation/useAIGenerateState";
11
11
 
12
12
  export interface PhotoUploadConfig {
@@ -60,7 +60,6 @@ export const usePhotoUploadState = ({
60
60
 
61
61
  const handlePickImage = useCallback(async () => {
62
62
  try {
63
- // Design system handles validation with maxFileSizeMB
64
63
  const result = await pickImage({
65
64
  allowsEditing: true,
66
65
  aspect: [1, 1],
@@ -78,7 +77,7 @@ export const usePhotoUploadState = ({
78
77
  } else if (result.error === MediaValidationError.PERMISSION_DENIED) {
79
78
  Alert.alert(
80
79
  translations.error,
81
- translations.permissionDenied || "Permission to access media library is required",
80
+ translations.permissionDenied ?? "Permission to access media library is required",
82
81
  );
83
82
  }
84
83
  return;
@@ -93,7 +92,6 @@ export const usePhotoUploadState = ({
93
92
  return;
94
93
  }
95
94
 
96
- // Create uploaded image object
97
95
  const uploadedImage: UploadedImage = {
98
96
  uri: selectedAsset.uri,
99
97
  previewUrl: selectedAsset.uri,
@@ -105,7 +103,7 @@ export const usePhotoUploadState = ({
105
103
  setImage(uploadedImage);
106
104
 
107
105
  if (typeof __DEV__ !== "undefined" && __DEV__) {
108
- const fileSizeMB = (selectedAsset.fileSize || 0) / (1024 * 1024);
106
+ const fileSizeMB = (selectedAsset.fileSize ?? 0) / (1024 * 1024);
109
107
  console.log("[usePhotoUploadState] Image selected", {
110
108
  width: uploadedImage.width,
111
109
  height: uploadedImage.height,
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Global type declarations for React Native environment
3
+ */
4
+
5
+ /** React Native development flag */
6
+ declare const __DEV__: boolean;
7
+
8
+ /** Extend NodeJS namespace for React Native compatibility */
9
+ declare namespace NodeJS {
10
+ interface Global {
11
+ __DEV__: boolean;
12
+ }
13
+ }