@umituz/react-native-ai-generation-content 1.83.10 → 1.83.12

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 (201) hide show
  1. package/package.json +1 -1
  2. package/src/domain/constants/queue-status.constants.ts +0 -2
  3. package/src/domain/entities/flow-config-data.types.ts +0 -9
  4. package/src/domain/entities/flow-config.types.ts +2 -6
  5. package/src/domain/entities/flow-configuration.types.ts +1 -8
  6. package/src/domain/interfaces/app-services.interface.ts +2 -2
  7. package/src/domain/interfaces/index.ts +0 -8
  8. package/src/domains/background/infrastructure/services/job-poller.service.ts +0 -1
  9. package/src/domains/background/infrastructure/utils/result-validator.util.ts +0 -1
  10. package/src/domains/background/infrastructure/utils/status-checker.util.ts +0 -1
  11. package/src/domains/background/infrastructure/utils/status-extraction-helpers.ts +1 -1
  12. package/src/domains/content-moderation/infrastructure/utils/content-security.util.ts +1 -1
  13. package/src/domains/creations/domain/constants/creation-fields.constants.ts +1 -10
  14. package/src/domains/creations/domain/constants/creation-status.constants.ts +0 -20
  15. package/src/domains/creations/domain/constants/creation-validation.constants.ts +0 -12
  16. package/src/domains/creations/domain/constants/index.ts +3 -15
  17. package/src/domains/creations/domain/entities/index.ts +1 -1
  18. package/src/domains/creations/infrastructure/repositories/creation-update.operations.ts +0 -2
  19. package/src/domains/creations/infrastructure/repositories/creations-operations.ts +1 -1
  20. package/src/domains/creations/presentation/components/CreationCard.tsx +3 -3
  21. package/src/domains/creations/presentation/components/CreationImagePreview.tsx +1 -1
  22. package/src/domains/creations/presentation/components/CreationVideoPreview.tsx +1 -1
  23. package/src/domains/creations/presentation/components/CreationsFilterBar.tsx +0 -1
  24. package/src/domains/creations/presentation/components/GalleryEmptyStates.tsx +4 -4
  25. package/src/domains/creations/presentation/components/GalleryHeader.tsx +3 -1
  26. package/src/domains/creations/presentation/components/GalleryScreenHeader.tsx +1 -1
  27. package/src/domains/creations/presentation/components/index.ts +0 -23
  28. package/src/domains/creations/presentation/hooks/creation-validators.ts +4 -4
  29. package/src/domains/creations/presentation/hooks/filterHelpers.ts +5 -5
  30. package/src/domains/creations/presentation/hooks/useFilter.ts +2 -2
  31. package/src/domains/creations/presentation/hooks/useGalleryCallbacks.ts +24 -19
  32. package/src/domains/creations/presentation/hooks/useGalleryState.ts +2 -2
  33. package/src/domains/creations/presentation/hooks/useProcessingJobsPoller.ts +24 -15
  34. package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -1
  35. package/src/domains/creations/presentation/utils/filter-buttons.util.ts +2 -2
  36. package/src/domains/creations/presentation-exports.ts +5 -3
  37. package/src/domains/face-detection/presentation/components/FaceValidationStatus.tsx +1 -1
  38. package/src/domains/generation/infrastructure/executors/text-to-image-executor.helpers.ts +1 -1
  39. package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts +0 -2
  40. package/src/domains/generation/wizard/infrastructure/strategies/image-generation.types.ts +0 -4
  41. package/src/domains/generation/wizard/infrastructure/strategies/index.ts +0 -1
  42. package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts +1 -1
  43. package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts +0 -1
  44. package/src/domains/generation/wizard/infrastructure/strategies/video-generation.types.ts +2 -6
  45. package/src/domains/generation/wizard/infrastructure/strategies/wizard-strategy.constants.ts +0 -7
  46. package/src/domains/generation/wizard/infrastructure/strategies/wizard-strategy.factory.ts +1 -3
  47. package/src/domains/generation/wizard/infrastructure/utils/creation-persistence.util.ts +0 -5
  48. package/src/domains/generation/wizard/infrastructure/utils/index.ts +0 -3
  49. package/src/domains/generation/wizard/infrastructure/utils/primitive-extractors.ts +3 -3
  50. package/src/domains/generation/wizard/presentation/components/IndeterminateProgressBar.tsx +1 -1
  51. package/src/domains/generation/wizard/presentation/components/WizardContinueButton.tsx +1 -1
  52. package/src/domains/generation/wizard/presentation/components/WizardFlowContent.tsx +1 -1
  53. package/src/domains/generation/wizard/presentation/components/WizardStepRenderer.tsx +0 -2
  54. package/src/domains/generation/wizard/presentation/components/WizardStepRenderer.utils.ts +0 -7
  55. package/src/domains/generation/wizard/presentation/components/index.ts +0 -2
  56. package/src/domains/generation/wizard/presentation/components/step-renderers/renderPhotoUploadStep.tsx +1 -1
  57. package/src/domains/generation/wizard/presentation/components/step-renderers/renderPreviewStep.tsx +1 -1
  58. package/src/domains/generation/wizard/presentation/components/step-renderers/renderSelectionStep.tsx +1 -1
  59. package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx +1 -1
  60. package/src/domains/generation/wizard/presentation/hooks/generationStateMachine.ts +2 -2
  61. package/src/domains/generation/wizard/presentation/hooks/useGenerationPhase.ts +1 -1
  62. package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.ts +2 -2
  63. package/src/domains/generation/wizard/presentation/hooks/useWizardFlowHandlers.ts +1 -1
  64. package/src/domains/generation/wizard/presentation/screens/GeneratingScreen.tsx +1 -1
  65. package/src/domains/generation/wizard/presentation/screens/GenericPhotoUploadScreen.tsx +3 -3
  66. package/src/domains/generation/wizard/presentation/screens/SelectionScreen.tsx +0 -6
  67. package/src/domains/generation/wizard/presentation/screens/TextInputScreen.tsx +5 -3
  68. package/src/domains/generation/wizard/presentation/screens/index.ts +0 -13
  69. package/src/domains/generation/wizard/presentation/utilities/validateScenario.ts +0 -6
  70. package/src/domains/image-to-video/presentation/hooks/image-to-video-feature.types.ts +0 -8
  71. package/src/domains/image-to-video/presentation/index.ts +0 -4
  72. package/src/domains/result-preview/presentation/components/StarRatingPicker.tsx +1 -1
  73. package/src/domains/result-preview/presentation/types/result-preview.types.ts +0 -5
  74. package/src/domains/scenarios/configs/index.ts +1 -6
  75. package/src/domains/scenarios/configs/wizard-step-factories.ts +1 -1
  76. package/src/domains/scenarios/infrastructure/scenario-registry.ts +0 -9
  77. package/src/domains/scenarios/presentation/components/ScenarioContinueButton.tsx +1 -1
  78. package/src/domains/scenarios/presentation/hooks/useHierarchicalScenarios.ts +2 -2
  79. package/src/domains/scenarios/presentation/screens/HierarchicalScenarioListScreen.tsx +1 -1
  80. package/src/domains/scenarios/presentation/screens/ScenarioPreviewScreen.tsx +2 -2
  81. package/src/domains/shared/presentation/components/AutoSkipPreview.tsx +1 -1
  82. package/src/domains/shared/presentation/components/index.ts +0 -1
  83. package/src/domains/shared/presentation/utils/index.ts +0 -3
  84. package/src/domains/shared/presentation/utils/wizard-flow.utils.ts +2 -2
  85. package/src/domains/text-to-image/presentation/index.ts +0 -2
  86. package/src/domains/text-to-video/domain/types/component.types.ts +0 -6
  87. package/src/domains/text-to-video/domain/types/index.ts +0 -4
  88. package/src/domains/text-to-video/presentation/components/FrameSelector.tsx +97 -52
  89. package/src/domains/text-to-video/presentation/index.ts +0 -2
  90. package/src/infrastructure/config/index.ts +0 -2
  91. package/src/infrastructure/constants/index.ts +0 -6
  92. package/src/infrastructure/constants/polling.constants.ts +0 -21
  93. package/src/infrastructure/constants/validation.constants.ts +0 -30
  94. package/src/infrastructure/utils/error-classification.ts +1 -1
  95. package/src/infrastructure/utils/error-factory.ts +2 -2
  96. package/src/infrastructure/utils/index.ts +0 -9
  97. package/src/infrastructure/utils/message-extractor.ts +1 -20
  98. package/src/infrastructure/utils/progress.utils.ts +0 -37
  99. package/src/infrastructure/utils/provider-validator.util.ts +1 -1
  100. package/src/infrastructure/utils/url-extractor/index.ts +0 -5
  101. package/src/infrastructure/utils/url-extractor.util.ts +0 -11
  102. package/src/infrastructure/utils/video-helpers.ts +1 -1
  103. package/src/infrastructure/validation/ai-validator.ts +0 -28
  104. package/src/infrastructure/validation/entity-validator.ts +0 -34
  105. package/src/infrastructure/validation/input-validator.ts +2 -5
  106. package/src/infrastructure/validation/sanitizer.ts +0 -17
  107. package/src/presentation/components/AIGenerationConfig.tsx +3 -1
  108. package/src/presentation/components/GenerationProgressContent.styles.ts +0 -2
  109. package/src/presentation/components/PhotoUploadCard/PhotoUploadCard.tsx +0 -1
  110. package/src/presentation/components/ProgressCloseButton.tsx +1 -1
  111. package/src/presentation/components/ProgressDismissButton.tsx +1 -1
  112. package/src/presentation/components/ProgressHeader.tsx +1 -1
  113. package/src/presentation/components/ProgressHint.tsx +1 -1
  114. package/src/presentation/components/display/AIGenerationResult.tsx +6 -4
  115. package/src/presentation/components/display/index.ts +0 -1
  116. package/src/presentation/components/moderation/ModerationSummary.tsx +2 -2
  117. package/src/presentation/components/prompts/ExamplePrompts.tsx +2 -2
  118. package/src/presentation/components/result/ResultImageCard.tsx +39 -21
  119. package/src/presentation/components/result/ResultStoryCard.tsx +38 -15
  120. package/src/presentation/components/result/button-style.utils.ts +1 -1
  121. package/src/presentation/components/selectors/GridSelector.tsx +2 -2
  122. package/src/presentation/components/selectors/factories/aspect-ratio.factory.ts +0 -2
  123. package/src/presentation/components/selectors/factories/duration.factory.ts +0 -2
  124. package/src/presentation/components/selectors/factories/style.factory.ts +1 -1
  125. package/src/presentation/components/shared/ModelSelector.tsx +3 -1
  126. package/src/presentation/hooks/ai-feature-callbacks-auth.hooks.ts +2 -2
  127. package/src/presentation/hooks/ai-feature-callbacks-cost.hooks.ts +2 -2
  128. package/src/presentation/hooks/ai-feature-callbacks-execution.hooks.ts +2 -2
  129. package/src/presentation/hooks/generation/index.ts +0 -5
  130. package/src/presentation/hooks/generation/moderation-handler.ts +1 -1
  131. package/src/presentation/hooks/generation/types.ts +0 -12
  132. package/src/presentation/hooks/index.ts +0 -4
  133. package/src/presentation/hooks/useProgressDismiss.ts +1 -1
  134. package/src/presentation/layouts/types/layout-props.ts +1 -1
  135. package/src/domain/constants/index.ts +0 -2
  136. package/src/domain/entities/feature-flow-config.types.ts +0 -17
  137. package/src/domain/entities/scenario-step-config.types.ts +0 -32
  138. package/src/domain/entities/step-config.types.ts +0 -18
  139. package/src/domain/entities/step-definition.types.ts +0 -50
  140. package/src/domain/entities/step-input-config.types.ts +0 -36
  141. package/src/domain/entities/step-upload-config.types.ts +0 -17
  142. package/src/domains/background/domain/entities/index.ts +0 -1
  143. package/src/domains/background/domain/interfaces/index.ts +0 -1
  144. package/src/domains/content-moderation/infrastructure/utils/validators.util.ts +0 -51
  145. package/src/domains/creations/domain/constants/creation-errors.constants.ts +0 -27
  146. package/src/domains/creations/domain/constants/creation-query.constants.ts +0 -37
  147. package/src/domains/creations/domain/constants/creation-types.constants.ts +0 -45
  148. package/src/domains/creations/presentation/components/CreationImageViewer.tsx +0 -43
  149. package/src/domains/creations/presentation/components/CreationRating.tsx +0 -69
  150. package/src/domains/creations/presentation/components/CreationsGrid.tsx +0 -130
  151. package/src/domains/creations/presentation/components/FilterSheets.tsx +0 -63
  152. package/src/domains/creations/presentation/hooks/index.ts +0 -24
  153. package/src/domains/creations/presentation/hooks/useCreationRating.ts +0 -68
  154. package/src/domains/creations/presentation/screens/index.ts +0 -5
  155. package/src/domains/generation/infrastructure/flow/scenario-configs.ts +0 -54
  156. package/src/domains/generation/infrastructure/flow/step-builders.ts +0 -133
  157. package/src/domains/generation/wizard/infrastructure/strategies/video-generation.utils.ts +0 -42
  158. package/src/domains/generation/wizard/presentation/components/WizardHeader.tsx +0 -96
  159. package/src/domains/generation/wizard/presentation/components/step-renderers/index.ts +0 -8
  160. package/src/domains/generation/wizard/presentation/components/step-renderers/renderGeneratingStep.tsx +0 -24
  161. package/src/domains/generation/wizard/presentation/components/step-renderers/renderResultStep.tsx +0 -69
  162. package/src/domains/generation/wizard/presentation/utilities/index.ts +0 -1
  163. package/src/domains/prompts/infrastructure/services/base/index.ts +0 -6
  164. package/src/domains/prompts/infrastructure/services/base/prompt-service.base.ts +0 -112
  165. package/src/domains/result-preview/index.ts +0 -37
  166. package/src/domains/result-preview/presentation/components/GenerationErrorScreen.tsx +0 -109
  167. package/src/domains/result-preview/presentation/components/index.ts +0 -16
  168. package/src/domains/result-preview/presentation/hooks/index.ts +0 -5
  169. package/src/domains/result-preview/presentation/types/index.ts +0 -16
  170. package/src/domains/result-preview/presentation/types/result-data.types.ts +0 -35
  171. package/src/domains/text-to-image/presentation/screens/TextToImageWizardFlow.types.ts +0 -27
  172. package/src/domains/text-to-video/domain/types/action-component.types.ts +0 -15
  173. package/src/domains/text-to-video/domain/types/selector-component.types.ts +0 -31
  174. package/src/infrastructure/constants/content.constants.ts +0 -8
  175. package/src/infrastructure/constants/storage.constants.ts +0 -27
  176. package/src/infrastructure/http/api-client.types.ts +0 -17
  177. package/src/infrastructure/http/http-client-methods.ts +0 -73
  178. package/src/infrastructure/http/http-client.util.ts +0 -12
  179. package/src/infrastructure/http/http-fetch-handler.ts +0 -63
  180. package/src/infrastructure/http/http-methods.constants.ts +0 -23
  181. package/src/infrastructure/http/http-request-executor.ts +0 -49
  182. package/src/infrastructure/http/http-response-parser.ts +0 -65
  183. package/src/infrastructure/http/index.ts +0 -16
  184. package/src/infrastructure/http/query-string.util.ts +0 -40
  185. package/src/infrastructure/http/timeout.util.ts +0 -26
  186. package/src/infrastructure/logging/debug.util.ts +0 -51
  187. package/src/infrastructure/logging/index.ts +0 -6
  188. package/src/infrastructure/utils/content-validators.ts +0 -92
  189. package/src/infrastructure/utils/domain-guards.ts +0 -23
  190. package/src/infrastructure/utils/error-classifiers.ts +0 -23
  191. package/src/infrastructure/utils/error-handlers.ts +0 -53
  192. package/src/infrastructure/utils/error-retry.ts +0 -44
  193. package/src/infrastructure/utils/error-types.ts +0 -23
  194. package/src/infrastructure/utils/general-validators.ts +0 -64
  195. package/src/infrastructure/utils/id-validators.ts +0 -39
  196. package/src/infrastructure/utils/primitive-guards.ts +0 -66
  197. package/src/infrastructure/utils/structure-guards.ts +0 -75
  198. package/src/infrastructure/utils/type-guards.util.ts +0 -26
  199. package/src/infrastructure/utils/validation-types.ts +0 -8
  200. package/src/infrastructure/utils/validation.util.ts +0 -18
  201. package/src/shared/utils/index.ts +0 -6
@@ -1,133 +0,0 @@
1
- /**
2
- * Step Builders
3
- * Functions for building step definitions from configuration
4
- */
5
-
6
- import { StepType } from "../../../../domain/entities/flow-config.types";
7
- import type {
8
- ScenarioStepConfig,
9
- DynamicStepDefinition,
10
- PhotoUploadStepConfig,
11
- } from "../../../../domain/entities/step-config.types";
12
-
13
- /**
14
- * Build steps from scenario configuration
15
- */
16
- export const buildStepsFromScenario = (
17
- config: ScenarioStepConfig,
18
- ): DynamicStepDefinition[] => {
19
- const steps: DynamicStepDefinition[] = [];
20
-
21
- if (config.photoUploads && config.photoUploads.count > 0) {
22
- for (let i = 0; i < config.photoUploads.count; i++) {
23
- const photoConfig: PhotoUploadStepConfig = {
24
- id: `PHOTO_UPLOAD_${i}`,
25
- label: config.photoUploads.labels?.[i] || `Photo ${i + 1}`,
26
- showFaceDetection: config.photoUploads.showFaceDetection ?? false,
27
- showNameInput: config.photoUploads.showNameInput ?? false,
28
- showPhotoTips: true,
29
- required: true,
30
- };
31
-
32
- steps.push({
33
- id: `PHOTO_UPLOAD_${i}`,
34
- type: StepType.PARTNER_UPLOAD,
35
- config: photoConfig,
36
- required: true,
37
- });
38
- }
39
- }
40
-
41
- if (config.textInput?.enabled) {
42
- steps.push({
43
- id: "TEXT_INPUT",
44
- type: StepType.TEXT_INPUT,
45
- config: {
46
- id: "TEXT_INPUT",
47
- minLength: config.textInput.minLength ?? 0,
48
- maxLength: config.textInput.maxLength ?? 500,
49
- required: config.textInput.required ?? false,
50
- },
51
- required: config.textInput.required ?? false,
52
- });
53
- }
54
-
55
- if (config.styleSelection?.enabled) {
56
- steps.push({
57
- id: "STYLE_SELECTION",
58
- type: StepType.FEATURE_SELECTION,
59
- config: {
60
- id: "STYLE_SELECTION",
61
- styles: config.styleSelection.styles ?? [],
62
- required: config.styleSelection.required ?? false,
63
- },
64
- required: config.styleSelection.required ?? false,
65
- });
66
- }
67
-
68
- if (config.durationSelection?.enabled) {
69
- steps.push({
70
- id: "DURATION_SELECTION",
71
- type: StepType.FEATURE_SELECTION,
72
- config: {
73
- id: "DURATION_SELECTION",
74
- durations: config.durationSelection.durations ?? [4, 8, 12],
75
- required: config.durationSelection.required ?? false,
76
- },
77
- required: config.durationSelection.required ?? false,
78
- });
79
- }
80
-
81
- return steps;
82
- };
83
-
84
- /**
85
- * Build steps with conditional navigation
86
- */
87
- export const buildStepsWithNavigation = (
88
- baseSteps: DynamicStepDefinition[],
89
- ): DynamicStepDefinition[] => {
90
- return baseSteps.map((step, index) => {
91
- if (!step.nextStep && index < baseSteps.length - 1) {
92
- return {
93
- ...step,
94
- nextStep: baseSteps[index + 1].id,
95
- };
96
- }
97
- return step;
98
- });
99
- };
100
-
101
- /**
102
- * Get next step ID based on configuration and state
103
- */
104
- export const resolveNextStep = (
105
- currentStepId: string,
106
- steps: readonly DynamicStepDefinition[],
107
- context: {
108
- readonly values: Record<string, unknown>;
109
- readonly completedSteps: readonly string[];
110
- },
111
- ): string | null => {
112
- const currentStep = steps.find((s) => s.id === currentStepId);
113
- if (!currentStep) return null;
114
-
115
- if (typeof currentStep.nextStep === "function") {
116
- return currentStep.nextStep({
117
- values: context.values,
118
- currentStepId,
119
- completedSteps: context.completedSteps,
120
- });
121
- }
122
-
123
- if (typeof currentStep.nextStep === "string") {
124
- return currentStep.nextStep;
125
- }
126
-
127
- const currentIndex = steps.findIndex((s) => s.id === currentStepId);
128
- if (currentIndex >= 0 && currentIndex < steps.length - 1) {
129
- return steps[currentIndex + 1].id;
130
- }
131
-
132
- return null;
133
- };
@@ -1,42 +0,0 @@
1
- /**
2
- * Video Generation Utilities
3
- * Video-specific utility functions
4
- */
5
-
6
- import type { VideoFeatureType } from "../../../../../domain/interfaces";
7
- import type { WizardScenarioData } from "../../presentation/hooks/wizard-generation.types";
8
- import { VIDEO_FEATURE_PATTERNS } from "./wizard-strategy.constants";
9
-
10
-
11
- /**
12
- * Determines the video feature type from scenario
13
- * Priority: featureType (app-controlled) > pattern matching > default
14
- */
15
- export function getVideoFeatureType(scenario: WizardScenarioData): VideoFeatureType {
16
- const { id, featureType } = scenario;
17
-
18
- // Primary: Use featureType from main app (package-driven design)
19
- if (featureType) {
20
- if (typeof __DEV__ !== "undefined" && __DEV__) {
21
- console.log("[VideoUtils] Using featureType from app", { id, featureType });
22
- }
23
- return featureType;
24
- }
25
-
26
- // Fallback: Pattern matching
27
- const lowerId = id.toLowerCase();
28
- for (const [pattern, type] of Object.entries(VIDEO_FEATURE_PATTERNS)) {
29
- if (lowerId.includes(pattern)) {
30
- if (typeof __DEV__ !== "undefined" && __DEV__) {
31
- console.log("[VideoUtils] Pattern match", { id, pattern, type });
32
- }
33
- return type;
34
- }
35
- }
36
-
37
- // Default: text-to-video
38
- if (typeof __DEV__ !== "undefined" && __DEV__) {
39
- console.log("[VideoUtils] Default to text-to-video", { id });
40
- }
41
- return "text-to-video";
42
- }
@@ -1,96 +0,0 @@
1
- /**
2
- * WizardHeader Component
3
- * Header with back button on left, action button on right
4
- */
5
-
6
- import React from "react";
7
- import { View, TouchableOpacity, StyleSheet } from "react-native";
8
- import {
9
- AtomicText,
10
- AtomicIcon,
11
- useAppDesignTokens,
12
- } from "@umituz/react-native-design-system";
13
-
14
- export interface WizardHeaderProps {
15
- readonly onBack: () => void;
16
- readonly onAction?: () => void;
17
- readonly backLabel?: string;
18
- readonly actionLabel?: string;
19
- readonly isActionDisabled?: boolean;
20
- readonly showAction?: boolean;
21
- }
22
-
23
- export const WizardHeader: React.FC<WizardHeaderProps> = ({
24
- onBack,
25
- onAction,
26
- backLabel,
27
- actionLabel,
28
- isActionDisabled = false,
29
- showAction = true,
30
- }) => {
31
- const tokens = useAppDesignTokens();
32
-
33
- return (
34
- <View style={[styles.container, { paddingHorizontal: tokens.spacing.md }]}>
35
- <TouchableOpacity onPress={onBack} style={styles.backButton}>
36
- <AtomicIcon name="chevron-left" size="md" color="textPrimary" />
37
- {backLabel ? (
38
- <AtomicText type="bodyMedium" color="textPrimary">
39
- {backLabel}
40
- </AtomicText>
41
- ) : null}
42
- </TouchableOpacity>
43
-
44
- {showAction && actionLabel ? (
45
- <TouchableOpacity
46
- onPress={onAction}
47
- disabled={isActionDisabled}
48
- style={[
49
- styles.actionButton,
50
- {
51
- backgroundColor: isActionDisabled
52
- ? tokens.colors.surfaceSecondary
53
- : tokens.colors.primary,
54
- borderRadius: tokens.radius.md,
55
- },
56
- ]}
57
- >
58
- <AtomicText
59
- type="labelLarge"
60
- style={{
61
- color: isActionDisabled
62
- ? tokens.colors.textSecondary
63
- : tokens.colors.textInverse,
64
- fontWeight: "600",
65
- }}
66
- >
67
- {actionLabel}
68
- </AtomicText>
69
- </TouchableOpacity>
70
- ) : (
71
- <View style={styles.placeholder} />
72
- )}
73
- </View>
74
- );
75
- };
76
-
77
- const styles = StyleSheet.create({
78
- container: {
79
- flexDirection: "row",
80
- justifyContent: "space-between",
81
- alignItems: "center",
82
- paddingVertical: 12,
83
- },
84
- backButton: {
85
- flexDirection: "row",
86
- alignItems: "center",
87
- gap: 4,
88
- },
89
- actionButton: {
90
- paddingHorizontal: 16,
91
- paddingVertical: 8,
92
- },
93
- placeholder: {
94
- width: 80,
95
- },
96
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * Step Renderers
3
- * Separated renderer functions for each wizard step type
4
- */
5
-
6
- export { renderPreviewStep, type PreviewStepProps } from "./renderPreviewStep";
7
- export { renderGeneratingStep, type GeneratingStepProps } from "./renderGeneratingStep";
8
- export { renderResultStep, type ResultStepProps } from "./renderResultStep";
@@ -1,24 +0,0 @@
1
- /**
2
- * Generating Step Renderer
3
- */
4
-
5
- import React from "react";
6
- import { GeneratingScreen } from "../../screens/GeneratingScreen";
7
- import type { WizardScenarioData } from "../../hooks/useWizardGeneration";
8
-
9
- export interface GeneratingStepProps {
10
- readonly progress: number;
11
- readonly scenario: WizardScenarioData | undefined;
12
- readonly t: (key: string) => string;
13
- readonly renderGenerating?: (progress: number) => React.ReactElement | null;
14
- }
15
-
16
- export function renderGeneratingStep({
17
- progress,
18
- scenario,
19
- t,
20
- renderGenerating,
21
- }: GeneratingStepProps): React.ReactElement | null {
22
- if (renderGenerating) return renderGenerating(progress);
23
- return <GeneratingScreen progress={progress} scenario={scenario} t={t} />;
24
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * Result Step Renderer
3
- */
4
-
5
- import React from "react";
6
- import { extractMediaUrl, getMediaTypeFromUrl } from "@umituz/react-native-design-system";
7
- import { ResultPreviewScreen } from "../../../../../result-preview/presentation/components/ResultPreviewScreen";
8
-
9
- export interface ResultStepProps {
10
- readonly generationResult: unknown;
11
- readonly isSaving: boolean;
12
- readonly isSharing: boolean;
13
- readonly showRating: boolean;
14
- readonly onDownload: () => void;
15
- readonly onShare: () => void;
16
- readonly onRate?: () => void;
17
- readonly onTryAgain?: () => void;
18
- readonly onBack: () => void;
19
- readonly t: (key: string) => string;
20
- readonly renderResult?: (result: unknown) => React.ReactElement | null;
21
- }
22
-
23
- export function renderResultStep({
24
- generationResult,
25
- isSaving,
26
- isSharing,
27
- showRating,
28
- onDownload,
29
- onShare,
30
- onRate,
31
- onTryAgain,
32
- onBack,
33
- t,
34
- renderResult,
35
- }: ResultStepProps): React.ReactElement | null {
36
- if (renderResult) return renderResult(generationResult);
37
-
38
- const media = extractMediaUrl(generationResult);
39
- if (!media) return null;
40
-
41
- const isVideo = media.isVideo || getMediaTypeFromUrl(media.url) === "video";
42
- const handleTryAgain = onTryAgain ?? onBack;
43
-
44
- return (
45
- <ResultPreviewScreen
46
- imageUrl={isVideo ? undefined : media.url}
47
- videoUrl={isVideo ? media.url : undefined}
48
- isSaving={isSaving}
49
- isSharing={isSharing}
50
- onDownload={onDownload}
51
- onShare={onShare}
52
- onRate={onRate}
53
- onTryAgain={handleTryAgain}
54
- onNavigateBack={handleTryAgain}
55
- hideLabel
56
- iconOnly
57
- showTryAgain
58
- showRating={showRating}
59
- translations={{
60
- title: t("generation.result.title"),
61
- saveButton: t("generation.result.save"),
62
- saving: t("generation.result.saving"),
63
- shareButton: t("generation.result.share"),
64
- sharing: t("generation.result.sharing"),
65
- tryAnother: t("generation.result.tryAnother"),
66
- }}
67
- />
68
- );
69
- }
@@ -1 +0,0 @@
1
- export { validateScenario, type ScenarioValidationResult } from "./validateScenario";
@@ -1,6 +0,0 @@
1
- /**
2
- * Base Services Index
3
- */
4
-
5
- export { BasePromptService, DEFAULT_PROMPT_SAFETY } from './prompt-service.base';
6
- export type { TemplateParams } from './prompt-service.base';
@@ -1,112 +0,0 @@
1
- /**
2
- * Base Prompt Service
3
- * Abstract class for AI prompt generation services
4
- * Eliminates code duplication across service implementations
5
- */
6
-
7
- import type { AIPromptTemplate } from '../../../domain/entities/AIPromptTemplate';
8
- import type { AIPromptResult, AIPromptCategory } from '../../../domain/entities/types';
9
- import type { AIPromptSafety } from '../../../domain/entities/value-objects';
10
- import { createAIPromptTemplate } from '../../../domain/entities/AIPromptTemplate';
11
- import { PromptGenerationService } from '../PromptGenerationService';
12
-
13
- /**
14
- * Default safety configuration for all AI prompt templates
15
- */
16
- export const DEFAULT_PROMPT_SAFETY: AIPromptSafety = {
17
- contentFilter: true,
18
- adultContentFilter: true,
19
- violenceFilter: true,
20
- hateSpeechFilter: true,
21
- copyrightFilter: true,
22
- };
23
-
24
- /**
25
- * Template creation parameters
26
- */
27
- export interface TemplateParams {
28
- id: string;
29
- name: string;
30
- description: string;
31
- category: AIPromptCategory;
32
- template: string;
33
- }
34
-
35
- /**
36
- * Base class for AI prompt generation services
37
- * Provides common functionality for template generation
38
- */
39
- export abstract class BasePromptService<TConfig> {
40
- protected readonly promptService: PromptGenerationService;
41
-
42
- constructor() {
43
- this.promptService = new PromptGenerationService();
44
- }
45
-
46
- /**
47
- * Generate template with standard error handling
48
- */
49
- generateTemplate(config: TConfig): Promise<AIPromptResult<AIPromptTemplate>> {
50
- try {
51
- if (!this.validateConfig(config)) {
52
- return Promise.resolve({
53
- success: false,
54
- error: 'VALIDATION_ERROR',
55
- message: 'Invalid configuration',
56
- });
57
- }
58
-
59
- const template = this.createTemplate(config);
60
- return Promise.resolve({ success: true, data: template });
61
- } catch {
62
- return Promise.resolve({
63
- success: false,
64
- error: 'GENERATION_FAILED',
65
- message: 'Failed to generate template',
66
- });
67
- }
68
- }
69
-
70
- /**
71
- * Generate prompt from template
72
- */
73
- async generatePrompt(
74
- template: AIPromptTemplate,
75
- config: TConfig,
76
- ): Promise<AIPromptResult<string>> {
77
- const variables = this.buildVariables(config);
78
- return this.promptService.generateFromTemplate(template, variables);
79
- }
80
-
81
- /**
82
- * Create template with default safety config
83
- */
84
- protected createTemplateWithDefaults(params: TemplateParams): AIPromptTemplate {
85
- return createAIPromptTemplate({
86
- ...params,
87
- variables: [],
88
- safety: DEFAULT_PROMPT_SAFETY,
89
- version: '1.0.0',
90
- });
91
- }
92
-
93
- /**
94
- * Service name for error messages
95
- */
96
- protected abstract getServiceName(): string;
97
-
98
- /**
99
- * Validate configuration
100
- */
101
- abstract validateConfig(config: TConfig): boolean;
102
-
103
- /**
104
- * Create the template (service-specific)
105
- */
106
- protected abstract createTemplate(config: TConfig): AIPromptTemplate;
107
-
108
- /**
109
- * Build variables for prompt generation
110
- */
111
- protected abstract buildVariables(config: TConfig): Record<string, unknown>;
112
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Result Preview Domain Export
3
- * Reusable result preview components for AI generation
4
- */
5
-
6
- // Components
7
- export {
8
- ResultPreviewScreen,
9
- ResultImageCard,
10
- ResultActionBar,
11
- RecentCreationsSection,
12
- GenerationErrorScreen,
13
- StarRatingPicker,
14
- } from "./presentation/components";
15
- export type {
16
- StarRatingPickerProps,
17
- GenerationErrorTranslations,
18
- GenerationErrorConfig,
19
- GenerationErrorScreenProps,
20
- } from "./presentation/components";
21
-
22
- // Hooks
23
- export { useResultActions } from "./presentation/hooks";
24
-
25
- // Types
26
- export type {
27
- ResultData,
28
- ResultActionsCallbacks,
29
- ResultDisplayState,
30
- ResultImageCardProps,
31
- ResultActionBarProps,
32
- RecentCreation,
33
- ResultPreviewScreenProps,
34
- ResultPreviewTranslations,
35
- UseResultActionsOptions,
36
- UseResultActionsReturn,
37
- } from "./presentation/types";
@@ -1,109 +0,0 @@
1
- /**
2
- * GenerationErrorScreen
3
- * Generic error screen for AI generation failures
4
- */
5
-
6
- import React, { useMemo } from "react";
7
- import { View, StyleSheet, StyleProp, ViewStyle } from "react-native";
8
- import {
9
- ScreenLayout,
10
- AtomicText,
11
- AtomicIcon,
12
- useAppDesignTokens,
13
- AtomicButton,
14
- type DesignTokens,
15
- } from "@umituz/react-native-design-system";
16
-
17
- export interface GenerationErrorTranslations {
18
- readonly title: string;
19
- readonly tryAgain: string;
20
- readonly chooseAnother: string;
21
- readonly noCreditCharged: string;
22
- }
23
-
24
- export interface GenerationErrorConfig {
25
- readonly showCreditInfo?: boolean;
26
- readonly iconName?: string;
27
- readonly iconSize?: number;
28
- }
29
-
30
- export interface GenerationErrorScreenProps {
31
- readonly errorMessage?: string;
32
- readonly translations: GenerationErrorTranslations;
33
- readonly config?: GenerationErrorConfig;
34
- readonly onTryAgain: () => void;
35
- readonly onChooseAnother: () => void;
36
- readonly premiumButtonText?: string;
37
- readonly onGoPremium?: () => void;
38
- readonly style?: StyleProp<ViewStyle>;
39
- }
40
-
41
- const DEFAULT_CONFIG: GenerationErrorConfig = { showCreditInfo: true, iconName: "alert-circle", iconSize: 56 };
42
-
43
- export const GenerationErrorScreen: React.FC<GenerationErrorScreenProps> = ({
44
- errorMessage,
45
- translations,
46
- config = DEFAULT_CONFIG,
47
- onTryAgain,
48
- onChooseAnother,
49
- premiumButtonText,
50
- onGoPremium,
51
- style,
52
- }) => {
53
- const tokens = useAppDesignTokens();
54
- const styles = useMemo(() => createStyles(tokens), [tokens]);
55
- const mergedConfig = { ...DEFAULT_CONFIG, ...config };
56
-
57
- return (
58
- <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }, style]}>
59
- <ScreenLayout scrollable={false} edges={["top", "bottom"]} backgroundColor="transparent">
60
- <View style={styles.content}>
61
- <View style={styles.iconContainer}>
62
- <AtomicIcon name={mergedConfig.iconName || "alert-circle"} size={mergedConfig.iconSize || 56} customColor={tokens.colors.error} />
63
- </View>
64
- <AtomicText style={styles.title}>{translations.title}</AtomicText>
65
- <AtomicText style={styles.message}>{errorMessage || translations.title}</AtomicText>
66
-
67
- {mergedConfig.showCreditInfo && (
68
- <View style={styles.infoContainer}>
69
- <AtomicIcon name="information-circle-outline" size={16} customColor={tokens.colors.textSecondary} />
70
- <AtomicText style={styles.infoText}>{translations.noCreditCharged}</AtomicText>
71
- </View>
72
- )}
73
-
74
- <View style={styles.spacer} />
75
-
76
- <View style={styles.actionsContainer}>
77
- {onGoPremium && premiumButtonText && (
78
- <AtomicButton title={premiumButtonText} onPress={onGoPremium} variant="primary" size="lg" fullWidth />
79
- )}
80
- <AtomicButton
81
- title={translations.tryAgain}
82
- onPress={onTryAgain}
83
- variant={onGoPremium ? "secondary" : "primary"}
84
- size="lg"
85
- fullWidth
86
- />
87
- <View style={styles.secondaryButtonContainer}>
88
- <AtomicButton title={translations.chooseAnother} onPress={onChooseAnother} variant="text" size="md" fullWidth />
89
- </View>
90
- </View>
91
- </View>
92
- </ScreenLayout>
93
- </View>
94
- );
95
- };
96
-
97
- const createStyles = (tokens: DesignTokens) =>
98
- StyleSheet.create({
99
- container: { flex: 1 },
100
- content: { flex: 1, alignItems: "center", paddingHorizontal: 32, paddingTop: 80, paddingBottom: 40 },
101
- iconContainer: { marginBottom: 24 },
102
- title: { ...tokens.typography.headlineSmall, color: tokens.colors.textPrimary, fontWeight: "700", marginBottom: 12, textAlign: "center" },
103
- message: { ...tokens.typography.bodyMedium, color: tokens.colors.textSecondary, textAlign: "center", lineHeight: 22, marginBottom: 24 },
104
- infoContainer: { flexDirection: "row", alignItems: "center", gap: 6, opacity: 0.7 },
105
- infoText: { ...tokens.typography.bodySmall, color: tokens.colors.textSecondary },
106
- spacer: { flex: 1 },
107
- actionsContainer: { width: "100%", gap: 16 },
108
- secondaryButtonContainer: { marginTop: 4 },
109
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Result Preview Components Export
3
- */
4
-
5
- export { ResultPreviewScreen } from "./ResultPreviewScreen";
6
- export { ResultImageCard } from "./ResultImageCard";
7
- export { ResultActionBar } from "./ResultActionBar";
8
- export { RecentCreationsSection } from "./RecentCreationsSection";
9
- export { GenerationErrorScreen } from "./GenerationErrorScreen";
10
- export { StarRatingPicker } from "./StarRatingPicker";
11
- export type { StarRatingPickerProps } from "./StarRatingPicker";
12
- export type {
13
- GenerationErrorTranslations,
14
- GenerationErrorConfig,
15
- GenerationErrorScreenProps,
16
- } from "./GenerationErrorScreen";
@@ -1,5 +0,0 @@
1
- /**
2
- * Result Preview Hooks Export
3
- */
4
-
5
- export { useResultActions } from "./useResultActions";
@@ -1,16 +0,0 @@
1
- /**
2
- * Result Preview Types Export
3
- */
4
-
5
- export type {
6
- ResultData,
7
- ResultActionsCallbacks,
8
- ResultDisplayState,
9
- ResultImageCardProps,
10
- ResultActionBarProps,
11
- RecentCreation,
12
- ResultPreviewScreenProps,
13
- ResultPreviewTranslations,
14
- UseResultActionsOptions,
15
- UseResultActionsReturn,
16
- } from "./result-preview.types";