@umituz/react-native-ai-generation-content 1.72.14 → 1.72.15
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/domains/content-moderation/infrastructure/services/pattern-matcher.service.ts +7 -4
- package/src/domains/generation/wizard/presentation/components/WizardFlowContent.tsx +1 -0
- package/src/domains/generation/wizard/presentation/components/WizardStepRenderer.tsx +2 -1
- package/src/domains/generation/wizard/presentation/components/WizardStepRenderer.types.ts +2 -0
- package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.72.
|
|
3
|
+
"version": "1.72.15",
|
|
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",
|
|
@@ -22,11 +22,14 @@ function isValidRegexPattern(pattern: string): boolean {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Check for dangerous patterns that could cause ReDoS
|
|
25
|
+
// Note: These checks are conservative to prevent catastrophic backtracking
|
|
25
26
|
const dangerousPatterns = [
|
|
26
|
-
/\([^)]*\+\([^)]*\+\)/, // Nested repeated groups
|
|
27
|
-
/\([^)]*\*[^)]*\*\)/, // Multiple nested stars
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/\([^)]*\+\([^)]*\+\)/, // Nested repeated groups like (x+(y+))
|
|
28
|
+
/\([^)]*\*[^)]*\*\)/, // Multiple nested stars in groups like (x*(y*))
|
|
29
|
+
/\.\*\.\*\.\*/, // Three or more consecutive .* wildcards
|
|
30
|
+
/\.\+\.\+\.\+/, // Three or more consecutive .+ wildcards
|
|
31
|
+
/\(\.\*\)\+/, // Repeated wildcard groups like (.*)+
|
|
32
|
+
/\(\.\+\)\+/, // Repeated wildcard groups like (.+)+
|
|
30
33
|
];
|
|
31
34
|
|
|
32
35
|
for (const dangerous of dangerousPatterns) {
|
|
@@ -164,6 +164,7 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
|
|
|
164
164
|
onTryAgain={onTryAgain}
|
|
165
165
|
onDismissGenerating={handlers.handleDismissGenerating}
|
|
166
166
|
t={t}
|
|
167
|
+
alertMessages={alertMessages}
|
|
167
168
|
renderPreview={renderPreview}
|
|
168
169
|
renderGenerating={renderGenerating}
|
|
169
170
|
renderResult={renderResult}
|
|
@@ -34,6 +34,7 @@ export const WizardStepRenderer: React.FC<WizardStepRendererProps> = ({
|
|
|
34
34
|
onTryAgain,
|
|
35
35
|
onDismissGenerating,
|
|
36
36
|
t,
|
|
37
|
+
alertMessages,
|
|
37
38
|
renderPreview,
|
|
38
39
|
renderGenerating,
|
|
39
40
|
renderResult,
|
|
@@ -91,7 +92,7 @@ export const WizardStepRenderer: React.FC<WizardStepRendererProps> = ({
|
|
|
91
92
|
return renderPhotoUploadStep({ step, customData, onBack, onPhotoContinue, t });
|
|
92
93
|
|
|
93
94
|
case StepType.TEXT_INPUT:
|
|
94
|
-
return renderTextInputStep({ step, customData, onBack, onPhotoContinue, t });
|
|
95
|
+
return renderTextInputStep({ step, customData, onBack, onPhotoContinue, t, alertMessages });
|
|
95
96
|
|
|
96
97
|
case StepType.FEATURE_SELECTION:
|
|
97
98
|
return renderSelectionStep({ step, customData, onBack, onPhotoContinue, t });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StepDefinition } from "../../../../../domain/entities/flow-config.types";
|
|
2
2
|
import type { WizardScenarioData } from "../hooks/useWizardGeneration";
|
|
3
3
|
import type { UploadedImage } from "../../../../../presentation/hooks/generation/useAIGenerateState";
|
|
4
|
+
import type { AlertMessages } from "../../../../../presentation/hooks/generation/types";
|
|
4
5
|
|
|
5
6
|
export interface WizardStepRendererProps {
|
|
6
7
|
readonly step: StepDefinition | undefined;
|
|
@@ -21,6 +22,7 @@ export interface WizardStepRendererProps {
|
|
|
21
22
|
/** Called when user dismisses generating screen - generation continues in background */
|
|
22
23
|
readonly onDismissGenerating?: () => void;
|
|
23
24
|
readonly t: (key: string) => string;
|
|
25
|
+
readonly alertMessages?: AlertMessages;
|
|
24
26
|
readonly renderPreview?: (onContinue: () => void) => React.ReactElement | null;
|
|
25
27
|
readonly renderGenerating?: (progress: number) => React.ReactElement | null;
|
|
26
28
|
readonly renderResult?: (result: unknown) => React.ReactElement | null;
|
package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { TextInputScreen } from "../../screens/TextInputScreen";
|
|
|
7
7
|
import { getTextInputConfig } from "../WizardStepRenderer.utils";
|
|
8
8
|
import type { StepDefinition } from "../../../../../../domain/entities/flow-config.types";
|
|
9
9
|
import type { UploadedImage } from "../../../../../../presentation/hooks/generation/useAIGenerateState";
|
|
10
|
+
import type { AlertMessages } from "../../../../../../presentation/hooks/generation/types";
|
|
10
11
|
|
|
11
12
|
export interface TextInputStepProps {
|
|
12
13
|
readonly step: StepDefinition;
|
|
@@ -14,6 +15,7 @@ export interface TextInputStepProps {
|
|
|
14
15
|
readonly onBack: () => void;
|
|
15
16
|
readonly onPhotoContinue: (stepId: string, image: UploadedImage) => void;
|
|
16
17
|
readonly t: (key: string) => string;
|
|
18
|
+
readonly alertMessages?: AlertMessages;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export function renderTextInputStep({
|
|
@@ -22,6 +24,7 @@ export function renderTextInputStep({
|
|
|
22
24
|
onBack,
|
|
23
25
|
onPhotoContinue,
|
|
24
26
|
t,
|
|
27
|
+
alertMessages,
|
|
25
28
|
}: TextInputStepProps): React.ReactElement {
|
|
26
29
|
const textConfig = getTextInputConfig(step.config);
|
|
27
30
|
const titleKey = textConfig?.titleKey ?? `wizard.steps.${step.id}.title`;
|
|
@@ -45,6 +48,8 @@ export function renderTextInputStep({
|
|
|
45
48
|
continueButton: t("common.continue"),
|
|
46
49
|
backButton: t("common.back"),
|
|
47
50
|
examplesTitle: t("textInput.examplesTitle"),
|
|
51
|
+
contentNotAllowed: alertMessages?.errorTitle || alertMessages?.policyViolationTitle || t("common.error"),
|
|
52
|
+
contentNotAllowedMessage: alertMessages?.policyViolation || "This type of content is not supported. Please try a different prompt.",
|
|
48
53
|
}}
|
|
49
54
|
config={{
|
|
50
55
|
minLength: textConfig?.minLength ?? 3,
|