@umituz/react-native-ai-generation-content 1.26.74 → 1.27.1
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.
|
|
3
|
+
"version": "1.27.1",
|
|
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",
|
|
@@ -17,7 +17,7 @@ export class CreationsFetcher {
|
|
|
17
17
|
|
|
18
18
|
async getAll(userId: string): Promise<Creation[]> {
|
|
19
19
|
if (__DEV__) {
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
console.log("[CreationsRepository] getAll()", { userId });
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -29,20 +29,32 @@ export class CreationsFetcher {
|
|
|
29
29
|
const snapshot = await getDocs(q);
|
|
30
30
|
|
|
31
31
|
if (__DEV__) {
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
console.log("[CreationsRepository] Fetched:", snapshot.docs.length);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const allCreations = snapshot.docs.map((docSnap) => {
|
|
37
37
|
const data = docSnap.data() as CreationDocument;
|
|
38
|
-
|
|
38
|
+
const creation = this.documentMapper(docSnap.id, data);
|
|
39
|
+
|
|
40
|
+
// Ensure deletedAt is always mapped from raw data (custom mappers may omit it)
|
|
41
|
+
if (creation.deletedAt === undefined && data.deletedAt) {
|
|
42
|
+
const deletedAt = data.deletedAt instanceof Date
|
|
43
|
+
? data.deletedAt
|
|
44
|
+
: (data.deletedAt && typeof data.deletedAt === "object" && "toDate" in data.deletedAt)
|
|
45
|
+
? (data.deletedAt as { toDate: () => Date }).toDate()
|
|
46
|
+
: undefined;
|
|
47
|
+
return { ...creation, deletedAt };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return creation;
|
|
39
51
|
});
|
|
40
52
|
|
|
41
53
|
// Filter out soft-deleted creations
|
|
42
54
|
return allCreations.filter((creation) => !creation.deletedAt);
|
|
43
55
|
} catch (error) {
|
|
44
56
|
if (__DEV__) {
|
|
45
|
-
|
|
57
|
+
|
|
46
58
|
console.error("[CreationsRepository] getAll() ERROR", error);
|
|
47
59
|
}
|
|
48
60
|
return [];
|
|
@@ -138,20 +138,35 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
|
|
|
138
138
|
}
|
|
139
139
|
}, [currentStepIndex, previousStep, onBack]);
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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(
|
|
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
|
|
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={
|
|
195
|
+
onNext={handleNextStep}
|
|
181
196
|
onBack={handleBack}
|
|
182
197
|
onPhotoContinue={handlePhotoContinue}
|
|
183
198
|
onDownload={handleDownload}
|