@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,1139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { useRouter } from "next/navigation";
|
|
6
|
+
import { ArrowLeft, ArrowRight, FileText, Plus, Send, Trash2 } from "lucide-react";
|
|
7
|
+
import { useLocale, useT } from "@open-mercato/shared/lib/i18n/context";
|
|
8
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
9
|
+
import { Checkbox } from "@open-mercato/ui/primitives/checkbox";
|
|
10
|
+
import { CheckboxField } from "@open-mercato/ui/primitives/checkbox-field";
|
|
11
|
+
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
|
|
12
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
13
|
+
import { Radio, RadioGroup } from "@open-mercato/ui/primitives/radio";
|
|
14
|
+
import {
|
|
15
|
+
Select,
|
|
16
|
+
SelectContent,
|
|
17
|
+
SelectItem,
|
|
18
|
+
SelectTrigger,
|
|
19
|
+
SelectValue
|
|
20
|
+
} from "@open-mercato/ui/primitives/select";
|
|
21
|
+
import { StatusBadge } from "@open-mercato/ui/primitives/status-badge";
|
|
22
|
+
import { StepIndicator } from "@open-mercato/ui/primitives/step-indicator";
|
|
23
|
+
import { Textarea } from "@open-mercato/ui/primitives/textarea";
|
|
24
|
+
import { FormField } from "@open-mercato/ui/primitives/form-field";
|
|
25
|
+
import { Alert, AlertDescription } from "@open-mercato/ui/primitives/alert";
|
|
26
|
+
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
27
|
+
import { ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
28
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
29
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
30
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
31
|
+
import { usePortalContext } from "@open-mercato/ui/portal/PortalContext";
|
|
32
|
+
import { PortalPageHeader } from "@open-mercato/ui/portal/components/PortalPageHeader";
|
|
33
|
+
import { PortalCard, PortalCardHeader } from "@open-mercato/ui/portal/components/PortalCard";
|
|
34
|
+
import { localizeDictionaryLabel } from "@open-mercato/core/modules/warranty_claims/lib/dictionaryLabels";
|
|
35
|
+
import {
|
|
36
|
+
ATTACHMENT_ACCEPT_TYPES,
|
|
37
|
+
validateAttachmentFile
|
|
38
|
+
} from "@open-mercato/core/modules/warranty_claims/lib/portalAttachmentValidation";
|
|
39
|
+
import {
|
|
40
|
+
TroubleshootingWalker
|
|
41
|
+
} from "../../../../../backend/components/TroubleshootingWalker.js";
|
|
42
|
+
const WIZARD_STEP_IDS = ["order", "items", "details", "review"];
|
|
43
|
+
const EMPTY_SELECT_VALUE = "__empty__";
|
|
44
|
+
let lineId = 0;
|
|
45
|
+
function createLineDraft() {
|
|
46
|
+
lineId += 1;
|
|
47
|
+
return {
|
|
48
|
+
localId: `claim-line-${lineId}`,
|
|
49
|
+
sku: "",
|
|
50
|
+
serialNumber: "",
|
|
51
|
+
faultCode: "",
|
|
52
|
+
faultDescription: "",
|
|
53
|
+
qtyClaimed: "1"
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
let stagedAttachmentId = 0;
|
|
57
|
+
function createStagedAttachment(file) {
|
|
58
|
+
stagedAttachmentId += 1;
|
|
59
|
+
return { localId: `claim-attachment-${stagedAttachmentId}`, file };
|
|
60
|
+
}
|
|
61
|
+
function optionalText(value) {
|
|
62
|
+
const trimmed = value.trim();
|
|
63
|
+
return trimmed.length ? trimmed : void 0;
|
|
64
|
+
}
|
|
65
|
+
function isPositiveQuantity(value) {
|
|
66
|
+
const qtyClaimed = Number(value);
|
|
67
|
+
return Number.isFinite(qtyClaimed) && qtyClaimed > 0;
|
|
68
|
+
}
|
|
69
|
+
function parsePositiveNumber(value) {
|
|
70
|
+
if (typeof value === "number") return Number.isFinite(value) && value > 0 ? value : null;
|
|
71
|
+
if (typeof value === "string") {
|
|
72
|
+
const parsed = Number(value);
|
|
73
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function defaultQuantity(value) {
|
|
78
|
+
return String(parsePositiveNumber(value) ?? 1);
|
|
79
|
+
}
|
|
80
|
+
function formatDate(value, fallback, locale) {
|
|
81
|
+
if (!value) return fallback;
|
|
82
|
+
const date = new Date(value);
|
|
83
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
84
|
+
return date.toLocaleDateString(locale || void 0, {
|
|
85
|
+
year: "numeric",
|
|
86
|
+
month: "short",
|
|
87
|
+
day: "numeric"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function formatQuantity(value, fallback, locale) {
|
|
91
|
+
const parsed = parsePositiveNumber(value);
|
|
92
|
+
return parsed === null ? fallback : parsed.toLocaleString(locale || void 0);
|
|
93
|
+
}
|
|
94
|
+
function formatOrderTotal(value, currencyCode, fallback, locale) {
|
|
95
|
+
const parsed = typeof value === "number" ? value : typeof value === "string" ? Number(value) : Number.NaN;
|
|
96
|
+
if (!Number.isFinite(parsed)) return fallback;
|
|
97
|
+
if (currencyCode && /^[A-Z]{3}$/.test(currencyCode)) {
|
|
98
|
+
return new Intl.NumberFormat(locale || void 0, { style: "currency", currency: currencyCode }).format(parsed);
|
|
99
|
+
}
|
|
100
|
+
const formatted = parsed.toLocaleString(locale || void 0);
|
|
101
|
+
return currencyCode ? `${formatted} ${currencyCode}` : formatted;
|
|
102
|
+
}
|
|
103
|
+
function optionLabel(options, value) {
|
|
104
|
+
return options.find((option) => option.value === value)?.label ?? value;
|
|
105
|
+
}
|
|
106
|
+
function isBlankLineDraft(line) {
|
|
107
|
+
return !line.orderLineId && !line.productId && !optionalText(line.productName ?? "") && !optionalText(line.sku) && !optionalText(line.serialNumber) && !optionalText(line.faultCode) && !optionalText(line.faultDescription) && (!optionalText(line.qtyClaimed) || line.qtyClaimed === "1");
|
|
108
|
+
}
|
|
109
|
+
function warrantyStatusVariant(status) {
|
|
110
|
+
if (status === "in_warranty") return "success";
|
|
111
|
+
if (status === "out_of_warranty") return "error";
|
|
112
|
+
return "neutral";
|
|
113
|
+
}
|
|
114
|
+
function warrantyStatusLabelKey(status) {
|
|
115
|
+
if (status === "in_warranty") return "warranty_claims.portal.entitlement.inWarranty";
|
|
116
|
+
if (status === "out_of_warranty") return "warranty_claims.portal.entitlement.outOfWarranty";
|
|
117
|
+
return "warranty_claims.portal.value.notAvailable";
|
|
118
|
+
}
|
|
119
|
+
const CREATE_MUTATION_CONTEXT_ID = "warranty_claims.portal.claim.create";
|
|
120
|
+
function WarrantyClaimPortalNewPage({ params }) {
|
|
121
|
+
const t = useT();
|
|
122
|
+
const locale = useLocale();
|
|
123
|
+
const router = useRouter();
|
|
124
|
+
const { auth } = usePortalContext();
|
|
125
|
+
const { user, loading } = auth;
|
|
126
|
+
const guardedMutation = useGuardedMutation({
|
|
127
|
+
contextId: CREATE_MUTATION_CONTEXT_ID,
|
|
128
|
+
blockedMessage: t("warranty_claims.portal.new.blocked")
|
|
129
|
+
});
|
|
130
|
+
const [currentStep, setCurrentStep] = React.useState("order");
|
|
131
|
+
const [noOrder, setNoOrder] = React.useState(false);
|
|
132
|
+
const [manualOrderEntry, setManualOrderEntry] = React.useState(false);
|
|
133
|
+
const [orderReference, setOrderReference] = React.useState("");
|
|
134
|
+
const [orderSearchInput, setOrderSearchInput] = React.useState("");
|
|
135
|
+
const [debouncedOrderSearch, setDebouncedOrderSearch] = React.useState("");
|
|
136
|
+
const [orders, setOrders] = React.useState([]);
|
|
137
|
+
const [ordersLoading, setOrdersLoading] = React.useState(false);
|
|
138
|
+
const [ordersUnavailable, setOrdersUnavailable] = React.useState(false);
|
|
139
|
+
const [selectedOrderId, setSelectedOrderId] = React.useState("");
|
|
140
|
+
const [selectedOrderNumber, setSelectedOrderNumber] = React.useState("");
|
|
141
|
+
const [selectedOrderPlacedAt, setSelectedOrderPlacedAt] = React.useState(null);
|
|
142
|
+
const [orderLines, setOrderLines] = React.useState([]);
|
|
143
|
+
const [orderLinesLoading, setOrderLinesLoading] = React.useState(false);
|
|
144
|
+
const [orderLinesUnavailable, setOrderLinesUnavailable] = React.useState(false);
|
|
145
|
+
const [selectedOrderLineIds, setSelectedOrderLineIds] = React.useState(() => /* @__PURE__ */ new Set());
|
|
146
|
+
const [selectedOrderLineQty, setSelectedOrderLineQty] = React.useState({});
|
|
147
|
+
const [reasonCode, setReasonCode] = React.useState("");
|
|
148
|
+
const [notes, setNotes] = React.useState("");
|
|
149
|
+
const [lines, setLines] = React.useState(() => [createLineDraft()]);
|
|
150
|
+
const [portalOptions, setPortalOptions] = React.useState({ reasons: [], faultCodes: [] });
|
|
151
|
+
const [troubleshootingGuide, setTroubleshootingGuide] = React.useState(null);
|
|
152
|
+
const [error, setError] = React.useState(null);
|
|
153
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
154
|
+
const [stagedFiles, setStagedFiles] = React.useState([]);
|
|
155
|
+
const [stagedFileInputKey, setStagedFileInputKey] = React.useState(0);
|
|
156
|
+
const [serialDuplicateWarnings, setSerialDuplicateWarnings] = React.useState({});
|
|
157
|
+
const serialLookupTimers = React.useRef({});
|
|
158
|
+
const isMountedRef = React.useRef(true);
|
|
159
|
+
React.useEffect(() => {
|
|
160
|
+
if (!loading && !user) {
|
|
161
|
+
router.replace(`/${params.orgSlug}/portal/login`);
|
|
162
|
+
}
|
|
163
|
+
}, [loading, user, router, params.orgSlug]);
|
|
164
|
+
React.useEffect(() => {
|
|
165
|
+
isMountedRef.current = true;
|
|
166
|
+
return () => {
|
|
167
|
+
isMountedRef.current = false;
|
|
168
|
+
Object.values(serialLookupTimers.current).forEach((timer) => window.clearTimeout(timer));
|
|
169
|
+
};
|
|
170
|
+
}, []);
|
|
171
|
+
const clearSerialLookupTimer = React.useCallback((localId) => {
|
|
172
|
+
const timer = serialLookupTimers.current[localId];
|
|
173
|
+
if (timer) {
|
|
174
|
+
window.clearTimeout(timer);
|
|
175
|
+
delete serialLookupTimers.current[localId];
|
|
176
|
+
}
|
|
177
|
+
}, []);
|
|
178
|
+
const clearSerialDuplicateWarning = React.useCallback((localId) => {
|
|
179
|
+
setSerialDuplicateWarnings((current) => {
|
|
180
|
+
if (!(localId in current)) return current;
|
|
181
|
+
const next = { ...current };
|
|
182
|
+
delete next[localId];
|
|
183
|
+
return next;
|
|
184
|
+
});
|
|
185
|
+
}, []);
|
|
186
|
+
const checkSerialDuplicate = React.useCallback((localId, serialNumber) => {
|
|
187
|
+
clearSerialLookupTimer(localId);
|
|
188
|
+
const trimmed = serialNumber.trim();
|
|
189
|
+
if (!trimmed) {
|
|
190
|
+
clearSerialDuplicateWarning(localId);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
serialLookupTimers.current[localId] = window.setTimeout(() => {
|
|
194
|
+
void apiCall(
|
|
195
|
+
`/api/warranty_claims/portal/claims?serialNumber=${encodeURIComponent(trimmed)}&pageSize=5`
|
|
196
|
+
).then((result) => {
|
|
197
|
+
if (!isMountedRef.current || !result.ok || !result.result) return;
|
|
198
|
+
const claimNumbers = result.result.items.map((item) => item.claimNumber).filter((value) => typeof value === "string" && value.length > 0);
|
|
199
|
+
setSerialDuplicateWarnings((current) => ({ ...current, [localId]: claimNumbers }));
|
|
200
|
+
}).catch(() => {
|
|
201
|
+
});
|
|
202
|
+
}, 300);
|
|
203
|
+
}, [clearSerialDuplicateWarning, clearSerialLookupTimer]);
|
|
204
|
+
React.useEffect(() => {
|
|
205
|
+
if (!user) return;
|
|
206
|
+
let cancelled = false;
|
|
207
|
+
apiCall("/api/warranty_claims/portal/options").then((result) => {
|
|
208
|
+
if (cancelled) return;
|
|
209
|
+
const options = result.result?.ok ? result.result.result : null;
|
|
210
|
+
setPortalOptions({
|
|
211
|
+
reasons: options?.reasons ?? [],
|
|
212
|
+
faultCodes: options?.faultCodes ?? []
|
|
213
|
+
});
|
|
214
|
+
}).catch(() => {
|
|
215
|
+
if (!cancelled) setPortalOptions({ reasons: [], faultCodes: [] });
|
|
216
|
+
});
|
|
217
|
+
return () => {
|
|
218
|
+
cancelled = true;
|
|
219
|
+
};
|
|
220
|
+
}, [user]);
|
|
221
|
+
React.useEffect(() => {
|
|
222
|
+
if (!user) {
|
|
223
|
+
setTroubleshootingGuide(null);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
let cancelled = false;
|
|
227
|
+
const timer = window.setTimeout(() => {
|
|
228
|
+
const params2 = new URLSearchParams({ claimType: "warranty" });
|
|
229
|
+
const trimmedReason = reasonCode.trim();
|
|
230
|
+
if (trimmedReason) params2.set("reasonCode", trimmedReason);
|
|
231
|
+
void apiCall(
|
|
232
|
+
`/api/warranty_claims/portal/troubleshooting?${params2.toString()}`,
|
|
233
|
+
void 0,
|
|
234
|
+
{ fallback: { guide: null } }
|
|
235
|
+
).then((result) => {
|
|
236
|
+
if (cancelled) return;
|
|
237
|
+
setTroubleshootingGuide(result.ok ? result.result?.guide ?? null : null);
|
|
238
|
+
}).catch(() => {
|
|
239
|
+
if (!cancelled) setTroubleshootingGuide(null);
|
|
240
|
+
});
|
|
241
|
+
}, 300);
|
|
242
|
+
return () => {
|
|
243
|
+
cancelled = true;
|
|
244
|
+
window.clearTimeout(timer);
|
|
245
|
+
};
|
|
246
|
+
}, [reasonCode, user]);
|
|
247
|
+
React.useEffect(() => {
|
|
248
|
+
if (currentStep !== "order") return;
|
|
249
|
+
const timer = window.setTimeout(() => {
|
|
250
|
+
setDebouncedOrderSearch(orderSearchInput.trim());
|
|
251
|
+
}, 300);
|
|
252
|
+
return () => window.clearTimeout(timer);
|
|
253
|
+
}, [currentStep, orderSearchInput]);
|
|
254
|
+
React.useEffect(() => {
|
|
255
|
+
if (!user || currentStep !== "order" || ordersUnavailable) return;
|
|
256
|
+
let cancelled = false;
|
|
257
|
+
setOrdersLoading(true);
|
|
258
|
+
const search = encodeURIComponent(debouncedOrderSearch);
|
|
259
|
+
apiCall(`/api/warranty_claims/portal/orders?search=${search}&page=1`).then((result) => {
|
|
260
|
+
if (cancelled) return;
|
|
261
|
+
const payload = result.ok ? result.result : null;
|
|
262
|
+
if (!payload?.ok) {
|
|
263
|
+
setOrders([]);
|
|
264
|
+
setOrdersUnavailable(true);
|
|
265
|
+
setManualOrderEntry(true);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
setOrders(payload.items);
|
|
269
|
+
}).catch(() => {
|
|
270
|
+
if (!cancelled) {
|
|
271
|
+
setOrders([]);
|
|
272
|
+
setOrdersUnavailable(true);
|
|
273
|
+
setManualOrderEntry(true);
|
|
274
|
+
}
|
|
275
|
+
}).finally(() => {
|
|
276
|
+
if (!cancelled) setOrdersLoading(false);
|
|
277
|
+
});
|
|
278
|
+
return () => {
|
|
279
|
+
cancelled = true;
|
|
280
|
+
};
|
|
281
|
+
}, [currentStep, debouncedOrderSearch, ordersUnavailable, user]);
|
|
282
|
+
React.useEffect(() => {
|
|
283
|
+
if (!user || currentStep !== "items" || !selectedOrderId) {
|
|
284
|
+
if (!selectedOrderId) {
|
|
285
|
+
setOrderLines([]);
|
|
286
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
287
|
+
setSelectedOrderLineQty({});
|
|
288
|
+
}
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
let cancelled = false;
|
|
292
|
+
setOrderLinesLoading(true);
|
|
293
|
+
setOrderLinesUnavailable(false);
|
|
294
|
+
apiCall(
|
|
295
|
+
`/api/warranty_claims/portal/orders/lines?orderId=${encodeURIComponent(selectedOrderId)}`
|
|
296
|
+
).then((result) => {
|
|
297
|
+
if (cancelled) return;
|
|
298
|
+
const payload = result.ok ? result.result : null;
|
|
299
|
+
if (!payload?.ok || payload.items.length === 0) {
|
|
300
|
+
setOrderLines([]);
|
|
301
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
302
|
+
setSelectedOrderLineQty({});
|
|
303
|
+
setOrderLinesUnavailable(true);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
setOrderLines(payload.items);
|
|
307
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
308
|
+
setSelectedOrderLineQty(Object.fromEntries(
|
|
309
|
+
payload.items.map((line) => [line.orderLineId, defaultQuantity(line.quantity)])
|
|
310
|
+
));
|
|
311
|
+
}).catch(() => {
|
|
312
|
+
if (!cancelled) {
|
|
313
|
+
setOrderLines([]);
|
|
314
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
315
|
+
setSelectedOrderLineQty({});
|
|
316
|
+
setOrderLinesUnavailable(true);
|
|
317
|
+
}
|
|
318
|
+
}).finally(() => {
|
|
319
|
+
if (!cancelled) setOrderLinesLoading(false);
|
|
320
|
+
});
|
|
321
|
+
return () => {
|
|
322
|
+
cancelled = true;
|
|
323
|
+
};
|
|
324
|
+
}, [currentStep, selectedOrderId, user]);
|
|
325
|
+
const currentStepIndex = WIZARD_STEP_IDS.indexOf(currentStep);
|
|
326
|
+
const hasValidLines = React.useMemo(() => {
|
|
327
|
+
return lines.length > 0 && lines.every((line) => line.faultDescription.trim().length > 0 && isPositiveQuantity(line.qtyClaimed));
|
|
328
|
+
}, [lines]);
|
|
329
|
+
const hasReason = reasonCode.trim().length > 0;
|
|
330
|
+
const wizardSteps = React.useMemo(() => {
|
|
331
|
+
const labels = {
|
|
332
|
+
order: t("warranty_claims.portal.wizard.order"),
|
|
333
|
+
items: t("warranty_claims.portal.wizard.items"),
|
|
334
|
+
details: t("warranty_claims.portal.wizard.details"),
|
|
335
|
+
review: t("warranty_claims.portal.wizard.reviewSubmit")
|
|
336
|
+
};
|
|
337
|
+
return WIZARD_STEP_IDS.map((stepId, index) => ({
|
|
338
|
+
id: stepId,
|
|
339
|
+
label: labels[stepId],
|
|
340
|
+
status: index < currentStepIndex ? "complete" : index === currentStepIndex ? "current" : "pending"
|
|
341
|
+
}));
|
|
342
|
+
}, [currentStepIndex, t]);
|
|
343
|
+
const updateLine = React.useCallback((localId, patch) => {
|
|
344
|
+
setLines((current) => current.map((line) => line.localId === localId ? { ...line, ...patch } : line));
|
|
345
|
+
}, []);
|
|
346
|
+
const addLine = React.useCallback(() => {
|
|
347
|
+
setLines((current) => [...current, createLineDraft()]);
|
|
348
|
+
}, []);
|
|
349
|
+
const removeLine = React.useCallback((localId) => {
|
|
350
|
+
setLines((current) => current.length > 1 ? current.filter((line) => line.localId !== localId) : current);
|
|
351
|
+
clearSerialLookupTimer(localId);
|
|
352
|
+
clearSerialDuplicateWarning(localId);
|
|
353
|
+
}, [clearSerialDuplicateWarning, clearSerialLookupTimer]);
|
|
354
|
+
const pruneImportedLineDrafts = React.useCallback(() => {
|
|
355
|
+
setLines((current) => {
|
|
356
|
+
const kept = current.filter((line) => !line.orderLineId);
|
|
357
|
+
return kept.length ? kept : [createLineDraft()];
|
|
358
|
+
});
|
|
359
|
+
}, []);
|
|
360
|
+
const clearSelectedOrder = React.useCallback(() => {
|
|
361
|
+
setSelectedOrderId("");
|
|
362
|
+
setSelectedOrderNumber("");
|
|
363
|
+
setSelectedOrderPlacedAt(null);
|
|
364
|
+
setOrderLines([]);
|
|
365
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
366
|
+
setSelectedOrderLineQty({});
|
|
367
|
+
pruneImportedLineDrafts();
|
|
368
|
+
}, [pruneImportedLineDrafts]);
|
|
369
|
+
const selectListedOrder = React.useCallback((orderId) => {
|
|
370
|
+
const order = orders.find((candidate) => candidate.id === orderId);
|
|
371
|
+
if (!order) return;
|
|
372
|
+
setSelectedOrderId(order.id);
|
|
373
|
+
setSelectedOrderNumber(order.orderNumber);
|
|
374
|
+
setSelectedOrderPlacedAt(order.placedAt);
|
|
375
|
+
setManualOrderEntry(false);
|
|
376
|
+
setNoOrder(false);
|
|
377
|
+
setOrderReference("");
|
|
378
|
+
setOrderLines([]);
|
|
379
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
380
|
+
setSelectedOrderLineQty({});
|
|
381
|
+
pruneImportedLineDrafts();
|
|
382
|
+
}, [orders, pruneImportedLineDrafts]);
|
|
383
|
+
const handleManualOrderChange = React.useCallback((checked) => {
|
|
384
|
+
const nextManualOrderEntry = checked === true;
|
|
385
|
+
setManualOrderEntry(nextManualOrderEntry);
|
|
386
|
+
if (nextManualOrderEntry) {
|
|
387
|
+
setNoOrder(false);
|
|
388
|
+
clearSelectedOrder();
|
|
389
|
+
} else {
|
|
390
|
+
setOrderReference("");
|
|
391
|
+
}
|
|
392
|
+
}, [clearSelectedOrder]);
|
|
393
|
+
const handleNoOrderChange = React.useCallback((checked) => {
|
|
394
|
+
const nextNoOrder = checked === true;
|
|
395
|
+
setNoOrder(nextNoOrder);
|
|
396
|
+
if (nextNoOrder) {
|
|
397
|
+
setManualOrderEntry(false);
|
|
398
|
+
setOrderReference("");
|
|
399
|
+
clearSelectedOrder();
|
|
400
|
+
}
|
|
401
|
+
}, [clearSelectedOrder]);
|
|
402
|
+
const toggleOrderLine = React.useCallback((orderLineId, checked) => {
|
|
403
|
+
setSelectedOrderLineIds((current) => {
|
|
404
|
+
const next = new Set(current);
|
|
405
|
+
if (checked === true) next.add(orderLineId);
|
|
406
|
+
else next.delete(orderLineId);
|
|
407
|
+
return next;
|
|
408
|
+
});
|
|
409
|
+
}, []);
|
|
410
|
+
const updateSelectedOrderLineQty = React.useCallback((orderLineId, qtyClaimed) => {
|
|
411
|
+
setSelectedOrderLineQty((current) => ({ ...current, [orderLineId]: qtyClaimed }));
|
|
412
|
+
}, []);
|
|
413
|
+
const selectedOrderLinesReady = React.useMemo(() => {
|
|
414
|
+
if (selectedOrderLineIds.size === 0) return false;
|
|
415
|
+
return Array.from(selectedOrderLineIds).every((orderLineId) => isPositiveQuantity(selectedOrderLineQty[orderLineId] ?? ""));
|
|
416
|
+
}, [selectedOrderLineIds, selectedOrderLineQty]);
|
|
417
|
+
const addSelectedOrderLines = React.useCallback(() => {
|
|
418
|
+
const selectedLines = orderLines.filter((line) => selectedOrderLineIds.has(line.orderLineId));
|
|
419
|
+
const nextDrafts = selectedLines.map((line) => {
|
|
420
|
+
const qtyClaimed = selectedOrderLineQty[line.orderLineId] ?? defaultQuantity(line.quantity);
|
|
421
|
+
if (!isPositiveQuantity(qtyClaimed)) return null;
|
|
422
|
+
return {
|
|
423
|
+
...createLineDraft(),
|
|
424
|
+
orderLineId: line.orderLineId,
|
|
425
|
+
productId: line.productId ?? void 0,
|
|
426
|
+
productName: line.name ?? void 0,
|
|
427
|
+
sku: line.sku ?? "",
|
|
428
|
+
qtyClaimed,
|
|
429
|
+
purchaseDate: line.purchaseDate ?? void 0,
|
|
430
|
+
warrantyMonths: line.warrantyMonths ?? void 0
|
|
431
|
+
};
|
|
432
|
+
}).filter((line) => line !== null);
|
|
433
|
+
if (!nextDrafts.length) return;
|
|
434
|
+
setLines((current) => {
|
|
435
|
+
const base = current.length === 1 && isBlankLineDraft(current[0]) ? [] : current;
|
|
436
|
+
return [...base, ...nextDrafts];
|
|
437
|
+
});
|
|
438
|
+
setSelectedOrderLineIds(/* @__PURE__ */ new Set());
|
|
439
|
+
}, [orderLines, selectedOrderLineIds, selectedOrderLineQty]);
|
|
440
|
+
const selectValue = React.useCallback((value) => value || EMPTY_SELECT_VALUE, []);
|
|
441
|
+
const handleSelectChange = React.useCallback((setValue) => {
|
|
442
|
+
return (value) => setValue(value === EMPTY_SELECT_VALUE ? "" : value);
|
|
443
|
+
}, []);
|
|
444
|
+
const validateStep = React.useCallback((step) => {
|
|
445
|
+
if (step === "items") {
|
|
446
|
+
if (lines.length < 1) {
|
|
447
|
+
setError(t("warranty_claims.portal.validation.lineRequired"));
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
for (const line of lines) {
|
|
451
|
+
if (!line.faultDescription.trim()) {
|
|
452
|
+
setError(t("warranty_claims.portal.validation.faultDescriptionRequired"));
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
if (!isPositiveQuantity(line.qtyClaimed)) {
|
|
456
|
+
setError(t("warranty_claims.portal.validation.qtyPositive"));
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (step === "details" && !reasonCode.trim()) {
|
|
462
|
+
setError(t("warranty_claims.portal.validation.reasonRequired"));
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
setError(null);
|
|
466
|
+
return true;
|
|
467
|
+
}, [lines, reasonCode, t]);
|
|
468
|
+
const buildPayload = React.useCallback(() => {
|
|
469
|
+
if (!validateStep("items") || !validateStep("details")) return null;
|
|
470
|
+
const normalizedLines = lines.map((line) => ({
|
|
471
|
+
orderLineId: optionalText(line.orderLineId ?? ""),
|
|
472
|
+
productId: optionalText(line.productId ?? ""),
|
|
473
|
+
productName: optionalText(line.productName ?? ""),
|
|
474
|
+
sku: optionalText(line.sku),
|
|
475
|
+
serialNumber: optionalText(line.serialNumber),
|
|
476
|
+
faultCode: optionalText(line.faultCode),
|
|
477
|
+
faultDescription: line.faultDescription.trim(),
|
|
478
|
+
qtyClaimed: Number(line.qtyClaimed),
|
|
479
|
+
purchaseDate: line.purchaseDate,
|
|
480
|
+
warrantyMonths: line.warrantyMonths
|
|
481
|
+
}));
|
|
482
|
+
return {
|
|
483
|
+
// Only a real selected order becomes `orderId` (a UUID). A typed "my order isn't listed"
|
|
484
|
+
// reference travels as free text so the API no longer rejects it as a non-UUID (WQA-002).
|
|
485
|
+
orderId: noOrder ? void 0 : selectedOrderId || void 0,
|
|
486
|
+
orderReference: noOrder || selectedOrderId ? void 0 : optionalText(orderReference),
|
|
487
|
+
reasonCode: reasonCode.trim(),
|
|
488
|
+
notes: optionalText(notes),
|
|
489
|
+
lines: normalizedLines
|
|
490
|
+
};
|
|
491
|
+
}, [lines, noOrder, notes, orderReference, reasonCode, selectedOrderId, validateStep]);
|
|
492
|
+
const goToStep = React.useCallback((stepId) => {
|
|
493
|
+
if (!WIZARD_STEP_IDS.includes(stepId)) return;
|
|
494
|
+
const nextIndex = WIZARD_STEP_IDS.indexOf(stepId);
|
|
495
|
+
if (nextIndex <= currentStepIndex) {
|
|
496
|
+
setCurrentStep(stepId);
|
|
497
|
+
setError(null);
|
|
498
|
+
}
|
|
499
|
+
}, [currentStepIndex]);
|
|
500
|
+
const goBack = React.useCallback(() => {
|
|
501
|
+
if (currentStepIndex <= 0) return;
|
|
502
|
+
setCurrentStep(WIZARD_STEP_IDS[currentStepIndex - 1]);
|
|
503
|
+
setError(null);
|
|
504
|
+
}, [currentStepIndex]);
|
|
505
|
+
const goNext = React.useCallback((event) => {
|
|
506
|
+
event.preventDefault();
|
|
507
|
+
if (!validateStep(currentStep)) return;
|
|
508
|
+
if (currentStepIndex >= WIZARD_STEP_IDS.length - 1) return;
|
|
509
|
+
setCurrentStep(WIZARD_STEP_IDS[currentStepIndex + 1]);
|
|
510
|
+
}, [currentStep, currentStepIndex, validateStep]);
|
|
511
|
+
const addStagedAttachments = React.useCallback(async (event) => {
|
|
512
|
+
const files = Array.from(event.target.files ?? []);
|
|
513
|
+
setStagedFileInputKey((current) => current + 1);
|
|
514
|
+
if (!files.length) return;
|
|
515
|
+
const accepted = [];
|
|
516
|
+
for (const file of files) {
|
|
517
|
+
const validationError = await validateAttachmentFile(file, t);
|
|
518
|
+
if (validationError) {
|
|
519
|
+
flash(t("warranty_claims.portal.new.attachmentRejected", "{name}: {reason}", { name: file.name, reason: validationError }), "error");
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
accepted.push(createStagedAttachment(file));
|
|
523
|
+
}
|
|
524
|
+
if (accepted.length) {
|
|
525
|
+
setStagedFiles((current) => [...current, ...accepted]);
|
|
526
|
+
}
|
|
527
|
+
}, [t]);
|
|
528
|
+
const removeStagedAttachment = React.useCallback((localId) => {
|
|
529
|
+
setStagedFiles((current) => current.filter((staged) => staged.localId !== localId));
|
|
530
|
+
}, []);
|
|
531
|
+
const uploadStagedAttachments = React.useCallback(async (claimId) => {
|
|
532
|
+
const failedFiles = [];
|
|
533
|
+
for (const staged of stagedFiles) {
|
|
534
|
+
try {
|
|
535
|
+
const form = new FormData();
|
|
536
|
+
form.set("claimId", claimId);
|
|
537
|
+
form.set("file", staged.file);
|
|
538
|
+
const result = await guardedMutation.runMutation({
|
|
539
|
+
operation: () => apiCall("/api/warranty_claims/portal/attachments", {
|
|
540
|
+
method: "POST",
|
|
541
|
+
credentials: "include",
|
|
542
|
+
body: form
|
|
543
|
+
}),
|
|
544
|
+
context: {
|
|
545
|
+
moduleId: "warranty_claims",
|
|
546
|
+
entityId: "attachments.attachment",
|
|
547
|
+
operation: "portal_attachment_upload",
|
|
548
|
+
claimId,
|
|
549
|
+
formId: CREATE_MUTATION_CONTEXT_ID,
|
|
550
|
+
resourceKind: "attachments.attachment",
|
|
551
|
+
resourceId: claimId,
|
|
552
|
+
retryLastMutation: guardedMutation.retryLastMutation
|
|
553
|
+
},
|
|
554
|
+
mutationPayload: { claimId, fileName: staged.file.name, fileSize: staged.file.size }
|
|
555
|
+
});
|
|
556
|
+
if (!result.ok || !result.result?.ok) {
|
|
557
|
+
failedFiles.push(staged.file.name);
|
|
558
|
+
}
|
|
559
|
+
} catch {
|
|
560
|
+
failedFiles.push(staged.file.name);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return failedFiles;
|
|
564
|
+
}, [guardedMutation, stagedFiles]);
|
|
565
|
+
const submitClaim = React.useCallback(async () => {
|
|
566
|
+
if (submitting) return;
|
|
567
|
+
setError(null);
|
|
568
|
+
const payload = buildPayload();
|
|
569
|
+
if (!payload) return;
|
|
570
|
+
setSubmitting(true);
|
|
571
|
+
try {
|
|
572
|
+
const mutationPayload = { ...payload };
|
|
573
|
+
const result = await guardedMutation.runMutation({
|
|
574
|
+
operation: () => apiCall("/api/warranty_claims/portal/claims", {
|
|
575
|
+
method: "POST",
|
|
576
|
+
headers: { "Content-Type": "application/json" },
|
|
577
|
+
credentials: "include",
|
|
578
|
+
body: JSON.stringify(payload)
|
|
579
|
+
}),
|
|
580
|
+
context: {
|
|
581
|
+
moduleId: "warranty_claims",
|
|
582
|
+
entityId: "warranty_claims.claim",
|
|
583
|
+
operation: "portal_create",
|
|
584
|
+
formId: CREATE_MUTATION_CONTEXT_ID,
|
|
585
|
+
resourceKind: "warranty_claims.claim",
|
|
586
|
+
retryLastMutation: guardedMutation.retryLastMutation
|
|
587
|
+
},
|
|
588
|
+
mutationPayload
|
|
589
|
+
});
|
|
590
|
+
if (!result.ok || !result.result?.claimId) {
|
|
591
|
+
setError(result.status === 404 ? t("warranty_claims.errors.orderNotOwned") : t("warranty_claims.portal.new.error"));
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const failedFiles = await uploadStagedAttachments(result.result.claimId);
|
|
595
|
+
if (failedFiles.length) {
|
|
596
|
+
flash(
|
|
597
|
+
t("warranty_claims.portal.new.attachmentsPartialFailure", "Your claim was created, but these files could not be uploaded: {files}. You can add them again from the claim page.", { files: failedFiles.join(", ") }),
|
|
598
|
+
"warning"
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
flash(t("warranty_claims.portal.new.success"), "success");
|
|
602
|
+
router.push(`/${params.orgSlug}/portal/claims/${result.result.claimId}`);
|
|
603
|
+
} catch {
|
|
604
|
+
setError(t("warranty_claims.portal.new.error"));
|
|
605
|
+
} finally {
|
|
606
|
+
setSubmitting(false);
|
|
607
|
+
}
|
|
608
|
+
}, [buildPayload, guardedMutation, params.orgSlug, router, submitting, t, uploadStagedAttachments]);
|
|
609
|
+
const handleSubmit = React.useCallback((event) => {
|
|
610
|
+
event.preventDefault();
|
|
611
|
+
if (currentStep === "review") {
|
|
612
|
+
void submitClaim();
|
|
613
|
+
}
|
|
614
|
+
}, [currentStep, submitClaim]);
|
|
615
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
616
|
+
if (event.key !== "Enter") return;
|
|
617
|
+
const target = event.target;
|
|
618
|
+
if (target instanceof HTMLTextAreaElement) return;
|
|
619
|
+
event.preventDefault();
|
|
620
|
+
if ((event.metaKey || event.ctrlKey) && currentStep === "review") {
|
|
621
|
+
void submitClaim();
|
|
622
|
+
}
|
|
623
|
+
}, [currentStep, submitClaim]);
|
|
624
|
+
const reasonOptions = portalOptions.reasons;
|
|
625
|
+
const faultCodeOptions = portalOptions.faultCodes;
|
|
626
|
+
const reasonLabel = React.useCallback((value) => localizeDictionaryLabel(t, "reason", value, optionLabel(reasonOptions, value)), [reasonOptions, t]);
|
|
627
|
+
const faultCodeLabel = React.useCallback((value) => localizeDictionaryLabel(t, "fault", value, optionLabel(faultCodeOptions, value)), [faultCodeOptions, t]);
|
|
628
|
+
const selectedReasonLabel = reasonCode ? reasonLabel(reasonCode) : t("warranty_claims.portal.value.notAvailable");
|
|
629
|
+
const renderReasonField = () => /* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.form.reasonCode"), required: true, children: reasonOptions.length > 0 ? /* @__PURE__ */ jsxs(Select, { value: selectValue(reasonCode), onValueChange: handleSelectChange(setReasonCode), disabled: submitting, children: [
|
|
630
|
+
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("warranty_claims.portal.new.reasonChoose") }) }),
|
|
631
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
632
|
+
/* @__PURE__ */ jsx(SelectItem, { value: EMPTY_SELECT_VALUE, children: t("warranty_claims.portal.new.reasonChoose") }),
|
|
633
|
+
reasonCode && !reasonOptions.some((option) => option.value === reasonCode) ? /* @__PURE__ */ jsx(SelectItem, { value: reasonCode, children: reasonLabel(reasonCode) }) : null,
|
|
634
|
+
reasonOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: reasonLabel(option.value) }, option.value))
|
|
635
|
+
] })
|
|
636
|
+
] }) : /* @__PURE__ */ jsx(
|
|
637
|
+
Input,
|
|
638
|
+
{
|
|
639
|
+
value: reasonCode,
|
|
640
|
+
onChange: (event) => setReasonCode(event.target.value),
|
|
641
|
+
disabled: submitting,
|
|
642
|
+
required: true
|
|
643
|
+
}
|
|
644
|
+
) });
|
|
645
|
+
const renderFaultCodeField = (line) => /* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.form.faultCode"), children: faultCodeOptions.length > 0 ? /* @__PURE__ */ jsxs(
|
|
646
|
+
Select,
|
|
647
|
+
{
|
|
648
|
+
value: selectValue(line.faultCode),
|
|
649
|
+
onValueChange: handleSelectChange((value) => updateLine(line.localId, { faultCode: value })),
|
|
650
|
+
disabled: submitting,
|
|
651
|
+
children: [
|
|
652
|
+
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("warranty_claims.portal.new.faultCodeChoose") }) }),
|
|
653
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
654
|
+
/* @__PURE__ */ jsx(SelectItem, { value: EMPTY_SELECT_VALUE, children: t("warranty_claims.portal.new.faultCodeChoose") }),
|
|
655
|
+
line.faultCode && !faultCodeOptions.some((option) => option.value === line.faultCode) ? /* @__PURE__ */ jsx(SelectItem, { value: line.faultCode, children: faultCodeLabel(line.faultCode) }) : null,
|
|
656
|
+
faultCodeOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: faultCodeLabel(option.value) }, option.value))
|
|
657
|
+
] })
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
) : /* @__PURE__ */ jsx(
|
|
661
|
+
Input,
|
|
662
|
+
{
|
|
663
|
+
value: line.faultCode,
|
|
664
|
+
onChange: (event) => updateLine(line.localId, { faultCode: event.target.value }),
|
|
665
|
+
disabled: submitting
|
|
666
|
+
}
|
|
667
|
+
) });
|
|
668
|
+
if (loading) {
|
|
669
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(Spinner, {}) });
|
|
670
|
+
}
|
|
671
|
+
if (!user) return null;
|
|
672
|
+
return /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-8", onSubmit: handleSubmit, onKeyDown: handleKeyDown, children: [
|
|
673
|
+
/* @__PURE__ */ jsx(
|
|
674
|
+
PortalPageHeader,
|
|
675
|
+
{
|
|
676
|
+
label: t("warranty_claims.portal.nav"),
|
|
677
|
+
title: t("warranty_claims.portal.new.title"),
|
|
678
|
+
description: t("warranty_claims.portal.new.description"),
|
|
679
|
+
action: /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", children: /* @__PURE__ */ jsxs(Link, { href: `/${params.orgSlug}/portal/claims`, children: [
|
|
680
|
+
/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4", "aria-hidden": "true" }),
|
|
681
|
+
t("warranty_claims.portal.new.back")
|
|
682
|
+
] }) })
|
|
683
|
+
}
|
|
684
|
+
),
|
|
685
|
+
error ? /* @__PURE__ */ jsx(ErrorMessage, { label: error }) : null,
|
|
686
|
+
/* @__PURE__ */ jsx(StepIndicator, { steps: wizardSteps, onStepClick: goToStep }),
|
|
687
|
+
currentStep === "order" ? /* @__PURE__ */ jsxs(PortalCard, { children: [
|
|
688
|
+
/* @__PURE__ */ jsx(
|
|
689
|
+
PortalCardHeader,
|
|
690
|
+
{
|
|
691
|
+
label: t("warranty_claims.portal.wizard.order"),
|
|
692
|
+
title: t("warranty_claims.portal.new.orderTitle"),
|
|
693
|
+
description: t("warranty_claims.portal.new.orderDescription")
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
ordersUnavailable ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
697
|
+
/* @__PURE__ */ jsx(
|
|
698
|
+
FormField,
|
|
699
|
+
{
|
|
700
|
+
label: t("warranty_claims.portal.new.orderReference"),
|
|
701
|
+
description: t("warranty_claims.portal.new.orderReferenceHelp"),
|
|
702
|
+
children: /* @__PURE__ */ jsx(
|
|
703
|
+
Input,
|
|
704
|
+
{
|
|
705
|
+
value: orderReference,
|
|
706
|
+
onChange: (event) => setOrderReference(event.target.value),
|
|
707
|
+
disabled: submitting || noOrder
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
),
|
|
712
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx(
|
|
713
|
+
CheckboxField,
|
|
714
|
+
{
|
|
715
|
+
checked: noOrder,
|
|
716
|
+
onCheckedChange: handleNoOrderChange,
|
|
717
|
+
disabled: submitting,
|
|
718
|
+
label: t("warranty_claims.portal.new.noOrder"),
|
|
719
|
+
description: t("warranty_claims.portal.new.noOrderDescription")
|
|
720
|
+
}
|
|
721
|
+
) })
|
|
722
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
723
|
+
/* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.portal.new.orderSearch"), children: /* @__PURE__ */ jsx(
|
|
724
|
+
Input,
|
|
725
|
+
{
|
|
726
|
+
type: "search",
|
|
727
|
+
value: orderSearchInput,
|
|
728
|
+
onChange: (event) => setOrderSearchInput(event.target.value),
|
|
729
|
+
disabled: submitting,
|
|
730
|
+
placeholder: t("warranty_claims.portal.new.orderSearchPlaceholder")
|
|
731
|
+
}
|
|
732
|
+
) }),
|
|
733
|
+
ordersLoading && orders.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center rounded-lg border border-border bg-muted/30 py-8", children: /* @__PURE__ */ jsx(Spinner, {}) }) : null,
|
|
734
|
+
orders.length > 0 ? /* @__PURE__ */ jsx(RadioGroup, { value: selectedOrderId, onValueChange: selectListedOrder, children: orders.map((order) => {
|
|
735
|
+
const selected = selectedOrderId === order.id;
|
|
736
|
+
return /* @__PURE__ */ jsxs(
|
|
737
|
+
"div",
|
|
738
|
+
{
|
|
739
|
+
className: `flex cursor-pointer items-start gap-3 rounded-lg border p-4 transition-colors ${selected ? "border-accent-indigo bg-accent/50" : "border-border bg-background hover:bg-muted/30"}`,
|
|
740
|
+
onClick: () => {
|
|
741
|
+
if (!submitting) selectListedOrder(order.id);
|
|
742
|
+
},
|
|
743
|
+
children: [
|
|
744
|
+
/* @__PURE__ */ jsx(
|
|
745
|
+
Radio,
|
|
746
|
+
{
|
|
747
|
+
value: order.id,
|
|
748
|
+
disabled: submitting,
|
|
749
|
+
"aria-label": order.orderNumber,
|
|
750
|
+
className: "mt-0.5"
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
754
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-foreground", children: order.orderNumber }),
|
|
755
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground", children: [
|
|
756
|
+
/* @__PURE__ */ jsx("span", { children: formatDate(order.placedAt, t("warranty_claims.portal.value.notAvailable"), locale) }),
|
|
757
|
+
/* @__PURE__ */ jsx("span", { children: formatOrderTotal(order.grandTotalGrossAmount, order.currencyCode, t("warranty_claims.portal.value.notAvailable"), locale) })
|
|
758
|
+
] })
|
|
759
|
+
] })
|
|
760
|
+
]
|
|
761
|
+
},
|
|
762
|
+
order.id
|
|
763
|
+
);
|
|
764
|
+
}) }) : null,
|
|
765
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
766
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx(
|
|
767
|
+
CheckboxField,
|
|
768
|
+
{
|
|
769
|
+
checked: manualOrderEntry,
|
|
770
|
+
onCheckedChange: handleManualOrderChange,
|
|
771
|
+
disabled: submitting,
|
|
772
|
+
label: t("warranty_claims.portal.new.orderNotListed"),
|
|
773
|
+
description: t("warranty_claims.portal.new.orderNotListedDescription")
|
|
774
|
+
}
|
|
775
|
+
) }),
|
|
776
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx(
|
|
777
|
+
CheckboxField,
|
|
778
|
+
{
|
|
779
|
+
checked: noOrder,
|
|
780
|
+
onCheckedChange: handleNoOrderChange,
|
|
781
|
+
disabled: submitting,
|
|
782
|
+
label: t("warranty_claims.portal.new.noOrder"),
|
|
783
|
+
description: t("warranty_claims.portal.new.noOrderDescription")
|
|
784
|
+
}
|
|
785
|
+
) })
|
|
786
|
+
] }),
|
|
787
|
+
manualOrderEntry ? /* @__PURE__ */ jsx(
|
|
788
|
+
FormField,
|
|
789
|
+
{
|
|
790
|
+
label: t("warranty_claims.portal.new.orderReference"),
|
|
791
|
+
description: t("warranty_claims.portal.new.orderReferenceHelp"),
|
|
792
|
+
children: /* @__PURE__ */ jsx(
|
|
793
|
+
Input,
|
|
794
|
+
{
|
|
795
|
+
value: orderReference,
|
|
796
|
+
onChange: (event) => setOrderReference(event.target.value),
|
|
797
|
+
disabled: submitting || noOrder
|
|
798
|
+
}
|
|
799
|
+
)
|
|
800
|
+
}
|
|
801
|
+
) : null
|
|
802
|
+
] })
|
|
803
|
+
] }) : null,
|
|
804
|
+
currentStep === "items" ? /* @__PURE__ */ jsxs(PortalCard, { children: [
|
|
805
|
+
/* @__PURE__ */ jsx(
|
|
806
|
+
PortalCardHeader,
|
|
807
|
+
{
|
|
808
|
+
label: t("warranty_claims.portal.wizard.items"),
|
|
809
|
+
title: t("warranty_claims.portal.new.linesTitle"),
|
|
810
|
+
description: t("warranty_claims.portal.new.linesDescription"),
|
|
811
|
+
action: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", onClick: addLine, disabled: submitting, children: [
|
|
812
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-4", "aria-hidden": "true" }),
|
|
813
|
+
t("warranty_claims.portal.new.addLine")
|
|
814
|
+
] })
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
818
|
+
selectedOrderId && !orderLinesUnavailable ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: [
|
|
819
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-start justify-between gap-4", children: [
|
|
820
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
821
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t("warranty_claims.portal.new.orderLinesTitle") }),
|
|
822
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
823
|
+
selectedOrderNumber,
|
|
824
|
+
selectedOrderPlacedAt ? ` - ${formatDate(selectedOrderPlacedAt, t("warranty_claims.portal.value.notAvailable"), locale)}` : ""
|
|
825
|
+
] })
|
|
826
|
+
] }),
|
|
827
|
+
orderLinesLoading ? /* @__PURE__ */ jsx(Spinner, {}) : null
|
|
828
|
+
] }),
|
|
829
|
+
orderLines.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
830
|
+
orderLines.map((orderLine) => {
|
|
831
|
+
const checked = selectedOrderLineIds.has(orderLine.orderLineId);
|
|
832
|
+
const label = orderLine.name ?? orderLine.sku ?? t("warranty_claims.portal.value.unnamedLine");
|
|
833
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-background p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
834
|
+
/* @__PURE__ */ jsx(
|
|
835
|
+
Checkbox,
|
|
836
|
+
{
|
|
837
|
+
checked,
|
|
838
|
+
onCheckedChange: (value) => toggleOrderLine(orderLine.orderLineId, value),
|
|
839
|
+
disabled: submitting,
|
|
840
|
+
"aria-label": label,
|
|
841
|
+
className: "mt-0.5"
|
|
842
|
+
}
|
|
843
|
+
),
|
|
844
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
845
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
846
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
847
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-foreground", children: label }),
|
|
848
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
849
|
+
orderLine.sku ?? t("warranty_claims.portal.value.notAvailable"),
|
|
850
|
+
" - ",
|
|
851
|
+
formatQuantity(orderLine.quantity, t("warranty_claims.portal.value.notAvailable"), locale)
|
|
852
|
+
] })
|
|
853
|
+
] }),
|
|
854
|
+
orderLine.estimatedWarrantyStatus !== "unknown" ? /* @__PURE__ */ jsx(StatusBadge, { variant: warrantyStatusVariant(orderLine.estimatedWarrantyStatus), dot: true, children: t(warrantyStatusLabelKey(orderLine.estimatedWarrantyStatus)) }) : null
|
|
855
|
+
] }),
|
|
856
|
+
/* @__PURE__ */ jsx(FormField, { className: "mt-3 max-w-40", label: t("warranty_claims.portal.new.qtyToClaim"), children: /* @__PURE__ */ jsx(
|
|
857
|
+
Input,
|
|
858
|
+
{
|
|
859
|
+
type: "number",
|
|
860
|
+
min: "0.01",
|
|
861
|
+
step: "0.01",
|
|
862
|
+
value: selectedOrderLineQty[orderLine.orderLineId] ?? defaultQuantity(orderLine.quantity),
|
|
863
|
+
onChange: (event) => updateSelectedOrderLineQty(orderLine.orderLineId, event.target.value),
|
|
864
|
+
disabled: submitting || !checked
|
|
865
|
+
}
|
|
866
|
+
) })
|
|
867
|
+
] })
|
|
868
|
+
] }) }, orderLine.orderLineId);
|
|
869
|
+
}),
|
|
870
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
871
|
+
Button,
|
|
872
|
+
{
|
|
873
|
+
type: "button",
|
|
874
|
+
variant: "outline",
|
|
875
|
+
onClick: addSelectedOrderLines,
|
|
876
|
+
disabled: submitting || !selectedOrderLinesReady,
|
|
877
|
+
children: [
|
|
878
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-4", "aria-hidden": "true" }),
|
|
879
|
+
t("warranty_claims.portal.new.addSelectedItems")
|
|
880
|
+
]
|
|
881
|
+
}
|
|
882
|
+
) })
|
|
883
|
+
] }) : null
|
|
884
|
+
] }) : null,
|
|
885
|
+
lines.map((line, index) => /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border bg-background p-4", children: [
|
|
886
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
|
|
887
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
888
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t("warranty_claims.portal.new.lineLabel", { number: index + 1 }) }),
|
|
889
|
+
line.productName ? (
|
|
890
|
+
// Order-backed lines carry a product name but often no visible SKU (SKU comes
|
|
891
|
+
// from the catalog snapshot); show it so the line is never visually blank (WQA-004).
|
|
892
|
+
/* @__PURE__ */ jsx("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: line.productName })
|
|
893
|
+
) : null
|
|
894
|
+
] }),
|
|
895
|
+
/* @__PURE__ */ jsx(
|
|
896
|
+
IconButton,
|
|
897
|
+
{
|
|
898
|
+
type: "button",
|
|
899
|
+
variant: "ghost",
|
|
900
|
+
"aria-label": t("warranty_claims.portal.new.removeLine"),
|
|
901
|
+
onClick: () => removeLine(line.localId),
|
|
902
|
+
disabled: submitting || lines.length === 1,
|
|
903
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-4", "aria-hidden": "true" })
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
] }),
|
|
907
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
908
|
+
/* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.portal.new.productOrSku"), children: /* @__PURE__ */ jsx(
|
|
909
|
+
Input,
|
|
910
|
+
{
|
|
911
|
+
value: line.sku,
|
|
912
|
+
onChange: (event) => updateLine(line.localId, { sku: event.target.value }),
|
|
913
|
+
disabled: submitting
|
|
914
|
+
}
|
|
915
|
+
) }),
|
|
916
|
+
/* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.form.serialNumber"), children: /* @__PURE__ */ jsx(
|
|
917
|
+
Input,
|
|
918
|
+
{
|
|
919
|
+
value: line.serialNumber,
|
|
920
|
+
onChange: (event) => {
|
|
921
|
+
const value = event.target.value;
|
|
922
|
+
updateLine(line.localId, { serialNumber: value });
|
|
923
|
+
checkSerialDuplicate(line.localId, value);
|
|
924
|
+
},
|
|
925
|
+
disabled: submitting
|
|
926
|
+
}
|
|
927
|
+
) }),
|
|
928
|
+
renderFaultCodeField(line),
|
|
929
|
+
/* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.form.qtyClaimed"), required: true, children: /* @__PURE__ */ jsx(
|
|
930
|
+
Input,
|
|
931
|
+
{
|
|
932
|
+
type: "number",
|
|
933
|
+
min: "0.01",
|
|
934
|
+
step: "0.01",
|
|
935
|
+
value: line.qtyClaimed,
|
|
936
|
+
onChange: (event) => updateLine(line.localId, { qtyClaimed: event.target.value }),
|
|
937
|
+
disabled: submitting,
|
|
938
|
+
required: true
|
|
939
|
+
}
|
|
940
|
+
) }),
|
|
941
|
+
/* @__PURE__ */ jsx(FormField, { className: "md:col-span-2", label: t("warranty_claims.form.faultDescription"), required: true, children: /* @__PURE__ */ jsx(
|
|
942
|
+
Textarea,
|
|
943
|
+
{
|
|
944
|
+
value: line.faultDescription,
|
|
945
|
+
onChange: (event) => updateLine(line.localId, { faultDescription: event.target.value }),
|
|
946
|
+
disabled: submitting,
|
|
947
|
+
required: true,
|
|
948
|
+
maxLength: 4e3,
|
|
949
|
+
showCount: true
|
|
950
|
+
}
|
|
951
|
+
) })
|
|
952
|
+
] }),
|
|
953
|
+
serialDuplicateWarnings[line.localId]?.length ? /* @__PURE__ */ jsx(Alert, { status: "warning", style: "lighter", className: "mt-4", children: /* @__PURE__ */ jsx(AlertDescription, { children: t("warranty_claims.portal.new.duplicateWarning", {
|
|
954
|
+
claimNumbers: serialDuplicateWarnings[line.localId].join(", ")
|
|
955
|
+
}) }) }) : null
|
|
956
|
+
] }, line.localId))
|
|
957
|
+
] })
|
|
958
|
+
] }) : null,
|
|
959
|
+
currentStep === "details" ? /* @__PURE__ */ jsxs(PortalCard, { children: [
|
|
960
|
+
/* @__PURE__ */ jsx(
|
|
961
|
+
PortalCardHeader,
|
|
962
|
+
{
|
|
963
|
+
label: t("warranty_claims.portal.wizard.details"),
|
|
964
|
+
title: t("warranty_claims.portal.new.detailsTitle"),
|
|
965
|
+
description: t("warranty_claims.portal.new.detailsDescription")
|
|
966
|
+
}
|
|
967
|
+
),
|
|
968
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 lg:grid-cols-3", children: [
|
|
969
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 lg:col-span-2", children: [
|
|
970
|
+
troubleshootingGuide ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx(
|
|
971
|
+
TroubleshootingWalker,
|
|
972
|
+
{
|
|
973
|
+
guide: troubleshootingGuide,
|
|
974
|
+
onResolve: (result) => {
|
|
975
|
+
if (result.reasonCode) setReasonCode(result.reasonCode);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
) }) : null,
|
|
979
|
+
renderReasonField(),
|
|
980
|
+
/* @__PURE__ */ jsx(FormField, { label: t("warranty_claims.form.notes"), children: /* @__PURE__ */ jsx(
|
|
981
|
+
Textarea,
|
|
982
|
+
{
|
|
983
|
+
value: notes,
|
|
984
|
+
onChange: (event) => setNotes(event.target.value),
|
|
985
|
+
disabled: submitting,
|
|
986
|
+
maxLength: 8e3,
|
|
987
|
+
showCount: true
|
|
988
|
+
}
|
|
989
|
+
) })
|
|
990
|
+
] }),
|
|
991
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 rounded-lg border border-border bg-muted/30 p-4", children: [
|
|
992
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
993
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t("warranty_claims.portal.new.attachmentsTitle", "Photos and documents") }),
|
|
994
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("warranty_claims.portal.new.attachmentsHelp", "Optional. Photos of the fault help us review your claim faster. Files are uploaded when you submit the claim.") })
|
|
995
|
+
] }),
|
|
996
|
+
/* @__PURE__ */ jsx(
|
|
997
|
+
Input,
|
|
998
|
+
{
|
|
999
|
+
type: "file",
|
|
1000
|
+
multiple: true,
|
|
1001
|
+
accept: ATTACHMENT_ACCEPT_TYPES,
|
|
1002
|
+
onChange: (event) => {
|
|
1003
|
+
void addStagedAttachments(event);
|
|
1004
|
+
},
|
|
1005
|
+
disabled: submitting,
|
|
1006
|
+
"aria-label": t("warranty_claims.portal.new.attachmentsTitle", "Photos and documents")
|
|
1007
|
+
},
|
|
1008
|
+
stagedFileInputKey
|
|
1009
|
+
),
|
|
1010
|
+
stagedFiles.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", children: stagedFiles.map((staged) => /* @__PURE__ */ jsxs(
|
|
1011
|
+
"li",
|
|
1012
|
+
{
|
|
1013
|
+
className: "flex items-center justify-between gap-3 rounded-lg border border-border bg-background px-3 py-2",
|
|
1014
|
+
children: [
|
|
1015
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1016
|
+
/* @__PURE__ */ jsx(FileText, { className: "size-4 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
1017
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm", children: staged.file.name })
|
|
1018
|
+
] }),
|
|
1019
|
+
/* @__PURE__ */ jsx(
|
|
1020
|
+
IconButton,
|
|
1021
|
+
{
|
|
1022
|
+
type: "button",
|
|
1023
|
+
variant: "ghost",
|
|
1024
|
+
"aria-label": t("warranty_claims.portal.new.removeAttachment", "Remove file"),
|
|
1025
|
+
onClick: () => removeStagedAttachment(staged.localId),
|
|
1026
|
+
disabled: submitting,
|
|
1027
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-4", "aria-hidden": "true" })
|
|
1028
|
+
}
|
|
1029
|
+
)
|
|
1030
|
+
]
|
|
1031
|
+
},
|
|
1032
|
+
staged.localId
|
|
1033
|
+
)) }) : null
|
|
1034
|
+
] })
|
|
1035
|
+
] })
|
|
1036
|
+
] }) : null,
|
|
1037
|
+
currentStep === "review" ? /* @__PURE__ */ jsxs(PortalCard, { children: [
|
|
1038
|
+
/* @__PURE__ */ jsx(
|
|
1039
|
+
PortalCardHeader,
|
|
1040
|
+
{
|
|
1041
|
+
label: t("warranty_claims.portal.wizard.reviewSubmit"),
|
|
1042
|
+
title: t("warranty_claims.portal.new.reviewTitle"),
|
|
1043
|
+
description: t("warranty_claims.portal.new.reviewDescription")
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 lg:grid-cols-3", children: [
|
|
1047
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 lg:col-span-2", children: lines.map((line, index) => /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border bg-background p-4", children: [
|
|
1048
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t("warranty_claims.portal.new.lineLabel", { number: index + 1 }) }),
|
|
1049
|
+
/* @__PURE__ */ jsxs("dl", { className: "mt-4 grid gap-3 text-sm md:grid-cols-2", children: [
|
|
1050
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1051
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("warranty_claims.portal.new.productOrSku") }),
|
|
1052
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1 font-medium", children: optionalText(line.productName ?? "") ?? optionalText(line.sku) ?? t("warranty_claims.portal.value.notAvailable") })
|
|
1053
|
+
] }),
|
|
1054
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1055
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("warranty_claims.form.serialNumber") }),
|
|
1056
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1 font-medium", children: line.serialNumber.trim() || t("warranty_claims.portal.value.notAvailable") })
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1059
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("warranty_claims.form.faultCode") }),
|
|
1060
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1 font-medium", children: line.faultCode ? faultCodeLabel(line.faultCode) : t("warranty_claims.portal.value.notAvailable") })
|
|
1061
|
+
] }),
|
|
1062
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1063
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("warranty_claims.form.qtyClaimed") }),
|
|
1064
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1 font-medium", children: line.qtyClaimed })
|
|
1065
|
+
] }),
|
|
1066
|
+
/* @__PURE__ */ jsxs("div", { className: "md:col-span-2", children: [
|
|
1067
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("warranty_claims.form.faultDescription") }),
|
|
1068
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1 whitespace-pre-wrap text-sm font-medium", children: line.faultDescription.trim() })
|
|
1069
|
+
] })
|
|
1070
|
+
] })
|
|
1071
|
+
] }, line.localId)) }),
|
|
1072
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: [
|
|
1073
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-3 text-sm font-semibold", children: t("warranty_claims.portal.new.summaryTitle") }),
|
|
1074
|
+
/* @__PURE__ */ jsxs("dl", { className: "space-y-3 text-sm", children: [
|
|
1075
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1076
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("warranty_claims.portal.new.reviewOrder") }),
|
|
1077
|
+
/* @__PURE__ */ jsx("dd", { className: "text-right font-medium", children: noOrder ? t("warranty_claims.portal.new.noOrder") : selectedOrderNumber || orderReference.trim() || t("warranty_claims.portal.value.notAvailable") })
|
|
1078
|
+
] }),
|
|
1079
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1080
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("warranty_claims.form.reasonCode") }),
|
|
1081
|
+
/* @__PURE__ */ jsx("dd", { className: "text-right font-medium", children: selectedReasonLabel })
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1084
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("warranty_claims.portal.new.reviewLines") }),
|
|
1085
|
+
/* @__PURE__ */ jsx("dd", { className: "font-medium", children: lines.length })
|
|
1086
|
+
] }),
|
|
1087
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1088
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("warranty_claims.portal.new.reviewNotes") }),
|
|
1089
|
+
/* @__PURE__ */ jsx("dd", { className: "font-medium", children: notes.trim() ? t("warranty_claims.portal.value.yes") : t("warranty_claims.portal.value.no") })
|
|
1090
|
+
] }),
|
|
1091
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("warranty_claims.portal.new.reviewAttachments", "Attachments") }),
|
|
1093
|
+
/* @__PURE__ */ jsx("dd", { className: "font-medium", children: stagedFiles.length })
|
|
1094
|
+
] })
|
|
1095
|
+
] })
|
|
1096
|
+
] })
|
|
1097
|
+
] })
|
|
1098
|
+
] }) : null,
|
|
1099
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col-reverse gap-3 sm:flex-row sm:justify-between", children: [
|
|
1100
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col-reverse gap-3 sm:flex-row", children: [
|
|
1101
|
+
/* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", children: /* @__PURE__ */ jsx(Link, { href: `/${params.orgSlug}/portal/claims`, children: t("warranty_claims.portal.new.cancel") }) }),
|
|
1102
|
+
currentStepIndex > 0 ? /* @__PURE__ */ jsxs(
|
|
1103
|
+
Button,
|
|
1104
|
+
{
|
|
1105
|
+
type: "button",
|
|
1106
|
+
variant: "outline",
|
|
1107
|
+
onClick: goBack,
|
|
1108
|
+
disabled: submitting,
|
|
1109
|
+
"aria-label": t("warranty_claims.portal.new.previousStep"),
|
|
1110
|
+
children: [
|
|
1111
|
+
/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4", "aria-hidden": "true" }),
|
|
1112
|
+
t("warranty_claims.portal.new.previousStep")
|
|
1113
|
+
]
|
|
1114
|
+
}
|
|
1115
|
+
) : null
|
|
1116
|
+
] }),
|
|
1117
|
+
currentStep === "review" ? /* @__PURE__ */ jsxs(Button, { type: "submit", disabled: submitting || !hasValidLines || !hasReason, "aria-label": t("warranty_claims.portal.submit"), children: [
|
|
1118
|
+
/* @__PURE__ */ jsx(Send, { className: "size-4", "aria-hidden": "true" }),
|
|
1119
|
+
submitting ? t("warranty_claims.portal.new.submitting") : t("warranty_claims.portal.submit")
|
|
1120
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
1121
|
+
Button,
|
|
1122
|
+
{
|
|
1123
|
+
type: "button",
|
|
1124
|
+
onClick: goNext,
|
|
1125
|
+
disabled: submitting,
|
|
1126
|
+
"aria-label": t("warranty_claims.portal.new.nextStep"),
|
|
1127
|
+
children: [
|
|
1128
|
+
t("warranty_claims.portal.new.nextStep"),
|
|
1129
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "size-4", "aria-hidden": "true" })
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1132
|
+
)
|
|
1133
|
+
] })
|
|
1134
|
+
] });
|
|
1135
|
+
}
|
|
1136
|
+
export {
|
|
1137
|
+
WarrantyClaimPortalNewPage as default
|
|
1138
|
+
};
|
|
1139
|
+
//# sourceMappingURL=page.js.map
|