fsalmansour's picture
تمّ التوسّع في المتطلبات ليشمل: 1. دفع الإشعارات (Push Notifications) لتنبيهات المخزون و وصول ردود المساعد. 2. دعم الملفات (صور / PDF ≤ 5 MB) ضمن الدردشة. 3. رسائل صوتيّة (تسجيل ميكروفون، رفع الـ Blob، اختياريًا Whisper لتحويل الكلام إلى نص). أدناه برومت واحد بالإنجليزي يضيف كل هذه الميزات إلى الصفحة السابقة — انسخه إلى DeepSite ثم Generate. ⸻ # === ADD-ON FEATURES === ## Push Notifications • Ask permission on first load or via Settings toggle “Enable Push Notifications”. • Register `sw.js` service-worker (inline snippet) that listens for “push” and shows system notification with icon **fa-bell**. • Front-end helper `notify(title, body)` called when: 1) assistant sends a chat reply **while chat panel is closed**, 2) any product stock drops below 10 (badge red → notification “Low stock on SKU …”). • Fallback: if permission !== ‘granted’ just show in-app toast. ## Chat – File & Voice ### UI additions • Inside chat composer add two buttons before Send: 1. **fa-paperclip** opens hidden `<input type=file multiple accept="image/*,.pdf">`. 2. **fa-microphone-lines** toggles `recording` state → show red circle blink; on second click stops and sends audio. • Show each attachment as a bubble: - Images: thumbnail preview; click = full-screen lightbox. - PDF / other: **fa-file** icon + filename (download link). - Voice: inline `<audio controls>` player. ### JS logic ```javascript attachments: [], recording:false, mediaRec:null, chunks:[], handleFileUpload(e){[...e.target.files].forEach(f=>this.attachments.push(f));}, toggleRecord(){ if(!this.recording){ navigator.mediaDevices.getUserMedia({audio:true}).then(stream=>{ this.mediaRec = new MediaRecorder(stream); this.mediaRec.ondataavailable = ev => this.chunks.push(ev.data); this.mediaRec.onstop = ()=>{ const blob = new Blob(this.chunks,{type:'audio/webm'}); this.attachments.push(blob); this.chunks=[]; }; this.mediaRec.start(); this.recording=true; }); }else{ this.mediaRec.stop(); this.recording=false; } }, • On sendMessage() embed attachments array; upload each file to /api/upload (return URL) then include markdown links in message. Reset attachments=[]. Bulk Import Endpoint /api/products/bulk receives CSV, returns JSON array → merge into products[] and recalc stock alerts. Service Worker (include at bottom) <script> if('serviceWorker' in navigator){navigator.serviceWorker.register('/sw.js');} </script> sw.js (auto-generated by DeepSite) listens for “push” & shows notifications. === UPDATE PROMPT SECTIONS FROM PREVIOUS SPEC === ➤ Settings modal: toggle fa-bell “Enable Push Notifications”. ➤ Products section: call notify() when stock drops < 10. ➤ Chat sendMessage(): when panel hidden, call notify('Store AI', 'Assistant replied…'). ➤ Command Palette: new commands “enable notifications”, “disable notifications”, “send test push”. === EVERYTHING ELSE remains exactly as in the last spec (dark neon, glass, FABs, localStorage, speech-to-text, etc.) === --- > بعد التوليد: > • ارفع ملفّ `sw.js` البسيط (يدرّج كود `self.addEventListener('push', … )`). > • اربط `/api/upload`, `/api/products/bulk`، وWeb-Push back-end (أو Firebase Cloud Messaging) حسب بنيتك. > > لأي استفسار إضافي أنا حاضر. - Follow Up Deployment
f6f3698 verified