feat: types ImageItem + dépendances heic2any jszip
- Install heic2any and jszip dependencies - Create src/types/images.ts with ImageItem, ImageStatus, ImageProgress, and ZipEntry types - heic2any includes bundled TypeScript types (no declaration file needed) - ImageItem is the central data model for the image processing module with support for: - HEIC to JPEG conversion - AI-powered background removal - Shopify product lookup and upload - Progress tracking and error handling - Rotation and feather adjustments (cached PNG blob for fast re-processing) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
export type ImageStatus =
|
||||
| 'pending' // ajouté, pas encore traité
|
||||
| 'converting' // HEIC → JPEG en cours
|
||||
| 'processing' // détourage IA en cours
|
||||
| 'searching' // recherche produit Shopify en cours
|
||||
| 'ready' // prêt à uploader
|
||||
| 'uploading' // upload Shopify en cours
|
||||
| 'uploaded' // uploadé avec succès
|
||||
| 'not_found' // référence produit introuvable dans Shopify
|
||||
| 'error' // erreur à n'importe quelle étape
|
||||
|
||||
export interface ImageProgress {
|
||||
key: string
|
||||
percent: number
|
||||
}
|
||||
|
||||
export interface ImageItem {
|
||||
id: string
|
||||
filename: string // nom de fichier original (ex: "REF-1042.heic")
|
||||
ref: string // référence produit extraite (ex: "REF-1042")
|
||||
originalBlob: Blob // image originale (pour la vue "avant")
|
||||
rawPngBlob: Blob | null // PNG transparent issu du détourage IA (cache pour feather)
|
||||
processedBlob: Blob | null // JPEG final sur fond blanc, pivoté (pour upload + vue "après")
|
||||
rotation: number // 0, 90, 180, 270
|
||||
feather: number // 0–5, défaut 2
|
||||
shopifyProductId: string | null
|
||||
shopifyProductTitle: string | null
|
||||
uploadedUrl: string | null
|
||||
status: ImageStatus
|
||||
error: string | null
|
||||
progress: ImageProgress | null
|
||||
}
|
||||
|
||||
export interface ZipEntry {
|
||||
folder: string // nom du dossier = référence produit
|
||||
filename: string // nom de fichier dans le dossier
|
||||
ext: string // extension sans point, en minuscules
|
||||
blob: Blob // blob avec type MIME correct
|
||||
isHeic: boolean
|
||||
}
|
||||
Reference in New Issue
Block a user