@umituz/react-native-ai-generation-content 1.13.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/domains/creations/presentation/components/CreationCard.tsx +1 -2
- package/src/domains/creations/presentation/components/CreationsGrid.tsx +0 -1
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +17 -22
- package/src/index.ts +32 -0
- package/src/presentation/components/index.ts +1 -0
- package/src/presentation/components/photo-step/PhotoStep.tsx +96 -0
- package/src/presentation/components/photo-step/index.ts +2 -0
- package/src/presentation/components/result/GenerationResultContent.tsx +60 -23
- package/src/presentation/components/result/ResultActions.tsx +171 -84
- package/src/presentation/components/result/ResultHeader.tsx +69 -38
- package/src/presentation/components/result/ResultImageCard.tsx +118 -39
- package/src/presentation/components/result/ResultStoryCard.tsx +94 -44
- package/src/presentation/components/result/index.ts +14 -0
- package/src/presentation/hooks/index.ts +6 -0
- package/src/presentation/hooks/useGenerationFlow.ts +315 -0
- package/src/presentation/types/flow-config.types.ts +246 -0
- package/src/presentation/types/result-config.types.ts +194 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Configuration Types
|
|
3
|
+
* Configuration system for step-by-step generation flows
|
|
4
|
+
*
|
|
5
|
+
* @package @umituz/react-native-ai-generation-content
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { StepHeaderConfig } from "@umituz/react-native-design-system";
|
|
9
|
+
import type { PhotoUploadCardConfig } from "@umituz/react-native-design-system";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Photo upload step configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface PhotoStepConfig {
|
|
15
|
+
/** Whether this step is enabled */
|
|
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
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Default single photo flow configuration
|
|
104
|
+
*/
|
|
105
|
+
export const DEFAULT_SINGLE_PHOTO_FLOW: GenerationFlowConfig = {
|
|
106
|
+
photoSteps: [
|
|
107
|
+
{
|
|
108
|
+
enabled: true,
|
|
109
|
+
order: 1,
|
|
110
|
+
id: "photo-1",
|
|
111
|
+
header: {
|
|
112
|
+
showStepIndicator: false,
|
|
113
|
+
titleAlignment: "center",
|
|
114
|
+
titleFontSize: 28,
|
|
115
|
+
subtitleFontSize: 16,
|
|
116
|
+
},
|
|
117
|
+
photoCard: {
|
|
118
|
+
aspectRatio: 1,
|
|
119
|
+
borderRadius: 28,
|
|
120
|
+
showValidationStatus: true,
|
|
121
|
+
allowChange: true,
|
|
122
|
+
borderStyle: "dashed",
|
|
123
|
+
},
|
|
124
|
+
requireNameInput: true,
|
|
125
|
+
enableValidation: false,
|
|
126
|
+
validationType: "none",
|
|
127
|
+
showPhotoTips: true,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
behavior: {
|
|
131
|
+
allowBack: false,
|
|
132
|
+
showProgress: false,
|
|
133
|
+
autoAdvance: false,
|
|
134
|
+
requireAuth: false,
|
|
135
|
+
checkFeatureGate: true,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Default dual photo flow configuration
|
|
141
|
+
*/
|
|
142
|
+
export const DEFAULT_DUAL_PHOTO_FLOW: GenerationFlowConfig = {
|
|
143
|
+
photoSteps: [
|
|
144
|
+
{
|
|
145
|
+
enabled: true,
|
|
146
|
+
order: 1,
|
|
147
|
+
id: "partner-a",
|
|
148
|
+
header: {
|
|
149
|
+
showStepIndicator: true,
|
|
150
|
+
currentStep: 1,
|
|
151
|
+
totalSteps: 2,
|
|
152
|
+
titleAlignment: "center",
|
|
153
|
+
titleFontSize: 28,
|
|
154
|
+
subtitleFontSize: 16,
|
|
155
|
+
},
|
|
156
|
+
photoCard: {
|
|
157
|
+
aspectRatio: 1,
|
|
158
|
+
borderRadius: 28,
|
|
159
|
+
showValidationStatus: true,
|
|
160
|
+
allowChange: true,
|
|
161
|
+
borderStyle: "dashed",
|
|
162
|
+
},
|
|
163
|
+
requireNameInput: true,
|
|
164
|
+
enableValidation: false,
|
|
165
|
+
validationType: "none",
|
|
166
|
+
showPhotoTips: true,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
enabled: true,
|
|
170
|
+
order: 2,
|
|
171
|
+
id: "partner-b",
|
|
172
|
+
header: {
|
|
173
|
+
showStepIndicator: true,
|
|
174
|
+
currentStep: 2,
|
|
175
|
+
totalSteps: 2,
|
|
176
|
+
titleAlignment: "center",
|
|
177
|
+
titleFontSize: 28,
|
|
178
|
+
subtitleFontSize: 16,
|
|
179
|
+
},
|
|
180
|
+
photoCard: {
|
|
181
|
+
aspectRatio: 1,
|
|
182
|
+
borderRadius: 28,
|
|
183
|
+
showValidationStatus: true,
|
|
184
|
+
allowChange: true,
|
|
185
|
+
borderStyle: "dashed",
|
|
186
|
+
},
|
|
187
|
+
requireNameInput: true,
|
|
188
|
+
enableValidation: false,
|
|
189
|
+
validationType: "none",
|
|
190
|
+
showPhotoTips: false,
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
behavior: {
|
|
194
|
+
allowBack: true,
|
|
195
|
+
showProgress: true,
|
|
196
|
+
autoAdvance: false,
|
|
197
|
+
requireAuth: false,
|
|
198
|
+
checkFeatureGate: true,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Step data structure
|
|
204
|
+
*/
|
|
205
|
+
export interface PhotoStepData {
|
|
206
|
+
/** Step identifier */
|
|
207
|
+
id: string;
|
|
208
|
+
/** Photo URI */
|
|
209
|
+
imageUri: string | null;
|
|
210
|
+
/** Preview URL */
|
|
211
|
+
previewUrl?: string;
|
|
212
|
+
/** Name/label for this photo */
|
|
213
|
+
name?: string;
|
|
214
|
+
/** Whether validation passed */
|
|
215
|
+
isValid?: boolean;
|
|
216
|
+
/** Validation status */
|
|
217
|
+
validationStatus?: "pending" | "validating" | "valid" | "invalid";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Text input step data
|
|
222
|
+
*/
|
|
223
|
+
export interface TextInputStepData {
|
|
224
|
+
/** Step identifier */
|
|
225
|
+
id: string;
|
|
226
|
+
/** Text content */
|
|
227
|
+
text: string;
|
|
228
|
+
/** Whether text is valid */
|
|
229
|
+
isValid?: boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Complete flow state
|
|
234
|
+
*/
|
|
235
|
+
export interface GenerationFlowState {
|
|
236
|
+
/** Current step index */
|
|
237
|
+
currentStepIndex: number;
|
|
238
|
+
/** Photo steps data */
|
|
239
|
+
photoSteps: PhotoStepData[];
|
|
240
|
+
/** Text input data */
|
|
241
|
+
textInput?: TextInputStepData;
|
|
242
|
+
/** Whether flow is complete */
|
|
243
|
+
isComplete: boolean;
|
|
244
|
+
/** Whether currently processing */
|
|
245
|
+
isProcessing: boolean;
|
|
246
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result Preview Configuration Types
|
|
3
|
+
* Allows main apps to customize result preview appearance and behavior
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ResultHeaderConfig {
|
|
7
|
+
showTitle?: boolean;
|
|
8
|
+
showDate?: boolean;
|
|
9
|
+
showDateIcon?: boolean;
|
|
10
|
+
titleAlignment?: "left" | "center" | "right";
|
|
11
|
+
titleFontSize?: number;
|
|
12
|
+
titleFontWeight?:
|
|
13
|
+
| "normal"
|
|
14
|
+
| "bold"
|
|
15
|
+
| "100"
|
|
16
|
+
| "200"
|
|
17
|
+
| "300"
|
|
18
|
+
| "400"
|
|
19
|
+
| "500"
|
|
20
|
+
| "600"
|
|
21
|
+
| "700"
|
|
22
|
+
| "800"
|
|
23
|
+
| "900";
|
|
24
|
+
dateBadgeStyle?: "outline" | "filled" | "minimal";
|
|
25
|
+
spacing?: {
|
|
26
|
+
marginBottom?: number;
|
|
27
|
+
titleMarginBottom?: number;
|
|
28
|
+
paddingHorizontal?: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ResultImageConfig {
|
|
33
|
+
aspectRatio?: number;
|
|
34
|
+
borderRadius?: number;
|
|
35
|
+
showBadge?: boolean;
|
|
36
|
+
badgePosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
37
|
+
badgeStyle?: "dark" | "light" | "gradient";
|
|
38
|
+
badgeIcon?: string;
|
|
39
|
+
spacing?: {
|
|
40
|
+
marginBottom?: number;
|
|
41
|
+
paddingHorizontal?: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ResultStoryConfig {
|
|
46
|
+
showQuotes?: boolean;
|
|
47
|
+
textAlignment?: "left" | "center" | "right";
|
|
48
|
+
fontSize?: number;
|
|
49
|
+
fontStyle?: "normal" | "italic";
|
|
50
|
+
fontWeight?:
|
|
51
|
+
| "normal"
|
|
52
|
+
| "bold"
|
|
53
|
+
| "100"
|
|
54
|
+
| "200"
|
|
55
|
+
| "300"
|
|
56
|
+
| "400"
|
|
57
|
+
| "500"
|
|
58
|
+
| "600"
|
|
59
|
+
| "700"
|
|
60
|
+
| "800"
|
|
61
|
+
| "900";
|
|
62
|
+
borderStyle?: "outline" | "filled" | "gradient";
|
|
63
|
+
spacing?: {
|
|
64
|
+
marginBottom?: number;
|
|
65
|
+
paddingHorizontal?: number;
|
|
66
|
+
padding?: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ResultActionButton {
|
|
71
|
+
enabled?: boolean;
|
|
72
|
+
label?: string;
|
|
73
|
+
icon?: string;
|
|
74
|
+
variant?: "primary" | "secondary" | "outline" | "text";
|
|
75
|
+
position?: "top" | "bottom";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface ResultActionsConfig {
|
|
79
|
+
share?: ResultActionButton;
|
|
80
|
+
save?: ResultActionButton;
|
|
81
|
+
retry?: ResultActionButton;
|
|
82
|
+
layout?: "horizontal" | "vertical" | "grid";
|
|
83
|
+
buttonSpacing?: number;
|
|
84
|
+
spacing?: {
|
|
85
|
+
paddingHorizontal?: number;
|
|
86
|
+
paddingBottom?: number;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ResultLayoutConfig {
|
|
91
|
+
maxWidth?: number;
|
|
92
|
+
maxHeight?: string | number;
|
|
93
|
+
borderRadius?: number;
|
|
94
|
+
backgroundColor?: string;
|
|
95
|
+
scrollEnabled?: boolean;
|
|
96
|
+
contentPadding?: {
|
|
97
|
+
top?: number;
|
|
98
|
+
bottom?: number;
|
|
99
|
+
horizontal?: number;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Complete Result Preview Configuration
|
|
105
|
+
* Pass this from main app to customize all aspects of result preview
|
|
106
|
+
*/
|
|
107
|
+
export interface ResultConfig {
|
|
108
|
+
header?: ResultHeaderConfig;
|
|
109
|
+
image?: ResultImageConfig;
|
|
110
|
+
story?: ResultStoryConfig;
|
|
111
|
+
actions?: ResultActionsConfig;
|
|
112
|
+
layout?: ResultLayoutConfig;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Default configuration for result preview
|
|
117
|
+
* Used when no config is provided by main app
|
|
118
|
+
*/
|
|
119
|
+
export const DEFAULT_RESULT_CONFIG: ResultConfig = {
|
|
120
|
+
header: {
|
|
121
|
+
showTitle: true,
|
|
122
|
+
showDate: true,
|
|
123
|
+
showDateIcon: true,
|
|
124
|
+
titleAlignment: "center",
|
|
125
|
+
titleFontSize: 24,
|
|
126
|
+
titleFontWeight: "800",
|
|
127
|
+
dateBadgeStyle: "filled",
|
|
128
|
+
spacing: {
|
|
129
|
+
marginBottom: 20,
|
|
130
|
+
titleMarginBottom: 12,
|
|
131
|
+
paddingHorizontal: 24,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
image: {
|
|
135
|
+
aspectRatio: 1,
|
|
136
|
+
borderRadius: 20,
|
|
137
|
+
showBadge: true,
|
|
138
|
+
badgePosition: "top-right",
|
|
139
|
+
badgeStyle: "dark",
|
|
140
|
+
badgeIcon: "sparkles",
|
|
141
|
+
spacing: {
|
|
142
|
+
marginBottom: 20,
|
|
143
|
+
paddingHorizontal: 20,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
story: {
|
|
147
|
+
showQuotes: true,
|
|
148
|
+
textAlignment: "center",
|
|
149
|
+
fontSize: 14,
|
|
150
|
+
fontStyle: "italic",
|
|
151
|
+
fontWeight: "500",
|
|
152
|
+
borderStyle: "gradient",
|
|
153
|
+
spacing: {
|
|
154
|
+
marginBottom: 20,
|
|
155
|
+
paddingHorizontal: 20,
|
|
156
|
+
padding: 20,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
actions: {
|
|
160
|
+
share: {
|
|
161
|
+
enabled: true,
|
|
162
|
+
icon: "share-social",
|
|
163
|
+
variant: "primary",
|
|
164
|
+
position: "bottom",
|
|
165
|
+
},
|
|
166
|
+
save: {
|
|
167
|
+
enabled: true,
|
|
168
|
+
icon: "download",
|
|
169
|
+
variant: "secondary",
|
|
170
|
+
position: "bottom",
|
|
171
|
+
},
|
|
172
|
+
retry: {
|
|
173
|
+
enabled: true,
|
|
174
|
+
icon: "refresh",
|
|
175
|
+
variant: "text",
|
|
176
|
+
position: "top",
|
|
177
|
+
},
|
|
178
|
+
layout: "horizontal",
|
|
179
|
+
buttonSpacing: 10,
|
|
180
|
+
spacing: {
|
|
181
|
+
paddingHorizontal: 20,
|
|
182
|
+
paddingBottom: 20,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
layout: {
|
|
186
|
+
borderRadius: 28,
|
|
187
|
+
scrollEnabled: true,
|
|
188
|
+
contentPadding: {
|
|
189
|
+
top: 24,
|
|
190
|
+
bottom: 20,
|
|
191
|
+
horizontal: 0,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
};
|