@umituz/react-native-ai-generation-content 1.26.57 → 1.26.58
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.58",
|
|
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",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { getMediaTypeFromUrl } from "@umituz/react-native-design-system";
|
|
2
|
+
import { getMediaTypeFromUrl, extractMediaUrl } from "@umituz/react-native-design-system";
|
|
3
3
|
import { StepType } from "../../../../../domain/entities/flow-config.types";
|
|
4
4
|
import { GenericPhotoUploadScreen } from "../screens/GenericPhotoUploadScreen";
|
|
5
5
|
import { GeneratingScreen } from "../screens/GeneratingScreen";
|
|
6
6
|
import { ScenarioPreviewScreen } from "../../../../scenarios/presentation/screens/ScenarioPreviewScreen";
|
|
7
7
|
import { ResultPreviewScreen } from "../../../../result-preview/presentation/components/ResultPreviewScreen";
|
|
8
|
-
import { extractMediaUrl } from "../../infrastructure/utils/media-url-extractor";
|
|
9
8
|
import { getWizardStepConfig, getUploadedImage } from "./WizardStepRenderer.utils";
|
|
10
9
|
import type { WizardStepRendererProps } from "./WizardStepRenderer.types";
|
|
11
10
|
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface MediaUrlResult {
|
|
2
|
-
readonly url: string;
|
|
3
|
-
readonly isVideo: boolean;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
7
|
-
return typeof value === "object" && value !== null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function findStringValue(obj: Record<string, unknown>, keys: string[]): string | undefined {
|
|
11
|
-
for (const key of keys) {
|
|
12
|
-
const value = obj[key];
|
|
13
|
-
if (typeof value === "string" && value.length > 0) return value;
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function extractMediaUrl(result: unknown): MediaUrlResult | null {
|
|
19
|
-
if (!isRecord(result)) return null;
|
|
20
|
-
|
|
21
|
-
const output = isRecord(result.output) ? result.output : undefined;
|
|
22
|
-
const sources = output ? [output, result] : [result];
|
|
23
|
-
|
|
24
|
-
for (const source of sources) {
|
|
25
|
-
const videoUrl = findStringValue(source, ["videoUrl", "video_url"]);
|
|
26
|
-
if (videoUrl) return { url: videoUrl, isVideo: true };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
for (const source of sources) {
|
|
30
|
-
const imageUrl = findStringValue(source, ["imageUrl", "image_url", "uri"]);
|
|
31
|
-
if (imageUrl) return { url: imageUrl, isVideo: false };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
}
|