@umituz/react-native-ai-generation-content 1.17.255 → 1.17.257

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.17.255",
3
+ "version": "1.17.257",
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",
@@ -84,6 +84,15 @@ export class CreationsWriter {
84
84
  if (updates.output !== undefined) {
85
85
  updateData.output = updates.output;
86
86
  }
87
+ if ((updates as any).rating !== undefined) {
88
+ updateData.rating = (updates as any).rating;
89
+ }
90
+ if ((updates as any).ratedAt !== undefined) {
91
+ updateData.ratedAt = (updates as any).ratedAt;
92
+ }
93
+ if ((updates as any).isFavorite !== undefined) {
94
+ updateData.isFavorite = (updates as any).isFavorite;
95
+ }
87
96
 
88
97
  await updateDoc(docRef, updateData);
89
98
  return true;
@@ -20,6 +20,8 @@ export interface CreationCardData {
20
20
  uri?: string;
21
21
  provider?: string;
22
22
  createdAt: Date | number;
23
+ /** Whether this creation is marked as favorite */
24
+ isFavorite?: boolean;
23
25
  }
24
26
 
25
27
  /**
@@ -45,7 +45,8 @@ export function useCreationCardActions({
45
45
  if (callbacks.onFavorite) {
46
46
  result.push({
47
47
  id: "favorite",
48
- icon: "heart-outline",
48
+ icon: creation.isFavorite ? "heart" : "heart-outline",
49
+ color: creation.isFavorite ? "error" : undefined,
49
50
  onPress: () => callbacks.onFavorite?.(creation),
50
51
  });
51
52
  }
@@ -13,12 +13,28 @@ import type {
13
13
  } from "../types/result-preview.types";
14
14
 
15
15
  /**
16
- * Check if a string is a base64 data URL
16
+ * Check if a string is a base64 data URL or raw base64
17
17
  */
18
18
  const isBase64DataUrl = (str: string): boolean => {
19
19
  return str.startsWith("data:image/");
20
20
  };
21
21
 
22
+ /**
23
+ * Check if a string is raw base64 (not a URL and not a data URL)
24
+ */
25
+ const isRawBase64 = (str: string): boolean => {
26
+ return !str.startsWith("http") && !str.startsWith("data:image/") && !str.startsWith("file://");
27
+ };
28
+
29
+ /**
30
+ * Convert raw base64 to data URL format
31
+ */
32
+ const toDataUrl = (str: string): string => {
33
+ if (isBase64DataUrl(str)) return str;
34
+ if (isRawBase64(str)) return `data:image/jpeg;base64,${str}`;
35
+ return str;
36
+ };
37
+
22
38
  /**
23
39
  * Save base64 image to file system
24
40
  */
@@ -80,11 +96,13 @@ export const useResultActions = (
80
96
  throw new Error("Media library permission not granted");
81
97
  }
82
98
 
83
- let fileUri = imageUrl;
99
+ // Convert to data URL if raw base64
100
+ const normalizedUrl = toDataUrl(imageUrl);
101
+ let fileUri = normalizedUrl;
84
102
 
85
103
  // If it's a base64 string, save to file first
86
- if (isBase64DataUrl(fileUri)) {
87
- fileUri = await saveBase64ToFile(fileUri);
104
+ if (isBase64DataUrl(normalizedUrl)) {
105
+ fileUri = await saveBase64ToFile(normalizedUrl);
88
106
  }
89
107
 
90
108
  // Save to media library
@@ -112,11 +130,13 @@ export const useResultActions = (
112
130
  setIsSharing(true);
113
131
  onShareStart?.();
114
132
 
115
- let shareUrl = imageUrl;
133
+ // Convert to data URL if raw base64
134
+ const normalizedUrl = toDataUrl(imageUrl);
135
+ let shareUrl = normalizedUrl;
116
136
 
117
137
  // If it's a base64 string, save to file first for sharing
118
- if (isBase64DataUrl(shareUrl)) {
119
- shareUrl = await saveBase64ToFile(shareUrl);
138
+ if (isBase64DataUrl(normalizedUrl)) {
139
+ shareUrl = await saveBase64ToFile(normalizedUrl);
120
140
  }
121
141
 
122
142
  // Use expo-sharing for cross-platform file sharing
@@ -7,7 +7,6 @@ import { View, Pressable, StyleSheet } from "react-native";
7
7
  import {
8
8
  AtomicText,
9
9
  AtomicIcon,
10
- useAppDesignTokens,
11
10
  useSafeAreaInsets,
12
11
  } from "@umituz/react-native-design-system";
13
12
  import { useLocalization } from "@umituz/react-native-localization";
@@ -29,7 +28,6 @@ export const GeneratorHeader: React.FC<GeneratorHeaderProps> = ({
29
28
  onGenerate,
30
29
  isGenerating,
31
30
  }) => {
32
- const tokens = useAppDesignTokens();
33
31
  const { top } = useSafeAreaInsets();
34
32
  const { t } = useLocalization();
35
33
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useState, useCallback, useEffect } from "react";
7
- import { useNavigation, useIsFocused, useRoute } from "@react-navigation/native";
7
+ import { useIsFocused } from "@react-navigation/native";
8
8
  import { MessageType, MessageTone } from "../../domain/types";
9
9
  import { generateLoveMessage } from "../../infrastructure/services/LoveMessageService";
10
10
  import { PartnerProfileRepository } from "../../infrastructure/persistence/PartnerProfileRepository";
@@ -76,7 +76,7 @@ export const useLoveMessageGenerator = (config: {
76
76
 
77
77
  setGeneratedMessage(message);
78
78
  setCurrentStep(GeneratorStep.RESULT);
79
- } catch (error) {
79
+ } catch {
80
80
  // Error handled in usecase
81
81
  } finally {
82
82
  setIsGenerating(false);
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  import { useState, useEffect, useCallback } from "react";
6
- import { useNavigation } from "@react-navigation/native";
7
6
  import { PartnerProfile } from "../../domain/types";
8
7
  import { PartnerProfileRepository } from "../../infrastructure/persistence/PartnerProfileRepository";
9
8
 
@@ -5,10 +5,10 @@
5
5
 
6
6
  import React from "react";
7
7
  import { createStackNavigator } from "@react-navigation/stack";
8
- import { LoveMessageExploreScreen } from "@domains/love-message/presentation/screens/LoveMessageExploreScreen";
9
- import { MessageListScreen } from "@domains/love-message/presentation/screens/MessageListScreen";
10
- import { LoveMessageGeneratorScreen } from "@domains/love-message/presentation/screens/LoveMessageGeneratorScreen";
11
- import { PartnerProfileScreen } from "@domains/love-message/presentation/screens/PartnerProfileScreen";
8
+ import { LoveMessageExploreScreen } from "../screens/LoveMessageExploreScreen";
9
+ import { MessageListScreen } from "../screens/MessageListScreen";
10
+ import { LoveMessageGeneratorScreen } from "../screens/LoveMessageGeneratorScreen";
11
+ import { PartnerProfileScreen } from "../screens/PartnerProfileScreen";
12
12
 
13
13
  export type LoveMessageStackParamList = {
14
14
  LoveMessageExplore: undefined;
@@ -3,16 +3,12 @@
3
3
  * Premium entry point for Love Message domain
4
4
  */
5
5
 
6
- import { FC, useCallback } from "react";
7
- import { View, ScrollView, StyleSheet, Pressable } from "react-native";
6
+ import { FC } from "react";
7
+ import { View, ScrollView, StyleSheet } from "react-native";
8
8
  import {
9
- AtomicText,
10
- AtomicIcon,
11
9
  useAppDesignTokens,
12
10
  useSafeAreaInsets,
13
11
  } from "@umituz/react-native-design-system";
14
- import { useLocalization } from "@umituz/react-native-localization";
15
- import { useNavigation } from "@react-navigation/native";
16
12
  import { ExploreHeader } from "../components/ExploreHeader";
17
13
  import { LoveMessageHeroSection } from "../components/LoveMessageHeroSection";
18
14
  import { CategoryGrid } from "../components/CategoryGrid";
@@ -31,7 +27,6 @@ export const LoveMessageExploreScreen: FC<LoveMessageExploreScreenProps> = ({
31
27
  }) => {
32
28
  const tokens = useAppDesignTokens();
33
29
  const { bottom } = useSafeAreaInsets();
34
- const { t } = useLocalization();
35
30
 
36
31
  return (
37
32
  <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
@@ -11,7 +11,6 @@ import {
11
11
  useSafeAreaInsets,
12
12
  } from "@umituz/react-native-design-system";
13
13
  import { useLocalization } from "@umituz/react-native-localization";
14
- import { useNavigation, useRoute } from "@react-navigation/native";
15
14
  import { CATEGORY_TEMPLATES, MESSAGE_TYPES } from "../../domain/constants";
16
15
  import { MessageListItem } from "../components/MessageListItem";
17
16