@umituz/react-native-ai-generation-content 1.65.1 → 1.65.2

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.
Files changed (152) hide show
  1. package/package.json +1 -1
  2. package/src/domain/constants/processing-modes-catalog.constants.ts +97 -0
  3. package/src/domain/constants/processing-modes-filters.ts +34 -0
  4. package/src/domain/constants/processing-modes-getters.ts +20 -0
  5. package/src/domain/constants/processing-modes.constants.ts +8 -134
  6. package/src/domain/entities/feature-flow-config.types.ts +17 -0
  7. package/src/domain/entities/flow-actions.types.ts +26 -0
  8. package/src/domain/entities/flow-config-data.types.ts +41 -0
  9. package/src/domain/entities/flow-config.types.ts +17 -169
  10. package/src/domain/entities/flow-configuration.types.ts +44 -0
  11. package/src/domain/entities/flow-state.types.ts +30 -0
  12. package/src/domain/entities/flow-step.types.ts +56 -0
  13. package/src/domain/entities/scenario-step-config.types.ts +32 -0
  14. package/src/domain/entities/step-config.types.ts +14 -129
  15. package/src/domain/entities/step-definition.types.ts +50 -0
  16. package/src/domain/entities/step-input-config.types.ts +36 -0
  17. package/src/domain/entities/step-upload-config.types.ts +17 -0
  18. package/src/domain/interfaces/ai-provider-capabilities.types.ts +27 -0
  19. package/src/domain/interfaces/ai-provider-config.types.ts +30 -0
  20. package/src/domain/interfaces/ai-provider-feature-types.ts +22 -0
  21. package/src/domain/interfaces/ai-provider-input.types.ts +28 -0
  22. package/src/domain/interfaces/ai-provider-progress.types.ts +37 -0
  23. package/src/domain/interfaces/ai-provider-status.types.ts +41 -0
  24. package/src/domain/interfaces/ai-provider.interface.ts +32 -142
  25. package/src/domain/types/result-constructors.ts +20 -0
  26. package/src/domain/types/result-guards.ts +20 -0
  27. package/src/domain/types/result-transformers.ts +36 -0
  28. package/src/domain/types/result-type-definitions.ts +27 -0
  29. package/src/domain/types/result-unwrappers.ts +28 -0
  30. package/src/domain/types/result.types.ts +11 -100
  31. package/src/domains/background/infrastructure/utils/polling-interval.util.ts +3 -8
  32. package/src/domains/background/infrastructure/utils/result-validation-logic.ts +88 -0
  33. package/src/domains/background/infrastructure/utils/result-validator-constants.ts +18 -0
  34. package/src/domains/background/infrastructure/utils/result-validator.types.ts +16 -0
  35. package/src/domains/background/infrastructure/utils/result-validator.util.ts +8 -109
  36. package/src/domains/background/infrastructure/utils/status-checker.types.ts +11 -0
  37. package/src/domains/background/infrastructure/utils/status-checker.util.ts +9 -119
  38. package/src/domains/background/infrastructure/utils/status-error-detector.ts +61 -0
  39. package/src/domains/background/infrastructure/utils/status-extraction-helpers.ts +25 -0
  40. package/src/domains/background/infrastructure/utils/status-predicates.ts +37 -0
  41. package/src/domains/creations/domain-exports.ts +79 -0
  42. package/src/domains/creations/index.ts +9 -169
  43. package/src/domains/creations/infrastructure-exports.ts +9 -0
  44. package/src/domains/creations/presentation-exports.ts +59 -0
  45. package/src/domains/generation/infrastructure/executors/text-to-image-executor.helpers.ts +81 -0
  46. package/src/domains/generation/infrastructure/executors/text-to-image-executor.ts +4 -100
  47. package/src/domains/generation/infrastructure/executors/text-to-image-executor.types.ts +19 -0
  48. package/src/domains/generation/infrastructure/flow/use-flow-store.types.ts +19 -0
  49. package/src/domains/generation/infrastructure/flow/useFlowStore.ts +33 -65
  50. package/src/domains/generation/wizard/domain/entities/wizard-config-builder.ts +75 -0
  51. package/src/domains/generation/wizard/domain/entities/wizard-feature-config.types.ts +29 -0
  52. package/src/domains/generation/wizard/domain/entities/wizard-feature.types.ts +9 -114
  53. package/src/domains/generation/wizard/domain/entities/wizard-presets.constants.ts +23 -0
  54. package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts +1 -1
  55. package/src/domains/generation/wizard/infrastructure/utils/creation-persistence-factory.ts +33 -0
  56. package/src/domains/generation/wizard/infrastructure/utils/creation-persistence.types.ts +22 -0
  57. package/src/domains/generation/wizard/infrastructure/utils/creation-persistence.util.ts +11 -135
  58. package/src/domains/generation/wizard/infrastructure/utils/creation-save-operations.ts +48 -0
  59. package/src/domains/generation/wizard/infrastructure/utils/creation-update-operations.ts +72 -0
  60. package/src/domains/generation/wizard/presentation/hooks/use-video-queue-generation.types.ts +21 -0
  61. package/src/domains/generation/wizard/presentation/hooks/useVideoQueueGeneration.ts +14 -35
  62. package/src/domains/image-to-video/domain/types/image-to-video-callbacks.types.ts +33 -0
  63. package/src/domains/image-to-video/domain/types/image-to-video-config.types.ts +29 -0
  64. package/src/domains/image-to-video/domain/types/image-to-video-request.types.ts +31 -0
  65. package/src/domains/image-to-video/domain/types/image-to-video-result.types.ts +17 -0
  66. package/src/domains/image-to-video/domain/types/image-to-video-state.types.ts +24 -0
  67. package/src/domains/image-to-video/domain/types/image-to-video.types.ts +24 -114
  68. package/src/domains/image-to-video/infrastructure/services/image-to-video-executor.ts +26 -99
  69. package/src/domains/image-to-video/infrastructure/services/image-to-video-executor.types.ts +15 -0
  70. package/src/domains/prompts/domain/base/constants.ts +47 -0
  71. package/src/domains/prompts/domain/base/creators.ts +76 -0
  72. package/src/domains/prompts/domain/base/types.ts +10 -0
  73. package/src/domains/prompts/domain/entities/MultiPersonPromptStructure.ts +1 -1
  74. package/src/domains/prompts/index.ts +4 -2
  75. package/src/domains/prompts/infrastructure/services/ImagePromptBuilder.ts +2 -72
  76. package/src/domains/prompts/infrastructure/services/image-prompt-builder.types.ts +17 -0
  77. package/src/domains/result-preview/presentation/types/result-components.types.ts +47 -0
  78. package/src/domains/result-preview/presentation/types/result-creation.types.ts +14 -0
  79. package/src/domains/result-preview/presentation/types/result-data.types.ts +35 -0
  80. package/src/domains/result-preview/presentation/types/result-hooks.types.ts +35 -0
  81. package/src/domains/result-preview/presentation/types/result-preview.types.ts +19 -182
  82. package/src/domains/result-preview/presentation/types/result-screen.types.ts +69 -0
  83. package/src/domains/text-to-image/domain-exports.ts +50 -0
  84. package/src/domains/text-to-image/index.ts +11 -102
  85. package/src/domains/text-to-image/infrastructure-exports.ts +6 -0
  86. package/src/domains/text-to-image/presentation/hooks/useFormState.ts +39 -24
  87. package/src/domains/text-to-image/presentation/hooks/useGeneration.ts +5 -3
  88. package/src/domains/text-to-image/presentation-exports.ts +41 -0
  89. package/src/domains/text-to-video/domain/types/action-component.types.ts +15 -0
  90. package/src/domains/text-to-video/domain/types/component.types.ts +16 -103
  91. package/src/domains/text-to-video/domain/types/content-component.types.ts +30 -0
  92. package/src/domains/text-to-video/domain/types/panel-component.types.ts +24 -0
  93. package/src/domains/text-to-video/domain/types/selector-component.types.ts +31 -0
  94. package/src/domains/text-to-video/domain/types/tab-component.types.ts +26 -0
  95. package/src/index.ts +0 -10
  96. package/src/infrastructure/executors/base-executor.ts +40 -112
  97. package/src/infrastructure/executors/base-executor.types.ts +10 -0
  98. package/src/infrastructure/http/http-client-methods.ts +73 -0
  99. package/src/infrastructure/http/http-client.util.ts +8 -163
  100. package/src/infrastructure/http/http-fetch-handler.ts +53 -0
  101. package/src/infrastructure/http/http-methods.constants.ts +23 -0
  102. package/src/infrastructure/http/http-request-executor.ts +49 -0
  103. package/src/infrastructure/http/http-response-parser.ts +53 -0
  104. package/src/infrastructure/orchestration/GenerationOrchestrator.ts +8 -43
  105. package/src/infrastructure/utils/classifier-helpers.ts +36 -0
  106. package/src/infrastructure/utils/content-validators.ts +92 -0
  107. package/src/infrastructure/utils/domain-guards.ts +22 -0
  108. package/src/infrastructure/utils/error-classification.ts +122 -0
  109. package/src/infrastructure/utils/error-classifier.util.ts +8 -181
  110. package/src/infrastructure/utils/error-classifiers.ts +49 -0
  111. package/src/infrastructure/utils/error-extractors.ts +42 -0
  112. package/src/infrastructure/utils/error-factory.ts +25 -0
  113. package/src/infrastructure/utils/error-handlers.ts +51 -0
  114. package/src/infrastructure/utils/error-handling.util.ts +7 -186
  115. package/src/infrastructure/utils/error-message-extractor.util.ts +10 -172
  116. package/src/infrastructure/utils/error-retry.ts +44 -0
  117. package/src/infrastructure/utils/error-types.ts +23 -0
  118. package/src/infrastructure/utils/extraction-types.ts +37 -0
  119. package/src/infrastructure/utils/fal-error-checker.ts +44 -0
  120. package/src/infrastructure/utils/general-validators.ts +64 -0
  121. package/src/infrastructure/utils/id-validators.ts +39 -0
  122. package/src/infrastructure/utils/message-extractor.ts +89 -0
  123. package/src/infrastructure/utils/primitive-guards.ts +66 -0
  124. package/src/infrastructure/utils/result-polling.ts +39 -0
  125. package/src/infrastructure/utils/structure-guards.ts +75 -0
  126. package/src/infrastructure/utils/type-guards.util.ts +22 -149
  127. package/src/infrastructure/utils/validation-types.ts +8 -0
  128. package/src/infrastructure/utils/validation.util.ts +14 -184
  129. package/src/presentation/hooks/ai-feature-callbacks-auth.hooks.ts +43 -0
  130. package/src/presentation/hooks/ai-feature-callbacks-cost.hooks.ts +56 -0
  131. package/src/presentation/hooks/ai-feature-callbacks-execution.hooks.ts +66 -0
  132. package/src/presentation/hooks/ai-feature-callbacks.types.ts +69 -0
  133. package/src/presentation/hooks/generation/use-image-generation.types.ts +39 -0
  134. package/src/presentation/hooks/generation/useImageGeneration.ts +33 -99
  135. package/src/presentation/hooks/generation-flow-navigation.ts +58 -0
  136. package/src/presentation/hooks/generation-flow-updates.ts +67 -0
  137. package/src/presentation/hooks/generation-flow.types.ts +32 -0
  138. package/src/presentation/hooks/useAIFeatureCallbacks.ts +48 -138
  139. package/src/presentation/hooks/useGenerationFlow.ts +40 -136
  140. package/src/presentation/types/flow-config.types.ts +9 -140
  141. package/src/presentation/types/flow-generation-config.types.ts +25 -0
  142. package/src/presentation/types/flow-state.types.ts +16 -0
  143. package/src/presentation/types/flow-step-configs.types.ts +48 -0
  144. package/src/presentation/types/flow-step-data.types.ts +24 -0
  145. package/src/presentation/types/result-actions.types.ts +50 -0
  146. package/src/presentation/types/result-config.types.ts +22 -171
  147. package/src/presentation/types/result-header.types.ts +44 -0
  148. package/src/presentation/types/result-image.types.ts +29 -0
  149. package/src/presentation/types/result-layout.types.ts +26 -0
  150. package/src/presentation/types/result-story.types.ts +42 -0
  151. package/src/domains/prompts/domain/entities/BasePromptStructure.ts +0 -168
  152. package/src/exports/domains.ts +0 -149
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.65.1",
3
+ "version": "1.65.2",
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",
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Processing Modes Catalog
3
+ * Domain Knowledge: Pre-configured image processing modes
4
+ */
5
+
6
+ import type { ModeCatalog } from "../entities/processing-modes.types";
7
+
8
+ export const DEFAULT_PROCESSING_MODES: ModeCatalog = {
9
+ clean_white: {
10
+ id: "clean_white",
11
+ icon: "square",
12
+ cost: 1,
13
+ premium: false,
14
+ requiresPrompt: false,
15
+ aiPrompt: `Replace the background with a clean, pure white background.
16
+ Keep the subject perfectly intact with professional edges.
17
+ Add subtle shadows beneath the subject for a grounded look.
18
+ This should look like a professional product or portrait photo.`,
19
+ },
20
+ portrait_blur: {
21
+ id: "portrait_blur",
22
+ icon: "person",
23
+ cost: 1,
24
+ premium: false,
25
+ requiresPrompt: false,
26
+ aiPrompt: `Create a professional portrait with a beautifully blurred background (bokeh effect).
27
+ Keep the subject in sharp focus with clean edges.
28
+ The background should have a soft, creamy blur similar to f/1.4 depth of field.
29
+ Maintain natural skin tones and lighting on the subject.`,
30
+ },
31
+ creative_scene: {
32
+ id: "creative_scene",
33
+ icon: "image",
34
+ cost: 2,
35
+ premium: false,
36
+ requiresPrompt: true,
37
+ aiPrompt: `Transform this image by placing the subject in a new creative scene.
38
+ The subject must remain completely unchanged - same pose, expression, clothing.
39
+ Seamlessly blend the subject into the new background with matched lighting.
40
+ Create a professional, realistic composite that looks natural.`,
41
+ },
42
+ transparent: {
43
+ id: "transparent",
44
+ icon: "remove-circle",
45
+ cost: 1,
46
+ premium: false,
47
+ requiresPrompt: false,
48
+ aiPrompt: `Remove the background completely from this image.
49
+ Keep the main subject perfectly intact with clean edges.
50
+ Output should have a transparent or solid white background.
51
+ Maintain all original details, colors, and lighting on the subject.`,
52
+ },
53
+ enhance: {
54
+ id: "enhance",
55
+ icon: "sparkles",
56
+ cost: 2,
57
+ premium: false,
58
+ requiresPrompt: false,
59
+ aiPrompt: `Enhance this image with professional quality improvements.
60
+ Improve lighting, color balance, and overall image quality.
61
+ Remove any imperfections while maintaining natural appearance.
62
+ The result should look professionally retouched but realistic.`,
63
+ },
64
+ remove_object: {
65
+ id: "remove_object",
66
+ icon: "trash",
67
+ cost: 2,
68
+ premium: true,
69
+ requiresPrompt: true,
70
+ aiPrompt: `Remove unwanted objects from this image.
71
+ Fill the removed areas with appropriate background content.
72
+ The result should look natural with no visible artifacts.
73
+ Maintain the overall composition and quality of the image.`,
74
+ },
75
+ replace_object: {
76
+ id: "replace_object",
77
+ icon: "swap-horizontal",
78
+ cost: 3,
79
+ premium: true,
80
+ requiresPrompt: true,
81
+ aiPrompt: `Replace the specified object in this image with a new one.
82
+ The replacement should blend naturally with the scene.
83
+ Match the lighting, perspective, and style of the original.
84
+ Ensure the result looks realistic and professionally edited.`,
85
+ },
86
+ relight: {
87
+ id: "relight",
88
+ icon: "sunny",
89
+ cost: 2,
90
+ premium: true,
91
+ requiresPrompt: true,
92
+ aiPrompt: `Relight this image with professional studio lighting.
93
+ Apply dramatic, flattering light that enhances the subject.
94
+ Add subtle shadows and highlights for depth and dimension.
95
+ The result should look like a professional studio photograph.`,
96
+ },
97
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Processing Modes Filters
3
+ * Domain Service: Filter modes by criteria
4
+ */
5
+
6
+ import type { ModeCatalog } from "../entities/processing-modes.types";
7
+ import { DEFAULT_PROCESSING_MODES } from "./processing-modes-catalog.constants";
8
+
9
+ /**
10
+ * Filter modes by premium status (free modes only)
11
+ */
12
+ export function getFreeModes(modes: ModeCatalog = DEFAULT_PROCESSING_MODES): ModeCatalog {
13
+ return Object.fromEntries(
14
+ Object.entries(modes).filter(([, config]) => !config.premium)
15
+ );
16
+ }
17
+
18
+ /**
19
+ * Filter modes by premium status (premium modes only)
20
+ */
21
+ export function getPremiumModes(modes: ModeCatalog = DEFAULT_PROCESSING_MODES): ModeCatalog {
22
+ return Object.fromEntries(
23
+ Object.entries(modes).filter(([, config]) => config.premium)
24
+ );
25
+ }
26
+
27
+ /**
28
+ * Get modes that require custom prompts
29
+ */
30
+ export function getPromptRequiredModes(modes: ModeCatalog = DEFAULT_PROCESSING_MODES): ModeCatalog {
31
+ return Object.fromEntries(
32
+ Object.entries(modes).filter(([, config]) => config.requiresPrompt)
33
+ );
34
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Processing Modes Getters
3
+ * Domain Service: Retrieve mode configurations
4
+ */
5
+
6
+ import type { ImageProcessingMode, ModeCatalog, ModeConfig } from "../entities/processing-modes.types";
7
+ import { DEFAULT_PROCESSING_MODES } from "./processing-modes-catalog.constants";
8
+
9
+ /**
10
+ * Get mode configuration by ID
11
+ * Returns default transparent mode if not found
12
+ */
13
+ export function getModeConfig(
14
+ mode: string,
15
+ customModes?: ModeCatalog
16
+ ): ModeConfig {
17
+ const modes = customModes || DEFAULT_PROCESSING_MODES;
18
+ const key = mode.replace("-", "_") as ImageProcessingMode;
19
+ return modes[key] || DEFAULT_PROCESSING_MODES.transparent;
20
+ }
@@ -1,138 +1,12 @@
1
1
  /**
2
- * Default Image Processing Modes
2
+ * Processing Modes - Barrel Export
3
3
  * Pre-configured modes for common image processing tasks
4
- * Apps can use these defaults or provide their own configurations
4
+ *
5
+ * Architecture:
6
+ * - Domain Knowledge: Mode catalog (modes and their configurations)
7
+ * - Domain Services: Filters and getters for mode access
5
8
  */
6
9
 
7
- import type { ImageProcessingMode, ModeCatalog, ModeConfig } from "../entities/processing-modes.types";
8
-
9
- export const DEFAULT_PROCESSING_MODES: ModeCatalog = {
10
- clean_white: {
11
- id: "clean_white",
12
- icon: "square",
13
- cost: 1,
14
- premium: false,
15
- requiresPrompt: false,
16
- aiPrompt: `Replace the background with a clean, pure white background.
17
- Keep the subject perfectly intact with professional edges.
18
- Add subtle shadows beneath the subject for a grounded look.
19
- This should look like a professional product or portrait photo.`,
20
- },
21
- portrait_blur: {
22
- id: "portrait_blur",
23
- icon: "person",
24
- cost: 1,
25
- premium: false,
26
- requiresPrompt: false,
27
- aiPrompt: `Create a professional portrait with a beautifully blurred background (bokeh effect).
28
- Keep the subject in sharp focus with clean edges.
29
- The background should have a soft, creamy blur similar to f/1.4 depth of field.
30
- Maintain natural skin tones and lighting on the subject.`,
31
- },
32
- creative_scene: {
33
- id: "creative_scene",
34
- icon: "image",
35
- cost: 2,
36
- premium: false,
37
- requiresPrompt: true,
38
- aiPrompt: `Transform this image by placing the subject in a new creative scene.
39
- The subject must remain completely unchanged - same pose, expression, clothing.
40
- Seamlessly blend the subject into the new background with matched lighting.
41
- Create a professional, realistic composite that looks natural.`,
42
- },
43
- transparent: {
44
- id: "transparent",
45
- icon: "remove-circle",
46
- cost: 1,
47
- premium: false,
48
- requiresPrompt: false,
49
- aiPrompt: `Remove the background completely from this image.
50
- Keep the main subject perfectly intact with clean edges.
51
- Output should have a transparent or solid white background.
52
- Maintain all original details, colors, and lighting on the subject.`,
53
- },
54
- enhance: {
55
- id: "enhance",
56
- icon: "sparkles",
57
- cost: 2,
58
- premium: false,
59
- requiresPrompt: false,
60
- aiPrompt: `Enhance this image with professional quality improvements.
61
- Improve lighting, color balance, and overall image quality.
62
- Remove any imperfections while maintaining natural appearance.
63
- The result should look professionally retouched but realistic.`,
64
- },
65
- remove_object: {
66
- id: "remove_object",
67
- icon: "trash",
68
- cost: 2,
69
- premium: true,
70
- requiresPrompt: true,
71
- aiPrompt: `Remove unwanted objects from this image.
72
- Fill the removed areas with appropriate background content.
73
- The result should look natural with no visible artifacts.
74
- Maintain the overall composition and quality of the image.`,
75
- },
76
- replace_object: {
77
- id: "replace_object",
78
- icon: "swap-horizontal",
79
- cost: 3,
80
- premium: true,
81
- requiresPrompt: true,
82
- aiPrompt: `Replace the specified object in this image with a new one.
83
- The replacement should blend naturally with the scene.
84
- Match the lighting, perspective, and style of the original.
85
- Ensure the result looks realistic and professionally edited.`,
86
- },
87
- relight: {
88
- id: "relight",
89
- icon: "sunny",
90
- cost: 2,
91
- premium: true,
92
- requiresPrompt: true,
93
- aiPrompt: `Relight this image with professional studio lighting.
94
- Apply dramatic, flattering light that enhances the subject.
95
- Add subtle shadows and highlights for depth and dimension.
96
- The result should look like a professional studio photograph.`,
97
- },
98
- };
99
-
100
- /**
101
- * Get mode configuration by ID
102
- * Returns default transparent mode if not found
103
- */
104
- export const getModeConfig = (
105
- mode: string,
106
- customModes?: ModeCatalog
107
- ): ModeConfig => {
108
- const modes = customModes || DEFAULT_PROCESSING_MODES;
109
- const key = mode.replace("-", "_") as ImageProcessingMode;
110
- return modes[key] || DEFAULT_PROCESSING_MODES.transparent;
111
- };
112
-
113
- /**
114
- * Filter modes by premium status
115
- */
116
- export const getFreeModes = (modes: ModeCatalog = DEFAULT_PROCESSING_MODES): ModeCatalog => {
117
- return Object.fromEntries(
118
- Object.entries(modes).filter(([, config]) => !config.premium)
119
- );
120
- };
121
-
122
- /**
123
- * Filter modes by premium status
124
- */
125
- export const getPremiumModes = (modes: ModeCatalog = DEFAULT_PROCESSING_MODES): ModeCatalog => {
126
- return Object.fromEntries(
127
- Object.entries(modes).filter(([, config]) => config.premium)
128
- );
129
- };
130
-
131
- /**
132
- * Get modes that require custom prompts
133
- */
134
- export const getPromptRequiredModes = (modes: ModeCatalog = DEFAULT_PROCESSING_MODES): ModeCatalog => {
135
- return Object.fromEntries(
136
- Object.entries(modes).filter(([, config]) => config.requiresPrompt)
137
- );
138
- };
10
+ export { DEFAULT_PROCESSING_MODES } from "./processing-modes-catalog.constants";
11
+ export { getFreeModes, getPremiumModes, getPromptRequiredModes } from "./processing-modes-filters";
12
+ export { getModeConfig } from "./processing-modes-getters";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Feature Flow Configuration Types
3
+ */
4
+
5
+ import type { DynamicStepDefinition } from "./step-definition.types";
6
+
7
+ /**
8
+ * Feature Flow Configuration
9
+ * Defines complete flow for a feature/scenario
10
+ */
11
+ export interface FeatureFlowConfig {
12
+ readonly id: string;
13
+ readonly name: string;
14
+ readonly steps: readonly DynamicStepDefinition[];
15
+ readonly initialStepId?: string;
16
+ readonly onComplete?: (data: Record<string, unknown>) => void | Promise<void>;
17
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Flow Actions Types
3
+ */
4
+
5
+ import type { FlowUploadedImageData } from "./flow-config-data.types";
6
+
7
+ /** Flow Actions */
8
+ export interface FlowActions {
9
+ goToStep: (stepId: string) => void;
10
+ nextStep: () => void;
11
+ previousStep: () => void;
12
+ setCategory: (category: unknown) => void;
13
+ setScenario: (scenario: unknown) => void;
14
+ setPartnerImage: (partnerId: string, image: FlowUploadedImageData | undefined) => void;
15
+ setPartnerName: (partnerId: string, name: string) => void;
16
+ setTextInput: (text: string) => void;
17
+ setVisualStyle: (styleId: string) => void;
18
+ setSelectedFeatures: (featureType: string, ids: readonly string[]) => void;
19
+ setCustomData: (key: string, value: unknown) => void;
20
+ startGeneration: () => void;
21
+ updateProgress: (progress: number) => void;
22
+ setResult: (result: unknown) => void;
23
+ setError: (error: string) => void;
24
+ reset: () => void;
25
+ completeStep: (stepId: string) => void;
26
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Flow Configuration Data Types
3
+ */
4
+
5
+ /** Auth Gate Configuration */
6
+ export interface AuthGateConfig {
7
+ readonly allowAnonymous?: boolean;
8
+ readonly onAuthRequired?: () => void;
9
+ readonly onAuthSuccess?: () => void;
10
+ }
11
+
12
+ /** Credit Gate Configuration */
13
+ export interface CreditGateConfig {
14
+ readonly requiredCredits: number;
15
+ readonly onCreditsExhausted?: () => void;
16
+ readonly onCreditsAvailable?: () => void;
17
+ }
18
+
19
+ /** Partner Configuration */
20
+ export interface PartnerConfig {
21
+ readonly partnerId: "A" | "B" | "single";
22
+ readonly showNameInput?: boolean;
23
+ readonly showFaceDetection?: boolean;
24
+ readonly showPhotoTips?: boolean;
25
+ readonly maxNameLength?: number;
26
+ }
27
+
28
+ /** Visual Style Option */
29
+ export interface FlowVisualStyleData {
30
+ readonly id: string;
31
+ readonly icon: string;
32
+ readonly labelKey: string;
33
+ readonly promptModifier?: string;
34
+ }
35
+
36
+ /** Uploaded Image Data */
37
+ export interface FlowUploadedImageData {
38
+ readonly uri: string;
39
+ readonly base64: string;
40
+ readonly mimeType: string;
41
+ }
@@ -1,173 +1,21 @@
1
1
  /**
2
- * Flow Configuration Types
2
+ * Flow Configuration Types - Barrel Export
3
3
  * Generic multi-step flow system for AI generation
4
4
  */
5
5
 
6
- /** Step Types */
7
- export enum StepType {
8
- // Gate steps - auth and credits check
9
- AUTH_GATE = "auth_gate",
10
- CREDIT_GATE = "credit_gate",
11
- // Content steps
12
- CATEGORY_SELECTION = "category_selection",
13
- SCENARIO_SELECTION = "scenario_selection",
14
- SCENARIO_PREVIEW = "scenario_preview",
15
- PARTNER_UPLOAD = "partner_upload",
16
- TEXT_INPUT = "text_input",
17
- FEATURE_SELECTION = "feature_selection",
18
- // Generation steps
19
- GENERATING = "generating",
20
- RESULT_PREVIEW = "result_preview",
21
- CUSTOM = "custom",
22
- }
23
-
24
- /** Gate Step Result */
25
- export type GateResult = "passed" | "blocked" | "pending";
26
-
27
- /** Auth Gate Configuration */
28
- export interface AuthGateConfig {
29
- readonly allowAnonymous?: boolean;
30
- readonly onAuthRequired?: () => void;
31
- readonly onAuthSuccess?: () => void;
32
- }
33
-
34
- /** Credit Gate Configuration */
35
- export interface CreditGateConfig {
36
- readonly requiredCredits: number;
37
- readonly onCreditsExhausted?: () => void;
38
- readonly onCreditsAvailable?: () => void;
39
- }
40
-
41
- /** Partner Configuration */
42
- export interface PartnerConfig {
43
- readonly partnerId: "A" | "B" | "single";
44
- readonly showNameInput?: boolean;
45
- readonly showFaceDetection?: boolean;
46
- readonly showPhotoTips?: boolean;
47
- readonly maxNameLength?: number;
48
- }
49
-
50
- /** Visual Style Option */
51
- export interface FlowVisualStyleData {
52
- readonly id: string;
53
- readonly icon: string;
54
- readonly labelKey: string;
55
- readonly promptModifier?: string;
56
- }
57
-
58
- /** Uploaded Image Data */
59
- export interface FlowUploadedImageData {
60
- readonly uri: string;
61
- readonly base64: string;
62
- readonly mimeType: string;
63
- }
64
-
65
- /** Step Transition */
66
- export interface StepTransition {
67
- readonly next?: string | ((state: FlowState) => string | null);
68
- readonly back?: string;
69
- readonly skipIf?: (state: FlowState) => boolean;
70
- }
71
-
72
- /** Step Definition */
73
- export interface StepDefinition<TConfig = unknown> {
74
- readonly id: string;
75
- readonly type: StepType;
76
- readonly required?: boolean;
77
- readonly config?: TConfig;
78
- readonly transitions?: StepTransition;
79
- readonly component?: React.ComponentType<StepComponentProps>;
80
- }
81
-
82
- /** Flow Generation Status - subset of GenerationStatus */
83
- export type FlowGenerationStatus = Extract<import("./generation.types").GenerationStatus, "idle" | "preparing" | "generating" | "completed" | "failed">;
84
-
85
- /** Flow State */
86
- export interface FlowState {
87
- readonly currentStepId: string;
88
- readonly currentStepIndex: number;
89
- readonly completedSteps: readonly string[];
90
- readonly selectedCategory?: unknown;
91
- readonly selectedScenario?: unknown;
92
- readonly partners: Record<string, FlowUploadedImageData | undefined>;
93
- readonly partnerNames: Record<string, string>;
94
- readonly textInput?: string;
95
- readonly visualStyle?: string;
96
- readonly selectedFeatures: Record<string, readonly string[]>;
97
- readonly customData: Record<string, unknown>;
98
- readonly generationStatus: FlowGenerationStatus;
99
- readonly generationProgress: number;
100
- readonly generationResult?: unknown;
101
- readonly generationError?: string;
102
- }
103
-
104
- /** Flow Actions */
105
- export interface FlowActions {
106
- goToStep: (stepId: string) => void;
107
- nextStep: () => void;
108
- previousStep: () => void;
109
- setCategory: (category: unknown) => void;
110
- setScenario: (scenario: unknown) => void;
111
- setPartnerImage: (partnerId: string, image: FlowUploadedImageData | undefined) => void;
112
- setPartnerName: (partnerId: string, name: string) => void;
113
- setTextInput: (text: string) => void;
114
- setVisualStyle: (styleId: string) => void;
115
- setSelectedFeatures: (featureType: string, ids: readonly string[]) => void;
116
- setCustomData: (key: string, value: unknown) => void;
117
- startGeneration: () => void;
118
- updateProgress: (progress: number) => void;
119
- setResult: (result: unknown) => void;
120
- setError: (error: string) => void;
121
- reset: () => void;
122
- completeStep: (stepId: string) => void;
123
- }
124
-
125
- /** Step Component Props */
126
- export interface StepComponentProps {
127
- readonly step: StepDefinition;
128
- readonly state: FlowState;
129
- readonly actions: FlowActions;
130
- readonly onNext: () => void;
131
- readonly onBack: () => void;
132
- readonly isProcessing: boolean;
133
- readonly progress: number;
134
- readonly error: string | null;
135
- }
136
-
137
- /** Flow Callbacks */
138
- export interface FlowCallbacks {
139
- onAuthRequired?: (resume: () => void) => void;
140
- onCreditsExhausted?: () => void;
141
- onGenerationStart?: () => void;
142
- onGenerationSuccess?: (result: unknown) => void;
143
- onGenerationError?: (error: string) => void;
144
- onStepChange?: (stepId: string, index: number) => void;
145
- onFlowComplete?: (result: unknown) => void;
146
- }
147
-
148
- /** Flow Data Provider - App provides data */
149
- export interface FlowDataProvider {
150
- readonly categories?: readonly unknown[];
151
- readonly scenarios?: readonly unknown[];
152
- readonly visualStyles?: readonly FlowVisualStyleData[];
153
- readonly surprisePrompts?: readonly string[];
154
- }
155
-
156
- /** Flow Configuration */
157
- export interface FlowConfiguration {
158
- readonly id: string;
159
- readonly steps: readonly StepDefinition[];
160
- readonly initialStepId?: string;
161
- readonly callbacks?: FlowCallbacks;
162
- readonly data?: FlowDataProvider;
163
- readonly creditCost?: number;
164
- readonly userId?: string;
165
- }
166
-
167
- /** Flow Features */
168
- export interface FlowFeatures {
169
- readonly categorySelection: boolean;
170
- readonly partnerCount: 0 | 1 | 2;
171
- readonly textInput: boolean;
172
- readonly scenarioSelection: boolean;
173
- }
6
+ export { StepType, type GateResult, type StepTransition, type StepDefinition, type StepComponentProps } from "./flow-step.types";
7
+ export type {
8
+ AuthGateConfig,
9
+ CreditGateConfig,
10
+ PartnerConfig,
11
+ FlowVisualStyleData,
12
+ FlowUploadedImageData,
13
+ } from "./flow-config-data.types";
14
+ export type { FlowState, FlowGenerationStatus } from "./flow-state.types";
15
+ export type { FlowActions } from "./flow-actions.types";
16
+ export type {
17
+ FlowCallbacks,
18
+ FlowDataProvider,
19
+ FlowConfiguration,
20
+ FlowFeatures,
21
+ } from "./flow-configuration.types";
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Flow Configuration Types
3
+ */
4
+
5
+ import type { StepDefinition } from "./flow-step.types";
6
+ import type { FlowVisualStyleData } from "./flow-config-data.types";
7
+
8
+ /** Flow Callbacks */
9
+ export interface FlowCallbacks {
10
+ onAuthRequired?: (resume: () => void) => void;
11
+ onCreditsExhausted?: () => void;
12
+ onGenerationStart?: () => void;
13
+ onGenerationSuccess?: (result: unknown) => void;
14
+ onGenerationError?: (error: string) => void;
15
+ onStepChange?: (stepId: string, index: number) => void;
16
+ onFlowComplete?: (result: unknown) => void;
17
+ }
18
+
19
+ /** Flow Data Provider - App provides data */
20
+ export interface FlowDataProvider {
21
+ readonly categories?: readonly unknown[];
22
+ readonly scenarios?: readonly unknown[];
23
+ readonly visualStyles?: readonly FlowVisualStyleData[];
24
+ readonly surprisePrompts?: readonly string[];
25
+ }
26
+
27
+ /** Flow Configuration */
28
+ export interface FlowConfiguration {
29
+ readonly id: string;
30
+ readonly steps: readonly StepDefinition[];
31
+ readonly initialStepId?: string;
32
+ readonly callbacks?: FlowCallbacks;
33
+ readonly data?: FlowDataProvider;
34
+ readonly creditCost?: number;
35
+ readonly userId?: string;
36
+ }
37
+
38
+ /** Flow Features */
39
+ export interface FlowFeatures {
40
+ readonly categorySelection: boolean;
41
+ readonly partnerCount: 0 | 1 | 2;
42
+ readonly textInput: boolean;
43
+ readonly scenarioSelection: boolean;
44
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Flow State Types
3
+ */
4
+
5
+ import type { FlowUploadedImageData } from "./flow-config-data.types";
6
+
7
+ /** Flow Generation Status - subset of GenerationStatus */
8
+ export type FlowGenerationStatus = Extract<
9
+ import("./generation.types").GenerationStatus,
10
+ "idle" | "preparing" | "generating" | "completed" | "failed"
11
+ >;
12
+
13
+ /** Flow State */
14
+ export interface FlowState {
15
+ readonly currentStepId: string;
16
+ readonly currentStepIndex: number;
17
+ readonly completedSteps: readonly string[];
18
+ readonly selectedCategory?: unknown;
19
+ readonly selectedScenario?: unknown;
20
+ readonly partners: Record<string, FlowUploadedImageData | undefined>;
21
+ readonly partnerNames: Record<string, string>;
22
+ readonly textInput?: string;
23
+ readonly visualStyle?: string;
24
+ readonly selectedFeatures: Record<string, readonly string[]>;
25
+ readonly customData: Record<string, unknown>;
26
+ readonly generationStatus: FlowGenerationStatus;
27
+ readonly generationProgress: number;
28
+ readonly generationResult?: unknown;
29
+ readonly generationError?: string;
30
+ }