@umituz/react-native-ai-generation-content 1.61.5 → 1.61.7
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 +2 -2
- package/src/exports/domain.ts +35 -0
- package/src/exports/domains.ts +149 -0
- package/src/exports/features.ts +91 -0
- package/src/exports/infrastructure.ts +61 -0
- package/src/exports/presentation.ts +77 -0
- package/src/index.ts +14 -382
- package/src/presentation/components/AIGenerationForm.tsx +4 -1
- package/src/presentation/components/AIGenerationForm.types.ts +2 -0
- package/src/presentation/hooks/generation/index.ts +7 -0
- package/src/presentation/hooks/generation/useDualImageGeneration.ts +35 -111
- package/src/presentation/hooks/generation/useDualImageGeneration.types.ts +42 -0
- package/src/presentation/hooks/generation/useImagePicker.ts +75 -0
- package/src/presentation/hooks/index.ts +4 -0
- package/src/presentation/layouts/DualImageFeatureLayout.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.61.
|
|
3
|
+
"version": "1.61.7",
|
|
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",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@types/react": "~19.1.10",
|
|
70
70
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
71
71
|
"@typescript-eslint/parser": "^8.0.0",
|
|
72
|
-
"@umituz/react-native-design-system": "^
|
|
72
|
+
"@umituz/react-native-design-system": "^4.23.42",
|
|
73
73
|
"@umituz/react-native-firebase": "^1.13.87",
|
|
74
74
|
"@umituz/react-native-subscription": "^2.27.23",
|
|
75
75
|
"eslint": "^9.0.0",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Layer Exports
|
|
3
|
+
* Core types, entities, and interfaces
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Result Type Pattern - Functional error handling
|
|
7
|
+
export type { Result, Success, Failure } from "../domain/types";
|
|
8
|
+
export {
|
|
9
|
+
success, failure, isSuccess, isFailure, mapResult, andThen, unwrap, unwrapOr,
|
|
10
|
+
} from "../domain/types";
|
|
11
|
+
|
|
12
|
+
// Interfaces
|
|
13
|
+
export type {
|
|
14
|
+
AIProviderConfig, IAIProvider, JobSubmission, JobStatus, AIJobStatusType, AILogEntry,
|
|
15
|
+
SubscribeOptions, RunOptions, ImageFeatureType, VideoFeatureType, ImageFeatureInputData,
|
|
16
|
+
VideoFeatureInputData, ProviderCapabilities, ProviderProgressInfo, INetworkService,
|
|
17
|
+
ICreditService, IPaywallService, IAuthService, IAnalyticsService, IAppServices, PartialAppServices,
|
|
18
|
+
IFeatureUtils,
|
|
19
|
+
} from "../domain/interfaces";
|
|
20
|
+
|
|
21
|
+
// Entities
|
|
22
|
+
export { AIErrorType } from "../domain/entities";
|
|
23
|
+
export type {
|
|
24
|
+
AIErrorInfo, AIErrorMessages, GenerationCapability, GenerationStatus, GenerationMetadata,
|
|
25
|
+
GenerationResult, GenerationProgress, GenerationRequest, PollingConfig, PollingState,
|
|
26
|
+
PollingOptions, BackgroundJobStatus, BackgroundJob, AddJobInput, UpdateJobInput,
|
|
27
|
+
JobExecutorConfig, BackgroundQueueConfig, GenerationMode,
|
|
28
|
+
} from "../domain/entities";
|
|
29
|
+
export { DEFAULT_POLLING_CONFIG, DEFAULT_QUEUE_CONFIG } from "../domain/entities";
|
|
30
|
+
|
|
31
|
+
// Processing Modes
|
|
32
|
+
export type { ImageProcessingMode, ModeConfig, ModeCatalog } from "../domain/entities/processing-modes.types";
|
|
33
|
+
export {
|
|
34
|
+
DEFAULT_PROCESSING_MODES, getModeConfig, getFreeModes, getPremiumModes, getPromptRequiredModes,
|
|
35
|
+
} from "../domain/constants/processing-modes.constants";
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Modules Exports
|
|
3
|
+
* Prompts, content-moderation, creations, face-detection, scenarios, etc.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Prompts Domain
|
|
7
|
+
export type {
|
|
8
|
+
AIPromptCategory, AIPromptVariableType, AIPromptError, AIPromptResult,
|
|
9
|
+
AIPromptVariable, AIPromptSafety, AIPromptVersion,
|
|
10
|
+
AIPromptTemplate, CreateAIPromptTemplateParams,
|
|
11
|
+
GeneratedPrompt, CreateGeneratedPromptParams,
|
|
12
|
+
ITemplateRepository, IPromptHistoryRepository, IPromptGenerationService,
|
|
13
|
+
AsyncState, AsyncActions, UseTemplateState, UseTemplateActions,
|
|
14
|
+
UsePromptGenerationState, UsePromptGenerationActions,
|
|
15
|
+
IdentitySegment, AnimeStyleSegment, QualitySegment,
|
|
16
|
+
ImagePromptResult, ImagePromptBuilderOptions, AnimeSelfiePromptResult,
|
|
17
|
+
CreatePromptOptions, MultiPersonPreservationRules, FacePreservationOptions,
|
|
18
|
+
InteractionStyle, InteractionStyleOptions,
|
|
19
|
+
} from "../domains/prompts";
|
|
20
|
+
export {
|
|
21
|
+
createPromptVersion, formatVersion,
|
|
22
|
+
createAIPromptTemplate, updateTemplateVersion, getTemplateString,
|
|
23
|
+
createGeneratedPrompt, isPromptRecent,
|
|
24
|
+
TemplateRepository, PromptHistoryRepository, PromptGenerationService,
|
|
25
|
+
useAsyncState, useTemplateRepository, usePromptGeneration,
|
|
26
|
+
IDENTITY_SEGMENTS, IDENTITY_NEGATIVE_SEGMENTS, ANIME_STYLE_SEGMENTS,
|
|
27
|
+
QUALITY_SEGMENTS, QUALITY_NEGATIVE_SEGMENTS, ANTI_REALISM_SEGMENTS,
|
|
28
|
+
ANATOMY_NEGATIVE_SEGMENTS, PRESET_COLLECTIONS,
|
|
29
|
+
ImagePromptBuilder, createAnimeSelfiePrompt, createStyleTransferPrompt,
|
|
30
|
+
IDENTITY_PRESERVATION_CORE, PHOTOREALISTIC_RENDERING, NATURAL_POSE_GUIDELINES,
|
|
31
|
+
MASTER_BASE_PROMPT, createPhotorealisticPrompt, createTransformationPrompt, enhanceExistingPrompt,
|
|
32
|
+
MULTI_PERSON_PRESERVATION_RULES, createMultiPersonPrompt,
|
|
33
|
+
buildFacePreservationPrompt, buildMinimalFacePreservationPrompt,
|
|
34
|
+
buildInteractionStylePrompt, buildMinimalInteractionStylePrompt, getInteractionRules, getInteractionForbidden,
|
|
35
|
+
} from "../domains/prompts";
|
|
36
|
+
|
|
37
|
+
// Content Moderation Domain
|
|
38
|
+
export type {
|
|
39
|
+
ContentType, ModerationSeverity, AgeRating, ViolationType, ModerationRule,
|
|
40
|
+
ModerationResult, Violation, ModerationContext, ModerationConfig,
|
|
41
|
+
SuggestionMessages, ValidationLimits, ContentFilterResult, IContentFilter, IModerator,
|
|
42
|
+
PatternMatch, ModerationResult as ModeratorResult,
|
|
43
|
+
} from "../domains/content-moderation";
|
|
44
|
+
export {
|
|
45
|
+
contentModerationService, patternMatcherService, textModerator, imageModerator,
|
|
46
|
+
videoModerator, voiceModerator, BaseModerator,
|
|
47
|
+
rulesRegistry, defaultModerationRules, ContentPolicyViolationError,
|
|
48
|
+
} from "../domains/content-moderation";
|
|
49
|
+
|
|
50
|
+
// Creations Domain
|
|
51
|
+
export type {
|
|
52
|
+
CreationTypeId, CreationStatus, CreationCategory, CreationFilter, FilterOption, CreationStats,
|
|
53
|
+
StatusColorKey, CreationOutput, IconName, Creation, CreationDocument,
|
|
54
|
+
CreationType, CreationsTranslations, CreationsConfig, DocumentMapper,
|
|
55
|
+
ICreationsRepository, CreationsSubscriptionCallback, UnsubscribeFunction, RepositoryOptions,
|
|
56
|
+
UseCreationPersistenceConfig, UseCreationPersistenceReturn, BaseProcessingStartData, BaseProcessingResult,
|
|
57
|
+
UseProcessingJobsPollerConfig, UseProcessingJobsPollerReturn,
|
|
58
|
+
CreationAction, CreationCardData, CreationCardCallbacks, FilterButton, PendingJobsSectionProps,
|
|
59
|
+
} from "../domains/creations";
|
|
60
|
+
export {
|
|
61
|
+
ALL_CREATION_STATUSES, ALL_CREATION_CATEGORIES, ALL_CREATION_TYPES,
|
|
62
|
+
IMAGE_CREATION_TYPES, VIDEO_CREATION_TYPES, DEFAULT_CREATION_FILTER,
|
|
63
|
+
MEDIA_FILTER_OPTIONS, STATUS_FILTER_OPTIONS, getTypesForCategory, getCategoryForType,
|
|
64
|
+
getCategoryForCreation, isTypeInCategory, isVideoCreationType, isImageCreationType, calculateCreationStats,
|
|
65
|
+
getStatusColorKey, getStatusColor, getStatusTextKey, getStatusText, isInProgress, isCompleted, isFailed,
|
|
66
|
+
getPreviewUrl, getAllMediaUrls, hasDownloadableContent, hasVideoContent, hasAudioContent, getPrimaryMediaUrl,
|
|
67
|
+
generateCreationId, getTypeIcon, getTypeTextKey, getTypeText, getCreationTitle, filterBySearch, sortCreations, truncateText,
|
|
68
|
+
mapDocumentToCreation, DEFAULT_TRANSLATIONS, DEFAULT_CONFIG,
|
|
69
|
+
CreationsRepository, createCreationsRepository,
|
|
70
|
+
useCreations, useDeleteCreation, useCreationsFilter, useAdvancedFilter, useCreationPersistence, useProcessingJobsPoller,
|
|
71
|
+
CreationPreview, CreationBadges, CreationActions, CreationCard, CreationThumbnail,
|
|
72
|
+
FilterChips, CreationsFilterBar, createMediaFilterButtons, createStatusFilterButtons,
|
|
73
|
+
CreationsHomeCard, EmptyState, PendingJobsSection,
|
|
74
|
+
getLocalizedTitle, getFilterCategoriesFromConfig, getTranslatedTypes,
|
|
75
|
+
CreationsGalleryScreen,
|
|
76
|
+
} from "../domains/creations";
|
|
77
|
+
|
|
78
|
+
// Face Detection Domain
|
|
79
|
+
export type { FaceDetectionResult, FaceValidationState, FaceDetectionConfig } from "../domains/face-detection";
|
|
80
|
+
export {
|
|
81
|
+
FACE_DETECTION_CONFIG, FACE_DETECTION_PROMPTS,
|
|
82
|
+
isValidFace, parseDetectionResponse, createFailedResult, createSuccessResult,
|
|
83
|
+
analyzeImageForFace, useFaceDetection, FaceValidationStatus, FaceDetectionToggle,
|
|
84
|
+
} from "../domains/face-detection";
|
|
85
|
+
|
|
86
|
+
// Scenarios Domain
|
|
87
|
+
export type {
|
|
88
|
+
ScenarioOutputType, ScenarioInputType, ScenarioPromptType, GeneratingMessages, Scenario,
|
|
89
|
+
AppScenarioConfig, ConfiguredScenario, WizardConfigOptions,
|
|
90
|
+
CategoryNavigationContainerProps, MainCategoryScreenProps, SubCategoryScreenProps,
|
|
91
|
+
MainCategory, SubCategory, CategoryInfo, ScenarioSelectorConfig, ScenarioPreviewTranslations,
|
|
92
|
+
ScenarioConfig, VisualStyleOption, InspirationChipData, MagicPromptConfig,
|
|
93
|
+
CoupleFeatureId, CoupleFeatureSelection, ScenarioData,
|
|
94
|
+
} from "../domains/scenarios";
|
|
95
|
+
export {
|
|
96
|
+
createScenariosForApp, filterScenariosByOutputType, filterScenariosByCategory,
|
|
97
|
+
getScenarioCategories, findScenarioById,
|
|
98
|
+
configureScenarios, getConfiguredScenario, getDefaultOutputType, isScenariosConfigured, getAllConfiguredScenarios,
|
|
99
|
+
createStoryTemplate, createCreativePrompt,
|
|
100
|
+
WizardInputType, detectWizardInputType, SCENARIO_TO_WIZARD_INPUT_MAP,
|
|
101
|
+
getScenarioWizardConfig, hasExplicitConfig, getScenarioWizardInputType, registerWizardConfig,
|
|
102
|
+
CategoryNavigationContainer, ScenarioPreviewScreen, MainCategoryScreen, SubCategoryScreen, HierarchicalScenarioListScreen,
|
|
103
|
+
} from "../domains/scenarios";
|
|
104
|
+
|
|
105
|
+
// Access Control Domain
|
|
106
|
+
export type { AIFeatureGateOptions, AIFeatureGateReturn, AIFeatureGateHook } from "../domains/access-control";
|
|
107
|
+
export { useAIFeatureGate } from "../domains/access-control";
|
|
108
|
+
|
|
109
|
+
// Result Preview Domain
|
|
110
|
+
export type {
|
|
111
|
+
ResultData, ResultActionsCallbacks, ResultDisplayState,
|
|
112
|
+
ResultActionBarProps, RecentCreation, ResultPreviewScreenProps, ResultPreviewTranslations,
|
|
113
|
+
UseResultActionsOptions, UseResultActionsReturn,
|
|
114
|
+
StarRatingPickerProps, GenerationErrorTranslations, GenerationErrorConfig, GenerationErrorScreenProps,
|
|
115
|
+
} from "../domains/result-preview";
|
|
116
|
+
export {
|
|
117
|
+
ResultPreviewScreen, ResultActionBar, RecentCreationsSection,
|
|
118
|
+
GenerationErrorScreen, StarRatingPicker, useResultActions,
|
|
119
|
+
} from "../domains/result-preview";
|
|
120
|
+
|
|
121
|
+
// Generation Domain (wizard, flow, strategy)
|
|
122
|
+
export type {
|
|
123
|
+
UseAIGenerationProps, UseAIGenerationReturn, AlertMessages as GenerationAlertMessages,
|
|
124
|
+
FeatureConfig, FeatureRegistration, GenerationType, InputType, OutputType, VisualStyleConfig,
|
|
125
|
+
GenerationExecutor, GenerationOptions as GenerationExecutorOptions,
|
|
126
|
+
GenerationResult as GenerationExecutorResult,
|
|
127
|
+
ImageGenerationOutput, VideoGenerationInput, VideoGenerationOutput,
|
|
128
|
+
MemeGenerationInput, MemeGenerationOutput, TextToImageInput, TextToImageOutput, ExecutorGenerationType,
|
|
129
|
+
BaseStepConfig, AuthGateStepConfig, CreditGateStepConfig, PhotoUploadStepConfig,
|
|
130
|
+
TextInputStepConfig as WizardTextInputStepConfig, SelectionStepConfig,
|
|
131
|
+
PreviewStepConfig as WizardPreviewStepConfig, WizardStepConfig,
|
|
132
|
+
WizardFeatureConfig, ScenarioBasedConfig,
|
|
133
|
+
UsePhotoUploadStateProps, UsePhotoUploadStateReturn, PhotoUploadConfig,
|
|
134
|
+
PhotoUploadTranslations as WizardPhotoUploadTranslations,
|
|
135
|
+
UseWizardGenerationProps, UseWizardGenerationReturn, WizardScenarioData, WizardOutputType,
|
|
136
|
+
GenericWizardFlowProps, TextInputScreenTranslations, TextInputScreenConfig, TextInputScreenProps,
|
|
137
|
+
FlowStoreType,
|
|
138
|
+
GateResult, AuthGateConfig, CreditGateConfig, FlowState, FlowActions, FlowCallbacks,
|
|
139
|
+
FlowConfiguration, StepDefinition,
|
|
140
|
+
} from "../domains/generation";
|
|
141
|
+
export {
|
|
142
|
+
useAIGeneration, featureRegistry, createGenerationStrategy, ExecutorFactory,
|
|
143
|
+
buildWizardConfigFromScenario, WIZARD_PRESETS, buildFlowStepsFromWizard, getPhotoUploadCount,
|
|
144
|
+
getStepConfig, quickBuildWizard, usePhotoUploadState, useWizardGeneration,
|
|
145
|
+
GenericWizardFlow, GeneratingScreen, TextInputScreen,
|
|
146
|
+
TEXT_TO_IMAGE_WIZARD_CONFIG, TEXT_TO_VIDEO_WIZARD_CONFIG, IMAGE_TO_VIDEO_WIZARD_CONFIG,
|
|
147
|
+
createFlowStore, useFlow, resetFlowStore,
|
|
148
|
+
StepType,
|
|
149
|
+
} from "../domains/generation";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Features Exports
|
|
3
|
+
* Text-to-Image, Text-to-Video, Image-to-Video
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Text-to-Image Feature
|
|
7
|
+
export type {
|
|
8
|
+
AspectRatio, ImageSize, OutputFormat, NumImages, StyleOption as TextToImageStyleOption,
|
|
9
|
+
TextToImageFormState, TextToImageFormActions, TextToImageFormDefaults,
|
|
10
|
+
TextToImageGenerationRequest, TextToImageGenerationResult, TextToImageGenerationResultSuccess,
|
|
11
|
+
TextToImageGenerationResultError, TextToImageCallbacks, TextToImageFormConfig, TextToImageTranslations,
|
|
12
|
+
TextToImageOptions, TextToImageRequest, TextToImageResult, TextToImageFeatureState,
|
|
13
|
+
TextToImageInputBuilder, TextToImageResultExtractor, TextToImageFeatureConfig,
|
|
14
|
+
PromptSuggestion, ExecuteTextToImageOptions, UseFormStateOptions, UseFormStateReturn,
|
|
15
|
+
TextToImageGenerationState,
|
|
16
|
+
UseGenerationOptions as TextToImageUseGenerationOptions,
|
|
17
|
+
UseGenerationReturn as TextToImageUseGenerationReturn,
|
|
18
|
+
UseTextToImageFormOptions, UseTextToImageFormReturn,
|
|
19
|
+
TextToImagePromptInputProps, TextToImageExamplePromptsProps, TextToImageStyleSelectorProps,
|
|
20
|
+
TextToImageAspectRatioSelectorProps, TextToImageGenerateButtonProps, TextToImageSettingsSheetProps,
|
|
21
|
+
} from "../features/text-to-image";
|
|
22
|
+
export {
|
|
23
|
+
DEFAULT_IMAGE_STYLES, DEFAULT_NUM_IMAGES_OPTIONS, ASPECT_RATIO_VALUES, IMAGE_SIZE_VALUES,
|
|
24
|
+
OUTPUT_FORMAT_VALUES, DEFAULT_FORM_VALUES, DEFAULT_TEXT_TO_IMAGE_PROMPTS, DEFAULT_TEXT_TO_VOICE_PROMPTS,
|
|
25
|
+
executeTextToImage, hasTextToImageSupport,
|
|
26
|
+
useFormState as useTextToImageFormState,
|
|
27
|
+
useGeneration as useTextToImageGeneration,
|
|
28
|
+
useTextToImageForm,
|
|
29
|
+
TextToImagePromptInput, TextToImageExamplePrompts, TextToImageNumImagesSelector,
|
|
30
|
+
TextToImageStyleSelector, TextToImageAspectRatioSelector, TextToImageSizeSelector,
|
|
31
|
+
TextToImageOutputFormatSelector, TextToImageGenerateButton, TextToImageSettingsSheet,
|
|
32
|
+
} from "../features/text-to-image";
|
|
33
|
+
|
|
34
|
+
// Text-to-Video Feature
|
|
35
|
+
export type {
|
|
36
|
+
TextToVideoOptions, TextToVideoRequest, TextToVideoResult, TextToVideoFeatureState,
|
|
37
|
+
TextToVideoFormState, TextToVideoGenerationState, TextToVideoTranslations,
|
|
38
|
+
TextToVideoInputBuilder, TextToVideoResultExtractor, TextToVideoConfig, TextToVideoCallbacks,
|
|
39
|
+
TabConfig, VideoStyleOption, AspectRatioOption as TextToVideoAspectRatioOption,
|
|
40
|
+
VideoDurationOption, OptionToggleConfig, HeroConfig, ProgressConfig,
|
|
41
|
+
FrameData, VideoModerationResult, ProjectData, CreationData, GenerationStartData,
|
|
42
|
+
GenerationTabsProps, FrameSelectorProps, OptionsPanelProps, HeroSectionProps,
|
|
43
|
+
HintCarouselProps, HintItem,
|
|
44
|
+
ExamplePromptsProps as TextToVideoExamplePromptsProps,
|
|
45
|
+
ExamplePrompt,
|
|
46
|
+
UseTextToVideoFeatureProps, UseTextToVideoFeatureReturn, TextToVideoGenerateParams,
|
|
47
|
+
UseTextToVideoFormProps, UseTextToVideoFormReturn, ExecuteTextToVideoOptions,
|
|
48
|
+
} from "../features/text-to-video";
|
|
49
|
+
export {
|
|
50
|
+
INITIAL_FORM_STATE, INITIAL_GENERATION_STATE,
|
|
51
|
+
executeTextToVideo, hasTextToVideoSupport,
|
|
52
|
+
useTextToVideoFeature, useTextToVideoForm,
|
|
53
|
+
GenerationTabs, FrameSelector, OptionsPanel, HeroSection, HintCarousel,
|
|
54
|
+
} from "../features/text-to-video";
|
|
55
|
+
|
|
56
|
+
// Image-to-Video Feature
|
|
57
|
+
export type {
|
|
58
|
+
AnimationStyle, AnimationStyleId, MusicMood, MusicMoodId,
|
|
59
|
+
VideoDuration, DurationOption as ImageToVideoDurationOption,
|
|
60
|
+
ImageToVideoFormState, ImageToVideoFormActions, ImageToVideoFormDefaults,
|
|
61
|
+
ImageToVideoCallbacks, ImageToVideoFormConfig, ImageToVideoTranslationsExtended,
|
|
62
|
+
ImageToVideoOptions, ImageToVideoGenerateParams, ImageToVideoRequest, ImageToVideoResult,
|
|
63
|
+
ImageToVideoGenerationState, ImageToVideoFeatureState, ImageToVideoTranslations,
|
|
64
|
+
ImageToVideoInputBuilder, ImageToVideoResultExtractor, ImageToVideoFeatureCallbacks,
|
|
65
|
+
ImageToVideoGenerationStartData, ImageToVideoCreationData, ImageToVideoFeatureConfig,
|
|
66
|
+
ExecuteImageToVideoOptions, UseImageToVideoFormStateOptions, UseImageToVideoFormStateReturn,
|
|
67
|
+
UseImageToVideoGenerationOptions, UseImageToVideoGenerationReturn,
|
|
68
|
+
UseImageToVideoFormOptions, UseImageToVideoFormReturn,
|
|
69
|
+
UseImageToVideoFeatureProps, UseImageToVideoFeatureReturn,
|
|
70
|
+
ImageToVideoAnimationStyleSelectorProps, ImageToVideoDurationSelectorProps,
|
|
71
|
+
ImageToVideoMusicMoodSelectorProps, ImageToVideoSelectionGridProps,
|
|
72
|
+
ImageToVideoSelectionGridTranslations, ImageToVideoGenerateButtonProps,
|
|
73
|
+
} from "../features/image-to-video";
|
|
74
|
+
export {
|
|
75
|
+
IMAGE_TO_VIDEO_ANIMATION_STYLES, IMAGE_TO_VIDEO_DEFAULT_ANIMATION,
|
|
76
|
+
IMAGE_TO_VIDEO_MUSIC_MOODS, IMAGE_TO_VIDEO_DEFAULT_MUSIC,
|
|
77
|
+
IMAGE_TO_VIDEO_DURATION_OPTIONS, IMAGE_TO_VIDEO_DEFAULT_DURATION,
|
|
78
|
+
IMAGE_TO_VIDEO_FORM_DEFAULTS, IMAGE_TO_VIDEO_CONFIG,
|
|
79
|
+
executeImageToVideo, hasImageToVideoSupport,
|
|
80
|
+
useImageToVideoFormState, useImageToVideoGeneration, useImageToVideoForm, useImageToVideoFeature,
|
|
81
|
+
ImageToVideoAnimationStyleSelector, ImageToVideoDurationSelector,
|
|
82
|
+
ImageToVideoMusicMoodSelector, ImageToVideoSelectionGrid, ImageToVideoGenerateButton,
|
|
83
|
+
} from "../features/image-to-video";
|
|
84
|
+
|
|
85
|
+
// Wizard Flows
|
|
86
|
+
export { TextToImageWizardFlow } from "../features/text-to-image/presentation/screens/TextToImageWizardFlow";
|
|
87
|
+
export type { TextToImageWizardFlowProps } from "../features/text-to-image/presentation/screens/TextToImageWizardFlow";
|
|
88
|
+
export { TextToVideoWizardFlow } from "../features/text-to-video/presentation/screens/TextToVideoWizardFlow";
|
|
89
|
+
export type { TextToVideoWizardFlowProps } from "../features/text-to-video/presentation/screens/TextToVideoWizardFlow";
|
|
90
|
+
export { ImageToVideoWizardFlow } from "../features/image-to-video/presentation/screens/ImageToVideoWizardFlow";
|
|
91
|
+
export type { ImageToVideoWizardFlowProps } from "../features/image-to-video/presentation/screens/ImageToVideoWizardFlow";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure Layer Exports
|
|
3
|
+
* Services, config, utils, orchestration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Base Executor
|
|
7
|
+
export { BaseExecutor } from "../infrastructure/executors";
|
|
8
|
+
export type { BaseExecutorOptions } from "../infrastructure/executors";
|
|
9
|
+
|
|
10
|
+
// App Services Config
|
|
11
|
+
export {
|
|
12
|
+
configureAppServices, updateAppServices, getAppServices, isAppServicesConfigured,
|
|
13
|
+
resetAppServices, getNetworkService, getCreditService, getPaywallService, getAuthService, getAnalyticsService,
|
|
14
|
+
} from "../infrastructure/config";
|
|
15
|
+
|
|
16
|
+
// Services
|
|
17
|
+
export {
|
|
18
|
+
providerRegistry, generationOrchestrator, pollJob, createJobPoller,
|
|
19
|
+
executeImageFeature, hasImageFeatureSupport, executeVideoFeature, hasVideoFeatureSupport,
|
|
20
|
+
submitVideoFeatureToQueue, executeMultiImageGeneration,
|
|
21
|
+
} from "../infrastructure/services";
|
|
22
|
+
export type {
|
|
23
|
+
OrchestratorConfig, PollJobOptions, PollJobResult, ImageResultExtractor,
|
|
24
|
+
ExecuteImageFeatureOptions, ImageFeatureResult, ImageFeatureRequest,
|
|
25
|
+
ExecuteVideoFeatureOptions, VideoFeatureResult, VideoFeatureRequest,
|
|
26
|
+
MultiImageGenerationInput, MultiImageGenerationResult,
|
|
27
|
+
} from "../infrastructure/services";
|
|
28
|
+
|
|
29
|
+
// Utils
|
|
30
|
+
export {
|
|
31
|
+
classifyError, isTransientError, isPermanentError, isResultNotReady, calculatePollingInterval,
|
|
32
|
+
createPollingDelay, checkStatusForErrors, isJobComplete, isJobProcessing, isJobFailed,
|
|
33
|
+
validateResult, extractOutputUrl, extractOutputUrls, extractVideoUrl, extractThumbnailUrl,
|
|
34
|
+
extractAudioUrl, extractImageUrls, cleanBase64, addBase64Prefix, preparePhoto, preparePhotos,
|
|
35
|
+
isValidBase64, getBase64Size, getBase64SizeMB, prepareImage, createDevCallbacks, createFeatureUtils,
|
|
36
|
+
showVideoGenerationSuccess, handleGenerationError, showContentModerationWarning,
|
|
37
|
+
mapJobStatusToGenerationStatus,
|
|
38
|
+
} from "../infrastructure/utils";
|
|
39
|
+
export type {
|
|
40
|
+
IntervalOptions, StatusCheckResult, ResultValidation, ValidateResultOptions,
|
|
41
|
+
PhotoInput, PreparedImage, ImageSelector, VideoSaver, AlertFunction, FeatureUtilsConfig, VideoAlertFunction,
|
|
42
|
+
} from "../infrastructure/utils";
|
|
43
|
+
|
|
44
|
+
// Orchestration
|
|
45
|
+
export type {
|
|
46
|
+
CreditService, PaywallService, NetworkService, AuthService,
|
|
47
|
+
GenerationMetadata as OrchestratorGenerationMetadata, GenerationCapability as OrchestratorGenerationCapability,
|
|
48
|
+
OrchestratorConfig as GenerationOrchestratorConfig,
|
|
49
|
+
} from "../infrastructure/orchestration";
|
|
50
|
+
export {
|
|
51
|
+
GenerationOrchestrator, NetworkUnavailableError, InsufficientCreditsError, AuthenticationRequiredError,
|
|
52
|
+
} from "../infrastructure/orchestration";
|
|
53
|
+
|
|
54
|
+
// Providers
|
|
55
|
+
export {
|
|
56
|
+
GenerationConfigProvider,
|
|
57
|
+
useGenerationConfig,
|
|
58
|
+
type GenerationModels,
|
|
59
|
+
type GenerationConfigValue,
|
|
60
|
+
type GenerationConfigProviderProps,
|
|
61
|
+
} from "../infrastructure/providers";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation Layer Exports
|
|
3
|
+
* Hooks, components, layouts
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Hooks
|
|
7
|
+
export {
|
|
8
|
+
useGeneration, usePendingJobs, useBackgroundGeneration,
|
|
9
|
+
useGenerationFlow, useAIFeatureCallbacks,
|
|
10
|
+
useAIGenerateState, AIGenerateStep,
|
|
11
|
+
useGenerationOrchestrator, useImageGeneration, useVideoGeneration, useDualImageGeneration,
|
|
12
|
+
useImagePicker,
|
|
13
|
+
createGenerationError, getAlertMessage, parseError,
|
|
14
|
+
} from "../presentation/hooks";
|
|
15
|
+
export type {
|
|
16
|
+
UseGenerationOptions, UseGenerationReturn, UsePendingJobsOptions, UsePendingJobsReturn,
|
|
17
|
+
UseBackgroundGenerationOptions, UseBackgroundGenerationReturn, DirectExecutionResult,
|
|
18
|
+
UseGenerationFlowOptions, UseGenerationFlowReturn,
|
|
19
|
+
AIFeatureCallbacksConfig, AIFeatureCallbacks, AIFeatureGenerationResult,
|
|
20
|
+
GenerationStrategy, GenerationConfig, GenerationState, OrchestratorStatus,
|
|
21
|
+
GenerationError, GenerationErrorType, AlertMessages, UseGenerationOrchestratorReturn,
|
|
22
|
+
SingleImageInput, DualImageInput, ImageGenerationInput, ImageGenerationConfig,
|
|
23
|
+
DualImageVideoInput, VideoGenerationConfig,
|
|
24
|
+
DualImageGenerationConfig, DualImageGenerationReturn,
|
|
25
|
+
ImagePickerState, UseImagePickerOptions, UseImagePickerReturn,
|
|
26
|
+
UploadedImage,
|
|
27
|
+
} from "../presentation/hooks";
|
|
28
|
+
|
|
29
|
+
// Components
|
|
30
|
+
export {
|
|
31
|
+
GenerationProgressContent, GenerationProgressBar, PendingJobCard,
|
|
32
|
+
PendingJobProgressBar, PendingJobCardActions, GenerationResultContent, ResultHeader,
|
|
33
|
+
ResultImageCard, ResultStoryCard, ResultActions, DEFAULT_RESULT_CONFIG, PhotoStep,
|
|
34
|
+
DualImagePicker, PromptInput, AIGenerationHero, ExamplePrompts, ModerationSummary,
|
|
35
|
+
GenerateButton, ResultDisplay, AIGenerationResult, ErrorDisplay, FeatureHeader,
|
|
36
|
+
AIGenScreenHeader, CreditBadge, PhotoUploadCard, SettingsSheet, StyleSelector,
|
|
37
|
+
AspectRatioSelector, DurationSelector, GridSelector, StylePresetsGrid, AIGenerationForm,
|
|
38
|
+
AIGenerationConfig, ModelSelector,
|
|
39
|
+
createAspectRatioOptions, createDurationOptions, createStyleOptions, createStyleOptionsFromConfig,
|
|
40
|
+
ASPECT_RATIO_IDS, COMMON_DURATIONS,
|
|
41
|
+
} from "../presentation/components";
|
|
42
|
+
export type {
|
|
43
|
+
GenerationProgressContentProps, GenerationProgressBarProps, PendingJobCardProps, StatusLabels,
|
|
44
|
+
PendingJobProgressBarProps, PendingJobCardActionsProps, GenerationResultData, GenerationResultContentProps,
|
|
45
|
+
ResultHeaderProps, ResultImageCardProps, ResultStoryCardProps, ResultActionsProps, ResultConfig,
|
|
46
|
+
ResultHeaderConfig, ResultImageConfig, ResultStoryConfig, ResultActionsConfig, ResultLayoutConfig,
|
|
47
|
+
ResultActionButton, PhotoStepProps, DualImagePickerProps, PromptInputProps, AIGenerationHeroProps,
|
|
48
|
+
ExamplePromptsProps, ModerationSummaryProps, StylePresetsGridProps, StylePreset, GenerateButtonProps,
|
|
49
|
+
ResultDisplayProps, ResultDisplayAction, AIGenerationResultProps, AIGenerationResultAction,
|
|
50
|
+
ErrorDisplayProps, FeatureHeaderProps, AIGenScreenHeaderProps, NavigationButtonType, CreditBadgeProps,
|
|
51
|
+
PhotoUploadCardProps, PhotoUploadCardConfig, SettingsSheetProps, StyleSelectorProps,
|
|
52
|
+
AspectRatioSelectorProps, DurationSelectorProps, GridSelectorProps, GridSelectorOption,
|
|
53
|
+
StyleOption, AspectRatioOption, DurationValue, AspectRatioTranslations, DurationOption,
|
|
54
|
+
StyleTranslations, AIGenerationFormProps, AIGenerationFormTranslations,
|
|
55
|
+
AIGenerationConfigProps, ModelOption, ModelSelectorProps,
|
|
56
|
+
} from "../presentation/components";
|
|
57
|
+
|
|
58
|
+
// Layouts
|
|
59
|
+
export {
|
|
60
|
+
SingleImageFeatureLayout, SingleImageWithPromptFeatureLayout,
|
|
61
|
+
DualImageFeatureLayout, DualImageVideoFeatureLayout,
|
|
62
|
+
} from "../presentation/layouts";
|
|
63
|
+
export type {
|
|
64
|
+
ModalTranslations, BaseLayoutTranslations, PhotoUploadTranslations,
|
|
65
|
+
SingleImageInputRenderProps, SingleImageWithPromptInputRenderProps,
|
|
66
|
+
SingleImageWithPromptFeatureState, SingleImageWithPromptFeatureLayoutProps,
|
|
67
|
+
DualImageInputRenderProps, ResultRenderProps, CustomResultRenderProps,
|
|
68
|
+
SingleImageFeatureLayoutProps, DualImageFeatureLayoutProps,
|
|
69
|
+
DualImageVideoFeatureState, DualImageVideoFeatureLayoutProps,
|
|
70
|
+
} from "../presentation/layouts";
|
|
71
|
+
|
|
72
|
+
// Flow Config Types
|
|
73
|
+
export { DEFAULT_SINGLE_PHOTO_FLOW, DEFAULT_DUAL_PHOTO_FLOW } from "../presentation/types/flow-config.types";
|
|
74
|
+
export type {
|
|
75
|
+
PhotoStepConfig, TextInputStepConfig, PreviewStepConfig, GenerationFlowConfig,
|
|
76
|
+
PhotoStepData, TextInputStepData, GenerationFlowState,
|
|
77
|
+
} from "../presentation/types/flow-config.types";
|
package/src/index.ts
CHANGED
|
@@ -3,392 +3,24 @@
|
|
|
3
3
|
* Provider-agnostic AI generation orchestration
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
if (typeof __DEV__ !== "undefined" && __DEV__)
|
|
6
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
7
|
+
console.log("📍 [LIFECYCLE] @umituz/react-native-ai-generation-content/index.ts - Module loading");
|
|
8
|
+
}
|
|
7
9
|
|
|
8
|
-
//
|
|
9
|
-
export
|
|
10
|
-
Result, Success, Failure,
|
|
11
|
-
} from "./domain/types";
|
|
12
|
-
export {
|
|
13
|
-
success, failure, isSuccess, isFailure, mapResult, andThen, unwrap, unwrapOr,
|
|
14
|
-
} from "./domain/types";
|
|
10
|
+
// Domain Layer
|
|
11
|
+
export * from "./exports/domain";
|
|
15
12
|
|
|
16
|
-
//
|
|
17
|
-
export
|
|
18
|
-
export type { BaseExecutorOptions } from "./infrastructure/executors";
|
|
13
|
+
// Infrastructure Layer
|
|
14
|
+
export * from "./exports/infrastructure";
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
SubscribeOptions, RunOptions, ImageFeatureType, VideoFeatureType, ImageFeatureInputData,
|
|
23
|
-
VideoFeatureInputData, ProviderCapabilities, ProviderProgressInfo, INetworkService,
|
|
24
|
-
ICreditService, IPaywallService, IAuthService, IAnalyticsService, IAppServices, PartialAppServices,
|
|
25
|
-
IFeatureUtils,
|
|
26
|
-
} from "./domain/interfaces";
|
|
16
|
+
// Presentation Layer
|
|
17
|
+
export * from "./exports/presentation";
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
// Domain Modules
|
|
20
|
+
export * from "./exports/domains";
|
|
29
21
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
GenerationResult, GenerationProgress, GenerationRequest, PollingConfig, PollingState,
|
|
33
|
-
PollingOptions, BackgroundJobStatus, BackgroundJob, AddJobInput, UpdateJobInput,
|
|
34
|
-
JobExecutorConfig, BackgroundQueueConfig, GenerationMode,
|
|
35
|
-
} from "./domain/entities";
|
|
36
|
-
|
|
37
|
-
export { DEFAULT_POLLING_CONFIG, DEFAULT_QUEUE_CONFIG } from "./domain/entities";
|
|
38
|
-
|
|
39
|
-
export type { ImageProcessingMode, ModeConfig, ModeCatalog } from "./domain/entities/processing-modes.types";
|
|
40
|
-
export { DEFAULT_PROCESSING_MODES, getModeConfig, getFreeModes, getPremiumModes, getPromptRequiredModes } from "./domain/constants/processing-modes.constants";
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
configureAppServices, updateAppServices, getAppServices, isAppServicesConfigured,
|
|
44
|
-
resetAppServices, getNetworkService, getCreditService, getPaywallService, getAuthService, getAnalyticsService,
|
|
45
|
-
} from "./infrastructure/config";
|
|
46
|
-
|
|
47
|
-
export {
|
|
48
|
-
providerRegistry, generationOrchestrator, pollJob, createJobPoller,
|
|
49
|
-
executeImageFeature, hasImageFeatureSupport, executeVideoFeature, hasVideoFeatureSupport,
|
|
50
|
-
submitVideoFeatureToQueue, executeMultiImageGeneration,
|
|
51
|
-
} from "./infrastructure/services";
|
|
52
|
-
|
|
53
|
-
export type {
|
|
54
|
-
OrchestratorConfig, PollJobOptions, PollJobResult, ImageResultExtractor,
|
|
55
|
-
ExecuteImageFeatureOptions, ImageFeatureResult, ImageFeatureRequest,
|
|
56
|
-
ExecuteVideoFeatureOptions, VideoFeatureResult, VideoFeatureRequest,
|
|
57
|
-
MultiImageGenerationInput, MultiImageGenerationResult,
|
|
58
|
-
} from "./infrastructure/services";
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
classifyError, isTransientError, isPermanentError, isResultNotReady, calculatePollingInterval,
|
|
62
|
-
createPollingDelay, checkStatusForErrors, isJobComplete, isJobProcessing, isJobFailed,
|
|
63
|
-
validateResult, extractOutputUrl, extractOutputUrls, extractVideoUrl, extractThumbnailUrl,
|
|
64
|
-
extractAudioUrl, extractImageUrls, cleanBase64, addBase64Prefix, preparePhoto, preparePhotos,
|
|
65
|
-
isValidBase64, getBase64Size, getBase64SizeMB, prepareImage, createDevCallbacks, createFeatureUtils,
|
|
66
|
-
showVideoGenerationSuccess, handleGenerationError, showContentModerationWarning,
|
|
67
|
-
mapJobStatusToGenerationStatus,
|
|
68
|
-
} from "./infrastructure/utils";
|
|
22
|
+
// Features
|
|
23
|
+
export * from "./exports/features";
|
|
69
24
|
|
|
25
|
+
// Utils
|
|
70
26
|
export { distinctBy } from "./utils/arrayUtils";
|
|
71
|
-
|
|
72
|
-
export type {
|
|
73
|
-
IntervalOptions, StatusCheckResult, ResultValidation, ValidateResultOptions,
|
|
74
|
-
PhotoInput, PreparedImage, ImageSelector, VideoSaver, AlertFunction, FeatureUtilsConfig, VideoAlertFunction,
|
|
75
|
-
} from "./infrastructure/utils";
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
useGeneration, usePendingJobs, useBackgroundGeneration,
|
|
79
|
-
useGenerationFlow, useAIFeatureCallbacks,
|
|
80
|
-
useAIGenerateState, AIGenerateStep,
|
|
81
|
-
useGenerationOrchestrator, useImageGeneration, useVideoGeneration, useDualImageGeneration,
|
|
82
|
-
createGenerationError, getAlertMessage, parseError,
|
|
83
|
-
} from "./presentation/hooks";
|
|
84
|
-
|
|
85
|
-
export type {
|
|
86
|
-
UseGenerationOptions, UseGenerationReturn, UsePendingJobsOptions, UsePendingJobsReturn,
|
|
87
|
-
UseBackgroundGenerationOptions, UseBackgroundGenerationReturn, DirectExecutionResult,
|
|
88
|
-
UseGenerationFlowOptions, UseGenerationFlowReturn,
|
|
89
|
-
AIFeatureCallbacksConfig, AIFeatureCallbacks, AIFeatureGenerationResult,
|
|
90
|
-
GenerationStrategy, GenerationConfig, GenerationState, OrchestratorStatus,
|
|
91
|
-
GenerationError, GenerationErrorType, AlertMessages, UseGenerationOrchestratorReturn,
|
|
92
|
-
SingleImageInput, DualImageInput, ImageGenerationInput, ImageGenerationConfig,
|
|
93
|
-
DualImageVideoInput, VideoGenerationConfig,
|
|
94
|
-
DualImageGenerationConfig, DualImageGenerationReturn,
|
|
95
|
-
UploadedImage,
|
|
96
|
-
} from "./presentation/hooks";
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
GenerationProgressContent, GenerationProgressBar, PendingJobCard,
|
|
100
|
-
PendingJobProgressBar, PendingJobCardActions, GenerationResultContent, ResultHeader,
|
|
101
|
-
ResultImageCard, ResultStoryCard, ResultActions, DEFAULT_RESULT_CONFIG, PhotoStep,
|
|
102
|
-
DualImagePicker, PromptInput, AIGenerationHero, ExamplePrompts, ModerationSummary,
|
|
103
|
-
GenerateButton, ResultDisplay, AIGenerationResult, ErrorDisplay, FeatureHeader,
|
|
104
|
-
AIGenScreenHeader, CreditBadge, PhotoUploadCard, SettingsSheet, StyleSelector,
|
|
105
|
-
AspectRatioSelector, DurationSelector, GridSelector, StylePresetsGrid, AIGenerationForm,
|
|
106
|
-
AIGenerationConfig, ModelSelector,
|
|
107
|
-
createAspectRatioOptions, createDurationOptions, createStyleOptions, createStyleOptionsFromConfig,
|
|
108
|
-
ASPECT_RATIO_IDS, COMMON_DURATIONS,
|
|
109
|
-
} from "./presentation/components";
|
|
110
|
-
|
|
111
|
-
export {
|
|
112
|
-
SingleImageFeatureLayout, SingleImageWithPromptFeatureLayout,
|
|
113
|
-
DualImageFeatureLayout, DualImageVideoFeatureLayout,
|
|
114
|
-
} from "./presentation/layouts";
|
|
115
|
-
export type {
|
|
116
|
-
ModalTranslations, BaseLayoutTranslations, PhotoUploadTranslations,
|
|
117
|
-
SingleImageInputRenderProps, SingleImageWithPromptInputRenderProps,
|
|
118
|
-
SingleImageWithPromptFeatureState, SingleImageWithPromptFeatureLayoutProps,
|
|
119
|
-
DualImageInputRenderProps, ResultRenderProps, CustomResultRenderProps,
|
|
120
|
-
SingleImageFeatureLayoutProps, DualImageFeatureLayoutProps,
|
|
121
|
-
DualImageVideoFeatureState, DualImageVideoFeatureLayoutProps,
|
|
122
|
-
} from "./presentation/layouts";
|
|
123
|
-
|
|
124
|
-
export type {
|
|
125
|
-
GenerationProgressContentProps, GenerationProgressBarProps, PendingJobCardProps, StatusLabels,
|
|
126
|
-
PendingJobProgressBarProps, PendingJobCardActionsProps, GenerationResultData, GenerationResultContentProps,
|
|
127
|
-
ResultHeaderProps, ResultImageCardProps, ResultStoryCardProps, ResultActionsProps, ResultConfig,
|
|
128
|
-
ResultHeaderConfig, ResultImageConfig, ResultStoryConfig, ResultActionsConfig, ResultLayoutConfig,
|
|
129
|
-
ResultActionButton, PhotoStepProps, DualImagePickerProps, PromptInputProps, AIGenerationHeroProps,
|
|
130
|
-
ExamplePromptsProps, ModerationSummaryProps, StylePresetsGridProps, StylePreset, GenerateButtonProps,
|
|
131
|
-
ResultDisplayProps, ResultDisplayAction, AIGenerationResultProps, AIGenerationResultAction,
|
|
132
|
-
ErrorDisplayProps, FeatureHeaderProps, AIGenScreenHeaderProps, NavigationButtonType, CreditBadgeProps,
|
|
133
|
-
PhotoUploadCardProps, PhotoUploadCardConfig, SettingsSheetProps, StyleSelectorProps,
|
|
134
|
-
AspectRatioSelectorProps, DurationSelectorProps, GridSelectorProps, GridSelectorOption,
|
|
135
|
-
StyleOption, AspectRatioOption, DurationValue, AspectRatioTranslations, DurationOption,
|
|
136
|
-
StyleTranslations, AIGenerationFormProps, AIGenerationFormTranslations,
|
|
137
|
-
AIGenerationConfigProps, ModelOption, ModelSelectorProps,
|
|
138
|
-
} from "./presentation/components";
|
|
139
|
-
|
|
140
|
-
export { DEFAULT_SINGLE_PHOTO_FLOW, DEFAULT_DUAL_PHOTO_FLOW } from "./presentation/types/flow-config.types";
|
|
141
|
-
export type {
|
|
142
|
-
PhotoStepConfig, TextInputStepConfig, PreviewStepConfig, GenerationFlowConfig,
|
|
143
|
-
PhotoStepData, TextInputStepData, GenerationFlowState,
|
|
144
|
-
} from "./presentation/types/flow-config.types";
|
|
145
|
-
|
|
146
|
-
// Prompts Domain
|
|
147
|
-
export type {
|
|
148
|
-
AIPromptCategory, AIPromptVariableType, AIPromptError, AIPromptResult,
|
|
149
|
-
AIPromptVariable, AIPromptSafety, AIPromptVersion,
|
|
150
|
-
AIPromptTemplate, CreateAIPromptTemplateParams,
|
|
151
|
-
GeneratedPrompt, CreateGeneratedPromptParams,
|
|
152
|
-
ITemplateRepository, IPromptHistoryRepository, IPromptGenerationService,
|
|
153
|
-
AsyncState, AsyncActions, UseTemplateState, UseTemplateActions,
|
|
154
|
-
UsePromptGenerationState, UsePromptGenerationActions,
|
|
155
|
-
IdentitySegment, AnimeStyleSegment, QualitySegment,
|
|
156
|
-
ImagePromptResult, ImagePromptBuilderOptions, AnimeSelfiePromptResult,
|
|
157
|
-
CreatePromptOptions, MultiPersonPreservationRules, FacePreservationOptions,
|
|
158
|
-
InteractionStyle, InteractionStyleOptions,
|
|
159
|
-
} from "./domains/prompts";
|
|
160
|
-
export {
|
|
161
|
-
createPromptVersion, formatVersion,
|
|
162
|
-
createAIPromptTemplate, updateTemplateVersion, getTemplateString,
|
|
163
|
-
createGeneratedPrompt, isPromptRecent,
|
|
164
|
-
TemplateRepository, PromptHistoryRepository, PromptGenerationService,
|
|
165
|
-
useAsyncState, useTemplateRepository, usePromptGeneration,
|
|
166
|
-
IDENTITY_SEGMENTS, IDENTITY_NEGATIVE_SEGMENTS, ANIME_STYLE_SEGMENTS,
|
|
167
|
-
QUALITY_SEGMENTS, QUALITY_NEGATIVE_SEGMENTS, ANTI_REALISM_SEGMENTS,
|
|
168
|
-
ANATOMY_NEGATIVE_SEGMENTS, PRESET_COLLECTIONS,
|
|
169
|
-
ImagePromptBuilder, createAnimeSelfiePrompt, createStyleTransferPrompt,
|
|
170
|
-
IDENTITY_PRESERVATION_CORE, PHOTOREALISTIC_RENDERING, NATURAL_POSE_GUIDELINES,
|
|
171
|
-
MASTER_BASE_PROMPT, createPhotorealisticPrompt, createTransformationPrompt, enhanceExistingPrompt,
|
|
172
|
-
MULTI_PERSON_PRESERVATION_RULES, createMultiPersonPrompt,
|
|
173
|
-
buildFacePreservationPrompt, buildMinimalFacePreservationPrompt,
|
|
174
|
-
buildInteractionStylePrompt, buildMinimalInteractionStylePrompt, getInteractionRules, getInteractionForbidden,
|
|
175
|
-
} from "./domains/prompts";
|
|
176
|
-
|
|
177
|
-
// Content Moderation Domain
|
|
178
|
-
export type {
|
|
179
|
-
ContentType, ModerationSeverity, AgeRating, ViolationType, ModerationRule,
|
|
180
|
-
ModerationResult, Violation, ModerationContext, ModerationConfig,
|
|
181
|
-
SuggestionMessages, ValidationLimits, ContentFilterResult, IContentFilter, IModerator,
|
|
182
|
-
PatternMatch, ModerationResult as ModeratorResult,
|
|
183
|
-
} from "./domains/content-moderation";
|
|
184
|
-
export {
|
|
185
|
-
contentModerationService, patternMatcherService, textModerator, imageModerator,
|
|
186
|
-
videoModerator, voiceModerator, BaseModerator,
|
|
187
|
-
rulesRegistry, defaultModerationRules, ContentPolicyViolationError,
|
|
188
|
-
} from "./domains/content-moderation";
|
|
189
|
-
|
|
190
|
-
// Creations Domain
|
|
191
|
-
export type {
|
|
192
|
-
CreationTypeId, CreationStatus, CreationCategory, CreationFilter, FilterOption, CreationStats,
|
|
193
|
-
StatusColorKey, CreationOutput, IconName, Creation, CreationDocument,
|
|
194
|
-
CreationType, CreationsTranslations, CreationsConfig, DocumentMapper,
|
|
195
|
-
ICreationsRepository, CreationsSubscriptionCallback, UnsubscribeFunction, RepositoryOptions,
|
|
196
|
-
UseCreationPersistenceConfig, UseCreationPersistenceReturn, BaseProcessingStartData, BaseProcessingResult,
|
|
197
|
-
UseProcessingJobsPollerConfig, UseProcessingJobsPollerReturn,
|
|
198
|
-
CreationAction, CreationCardData, CreationCardCallbacks, FilterButton, PendingJobsSectionProps,
|
|
199
|
-
} from "./domains/creations";
|
|
200
|
-
export {
|
|
201
|
-
ALL_CREATION_STATUSES, ALL_CREATION_CATEGORIES, ALL_CREATION_TYPES,
|
|
202
|
-
IMAGE_CREATION_TYPES, VIDEO_CREATION_TYPES, DEFAULT_CREATION_FILTER,
|
|
203
|
-
MEDIA_FILTER_OPTIONS, STATUS_FILTER_OPTIONS, getTypesForCategory, getCategoryForType,
|
|
204
|
-
getCategoryForCreation, isTypeInCategory, isVideoCreationType, isImageCreationType, calculateCreationStats,
|
|
205
|
-
getStatusColorKey, getStatusColor, getStatusTextKey, getStatusText, isInProgress, isCompleted, isFailed,
|
|
206
|
-
getPreviewUrl, getAllMediaUrls, hasDownloadableContent, hasVideoContent, hasAudioContent, getPrimaryMediaUrl,
|
|
207
|
-
generateCreationId, getTypeIcon, getTypeTextKey, getTypeText, getCreationTitle, filterBySearch, sortCreations, truncateText,
|
|
208
|
-
mapDocumentToCreation, DEFAULT_TRANSLATIONS, DEFAULT_CONFIG,
|
|
209
|
-
CreationsRepository, createCreationsRepository,
|
|
210
|
-
useCreations, useDeleteCreation, useCreationsFilter, useAdvancedFilter, useCreationPersistence, useProcessingJobsPoller,
|
|
211
|
-
CreationPreview, CreationBadges, CreationActions, CreationCard, CreationThumbnail,
|
|
212
|
-
FilterChips, CreationsFilterBar, createMediaFilterButtons, createStatusFilterButtons,
|
|
213
|
-
CreationsHomeCard, EmptyState, PendingJobsSection,
|
|
214
|
-
getLocalizedTitle, getFilterCategoriesFromConfig, getTranslatedTypes,
|
|
215
|
-
CreationsGalleryScreen,
|
|
216
|
-
} from "./domains/creations";
|
|
217
|
-
|
|
218
|
-
// Face Detection Domain
|
|
219
|
-
export type { FaceDetectionResult, FaceValidationState, FaceDetectionConfig } from "./domains/face-detection";
|
|
220
|
-
export {
|
|
221
|
-
FACE_DETECTION_CONFIG, FACE_DETECTION_PROMPTS,
|
|
222
|
-
isValidFace, parseDetectionResponse, createFailedResult, createSuccessResult,
|
|
223
|
-
analyzeImageForFace, useFaceDetection, FaceValidationStatus, FaceDetectionToggle,
|
|
224
|
-
} from "./domains/face-detection";
|
|
225
|
-
|
|
226
|
-
// Scenarios Domain
|
|
227
|
-
export type {
|
|
228
|
-
ScenarioOutputType, ScenarioInputType, ScenarioPromptType, GeneratingMessages, Scenario,
|
|
229
|
-
AppScenarioConfig, ConfiguredScenario, WizardConfigOptions,
|
|
230
|
-
CategoryNavigationContainerProps, MainCategoryScreenProps, SubCategoryScreenProps,
|
|
231
|
-
MainCategory, SubCategory, CategoryInfo, ScenarioSelectorConfig, ScenarioPreviewTranslations,
|
|
232
|
-
ScenarioConfig, VisualStyleOption, InspirationChipData, MagicPromptConfig,
|
|
233
|
-
CoupleFeatureId, CoupleFeatureSelection, ScenarioData,
|
|
234
|
-
} from "./domains/scenarios";
|
|
235
|
-
export {
|
|
236
|
-
createScenariosForApp, filterScenariosByOutputType, filterScenariosByCategory,
|
|
237
|
-
getScenarioCategories, findScenarioById,
|
|
238
|
-
configureScenarios, getConfiguredScenario, getDefaultOutputType, isScenariosConfigured, getAllConfiguredScenarios,
|
|
239
|
-
createStoryTemplate, createCreativePrompt,
|
|
240
|
-
WizardInputType, detectWizardInputType, SCENARIO_TO_WIZARD_INPUT_MAP,
|
|
241
|
-
getScenarioWizardConfig, hasExplicitConfig, getScenarioWizardInputType, registerWizardConfig,
|
|
242
|
-
CategoryNavigationContainer, ScenarioPreviewScreen, MainCategoryScreen, SubCategoryScreen, HierarchicalScenarioListScreen,
|
|
243
|
-
} from "./domains/scenarios";
|
|
244
|
-
|
|
245
|
-
// Access Control Domain
|
|
246
|
-
export type { AIFeatureGateOptions, AIFeatureGateReturn, AIFeatureGateHook } from "./domains/access-control";
|
|
247
|
-
export { useAIFeatureGate } from "./domains/access-control";
|
|
248
|
-
|
|
249
|
-
// Orchestration Infrastructure (GenerationOrchestrator class)
|
|
250
|
-
export type {
|
|
251
|
-
CreditService, PaywallService, NetworkService, AuthService,
|
|
252
|
-
GenerationMetadata as OrchestratorGenerationMetadata, GenerationCapability as OrchestratorGenerationCapability,
|
|
253
|
-
OrchestratorConfig as GenerationOrchestratorConfig,
|
|
254
|
-
} from "./infrastructure/orchestration";
|
|
255
|
-
export {
|
|
256
|
-
GenerationOrchestrator, NetworkUnavailableError, InsufficientCreditsError, AuthenticationRequiredError,
|
|
257
|
-
} from "./infrastructure/orchestration";
|
|
258
|
-
|
|
259
|
-
export {
|
|
260
|
-
GenerationConfigProvider,
|
|
261
|
-
useGenerationConfig,
|
|
262
|
-
type GenerationModels,
|
|
263
|
-
type GenerationConfigValue,
|
|
264
|
-
type GenerationConfigProviderProps,
|
|
265
|
-
} from "./infrastructure/providers";
|
|
266
|
-
|
|
267
|
-
// Result Preview Domain (screens and additional components not in presentation/components)
|
|
268
|
-
export type {
|
|
269
|
-
ResultData, ResultActionsCallbacks, ResultDisplayState,
|
|
270
|
-
ResultActionBarProps, RecentCreation, ResultPreviewScreenProps, ResultPreviewTranslations,
|
|
271
|
-
UseResultActionsOptions, UseResultActionsReturn,
|
|
272
|
-
StarRatingPickerProps, GenerationErrorTranslations, GenerationErrorConfig, GenerationErrorScreenProps,
|
|
273
|
-
} from "./domains/result-preview";
|
|
274
|
-
export {
|
|
275
|
-
ResultPreviewScreen, ResultActionBar, RecentCreationsSection,
|
|
276
|
-
GenerationErrorScreen, StarRatingPicker, useResultActions,
|
|
277
|
-
} from "./domains/result-preview";
|
|
278
|
-
|
|
279
|
-
// Generation Domain (wizard, flow, strategy)
|
|
280
|
-
export type {
|
|
281
|
-
UseAIGenerationProps, UseAIGenerationReturn, AlertMessages as GenerationAlertMessages,
|
|
282
|
-
FeatureConfig, FeatureRegistration, GenerationType, InputType, OutputType, VisualStyleConfig,
|
|
283
|
-
GenerationExecutor, GenerationOptions as GenerationExecutorOptions,
|
|
284
|
-
GenerationResult as GenerationExecutorResult,
|
|
285
|
-
ImageGenerationOutput, VideoGenerationInput, VideoGenerationOutput,
|
|
286
|
-
MemeGenerationInput, MemeGenerationOutput, TextToImageInput, TextToImageOutput, ExecutorGenerationType,
|
|
287
|
-
BaseStepConfig, AuthGateStepConfig, CreditGateStepConfig, PhotoUploadStepConfig,
|
|
288
|
-
TextInputStepConfig as WizardTextInputStepConfig, SelectionStepConfig,
|
|
289
|
-
PreviewStepConfig as WizardPreviewStepConfig, WizardStepConfig,
|
|
290
|
-
WizardFeatureConfig, ScenarioBasedConfig,
|
|
291
|
-
UsePhotoUploadStateProps, UsePhotoUploadStateReturn, PhotoUploadConfig,
|
|
292
|
-
PhotoUploadTranslations as WizardPhotoUploadTranslations,
|
|
293
|
-
UseWizardGenerationProps, UseWizardGenerationReturn, WizardScenarioData, WizardOutputType,
|
|
294
|
-
GenericWizardFlowProps, TextInputScreenTranslations, TextInputScreenConfig, TextInputScreenProps,
|
|
295
|
-
FlowStoreType,
|
|
296
|
-
GateResult, AuthGateConfig, CreditGateConfig, FlowState, FlowActions, FlowCallbacks,
|
|
297
|
-
FlowConfiguration, StepDefinition,
|
|
298
|
-
} from "./domains/generation";
|
|
299
|
-
export {
|
|
300
|
-
useAIGeneration, featureRegistry, createGenerationStrategy, ExecutorFactory,
|
|
301
|
-
buildWizardConfigFromScenario, WIZARD_PRESETS, buildFlowStepsFromWizard, getPhotoUploadCount,
|
|
302
|
-
getStepConfig, quickBuildWizard, usePhotoUploadState, useWizardGeneration,
|
|
303
|
-
GenericWizardFlow, GeneratingScreen, TextInputScreen,
|
|
304
|
-
TEXT_TO_IMAGE_WIZARD_CONFIG, TEXT_TO_VIDEO_WIZARD_CONFIG, IMAGE_TO_VIDEO_WIZARD_CONFIG,
|
|
305
|
-
createFlowStore, useFlow, resetFlowStore,
|
|
306
|
-
StepType,
|
|
307
|
-
} from "./domains/generation";
|
|
308
|
-
|
|
309
|
-
// Features - Text-to-Image
|
|
310
|
-
export type {
|
|
311
|
-
AspectRatio, ImageSize, OutputFormat, NumImages, StyleOption as TextToImageStyleOption,
|
|
312
|
-
TextToImageFormState, TextToImageFormActions, TextToImageFormDefaults,
|
|
313
|
-
TextToImageGenerationRequest, TextToImageGenerationResult, TextToImageGenerationResultSuccess,
|
|
314
|
-
TextToImageGenerationResultError, TextToImageCallbacks, TextToImageFormConfig, TextToImageTranslations,
|
|
315
|
-
TextToImageOptions, TextToImageRequest, TextToImageResult, TextToImageFeatureState,
|
|
316
|
-
TextToImageInputBuilder, TextToImageResultExtractor, TextToImageFeatureConfig,
|
|
317
|
-
PromptSuggestion, ExecuteTextToImageOptions, UseFormStateOptions, UseFormStateReturn,
|
|
318
|
-
TextToImageGenerationState,
|
|
319
|
-
UseGenerationOptions as TextToImageUseGenerationOptions,
|
|
320
|
-
UseGenerationReturn as TextToImageUseGenerationReturn,
|
|
321
|
-
UseTextToImageFormOptions, UseTextToImageFormReturn,
|
|
322
|
-
TextToImagePromptInputProps, TextToImageExamplePromptsProps, TextToImageStyleSelectorProps,
|
|
323
|
-
TextToImageAspectRatioSelectorProps, TextToImageGenerateButtonProps, TextToImageSettingsSheetProps,
|
|
324
|
-
} from "./features/text-to-image";
|
|
325
|
-
export {
|
|
326
|
-
DEFAULT_IMAGE_STYLES, DEFAULT_NUM_IMAGES_OPTIONS, ASPECT_RATIO_VALUES, IMAGE_SIZE_VALUES,
|
|
327
|
-
OUTPUT_FORMAT_VALUES, DEFAULT_FORM_VALUES, DEFAULT_TEXT_TO_IMAGE_PROMPTS, DEFAULT_TEXT_TO_VOICE_PROMPTS,
|
|
328
|
-
executeTextToImage, hasTextToImageSupport,
|
|
329
|
-
useFormState as useTextToImageFormState,
|
|
330
|
-
useGeneration as useTextToImageGeneration,
|
|
331
|
-
useTextToImageForm,
|
|
332
|
-
TextToImagePromptInput, TextToImageExamplePrompts, TextToImageNumImagesSelector,
|
|
333
|
-
TextToImageStyleSelector, TextToImageAspectRatioSelector, TextToImageSizeSelector,
|
|
334
|
-
TextToImageOutputFormatSelector, TextToImageGenerateButton, TextToImageSettingsSheet,
|
|
335
|
-
} from "./features/text-to-image";
|
|
336
|
-
|
|
337
|
-
// Features - Text-to-Video
|
|
338
|
-
export type {
|
|
339
|
-
TextToVideoOptions, TextToVideoRequest, TextToVideoResult, TextToVideoFeatureState,
|
|
340
|
-
TextToVideoFormState, TextToVideoGenerationState, TextToVideoTranslations,
|
|
341
|
-
TextToVideoInputBuilder, TextToVideoResultExtractor, TextToVideoConfig, TextToVideoCallbacks,
|
|
342
|
-
TabConfig, VideoStyleOption, AspectRatioOption as TextToVideoAspectRatioOption,
|
|
343
|
-
VideoDurationOption, OptionToggleConfig, HeroConfig, ProgressConfig,
|
|
344
|
-
FrameData, VideoModerationResult, ProjectData, CreationData, GenerationStartData,
|
|
345
|
-
GenerationTabsProps, FrameSelectorProps, OptionsPanelProps, HeroSectionProps,
|
|
346
|
-
HintCarouselProps, HintItem,
|
|
347
|
-
ExamplePromptsProps as TextToVideoExamplePromptsProps,
|
|
348
|
-
ExamplePrompt,
|
|
349
|
-
UseTextToVideoFeatureProps, UseTextToVideoFeatureReturn, TextToVideoGenerateParams,
|
|
350
|
-
UseTextToVideoFormProps, UseTextToVideoFormReturn, ExecuteTextToVideoOptions,
|
|
351
|
-
} from "./features/text-to-video";
|
|
352
|
-
export {
|
|
353
|
-
INITIAL_FORM_STATE, INITIAL_GENERATION_STATE,
|
|
354
|
-
executeTextToVideo, hasTextToVideoSupport,
|
|
355
|
-
useTextToVideoFeature, useTextToVideoForm,
|
|
356
|
-
GenerationTabs, FrameSelector, OptionsPanel, HeroSection, HintCarousel,
|
|
357
|
-
} from "./features/text-to-video";
|
|
358
|
-
|
|
359
|
-
// Features - Image-to-Video
|
|
360
|
-
export type {
|
|
361
|
-
AnimationStyle, AnimationStyleId, MusicMood, MusicMoodId,
|
|
362
|
-
VideoDuration, DurationOption as ImageToVideoDurationOption,
|
|
363
|
-
ImageToVideoFormState, ImageToVideoFormActions, ImageToVideoFormDefaults,
|
|
364
|
-
ImageToVideoCallbacks, ImageToVideoFormConfig, ImageToVideoTranslationsExtended,
|
|
365
|
-
ImageToVideoOptions, ImageToVideoGenerateParams, ImageToVideoRequest, ImageToVideoResult,
|
|
366
|
-
ImageToVideoGenerationState, ImageToVideoFeatureState, ImageToVideoTranslations,
|
|
367
|
-
ImageToVideoInputBuilder, ImageToVideoResultExtractor, ImageToVideoFeatureCallbacks,
|
|
368
|
-
ImageToVideoGenerationStartData, ImageToVideoCreationData, ImageToVideoFeatureConfig,
|
|
369
|
-
ExecuteImageToVideoOptions, UseImageToVideoFormStateOptions, UseImageToVideoFormStateReturn,
|
|
370
|
-
UseImageToVideoGenerationOptions, UseImageToVideoGenerationReturn,
|
|
371
|
-
UseImageToVideoFormOptions, UseImageToVideoFormReturn,
|
|
372
|
-
UseImageToVideoFeatureProps, UseImageToVideoFeatureReturn,
|
|
373
|
-
ImageToVideoAnimationStyleSelectorProps, ImageToVideoDurationSelectorProps,
|
|
374
|
-
ImageToVideoMusicMoodSelectorProps, ImageToVideoSelectionGridProps,
|
|
375
|
-
ImageToVideoSelectionGridTranslations, ImageToVideoGenerateButtonProps,
|
|
376
|
-
} from "./features/image-to-video";
|
|
377
|
-
export {
|
|
378
|
-
IMAGE_TO_VIDEO_ANIMATION_STYLES, IMAGE_TO_VIDEO_DEFAULT_ANIMATION,
|
|
379
|
-
IMAGE_TO_VIDEO_MUSIC_MOODS, IMAGE_TO_VIDEO_DEFAULT_MUSIC,
|
|
380
|
-
IMAGE_TO_VIDEO_DURATION_OPTIONS, IMAGE_TO_VIDEO_DEFAULT_DURATION,
|
|
381
|
-
IMAGE_TO_VIDEO_FORM_DEFAULTS, IMAGE_TO_VIDEO_CONFIG,
|
|
382
|
-
executeImageToVideo, hasImageToVideoSupport,
|
|
383
|
-
useImageToVideoFormState, useImageToVideoGeneration, useImageToVideoForm, useImageToVideoFeature,
|
|
384
|
-
ImageToVideoAnimationStyleSelector, ImageToVideoDurationSelector,
|
|
385
|
-
ImageToVideoMusicMoodSelector, ImageToVideoSelectionGrid, ImageToVideoGenerateButton,
|
|
386
|
-
} from "./features/image-to-video";
|
|
387
|
-
|
|
388
|
-
// Wizard Flows - Direct exports
|
|
389
|
-
export { TextToImageWizardFlow } from "./features/text-to-image/presentation/screens/TextToImageWizardFlow";
|
|
390
|
-
export type { TextToImageWizardFlowProps } from "./features/text-to-image/presentation/screens/TextToImageWizardFlow";
|
|
391
|
-
export { TextToVideoWizardFlow } from "./features/text-to-video/presentation/screens/TextToVideoWizardFlow";
|
|
392
|
-
export type { TextToVideoWizardFlowProps } from "./features/text-to-video/presentation/screens/TextToVideoWizardFlow";
|
|
393
|
-
export { ImageToVideoWizardFlow } from "./features/image-to-video/presentation/screens/ImageToVideoWizardFlow";
|
|
394
|
-
export type { ImageToVideoWizardFlowProps } from "./features/image-to-video/presentation/screens/ImageToVideoWizardFlow";
|
|
@@ -34,6 +34,7 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
|
|
|
34
34
|
onGenerate,
|
|
35
35
|
isGenerating,
|
|
36
36
|
hideGenerateButton,
|
|
37
|
+
isDisabled,
|
|
37
38
|
generateButtonProps,
|
|
38
39
|
showAdvanced,
|
|
39
40
|
onAdvancedToggle,
|
|
@@ -48,7 +49,9 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
|
|
|
48
49
|
|
|
49
50
|
const tokens = useAppDesignTokens();
|
|
50
51
|
const isAdvancedVisible = showAdvanced !== undefined ? showAdvanced : true;
|
|
51
|
-
|
|
52
|
+
// Button is disabled if: external isDisabled is true, OR prompt validation fails (when prompt is used)
|
|
53
|
+
const promptInvalid = onPromptChange ? !prompt?.trim() : false;
|
|
54
|
+
const buttonIsDisabled = isDisabled || promptInvalid;
|
|
52
55
|
|
|
53
56
|
useEffect(() => {
|
|
54
57
|
if (__DEV__) {
|
|
@@ -55,6 +55,8 @@ export interface AIGenerationFormProps extends PropsWithChildren {
|
|
|
55
55
|
onGenerate: () => void;
|
|
56
56
|
isGenerating: boolean;
|
|
57
57
|
hideGenerateButton?: boolean;
|
|
58
|
+
/** External control to disable the generate button (e.g., when images are not selected) */
|
|
59
|
+
isDisabled?: boolean;
|
|
58
60
|
|
|
59
61
|
// Optional: Generation Progress
|
|
60
62
|
progress?: number;
|
|
@@ -10,6 +10,7 @@ export { useGenerationOrchestrator } from "./orchestrator";
|
|
|
10
10
|
export { useImageGeneration } from "./useImageGeneration";
|
|
11
11
|
export { useVideoGeneration } from "./useVideoGeneration";
|
|
12
12
|
export { useDualImageGeneration } from "./useDualImageGeneration";
|
|
13
|
+
export { useImagePicker } from "./useImagePicker";
|
|
13
14
|
|
|
14
15
|
// Types
|
|
15
16
|
export type {
|
|
@@ -45,6 +46,12 @@ export type {
|
|
|
45
46
|
DualImageGenerationReturn,
|
|
46
47
|
} from "./useDualImageGeneration";
|
|
47
48
|
|
|
49
|
+
export type {
|
|
50
|
+
ImagePickerState,
|
|
51
|
+
UseImagePickerOptions,
|
|
52
|
+
UseImagePickerReturn,
|
|
53
|
+
} from "./useImagePicker";
|
|
54
|
+
|
|
48
55
|
// Error utilities
|
|
49
56
|
export {
|
|
50
57
|
createGenerationError,
|
|
@@ -5,55 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { useState, useCallback, useMemo } from "react";
|
|
8
|
-
import {
|
|
9
|
-
MediaPickerService,
|
|
10
|
-
MediaQuality,
|
|
11
|
-
useAlert,
|
|
12
|
-
saveImageToGallery,
|
|
13
|
-
} from "@umituz/react-native-design-system";
|
|
8
|
+
import { useAlert, saveImageToGallery } from "@umituz/react-native-design-system";
|
|
14
9
|
import { useGenerationOrchestrator } from "./orchestrator";
|
|
10
|
+
import { useImagePicker } from "./useImagePicker";
|
|
15
11
|
import { executeMultiImageGeneration } from "../../../infrastructure/services/multi-image-generation.executor";
|
|
16
|
-
import {
|
|
17
|
-
import type {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/** Function that returns the prompt (can depend on external state) */
|
|
25
|
-
readonly getPrompt: () => string;
|
|
26
|
-
/** User ID for credit operations */
|
|
27
|
-
readonly userId: string | undefined;
|
|
28
|
-
/** Credit cost per generation */
|
|
29
|
-
readonly creditCost: number;
|
|
30
|
-
/** Alert messages */
|
|
31
|
-
readonly alertMessages: AlertMessages;
|
|
32
|
-
/** Image aspect ratio for picker */
|
|
33
|
-
readonly imageAspect?: [number, number];
|
|
34
|
-
/** Callbacks */
|
|
35
|
-
readonly onCreditsExhausted?: () => void;
|
|
36
|
-
readonly onSuccess?: (imageUrl: string) => void;
|
|
37
|
-
readonly onError?: (error: string) => void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface DualImageGenerationReturn {
|
|
41
|
-
readonly sourceImageUri: string | null;
|
|
42
|
-
readonly targetImageUri: string | null;
|
|
43
|
-
readonly processedUrl: string | null;
|
|
44
|
-
readonly isProcessing: boolean;
|
|
45
|
-
readonly progress: number;
|
|
46
|
-
selectSourceImage(): Promise<void>;
|
|
47
|
-
selectTargetImage(): Promise<void>;
|
|
48
|
-
process(): Promise<void>;
|
|
49
|
-
save(): Promise<void>;
|
|
50
|
-
reset(): void;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface GenerationInput {
|
|
54
|
-
sourceBase64: string;
|
|
55
|
-
targetBase64: string;
|
|
56
|
-
}
|
|
12
|
+
import type { GenerationStrategy } from "./types";
|
|
13
|
+
import type {
|
|
14
|
+
DualImageGenerationConfig,
|
|
15
|
+
DualImageGenerationReturn,
|
|
16
|
+
GenerationInput,
|
|
17
|
+
} from "./useDualImageGeneration.types";
|
|
18
|
+
|
|
19
|
+
export type { DualImageGenerationConfig, DualImageGenerationReturn } from "./useDualImageGeneration.types";
|
|
57
20
|
|
|
58
21
|
export const useDualImageGeneration = (
|
|
59
22
|
config: DualImageGenerationConfig,
|
|
@@ -71,14 +34,19 @@ export const useDualImageGeneration = (
|
|
|
71
34
|
} = config;
|
|
72
35
|
|
|
73
36
|
const { showError, showSuccess } = useAlert();
|
|
74
|
-
|
|
75
|
-
// Image state
|
|
76
|
-
const [sourceImageUri, setSourceImageUri] = useState<string | null>(null);
|
|
77
|
-
const [targetImageUri, setTargetImageUri] = useState<string | null>(null);
|
|
78
|
-
const [sourceBase64, setSourceBase64] = useState<string | null>(null);
|
|
79
|
-
const [targetBase64, setTargetBase64] = useState<string | null>(null);
|
|
80
37
|
const [progress, setProgress] = useState(0);
|
|
81
38
|
|
|
39
|
+
// Image pickers
|
|
40
|
+
const sourceImage = useImagePicker({
|
|
41
|
+
aspect: imageAspect,
|
|
42
|
+
onError: () => showError("Error", "Failed to select image"),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const targetImage = useImagePicker({
|
|
46
|
+
aspect: imageAspect,
|
|
47
|
+
onError: () => showError("Error", "Failed to select image"),
|
|
48
|
+
});
|
|
49
|
+
|
|
82
50
|
// Generation strategy for orchestrator
|
|
83
51
|
const strategy: GenerationStrategy<GenerationInput, string> = useMemo(
|
|
84
52
|
() => ({
|
|
@@ -112,67 +80,25 @@ export const useDualImageGeneration = (
|
|
|
112
80
|
onError: (error) => onError?.(error.message),
|
|
113
81
|
});
|
|
114
82
|
|
|
115
|
-
// Image selection handlers
|
|
116
|
-
const selectSourceImage = useCallback(async () => {
|
|
117
|
-
try {
|
|
118
|
-
const result = await MediaPickerService.pickSingleImage({
|
|
119
|
-
allowsEditing: true,
|
|
120
|
-
quality: MediaQuality.HIGH,
|
|
121
|
-
aspect: imageAspect,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
if (!result.canceled && result.assets?.[0]) {
|
|
125
|
-
const asset = result.assets[0];
|
|
126
|
-
setSourceImageUri(asset.uri);
|
|
127
|
-
const base64 = await prepareImage(asset.uri);
|
|
128
|
-
setSourceBase64(base64);
|
|
129
|
-
}
|
|
130
|
-
} catch (error) {
|
|
131
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
132
|
-
console.error("[DualImageGeneration] Source image error:", error);
|
|
133
|
-
}
|
|
134
|
-
showError("Error", "Failed to select image");
|
|
135
|
-
}
|
|
136
|
-
}, [imageAspect, showError]);
|
|
137
|
-
|
|
138
|
-
const selectTargetImage = useCallback(async () => {
|
|
139
|
-
try {
|
|
140
|
-
const result = await MediaPickerService.pickSingleImage({
|
|
141
|
-
allowsEditing: true,
|
|
142
|
-
quality: MediaQuality.HIGH,
|
|
143
|
-
aspect: imageAspect,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (!result.canceled && result.assets?.[0]) {
|
|
147
|
-
const asset = result.assets[0];
|
|
148
|
-
setTargetImageUri(asset.uri);
|
|
149
|
-
const base64 = await prepareImage(asset.uri);
|
|
150
|
-
setTargetBase64(base64);
|
|
151
|
-
}
|
|
152
|
-
} catch (error) {
|
|
153
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
154
|
-
console.error("[DualImageGeneration] Target image error:", error);
|
|
155
|
-
}
|
|
156
|
-
showError("Error", "Failed to select image");
|
|
157
|
-
}
|
|
158
|
-
}, [imageAspect, showError]);
|
|
159
|
-
|
|
160
83
|
// Process handler
|
|
161
84
|
const process = useCallback(async () => {
|
|
162
|
-
if (!
|
|
85
|
+
if (!sourceImage.base64 || !targetImage.base64) {
|
|
163
86
|
showError("Missing Photos", "Please upload both photos");
|
|
164
87
|
return;
|
|
165
88
|
}
|
|
166
89
|
|
|
167
90
|
setProgress(10);
|
|
168
91
|
try {
|
|
169
|
-
await orchestrator.generate({
|
|
92
|
+
await orchestrator.generate({
|
|
93
|
+
sourceBase64: sourceImage.base64,
|
|
94
|
+
targetBase64: targetImage.base64,
|
|
95
|
+
});
|
|
170
96
|
} catch {
|
|
171
97
|
setProgress(0);
|
|
172
98
|
}
|
|
173
|
-
}, [
|
|
99
|
+
}, [sourceImage.base64, targetImage.base64, orchestrator, showError]);
|
|
174
100
|
|
|
175
|
-
// Save handler
|
|
101
|
+
// Save handler
|
|
176
102
|
const save = useCallback(async () => {
|
|
177
103
|
if (!orchestrator.result) return;
|
|
178
104
|
|
|
@@ -186,22 +112,20 @@ export const useDualImageGeneration = (
|
|
|
186
112
|
|
|
187
113
|
// Reset handler
|
|
188
114
|
const reset = useCallback(() => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
setSourceBase64(null);
|
|
192
|
-
setTargetBase64(null);
|
|
115
|
+
sourceImage.reset();
|
|
116
|
+
targetImage.reset();
|
|
193
117
|
setProgress(0);
|
|
194
118
|
orchestrator.reset();
|
|
195
|
-
}, [orchestrator]);
|
|
119
|
+
}, [sourceImage, targetImage, orchestrator]);
|
|
196
120
|
|
|
197
121
|
return {
|
|
198
|
-
sourceImageUri,
|
|
199
|
-
targetImageUri,
|
|
122
|
+
sourceImageUri: sourceImage.uri,
|
|
123
|
+
targetImageUri: targetImage.uri,
|
|
200
124
|
processedUrl: orchestrator.result,
|
|
201
125
|
isProcessing: orchestrator.isGenerating,
|
|
202
126
|
progress,
|
|
203
|
-
selectSourceImage,
|
|
204
|
-
selectTargetImage,
|
|
127
|
+
selectSourceImage: sourceImage.pick,
|
|
128
|
+
selectTargetImage: targetImage.pick,
|
|
205
129
|
process,
|
|
206
130
|
save,
|
|
207
131
|
reset,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for useDualImageGeneration Hook
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { AlertMessages } from "./types";
|
|
6
|
+
|
|
7
|
+
export interface DualImageGenerationConfig {
|
|
8
|
+
/** AI model to use */
|
|
9
|
+
readonly model: string;
|
|
10
|
+
/** Function that returns the prompt (can depend on external state) */
|
|
11
|
+
readonly getPrompt: () => string;
|
|
12
|
+
/** User ID for credit operations */
|
|
13
|
+
readonly userId: string | undefined;
|
|
14
|
+
/** Credit cost per generation */
|
|
15
|
+
readonly creditCost: number;
|
|
16
|
+
/** Alert messages */
|
|
17
|
+
readonly alertMessages: AlertMessages;
|
|
18
|
+
/** Image aspect ratio for picker */
|
|
19
|
+
readonly imageAspect?: [number, number];
|
|
20
|
+
/** Callbacks */
|
|
21
|
+
readonly onCreditsExhausted?: () => void;
|
|
22
|
+
readonly onSuccess?: (imageUrl: string) => void;
|
|
23
|
+
readonly onError?: (error: string) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface DualImageGenerationReturn {
|
|
27
|
+
readonly sourceImageUri: string | null;
|
|
28
|
+
readonly targetImageUri: string | null;
|
|
29
|
+
readonly processedUrl: string | null;
|
|
30
|
+
readonly isProcessing: boolean;
|
|
31
|
+
readonly progress: number;
|
|
32
|
+
selectSourceImage(): Promise<void>;
|
|
33
|
+
selectTargetImage(): Promise<void>;
|
|
34
|
+
process(): Promise<void>;
|
|
35
|
+
save(): Promise<void>;
|
|
36
|
+
reset(): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GenerationInput {
|
|
40
|
+
sourceBase64: string;
|
|
41
|
+
targetBase64: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useImagePicker Hook
|
|
3
|
+
* Reusable hook for picking and preparing images with base64 conversion
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useState, useCallback } from "react";
|
|
7
|
+
import { MediaPickerService, MediaQuality } from "@umituz/react-native-design-system";
|
|
8
|
+
import { prepareImage } from "../../../infrastructure/utils/feature-utils";
|
|
9
|
+
|
|
10
|
+
declare const __DEV__: boolean;
|
|
11
|
+
|
|
12
|
+
export interface ImagePickerState {
|
|
13
|
+
readonly uri: string | null;
|
|
14
|
+
readonly base64: string | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface UseImagePickerOptions {
|
|
18
|
+
readonly aspect?: [number, number];
|
|
19
|
+
readonly onError?: (error: Error) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface UseImagePickerReturn {
|
|
23
|
+
readonly uri: string | null;
|
|
24
|
+
readonly base64: string | null;
|
|
25
|
+
readonly isLoading: boolean;
|
|
26
|
+
pick(): Promise<void>;
|
|
27
|
+
reset(): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const useImagePicker = (options: UseImagePickerOptions = {}): UseImagePickerReturn => {
|
|
31
|
+
const { aspect = [1, 1], onError } = options;
|
|
32
|
+
|
|
33
|
+
const [uri, setUri] = useState<string | null>(null);
|
|
34
|
+
const [base64, setBase64] = useState<string | null>(null);
|
|
35
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
36
|
+
|
|
37
|
+
const pick = useCallback(async () => {
|
|
38
|
+
try {
|
|
39
|
+
setIsLoading(true);
|
|
40
|
+
const result = await MediaPickerService.pickSingleImage({
|
|
41
|
+
allowsEditing: true,
|
|
42
|
+
quality: MediaQuality.HIGH,
|
|
43
|
+
aspect,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (!result.canceled && result.assets?.[0]) {
|
|
47
|
+
const asset = result.assets[0];
|
|
48
|
+
setUri(asset.uri);
|
|
49
|
+
const preparedBase64 = await prepareImage(asset.uri);
|
|
50
|
+
setBase64(preparedBase64);
|
|
51
|
+
}
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
54
|
+
console.error("[useImagePicker] Error:", error);
|
|
55
|
+
}
|
|
56
|
+
onError?.(error as Error);
|
|
57
|
+
} finally {
|
|
58
|
+
setIsLoading(false);
|
|
59
|
+
}
|
|
60
|
+
}, [aspect, onError]);
|
|
61
|
+
|
|
62
|
+
const reset = useCallback(() => {
|
|
63
|
+
setUri(null);
|
|
64
|
+
setBase64(null);
|
|
65
|
+
setIsLoading(false);
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
uri,
|
|
70
|
+
base64,
|
|
71
|
+
isLoading,
|
|
72
|
+
pick,
|
|
73
|
+
reset,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -8,6 +8,7 @@ export {
|
|
|
8
8
|
useImageGeneration,
|
|
9
9
|
useVideoGeneration,
|
|
10
10
|
useDualImageGeneration,
|
|
11
|
+
useImagePicker,
|
|
11
12
|
createGenerationError,
|
|
12
13
|
getAlertMessage,
|
|
13
14
|
parseError,
|
|
@@ -31,6 +32,9 @@ export type {
|
|
|
31
32
|
VideoGenerationConfig,
|
|
32
33
|
DualImageGenerationConfig,
|
|
33
34
|
DualImageGenerationReturn,
|
|
35
|
+
ImagePickerState,
|
|
36
|
+
UseImagePickerOptions,
|
|
37
|
+
UseImagePickerReturn,
|
|
34
38
|
} from "./generation";
|
|
35
39
|
|
|
36
40
|
export { useGeneration } from "./use-generation";
|
|
@@ -121,6 +121,7 @@ export const DualImageFeatureLayout: React.FC<DualImageFeatureLayoutProps> = ({
|
|
|
121
121
|
<AIGenerationForm
|
|
122
122
|
onGenerate={handleProcess}
|
|
123
123
|
isGenerating={feature.isProcessing}
|
|
124
|
+
isDisabled={!feature.sourceImageUri || !feature.targetImageUri}
|
|
124
125
|
progress={feature.progress}
|
|
125
126
|
translations={{
|
|
126
127
|
generateButton: translations.processButtonText,
|