@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.
- package/package.json +1 -1
- package/src/domain/constants/processing-modes-catalog.constants.ts +97 -0
- package/src/domain/constants/processing-modes-filters.ts +34 -0
- package/src/domain/constants/processing-modes-getters.ts +20 -0
- package/src/domain/constants/processing-modes.constants.ts +8 -134
- package/src/domain/entities/feature-flow-config.types.ts +17 -0
- package/src/domain/entities/flow-actions.types.ts +26 -0
- package/src/domain/entities/flow-config-data.types.ts +41 -0
- package/src/domain/entities/flow-config.types.ts +17 -169
- package/src/domain/entities/flow-configuration.types.ts +44 -0
- package/src/domain/entities/flow-state.types.ts +30 -0
- package/src/domain/entities/flow-step.types.ts +56 -0
- package/src/domain/entities/scenario-step-config.types.ts +32 -0
- package/src/domain/entities/step-config.types.ts +14 -129
- package/src/domain/entities/step-definition.types.ts +50 -0
- package/src/domain/entities/step-input-config.types.ts +36 -0
- package/src/domain/entities/step-upload-config.types.ts +17 -0
- package/src/domain/interfaces/ai-provider-capabilities.types.ts +27 -0
- package/src/domain/interfaces/ai-provider-config.types.ts +30 -0
- package/src/domain/interfaces/ai-provider-feature-types.ts +22 -0
- package/src/domain/interfaces/ai-provider-input.types.ts +28 -0
- package/src/domain/interfaces/ai-provider-progress.types.ts +37 -0
- package/src/domain/interfaces/ai-provider-status.types.ts +41 -0
- package/src/domain/interfaces/ai-provider.interface.ts +32 -142
- package/src/domain/types/result-constructors.ts +20 -0
- package/src/domain/types/result-guards.ts +20 -0
- package/src/domain/types/result-transformers.ts +36 -0
- package/src/domain/types/result-type-definitions.ts +27 -0
- package/src/domain/types/result-unwrappers.ts +28 -0
- package/src/domain/types/result.types.ts +11 -100
- package/src/domains/background/infrastructure/utils/polling-interval.util.ts +3 -8
- package/src/domains/background/infrastructure/utils/result-validation-logic.ts +88 -0
- package/src/domains/background/infrastructure/utils/result-validator-constants.ts +18 -0
- package/src/domains/background/infrastructure/utils/result-validator.types.ts +16 -0
- package/src/domains/background/infrastructure/utils/result-validator.util.ts +8 -109
- package/src/domains/background/infrastructure/utils/status-checker.types.ts +11 -0
- package/src/domains/background/infrastructure/utils/status-checker.util.ts +9 -119
- package/src/domains/background/infrastructure/utils/status-error-detector.ts +61 -0
- package/src/domains/background/infrastructure/utils/status-extraction-helpers.ts +25 -0
- package/src/domains/background/infrastructure/utils/status-predicates.ts +37 -0
- package/src/domains/creations/domain-exports.ts +79 -0
- package/src/domains/creations/index.ts +9 -169
- package/src/domains/creations/infrastructure-exports.ts +9 -0
- package/src/domains/creations/presentation-exports.ts +59 -0
- package/src/domains/generation/infrastructure/executors/text-to-image-executor.helpers.ts +81 -0
- package/src/domains/generation/infrastructure/executors/text-to-image-executor.ts +4 -100
- package/src/domains/generation/infrastructure/executors/text-to-image-executor.types.ts +19 -0
- package/src/domains/generation/infrastructure/flow/use-flow-store.types.ts +19 -0
- package/src/domains/generation/infrastructure/flow/useFlowStore.ts +33 -65
- package/src/domains/generation/wizard/domain/entities/wizard-config-builder.ts +75 -0
- package/src/domains/generation/wizard/domain/entities/wizard-feature-config.types.ts +29 -0
- package/src/domains/generation/wizard/domain/entities/wizard-feature.types.ts +9 -114
- package/src/domains/generation/wizard/domain/entities/wizard-presets.constants.ts +23 -0
- package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts +1 -1
- package/src/domains/generation/wizard/infrastructure/utils/creation-persistence-factory.ts +33 -0
- package/src/domains/generation/wizard/infrastructure/utils/creation-persistence.types.ts +22 -0
- package/src/domains/generation/wizard/infrastructure/utils/creation-persistence.util.ts +11 -135
- package/src/domains/generation/wizard/infrastructure/utils/creation-save-operations.ts +48 -0
- package/src/domains/generation/wizard/infrastructure/utils/creation-update-operations.ts +72 -0
- package/src/domains/generation/wizard/presentation/hooks/use-video-queue-generation.types.ts +21 -0
- package/src/domains/generation/wizard/presentation/hooks/useVideoQueueGeneration.ts +14 -35
- package/src/domains/image-to-video/domain/types/image-to-video-callbacks.types.ts +33 -0
- package/src/domains/image-to-video/domain/types/image-to-video-config.types.ts +29 -0
- package/src/domains/image-to-video/domain/types/image-to-video-request.types.ts +31 -0
- package/src/domains/image-to-video/domain/types/image-to-video-result.types.ts +17 -0
- package/src/domains/image-to-video/domain/types/image-to-video-state.types.ts +24 -0
- package/src/domains/image-to-video/domain/types/image-to-video.types.ts +24 -114
- package/src/domains/image-to-video/infrastructure/services/image-to-video-executor.ts +26 -99
- package/src/domains/image-to-video/infrastructure/services/image-to-video-executor.types.ts +15 -0
- package/src/domains/prompts/domain/base/constants.ts +47 -0
- package/src/domains/prompts/domain/base/creators.ts +76 -0
- package/src/domains/prompts/domain/base/types.ts +10 -0
- package/src/domains/prompts/domain/entities/MultiPersonPromptStructure.ts +1 -1
- package/src/domains/prompts/index.ts +4 -2
- package/src/domains/prompts/infrastructure/services/ImagePromptBuilder.ts +2 -72
- package/src/domains/prompts/infrastructure/services/image-prompt-builder.types.ts +17 -0
- package/src/domains/result-preview/presentation/types/result-components.types.ts +47 -0
- package/src/domains/result-preview/presentation/types/result-creation.types.ts +14 -0
- package/src/domains/result-preview/presentation/types/result-data.types.ts +35 -0
- package/src/domains/result-preview/presentation/types/result-hooks.types.ts +35 -0
- package/src/domains/result-preview/presentation/types/result-preview.types.ts +19 -182
- package/src/domains/result-preview/presentation/types/result-screen.types.ts +69 -0
- package/src/domains/text-to-image/domain-exports.ts +50 -0
- package/src/domains/text-to-image/index.ts +11 -102
- package/src/domains/text-to-image/infrastructure-exports.ts +6 -0
- package/src/domains/text-to-image/presentation/hooks/useFormState.ts +39 -24
- package/src/domains/text-to-image/presentation/hooks/useGeneration.ts +5 -3
- package/src/domains/text-to-image/presentation-exports.ts +41 -0
- package/src/domains/text-to-video/domain/types/action-component.types.ts +15 -0
- package/src/domains/text-to-video/domain/types/component.types.ts +16 -103
- package/src/domains/text-to-video/domain/types/content-component.types.ts +30 -0
- package/src/domains/text-to-video/domain/types/panel-component.types.ts +24 -0
- package/src/domains/text-to-video/domain/types/selector-component.types.ts +31 -0
- package/src/domains/text-to-video/domain/types/tab-component.types.ts +26 -0
- package/src/index.ts +0 -10
- package/src/infrastructure/executors/base-executor.ts +40 -112
- package/src/infrastructure/executors/base-executor.types.ts +10 -0
- package/src/infrastructure/http/http-client-methods.ts +73 -0
- package/src/infrastructure/http/http-client.util.ts +8 -163
- package/src/infrastructure/http/http-fetch-handler.ts +53 -0
- package/src/infrastructure/http/http-methods.constants.ts +23 -0
- package/src/infrastructure/http/http-request-executor.ts +49 -0
- package/src/infrastructure/http/http-response-parser.ts +53 -0
- package/src/infrastructure/orchestration/GenerationOrchestrator.ts +8 -43
- package/src/infrastructure/utils/classifier-helpers.ts +36 -0
- package/src/infrastructure/utils/content-validators.ts +92 -0
- package/src/infrastructure/utils/domain-guards.ts +22 -0
- package/src/infrastructure/utils/error-classification.ts +122 -0
- package/src/infrastructure/utils/error-classifier.util.ts +8 -181
- package/src/infrastructure/utils/error-classifiers.ts +49 -0
- package/src/infrastructure/utils/error-extractors.ts +42 -0
- package/src/infrastructure/utils/error-factory.ts +25 -0
- package/src/infrastructure/utils/error-handlers.ts +51 -0
- package/src/infrastructure/utils/error-handling.util.ts +7 -186
- package/src/infrastructure/utils/error-message-extractor.util.ts +10 -172
- package/src/infrastructure/utils/error-retry.ts +44 -0
- package/src/infrastructure/utils/error-types.ts +23 -0
- package/src/infrastructure/utils/extraction-types.ts +37 -0
- package/src/infrastructure/utils/fal-error-checker.ts +44 -0
- package/src/infrastructure/utils/general-validators.ts +64 -0
- package/src/infrastructure/utils/id-validators.ts +39 -0
- package/src/infrastructure/utils/message-extractor.ts +89 -0
- package/src/infrastructure/utils/primitive-guards.ts +66 -0
- package/src/infrastructure/utils/result-polling.ts +39 -0
- package/src/infrastructure/utils/structure-guards.ts +75 -0
- package/src/infrastructure/utils/type-guards.util.ts +22 -149
- package/src/infrastructure/utils/validation-types.ts +8 -0
- package/src/infrastructure/utils/validation.util.ts +14 -184
- package/src/presentation/hooks/ai-feature-callbacks-auth.hooks.ts +43 -0
- package/src/presentation/hooks/ai-feature-callbacks-cost.hooks.ts +56 -0
- package/src/presentation/hooks/ai-feature-callbacks-execution.hooks.ts +66 -0
- package/src/presentation/hooks/ai-feature-callbacks.types.ts +69 -0
- package/src/presentation/hooks/generation/use-image-generation.types.ts +39 -0
- package/src/presentation/hooks/generation/useImageGeneration.ts +33 -99
- package/src/presentation/hooks/generation-flow-navigation.ts +58 -0
- package/src/presentation/hooks/generation-flow-updates.ts +67 -0
- package/src/presentation/hooks/generation-flow.types.ts +32 -0
- package/src/presentation/hooks/useAIFeatureCallbacks.ts +48 -138
- package/src/presentation/hooks/useGenerationFlow.ts +40 -136
- package/src/presentation/types/flow-config.types.ts +9 -140
- package/src/presentation/types/flow-generation-config.types.ts +25 -0
- package/src/presentation/types/flow-state.types.ts +16 -0
- package/src/presentation/types/flow-step-configs.types.ts +48 -0
- package/src/presentation/types/flow-step-data.types.ts +24 -0
- package/src/presentation/types/result-actions.types.ts +50 -0
- package/src/presentation/types/result-config.types.ts +22 -171
- package/src/presentation/types/result-header.types.ts +44 -0
- package/src/presentation/types/result-image.types.ts +29 -0
- package/src/presentation/types/result-layout.types.ts +26 -0
- package/src/presentation/types/result-story.types.ts +42 -0
- package/src/domains/prompts/domain/entities/BasePromptStructure.ts +0 -168
- package/src/exports/domains.ts +0 -149
|
@@ -1,165 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useGenerationFlow Hook
|
|
3
3
|
* Manages step-by-step generation flow state and navigation
|
|
4
|
-
*
|
|
5
|
-
* @package @umituz/react-native-ai-generation-content
|
|
6
4
|
*/
|
|
7
5
|
|
|
8
6
|
import { useState, useCallback, useMemo } from "react";
|
|
9
|
-
import
|
|
10
|
-
GenerationFlowConfig,
|
|
11
|
-
GenerationFlowState,
|
|
12
|
-
PhotoStepData,
|
|
13
|
-
PhotoStepConfig,
|
|
14
|
-
} from "../types/flow-config.types";
|
|
7
|
+
import { createInitialFlowState, isStepValid } from "./flow-state.utils";
|
|
15
8
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from "./flow-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
createPhotoUpdater,
|
|
10
|
+
createNameUpdater,
|
|
11
|
+
createValidationUpdater,
|
|
12
|
+
createTextInputUpdater,
|
|
13
|
+
} from "./generation-flow-updates";
|
|
14
|
+
import {
|
|
15
|
+
createGoNextHandler,
|
|
16
|
+
createGoBackHandler,
|
|
17
|
+
createCompleteHandler,
|
|
18
|
+
} from "./generation-flow-navigation";
|
|
19
|
+
import type {
|
|
20
|
+
UseGenerationFlowOptions,
|
|
21
|
+
UseGenerationFlowReturn,
|
|
22
|
+
} from "./generation-flow.types";
|
|
27
23
|
|
|
28
|
-
export
|
|
29
|
-
state: GenerationFlowState;
|
|
30
|
-
currentStepConfig: PhotoStepConfig | null;
|
|
31
|
-
currentStepData: PhotoStepData | null;
|
|
32
|
-
canGoNext: boolean;
|
|
33
|
-
canGoBack: boolean;
|
|
34
|
-
goNext: () => void;
|
|
35
|
-
goBack: () => void;
|
|
36
|
-
updatePhoto: (imageUri: string, previewUrl?: string) => void;
|
|
37
|
-
updateName: (name: string) => void;
|
|
38
|
-
updateValidation: (isValid: boolean) => void;
|
|
39
|
-
updateTextInput: (text: string) => void;
|
|
40
|
-
reset: () => void;
|
|
41
|
-
complete: () => void;
|
|
42
|
-
}
|
|
24
|
+
export type { UseGenerationFlowOptions, UseGenerationFlowReturn };
|
|
43
25
|
|
|
44
|
-
/**
|
|
45
|
-
* Hook to manage generation flow state
|
|
46
|
-
*/
|
|
47
26
|
export const useGenerationFlow = ({
|
|
48
27
|
config,
|
|
49
28
|
onComplete,
|
|
50
29
|
onStepChange,
|
|
51
30
|
}: UseGenerationFlowOptions): UseGenerationFlowReturn => {
|
|
52
|
-
const [state, setState] = useState
|
|
53
|
-
createInitialFlowState(config),
|
|
54
|
-
);
|
|
31
|
+
const [state, setState] = useState(() => createInitialFlowState(config));
|
|
55
32
|
|
|
56
|
-
const currentStepConfig = useMemo(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
33
|
+
const currentStepConfig = useMemo(
|
|
34
|
+
() => (state.currentStepIndex >= config.photoSteps.length ? null : config.photoSteps[state.currentStepIndex]),
|
|
35
|
+
[state.currentStepIndex, config.photoSteps]
|
|
36
|
+
);
|
|
60
37
|
|
|
61
|
-
const currentStepData = useMemo(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
38
|
+
const currentStepData = useMemo(
|
|
39
|
+
() => (state.currentStepIndex >= state.photoSteps.length ? null : state.photoSteps[state.currentStepIndex]),
|
|
40
|
+
[state.currentStepIndex, state.photoSteps]
|
|
41
|
+
);
|
|
65
42
|
|
|
66
43
|
const isCurrentStepValid = useMemo(
|
|
67
44
|
() => isStepValid(currentStepData, currentStepConfig),
|
|
68
|
-
[currentStepData, currentStepConfig]
|
|
45
|
+
[currentStepData, currentStepConfig]
|
|
69
46
|
);
|
|
70
47
|
|
|
71
|
-
const canGoNext =
|
|
72
|
-
|
|
73
|
-
[isCurrentStepValid, state.isProcessing],
|
|
74
|
-
);
|
|
48
|
+
const canGoNext = isCurrentStepValid && !state.isProcessing;
|
|
49
|
+
const canGoBack = state.currentStepIndex > 0 && config.behavior?.allowBack !== false && !state.isProcessing;
|
|
75
50
|
|
|
76
|
-
const
|
|
77
|
-
()
|
|
78
|
-
|
|
79
|
-
config.behavior?.allowBack !== false &&
|
|
80
|
-
!state.isProcessing,
|
|
81
|
-
[state.currentStepIndex, config.behavior?.allowBack, state.isProcessing],
|
|
51
|
+
const goNext = useCallback(
|
|
52
|
+
createGoNextHandler(canGoNext, state, config, setState, onComplete, onStepChange),
|
|
53
|
+
[canGoNext, state, config, onComplete, onStepChange]
|
|
82
54
|
);
|
|
83
55
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const nextIndex = state.currentStepIndex + 1;
|
|
88
|
-
const isLastStep = nextIndex >= config.photoSteps.length;
|
|
89
|
-
|
|
90
|
-
if (isLastStep) {
|
|
91
|
-
const newState = { ...state, isComplete: true };
|
|
92
|
-
setState(newState);
|
|
93
|
-
onComplete?.(newState);
|
|
94
|
-
} else {
|
|
95
|
-
setState((prev) => ({ ...prev, currentStepIndex: nextIndex }));
|
|
96
|
-
onStepChange?.(nextIndex, config.photoSteps[nextIndex]);
|
|
97
|
-
}
|
|
98
|
-
}, [canGoNext, state, config.photoSteps, onComplete, onStepChange]);
|
|
99
|
-
|
|
100
|
-
const goBack = useCallback(() => {
|
|
101
|
-
if (!canGoBack) return;
|
|
102
|
-
|
|
103
|
-
const prevIndex = state.currentStepIndex - 1;
|
|
104
|
-
setState((prev) => ({ ...prev, currentStepIndex: prevIndex, isComplete: false }));
|
|
105
|
-
onStepChange?.(prevIndex, config.photoSteps[prevIndex]);
|
|
106
|
-
}, [canGoBack, state.currentStepIndex, config.photoSteps, onStepChange]);
|
|
107
|
-
|
|
108
|
-
const updatePhoto = useCallback((imageUri: string, previewUrl?: string) => {
|
|
109
|
-
setState((prev) =>
|
|
110
|
-
updatePhotoStep(prev, prev.currentStepIndex, {
|
|
111
|
-
imageUri,
|
|
112
|
-
previewUrl,
|
|
113
|
-
validationStatus: "pending",
|
|
114
|
-
}),
|
|
115
|
-
);
|
|
116
|
-
}, []);
|
|
117
|
-
|
|
118
|
-
const updateName = useCallback((name: string) => {
|
|
119
|
-
setState((prev) =>
|
|
120
|
-
updatePhotoStep(prev, prev.currentStepIndex, { name }),
|
|
121
|
-
);
|
|
122
|
-
}, []);
|
|
123
|
-
|
|
124
|
-
const updateValidation = useCallback((isValid: boolean) => {
|
|
125
|
-
setState((prev) =>
|
|
126
|
-
updatePhotoStep(prev, prev.currentStepIndex, {
|
|
127
|
-
isValid,
|
|
128
|
-
validationStatus: isValid ? "valid" : "invalid",
|
|
129
|
-
}),
|
|
130
|
-
);
|
|
131
|
-
}, []);
|
|
132
|
-
|
|
133
|
-
const updateTextInput = useCallback(
|
|
134
|
-
(text: string) => {
|
|
135
|
-
setState((prev) => {
|
|
136
|
-
if (!prev.textInput) return prev;
|
|
137
|
-
|
|
138
|
-
const minLength = config.textInputStep?.minLength ?? 0;
|
|
139
|
-
const maxLength = config.textInputStep?.maxLength ?? Infinity;
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
...prev,
|
|
143
|
-
textInput: {
|
|
144
|
-
...prev.textInput,
|
|
145
|
-
text,
|
|
146
|
-
isValid: isTextInputValid(text, minLength, maxLength),
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
[config.textInputStep],
|
|
56
|
+
const goBack = useCallback(
|
|
57
|
+
createGoBackHandler(canGoBack, state.currentStepIndex, config, setState, onStepChange),
|
|
58
|
+
[canGoBack, state.currentStepIndex, config, onStepChange]
|
|
152
59
|
);
|
|
153
60
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
setState(newState);
|
|
161
|
-
onComplete?.(newState);
|
|
162
|
-
}, [state, onComplete]);
|
|
61
|
+
const updatePhoto = useCallback(createPhotoUpdater(setState), []);
|
|
62
|
+
const updateName = useCallback(createNameUpdater(setState), []);
|
|
63
|
+
const updateValidation = useCallback(createValidationUpdater(setState), []);
|
|
64
|
+
const updateTextInput = useCallback(createTextInputUpdater(setState, config), [config.textInputStep]);
|
|
65
|
+
const reset = useCallback(() => setState(createInitialFlowState(config)), [config]);
|
|
66
|
+
const complete = useCallback(createCompleteHandler(state, setState, onComplete), [state, onComplete]);
|
|
163
67
|
|
|
164
68
|
return {
|
|
165
69
|
state,
|
|
@@ -1,152 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flow Configuration Types
|
|
2
|
+
* Flow Configuration Types - Barrel Export
|
|
3
3
|
* Configuration system for step-by-step generation flows
|
|
4
4
|
*
|
|
5
5
|
* @package @umituz/react-native-ai-generation-content
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
/** Step order (1, 2, 3, etc.) */
|
|
18
|
-
order: number;
|
|
19
|
-
/** Step identifier */
|
|
20
|
-
id: string;
|
|
21
|
-
/** Header configuration */
|
|
22
|
-
header?: StepHeaderConfig;
|
|
23
|
-
/** Photo upload card configuration */
|
|
24
|
-
photoCard?: PhotoUploadCardConfig;
|
|
25
|
-
/** Whether name input is required */
|
|
26
|
-
requireNameInput?: boolean;
|
|
27
|
-
/** Whether photo validation is enabled */
|
|
28
|
-
enableValidation?: boolean;
|
|
29
|
-
/** Validation type */
|
|
30
|
-
validationType?: "none" | "face-detection" | "custom";
|
|
31
|
-
/** Whether to show photo tips */
|
|
32
|
-
showPhotoTips?: boolean;
|
|
33
|
-
/** Custom validation function */
|
|
34
|
-
customValidator?: (imageUri: string) => Promise<boolean>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Text input step configuration
|
|
39
|
-
*/
|
|
40
|
-
export interface TextInputStepConfig {
|
|
41
|
-
/** Whether this step is enabled */
|
|
42
|
-
enabled: boolean;
|
|
43
|
-
/** Step order */
|
|
44
|
-
order: number;
|
|
45
|
-
/** Step identifier */
|
|
46
|
-
id: string;
|
|
47
|
-
/** Header configuration */
|
|
48
|
-
header?: StepHeaderConfig;
|
|
49
|
-
/** Minimum character length */
|
|
50
|
-
minLength?: number;
|
|
51
|
-
/** Maximum character length */
|
|
52
|
-
maxLength?: number;
|
|
53
|
-
/** Placeholder text */
|
|
54
|
-
placeholder?: string;
|
|
55
|
-
/** Whether to show character counter */
|
|
56
|
-
showCharacterCount?: boolean;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Preview step configuration
|
|
61
|
-
*/
|
|
62
|
-
export interface PreviewStepConfig {
|
|
63
|
-
/** Whether this step is enabled */
|
|
64
|
-
enabled: boolean;
|
|
65
|
-
/** Step order */
|
|
66
|
-
order: number;
|
|
67
|
-
/** Step identifier */
|
|
68
|
-
id: string;
|
|
69
|
-
/** Header configuration */
|
|
70
|
-
header?: StepHeaderConfig;
|
|
71
|
-
/** Whether to show edit buttons */
|
|
72
|
-
allowEditing?: boolean;
|
|
73
|
-
/** Preview layout style */
|
|
74
|
-
layout?: "grid" | "list" | "carousel";
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Complete flow configuration
|
|
79
|
-
*/
|
|
80
|
-
export interface GenerationFlowConfig {
|
|
81
|
-
/** Photo upload steps (can be 1 or multiple) */
|
|
82
|
-
photoSteps: PhotoStepConfig[];
|
|
83
|
-
/** Text input step */
|
|
84
|
-
textInputStep?: TextInputStepConfig;
|
|
85
|
-
/** Preview step */
|
|
86
|
-
previewStep?: PreviewStepConfig;
|
|
87
|
-
/** Flow behavior */
|
|
88
|
-
behavior?: {
|
|
89
|
-
/** Whether to allow going back */
|
|
90
|
-
allowBack?: boolean;
|
|
91
|
-
/** Whether to show progress indicator */
|
|
92
|
-
showProgress?: boolean;
|
|
93
|
-
/** Whether to auto-advance after photo selection */
|
|
94
|
-
autoAdvance?: boolean;
|
|
95
|
-
/** Whether to require authentication */
|
|
96
|
-
requireAuth?: boolean;
|
|
97
|
-
/** Whether to check feature gate */
|
|
98
|
-
checkFeatureGate?: boolean;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
8
|
+
export type {
|
|
9
|
+
PhotoStepConfig,
|
|
10
|
+
TextInputStepConfig,
|
|
11
|
+
PreviewStepConfig,
|
|
12
|
+
} from "./flow-step-configs.types";
|
|
13
|
+
export type { GenerationFlowConfig } from "./flow-generation-config.types";
|
|
14
|
+
export type { PhotoStepData, TextInputStepData } from "./flow-step-data.types";
|
|
15
|
+
export type { GenerationFlowState } from "./flow-state.types";
|
|
101
16
|
|
|
102
17
|
// Re-export default configs from separate file
|
|
103
18
|
export {
|
|
104
19
|
DEFAULT_SINGLE_PHOTO_FLOW,
|
|
105
20
|
DEFAULT_DUAL_PHOTO_FLOW,
|
|
106
21
|
} from "./flow-default-configs";
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Step data structure
|
|
110
|
-
*/
|
|
111
|
-
export interface PhotoStepData {
|
|
112
|
-
/** Step identifier */
|
|
113
|
-
id: string;
|
|
114
|
-
/** Photo URI */
|
|
115
|
-
imageUri: string | null;
|
|
116
|
-
/** Preview URL */
|
|
117
|
-
previewUrl?: string;
|
|
118
|
-
/** Name/label for this photo */
|
|
119
|
-
name?: string;
|
|
120
|
-
/** Whether validation passed */
|
|
121
|
-
isValid?: boolean;
|
|
122
|
-
/** Validation status */
|
|
123
|
-
validationStatus?: "pending" | "validating" | "valid" | "invalid";
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Text input step data
|
|
128
|
-
*/
|
|
129
|
-
export interface TextInputStepData {
|
|
130
|
-
/** Step identifier */
|
|
131
|
-
id: string;
|
|
132
|
-
/** Text content */
|
|
133
|
-
text: string;
|
|
134
|
-
/** Whether text is valid */
|
|
135
|
-
isValid?: boolean;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Complete flow state
|
|
140
|
-
*/
|
|
141
|
-
export interface GenerationFlowState {
|
|
142
|
-
/** Current step index */
|
|
143
|
-
currentStepIndex: number;
|
|
144
|
-
/** Photo steps data */
|
|
145
|
-
photoSteps: PhotoStepData[];
|
|
146
|
-
/** Text input data */
|
|
147
|
-
textInput?: TextInputStepData;
|
|
148
|
-
/** Whether flow is complete */
|
|
149
|
-
isComplete: boolean;
|
|
150
|
-
/** Whether currently processing */
|
|
151
|
-
isProcessing: boolean;
|
|
152
|
-
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Generation Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { PhotoStepConfig, TextInputStepConfig, PreviewStepConfig } from "./flow-step-configs.types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Complete flow configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface GenerationFlowConfig {
|
|
11
|
+
/** Photo upload steps (can be 1 or multiple) */
|
|
12
|
+
photoSteps: PhotoStepConfig[];
|
|
13
|
+
/** Text input step */
|
|
14
|
+
textInputStep?: TextInputStepConfig;
|
|
15
|
+
/** Preview step */
|
|
16
|
+
previewStep?: PreviewStepConfig;
|
|
17
|
+
/** Flow behavior */
|
|
18
|
+
behavior?: {
|
|
19
|
+
allowBack?: boolean;
|
|
20
|
+
showProgress?: boolean;
|
|
21
|
+
autoAdvance?: boolean;
|
|
22
|
+
requireAuth?: boolean;
|
|
23
|
+
checkFeatureGate?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow State Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { PhotoStepData, TextInputStepData } from "./flow-step-data.types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Complete flow state
|
|
9
|
+
*/
|
|
10
|
+
export interface GenerationFlowState {
|
|
11
|
+
currentStepIndex: number;
|
|
12
|
+
photoSteps: PhotoStepData[];
|
|
13
|
+
textInput?: TextInputStepData;
|
|
14
|
+
isComplete: boolean;
|
|
15
|
+
isProcessing: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Step Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { StepHeaderConfig } from "@umituz/react-native-design-system";
|
|
6
|
+
import type { PhotoUploadCardConfig } from "../components/PhotoUploadCard";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Photo upload step configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface PhotoStepConfig {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
order: number;
|
|
14
|
+
id: string;
|
|
15
|
+
header?: StepHeaderConfig;
|
|
16
|
+
photoCard?: PhotoUploadCardConfig;
|
|
17
|
+
requireNameInput?: boolean;
|
|
18
|
+
enableValidation?: boolean;
|
|
19
|
+
validationType?: "none" | "face-detection" | "custom";
|
|
20
|
+
showPhotoTips?: boolean;
|
|
21
|
+
customValidator?: (imageUri: string) => Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Text input step configuration
|
|
26
|
+
*/
|
|
27
|
+
export interface TextInputStepConfig {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
order: number;
|
|
30
|
+
id: string;
|
|
31
|
+
header?: StepHeaderConfig;
|
|
32
|
+
minLength?: number;
|
|
33
|
+
maxLength?: number;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
showCharacterCount?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Preview step configuration
|
|
40
|
+
*/
|
|
41
|
+
export interface PreviewStepConfig {
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
order: number;
|
|
44
|
+
id: string;
|
|
45
|
+
header?: StepHeaderConfig;
|
|
46
|
+
allowEditing?: boolean;
|
|
47
|
+
layout?: "grid" | "list" | "carousel";
|
|
48
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Step Data Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Step data structure
|
|
7
|
+
*/
|
|
8
|
+
export interface PhotoStepData {
|
|
9
|
+
id: string;
|
|
10
|
+
imageUri: string | null;
|
|
11
|
+
previewUrl?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
isValid?: boolean;
|
|
14
|
+
validationStatus?: "pending" | "validating" | "valid" | "invalid";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Text input step data
|
|
19
|
+
*/
|
|
20
|
+
export interface TextInputStepData {
|
|
21
|
+
id: string;
|
|
22
|
+
text: string;
|
|
23
|
+
isValid?: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result Actions Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ResultActionButton {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
variant?: "primary" | "secondary" | "outline" | "text";
|
|
10
|
+
position?: "top" | "bottom";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ResultActionsConfig {
|
|
14
|
+
share?: ResultActionButton;
|
|
15
|
+
save?: ResultActionButton;
|
|
16
|
+
retry?: ResultActionButton;
|
|
17
|
+
layout?: "horizontal" | "vertical" | "grid";
|
|
18
|
+
buttonSpacing?: number;
|
|
19
|
+
spacing?: {
|
|
20
|
+
paddingHorizontal?: number;
|
|
21
|
+
paddingBottom?: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_ACTIONS_CONFIG: ResultActionsConfig = {
|
|
26
|
+
share: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
icon: "share-social",
|
|
29
|
+
variant: "primary",
|
|
30
|
+
position: "bottom",
|
|
31
|
+
},
|
|
32
|
+
save: {
|
|
33
|
+
enabled: true,
|
|
34
|
+
icon: "download",
|
|
35
|
+
variant: "secondary",
|
|
36
|
+
position: "bottom",
|
|
37
|
+
},
|
|
38
|
+
retry: {
|
|
39
|
+
enabled: true,
|
|
40
|
+
icon: "refresh",
|
|
41
|
+
variant: "outline",
|
|
42
|
+
position: "bottom",
|
|
43
|
+
},
|
|
44
|
+
layout: "horizontal",
|
|
45
|
+
buttonSpacing: 10,
|
|
46
|
+
spacing: {
|
|
47
|
+
paddingHorizontal: 20,
|
|
48
|
+
paddingBottom: 20,
|
|
49
|
+
},
|
|
50
|
+
};
|