@umituz/react-native-design-system 4.23.100 → 4.23.101

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.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/AtomicInput.tsx +0 -2
  3. package/src/media/domain/entities/{MultimediaFlashcardTypes.ts → MediaAttachments.ts} +13 -32
  4. package/src/media/index.ts +24 -23
  5. package/src/media/infrastructure/services/MediaGenerationService.ts +1 -1
  6. package/src/media/infrastructure/services/MediaOptimizerService.ts +1 -1
  7. package/src/media/infrastructure/services/MediaUploadService.ts +1 -1
  8. package/src/media/infrastructure/services/MediaValidationService.ts +1 -1
  9. package/src/media/infrastructure/services/MultimediaFlashcardService.ts +1 -1
  10. package/src/media/infrastructure/utils/PermissionManager.ts +1 -1
  11. package/src/media/infrastructure/utils/media-collection-utils.ts +4 -2
  12. package/src/media/infrastructure/utils/mediaPickerMappers.ts +1 -1
  13. package/src/media/presentation/hooks/multimedia.types.ts +1 -1
  14. package/src/media/presentation/hooks/useCardMultimediaFlashcard.ts +4 -4
  15. package/src/media/presentation/hooks/useMedia.ts +2 -2
  16. package/src/media/presentation/hooks/useMediaGeneration.ts +1 -1
  17. package/src/media/presentation/hooks/useMediaUpload.ts +1 -1
  18. package/src/media/presentation/hooks/useMediaValidation.ts +1 -1
  19. package/src/media/presentation/hooks/useMultimediaFlashcard.ts +1 -1
  20. package/src/molecules/navigation/utils/AppNavigation.ts +3 -3
  21. package/src/storage/infrastructure/adapters/StorageService.ts +3 -3
  22. package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +5 -5
  23. package/src/storage/presentation/hooks/CacheStorageOperations.ts +3 -3
  24. package/src/storage/presentation/hooks/useStore.ts +0 -1
  25. package/src/media/domain/entities/CardMultimedia.types.README.md +0 -129
  26. package/src/media/domain/entities/Media.README.md +0 -80
  27. package/src/media/domain/entities/MultimediaFlashcardTypes.README.md +0 -144
  28. package/src/media/domain/utils/MediaUtils.README.md +0 -178
  29. package/src/media/index.ts.README.md +0 -191
  30. package/src/media/infrastructure/services/CardMultimediaService.README.md +0 -176
  31. package/src/media/infrastructure/services/CardMultimediaService.ts +0 -98
  32. package/src/media/infrastructure/services/MediaGenerationService.README.md +0 -142
  33. package/src/media/infrastructure/services/MediaOptimizerService.README.md +0 -145
  34. package/src/media/infrastructure/services/MediaPickerService.README.md +0 -106
  35. package/src/media/infrastructure/services/MediaSaveService.README.md +0 -120
  36. package/src/media/infrastructure/services/MediaUploadService.README.md +0 -135
  37. package/src/media/infrastructure/services/MediaValidationService.README.md +0 -135
  38. package/src/media/infrastructure/services/MultimediaFlashcardService.README.md +0 -142
  39. package/src/media/infrastructure/utils/mediaHelpers.README.md +0 -96
  40. package/src/media/infrastructure/utils/mediaPickerMappers.README.md +0 -129
  41. package/src/media/presentation/hooks/card-multimedia.types.README.md +0 -177
  42. package/src/media/presentation/hooks/card-multimedia.types.ts +0 -53
  43. package/src/media/presentation/hooks/multimedia.types.README.md +0 -201
  44. package/src/media/presentation/hooks/useCardMediaGeneration.ts +0 -20
  45. package/src/media/presentation/hooks/useCardMediaUpload.ts +0 -84
  46. package/src/media/presentation/hooks/useCardMediaValidation.ts +0 -104
  47. package/src/media/presentation/hooks/useCardMultimediaFlashcard.README.md +0 -158
  48. package/src/media/presentation/hooks/useMedia.README.md +0 -94
  49. package/src/media/presentation/hooks/useMediaGeneration.README.md +0 -118
  50. package/src/media/presentation/hooks/useMediaUpload.README.md +0 -108
  51. package/src/media/presentation/hooks/useMediaValidation.README.md +0 -134
  52. package/src/media/presentation/hooks/useMultimediaFlashcard.README.md +0 -141
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "4.23.100",
3
+ "version": "4.23.101",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -57,9 +57,7 @@ export const AtomicInput = React.forwardRef<React.ElementRef<typeof TextInput>,
57
57
  value,
58
58
  onChangeText,
59
59
  secureTextEntry,
60
- showPasswordToggle,
61
60
  maxLength,
62
- showCharacterCount,
63
61
  });
64
62
 
65
63
  const isDisabled = state === 'disabled' || disabled;
@@ -1,22 +1,22 @@
1
1
  /**
2
- * Multimedia Flashcard Types
3
- * Extended media types for flashcard support
2
+ * Media Attachments Types
3
+ * Types for media attachments in flashcards and content
4
4
  */
5
5
 
6
- export type MediaType = "image" | "audio" | "video";
6
+ export type MediaAttachmentType = "image" | "audio" | "video";
7
7
  export type MediaPosition = "front" | "back" | "both";
8
8
 
9
9
  export interface MediaAttachment {
10
10
  id: string;
11
- type: MediaType;
11
+ type: MediaAttachmentType;
12
12
  position: MediaPosition;
13
13
  url: string;
14
14
  localPath?: string;
15
15
  filename: string;
16
16
  fileSize: number;
17
17
  mimeType: string;
18
- duration?: number; // For audio/video in seconds
19
- thumbnailUrl?: string; // For videos
18
+ duration?: number;
19
+ thumbnailUrl?: string;
20
20
  caption?: string;
21
21
  isDownloaded: boolean;
22
22
  createdAt: string;
@@ -30,12 +30,11 @@ export interface MultimediaFlashcard {
30
30
  tags: string[];
31
31
  createdAt?: string;
32
32
  updatedAt?: string;
33
- // Extended properties for multimedia support
34
33
  media: MediaAttachment[];
35
- hasMedia: boolean; // Computed property
36
- mediaType: MediaType[]; // Array of media types present
37
- isDownloaded: boolean; // All media downloaded?
38
- estimatedSize: number; // Total size in bytes
34
+ hasMedia: boolean;
35
+ mediaType: MediaAttachmentType[];
36
+ isDownloaded: boolean;
37
+ estimatedSize: number;
39
38
  }
40
39
 
41
40
  export interface MediaGenerationRequest {
@@ -65,17 +64,17 @@ export interface MediaGenerationResult {
65
64
 
66
65
  export interface MediaUploadProgress {
67
66
  fileId: string;
68
- progress: number; // 0-100
67
+ progress: number;
69
68
  status: "uploading" | "processing" | "completed" | "error";
70
69
  error?: string;
71
70
  url?: string;
72
71
  }
73
72
 
74
73
  export interface MediaCompressionOptions {
75
- quality: number; // 0.1 - 1.0
74
+ quality: number;
76
75
  maxWidth?: number;
77
76
  maxHeight?: number;
78
- maxFileSize?: number; // bytes
77
+ maxFileSize?: number;
79
78
  format?: "jpeg" | "png" | "webp";
80
79
  }
81
80
 
@@ -100,21 +99,3 @@ export interface MediaValidation {
100
99
  warnings: string[];
101
100
  recommendations: string[];
102
101
  }
103
-
104
- export interface MultimediaFlashcardService {
105
- uploadMedia(
106
- file: MediaFile,
107
- options?: MediaCompressionOptions,
108
- ): Promise<MediaAttachment>;
109
- generateMedia(
110
- request: MediaGenerationRequest,
111
- ): Promise<MediaGenerationResult>;
112
- validateMedia(file: MediaFile): Promise<MediaValidation>;
113
- optimizeMedia(
114
- attachment: MediaAttachment,
115
- options: MediaCompressionOptions,
116
- ): Promise<MediaAttachment>;
117
- deleteMedia(attachmentId: string): Promise<void>;
118
- getMediaUrl(attachmentId: string): Promise<string>;
119
- downloadMedia(attachmentId: string): Promise<string>; // Returns local path
120
- }
@@ -91,28 +91,29 @@ export {
91
91
  type SaveToGalleryResult,
92
92
  } from "./infrastructure/utils/file-media-utils";
93
93
 
94
- // Multimedia Flashcard Support
94
+ // Media Attachment Types (Clean, no aliases)
95
95
  export type {
96
- CardMediaType,
97
- CardMediaPosition,
98
- CardMediaAttachment,
99
- CardMultimediaFlashcard,
100
- CardMediaGenerationRequest,
101
- CardMediaGenerationResult,
102
- CardMediaUploadProgress,
103
- CardMediaCompressionOptions,
104
- CardMediaValidation,
105
- } from "./domain/entities/CardMultimedia.types";
96
+ MediaAttachmentType,
97
+ MediaPosition,
98
+ MediaAttachment,
99
+ MultimediaFlashcard,
100
+ MediaGenerationRequest,
101
+ MediaGenerationResult,
102
+ MediaUploadProgress,
103
+ MediaCompressionOptions,
104
+ MediaValidation,
105
+ MediaFile,
106
+ CreateMultimediaCardData,
107
+ } from "./domain/entities/MediaAttachments";
106
108
 
107
- export { CardMultimediaFlashcardService } from "./infrastructure/services/CardMultimediaService";
108
-
109
- export {
110
- useCardMediaUpload,
111
- useCardMediaGeneration,
112
- useCardMediaValidation,
113
- useCardMultimediaFlashcard,
114
- type UseCardMediaUploadResult,
115
- type UseCardMediaGenerationResult,
116
- type UseCardMediaValidationResult,
117
- type UseCardMultimediaFlashcardResult,
118
- } from "./presentation/hooks/useCardMultimediaFlashcard";
109
+ // Media Hooks
110
+ export { useMediaUpload } from "./presentation/hooks/useMediaUpload";
111
+ export { useMediaGeneration } from "./presentation/hooks/useMediaGeneration";
112
+ export { useMediaValidation } from "./presentation/hooks/useMediaValidation";
113
+ export { useMultimediaFlashcard } from "./presentation/hooks/useMultimediaFlashcard";
114
+ export type {
115
+ UseMediaUploadResult,
116
+ UseMediaGenerationResult,
117
+ UseMediaValidationResult,
118
+ UseMultimediaFlashcardResult,
119
+ } from "./presentation/hooks/multimedia.types";
@@ -9,7 +9,7 @@ import type {
9
9
  MediaGenerationResult,
10
10
  MediaType,
11
11
  MediaPosition,
12
- } from "../../domain/entities/MultimediaFlashcardTypes";
12
+ } from "../../domain/entities/MediaAttachments";
13
13
 
14
14
  export class MediaGenerationService {
15
15
  /**
@@ -6,7 +6,7 @@
6
6
  import type {
7
7
  MediaAttachment,
8
8
  MediaCompressionOptions,
9
- } from "../../domain/entities/MultimediaFlashcardTypes";
9
+ } from "../../domain/entities/MediaAttachments";
10
10
 
11
11
  export class MediaOptimizerService {
12
12
  /**
@@ -7,7 +7,7 @@ import type {
7
7
  MediaAttachment,
8
8
  MediaCompressionOptions,
9
9
  MediaFile,
10
- } from "../../domain/entities/MultimediaFlashcardTypes";
10
+ } from "../../domain/entities/MediaAttachments";
11
11
  import { generateThumbnail, getMediaDuration } from "../utils/file-media-utils";
12
12
  import { getMediaTypeFromMime } from "../utils/mime-type-detector";
13
13
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { formatFileSize } from "../utils/media-collection-utils";
7
- import type { MediaValidation, MediaFile } from "../../domain/entities/MultimediaFlashcardTypes";
7
+ import type { MediaValidation, MediaFile } from "../../domain/entities/MediaAttachments";
8
8
 
9
9
  export class MediaValidationService {
10
10
  /**
@@ -10,7 +10,7 @@ import type {
10
10
  MediaGenerationResult,
11
11
  MediaCompressionOptions,
12
12
  MediaValidation,
13
- } from "../../domain/entities/MultimediaFlashcardTypes";
13
+ } from "../../domain/entities/MediaAttachments";
14
14
  import { MediaUploadService } from "./MediaUploadService";
15
15
  import { MediaGenerationService } from "./MediaGenerationService";
16
16
  import { MediaValidationService } from "./MediaValidationService";
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import * as ImagePicker from "expo-image-picker";
8
- import { MediaLibraryPermission } from "../../domain/entities/Media";
8
+ import { MediaLibraryPermission } from "../../domain/entities/MediaAttachments";
9
9
  import { mapPermissionStatus } from "./mediaPickerMappers";
10
10
 
11
11
  /**
@@ -1,5 +1,7 @@
1
- import type { CardMediaAttachment } from "../../domain/entities/CardMultimedia.types";
2
- import type { MediaAttachment } from "../../domain/entities/MultimediaFlashcardTypes";
1
+ import type { MediaAttachment } from "../../domain/entities/MediaAttachments";
2
+
3
+ // CardMediaAttachment is an alias of MediaAttachment
4
+ type CardMediaAttachment = MediaAttachment;
3
5
 
4
6
  type MediaType = "image" | "audio" | "video";
5
7
 
@@ -9,7 +9,7 @@ import {
9
9
  MediaType,
10
10
  type MediaAsset,
11
11
  type MediaPickerResult,
12
- } from "../../domain/entities/Media";
12
+ } from "../../domain/entities/MediaAttachments";
13
13
 
14
14
  /**
15
15
  * Map expo-image-picker permission status to MediaLibraryPermission
@@ -13,7 +13,7 @@ import type {
13
13
  MediaUploadProgress,
14
14
  MultimediaFlashcard,
15
15
  CreateMultimediaCardData,
16
- } from "../../domain/entities/MultimediaFlashcardTypes";
16
+ } from "../../domain/entities/MediaAttachments";
17
17
 
18
18
  export interface UseMediaUploadResult {
19
19
  uploadMedia: (
@@ -7,10 +7,10 @@ import { useState, useCallback } from "react";
7
7
  import { calculateTotalSize, extractMediaTypes } from "../../infrastructure/utils/media-collection-utils";
8
8
  import type { UseCardMultimediaFlashcardResult } from "./card-multimedia.types";
9
9
  import type {
10
- CardMediaAttachment,
11
- CardMultimediaFlashcard,
12
- CreateCardMultimediaData,
13
- } from "../../domain/entities/CardMultimedia.types";
10
+ MediaAttachment as CardMediaAttachment,
11
+ MultimediaFlashcard as CardMultimediaFlashcard,
12
+ CreateMultimediaCardData as CreateCardMultimediaData,
13
+ } from "../../domain/entities/MediaAttachments";
14
14
 
15
15
  // Export individual hooks
16
16
  export { useCardMediaUpload } from "./useCardMediaUpload";
@@ -12,8 +12,8 @@ import type {
12
12
  MediaPickerOptions,
13
13
  MediaPickerResult,
14
14
  CameraOptions,
15
- } from "../../domain/entities/Media";
16
- import { MediaLibraryPermission } from "../../domain/entities/Media";
15
+ } from "../../domain/entities/MediaAttachments";
16
+ import { MediaLibraryPermission } from "../../domain/entities/MediaAttachments";
17
17
 
18
18
  /**
19
19
  * useMedia hook for complete media workflow
@@ -9,7 +9,7 @@ import type { UseMediaGenerationResult } from "./multimedia.types";
9
9
  import type {
10
10
  MediaAttachment,
11
11
  MediaGenerationRequest,
12
- } from "../../domain/entities/MultimediaFlashcardTypes";
12
+ } from "../../domain/entities/MediaAttachments";
13
13
 
14
14
  export const useMediaGeneration = (): UseMediaGenerationResult => {
15
15
  return useGenericMediaGeneration<MediaAttachment, MediaGenerationRequest>(
@@ -12,7 +12,7 @@ import type {
12
12
  MediaCompressionOptions,
13
13
  MediaFile,
14
14
  MediaUploadProgress,
15
- } from "../../domain/entities/MultimediaFlashcardTypes";
15
+ } from "../../domain/entities/MediaAttachments";
16
16
 
17
17
  export const useMediaUpload = (): UseMediaUploadResult => {
18
18
  const [isUploading, setIsUploading] = useState(false);
@@ -6,7 +6,7 @@
6
6
  import { useState, useCallback } from "react";
7
7
  import { formatFileSize } from "../../infrastructure/utils/media-collection-utils";
8
8
  import type { UseMediaValidationResult } from "./multimedia.types";
9
- import type { MediaValidation, MediaFile } from "../../domain/entities/MultimediaFlashcardTypes";
9
+ import type { MediaValidation, MediaFile } from "../../domain/entities/MediaAttachments";
10
10
 
11
11
  export const useMediaValidation = (): UseMediaValidationResult => {
12
12
  const [isValidating, setIsValidating] = useState(false);
@@ -10,7 +10,7 @@ import type {
10
10
  MediaAttachment,
11
11
  MultimediaFlashcard,
12
12
  CreateMultimediaCardData,
13
- } from "../../domain/entities/MultimediaFlashcardTypes";
13
+ } from "../../domain/entities/MediaAttachments";
14
14
 
15
15
  // Export individual hooks
16
16
  export { useMediaUpload } from "./useMediaUpload";
@@ -40,7 +40,7 @@ export const navigate = (name: string, params?: object): void => {
40
40
  if (__DEV__) {
41
41
  }
42
42
  if (navigationRef?.isReady()) {
43
- navigationRef.navigate(name as never, params as never);
43
+ navigationRef.navigate(name, params);
44
44
  }
45
45
  };
46
46
 
@@ -54,10 +54,10 @@ export const navigateNested = (navigatorName: string, screenName: string, params
54
54
  if (__DEV__) {
55
55
  }
56
56
  if (navigationRef?.isReady()) {
57
- navigationRef.navigate(navigatorName as never, {
57
+ navigationRef.navigate(navigatorName, {
58
58
  screen: screenName,
59
59
  params,
60
- } as never);
60
+ });
61
61
  }
62
62
  };
63
63
 
@@ -16,7 +16,7 @@ export const storageService: StateStorage = {
16
16
  getItem: async (name: string): Promise<string | null> => {
17
17
  try {
18
18
  return await AsyncStorage.getItem(name);
19
- } catch (error) {
19
+ } catch (_error) {
20
20
  return null;
21
21
  }
22
22
  },
@@ -24,7 +24,7 @@ export const storageService: StateStorage = {
24
24
  setItem: async (name: string, value: string): Promise<void> => {
25
25
  try {
26
26
  await AsyncStorage.setItem(name, value);
27
- } catch (error) {
27
+ } catch (_error) {
28
28
  // Silent failure
29
29
  }
30
30
  },
@@ -32,7 +32,7 @@ export const storageService: StateStorage = {
32
32
  removeItem: async (name: string): Promise<void> => {
33
33
  try {
34
34
  await AsyncStorage.removeItem(name);
35
- } catch (error) {
35
+ } catch (_error) {
36
36
  // Silent failure
37
37
  }
38
38
  },
@@ -36,7 +36,7 @@ export class BaseStorageOperations {
36
36
  } catch (parseError) {
37
37
  return failure(new StorageDeserializationError(key, parseError), defaultValue);
38
38
  }
39
- } catch (error) {
39
+ } catch (_error) {
40
40
  return failure(new StorageReadError(key, error), defaultValue);
41
41
  }
42
42
  }
@@ -55,7 +55,7 @@ export class BaseStorageOperations {
55
55
 
56
56
  await AsyncStorage.setItem(key, serialized);
57
57
  return success(value);
58
- } catch (error) {
58
+ } catch (_error) {
59
59
  return failure(new StorageWriteError(key, error));
60
60
  }
61
61
  }
@@ -67,7 +67,7 @@ export class BaseStorageOperations {
67
67
  try {
68
68
  await AsyncStorage.removeItem(key);
69
69
  return success(undefined);
70
- } catch (error) {
70
+ } catch (_error) {
71
71
  return failure(new StorageDeleteError(key, error));
72
72
  }
73
73
  }
@@ -79,7 +79,7 @@ export class BaseStorageOperations {
79
79
  try {
80
80
  const value = await AsyncStorage.getItem(key);
81
81
  return value !== null;
82
- } catch (error) {
82
+ } catch (_error) {
83
83
  return false;
84
84
  }
85
85
  }
@@ -91,7 +91,7 @@ export class BaseStorageOperations {
91
91
  try {
92
92
  await AsyncStorage.clear();
93
93
  return success(undefined);
94
- } catch (error) {
94
+ } catch (_error) {
95
95
  return failure(new StorageDeleteError('ALL_KEYS', error));
96
96
  }
97
97
  }
@@ -59,7 +59,7 @@ export class CacheStorageOperations {
59
59
  }
60
60
 
61
61
  return null;
62
- } catch (error) {
62
+ } catch (_error) {
63
63
  return null;
64
64
  }
65
65
  }
@@ -79,7 +79,7 @@ export class CacheStorageOperations {
79
79
  try {
80
80
  const cached = createCachedValue(value, ttl || 0, version);
81
81
  await storageRepository.setString(key, JSON.stringify(cached));
82
- } catch (error) {
82
+ } catch (_error) {
83
83
  // Silent failure
84
84
  }
85
85
  }
@@ -92,7 +92,7 @@ export class CacheStorageOperations {
92
92
 
93
93
  try {
94
94
  await storageRepository.removeItem(key);
95
- } catch (error) {
95
+ } catch (_error) {
96
96
  // Silent failure
97
97
  }
98
98
  }
@@ -16,7 +16,6 @@ export function useStore<T extends object>(config: StoreConfig<T>) {
16
16
  config.version,
17
17
  config.persist,
18
18
  config.storage,
19
- config.ttl,
20
19
  ]
21
20
  );
22
21
 
@@ -1,129 +0,0 @@
1
- # CardMultimedia Types
2
-
3
- ## Purpose
4
- Type definitions for flashcard-specific media operations. These types define the contract for media attachment, generation, and management within the card-based learning system.
5
-
6
- ## File Location
7
- `src/domain/entities/CardMultimedia.types.ts`
8
-
9
- ## Strategy
10
- - Define the contract for card-specific media operations
11
- - Provide type-safe interfaces for flashcard media attachments
12
- - Support AI-powered media generation for educational content
13
- - Enable comprehensive media validation and optimization
14
- - Maintain clear separation between card media and general media types
15
- - Support upload progress tracking and compression
16
- - Facilitate media download management for offline learning
17
-
18
- ## Forbidden
19
- - **DO NOT** use these types for general-purpose media operations (use Multimedia types instead)
20
- - **DO NOT** include UI components or presentation logic in type definitions
21
- - **DO NOT** add business logic or implementation details to interfaces
22
- - **DO NOT** create circular dependencies with other domain types
23
- - **DO NOT** use `any` type or loose type definitions
24
- - **DO NOT** modify existing type properties - extend interfaces for new features
25
- - **DO NOT** assume specific storage backend or cloud provider
26
- - **DO NOT** hardcode validation limits in type definitions
27
- - **DO NOT** mix card media types with general multimedia types
28
-
29
- ## Rules
30
- 1. All card media types must be exported from this file
31
- 2. Type definitions must be framework-agnostic
32
- 3. Card media IDs must use "card_media_" prefix for uniqueness
33
- 4. Position types must explicitly define front/back/both placement
34
- 5. File size fields must use bytes as unit
35
- 6. Duration fields must use seconds as unit
36
- 7. Date fields must use ISO 8601 format
37
- 8. All generation requests must include input validation
38
- 9. Compression quality must be between 0.1 and 1.0
39
- 10. Upload progress must be tracked from 0-100
40
- 11. Validation results must separate errors, warnings, and recommendations
41
- 12. Service interfaces must return Promises for all async operations
42
- 13. Media type arrays must be automatically calculated, not manually set
43
- 14. Download status must be tracked per attachment
44
- 15. Estimated size must represent total of all attachments
45
-
46
- ## AI Agent Guidelines
47
-
48
- When working with CardMultimedia types:
49
-
50
- 1. **Type Selection**: Use CardMediaAttachment for flashcard-specific media operations
51
- 2. **Generation Requests**: Always specify input parameters and options explicitly
52
- 3. **Validation**: Validate media files before upload and after generation
53
- 4. **Progress Tracking**: Monitor upload progress for user feedback
54
- 5. **Compression**: Apply compression options before upload to reduce bandwidth
55
- 6. **Download Management**: Check isDownloaded status before displaying media
56
- 7. **Position Logic**: Respect position field for front/back/both placement
57
- 8. **Size Estimation**: Calculate total size for all media before batch operations
58
- 9. **Error Handling**: Parse validation errors and warnings for user feedback
59
- 10. **Cost Tracking**: Monitor creditsUsed for AI generation operations
60
-
61
- ### Key Types Reference
62
-
63
- - **CardMediaType**: "image" | "audio" | "video" - Media type classification for cards
64
- - **CardMediaPosition**: "front" | "back" | "both" - Display placement on card faces
65
- - **CardMediaAttachment**: Core interface for individual media items with metadata
66
- - **CardMultimediaFlashcard**: Card entity with computed media properties
67
- - **CardMediaGenerationRequest**: Input specification for AI media generation
68
- - **CardMediaGenerationResult**: Output with cost tracking and performance metrics
69
- - **CardMediaUploadProgress**: Real-time upload status tracking
70
- - **CardMediaCompressionOptions**: Quality and size optimization settings
71
- - **CardMediaValidation**: Comprehensive validation with recommendations
72
- - **CardMultimediaFlashcardService**: Service interface for media operations
73
-
74
- ### Type Usage Patterns
75
-
76
- 1. **CardMediaAttachment**: Individual media item with position, URL, and metadata
77
- 2. **CardMultimediaFlashcard**: Card with computed properties (hasMedia, mediaType, isDownloaded)
78
- 3. **CardMediaGenerationRequest**: Three generation types (text_to_image, text_to_audio, image_search)
79
- 4. **CardMediaValidation**: Separate errors (blocking) from warnings and recommendations
80
-
81
- ### Validation Rules
82
-
83
- 1. Validate file size against upload limits before processing
84
- 2. Check MIME type matches CardMediaType
85
- 3. Ensure dimensions are within supported ranges
86
- 4. Verify URIs are properly formatted and accessible
87
- 5. Validate duration for audio/video files
88
- 6. Check compression quality is within 0.1-1.0 range
89
- 7. Ensure generation prompts are non-empty strings
90
- 8. Validate language codes for audio generation (e.g., "tr-TR", "en-US")
91
-
92
- ### Service Interface Guidelines
93
-
94
- When implementing CardMultimediaFlashcardService:
95
-
96
- 1. **uploadMedia**: Accept file with optional compression, return attachment with URL
97
- 2. **generateMedia**: Process AI generation request, track credits and timing
98
- 3. **validateMedia**: Return comprehensive validation with errors, warnings, recommendations
99
- 4. **optimizeMedia**: Apply compression to existing attachment, preserve metadata
100
- 5. **deleteMedia**: Remove attachment and update card associations
101
- 6. **getMediaUrl**: Return accessible URL for downloaded or remote media
102
- 7. **downloadMedia**: Fetch remote media to local storage, update isDownloaded status
103
-
104
- ### Generation Type Specifics
105
-
106
- 1. **text_to_image**: Requires prompt, style (realistic/cartoon/artistic), quality, format
107
- 2. **text_to_audio**: Requires text, language, voice (male/female/neutral), format
108
- 3. **image_search**: Requires prompt, maxResults (no quality/format options)
109
-
110
- ### Position Logic
111
-
112
- 1. **front**: Media displayed only on card front face
113
- 2. **back**: Media displayed only on card back face
114
- 3. **both**: Media displayed on both card faces (e.g., background image)
115
-
116
- ### Download Management
117
-
118
- 1. Check isDownloaded before displaying media offline
119
- 2. Use localPath for offline access when available
120
- 3. Fall back to URL when media not downloaded
121
- 4. Track estimatedSize for storage management
122
- 5. Implement downloadMedia for offline caching
123
-
124
- ## Dependencies
125
-
126
- - No external dependencies
127
- - References domain types from Media.ts for base media concepts
128
- - Must be usable by infrastructure and presentation layers without additional dependencies
129
- - Service interfaces require async operation support