@umituz/react-native-ai-generation-content 1.90.5 → 1.90.6

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.90.5",
3
+ "version": "1.90.6",
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",
@@ -15,7 +15,6 @@ import { useCallback, useMemo } from "react";
15
15
  import { useOffline } from "@umituz/react-native-design-system/offline";
16
16
  import { useAuth, useAuthModalStore } from "@umituz/react-native-auth";
17
17
  import {
18
- usePremiumStatus,
19
18
  useCredits,
20
19
  usePaywallVisibility,
21
20
  useFeatureGate,
@@ -47,11 +46,12 @@ export function useAIFeatureGate(options: AIFeatureGateOptions): AIFeatureGateRe
47
46
  const { isOffline } = useOffline();
48
47
  const { hasFirebaseUser } = useAuth();
49
48
  const { showAuthModal } = useAuthModalStore();
50
- const { isPremium } = usePremiumStatus();
51
49
  const { credits, isCreditsLoaded, isLoading: isCreditsLoading } = useCredits();
52
50
  const { openPaywall } = usePaywallVisibility();
53
51
  const creditBalance = credits?.credits ?? 0;
54
52
  const hasCredits = creditBalance >= creditCost;
53
+ // TODO: Replace with actual premium status check from subscription package
54
+ const isPremium = false;
55
55
 
56
56
  const { requireFeature: requireFeatureFromPackage } = useFeatureGate({
57
57
  isAuthenticated: hasFirebaseUser,
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Creation Domain Constants
3
+ * Centralized constants for creation field names, status, and validation
4
+ */
5
+
6
+ export {
7
+ CREATION_FIELDS,
8
+ UPDATABLE_FIELDS,
9
+ } from './creation-fields.constants';
10
+
11
+ // Re-export CreationFieldName as a type alias
12
+ import type { CreationFieldName } from './creation-fields.constants';
13
+ export type { CreationFieldName };
14
+
15
+ export {
16
+ CREATION_STATUS,
17
+ } from './creation-status.constants';
18
+
19
+ export {
20
+ CREATION_VALIDATION,
21
+ } from './creation-validation.constants';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Creation Format Utilities
3
- * Single Responsibility: Text formatting
3
+ * Single Responsibility: Text formatting and ID generation
4
4
  */
5
5
 
6
6
  /**
@@ -10,3 +10,10 @@ export function truncateText(text: string, maxLength: number): string {
10
10
  if (text.length <= maxLength) return text;
11
11
  return text.substring(0, maxLength - 3) + "...";
12
12
  }
13
+
14
+ /**
15
+ * Generate unique creation ID
16
+ */
17
+ export function generateCreationId(): string {
18
+ return `creation_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
19
+ }
@@ -5,11 +5,15 @@
5
5
 
6
6
  // Display utilities
7
7
  export {
8
- truncateText,
8
+ getTypeIcon,
9
+ getTypeTextKey,
10
+ getTypeText,
11
+ getCreationTitle,
9
12
  } from './creation-display.util';
10
13
 
11
14
  // Format utilities
12
15
  export {
16
+ truncateText,
13
17
  generateCreationId,
14
18
  } from './creation-format.util';
15
19
 
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Image-to-Video Domain Types
3
+ * Exports all domain types and constants
4
+ */
5
+
6
+ export * from './types';
@@ -18,5 +18,5 @@ export type {
18
18
  } from "./ImageSelectionGrid";
19
19
 
20
20
  // Action Components
21
- export { GenerateButton as ImageToVideoGenerateButton } from "../../../../presentation/components/buttons/GenerateButton";
22
- export type { GenerateButtonProps as ImageToVideoGenerateButtonProps } from "../../../../presentation/components/buttons/GenerateButton";
21
+ export { GenerateButton as ImageToVideoGenerateButton } from "../../../../../presentation/components/buttons/GenerateButton";
22
+ export type { GenerateButtonProps as ImageToVideoGenerateButtonProps } from "../../../../../presentation/components/buttons/GenerateButton";
@@ -17,6 +17,7 @@ export const INITIAL_STATE: ImageToVideoFeatureState = {
17
17
  motionPrompt: "",
18
18
  videoUrl: null,
19
19
  thumbnailUrl: null,
20
+ output: null,
20
21
  isProcessing: false,
21
22
  progress: 0,
22
23
  error: null,
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Image-to-Video Presentation Index
3
+ * Exports all presentation layer items (hooks and components)
4
+ */
5
+
6
+ // =============================================================================
7
+ // HOOKS
8
+ // =============================================================================
9
+
10
+ // Form State Hook
11
+ export { useImageToVideoFormState } from "./hooks";
12
+ export type {
13
+ UseImageToVideoFormStateOptions,
14
+ UseImageToVideoFormStateReturn,
15
+ } from "./hooks";
16
+
17
+ // Generation Hook
18
+ export { useImageToVideoGeneration } from "./hooks";
19
+ export type {
20
+ UseImageToVideoGenerationOptions,
21
+ UseImageToVideoGenerationReturn,
22
+ } from "./hooks";
23
+
24
+ // Combined Form Hook
25
+ export { useImageToVideoForm } from "./hooks";
26
+ export type {
27
+ UseImageToVideoFormOptions,
28
+ UseImageToVideoFormReturn,
29
+ } from "./hooks";
30
+
31
+ // Provider-based Feature Hook
32
+ export { useImageToVideoFeature } from "./hooks";
33
+ export type {
34
+ UseImageToVideoFeatureProps,
35
+ UseImageToVideoFeatureReturn,
36
+ } from "./hooks";
37
+
38
+ // =============================================================================
39
+ // COMPONENTS
40
+ // =============================================================================
41
+
42
+ export {
43
+ ImageToVideoAnimationStyleSelector,
44
+ ImageToVideoDurationSelector,
45
+ ImageToVideoSelectionGrid,
46
+ ImageToVideoGenerateButton,
47
+ } from "./components";
48
+
49
+ export type {
50
+ ImageToVideoAnimationStyleSelectorProps,
51
+ ImageToVideoDurationSelectorProps,
52
+ ImageToVideoSelectionGridProps,
53
+ ImageToVideoSelectionGridTranslations,
54
+ ImageToVideoGenerateButtonProps,
55
+ } from "./components";
@@ -60,9 +60,11 @@ class TextToImageExecutor extends BaseExecutor<
60
60
 
61
61
  protected transformResult(
62
62
  extracted: ExtractedImageResult,
63
+ request: TextToImageRequest,
63
64
  ): TextToImageResult {
64
65
  return {
65
66
  success: true,
67
+ requestId: request.meta.requestId,
66
68
  imageUrl: extracted.imageUrl,
67
69
  imageUrls: extracted.imageUrls,
68
70
  };
@@ -100,7 +102,11 @@ export async function executeTextToImage(
100
102
  if (isSuccess(result)) {
101
103
  return result.value;
102
104
  }
103
- return { success: false, error: result.error };
105
+ return {
106
+ success: false,
107
+ error: result.error,
108
+ requestId: request.meta.requestId,
109
+ };
104
110
  }
105
111
 
106
112
  /**
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Text-to-Video Domain Types
3
+ * Exports all domain types and constants
4
+ */
5
+
6
+ export * from './types';
@@ -38,6 +38,23 @@ export interface FrameData {
38
38
  order: number;
39
39
  }
40
40
 
41
+ /**
42
+ * Text-to-video generation state
43
+ * Tracks the progress of video generation
44
+ */
45
+ export interface TextToVideoGenerationState {
46
+ isGenerating: boolean;
47
+ error: string | null;
48
+ }
49
+
50
+ /**
51
+ * Initial generation state
52
+ */
53
+ export const INITIAL_GENERATION_STATE: TextToVideoGenerationState = {
54
+ isGenerating: false,
55
+ error: null,
56
+ };
57
+
41
58
  /**
42
59
  * Initial form state
43
60
  */
@@ -82,9 +82,11 @@ class TextToVideoExecutor extends BaseExecutor<
82
82
 
83
83
  protected transformResult(
84
84
  extracted: ExtractedVideoResult,
85
+ request: TextToVideoRequest,
85
86
  ): TextToVideoResult {
86
87
  return {
87
88
  success: true,
89
+ requestId: request.meta.requestId,
88
90
  videoUrl: extracted.videoUrl,
89
91
  thumbnailUrl: extracted.thumbnailUrl,
90
92
  };
@@ -122,7 +124,11 @@ export async function executeTextToVideo(
122
124
  if (isSuccess(result)) {
123
125
  return result.value;
124
126
  }
125
- return { success: false, error: result.error };
127
+ return {
128
+ success: false,
129
+ error: result.error,
130
+ requestId: request.meta.requestId,
131
+ };
126
132
  }
127
133
 
128
134
  /**
@@ -14,4 +14,4 @@ export { useTextToVideoForm } from "./useTextToVideoForm";
14
14
  export type {
15
15
  UseTextToVideoFormProps,
16
16
  UseTextToVideoFormReturn,
17
- } from "./useTextToVideoForm";
17
+ } from "./useTextToVideoForm.types";
@@ -5,10 +5,12 @@ import type {
5
5
  TextToVideoConfig,
6
6
  TextToVideoCallbacks,
7
7
  TextToVideoResult,
8
+ TextToVideoRequest,
8
9
  TextToVideoOptions,
9
10
  TextToVideoInputBuilder,
10
11
  TextToVideoResultExtractor,
11
12
  } from "../../domain/types";
13
+ import type { BaseRequestMeta } from "../../../../shared-kernel/base-types";
12
14
 
13
15
  interface VideoGenerationInput {
14
16
  prompt: string;
@@ -36,6 +38,19 @@ export const createTextToVideoStrategy = (
36
38
  execute: async (input) => {
37
39
  creationIdRef.current = input.creationId;
38
40
 
41
+ const meta: BaseRequestMeta = {
42
+ requestId: input.creationId,
43
+ userId,
44
+ timestamp: Date.now(),
45
+ priority: "normal",
46
+ };
47
+
48
+ const request: TextToVideoRequest = {
49
+ prompt: input.prompt,
50
+ options: input.options,
51
+ meta,
52
+ };
53
+
39
54
  callbacks.onGenerationStart?.({
40
55
  creationId: input.creationId,
41
56
  type: "text-to-video",
@@ -48,7 +63,7 @@ export const createTextToVideoStrategy = (
48
63
  });
49
64
 
50
65
  const result = await executeTextToVideo(
51
- { prompt: input.prompt, userId, options: input.options },
66
+ request,
52
67
  { model: config.model, buildInput, extractResult },
53
68
  );
54
69
 
@@ -60,6 +75,7 @@ export const createTextToVideoStrategy = (
60
75
 
61
76
  return {
62
77
  success: true,
78
+ requestId: result.requestId,
63
79
  videoUrl: result.videoUrl,
64
80
  thumbnailUrl: result.thumbnailUrl,
65
81
  };
@@ -38,6 +38,7 @@ const INITIAL_STATE: TextToVideoFeatureState = {
38
38
  prompt: "",
39
39
  videoUrl: null,
40
40
  thumbnailUrl: null,
41
+ output: null,
41
42
  isProcessing: false,
42
43
  progress: 0,
43
44
  error: null,
@@ -84,23 +85,29 @@ export function useTextToVideoFeature(props: UseTextToVideoFeatureProps): UseTex
84
85
  if (!prompt.trim()) {
85
86
  const error = "Prompt is required";
86
87
  setState((prev) => ({ ...prev, error }));
87
- return { success: false, error };
88
+ return { success: false, error, requestId: generateCreationId("text-to-video") };
88
89
  }
89
90
 
90
91
  setState((prev) => ({ ...prev, isProcessing: true, error: null, progress: 0 }));
92
+ const requestId = generateCreationId("text-to-video");
91
93
 
92
94
  try {
93
95
  const result = await orchestrator.generate({
94
96
  prompt: prompt.trim(),
95
97
  options: params,
96
- creationId: generateCreationId("text-to-video"),
98
+ creationId: requestId,
97
99
  });
98
100
  setState((prev) => ({ ...prev, isProcessing: false }));
99
- return { success: true, videoUrl: (result as TextToVideoResult)?.videoUrl };
101
+ return {
102
+ success: true,
103
+ requestId,
104
+ videoUrl: (result as TextToVideoResult)?.videoUrl || null,
105
+ thumbnailUrl: (result as TextToVideoResult)?.thumbnailUrl || null,
106
+ };
100
107
  } catch (error) {
101
108
  const message = error instanceof Error ? error.message : "Generation failed";
102
109
  setState((prev) => ({ ...prev, isProcessing: false, error: message }));
103
- return { success: false, error: message };
110
+ return { success: false, error: message, requestId };
104
111
  }
105
112
  },
106
113
  [state.prompt, orchestrator],
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Text-to-Video Presentation Index
3
+ * Exports all presentation layer items (hooks and components)
4
+ */
5
+
6
+ // =============================================================================
7
+ // HOOKS
8
+ // =============================================================================
9
+
10
+ export { useTextToVideoFeature } from "./hooks";
11
+ export type {
12
+ UseTextToVideoFeatureProps,
13
+ UseTextToVideoFeatureReturn,
14
+ TextToVideoGenerateParams,
15
+ } from "./hooks";
16
+
17
+ export { useTextToVideoForm } from "./hooks";
18
+ export type {
19
+ UseTextToVideoFormProps,
20
+ UseTextToVideoFormReturn,
21
+ } from "./hooks";
22
+
23
+ // =============================================================================
24
+ // COMPONENTS
25
+ // =============================================================================
26
+
27
+ export {
28
+ GenerationTabs,
29
+ FrameSelector,
30
+ OptionsPanel,
31
+ HeroSection,
32
+ HintCarousel,
33
+ } from "./components";
@@ -3,7 +3,7 @@
3
3
  * Singleton for storing app-provided service implementations
4
4
  */
5
5
 
6
- import type { IAppServices, PartialAppServices } from "../../domain/interfaces/app-services.interface";
6
+ import type { IAppServices, PartialAppServices } from "../../domain/interfaces/app-services-composite.interface";
7
7
 
8
8
 
9
9
  let appServices: IAppServices | null = null;
@@ -52,7 +52,7 @@ export abstract class BaseExecutor<TRequest, TResult, TOutput> {
52
52
  onProgress?: (progress: number) => void,
53
53
  ): Promise<unknown>;
54
54
  protected abstract validateExtractedResult(extracted: TOutput | undefined): string | undefined;
55
- protected abstract transformResult(extracted: TOutput): TResult;
55
+ protected abstract transformResult(extracted: TOutput, request: TRequest): TResult;
56
56
  protected abstract getDefaultExtractor(): (result: unknown) => TOutput | undefined;
57
57
 
58
58
  private getProvider(): { provider: IAIProvider; error: null } | { provider: null; error: string } {
@@ -84,7 +84,7 @@ export abstract class BaseExecutor<TRequest, TResult, TOutput> {
84
84
  return failure(error);
85
85
  }
86
86
 
87
- return success(this.transformResult(extracted as TOutput));
87
+ return success(this.transformResult(extracted as TOutput, request));
88
88
  }
89
89
 
90
90
  protected log(level: "info" | "error", message: string): void {
@@ -2,13 +2,19 @@
2
2
  * Shared Validation Utilities
3
3
  */
4
4
 
5
- // Export types from base-validator.types
6
- export type {
5
+ import type {
7
6
  ValidationResult,
8
7
  StringValidationOptions,
9
8
  NumericValidationOptions,
10
9
  } from "../../../infrastructure/validation/base-validator.types";
11
10
 
11
+ // Re-export types
12
+ export type {
13
+ ValidationResult,
14
+ StringValidationOptions,
15
+ NumericValidationOptions,
16
+ };
17
+
12
18
  // Export functions from advanced-validator
13
19
  export { combineValidationResults } from "../../../infrastructure/validation/advanced-validator";
14
20