@open-mercato/core 0.6.8-develop.6998.1.d2bc46c56c → 0.6.8-develop.7001.1.03608ab252
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/warranty_claim/index.js +105 -0
- package/dist/generated/entities/warranty_claim/index.js.map +7 -0
- package/dist/generated/entities/warranty_claim_event/index.js +25 -0
- package/dist/generated/entities/warranty_claim_event/index.js.map +7 -0
- package/dist/generated/entities/warranty_claim_line/index.js +77 -0
- package/dist/generated/entities/warranty_claim_line/index.js.map +7 -0
- package/dist/generated/entities/warranty_claim_registration/index.js +43 -0
- package/dist/generated/entities/warranty_claim_registration/index.js.map +7 -0
- package/dist/generated/entities/warranty_claim_sequence/index.js +17 -0
- package/dist/generated/entities/warranty_claim_sequence/index.js.map +7 -0
- package/dist/generated/entities/warranty_claim_settings/index.js +43 -0
- package/dist/generated/entities/warranty_claim_settings/index.js.map +7 -0
- package/dist/generated/entities/warranty_claim_sla_signal/index.js +25 -0
- package/dist/generated/entities/warranty_claim_sla_signal/index.js.map +7 -0
- package/dist/generated/entities/warranty_troubleshooting_guide/index.js +25 -0
- package/dist/generated/entities/warranty_troubleshooting_guide/index.js.map +7 -0
- package/dist/generated/entities/warranty_vendor_policy/index.js +31 -0
- package/dist/generated/entities/warranty_vendor_policy/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +12 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +200 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/api.js +3 -2
- package/dist/helpers/integration/api.js.map +2 -2
- package/dist/helpers/integration/salesFixtures.js +13 -6
- package/dist/helpers/integration/salesFixtures.js.map +2 -2
- package/dist/modules/attachments/di.js +18 -0
- package/dist/modules/attachments/di.js.map +2 -2
- package/dist/modules/attachments/fields/attachment.js +186 -26
- package/dist/modules/attachments/fields/attachment.js.map +2 -2
- package/dist/modules/attachments/lib/scoped-upload-service.js +202 -0
- package/dist/modules/attachments/lib/scoped-upload-service.js.map +7 -0
- package/dist/modules/attachments/lib/target-access-service.js +39 -0
- package/dist/modules/attachments/lib/target-access-service.js.map +7 -0
- package/dist/modules/auth/api/logout.js +37 -10
- package/dist/modules/auth/api/logout.js.map +2 -2
- package/dist/modules/auth/api/reset/confirm.js +7 -0
- package/dist/modules/auth/api/reset/confirm.js.map +2 -2
- package/dist/modules/auth/api/reset.js +7 -0
- package/dist/modules/auth/api/reset.js.map +2 -2
- package/dist/modules/auth/commands/users.js +13 -0
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/events.js +15 -0
- package/dist/modules/auth/events.js.map +2 -2
- package/dist/modules/customers/api/companies/route.js +1 -0
- package/dist/modules/customers/api/companies/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/components/detail/assignableStaff.js +6 -69
- package/dist/modules/customers/components/detail/assignableStaff.js.map +2 -2
- package/dist/modules/customers/lib/assignableStaff.js +76 -0
- package/dist/modules/customers/lib/assignableStaff.js.map +7 -0
- package/dist/modules/data_sync/lib/batch-stream.js +56 -0
- package/dist/modules/data_sync/lib/batch-stream.js.map +7 -0
- package/dist/modules/data_sync/lib/sync-engine.js +165 -103
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js +4 -0
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/extract/route.js +4 -0
- package/dist/modules/inbox_ops/api/extract/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/webhook/inbound.js +4 -0
- package/dist/modules/inbox_ops/api/webhook/inbound.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +8 -8
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/warranty_claims/acl.js +75 -0
- package/dist/modules/warranty_claims/acl.js.map +7 -0
- package/dist/modules/warranty_claims/ai-agents.js +161 -0
- package/dist/modules/warranty_claims/ai-agents.js.map +7 -0
- package/dist/modules/warranty_claims/ai-tools.js +591 -0
- package/dist/modules/warranty_claims/ai-tools.js.map +7 -0
- package/dist/modules/warranty_claims/api/ai/assess/route.js +304 -0
- package/dist/modules/warranty_claims/api/ai/assess/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/ai/draft-reply/route.js +127 -0
- package/dist/modules/warranty_claims/api/ai/draft-reply/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/ai/suggest/route.js +177 -0
- package/dist/modules/warranty_claims/api/ai/suggest/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/assign/route.js +124 -0
- package/dist/modules/warranty_claims/api/assign/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/assignees/route.js +97 -0
- package/dist/modules/warranty_claims/api/assignees/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/credit-memo/route.js +152 -0
- package/dist/modules/warranty_claims/api/credit-memo/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/entitlement/route.js +145 -0
- package/dist/modules/warranty_claims/api/entitlement/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/events/route.js +199 -0
- package/dist/modules/warranty_claims/api/events/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/external/claims/route.js +446 -0
- package/dist/modules/warranty_claims/api/external/claims/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/lines/route.js +258 -0
- package/dist/modules/warranty_claims/api/lines/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/openapi.js +27 -0
- package/dist/modules/warranty_claims/api/openapi.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/attachments/route.js +490 -0
- package/dist/modules/warranty_claims/api/portal/attachments/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/route.js +178 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/shared.js +101 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/shared.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/submit/route.js +78 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/submit/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.js +81 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/claims/route.js +462 -0
- package/dist/modules/warranty_claims/api/portal/claims/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/events/route.js +228 -0
- package/dist/modules/warranty_claims/api/portal/events/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/options/route.js +91 -0
- package/dist/modules/warranty_claims/api/portal/options/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/orders/lines/route.js +172 -0
- package/dist/modules/warranty_claims/api/portal/orders/lines/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/orders/route.js +151 -0
- package/dist/modules/warranty_claims/api/portal/orders/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/portal/troubleshooting/route.js +121 -0
- package/dist/modules/warranty_claims/api/portal/troubleshooting/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/receiving/route.js +176 -0
- package/dist/modules/warranty_claims/api/receiving/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/registrations/route.js +382 -0
- package/dist/modules/warranty_claims/api/registrations/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/replacement-order/route.js +150 -0
- package/dist/modules/warranty_claims/api/replacement-order/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/return-label/route.js +235 -0
- package/dist/modules/warranty_claims/api/return-label/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/risk/route.js +101 -0
- package/dist/modules/warranty_claims/api/risk/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/route.js +482 -0
- package/dist/modules/warranty_claims/api/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/sales-return/route.js +151 -0
- package/dist/modules/warranty_claims/api/sales-return/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/settings-general/route.js +195 -0
- package/dist/modules/warranty_claims/api/settings-general/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/stats/route.js +199 -0
- package/dist/modules/warranty_claims/api/stats/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/submit/route.js +120 -0
- package/dist/modules/warranty_claims/api/submit/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/transition/route.js +126 -0
- package/dist/modules/warranty_claims/api/transition/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/troubleshooting-guides/route.js +261 -0
- package/dist/modules/warranty_claims/api/troubleshooting-guides/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/vendor-policies/route.js +311 -0
- package/dist/modules/warranty_claims/api/vendor-policies/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js +130 -0
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js.map +7 -0
- package/dist/modules/warranty_claims/api/vendor-recovery-suggestions/route.js +153 -0
- package/dist/modules/warranty_claims/api/vendor-recovery-suggestions/route.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/AiAssessButtons.js +268 -0
- package/dist/modules/warranty_claims/backend/components/AiAssessButtons.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/ClaimStageProgress.js +54 -0
- package/dist/modules/warranty_claims/backend/components/ClaimStageProgress.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/ClaimStatusBadge.js +87 -0
- package/dist/modules/warranty_claims/backend/components/ClaimStatusBadge.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/ClaimsKpiStrip.js +120 -0
- package/dist/modules/warranty_claims/backend/components/ClaimsKpiStrip.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/EntitlementLookupBadge.js +135 -0
- package/dist/modules/warranty_claims/backend/components/EntitlementLookupBadge.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/ReceivingPanel.js +218 -0
- package/dist/modules/warranty_claims/backend/components/ReceivingPanel.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/ReturnLabelPanel.js +231 -0
- package/dist/modules/warranty_claims/backend/components/ReturnLabelPanel.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/TroubleshootingWalker.js +82 -0
- package/dist/modules/warranty_claims/backend/components/TroubleshootingWalker.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/VendorRecoverySuggestionsPanel.js +136 -0
- package/dist/modules/warranty_claims/backend/components/VendorRecoverySuggestionsPanel.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/WarrantyWorkspace.js +41 -0
- package/dist/modules/warranty_claims/backend/components/WarrantyWorkspace.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/claimReasonOptions.js +45 -0
- package/dist/modules/warranty_claims/backend/components/claimReasonOptions.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/claimSla.js +92 -0
- package/dist/modules/warranty_claims/backend/components/claimSla.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/orderLookup.js +81 -0
- package/dist/modules/warranty_claims/backend/components/orderLookup.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/productLookup.js +317 -0
- package/dist/modules/warranty_claims/backend/components/productLookup.js.map +7 -0
- package/dist/modules/warranty_claims/backend/components/useUserDisplayNames.js +61 -0
- package/dist/modules/warranty_claims/backend/components/useUserDisplayNames.js.map +7 -0
- package/dist/modules/warranty_claims/backend/page.js +1088 -0
- package/dist/modules/warranty_claims/backend/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/page.meta.js +16 -0
- package/dist/modules/warranty_claims/backend/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/edit/page.js +427 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/edit/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/edit/page.meta.js +16 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/page.js +2101 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/page.meta.js +16 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/[id]/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/create/page.js +1249 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/create/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/create/page.meta.js +16 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/create/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/[id]/edit/page.js +110 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/[id]/edit/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/[id]/edit/page.meta.js +17 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/create/page.js +49 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/create/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/create/page.meta.js +17 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/create/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js +485 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.meta.js +19 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/registrationForm.js +253 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/registrationForm.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/settings/page.js +1565 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/settings/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/settings/page.meta.js +19 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/settings/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/TroubleshootingTreeBuilder.js +472 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/TroubleshootingTreeBuilder.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/[id]/edit/page.js +115 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/[id]/edit/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/[id]/edit/page.meta.js +19 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/create/page.js +54 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/create/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/create/page.meta.js +19 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/create/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js +414 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.meta.js +21 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/troubleshootingGuideForm.js +171 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/troubleshootingGuideForm.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/[id]/edit/page.js +111 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/[id]/edit/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/[id]/edit/page.meta.js +19 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/create/page.js +48 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/create/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/create/page.meta.js +19 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/create/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js +429 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.meta.js +21 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/vendorPolicyForm.js +182 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/vendorPolicyForm.js.map +7 -0
- package/dist/modules/warranty_claims/ce.js +48 -0
- package/dist/modules/warranty_claims/ce.js.map +7 -0
- package/dist/modules/warranty_claims/commands/claim-lines.js +911 -0
- package/dist/modules/warranty_claims/commands/claim-lines.js.map +7 -0
- package/dist/modules/warranty_claims/commands/claims.js +2577 -0
- package/dist/modules/warranty_claims/commands/claims.js.map +7 -0
- package/dist/modules/warranty_claims/commands/index.js +4 -0
- package/dist/modules/warranty_claims/commands/index.js.map +7 -0
- package/dist/modules/warranty_claims/commands/settings.js +169 -0
- package/dist/modules/warranty_claims/commands/settings.js.map +7 -0
- package/dist/modules/warranty_claims/commands/shared.js +162 -0
- package/dist/modules/warranty_claims/commands/shared.js.map +7 -0
- package/dist/modules/warranty_claims/data/constants.js +35 -0
- package/dist/modules/warranty_claims/data/constants.js.map +7 -0
- package/dist/modules/warranty_claims/data/enrichers.js +97 -0
- package/dist/modules/warranty_claims/data/enrichers.js.map +7 -0
- package/dist/modules/warranty_claims/data/entities.js +731 -0
- package/dist/modules/warranty_claims/data/entities.js.map +7 -0
- package/dist/modules/warranty_claims/data/validators.js +488 -0
- package/dist/modules/warranty_claims/data/validators.js.map +7 -0
- package/dist/modules/warranty_claims/di.js +29 -0
- package/dist/modules/warranty_claims/di.js.map +7 -0
- package/dist/modules/warranty_claims/encryption.js +28 -0
- package/dist/modules/warranty_claims/encryption.js.map +7 -0
- package/dist/modules/warranty_claims/events.js +81 -0
- package/dist/modules/warranty_claims/events.js.map +7 -0
- package/dist/modules/warranty_claims/extension-points.js +19 -0
- package/dist/modules/warranty_claims/extension-points.js.map +7 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/[id]/page.js +825 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/[id]/page.js.map +7 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/[id]/page.meta.js +11 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/[id]/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/new/page.js +1139 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/new/page.js.map +7 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/new/page.meta.js +11 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/new/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js +253 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js.map +7 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.meta.js +18 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.meta.js.map +7 -0
- package/dist/modules/warranty_claims/index.js +15 -0
- package/dist/modules/warranty_claims/index.js.map +7 -0
- package/dist/modules/warranty_claims/lib/aiAssist.js +496 -0
- package/dist/modules/warranty_claims/lib/aiAssist.js.map +7 -0
- package/dist/modules/warranty_claims/lib/apiIdsFilter.js +11 -0
- package/dist/modules/warranty_claims/lib/apiIdsFilter.js.map +7 -0
- package/dist/modules/warranty_claims/lib/assigneeNames.js +153 -0
- package/dist/modules/warranty_claims/lib/assigneeNames.js.map +7 -0
- package/dist/modules/warranty_claims/lib/attachmentVisibility.js +9 -0
- package/dist/modules/warranty_claims/lib/attachmentVisibility.js.map +7 -0
- package/dist/modules/warranty_claims/lib/bulkFeedback.js +8 -0
- package/dist/modules/warranty_claims/lib/bulkFeedback.js.map +7 -0
- package/dist/modules/warranty_claims/lib/businessHours.js +250 -0
- package/dist/modules/warranty_claims/lib/businessHours.js.map +7 -0
- package/dist/modules/warranty_claims/lib/businessHoursForm.js +146 -0
- package/dist/modules/warranty_claims/lib/businessHoursForm.js.map +7 -0
- package/dist/modules/warranty_claims/lib/claimTypeConfig.js +39 -0
- package/dist/modules/warranty_claims/lib/claimTypeConfig.js.map +7 -0
- package/dist/modules/warranty_claims/lib/decryptionSafety.js +17 -0
- package/dist/modules/warranty_claims/lib/decryptionSafety.js.map +7 -0
- package/dist/modules/warranty_claims/lib/deskFilters.js +88 -0
- package/dist/modules/warranty_claims/lib/deskFilters.js.map +7 -0
- package/dist/modules/warranty_claims/lib/dictionaries.js +157 -0
- package/dist/modules/warranty_claims/lib/dictionaries.js.map +7 -0
- package/dist/modules/warranty_claims/lib/dictionaryLabels.js +12 -0
- package/dist/modules/warranty_claims/lib/dictionaryLabels.js.map +7 -0
- package/dist/modules/warranty_claims/lib/emailIntake.js +87 -0
- package/dist/modules/warranty_claims/lib/emailIntake.js.map +7 -0
- package/dist/modules/warranty_claims/lib/escalation.js +58 -0
- package/dist/modules/warranty_claims/lib/escalation.js.map +7 -0
- package/dist/modules/warranty_claims/lib/externalIntake.js +233 -0
- package/dist/modules/warranty_claims/lib/externalIntake.js.map +7 -0
- package/dist/modules/warranty_claims/lib/grading.js +21 -0
- package/dist/modules/warranty_claims/lib/grading.js.map +7 -0
- package/dist/modules/warranty_claims/lib/listSegments.js +18 -0
- package/dist/modules/warranty_claims/lib/listSegments.js.map +7 -0
- package/dist/modules/warranty_claims/lib/orderOwnership.js +25 -0
- package/dist/modules/warranty_claims/lib/orderOwnership.js.map +7 -0
- package/dist/modules/warranty_claims/lib/portalAttachmentUpload.js +11 -0
- package/dist/modules/warranty_claims/lib/portalAttachmentUpload.js.map +7 -0
- package/dist/modules/warranty_claims/lib/portalAttachmentValidation.js +108 -0
- package/dist/modules/warranty_claims/lib/portalAttachmentValidation.js.map +7 -0
- package/dist/modules/warranty_claims/lib/portalClaimAccess.js +26 -0
- package/dist/modules/warranty_claims/lib/portalClaimAccess.js.map +7 -0
- package/dist/modules/warranty_claims/lib/quantity.js +19 -0
- package/dist/modules/warranty_claims/lib/quantity.js.map +7 -0
- package/dist/modules/warranty_claims/lib/risk.js +204 -0
- package/dist/modules/warranty_claims/lib/risk.js.map +7 -0
- package/dist/modules/warranty_claims/lib/settings.js +55 -0
- package/dist/modules/warranty_claims/lib/settings.js.map +7 -0
- package/dist/modules/warranty_claims/lib/stateMachine.js +88 -0
- package/dist/modules/warranty_claims/lib/stateMachine.js.map +7 -0
- package/dist/modules/warranty_claims/lib/timelineFilters.js +16 -0
- package/dist/modules/warranty_claims/lib/timelineFilters.js.map +7 -0
- package/dist/modules/warranty_claims/lib/triage.js +241 -0
- package/dist/modules/warranty_claims/lib/triage.js.map +7 -0
- package/dist/modules/warranty_claims/lib/troubleshooting.js +111 -0
- package/dist/modules/warranty_claims/lib/troubleshooting.js.map +7 -0
- package/dist/modules/warranty_claims/lib/tryResolve.js +11 -0
- package/dist/modules/warranty_claims/lib/tryResolve.js.map +7 -0
- package/dist/modules/warranty_claims/lib/vendorPolicyRecovery.js +101 -0
- package/dist/modules/warranty_claims/lib/vendorPolicyRecovery.js.map +7 -0
- package/dist/modules/warranty_claims/lib/warrantyPreview.js +18 -0
- package/dist/modules/warranty_claims/lib/warrantyPreview.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260703191537_warranty_claims.js +32 -0
- package/dist/modules/warranty_claims/migrations/Migration20260703191537_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260704115605_warranty_claims.js +16 -0
- package/dist/modules/warranty_claims/migrations/Migration20260704115605_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260704230000_warranty_claims.js +17 -0
- package/dist/modules/warranty_claims/migrations/Migration20260704230000_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260705121601_warranty_claims.js +29 -0
- package/dist/modules/warranty_claims/migrations/Migration20260705121601_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260709120000_warranty_claims.js +25 -0
- package/dist/modules/warranty_claims/migrations/Migration20260709120000_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260710023607_warranty_claims.js +13 -0
- package/dist/modules/warranty_claims/migrations/Migration20260710023607_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260716203936_warranty_claims.js +15 -0
- package/dist/modules/warranty_claims/migrations/Migration20260716203936_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260717150000_warranty_claims.js +13 -0
- package/dist/modules/warranty_claims/migrations/Migration20260717150000_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260719120000_warranty_claims.js +13 -0
- package/dist/modules/warranty_claims/migrations/Migration20260719120000_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/migrations/Migration20260813103053_warranty_claims.js +12 -0
- package/dist/modules/warranty_claims/migrations/Migration20260813103053_warranty_claims.js.map +7 -0
- package/dist/modules/warranty_claims/notifications.client.js +67 -0
- package/dist/modules/warranty_claims/notifications.client.js.map +7 -0
- package/dist/modules/warranty_claims/notifications.js +103 -0
- package/dist/modules/warranty_claims/notifications.js.map +7 -0
- package/dist/modules/warranty_claims/search.js +174 -0
- package/dist/modules/warranty_claims/search.js.map +7 -0
- package/dist/modules/warranty_claims/services/adjudicationEvaluator.js +202 -0
- package/dist/modules/warranty_claims/services/adjudicationEvaluator.js.map +7 -0
- package/dist/modules/warranty_claims/services/claimNumberGenerator.js +58 -0
- package/dist/modules/warranty_claims/services/claimNumberGenerator.js.map +7 -0
- package/dist/modules/warranty_claims/services/entitlementResolver.js +69 -0
- package/dist/modules/warranty_claims/services/entitlementResolver.js.map +7 -0
- package/dist/modules/warranty_claims/services/returnLabelProvider.js +14 -0
- package/dist/modules/warranty_claims/services/returnLabelProvider.js.map +7 -0
- package/dist/modules/warranty_claims/setup.js +121 -0
- package/dist/modules/warranty_claims/setup.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/auto-vendor-recovery.js +119 -0
- package/dist/modules/warranty_claims/subscribers/auto-vendor-recovery.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/claim-assigned-notification.js +47 -0
- package/dist/modules/warranty_claims/subscribers/claim-assigned-notification.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/claim-customer-reply-notification.js +60 -0
- package/dist/modules/warranty_claims/subscribers/claim-customer-reply-notification.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/claim-status-notification.js +83 -0
- package/dist/modules/warranty_claims/subscribers/claim-status-notification.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/claim-submitted-notification.js +46 -0
- package/dist/modules/warranty_claims/subscribers/claim-submitted-notification.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/email-to-claim.js +135 -0
- package/dist/modules/warranty_claims/subscribers/email-to-claim.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/return-shipment-tracking.js +164 -0
- package/dist/modules/warranty_claims/subscribers/return-shipment-tracking.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/vendor-recovery-reconciliation-undo.js +24 -0
- package/dist/modules/warranty_claims/subscribers/vendor-recovery-reconciliation-undo.js.map +7 -0
- package/dist/modules/warranty_claims/subscribers/vendor-recovery-reconciliation.js +26 -0
- package/dist/modules/warranty_claims/subscribers/vendor-recovery-reconciliation.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/dashboard/claims-queue/config.js +15 -0
- package/dist/modules/warranty_claims/widgets/dashboard/claims-queue/config.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/dashboard/claims-queue/widget.client.js +197 -0
- package/dist/modules/warranty_claims/widgets/dashboard/claims-queue/widget.client.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/dashboard/claims-queue/widget.js +28 -0
- package/dist/modules/warranty_claims/widgets/dashboard/claims-queue/widget.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection/claims-ai-trigger/widget.client.js +418 -0
- package/dist/modules/warranty_claims/widgets/injection/claims-ai-trigger/widget.client.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection/claims-ai-trigger/widget.js +18 -0
- package/dist/modules/warranty_claims/widgets/injection/claims-ai-trigger/widget.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection/customer-claims-tab/widget.js +17 -0
- package/dist/modules/warranty_claims/widgets/injection/customer-claims-tab/widget.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection/customer-claims-tab.js +146 -0
- package/dist/modules/warranty_claims/widgets/injection/customer-claims-tab.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection/order-claims-tab/widget.js +17 -0
- package/dist/modules/warranty_claims/widgets/injection/order-claims-tab/widget.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection/order-claims-tab.js +147 -0
- package/dist/modules/warranty_claims/widgets/injection/order-claims-tab.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/injection-table.js +38 -0
- package/dist/modules/warranty_claims/widgets/injection-table.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.js +223 -0
- package/dist/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.js.map +7 -0
- package/dist/modules/warranty_claims/widgets/notifications/index.js +5 -0
- package/dist/modules/warranty_claims/widgets/notifications/index.js.map +7 -0
- package/dist/modules/warranty_claims/workers/sla-escalation-sweep.js +334 -0
- package/dist/modules/warranty_claims/workers/sla-escalation-sweep.js.map +7 -0
- package/generated/entities/warranty_claim/index.ts +51 -0
- package/generated/entities/warranty_claim_event/index.ts +11 -0
- package/generated/entities/warranty_claim_line/index.ts +37 -0
- package/generated/entities/warranty_claim_registration/index.ts +20 -0
- package/generated/entities/warranty_claim_sequence/index.ts +7 -0
- package/generated/entities/warranty_claim_settings/index.ts +20 -0
- package/generated/entities/warranty_claim_sla_signal/index.ts +11 -0
- package/generated/entities/warranty_troubleshooting_guide/index.ts +11 -0
- package/generated/entities/warranty_vendor_policy/index.ts +14 -0
- package/generated/entities.ids.generated.ts +12 -0
- package/generated/entity-fields-registry.ts +200 -0
- package/package.json +7 -7
- package/src/helpers/integration/api.ts +10 -3
- package/src/helpers/integration/salesFixtures.ts +17 -7
- package/src/modules/attachments/di.ts +30 -1
- package/src/modules/attachments/fields/attachment.tsx +215 -23
- package/src/modules/attachments/i18n/de.json +5 -0
- package/src/modules/attachments/i18n/en.json +5 -0
- package/src/modules/attachments/i18n/es.json +5 -0
- package/src/modules/attachments/i18n/ko.json +5 -0
- package/src/modules/attachments/i18n/pl.json +5 -0
- package/src/modules/attachments/lib/scoped-upload-service.ts +257 -0
- package/src/modules/attachments/lib/target-access-service.ts +57 -0
- package/src/modules/auth/api/logout.ts +46 -10
- package/src/modules/auth/api/reset/confirm.ts +7 -0
- package/src/modules/auth/api/reset.ts +7 -0
- package/src/modules/auth/commands/users.ts +22 -0
- package/src/modules/auth/events.ts +15 -0
- package/src/modules/customers/api/companies/route.ts +1 -0
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +4 -2
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +4 -2
- package/src/modules/customers/components/detail/assignableStaff.ts +14 -177
- package/src/modules/customers/lib/assignableStaff.ts +177 -0
- package/src/modules/data_sync/AGENTS.md +3 -0
- package/src/modules/data_sync/lib/batch-stream.ts +117 -0
- package/src/modules/data_sync/lib/sync-engine.ts +190 -115
- package/src/modules/inbox_ops/api/emails/[id]/reprocess/route.ts +4 -0
- package/src/modules/inbox_ops/api/extract/route.ts +4 -0
- package/src/modules/inbox_ops/api/webhook/inbound.ts +4 -0
- package/src/modules/sales/commands/documents.ts +16 -8
- package/src/modules/warranty_claims/AGENTS.md +49 -0
- package/src/modules/warranty_claims/acl.ts +71 -0
- package/src/modules/warranty_claims/ai-agents.ts +189 -0
- package/src/modules/warranty_claims/ai-tools.ts +711 -0
- package/src/modules/warranty_claims/api/ai/assess/route.ts +371 -0
- package/src/modules/warranty_claims/api/ai/draft-reply/route.ts +149 -0
- package/src/modules/warranty_claims/api/ai/suggest/route.ts +190 -0
- package/src/modules/warranty_claims/api/assign/route.ts +142 -0
- package/src/modules/warranty_claims/api/assignees/route.ts +102 -0
- package/src/modules/warranty_claims/api/credit-memo/route.ts +191 -0
- package/src/modules/warranty_claims/api/entitlement/route.ts +224 -0
- package/src/modules/warranty_claims/api/events/route.ts +226 -0
- package/src/modules/warranty_claims/api/external/claims/route.ts +528 -0
- package/src/modules/warranty_claims/api/lines/route.ts +275 -0
- package/src/modules/warranty_claims/api/openapi.ts +28 -0
- package/src/modules/warranty_claims/api/portal/attachments/route.ts +547 -0
- package/src/modules/warranty_claims/api/portal/claims/[id]/route.ts +195 -0
- package/src/modules/warranty_claims/api/portal/claims/[id]/shared.ts +125 -0
- package/src/modules/warranty_claims/api/portal/claims/[id]/submit/route.ts +82 -0
- package/src/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.ts +87 -0
- package/src/modules/warranty_claims/api/portal/claims/route.ts +579 -0
- package/src/modules/warranty_claims/api/portal/events/route.ts +260 -0
- package/src/modules/warranty_claims/api/portal/options/route.ts +113 -0
- package/src/modules/warranty_claims/api/portal/orders/lines/route.ts +258 -0
- package/src/modules/warranty_claims/api/portal/orders/route.ts +206 -0
- package/src/modules/warranty_claims/api/portal/troubleshooting/route.ts +151 -0
- package/src/modules/warranty_claims/api/receiving/route.ts +215 -0
- package/src/modules/warranty_claims/api/registrations/route.ts +417 -0
- package/src/modules/warranty_claims/api/replacement-order/route.ts +188 -0
- package/src/modules/warranty_claims/api/return-label/route.ts +291 -0
- package/src/modules/warranty_claims/api/risk/route.ts +112 -0
- package/src/modules/warranty_claims/api/route.ts +543 -0
- package/src/modules/warranty_claims/api/sales-return/route.ts +183 -0
- package/src/modules/warranty_claims/api/settings-general/route.ts +230 -0
- package/src/modules/warranty_claims/api/stats/route.ts +306 -0
- package/src/modules/warranty_claims/api/submit/route.ts +146 -0
- package/src/modules/warranty_claims/api/transition/route.ts +144 -0
- package/src/modules/warranty_claims/api/troubleshooting-guides/route.ts +295 -0
- package/src/modules/warranty_claims/api/vendor-policies/route.ts +351 -0
- package/src/modules/warranty_claims/api/vendor-recovery/route.ts +148 -0
- package/src/modules/warranty_claims/api/vendor-recovery-suggestions/route.ts +167 -0
- package/src/modules/warranty_claims/backend/components/AiAssessButtons.tsx +389 -0
- package/src/modules/warranty_claims/backend/components/ClaimStageProgress.tsx +65 -0
- package/src/modules/warranty_claims/backend/components/ClaimStatusBadge.tsx +137 -0
- package/src/modules/warranty_claims/backend/components/ClaimsKpiStrip.tsx +169 -0
- package/src/modules/warranty_claims/backend/components/EntitlementLookupBadge.tsx +203 -0
- package/src/modules/warranty_claims/backend/components/ReceivingPanel.tsx +300 -0
- package/src/modules/warranty_claims/backend/components/ReturnLabelPanel.tsx +292 -0
- package/src/modules/warranty_claims/backend/components/TroubleshootingWalker.tsx +125 -0
- package/src/modules/warranty_claims/backend/components/VendorRecoverySuggestionsPanel.tsx +217 -0
- package/src/modules/warranty_claims/backend/components/WarrantyWorkspace.tsx +66 -0
- package/src/modules/warranty_claims/backend/components/claimReasonOptions.ts +57 -0
- package/src/modules/warranty_claims/backend/components/claimSla.tsx +127 -0
- package/src/modules/warranty_claims/backend/components/orderLookup.ts +109 -0
- package/src/modules/warranty_claims/backend/components/productLookup.tsx +433 -0
- package/src/modules/warranty_claims/backend/components/useUserDisplayNames.ts +66 -0
- package/src/modules/warranty_claims/backend/page.meta.ts +12 -0
- package/src/modules/warranty_claims/backend/page.tsx +1302 -0
- package/src/modules/warranty_claims/backend/warranty_claims/[id]/edit/page.meta.ts +12 -0
- package/src/modules/warranty_claims/backend/warranty_claims/[id]/edit/page.tsx +531 -0
- package/src/modules/warranty_claims/backend/warranty_claims/[id]/page.meta.ts +12 -0
- package/src/modules/warranty_claims/backend/warranty_claims/[id]/page.tsx +2599 -0
- package/src/modules/warranty_claims/backend/warranty_claims/create/page.meta.ts +12 -0
- package/src/modules/warranty_claims/backend/warranty_claims/create/page.tsx +1533 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/[id]/edit/page.meta.ts +13 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/[id]/edit/page.tsx +136 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/create/page.meta.ts +13 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/create/page.tsx +52 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/page.meta.ts +15 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/page.tsx +555 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/registrationForm.tsx +295 -0
- package/src/modules/warranty_claims/backend/warranty_claims/settings/page.meta.ts +15 -0
- package/src/modules/warranty_claims/backend/warranty_claims/settings/page.tsx +1903 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/TroubleshootingTreeBuilder.tsx +550 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/[id]/edit/page.meta.ts +15 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/[id]/edit/page.tsx +141 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/create/page.meta.ts +15 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/create/page.tsx +57 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.meta.ts +17 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.tsx +477 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/troubleshootingGuideForm.tsx +214 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/[id]/edit/page.meta.ts +15 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/[id]/edit/page.tsx +137 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/create/page.meta.ts +15 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/create/page.tsx +51 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.meta.ts +17 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.tsx +506 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/vendorPolicyForm.tsx +220 -0
- package/src/modules/warranty_claims/ce.ts +44 -0
- package/src/modules/warranty_claims/commands/claim-lines.ts +1082 -0
- package/src/modules/warranty_claims/commands/claims.ts +3364 -0
- package/src/modules/warranty_claims/commands/index.ts +3 -0
- package/src/modules/warranty_claims/commands/settings.ts +198 -0
- package/src/modules/warranty_claims/commands/shared.ts +212 -0
- package/src/modules/warranty_claims/data/constants.ts +37 -0
- package/src/modules/warranty_claims/data/enrichers.ts +165 -0
- package/src/modules/warranty_claims/data/entities.ts +663 -0
- package/src/modules/warranty_claims/data/validators.ts +634 -0
- package/src/modules/warranty_claims/di.ts +34 -0
- package/src/modules/warranty_claims/encryption.ts +26 -0
- package/src/modules/warranty_claims/events.ts +81 -0
- package/src/modules/warranty_claims/extension-points.ts +16 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/[id]/page.meta.ts +9 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/[id]/page.tsx +1037 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/new/page.meta.ts +9 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/new/page.tsx +1409 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.meta.ts +16 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.tsx +304 -0
- package/src/modules/warranty_claims/i18n/de.json +1270 -0
- package/src/modules/warranty_claims/i18n/en.json +1270 -0
- package/src/modules/warranty_claims/i18n/es.json +1270 -0
- package/src/modules/warranty_claims/i18n/ko.json +1270 -0
- package/src/modules/warranty_claims/i18n/pl.json +1270 -0
- package/src/modules/warranty_claims/index.ts +13 -0
- package/src/modules/warranty_claims/lib/aiAssist.ts +677 -0
- package/src/modules/warranty_claims/lib/apiIdsFilter.ts +12 -0
- package/src/modules/warranty_claims/lib/assigneeNames.ts +184 -0
- package/src/modules/warranty_claims/lib/attachmentVisibility.ts +5 -0
- package/src/modules/warranty_claims/lib/bulkFeedback.ts +6 -0
- package/src/modules/warranty_claims/lib/businessHours.ts +333 -0
- package/src/modules/warranty_claims/lib/businessHoursForm.ts +206 -0
- package/src/modules/warranty_claims/lib/claimTypeConfig.ts +49 -0
- package/src/modules/warranty_claims/lib/decryptionSafety.ts +19 -0
- package/src/modules/warranty_claims/lib/deskFilters.ts +131 -0
- package/src/modules/warranty_claims/lib/dictionaries.ts +212 -0
- package/src/modules/warranty_claims/lib/dictionaryLabels.ts +16 -0
- package/src/modules/warranty_claims/lib/emailIntake.ts +123 -0
- package/src/modules/warranty_claims/lib/escalation.ts +83 -0
- package/src/modules/warranty_claims/lib/externalIntake.ts +362 -0
- package/src/modules/warranty_claims/lib/grading.ts +23 -0
- package/src/modules/warranty_claims/lib/listSegments.ts +19 -0
- package/src/modules/warranty_claims/lib/orderOwnership.ts +58 -0
- package/src/modules/warranty_claims/lib/portalAttachmentUpload.ts +11 -0
- package/src/modules/warranty_claims/lib/portalAttachmentValidation.ts +115 -0
- package/src/modules/warranty_claims/lib/portalClaimAccess.ts +37 -0
- package/src/modules/warranty_claims/lib/quantity.ts +15 -0
- package/src/modules/warranty_claims/lib/risk.ts +371 -0
- package/src/modules/warranty_claims/lib/settings.ts +76 -0
- package/src/modules/warranty_claims/lib/stateMachine.ts +130 -0
- package/src/modules/warranty_claims/lib/timelineFilters.ts +22 -0
- package/src/modules/warranty_claims/lib/triage.ts +366 -0
- package/src/modules/warranty_claims/lib/troubleshooting.ts +157 -0
- package/src/modules/warranty_claims/lib/tryResolve.ts +7 -0
- package/src/modules/warranty_claims/lib/vendorPolicyRecovery.ts +182 -0
- package/src/modules/warranty_claims/lib/warrantyPreview.ts +20 -0
- package/src/modules/warranty_claims/migrations/.snapshot-open-mercato.json +3525 -0
- package/src/modules/warranty_claims/migrations/Migration20260703191537_warranty_claims.ts +38 -0
- package/src/modules/warranty_claims/migrations/Migration20260704115605_warranty_claims.ts +17 -0
- package/src/modules/warranty_claims/migrations/Migration20260704230000_warranty_claims.ts +17 -0
- package/src/modules/warranty_claims/migrations/Migration20260705121601_warranty_claims.ts +37 -0
- package/src/modules/warranty_claims/migrations/Migration20260709120000_warranty_claims.ts +25 -0
- package/src/modules/warranty_claims/migrations/Migration20260710023607_warranty_claims.ts +13 -0
- package/src/modules/warranty_claims/migrations/Migration20260716203936_warranty_claims.ts +15 -0
- package/src/modules/warranty_claims/migrations/Migration20260717150000_warranty_claims.ts +13 -0
- package/src/modules/warranty_claims/migrations/Migration20260719120000_warranty_claims.ts +13 -0
- package/src/modules/warranty_claims/migrations/Migration20260813103053_warranty_claims.ts +11 -0
- package/src/modules/warranty_claims/notifications.client.ts +78 -0
- package/src/modules/warranty_claims/notifications.ts +101 -0
- package/src/modules/warranty_claims/search.ts +199 -0
- package/src/modules/warranty_claims/services/adjudicationEvaluator.ts +344 -0
- package/src/modules/warranty_claims/services/claimNumberGenerator.ts +69 -0
- package/src/modules/warranty_claims/services/entitlementResolver.ts +102 -0
- package/src/modules/warranty_claims/services/returnLabelProvider.ts +30 -0
- package/src/modules/warranty_claims/setup.ts +154 -0
- package/src/modules/warranty_claims/subscribers/auto-vendor-recovery.ts +140 -0
- package/src/modules/warranty_claims/subscribers/claim-assigned-notification.ts +54 -0
- package/src/modules/warranty_claims/subscribers/claim-customer-reply-notification.ts +68 -0
- package/src/modules/warranty_claims/subscribers/claim-status-notification.ts +100 -0
- package/src/modules/warranty_claims/subscribers/claim-submitted-notification.ts +53 -0
- package/src/modules/warranty_claims/subscribers/email-to-claim.ts +175 -0
- package/src/modules/warranty_claims/subscribers/return-shipment-tracking.ts +226 -0
- package/src/modules/warranty_claims/subscribers/vendor-recovery-reconciliation-undo.ts +28 -0
- package/src/modules/warranty_claims/subscribers/vendor-recovery-reconciliation.ts +31 -0
- package/src/modules/warranty_claims/widgets/dashboard/claims-queue/config.ts +15 -0
- package/src/modules/warranty_claims/widgets/dashboard/claims-queue/widget.client.tsx +237 -0
- package/src/modules/warranty_claims/widgets/dashboard/claims-queue/widget.ts +27 -0
- package/src/modules/warranty_claims/widgets/injection/claims-ai-trigger/widget.client.tsx +527 -0
- package/src/modules/warranty_claims/widgets/injection/claims-ai-trigger/widget.ts +37 -0
- package/src/modules/warranty_claims/widgets/injection/customer-claims-tab/widget.ts +21 -0
- package/src/modules/warranty_claims/widgets/injection/customer-claims-tab.tsx +210 -0
- package/src/modules/warranty_claims/widgets/injection/order-claims-tab/widget.ts +21 -0
- package/src/modules/warranty_claims/widgets/injection/order-claims-tab.tsx +210 -0
- package/src/modules/warranty_claims/widgets/injection-table.ts +36 -0
- package/src/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.tsx +253 -0
- package/src/modules/warranty_claims/widgets/notifications/index.ts +1 -0
- package/src/modules/warranty_claims/workers/sla-escalation-sweep.ts +450 -0
|
@@ -0,0 +1,1037 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import Link from 'next/link'
|
|
5
|
+
import { useRouter } from 'next/navigation'
|
|
6
|
+
import { ArrowLeft, Check, CircleAlert, Info, Paperclip, RefreshCw, ShieldCheck, Trash2, TriangleAlert } from 'lucide-react'
|
|
7
|
+
import { useLocale, useT, type TranslateFn } from '@open-mercato/shared/lib/i18n/context'
|
|
8
|
+
import { localizeDictionaryLabel } from '@open-mercato/core/modules/warranty_claims/lib/dictionaryLabels'
|
|
9
|
+
import { formatQuantity } from '@open-mercato/core/modules/warranty_claims/lib/quantity'
|
|
10
|
+
import {
|
|
11
|
+
ATTACHMENT_ACCEPT_TYPES,
|
|
12
|
+
validateAttachmentFile,
|
|
13
|
+
} from '@open-mercato/core/modules/warranty_claims/lib/portalAttachmentValidation'
|
|
14
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
15
|
+
import {
|
|
16
|
+
Dialog,
|
|
17
|
+
DialogContent,
|
|
18
|
+
DialogDescription,
|
|
19
|
+
DialogFooter,
|
|
20
|
+
DialogHeader,
|
|
21
|
+
DialogTitle,
|
|
22
|
+
} from '@open-mercato/ui/primitives/dialog'
|
|
23
|
+
import { Textarea } from '@open-mercato/ui/primitives/textarea'
|
|
24
|
+
import { Spinner } from '@open-mercato/ui/primitives/spinner'
|
|
25
|
+
import { ErrorMessage, LoadingMessage } from '@open-mercato/ui/backend/detail'
|
|
26
|
+
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
27
|
+
import { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'
|
|
28
|
+
import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'
|
|
29
|
+
import { apiCall, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'
|
|
30
|
+
import { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'
|
|
31
|
+
import { usePortalContext } from '@open-mercato/ui/portal/PortalContext'
|
|
32
|
+
import { PortalEmptyState } from '@open-mercato/ui/portal/components/PortalEmptyState'
|
|
33
|
+
|
|
34
|
+
type Props = { params: { orgSlug: string; id: string } }
|
|
35
|
+
|
|
36
|
+
type PortalClaimLine = {
|
|
37
|
+
id: string
|
|
38
|
+
lineNo: number
|
|
39
|
+
sku: string | null
|
|
40
|
+
productName: string | null
|
|
41
|
+
serialNumber: string | null
|
|
42
|
+
faultCode: string | null
|
|
43
|
+
faultDescription: string | null
|
|
44
|
+
qtyClaimed: string
|
|
45
|
+
qtyApproved: string | null
|
|
46
|
+
lineStatus: string
|
|
47
|
+
disposition: string | null
|
|
48
|
+
creditAmount: string | null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type PortalClaim = {
|
|
52
|
+
id: string
|
|
53
|
+
claimNumber: string
|
|
54
|
+
claimType: string
|
|
55
|
+
status: string
|
|
56
|
+
priority: string
|
|
57
|
+
orderId: string | null
|
|
58
|
+
orderNumber: string | null
|
|
59
|
+
reasonCode: string | null
|
|
60
|
+
rejectionReasonCode: string | null
|
|
61
|
+
resolutionSummary: string | null
|
|
62
|
+
submittedAt: string | null
|
|
63
|
+
resolvedAt: string | null
|
|
64
|
+
closedAt: string | null
|
|
65
|
+
createdAt: string | null
|
|
66
|
+
updatedAt: string | null
|
|
67
|
+
lines: PortalClaimLine[]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
type PortalClaimEvent = {
|
|
71
|
+
id: string
|
|
72
|
+
kind: string
|
|
73
|
+
body: string | null
|
|
74
|
+
payload: Record<string, unknown> | null
|
|
75
|
+
actorCustomerId: string | null
|
|
76
|
+
createdAt: string | null
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type PortalAttachment = {
|
|
80
|
+
id: string
|
|
81
|
+
url: string
|
|
82
|
+
downloadUrl: string
|
|
83
|
+
fileName: string
|
|
84
|
+
fileSize: number
|
|
85
|
+
mimeType: string | null
|
|
86
|
+
thumbnailUrl: string
|
|
87
|
+
createdAt: string | null
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type ClaimResponse = { item: PortalClaim }
|
|
91
|
+
type EventResponse = { items: PortalClaimEvent[] }
|
|
92
|
+
type AttachmentResponse = { items: PortalAttachment[] }
|
|
93
|
+
type MutationOkResponse = { ok: boolean; error?: string }
|
|
94
|
+
type UploadResponse = MutationOkResponse & { item?: PortalAttachment }
|
|
95
|
+
type ClaimActionResponse = MutationOkResponse & { claimId?: string; status?: string }
|
|
96
|
+
|
|
97
|
+
type PortalClaimAction = 'submit' | 'withdraw'
|
|
98
|
+
|
|
99
|
+
type TrackerStepState = 'complete' | 'current' | 'pending'
|
|
100
|
+
|
|
101
|
+
type TrackerStep = {
|
|
102
|
+
id: string
|
|
103
|
+
title: string
|
|
104
|
+
description: string
|
|
105
|
+
state: TrackerStepState
|
|
106
|
+
dateLabel: string | null
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type BannerTone = 'info' | 'success' | 'warning' | 'error'
|
|
110
|
+
|
|
111
|
+
type ActivityEntry = {
|
|
112
|
+
id: string
|
|
113
|
+
title: string
|
|
114
|
+
description: string
|
|
115
|
+
createdAt: string | null
|
|
116
|
+
href?: string
|
|
117
|
+
attachment?: PortalAttachment
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const TRACKER_STEP_KEYS = ['received', 'review', 'decision', 'return', 'resolved'] as const
|
|
121
|
+
|
|
122
|
+
const STATUS_STEP_INDEX: Record<string, number> = {
|
|
123
|
+
draft: 0,
|
|
124
|
+
submitted: 1,
|
|
125
|
+
in_review: 1,
|
|
126
|
+
info_requested: 1,
|
|
127
|
+
rejected: 2,
|
|
128
|
+
cancelled: 2,
|
|
129
|
+
approved: 3,
|
|
130
|
+
awaiting_return: 3,
|
|
131
|
+
received: 4,
|
|
132
|
+
inspecting: 4,
|
|
133
|
+
resolved: 5,
|
|
134
|
+
closed: 5,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const LINE_STATUS_DOT_CLASSES: Record<string, string> = {
|
|
138
|
+
pending: 'bg-status-neutral-icon',
|
|
139
|
+
approved: 'bg-status-success-icon',
|
|
140
|
+
rejected: 'bg-status-error-icon',
|
|
141
|
+
received: 'bg-status-info-icon',
|
|
142
|
+
inspected: 'bg-status-info-icon',
|
|
143
|
+
resolved: 'bg-status-success-icon',
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const BANNER_TONE_CLASSES: Record<BannerTone, { wrapper: string; text: string; icon: string }> = {
|
|
147
|
+
info: {
|
|
148
|
+
wrapper: 'bg-status-info-bg',
|
|
149
|
+
text: 'text-status-info-text',
|
|
150
|
+
icon: 'text-status-info-icon',
|
|
151
|
+
},
|
|
152
|
+
success: {
|
|
153
|
+
wrapper: 'bg-status-success-bg',
|
|
154
|
+
text: 'text-status-success-text',
|
|
155
|
+
icon: 'text-status-success-icon',
|
|
156
|
+
},
|
|
157
|
+
warning: {
|
|
158
|
+
wrapper: 'bg-status-warning-bg',
|
|
159
|
+
text: 'text-status-warning-text',
|
|
160
|
+
icon: 'text-status-warning-icon',
|
|
161
|
+
},
|
|
162
|
+
error: {
|
|
163
|
+
wrapper: 'bg-status-error-bg',
|
|
164
|
+
text: 'text-status-error-text',
|
|
165
|
+
icon: 'text-status-error-icon',
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function bannerTone(status: string): BannerTone {
|
|
170
|
+
if (status === 'rejected' || status === 'cancelled') return 'error'
|
|
171
|
+
if (status === 'info_requested') return 'warning'
|
|
172
|
+
if (status === 'approved' || status === 'resolved' || status === 'closed') return 'success'
|
|
173
|
+
return 'info'
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function bannerMessage(claim: PortalClaim, t: TranslateFn): string {
|
|
177
|
+
switch (claim.status) {
|
|
178
|
+
case 'draft':
|
|
179
|
+
return t('warranty_claims.portal.tracker.banner.draft')
|
|
180
|
+
case 'info_requested':
|
|
181
|
+
return t('warranty_claims.portal.tracker.banner.infoRequested')
|
|
182
|
+
case 'approved':
|
|
183
|
+
return t('warranty_claims.portal.tracker.banner.approved')
|
|
184
|
+
case 'awaiting_return':
|
|
185
|
+
return t('warranty_claims.portal.tracker.banner.awaitingReturn')
|
|
186
|
+
case 'received':
|
|
187
|
+
case 'inspecting':
|
|
188
|
+
return t('warranty_claims.portal.tracker.banner.goodsFlow')
|
|
189
|
+
case 'resolved':
|
|
190
|
+
case 'closed':
|
|
191
|
+
return claim.resolutionSummary ?? t('warranty_claims.portal.tracker.banner.resolved')
|
|
192
|
+
case 'rejected': {
|
|
193
|
+
const reason = claim.rejectionReasonCode
|
|
194
|
+
? localizeDictionaryLabel(t, 'rejection', claim.rejectionReasonCode, claim.rejectionReasonCode)
|
|
195
|
+
: null
|
|
196
|
+
const base = t('warranty_claims.portal.detail.terminal.rejected')
|
|
197
|
+
const parts = [base, reason, claim.resolutionSummary].filter((part): part is string => Boolean(part))
|
|
198
|
+
return parts.join(' ')
|
|
199
|
+
}
|
|
200
|
+
case 'cancelled':
|
|
201
|
+
return t('warranty_claims.portal.detail.terminal.cancelled')
|
|
202
|
+
default:
|
|
203
|
+
return t('warranty_claims.portal.tracker.banner.review')
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function formatShortDate(value: string | null, locale: string): string | null {
|
|
208
|
+
if (!value) return null
|
|
209
|
+
const date = new Date(value)
|
|
210
|
+
if (Number.isNaN(date.getTime())) return null
|
|
211
|
+
return date.toLocaleDateString(locale || undefined, { month: 'short', day: 'numeric' })
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function formatLongDate(value: string | null, locale: string): string | null {
|
|
215
|
+
if (!value) return null
|
|
216
|
+
const date = new Date(value)
|
|
217
|
+
if (Number.isNaN(date.getTime())) return null
|
|
218
|
+
return date.toLocaleDateString(locale || undefined, { year: 'numeric', month: 'short', day: 'numeric' })
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function buildTrackerSteps(claim: PortalClaim, t: TranslateFn, locale: string): TrackerStep[] {
|
|
222
|
+
const currentIndex = STATUS_STEP_INDEX[claim.status] ?? 1
|
|
223
|
+
const terminalComplete = claim.status === 'resolved' || claim.status === 'closed'
|
|
224
|
+
return TRACKER_STEP_KEYS.map((key, index) => {
|
|
225
|
+
const state: TrackerStepState = index < currentIndex || (terminalComplete && index === currentIndex)
|
|
226
|
+
? 'complete'
|
|
227
|
+
: index === currentIndex
|
|
228
|
+
? 'current'
|
|
229
|
+
: 'pending'
|
|
230
|
+
let dateLabel: string | null = null
|
|
231
|
+
if (index === 0 && state === 'complete') dateLabel = formatShortDate(claim.submittedAt, locale)
|
|
232
|
+
if (index === TRACKER_STEP_KEYS.length - 1 && state === 'complete') {
|
|
233
|
+
dateLabel = formatShortDate(
|
|
234
|
+
claim.status === 'closed'
|
|
235
|
+
? claim.closedAt ?? claim.resolvedAt
|
|
236
|
+
: claim.resolvedAt ?? claim.closedAt,
|
|
237
|
+
locale,
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
if (state === 'current') dateLabel = t('warranty_claims.portal.tracker.step.now')
|
|
241
|
+
return {
|
|
242
|
+
id: key,
|
|
243
|
+
title: t(`warranty_claims.portal.tracker.step.${key}.title`),
|
|
244
|
+
description: t(`warranty_claims.portal.tracker.step.${key}.description`),
|
|
245
|
+
state,
|
|
246
|
+
dateLabel,
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function buildClaimTitle(claim: PortalClaim, t: TranslateFn): string {
|
|
252
|
+
const typeLabel = t(`warranty_claims.claimType.${claim.claimType}`)
|
|
253
|
+
if (claim.reasonCode) {
|
|
254
|
+
const reasonLabel = localizeDictionaryLabel(t, 'reason', claim.reasonCode, claim.reasonCode)
|
|
255
|
+
return t('warranty_claims.portal.tracker.titleWithReason', { reason: reasonLabel, type: typeLabel })
|
|
256
|
+
}
|
|
257
|
+
return t('warranty_claims.portal.tracker.titleFallback', { type: typeLabel })
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function buildClaimSubtitle(claim: PortalClaim, t: TranslateFn, locale: string): string {
|
|
261
|
+
if (claim.status === 'draft') {
|
|
262
|
+
const created = formatLongDate(claim.createdAt, locale)
|
|
263
|
+
return created
|
|
264
|
+
? t('warranty_claims.portal.tracker.draftCreated', { date: created })
|
|
265
|
+
: t('warranty_claims.portal.detail.notSubmitted')
|
|
266
|
+
}
|
|
267
|
+
const submitted = formatLongDate(claim.submittedAt, locale) ?? formatLongDate(claim.createdAt, locale)
|
|
268
|
+
if (!submitted) return t('warranty_claims.portal.value.notAvailable')
|
|
269
|
+
if (claim.orderNumber) {
|
|
270
|
+
return t('warranty_claims.portal.tracker.submittedFromOrder', { date: submitted, order: claim.orderNumber })
|
|
271
|
+
}
|
|
272
|
+
return t('warranty_claims.portal.tracker.submittedOn', { date: submitted })
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function formatEventBody(event: PortalClaimEvent, t: TranslateFn): string {
|
|
276
|
+
if (event.body) return event.body
|
|
277
|
+
const payload = event.payload
|
|
278
|
+
const from = typeof payload?.from === 'string' ? payload.from : null
|
|
279
|
+
const to = typeof payload?.to === 'string' ? payload.to : null
|
|
280
|
+
if (from && to) {
|
|
281
|
+
return t('warranty_claims.portal.event.transition', {
|
|
282
|
+
from: t(`warranty_claims.status.${from}`),
|
|
283
|
+
to: t(`warranty_claims.status.${to}`),
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
return t('warranty_claims.portal.event.noDetails')
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function eventTitle(event: PortalClaimEvent, t: TranslateFn): string {
|
|
290
|
+
if (event.kind === 'comment') {
|
|
291
|
+
return event.actorCustomerId
|
|
292
|
+
? t('warranty_claims.portal.tracker.event.youReplied')
|
|
293
|
+
: t('warranty_claims.portal.tracker.event.teamReplied')
|
|
294
|
+
}
|
|
295
|
+
return t(`warranty_claims.portal.event.${event.kind}`)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function buildActivityEntries(
|
|
299
|
+
events: PortalClaimEvent[],
|
|
300
|
+
attachments: PortalAttachment[],
|
|
301
|
+
t: TranslateFn,
|
|
302
|
+
): ActivityEntry[] {
|
|
303
|
+
const eventEntries: ActivityEntry[] = events.map((event) => ({
|
|
304
|
+
id: `event-${event.id}`,
|
|
305
|
+
title: eventTitle(event, t),
|
|
306
|
+
description: formatEventBody(event, t),
|
|
307
|
+
createdAt: event.createdAt,
|
|
308
|
+
}))
|
|
309
|
+
const attachmentEntries: ActivityEntry[] = attachments.map((attachment) => ({
|
|
310
|
+
id: `attachment-${attachment.id}`,
|
|
311
|
+
title: t('warranty_claims.portal.tracker.event.attachmentAdded'),
|
|
312
|
+
description: attachment.fileName,
|
|
313
|
+
createdAt: attachment.createdAt,
|
|
314
|
+
href: attachment.downloadUrl,
|
|
315
|
+
attachment,
|
|
316
|
+
}))
|
|
317
|
+
return [...eventEntries, ...attachmentEntries].sort((left, right) => {
|
|
318
|
+
const leftTime = left.createdAt ? new Date(left.createdAt).getTime() : 0
|
|
319
|
+
const rightTime = right.createdAt ? new Date(right.createdAt).getTime() : 0
|
|
320
|
+
return rightTime - leftTime
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const DETAIL_MUTATION_CONTEXT_ID = 'warranty_claims.portal.claim.detail'
|
|
325
|
+
|
|
326
|
+
const SECTION_CLASS = 'flex w-full flex-col gap-3 border-t border-border px-6 pb-6 pt-5'
|
|
327
|
+
const SECTION_HEADING_CLASS = 'text-sm font-semibold text-foreground'
|
|
328
|
+
const DARK_BUTTON_CLASS = 'rounded-md px-3 py-2 text-sm font-medium'
|
|
329
|
+
|
|
330
|
+
export default function WarrantyClaimPortalDetailPage({ params }: Props) {
|
|
331
|
+
const t = useT()
|
|
332
|
+
const locale = useLocale()
|
|
333
|
+
const router = useRouter()
|
|
334
|
+
const { auth } = usePortalContext()
|
|
335
|
+
const { user, loading } = auth
|
|
336
|
+
const guardedMutation = useGuardedMutation<Record<string, unknown>>({
|
|
337
|
+
contextId: DETAIL_MUTATION_CONTEXT_ID,
|
|
338
|
+
blockedMessage: t('warranty_claims.portal.detail.blocked'),
|
|
339
|
+
})
|
|
340
|
+
const { confirm, ConfirmDialogElement } = useConfirmDialog()
|
|
341
|
+
const [claim, setClaim] = React.useState<PortalClaim | null>(null)
|
|
342
|
+
const [events, setEvents] = React.useState<PortalClaimEvent[]>([])
|
|
343
|
+
const [attachments, setAttachments] = React.useState<PortalAttachment[]>([])
|
|
344
|
+
const [isLoading, setIsLoading] = React.useState(true)
|
|
345
|
+
const [error, setError] = React.useState<string | null>(null)
|
|
346
|
+
const [notFound, setNotFound] = React.useState(false)
|
|
347
|
+
const [comment, setComment] = React.useState('')
|
|
348
|
+
const [commentSubmitting, setCommentSubmitting] = React.useState(false)
|
|
349
|
+
const [fileInputKey, setFileInputKey] = React.useState(0)
|
|
350
|
+
const [uploading, setUploading] = React.useState(false)
|
|
351
|
+
const [attachmentMutationId, setAttachmentMutationId] = React.useState<string | null>(null)
|
|
352
|
+
const [claimAction, setClaimAction] = React.useState<PortalClaimAction | null>(null)
|
|
353
|
+
const [actionSubmitting, setActionSubmitting] = React.useState(false)
|
|
354
|
+
const replacementInputRef = React.useRef<HTMLInputElement | null>(null)
|
|
355
|
+
const replacementTargetRef = React.useRef<PortalAttachment | null>(null)
|
|
356
|
+
|
|
357
|
+
React.useEffect(() => {
|
|
358
|
+
if (!loading && !user) {
|
|
359
|
+
router.replace(`/${params.orgSlug}/portal/login`)
|
|
360
|
+
}
|
|
361
|
+
}, [loading, user, router, params.orgSlug])
|
|
362
|
+
|
|
363
|
+
const refreshEvents = React.useCallback(async (claimId: string) => {
|
|
364
|
+
const result = await apiCall<EventResponse>(`/api/warranty_claims/portal/events?claimId=${encodeURIComponent(claimId)}`)
|
|
365
|
+
if (result.ok && result.result) setEvents(result.result.items)
|
|
366
|
+
}, [])
|
|
367
|
+
|
|
368
|
+
const refreshAttachments = React.useCallback(async (claimId: string) => {
|
|
369
|
+
const result = await apiCall<AttachmentResponse>(`/api/warranty_claims/portal/attachments?claimId=${encodeURIComponent(claimId)}`)
|
|
370
|
+
if (result.ok && result.result) setAttachments(result.result.items)
|
|
371
|
+
}, [])
|
|
372
|
+
|
|
373
|
+
const loadClaim = React.useCallback(async () => {
|
|
374
|
+
setIsLoading(true)
|
|
375
|
+
setError(null)
|
|
376
|
+
setNotFound(false)
|
|
377
|
+
try {
|
|
378
|
+
const detail = await apiCall<ClaimResponse>(`/api/warranty_claims/portal/claims/${encodeURIComponent(params.id)}`)
|
|
379
|
+
if (detail.status === 404) {
|
|
380
|
+
setClaim(null)
|
|
381
|
+
setNotFound(true)
|
|
382
|
+
return
|
|
383
|
+
}
|
|
384
|
+
if (!detail.ok || !detail.result) {
|
|
385
|
+
setError(t('warranty_claims.portal.detail.loadError'))
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
setClaim(detail.result.item)
|
|
389
|
+
await Promise.all([
|
|
390
|
+
refreshEvents(detail.result.item.id),
|
|
391
|
+
refreshAttachments(detail.result.item.id),
|
|
392
|
+
])
|
|
393
|
+
} catch {
|
|
394
|
+
setError(t('warranty_claims.portal.detail.loadError'))
|
|
395
|
+
} finally {
|
|
396
|
+
setIsLoading(false)
|
|
397
|
+
}
|
|
398
|
+
}, [params.id, refreshAttachments, refreshEvents, t])
|
|
399
|
+
|
|
400
|
+
React.useEffect(() => {
|
|
401
|
+
if (user) void loadClaim()
|
|
402
|
+
}, [loadClaim, user])
|
|
403
|
+
|
|
404
|
+
const submitComment = React.useCallback(async () => {
|
|
405
|
+
if (!claim || commentSubmitting) return
|
|
406
|
+
const body = comment.trim()
|
|
407
|
+
if (!body) return
|
|
408
|
+
setCommentSubmitting(true)
|
|
409
|
+
setError(null)
|
|
410
|
+
try {
|
|
411
|
+
const result = await guardedMutation.runMutation({
|
|
412
|
+
operation: () => apiCall<MutationOkResponse>('/api/warranty_claims/portal/events', {
|
|
413
|
+
method: 'POST',
|
|
414
|
+
headers: { 'Content-Type': 'application/json' },
|
|
415
|
+
credentials: 'include',
|
|
416
|
+
body: JSON.stringify({ claimId: claim.id, body }),
|
|
417
|
+
}),
|
|
418
|
+
context: {
|
|
419
|
+
moduleId: 'warranty_claims',
|
|
420
|
+
entityId: 'warranty_claims.claim_event',
|
|
421
|
+
operation: 'portal_comment',
|
|
422
|
+
claimId: claim.id,
|
|
423
|
+
formId: DETAIL_MUTATION_CONTEXT_ID,
|
|
424
|
+
resourceKind: 'warranty_claims.claim_event',
|
|
425
|
+
resourceId: claim.id,
|
|
426
|
+
retryLastMutation: guardedMutation.retryLastMutation,
|
|
427
|
+
},
|
|
428
|
+
mutationPayload: { claimId: claim.id, body },
|
|
429
|
+
})
|
|
430
|
+
if (!result.ok || !result.result?.ok) {
|
|
431
|
+
setError(t('warranty_claims.portal.detail.commentError'))
|
|
432
|
+
return
|
|
433
|
+
}
|
|
434
|
+
setComment('')
|
|
435
|
+
flash(t('warranty_claims.portal.detail.commentSuccess'), 'success')
|
|
436
|
+
await refreshEvents(claim.id)
|
|
437
|
+
} catch {
|
|
438
|
+
setError(t('warranty_claims.portal.detail.commentError'))
|
|
439
|
+
} finally {
|
|
440
|
+
setCommentSubmitting(false)
|
|
441
|
+
}
|
|
442
|
+
}, [claim, comment, commentSubmitting, guardedMutation, refreshEvents, t])
|
|
443
|
+
|
|
444
|
+
const uploadAttachment = React.useCallback(async (file: File, replacementTarget?: PortalAttachment) => {
|
|
445
|
+
if (!claim || uploading) return
|
|
446
|
+
const validationError = await validateAttachmentFile(file, t)
|
|
447
|
+
if (validationError) {
|
|
448
|
+
setError(validationError)
|
|
449
|
+
flash(validationError, 'error')
|
|
450
|
+
return
|
|
451
|
+
}
|
|
452
|
+
setUploading(true)
|
|
453
|
+
setAttachmentMutationId(replacementTarget?.id ?? 'new')
|
|
454
|
+
setError(null)
|
|
455
|
+
try {
|
|
456
|
+
const form = new FormData()
|
|
457
|
+
form.set('claimId', claim.id)
|
|
458
|
+
form.set('file', file)
|
|
459
|
+
if (replacementTarget) form.set('attachmentId', replacementTarget.id)
|
|
460
|
+
const result = await guardedMutation.runMutation({
|
|
461
|
+
operation: () => apiCall<UploadResponse>('/api/warranty_claims/portal/attachments', {
|
|
462
|
+
method: replacementTarget ? 'PUT' : 'POST',
|
|
463
|
+
credentials: 'include',
|
|
464
|
+
body: form,
|
|
465
|
+
}),
|
|
466
|
+
context: {
|
|
467
|
+
moduleId: 'warranty_claims',
|
|
468
|
+
entityId: 'attachments.attachment',
|
|
469
|
+
operation: replacementTarget ? 'portal_attachment_replace' : 'portal_attachment_upload',
|
|
470
|
+
claimId: claim.id,
|
|
471
|
+
formId: DETAIL_MUTATION_CONTEXT_ID,
|
|
472
|
+
resourceKind: 'attachments.attachment',
|
|
473
|
+
resourceId: replacementTarget?.id ?? claim.id,
|
|
474
|
+
retryLastMutation: guardedMutation.retryLastMutation,
|
|
475
|
+
},
|
|
476
|
+
mutationPayload: {
|
|
477
|
+
claimId: claim.id,
|
|
478
|
+
attachmentId: replacementTarget?.id,
|
|
479
|
+
fileName: file.name,
|
|
480
|
+
fileSize: file.size,
|
|
481
|
+
},
|
|
482
|
+
})
|
|
483
|
+
if (!result.ok || !result.result?.ok) {
|
|
484
|
+
setError(replacementTarget
|
|
485
|
+
? t('warranty_claims.portal.detail.attachmentReplaceError', 'Attachment replacement failed.')
|
|
486
|
+
: t('warranty_claims.portal.detail.attachmentError'))
|
|
487
|
+
return
|
|
488
|
+
}
|
|
489
|
+
flash(
|
|
490
|
+
replacementTarget
|
|
491
|
+
? t('warranty_claims.portal.detail.attachmentReplaceSuccess', 'Attachment replaced.')
|
|
492
|
+
: t('warranty_claims.portal.detail.attachmentSuccess'),
|
|
493
|
+
'success',
|
|
494
|
+
)
|
|
495
|
+
await refreshAttachments(claim.id)
|
|
496
|
+
} catch {
|
|
497
|
+
setError(replacementTarget
|
|
498
|
+
? t('warranty_claims.portal.detail.attachmentReplaceError', 'Attachment replacement failed.')
|
|
499
|
+
: t('warranty_claims.portal.detail.attachmentError'))
|
|
500
|
+
} finally {
|
|
501
|
+
setUploading(false)
|
|
502
|
+
setAttachmentMutationId(null)
|
|
503
|
+
setFileInputKey((current) => current + 1)
|
|
504
|
+
}
|
|
505
|
+
}, [claim, guardedMutation, refreshAttachments, t, uploading])
|
|
506
|
+
|
|
507
|
+
const deleteAttachment = React.useCallback(async (attachment: PortalAttachment) => {
|
|
508
|
+
if (!claim || uploading) return
|
|
509
|
+
const confirmed = await confirm({
|
|
510
|
+
title: t('warranty_claims.portal.detail.attachmentDelete', 'Delete attachment'),
|
|
511
|
+
text: t(
|
|
512
|
+
'warranty_claims.portal.detail.attachmentDeleteConfirm',
|
|
513
|
+
'Delete "{name}"? This action cannot be undone.',
|
|
514
|
+
{ name: attachment.fileName },
|
|
515
|
+
),
|
|
516
|
+
confirmText: t('warranty_claims.portal.detail.attachmentDelete', 'Delete attachment'),
|
|
517
|
+
cancelText: t('warranty_claims.portal.detail.dialogCancel', 'Cancel'),
|
|
518
|
+
variant: 'destructive',
|
|
519
|
+
})
|
|
520
|
+
if (!confirmed) return
|
|
521
|
+
setUploading(true)
|
|
522
|
+
setAttachmentMutationId(attachment.id)
|
|
523
|
+
setError(null)
|
|
524
|
+
try {
|
|
525
|
+
const result = await guardedMutation.runMutation({
|
|
526
|
+
operation: () => apiCall<MutationOkResponse>(
|
|
527
|
+
`/api/warranty_claims/portal/attachments?attachmentId=${encodeURIComponent(attachment.id)}`,
|
|
528
|
+
{ method: 'DELETE', credentials: 'include' },
|
|
529
|
+
),
|
|
530
|
+
context: {
|
|
531
|
+
moduleId: 'warranty_claims',
|
|
532
|
+
entityId: 'attachments.attachment',
|
|
533
|
+
operation: 'portal_attachment_delete',
|
|
534
|
+
claimId: claim.id,
|
|
535
|
+
formId: DETAIL_MUTATION_CONTEXT_ID,
|
|
536
|
+
resourceKind: 'attachments.attachment',
|
|
537
|
+
resourceId: attachment.id,
|
|
538
|
+
retryLastMutation: guardedMutation.retryLastMutation,
|
|
539
|
+
},
|
|
540
|
+
mutationPayload: { claimId: claim.id, attachmentId: attachment.id },
|
|
541
|
+
})
|
|
542
|
+
if (!result.ok || !result.result?.ok) {
|
|
543
|
+
setError(t('warranty_claims.portal.detail.attachmentDeleteError', 'Attachment deletion failed.'))
|
|
544
|
+
return
|
|
545
|
+
}
|
|
546
|
+
flash(t('warranty_claims.portal.detail.attachmentDeleteSuccess', 'Attachment deleted.'), 'success')
|
|
547
|
+
await refreshAttachments(claim.id)
|
|
548
|
+
} catch {
|
|
549
|
+
setError(t('warranty_claims.portal.detail.attachmentDeleteError', 'Attachment deletion failed.'))
|
|
550
|
+
} finally {
|
|
551
|
+
setUploading(false)
|
|
552
|
+
setAttachmentMutationId(null)
|
|
553
|
+
}
|
|
554
|
+
}, [claim, confirm, guardedMutation, refreshAttachments, t, uploading])
|
|
555
|
+
|
|
556
|
+
const requestAttachmentReplacement = React.useCallback((attachment: PortalAttachment) => {
|
|
557
|
+
if (uploading) return
|
|
558
|
+
replacementTargetRef.current = attachment
|
|
559
|
+
replacementInputRef.current?.click()
|
|
560
|
+
}, [uploading])
|
|
561
|
+
|
|
562
|
+
const runClaimAction = React.useCallback(async (action: PortalClaimAction) => {
|
|
563
|
+
if (!claim || actionSubmitting) return
|
|
564
|
+
setActionSubmitting(true)
|
|
565
|
+
setError(null)
|
|
566
|
+
try {
|
|
567
|
+
const endpoint = `/api/warranty_claims/portal/claims/${encodeURIComponent(claim.id)}/${action}`
|
|
568
|
+
const result = await guardedMutation.runMutation({
|
|
569
|
+
operation: () => withScopedApiRequestHeaders(
|
|
570
|
+
buildOptimisticLockHeader(claim.updatedAt),
|
|
571
|
+
() => apiCall<ClaimActionResponse>(endpoint, {
|
|
572
|
+
method: 'POST',
|
|
573
|
+
headers: { 'Content-Type': 'application/json' },
|
|
574
|
+
credentials: 'include',
|
|
575
|
+
body: JSON.stringify({}),
|
|
576
|
+
}),
|
|
577
|
+
),
|
|
578
|
+
context: {
|
|
579
|
+
moduleId: 'warranty_claims',
|
|
580
|
+
entityId: 'warranty_claims.claim',
|
|
581
|
+
operation: action === 'submit' ? 'portal_submit' : 'portal_withdraw',
|
|
582
|
+
claimId: claim.id,
|
|
583
|
+
formId: DETAIL_MUTATION_CONTEXT_ID,
|
|
584
|
+
resourceKind: 'warranty_claims.claim',
|
|
585
|
+
resourceId: claim.id,
|
|
586
|
+
retryLastMutation: guardedMutation.retryLastMutation,
|
|
587
|
+
},
|
|
588
|
+
mutationPayload: { claimId: claim.id, action },
|
|
589
|
+
})
|
|
590
|
+
if (!result.ok || !result.result?.ok) {
|
|
591
|
+
const message = result.status === 409
|
|
592
|
+
? t('warranty_claims.portal.detail.actionConflict', 'This claim changed in the meantime. It has been reloaded — please try again.')
|
|
593
|
+
: action === 'submit'
|
|
594
|
+
? t('warranty_claims.portal.detail.submitError', 'The claim could not be submitted.')
|
|
595
|
+
: t('warranty_claims.portal.detail.withdrawError', 'The claim could not be withdrawn.')
|
|
596
|
+
setError(message)
|
|
597
|
+
flash(message, 'error')
|
|
598
|
+
if (result.status === 409) {
|
|
599
|
+
setClaimAction(null)
|
|
600
|
+
await loadClaim()
|
|
601
|
+
}
|
|
602
|
+
return
|
|
603
|
+
}
|
|
604
|
+
setClaimAction(null)
|
|
605
|
+
flash(
|
|
606
|
+
action === 'submit'
|
|
607
|
+
? t('warranty_claims.portal.detail.submitSuccess', 'Your claim has been submitted.')
|
|
608
|
+
: t('warranty_claims.portal.detail.withdrawSuccess', 'Your claim has been withdrawn.'),
|
|
609
|
+
'success',
|
|
610
|
+
)
|
|
611
|
+
await loadClaim()
|
|
612
|
+
} catch {
|
|
613
|
+
const message = action === 'submit'
|
|
614
|
+
? t('warranty_claims.portal.detail.submitError', 'The claim could not be submitted.')
|
|
615
|
+
: t('warranty_claims.portal.detail.withdrawError', 'The claim could not be withdrawn.')
|
|
616
|
+
setError(message)
|
|
617
|
+
flash(message, 'error')
|
|
618
|
+
} finally {
|
|
619
|
+
setActionSubmitting(false)
|
|
620
|
+
}
|
|
621
|
+
}, [actionSubmitting, claim, guardedMutation, loadClaim, t])
|
|
622
|
+
|
|
623
|
+
const handleSelectedFileChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
|
624
|
+
const file = event.target.files?.[0] ?? null
|
|
625
|
+
if (!file) return
|
|
626
|
+
void uploadAttachment(file)
|
|
627
|
+
}, [uploadAttachment])
|
|
628
|
+
|
|
629
|
+
const handleReplacementFileChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
|
630
|
+
const replacementTarget = replacementTargetRef.current
|
|
631
|
+
replacementTargetRef.current = null
|
|
632
|
+
const file = event.target.files?.[0] ?? null
|
|
633
|
+
event.target.value = ''
|
|
634
|
+
if (!replacementTarget || !file) return
|
|
635
|
+
void uploadAttachment(file, replacementTarget)
|
|
636
|
+
}, [uploadAttachment])
|
|
637
|
+
|
|
638
|
+
const handleCommentSubmit = React.useCallback((event: React.FormEvent<HTMLFormElement>) => {
|
|
639
|
+
event.preventDefault()
|
|
640
|
+
void submitComment()
|
|
641
|
+
}, [submitComment])
|
|
642
|
+
|
|
643
|
+
const handleCommentKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
644
|
+
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
|
|
645
|
+
event.preventDefault()
|
|
646
|
+
void submitComment()
|
|
647
|
+
return
|
|
648
|
+
}
|
|
649
|
+
if (event.key === 'Escape') {
|
|
650
|
+
event.preventDefault()
|
|
651
|
+
setComment('')
|
|
652
|
+
}
|
|
653
|
+
}, [submitComment])
|
|
654
|
+
|
|
655
|
+
if (loading) {
|
|
656
|
+
return <div className="flex items-center justify-center py-20"><Spinner /></div>
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
if (!user) return null
|
|
660
|
+
|
|
661
|
+
if (isLoading) {
|
|
662
|
+
return <LoadingMessage label={t('warranty_claims.portal.detail.loading')} />
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (notFound) {
|
|
666
|
+
return (
|
|
667
|
+
<PortalEmptyState
|
|
668
|
+
icon={<ShieldCheck className="size-5" />}
|
|
669
|
+
title={t('warranty_claims.portal.detail.notFoundTitle')}
|
|
670
|
+
description={t('warranty_claims.portal.detail.notFoundDescription')}
|
|
671
|
+
action={
|
|
672
|
+
<Button asChild>
|
|
673
|
+
<Link href={`/${params.orgSlug}/portal/claims`}>
|
|
674
|
+
<ArrowLeft className="size-4" aria-hidden="true" />
|
|
675
|
+
{t('warranty_claims.portal.detail.back')}
|
|
676
|
+
</Link>
|
|
677
|
+
</Button>
|
|
678
|
+
}
|
|
679
|
+
/>
|
|
680
|
+
)
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (!claim) {
|
|
684
|
+
return <ErrorMessage label={error ?? t('warranty_claims.portal.detail.loadError')} />
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const trackerSteps = buildTrackerSteps(claim, t, locale)
|
|
688
|
+
const isDraft = claim.status === 'draft'
|
|
689
|
+
const canWithdraw = claim.status === 'draft' || claim.status === 'submitted'
|
|
690
|
+
const tone = bannerTone(claim.status)
|
|
691
|
+
const toneClasses = BANNER_TONE_CLASSES[tone]
|
|
692
|
+
const BannerIcon = tone === 'error' ? CircleAlert : tone === 'warning' ? TriangleAlert : Info
|
|
693
|
+
const activityEntries = buildActivityEntries(events, attachments, t)
|
|
694
|
+
|
|
695
|
+
return (
|
|
696
|
+
<div className="mx-auto flex w-full max-w-3xl flex-col gap-4">
|
|
697
|
+
<Link
|
|
698
|
+
href={`/${params.orgSlug}/portal/claims`}
|
|
699
|
+
className="text-sm font-medium text-muted-foreground transition-colors hover:text-foreground"
|
|
700
|
+
>
|
|
701
|
+
{'←'} {t('warranty_claims.portal.listTitle')}
|
|
702
|
+
</Link>
|
|
703
|
+
|
|
704
|
+
{error ? <ErrorMessage label={error} /> : null}
|
|
705
|
+
|
|
706
|
+
<div className="w-full overflow-hidden rounded-lg border border-border bg-card">
|
|
707
|
+
<div className="flex w-full flex-col gap-3 px-6 pb-5 pt-6">
|
|
708
|
+
<div className="flex w-full items-center gap-2">
|
|
709
|
+
<div className="flex items-center gap-2 rounded-sm border border-border bg-background px-3 py-1">
|
|
710
|
+
<span className="text-xs font-medium text-muted-foreground">
|
|
711
|
+
{t(`warranty_claims.claimType.${claim.claimType}`)}
|
|
712
|
+
</span>
|
|
713
|
+
<span className="text-sm font-semibold text-foreground">
|
|
714
|
+
{claim.claimNumber}
|
|
715
|
+
</span>
|
|
716
|
+
</div>
|
|
717
|
+
<div className="min-w-px flex-1" />
|
|
718
|
+
{isDraft ? (
|
|
719
|
+
<Button
|
|
720
|
+
type="button"
|
|
721
|
+
size="sm"
|
|
722
|
+
className={DARK_BUTTON_CLASS}
|
|
723
|
+
onClick={() => setClaimAction('submit')}
|
|
724
|
+
disabled={actionSubmitting}
|
|
725
|
+
>
|
|
726
|
+
{t('warranty_claims.portal.submit')}
|
|
727
|
+
</Button>
|
|
728
|
+
) : null}
|
|
729
|
+
{canWithdraw ? (
|
|
730
|
+
<Button
|
|
731
|
+
type="button"
|
|
732
|
+
size="sm"
|
|
733
|
+
variant="destructive"
|
|
734
|
+
className="rounded-md px-3 py-2 text-sm font-medium"
|
|
735
|
+
onClick={() => setClaimAction('withdraw')}
|
|
736
|
+
disabled={actionSubmitting}
|
|
737
|
+
>
|
|
738
|
+
{t('warranty_claims.portal.detail.withdraw', 'Withdraw claim')}
|
|
739
|
+
</Button>
|
|
740
|
+
) : null}
|
|
741
|
+
</div>
|
|
742
|
+
<h1 className="text-xl font-bold text-foreground">
|
|
743
|
+
{buildClaimTitle(claim, t)}
|
|
744
|
+
</h1>
|
|
745
|
+
<p className="text-sm text-muted-foreground">
|
|
746
|
+
{buildClaimSubtitle(claim, t, locale)}
|
|
747
|
+
</p>
|
|
748
|
+
</div>
|
|
749
|
+
|
|
750
|
+
<div className="w-full px-6 pb-6">
|
|
751
|
+
<div className={`flex w-full items-start gap-3 rounded-lg px-4 py-3 ${toneClasses.wrapper}`}>
|
|
752
|
+
<BannerIcon className={`mt-px size-4 shrink-0 ${toneClasses.icon}`} aria-hidden="true" />
|
|
753
|
+
<p className={`min-w-px flex-1 text-sm ${toneClasses.text}`}>
|
|
754
|
+
{bannerMessage(claim, t)}
|
|
755
|
+
</p>
|
|
756
|
+
</div>
|
|
757
|
+
</div>
|
|
758
|
+
|
|
759
|
+
<div className="flex w-full flex-col px-6 pb-6">
|
|
760
|
+
{trackerSteps.map((step, index) => (
|
|
761
|
+
<div key={step.id} className="flex w-full items-stretch gap-4">
|
|
762
|
+
<div className="flex flex-col items-center">
|
|
763
|
+
{step.state === 'complete' ? (
|
|
764
|
+
<span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-status-success-icon">
|
|
765
|
+
<Check className="size-3 text-status-success-bg" strokeWidth={2.5} aria-hidden="true" />
|
|
766
|
+
</span>
|
|
767
|
+
) : step.state === 'current' ? (
|
|
768
|
+
<span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-semibold text-primary-foreground">
|
|
769
|
+
{index + 1}
|
|
770
|
+
</span>
|
|
771
|
+
) : (
|
|
772
|
+
<span className="flex size-6 shrink-0 items-center justify-center rounded-full border border-border text-xs font-semibold text-muted-foreground">
|
|
773
|
+
{index + 1}
|
|
774
|
+
</span>
|
|
775
|
+
)}
|
|
776
|
+
{index < trackerSteps.length - 1 ? (
|
|
777
|
+
<span
|
|
778
|
+
className={`min-h-2 w-px flex-1 ${step.state === 'complete' ? 'bg-status-success-icon' : 'bg-border'}`}
|
|
779
|
+
/>
|
|
780
|
+
) : null}
|
|
781
|
+
</div>
|
|
782
|
+
<div className="flex min-w-px flex-1 flex-col gap-1 pb-4">
|
|
783
|
+
<div className="flex w-full items-center gap-2">
|
|
784
|
+
<p
|
|
785
|
+
className={
|
|
786
|
+
step.state === 'pending'
|
|
787
|
+
? 'text-sm font-medium text-muted-foreground'
|
|
788
|
+
: 'text-sm font-semibold text-foreground'
|
|
789
|
+
}
|
|
790
|
+
>
|
|
791
|
+
{step.title}
|
|
792
|
+
</p>
|
|
793
|
+
<div className="min-w-px flex-1" />
|
|
794
|
+
{step.dateLabel ? (
|
|
795
|
+
<p className="text-xs text-muted-foreground">{step.dateLabel}</p>
|
|
796
|
+
) : null}
|
|
797
|
+
</div>
|
|
798
|
+
<p className="w-full text-xs text-muted-foreground">{step.description}</p>
|
|
799
|
+
</div>
|
|
800
|
+
</div>
|
|
801
|
+
))}
|
|
802
|
+
</div>
|
|
803
|
+
|
|
804
|
+
<div className={SECTION_CLASS}>
|
|
805
|
+
<p className={SECTION_HEADING_CLASS}>{t('warranty_claims.portal.tracker.items')}</p>
|
|
806
|
+
{claim.lines.length > 0 ? (
|
|
807
|
+
claim.lines.map((line) => (
|
|
808
|
+
<div
|
|
809
|
+
key={line.id}
|
|
810
|
+
className="flex w-full items-center gap-3 rounded-lg border border-border px-4 py-3"
|
|
811
|
+
>
|
|
812
|
+
<div className="flex min-w-px flex-1 flex-col gap-1">
|
|
813
|
+
<p className="text-sm font-medium text-foreground">
|
|
814
|
+
{line.productName ?? line.sku ?? t('warranty_claims.portal.value.unnamedLine')}
|
|
815
|
+
</p>
|
|
816
|
+
<p className="text-xs text-muted-foreground">
|
|
817
|
+
{line.sku
|
|
818
|
+
? t('warranty_claims.portal.tracker.itemMeta', {
|
|
819
|
+
sku: line.sku,
|
|
820
|
+
qty: formatQuantity(line.qtyClaimed, t('warranty_claims.portal.value.notAvailable')),
|
|
821
|
+
})
|
|
822
|
+
: t('warranty_claims.portal.tracker.itemQty', {
|
|
823
|
+
qty: formatQuantity(line.qtyClaimed, t('warranty_claims.portal.value.notAvailable')),
|
|
824
|
+
})}
|
|
825
|
+
</p>
|
|
826
|
+
</div>
|
|
827
|
+
<div className="flex shrink-0 items-center gap-2 rounded-sm border border-border bg-background px-2 py-1">
|
|
828
|
+
<span
|
|
829
|
+
className={`size-2 shrink-0 rounded-full ${LINE_STATUS_DOT_CLASSES[line.lineStatus] ?? 'bg-status-neutral-icon'}`}
|
|
830
|
+
aria-hidden="true"
|
|
831
|
+
/>
|
|
832
|
+
<span className="text-xs font-medium text-foreground">
|
|
833
|
+
{t(`warranty_claims.lineStatus.${line.lineStatus}`)}
|
|
834
|
+
</span>
|
|
835
|
+
</div>
|
|
836
|
+
</div>
|
|
837
|
+
))
|
|
838
|
+
) : (
|
|
839
|
+
<p className="text-xs text-muted-foreground">
|
|
840
|
+
{t('warranty_claims.portal.detail.linesEmpty.description')}
|
|
841
|
+
</p>
|
|
842
|
+
)}
|
|
843
|
+
</div>
|
|
844
|
+
|
|
845
|
+
<div className={SECTION_CLASS}>
|
|
846
|
+
<p className={SECTION_HEADING_CLASS}>{t('warranty_claims.portal.tracker.activity')}</p>
|
|
847
|
+
{activityEntries.length > 0 ? (
|
|
848
|
+
activityEntries.map((entry) => (
|
|
849
|
+
<div key={entry.id} className="flex w-full items-start gap-3">
|
|
850
|
+
<span className="mt-1 size-2 shrink-0 rounded-full bg-status-neutral-icon" aria-hidden="true" />
|
|
851
|
+
<div className="flex min-w-px flex-1 flex-col gap-px">
|
|
852
|
+
<div className="flex w-full items-start gap-2">
|
|
853
|
+
<p className="text-sm font-medium text-foreground">{entry.title}</p>
|
|
854
|
+
<div className="min-w-px flex-1" />
|
|
855
|
+
{entry.createdAt ? (
|
|
856
|
+
<p className="text-xs text-muted-foreground">{formatShortDate(entry.createdAt, locale)}</p>
|
|
857
|
+
) : null}
|
|
858
|
+
</div>
|
|
859
|
+
{entry.href ? (
|
|
860
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
861
|
+
<a
|
|
862
|
+
href={entry.href}
|
|
863
|
+
target="_blank"
|
|
864
|
+
rel="noreferrer"
|
|
865
|
+
className="min-w-0 whitespace-pre-wrap text-xs text-muted-foreground underline-offset-2 hover:underline"
|
|
866
|
+
>
|
|
867
|
+
{entry.description}
|
|
868
|
+
</a>
|
|
869
|
+
{entry.attachment ? (
|
|
870
|
+
<div className="flex items-center gap-1">
|
|
871
|
+
<Button
|
|
872
|
+
type="button"
|
|
873
|
+
variant="ghost"
|
|
874
|
+
size="sm"
|
|
875
|
+
className="px-2 text-xs"
|
|
876
|
+
aria-label={t(
|
|
877
|
+
'warranty_claims.portal.detail.attachmentReplaceNamed',
|
|
878
|
+
'Replace {name}',
|
|
879
|
+
{ name: entry.attachment.fileName },
|
|
880
|
+
)}
|
|
881
|
+
onClick={() => requestAttachmentReplacement(entry.attachment!)}
|
|
882
|
+
disabled={uploading}
|
|
883
|
+
>
|
|
884
|
+
{attachmentMutationId === entry.attachment.id ? (
|
|
885
|
+
<Spinner className="size-3" />
|
|
886
|
+
) : (
|
|
887
|
+
<RefreshCw className="size-3" aria-hidden="true" />
|
|
888
|
+
)}
|
|
889
|
+
{t('warranty_claims.portal.detail.attachmentReplace', 'Replace')}
|
|
890
|
+
</Button>
|
|
891
|
+
<Button
|
|
892
|
+
type="button"
|
|
893
|
+
variant="ghost"
|
|
894
|
+
size="sm"
|
|
895
|
+
className="px-2 text-xs text-status-error-text"
|
|
896
|
+
aria-label={t(
|
|
897
|
+
'warranty_claims.portal.detail.attachmentDeleteNamed',
|
|
898
|
+
'Delete {name}',
|
|
899
|
+
{ name: entry.attachment.fileName },
|
|
900
|
+
)}
|
|
901
|
+
onClick={() => { void deleteAttachment(entry.attachment!) }}
|
|
902
|
+
disabled={uploading}
|
|
903
|
+
>
|
|
904
|
+
<Trash2 className="size-3" aria-hidden="true" />
|
|
905
|
+
{t('warranty_claims.portal.detail.attachmentDelete', 'Delete attachment')}
|
|
906
|
+
</Button>
|
|
907
|
+
</div>
|
|
908
|
+
) : null}
|
|
909
|
+
</div>
|
|
910
|
+
) : (
|
|
911
|
+
<p className="whitespace-pre-wrap text-xs text-muted-foreground">{entry.description}</p>
|
|
912
|
+
)}
|
|
913
|
+
</div>
|
|
914
|
+
</div>
|
|
915
|
+
))
|
|
916
|
+
) : (
|
|
917
|
+
<p className="text-xs text-muted-foreground">
|
|
918
|
+
{t('warranty_claims.portal.detail.timelineEmpty.description')}
|
|
919
|
+
</p>
|
|
920
|
+
)}
|
|
921
|
+
<input
|
|
922
|
+
ref={replacementInputRef}
|
|
923
|
+
type="file"
|
|
924
|
+
accept={ATTACHMENT_ACCEPT_TYPES}
|
|
925
|
+
onChange={handleReplacementFileChange}
|
|
926
|
+
disabled={uploading}
|
|
927
|
+
className="sr-only"
|
|
928
|
+
aria-label={t('warranty_claims.portal.detail.attachmentChooseReplacement', 'Choose replacement file')}
|
|
929
|
+
/>
|
|
930
|
+
</div>
|
|
931
|
+
|
|
932
|
+
<div className={SECTION_CLASS}>
|
|
933
|
+
<p className={SECTION_HEADING_CLASS}>{t('warranty_claims.portal.tracker.message')}</p>
|
|
934
|
+
<form id="warranty-claim-comment-box" className="flex w-full flex-col gap-3" onSubmit={handleCommentSubmit}>
|
|
935
|
+
<Textarea
|
|
936
|
+
value={comment}
|
|
937
|
+
onChange={(event) => setComment(event.target.value)}
|
|
938
|
+
onKeyDown={handleCommentKeyDown}
|
|
939
|
+
placeholder={t('warranty_claims.portal.tracker.messagePlaceholder')}
|
|
940
|
+
disabled={commentSubmitting}
|
|
941
|
+
maxLength={8000}
|
|
942
|
+
className="h-40 resize-none rounded-lg border-input bg-background px-3 py-2 text-sm shadow-xs placeholder:text-muted-foreground"
|
|
943
|
+
/>
|
|
944
|
+
<div className="flex w-full items-center gap-2">
|
|
945
|
+
<label className={`flex items-center gap-2 ${uploading ? 'cursor-default opacity-70' : 'cursor-pointer'}`}>
|
|
946
|
+
{uploading ? (
|
|
947
|
+
<Spinner className="size-4" />
|
|
948
|
+
) : (
|
|
949
|
+
<Paperclip className="size-4 text-muted-foreground" aria-hidden="true" />
|
|
950
|
+
)}
|
|
951
|
+
<span className="text-xs font-medium text-muted-foreground transition-colors hover:text-foreground">
|
|
952
|
+
{uploading
|
|
953
|
+
? t('warranty_claims.portal.detail.uploading')
|
|
954
|
+
: t('warranty_claims.portal.tracker.attachFiles')}
|
|
955
|
+
</span>
|
|
956
|
+
<input
|
|
957
|
+
key={fileInputKey}
|
|
958
|
+
type="file"
|
|
959
|
+
accept={ATTACHMENT_ACCEPT_TYPES}
|
|
960
|
+
onChange={handleSelectedFileChange}
|
|
961
|
+
disabled={uploading}
|
|
962
|
+
className="sr-only"
|
|
963
|
+
/>
|
|
964
|
+
</label>
|
|
965
|
+
<div className="min-w-px flex-1" />
|
|
966
|
+
<Button type="submit" size="sm" className={DARK_BUTTON_CLASS} disabled={commentSubmitting || !comment.trim()}>
|
|
967
|
+
{commentSubmitting
|
|
968
|
+
? t('warranty_claims.portal.tracker.sending')
|
|
969
|
+
: t('warranty_claims.portal.tracker.send')}
|
|
970
|
+
</Button>
|
|
971
|
+
</div>
|
|
972
|
+
</form>
|
|
973
|
+
</div>
|
|
974
|
+
</div>
|
|
975
|
+
|
|
976
|
+
<Dialog
|
|
977
|
+
open={claimAction !== null}
|
|
978
|
+
onOpenChange={(open) => {
|
|
979
|
+
if (!open && !actionSubmitting) setClaimAction(null)
|
|
980
|
+
}}
|
|
981
|
+
>
|
|
982
|
+
<DialogContent
|
|
983
|
+
className="max-w-lg"
|
|
984
|
+
onKeyDown={(event) => {
|
|
985
|
+
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
|
|
986
|
+
event.preventDefault()
|
|
987
|
+
if (claimAction && !actionSubmitting) void runClaimAction(claimAction)
|
|
988
|
+
}
|
|
989
|
+
if (event.key === 'Escape' && !actionSubmitting) {
|
|
990
|
+
setClaimAction(null)
|
|
991
|
+
}
|
|
992
|
+
}}
|
|
993
|
+
>
|
|
994
|
+
<DialogHeader>
|
|
995
|
+
<DialogTitle>
|
|
996
|
+
{claimAction === 'withdraw'
|
|
997
|
+
? t('warranty_claims.portal.detail.withdrawDialog.title', 'Withdraw this claim?')
|
|
998
|
+
: t('warranty_claims.portal.detail.submitDialog.title', 'Submit this claim?')}
|
|
999
|
+
</DialogTitle>
|
|
1000
|
+
<DialogDescription>
|
|
1001
|
+
{claimAction === 'withdraw'
|
|
1002
|
+
? t('warranty_claims.portal.detail.withdrawDialog.description', 'The claim will be cancelled and cannot be reopened. This cannot be undone.')
|
|
1003
|
+
: t('warranty_claims.portal.detail.submitDialog.description', 'Your claim will be sent to our support team for review. You can still add comments and photos afterwards.')}
|
|
1004
|
+
</DialogDescription>
|
|
1005
|
+
</DialogHeader>
|
|
1006
|
+
<DialogFooter>
|
|
1007
|
+
<Button
|
|
1008
|
+
type="button"
|
|
1009
|
+
variant="outline"
|
|
1010
|
+
onClick={() => setClaimAction(null)}
|
|
1011
|
+
disabled={actionSubmitting}
|
|
1012
|
+
>
|
|
1013
|
+
{t('warranty_claims.portal.detail.dialogCancel', 'Cancel')}
|
|
1014
|
+
</Button>
|
|
1015
|
+
<Button
|
|
1016
|
+
type="button"
|
|
1017
|
+
variant={claimAction === 'withdraw' ? 'destructive' : 'default'}
|
|
1018
|
+
onClick={() => {
|
|
1019
|
+
if (claimAction) void runClaimAction(claimAction)
|
|
1020
|
+
}}
|
|
1021
|
+
disabled={actionSubmitting}
|
|
1022
|
+
>
|
|
1023
|
+
{claimAction === 'withdraw'
|
|
1024
|
+
? (actionSubmitting
|
|
1025
|
+
? t('warranty_claims.portal.detail.withdrawing', 'Withdrawing...')
|
|
1026
|
+
: t('warranty_claims.portal.detail.withdrawConfirm', 'Withdraw claim'))
|
|
1027
|
+
: (actionSubmitting
|
|
1028
|
+
? t('warranty_claims.portal.detail.submitting', 'Submitting...')
|
|
1029
|
+
: t('warranty_claims.portal.detail.submitConfirm', 'Submit claim'))}
|
|
1030
|
+
</Button>
|
|
1031
|
+
</DialogFooter>
|
|
1032
|
+
</DialogContent>
|
|
1033
|
+
</Dialog>
|
|
1034
|
+
{ConfirmDialogElement}
|
|
1035
|
+
</div>
|
|
1036
|
+
)
|
|
1037
|
+
}
|