@umituz/react-native-ai-generation-content 1.26.24 → 1.26.26
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.
|
|
3
|
+
"version": "1.26.26",
|
|
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,10 +17,12 @@ import { View, StyleSheet } from "react-native";
|
|
|
17
17
|
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
18
18
|
import { useFlow } from "../../../infrastructure/flow/useFlow";
|
|
19
19
|
import { StepType, type StepDefinition } from "../../../../../domain/entities/flow-config.types";
|
|
20
|
-
import type { WizardFeatureConfig } from "../../domain/entities/wizard-config.types";
|
|
20
|
+
import type { WizardFeatureConfig, WizardStepConfig } from "../../domain/entities/wizard-config.types";
|
|
21
21
|
import { buildFlowStepsFromWizard } from "../../infrastructure/builders/dynamic-step-builder";
|
|
22
22
|
import { useWizardGeneration, type WizardScenarioData } from "../hooks/useWizardGeneration";
|
|
23
23
|
import type { AlertMessages } from "../../../../../presentation/hooks/generation/types";
|
|
24
|
+
import { PhotoStep } from "../../../../../presentation/components/photo-step/PhotoStep";
|
|
25
|
+
import { usePhotoUploadState } from "../hooks/usePhotoUploadState";
|
|
24
26
|
|
|
25
27
|
export interface GenericWizardFlowProps {
|
|
26
28
|
readonly featureConfig: WizardFeatureConfig;
|
|
@@ -232,6 +234,25 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
|
|
|
232
234
|
}
|
|
233
235
|
}, [currentStepIndex, previousStep, onBack]);
|
|
234
236
|
|
|
237
|
+
// Photo upload state translations (generic, used for all photo upload steps)
|
|
238
|
+
const photoUploadTranslations = useMemo(() => ({
|
|
239
|
+
fileTooLarge: t("common.errors.file_too_large"),
|
|
240
|
+
maxFileSize: t("common.errors.max_file_size"),
|
|
241
|
+
error: t("common.error"),
|
|
242
|
+
uploadFailed: t("common.errors.upload_failed"),
|
|
243
|
+
}), [t]);
|
|
244
|
+
|
|
245
|
+
const photoUploadHook = usePhotoUploadState({
|
|
246
|
+
translations: photoUploadTranslations,
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// Save photo when uploaded
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
if (photoUploadHook.image && currentStep) {
|
|
252
|
+
setCustomData(currentStep.id, photoUploadHook.image);
|
|
253
|
+
}
|
|
254
|
+
}, [photoUploadHook.image, currentStep, setCustomData]);
|
|
255
|
+
|
|
235
256
|
// Render current step
|
|
236
257
|
const renderCurrentStep = useCallback(() => {
|
|
237
258
|
const step = currentStep;
|
|
@@ -261,6 +282,49 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
|
|
|
261
282
|
case StepType.RESULT_PREVIEW:
|
|
262
283
|
return renderResult?.(generationResult) || null;
|
|
263
284
|
|
|
285
|
+
case StepType.PARTNER_UPLOAD: {
|
|
286
|
+
// Get wizard step config
|
|
287
|
+
const wizardConfig = step.config as WizardStepConfig;
|
|
288
|
+
|
|
289
|
+
// Use titleKey from config, fallback to step-specific translation key
|
|
290
|
+
const titleKey = wizardConfig?.titleKey || `wizard.steps.${step.id}.title`;
|
|
291
|
+
const title = t(titleKey);
|
|
292
|
+
|
|
293
|
+
// Subtitle is optional
|
|
294
|
+
const subtitle = wizardConfig?.subtitleKey ? t(wizardConfig.subtitleKey) : undefined;
|
|
295
|
+
|
|
296
|
+
// Get existing photo for this step from customData
|
|
297
|
+
const existingPhoto = customData[step.id];
|
|
298
|
+
const imageUri = existingPhoto && typeof existingPhoto === "object" && "uri" in existingPhoto
|
|
299
|
+
? (existingPhoto.uri as string)
|
|
300
|
+
: photoUploadHook.image?.uri || null;
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<PhotoStep
|
|
304
|
+
config={{
|
|
305
|
+
enabled: true,
|
|
306
|
+
order: currentStepIndex,
|
|
307
|
+
id: step.id,
|
|
308
|
+
header: {},
|
|
309
|
+
photoCard: {},
|
|
310
|
+
enableValidation: false,
|
|
311
|
+
}}
|
|
312
|
+
imageUri={imageUri}
|
|
313
|
+
isValidating={false}
|
|
314
|
+
isValid={null}
|
|
315
|
+
onPhotoSelect={photoUploadHook.handlePickImage}
|
|
316
|
+
disabled={false}
|
|
317
|
+
title={title}
|
|
318
|
+
subtitle={subtitle}
|
|
319
|
+
translations={{
|
|
320
|
+
tapToUpload: t("photoUpload.tapToUpload"),
|
|
321
|
+
selectPhoto: t("photoUpload.selectPhoto"),
|
|
322
|
+
change: t("common.change"),
|
|
323
|
+
}}
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
264
328
|
default:
|
|
265
329
|
// Other step types should be handled by custom render props
|
|
266
330
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|