You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adjusters need the ability to export completed assessments as a shareable package containing all photos and damage notes. The export must be organized, easily shareable via email/messaging, and mark the assessment as complete.
Services/Areas Involved
Photo Storage Layer: IndexedDB (photo-storage-indexeddb.ts) for retrieving photo blobs
Claims Management: useClaims() hook and claim storage for assessment data
Photo Position System: photo-positions.ts for position labels and metadata
Next.js App Router: New export/review page at /assessments/[id]/export or /assessments/[id]/review
UI Components: New export button and completion screen components
Technical Specifications
Functional Requirements
Zip File Generation
File naming: Assessment_[VIN]_[YYYY-MM-DD].zip
Contents:
Photos named by position label (e.g., FrontView.jpg, DriverSide.jpg)
Text files with damage notes (e.g., FrontView_notes.txt) - only if notes exist
File structure matches photo position order from carrier workflow
Native Sharing
Use Web Share API for native OS share sheet
Fallback to download link for unsupported browsers
ZIP file shareable via Mail, Messages, Files, AirDrop
File previews correctly as ZIP archive
TC-6: Web Share API Fallback - Desktop Chrome
Preconditions: Desktop Chrome browser (no Web Share API) Platform: macOS/Windows Chrome Steps:
Export assessment
Verify download link appears (fallback behavior)
Click download link
Verify ZIP downloads to Downloads folder
Expected Results:
No share sheet appears (API not available)
Download link prominently displayed
ZIP downloads with correct filename
Browser shows download progress
TC-7: Offline Export (PWA Mode)
Preconditions: PWA installed, completed assessment, device offline Platform: Any mobile device Steps:
Enable Airplane Mode
Open Snapscope PWA
Navigate to completed assessment
Click "Export Assessment"
Verify ZIP generation completes
Share or save ZIP file
Expected Results:
Export completes without network errors
All photos retrieved from IndexedDB
ZIP generation successful
Share/download works offline
TC-8: Large Assessment (Performance Test)
Preconditions: Assessment with 15+ photos (custom carrier workflow) Steps:
Create assessment with carrier requiring 15 positions
Capture all photos (mix of 2MB+ images)
Export assessment
Measure time from click to ZIP ready
Expected Results:
ZIP generation completes in <5 seconds
No UI freezing or lag
Loading indicator displays throughout
Memory usage stays reasonable (<100MB)
TC-9: Missing Photo Error Handling
Preconditions: Claim record with photo reference, but photo blob missing from IndexedDB Steps:
Manually delete photo from IndexedDB (simulate corruption)
Attempt export
Expected Results:
Export fails gracefully
Error message: "Some photos are missing. Please retake missing photos."
User redirected to photo workflow
Missing photos highlighted
TC-10: IndexedDB Storage Quota Error
Preconditions: Device storage nearly full Steps:
Attempt export with storage quota exceeded
Expected Results:
Clear error message: "Storage full. Free up space and try again."
Export process cancels safely
No data corruption
User can retry after freeing space
TC-11: Filename Sanitization
Preconditions: Assessment with unusual VIN characters Test VINs: Use VINs with special chars (if possible) Steps:
Create assessment with edge-case VIN
Export assessment
Verify filename
Expected Results:
Special characters replaced/sanitized
Filename remains readable
File system accepts filename (no errors)
TC-12: Photo Position Label Mapping
Preconditions: Assessment with custom carrier workflow Steps:
Create assessment with carrier having custom position names
Export assessment
Extract and inspect ZIP contents
Expected Results:
Photo filenames use position labels (not IDs)
Labels match carrier workflow (e.g., "LeftFrontFender.jpg")
Notes files match photo names (e.g., "LeftFrontFender_notes.txt")
TC-13: Concurrent Export Prevention
Preconditions: Assessment ready to export Steps:
Click "Export Assessment"
Immediately click again (double-click)
Expected Results:
Only one export process runs
Button disabled during export
Loading state prevents additional clicks
No duplicate downloads/shares
TC-14: Assessment Info Metadata File
Preconditions: Completed assessment Steps:
Export assessment
Extract ZIP
Open assessment_info.txt
Expected Results:
File contains:
Assessment Information
VIN: [Vehicle VIN]
Date: [Completion Date]
Photos Captured: [Count]
Carrier: [Carrier Name or "Default"]
Adjuster: [User info if available]
TC-15: Browser Back Button During Export
Preconditions: Export in progress Steps:
Click "Export Assessment"
Immediately press browser back button
Observe behavior
Expected Results:
Export continues in background OR
Export cancels gracefully
No broken state
User can retry export
Regression Tests
After implementation, verify these existing features still work:
✅ Photo capture flow unchanged
✅ Damage notes save/load correctly
✅ Assessment list displays correctly
✅ VIN validation works
✅ Carrier workflow selection intact
✅ IndexedDB migration from localStorage works
Manual QA Checklist
Test on iPhone (Safari)
Test on Android (Chrome)
Test on iPad (Safari)
Test on Desktop Chrome
Test on Desktop Firefox
Test on Desktop Safari
Test offline (airplane mode)
Test with slow network (throttling)
Test with 3 photos, 6 photos, 9 photos, 15+ photos
Test with/without damage notes
Test re-export functionality
Test error states (missing photos, storage full)
Verify ZIP file structure and contents
Verify file naming conventions
Test accessibility (keyboard navigation, screen readers)
Acceptance Criteria Verification
From original issue:
✅ User exports completed assessment as organized .zip file
✅ User shares .zip via email/messaging to claims department
✅ Photos named by position (LeftSide.jpg, Front.jpg, etc.)
✅ Text files with damage notes (LeftSide_label.txt, etc.)
Activity
adamveld12 commentedon Oct 21, 2025
Background Context Report
Problem Statement
Adjusters need the ability to export completed assessments as a shareable package containing all photos and damage notes. The export must be organized, easily shareable via email/messaging, and mark the assessment as complete.
Services/Areas Involved
photo-storage-indexeddb.ts) for retrieving photo blobsuseClaims()hook and claim storage for assessment dataphoto-positions.tsfor position labels and metadata/assessments/[id]/exportor/assessments/[id]/reviewTechnical Specifications
Functional Requirements
Zip File Generation
Assessment_[VIN]_[YYYY-MM-DD].zipFrontView.jpg,DriverSide.jpg)FrontView_notes.txt) - only if notes existNative Sharing
Assessment Completion
in_progress→completedUser Flow
Non-Functional Requirements
Visual Design
New Libraries Required
jszip(v3.10.1+): Browser-based zip file creationCode Areas Requiring Modification
New Files:
/packages/client/src/app/assessments/[id]/export/page.tsx- Export screen/packages/client/src/lib/export-assessment.ts- Zip generation utility/packages/client/src/hooks/useAssessmentExport.ts- Export logic hookModified Files:
/packages/client/src/app/assessments/[id]/photos/page.tsx- Add "Complete & Export" button when all photos captured/packages/client/src/types/claim.ts- AddcompletedAt?: Datefield to Claim interface/packages/client/package.json- Add jszip dependencyNew UI Components (in
@snapscope/ui):ExportButton- Styled export button with loading stateCompletionSummary- Assessment completion cardAssumptions & Unknowns
adamveld12 commentedon Oct 21, 2025
Implementation Plan
Step 1: Add jszip Dependency
packages/client/pnpm add jszippnpm add -D @types/jszipStep 2: Extend Claim Type Definition
packages/client/src/types/claim.tscompletedAt?: Datefield toClaiminterfaceexportedAt?: Datefield for tracking export historyStep 3: Create Export Utility (
export-assessment.ts)/packages/client/src/lib/export-assessment.tsgenerateAssessmentZip(claimId: string): Promise<Blob>claim.photosRecordgetPositionById()photoStorage.getPhotoBlob(photoId)FrontView.jpg)photo.notesexists, createFrontView_notes.txtassessment_info.txtwith VIN, date, photo countStep 4: Create Export Hook (
useAssessmentExport.ts)/packages/client/src/hooks/useAssessmentExport.tsexportAssessment(claimId: string)functioncompletedcompletedAtandexportedAttimestampsStep 5: Create Export UI Components
In
packages/client/src/app/assessments/[id]/export/page.tsx:In
packages/ui/src/:export-button.tsxcomponent with loading spinnercompletion-summary.tsxcard componentStep 6: Integrate Export into Photo Workflow
/packages/client/src/app/assessments/[id]/photos/page.tsx/assessments/[id]/exportStep 7: Update Assessment List Page
/packages/client/src/app/assessments/page.tsxStep 8: Testing & Validation
Step 9: Error Handling & Edge Cases
adamveld12 commentedon Oct 21, 2025
Testing Plan
Test Environment Setup
1FMPU18L9WLA04056,JTEDS41AX82059224Test Cases
TC-1: Basic Export Flow (Happy Path)
Preconditions: Complete assessment with 9 photos, all with damage notes
Steps:
/assessments/{id}/photos/assessments/{id}/exportcompletedin assessment listExpected Results:
Assessment_[VIN]_[YYYY-MM-DD].zipFrontView.jpg,DriverSide.jpg)FrontView_notes.txt)assessment_info.txtwith metadataTC-2: Export Without Damage Notes
Preconditions: Complete assessment with 9 photos, NO damage notes
Steps:
Expected Results:
assessment_info.txtTC-3: Partial Assessment Export Prevention
Preconditions: Assessment with only 5 of 9 required photos
Steps:
/assessments/{id}/photosExpected Results:
TC-4: Re-Export Completed Assessment
Preconditions: Previously exported assessment (status =
completed)Steps:
Expected Results:
exportedAttimestamp updatedcompletedTC-5: Web Share API - iOS Safari
Preconditions: iPhone with Safari, completed assessment
Platform: iOS 14+ (Safari)
Steps:
Expected Results:
TC-6: Web Share API Fallback - Desktop Chrome
Preconditions: Desktop Chrome browser (no Web Share API)
Platform: macOS/Windows Chrome
Steps:
Expected Results:
TC-7: Offline Export (PWA Mode)
Preconditions: PWA installed, completed assessment, device offline
Platform: Any mobile device
Steps:
Expected Results:
TC-8: Large Assessment (Performance Test)
Preconditions: Assessment with 15+ photos (custom carrier workflow)
Steps:
Expected Results:
TC-9: Missing Photo Error Handling
Preconditions: Claim record with photo reference, but photo blob missing from IndexedDB
Steps:
Expected Results:
TC-10: IndexedDB Storage Quota Error
Preconditions: Device storage nearly full
Steps:
Expected Results:
TC-11: Filename Sanitization
Preconditions: Assessment with unusual VIN characters
Test VINs: Use VINs with special chars (if possible)
Steps:
Expected Results:
TC-12: Photo Position Label Mapping
Preconditions: Assessment with custom carrier workflow
Steps:
Expected Results:
TC-13: Concurrent Export Prevention
Preconditions: Assessment ready to export
Steps:
Expected Results:
TC-14: Assessment Info Metadata File
Preconditions: Completed assessment
Steps:
assessment_info.txtExpected Results:
File contains:
TC-15: Browser Back Button During Export
Preconditions: Export in progress
Steps:
Expected Results:
Regression Tests
After implementation, verify these existing features still work:
Manual QA Checklist
Acceptance Criteria Verification
From original issue:
Performance Benchmarks
feat: Export completed assessments as ZIP files (#33) (#76)