@open-mercato/core 0.7.0 → 0.7.1-develop.7103.1.41ff100d93
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 +1 -1
- package/dist/helpers/integration/api.js +13 -1
- package/dist/helpers/integration/api.js.map +2 -2
- package/dist/helpers/integration/communicationChannelsFixtures.js +19 -0
- package/dist/helpers/integration/communicationChannelsFixtures.js.map +2 -2
- package/dist/modules/api_keys/api/keys/route.js +1 -1
- package/dist/modules/api_keys/api/keys/route.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/page.js +3 -1
- package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
- package/dist/modules/api_keys/di.js +9 -0
- package/dist/modules/api_keys/di.js.map +7 -0
- package/dist/modules/api_keys/services/principalService.js +31 -0
- package/dist/modules/api_keys/services/principalService.js.map +7 -0
- package/dist/modules/attachments/api/route.js +2 -2
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js +2 -0
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/di.js +11 -1
- package/dist/modules/attachments/di.js.map +2 -2
- package/dist/modules/attachments/index.js.map +1 -1
- package/dist/modules/attachments/lib/attachment-service.js +313 -0
- package/dist/modules/attachments/lib/attachment-service.js.map +7 -0
- package/dist/modules/attachments/lib/scoped-upload-service.js +15 -2
- package/dist/modules/attachments/lib/scoped-upload-service.js.map +2 -2
- package/dist/modules/attachments/lib/upload-limits.js +6 -2
- package/dist/modules/attachments/lib/upload-limits.js.map +2 -2
- package/dist/modules/audit_logs/backend/audit-logs/page.js +6 -0
- package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
- package/dist/modules/audit_logs/lib/display-helpers.js +19 -11
- package/dist/modules/audit_logs/lib/display-helpers.js.map +2 -2
- package/dist/modules/audit_logs/services/actionLogService.js +57 -12
- package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
- package/dist/modules/auth/acl.js +30 -5
- package/dist/modules/auth/acl.js.map +2 -2
- package/dist/modules/auth/api/feature-check.js +8 -2
- package/dist/modules/auth/api/feature-check.js.map +2 -2
- package/dist/modules/auth/api/login.js +4 -1
- package/dist/modules/auth/api/login.js.map +2 -2
- package/dist/modules/auth/api/reset/validate.js +55 -0
- package/dist/modules/auth/api/reset/validate.js.map +7 -0
- package/dist/modules/auth/api/roles/acl/route.js +28 -33
- package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
- package/dist/modules/auth/api/session/refresh.js +25 -1
- package/dist/modules/auth/api/session/refresh.js.map +2 -2
- package/dist/modules/auth/api/users/acl/route.js +96 -51
- package/dist/modules/auth/api/users/acl/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +13 -5
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js +5 -1
- package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +3 -1
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.meta.js +5 -1
- package/dist/modules/auth/backend/users/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/auth/backend/users/page.js +2 -1
- package/dist/modules/auth/backend/users/page.js.map +2 -2
- package/dist/modules/auth/commands/acl.js +254 -0
- package/dist/modules/auth/commands/acl.js.map +7 -0
- package/dist/modules/auth/components/AclEditor.js +39 -30
- package/dist/modules/auth/components/AclEditor.js.map +2 -2
- package/dist/modules/auth/data/entities.js.map +2 -2
- package/dist/modules/auth/data/validators.js +5 -1
- package/dist/modules/auth/data/validators.js.map +2 -2
- package/dist/modules/auth/di.js +35 -9
- package/dist/modules/auth/di.js.map +2 -2
- package/dist/modules/auth/frontend/reset/[token]/page.js +46 -0
- package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
- package/dist/modules/auth/lib/grantChecks.js.map +2 -2
- package/dist/modules/auth/lib/userIdFilter.js +16 -0
- package/dist/modules/auth/lib/userIdFilter.js.map +7 -0
- package/dist/modules/auth/services/authService.js +16 -2
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/auth/services/principalService.js +200 -0
- package/dist/modules/auth/services/principalService.js.map +7 -0
- package/dist/modules/auth/services/rbacService.js +67 -24
- package/dist/modules/auth/services/rbacService.js.map +3 -3
- package/dist/modules/auth/services/roleOrganizationScope.js +41 -0
- package/dist/modules/auth/services/roleOrganizationScope.js.map +7 -0
- package/dist/modules/business_rules/backend/logs/page.js +3 -1
- package/dist/modules/business_rules/backend/logs/page.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/page.js +3 -1
- package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/page.js +3 -1
- package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
- package/dist/modules/business_rules/lib/expression-evaluator.js +9 -9
- package/dist/modules/business_rules/lib/expression-evaluator.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-evaluator.js +10 -9
- package/dist/modules/business_rules/lib/rule-evaluator.js.map +2 -2
- package/dist/modules/catalog/ai-agents.js +1 -1
- package/dist/modules/catalog/ai-agents.js.map +1 -1
- package/dist/modules/catalog/ai-tools/merchandising-pack.js +2 -2
- package/dist/modules/catalog/ai-tools/merchandising-pack.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js +5 -2
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js.map +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js +2 -0
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js +7 -1
- package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
- package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js +2 -0
- package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js +9 -1
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/test-seed/route.js +95 -10
- package/dist/modules/communication_channels/api/post/test-seed/route.js.map +2 -2
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js +3 -0
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js.map +2 -2
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js +14 -1
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
- package/dist/modules/communication_channels/di.js +7 -1
- package/dist/modules/communication_channels/di.js.map +2 -2
- package/dist/modules/communication_channels/lib/email-capabilities.js +4 -1
- package/dist/modules/communication_channels/lib/email-capabilities.js.map +2 -2
- package/dist/modules/communication_channels/lib/outbound-recipient.js +33 -0
- package/dist/modules/communication_channels/lib/outbound-recipient.js.map +7 -0
- package/dist/modules/communication_channels/lib/resolve-channel-type.js +51 -0
- package/dist/modules/communication_channels/lib/resolve-channel-type.js.map +7 -0
- package/dist/modules/communication_channels/lib/test-seed.js +41 -2
- package/dist/modules/communication_channels/lib/test-seed.js.map +2 -2
- package/dist/modules/configs/lib/system-status.js +9 -0
- package/dist/modules/configs/lib/system-status.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/page.js +3 -1
- package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js +3 -1
- package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
- package/dist/modules/currencies/services/rateFetchingService.js +6 -1
- package/dist/modules/currencies/services/rateFetchingService.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js +9 -0
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js +3 -1
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js +3 -1
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js.map +2 -2
- package/dist/modules/customer_accounts/services/domainMappingService.js +10 -0
- package/dist/modules/customer_accounts/services/domainMappingService.js.map +2 -2
- package/dist/modules/customers/ai-tools/companies-pack.js +4 -1
- package/dist/modules/customers/ai-tools/companies-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js +13 -2
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/deals-pack.js +52 -6
- package/dist/modules/customers/ai-tools/deals-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/people-pack.js +4 -1
- package/dist/modules/customers/ai-tools/people-pack.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +48 -6
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +20 -64
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +17 -94
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js +8 -5
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js +1 -1
- package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +1 -1
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/route.js +8 -25
- package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/stats/route.js +3 -22
- package/dist/modules/customers/api/deals/[id]/stats/route.js.map +2 -2
- package/dist/modules/customers/api/deals/aggregate/route.js +14 -9
- package/dist/modules/customers/api/deals/aggregate/route.js.map +2 -2
- package/dist/modules/customers/api/deals/map/route.js +5 -5
- package/dist/modules/customers/api/deals/map/route.js.map +2 -2
- package/dist/modules/customers/api/deals/route.js +38 -1
- package/dist/modules/customers/api/deals/route.js.map +2 -2
- package/dist/modules/customers/api/entity-roles-factory.js +4 -4
- package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +3 -1
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/tasks/route.js +27 -4
- package/dist/modules/customers/api/interactions/tasks/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +4 -3
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/context.js +1 -1
- package/dist/modules/customers/api/people/[id]/companies/context.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js +1 -1
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +11 -10
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/check-phone/route.js +51 -9
- package/dist/modules/customers/api/people/check-phone/route.js.map +2 -2
- package/dist/modules/customers/api/todos/route.js +30 -5
- package/dist/modules/customers/api/todos/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +4 -2
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +6 -1
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +5 -2
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js +4 -13
- package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js +85 -14
- package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js +18 -0
- package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js.map +7 -0
- package/dist/modules/customers/backend/customers/people/page.js +4 -2
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js +9 -3
- package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +21 -34
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js.map +1 -1
- package/dist/modules/customers/commands/personCompanyLinks.js +131 -2
- package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
- package/dist/modules/customers/components/CustomerTodosTable.js +1 -0
- package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
- package/dist/modules/customers/components/DealsKpiStrip.js +7 -6
- package/dist/modules/customers/components/DealsKpiStrip.js.map +2 -2
- package/dist/modules/customers/components/calendar/AgendaList.js +2 -2
- package/dist/modules/customers/components/calendar/AgendaList.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js +1 -1
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarScreen.js +1 -1
- package/dist/modules/customers/components/calendar/CalendarScreen.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarSettingsModal.js +1 -1
- package/dist/modules/customers/components/calendar/CalendarSettingsModal.js.map +2 -2
- package/dist/modules/customers/components/calendar/EventBlock.js +1 -1
- package/dist/modules/customers/components/calendar/EventBlock.js.map +2 -2
- package/dist/modules/customers/components/calendar/EventPeekPopover.js +3 -2
- package/dist/modules/customers/components/calendar/EventPeekPopover.js.map +2 -2
- package/dist/modules/customers/components/calendar/editor/PeopleField.js +40 -5
- package/dist/modules/customers/components/calendar/editor/PeopleField.js.map +2 -2
- package/dist/modules/customers/components/calendar/editor/hooks.js +2 -1
- package/dist/modules/customers/components/calendar/editor/hooks.js.map +2 -2
- package/dist/modules/customers/components/calendar/types.js +1 -1
- package/dist/modules/customers/components/calendar/types.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyKpiBar.js +5 -4
- package/dist/modules/customers/components/detail/CompanyKpiBar.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js +3 -1
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +19 -7
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/DealsSection.js +6 -5
- package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
- package/dist/modules/customers/components/detail/EntityTagsDialog.js +35 -11
- package/dist/modules/customers/components/detail/EntityTagsDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonCompaniesSection.js +3 -1
- package/dist/modules/customers/components/detail/PersonCompaniesSection.js.map +2 -2
- package/dist/modules/customers/components/detail/hooks/usePersonTasks.js +19 -13
- package/dist/modules/customers/components/detail/hooks/usePersonTasks.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/ParticipantsField.js +4 -4
- package/dist/modules/customers/components/detail/schedule/ParticipantsField.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js +3 -3
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js.map +2 -2
- package/dist/modules/customers/components/detail/utils.js +5 -5
- package/dist/modules/customers/components/detail/utils.js.map +2 -2
- package/dist/modules/customers/data/entities.js.map +1 -1
- package/dist/modules/customers/data/validators.js +32 -3
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/events.js +5 -0
- package/dist/modules/customers/events.js.map +2 -2
- package/dist/modules/customers/lib/calendar/conflicts.js +8 -2
- package/dist/modules/customers/lib/calendar/conflicts.js.map +2 -2
- package/dist/modules/customers/lib/calendar/editorPayload.js +3 -2
- package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
- package/dist/modules/customers/lib/calendar/mapItem.js +8 -3
- package/dist/modules/customers/lib/calendar/mapItem.js.map +2 -2
- package/dist/modules/customers/lib/calendar/participantIdentity.js +9 -0
- package/dist/modules/customers/lib/calendar/participantIdentity.js.map +7 -0
- package/dist/modules/customers/lib/closureStage.js +45 -0
- package/dist/modules/customers/lib/closureStage.js.map +7 -0
- package/dist/modules/customers/lib/dealStatus.js +30 -0
- package/dist/modules/customers/lib/dealStatus.js.map +2 -2
- package/dist/modules/customers/lib/detailReadAccess.js +12 -0
- package/dist/modules/customers/lib/detailReadAccess.js.map +7 -0
- package/dist/modules/customers/lib/findPeopleByAddresses.js +1 -0
- package/dist/modules/customers/lib/findPeopleByAddresses.js.map +2 -2
- package/dist/modules/customers/lib/personCompanies.js +100 -2
- package/dist/modules/customers/lib/personCompanies.js.map +2 -2
- package/dist/modules/customers/lib/todoCompatibility.js +12 -0
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetScope.js +6 -1
- package/dist/modules/dashboards/lib/widgetScope.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +3 -1
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/abandoned-run.js +19 -0
- package/dist/modules/data_sync/lib/abandoned-run.js.map +7 -0
- package/dist/modules/data_sync/lib/sync-engine.js +72 -6
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-export.js +5 -1
- package/dist/modules/data_sync/workers/sync-export.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-import.js +5 -1
- package/dist/modules/data_sync/workers/sync-import.js.map +2 -2
- package/dist/modules/devices/acl.js +9 -1
- package/dist/modules/devices/acl.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/[id]/route.js +5 -32
- package/dist/modules/devices/api/admin/devices/[id]/route.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/route.js +14 -1
- package/dist/modules/devices/api/admin/devices/route.js.map +2 -2
- package/dist/modules/devices/api/deviceList.js +99 -12
- package/dist/modules/devices/api/deviceList.js.map +2 -2
- package/dist/modules/devices/api/deviceSerialization.js +46 -0
- package/dist/modules/devices/api/deviceSerialization.js.map +7 -0
- package/dist/modules/devices/api/openapi.js +3 -1
- package/dist/modules/devices/api/openapi.js.map +2 -2
- package/dist/modules/devices/api/route.js +9 -1
- package/dist/modules/devices/api/route.js.map +2 -2
- package/dist/modules/devices/backend/devices/[id]/page.js +10 -26
- package/dist/modules/devices/backend/devices/[id]/page.js.map +2 -2
- package/dist/modules/devices/backend/devices/create/page.js +17 -1
- package/dist/modules/devices/backend/devices/create/page.js.map +2 -2
- package/dist/modules/devices/backend/devices/page.js +28 -34
- package/dist/modules/devices/backend/devices/page.js.map +2 -2
- package/dist/modules/devices/backend/devices/useDeviceUserLabels.js +34 -0
- package/dist/modules/devices/backend/devices/useDeviceUserLabels.js.map +7 -0
- package/dist/modules/devices/backend/devices/userOptions.js +52 -0
- package/dist/modules/devices/backend/devices/userOptions.js.map +7 -0
- package/dist/modules/devices/setup.js +6 -2
- package/dist/modules/devices/setup.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js +2 -1
- package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js +2 -1
- package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
- package/dist/modules/directory/di.js +9 -0
- package/dist/modules/directory/di.js.map +2 -2
- package/dist/modules/directory/services/organizationHierarchyService.js +29 -0
- package/dist/modules/directory/services/organizationHierarchyService.js.map +7 -0
- package/dist/modules/directory/services/organizationScopeService.js +56 -0
- package/dist/modules/directory/services/organizationScopeService.js.map +7 -0
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/entities/api/records.js +4 -2
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +3 -1
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
- package/dist/modules/eudr/api/plots/route.js +5 -1
- package/dist/modules/eudr/api/plots/route.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js +3 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/page.js +3 -0
- package/dist/modules/eudr/backend/eudr/plots/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js +3 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js +3 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/page.js +3 -0
- package/dist/modules/eudr/backend/eudr/statements/page.js.map +2 -2
- package/dist/modules/eudr/commands/statements.js +0 -3
- package/dist/modules/eudr/commands/statements.js.map +2 -2
- package/dist/modules/eudr/data/validators.js +4 -1
- package/dist/modules/eudr/data/validators.js.map +2 -2
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +1 -0
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/OverridesTable.js +1 -0
- package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
- package/dist/modules/feature_toggles/defaults.json +0 -8
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +3 -0
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js +3 -0
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js.map +2 -2
- package/dist/modules/inbox_ops/lib/htmlToPlainText.js +1 -12
- package/dist/modules/inbox_ops/lib/htmlToPlainText.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +6 -1
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +38 -29
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +36 -9
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/credential-secret-fields.js +55 -0
- package/dist/modules/integrations/backend/integrations/credential-secret-fields.js.map +7 -0
- package/dist/modules/integrations/data/validators.js +11 -3
- package/dist/modules/integrations/data/validators.js.map +2 -2
- package/dist/modules/integrations/lib/credentials-masking.js +6 -2
- package/dist/modules/integrations/lib/credentials-masking.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +29 -1
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/openapi.js +17 -2
- package/dist/modules/messages/api/openapi.js.map +2 -2
- package/dist/modules/messages/api/route.js +17 -2
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/components/MessagesInboxPageClient.js +7 -14
- package/dist/modules/messages/components/MessagesInboxPageClient.js.map +2 -2
- package/dist/modules/messages/components/inboxFilters.js +15 -0
- package/dist/modules/messages/components/inboxFilters.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js +11 -1
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js +3 -1
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js +2 -1
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js.map +2 -2
- package/dist/modules/messages/components/messageListLabels.js +14 -2
- package/dist/modules/messages/components/messageListLabels.js.map +2 -2
- package/dist/modules/messages/data/validators.js +18 -4
- package/dist/modules/messages/data/validators.js.map +2 -2
- package/dist/modules/messages/lib/channel-sender-identity.js +26 -0
- package/dist/modules/messages/lib/channel-sender-identity.js.map +7 -0
- package/dist/modules/messages/lib/composeSourceChannelType.js +41 -0
- package/dist/modules/messages/lib/composeSourceChannelType.js.map +7 -0
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +4 -6
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js +3 -1
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js.map +2 -2
- package/dist/modules/payment_gateways/lib/webhook-processor.js +7 -0
- package/dist/modules/payment_gateways/lib/webhook-processor.js.map +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +3 -0
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/push_notifications/backend/push_notifications/page.js +3 -1
- package/dist/modules/push_notifications/backend/push_notifications/page.js.map +2 -2
- package/dist/modules/push_notifications/backend/push_notifications/send/page.js +1 -1
- package/dist/modules/push_notifications/backend/push_notifications/send/page.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +150 -51
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/search-entity-policy.js +14 -0
- package/dist/modules/query_index/lib/search-entity-policy.js.map +7 -0
- package/dist/modules/query_index/lib/search-tokens.js +79 -3
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +3 -1
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +3 -1
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js +3 -0
- package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +3 -0
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +10 -8
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +79 -1
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/components/PriceWithCurrency.js +7 -5
- package/dist/modules/sales/components/PriceWithCurrency.js.map +2 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +3 -0
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js +8 -6
- package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +51 -22
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +83 -18
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +23 -9
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ReturnsSection.js +8 -6
- package/dist/modules/sales/components/documents/ReturnsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +68 -14
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js +6 -5
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +5 -4
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentsSection.js +8 -6
- package/dist/modules/sales/components/documents/ShipmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/lineItemShipmentLock.js +54 -0
- package/dist/modules/sales/components/documents/lineItemShipmentLock.js.map +7 -0
- package/dist/modules/sales/components/documents/lineItemUtils.js +2 -2
- package/dist/modules/sales/components/documents/lineItemUtils.js.map +2 -2
- package/dist/modules/sales/data/entities.js +8 -2
- package/dist/modules/sales/data/entities.js.map +2 -2
- package/dist/modules/sales/extension-points.js +1 -0
- package/dist/modules/sales/extension-points.js.map +2 -2
- package/dist/modules/sales/lib/salesChannelsToggleSeed.js +33 -0
- package/dist/modules/sales/lib/salesChannelsToggleSeed.js.map +7 -0
- package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js +32 -0
- package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js.map +7 -0
- package/dist/modules/sales/setup.js +2 -0
- package/dist/modules/sales/setup.js.map +2 -2
- package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js +10 -2
- package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js.map +2 -2
- package/dist/modules/sales/widgets/injection-table.js +4 -7
- package/dist/modules/sales/widgets/injection-table.js.map +2 -2
- package/dist/modules/staff/backend/staff/leave-requests/page.js +3 -0
- package/dist/modules/staff/backend/staff/leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js +3 -0
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/page.js +3 -0
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +3 -0
- package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +3 -0
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +3 -0
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.js +29 -18
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +3 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/sync_excel/lib/adapters/customers.js +1 -0
- package/dist/modules/sync_excel/lib/adapters/customers.js.map +2 -2
- package/dist/modules/warranty_claims/api/assignees/route.js +3 -3
- package/dist/modules/warranty_claims/api/assignees/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/attachments/route.js +2 -2
- package/dist/modules/warranty_claims/api/portal/attachments/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/claims/route.js +12 -9
- package/dist/modules/warranty_claims/api/portal/claims/route.js.map +2 -2
- package/dist/modules/warranty_claims/backend/page.js +3 -0
- package/dist/modules/warranty_claims/backend/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js +3 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js +3 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js +3 -0
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js.map +2 -2
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js +3 -0
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js.map +2 -2
- package/dist/modules/wms/api/warehouseSearch.js +21 -0
- package/dist/modules/wms/api/warehouseSearch.js.map +7 -0
- package/dist/modules/wms/api/warehouses/route.js +13 -9
- package/dist/modules/wms/api/warehouses/route.js.map +2 -2
- package/dist/modules/wms/api/zones/route.js +15 -2
- package/dist/modules/wms/api/zones/route.js.map +2 -2
- package/dist/modules/wms/commands/configuration.js +121 -9
- package/dist/modules/wms/commands/configuration.js.map +2 -2
- package/dist/modules/wms/commands/inventory-actions.js +3 -0
- package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
- package/dist/modules/wms/commands/shared.js +9 -1
- package/dist/modules/wms/commands/shared.js.map +2 -2
- package/dist/modules/wms/components/backend/WarehouseEditDialog.js +158 -0
- package/dist/modules/wms/components/backend/WarehouseEditDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js +76 -111
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +3 -3
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +1 -0
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotsListPage.js +1 -0
- package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +2 -2
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +27 -20
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +2 -2
- package/dist/modules/wms/components/backend/warehouseFormOptions.js +66 -0
- package/dist/modules/wms/components/backend/warehouseFormOptions.js.map +7 -0
- package/dist/modules/workflows/backend/definitions/page.js +3 -1
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/events/page.js +3 -1
- package/dist/modules/workflows/backend/events/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +3 -1
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +3 -1
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +4 -0
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/package.json +9 -10
- package/src/helpers/integration/api.ts +33 -1
- package/src/helpers/integration/communicationChannelsFixtures.ts +69 -1
- package/src/modules/api_keys/api/keys/route.ts +3 -1
- package/src/modules/api_keys/backend/api-keys/page.tsx +4 -1
- package/src/modules/api_keys/di.ts +7 -0
- package/src/modules/api_keys/services/principalService.ts +33 -0
- package/src/modules/attachments/AGENTS.md +15 -0
- package/src/modules/attachments/api/route.ts +2 -2
- package/src/modules/attachments/components/AttachmentLibrary.tsx +3 -0
- package/src/modules/attachments/di.ts +16 -0
- 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/index.ts +10 -0
- package/src/modules/attachments/lib/attachment-service.ts +468 -0
- package/src/modules/attachments/lib/scoped-upload-service.ts +46 -0
- package/src/modules/attachments/lib/upload-limits.ts +6 -2
- package/src/modules/audit_logs/backend/audit-logs/page.tsx +8 -0
- package/src/modules/audit_logs/lib/display-helpers.tsx +42 -32
- package/src/modules/audit_logs/services/actionLogService.ts +74 -11
- package/src/modules/auth/acl.ts +30 -6
- package/src/modules/auth/api/feature-check.ts +10 -3
- package/src/modules/auth/api/login.ts +9 -1
- package/src/modules/auth/api/reset/validate.ts +57 -0
- package/src/modules/auth/api/roles/acl/route.ts +42 -39
- package/src/modules/auth/api/session/refresh.ts +32 -1
- package/src/modules/auth/api/users/acl/route.ts +177 -53
- package/src/modules/auth/api/users/route.ts +18 -5
- package/src/modules/auth/backend/roles/[id]/edit/page.meta.ts +5 -2
- package/src/modules/auth/backend/roles/page.tsx +4 -2
- package/src/modules/auth/backend/users/[id]/edit/page.meta.ts +5 -2
- package/src/modules/auth/backend/users/page.tsx +3 -2
- package/src/modules/auth/commands/acl.ts +495 -0
- package/src/modules/auth/components/AclEditor.tsx +63 -33
- package/src/modules/auth/data/entities.ts +4 -1
- package/src/modules/auth/data/validators.ts +5 -0
- package/src/modules/auth/di.ts +46 -16
- package/src/modules/auth/frontend/reset/[token]/page.tsx +74 -0
- package/src/modules/auth/i18n/de.json +389 -0
- package/src/modules/auth/i18n/en.json +389 -0
- package/src/modules/auth/i18n/es.json +389 -0
- package/src/modules/auth/i18n/ko.json +389 -0
- package/src/modules/auth/i18n/pl.json +391 -2
- package/src/modules/auth/lib/grantChecks.ts +6 -0
- package/src/modules/auth/lib/userIdFilter.ts +31 -0
- package/src/modules/auth/services/authService.ts +18 -2
- package/src/modules/auth/services/principalService.ts +266 -0
- package/src/modules/auth/services/rbacService.ts +110 -24
- package/src/modules/auth/services/roleOrganizationScope.ts +70 -0
- package/src/modules/business_rules/backend/logs/page.tsx +4 -1
- package/src/modules/business_rules/backend/rules/page.tsx +4 -1
- package/src/modules/business_rules/backend/sets/page.tsx +4 -1
- package/src/modules/business_rules/lib/expression-evaluator.ts +9 -9
- package/src/modules/business_rules/lib/rule-evaluator.ts +10 -9
- package/src/modules/catalog/ai-agents.ts +1 -1
- package/src/modules/catalog/ai-tools/merchandising-pack.ts +2 -2
- package/src/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.tsx +12 -5
- package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +3 -0
- package/src/modules/catalog/components/products/ProductsDataTable.tsx +7 -0
- package/src/modules/catalog/i18n/de.json +1 -0
- package/src/modules/catalog/i18n/en.json +1 -0
- package/src/modules/catalog/i18n/es.json +1 -0
- package/src/modules/catalog/i18n/ko.json +1 -0
- package/src/modules/catalog/i18n/pl.json +1 -0
- package/src/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.tsx +4 -0
- package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +17 -1
- package/src/modules/communication_channels/api/post/test-seed/route.ts +155 -16
- package/src/modules/communication_channels/backend/communication_channels/channels/page.tsx +4 -0
- package/src/modules/communication_channels/commands/ingest-inbound-message.ts +38 -1
- package/src/modules/communication_channels/di.ts +7 -0
- package/src/modules/communication_channels/lib/adapter.ts +14 -0
- package/src/modules/communication_channels/lib/email-capabilities.ts +4 -0
- package/src/modules/communication_channels/lib/outbound-recipient.ts +71 -0
- package/src/modules/communication_channels/lib/resolve-channel-type.ts +99 -0
- package/src/modules/communication_channels/lib/test-seed.ts +64 -4
- package/src/modules/configs/i18n/de.json +2 -0
- package/src/modules/configs/i18n/en.json +2 -0
- package/src/modules/configs/i18n/es.json +2 -0
- package/src/modules/configs/i18n/ko.json +2 -0
- package/src/modules/configs/i18n/pl.json +2 -0
- package/src/modules/configs/lib/system-status.ts +9 -0
- package/src/modules/currencies/AGENTS.md +3 -0
- package/src/modules/currencies/backend/currencies/page.tsx +4 -1
- package/src/modules/currencies/backend/exchange-rates/page.tsx +4 -1
- package/src/modules/currencies/services/README.md +45 -0
- package/src/modules/currencies/services/rateFetchingService.ts +6 -1
- package/src/modules/customer_accounts/api/admin/domain-mappings.ts +7 -0
- package/src/modules/customer_accounts/backend/customer_accounts/roles/page.tsx +4 -1
- package/src/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.tsx +4 -1
- package/src/modules/customer_accounts/services/domainMappingService.ts +10 -0
- package/src/modules/customers/ai-tools/companies-pack.ts +4 -1
- package/src/modules/customers/ai-tools/deal-analyzer-pack.ts +17 -2
- package/src/modules/customers/ai-tools/deals-pack.ts +66 -1
- package/src/modules/customers/ai-tools/people-pack.ts +4 -1
- package/src/modules/customers/api/activities/route.ts +45 -0
- package/src/modules/customers/api/companies/[id]/people/route.ts +24 -73
- package/src/modules/customers/api/companies/[id]/route.ts +24 -107
- package/src/modules/customers/api/dashboard/widgets/customer-todos/route.ts +16 -8
- package/src/modules/customers/api/deals/[id]/companies/route.ts +4 -1
- package/src/modules/customers/api/deals/[id]/people/route.ts +4 -1
- package/src/modules/customers/api/deals/[id]/route.ts +17 -28
- package/src/modules/customers/api/deals/[id]/stats/route.ts +10 -25
- package/src/modules/customers/api/deals/aggregate/route.ts +17 -9
- package/src/modules/customers/api/deals/map/route.ts +4 -4
- package/src/modules/customers/api/deals/route.ts +50 -1
- package/src/modules/customers/api/entity-roles-factory.ts +8 -4
- package/src/modules/customers/api/interactions/route.ts +8 -2
- package/src/modules/customers/api/interactions/tasks/route.ts +24 -1
- package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +12 -4
- package/src/modules/customers/api/people/[id]/companies/context.ts +4 -1
- package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +4 -1
- package/src/modules/customers/api/people/[id]/route.ts +16 -11
- package/src/modules/customers/api/people/check-phone/route.ts +75 -10
- package/src/modules/customers/api/todos/route.ts +27 -2
- package/src/modules/customers/backend/customers/companies/page.tsx +5 -2
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +7 -2
- package/src/modules/customers/backend/customers/deals/page.tsx +8 -2
- package/src/modules/customers/backend/customers/deals/pipeline/components/Lane.tsx +5 -14
- package/src/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.tsx +109 -27
- package/src/modules/customers/backend/customers/deals/pipeline/components/toneClasses.ts +21 -0
- package/src/modules/customers/backend/customers/people/page.tsx +5 -2
- package/src/modules/customers/backend/hooks/useEmailDuplicateCheck.ts +12 -4
- package/src/modules/customers/commands/deals.ts +34 -59
- package/src/modules/customers/commands/interactions.ts +1 -1
- package/src/modules/customers/commands/personCompanyLinks.ts +224 -8
- package/src/modules/customers/components/CustomerTodosTable.tsx +2 -0
- package/src/modules/customers/components/DealsKpiStrip.tsx +7 -7
- package/src/modules/customers/components/calendar/AgendaList.tsx +3 -3
- package/src/modules/customers/components/calendar/CalendarEventEditor.tsx +1 -1
- package/src/modules/customers/components/calendar/CalendarScreen.tsx +1 -1
- package/src/modules/customers/components/calendar/CalendarSettingsModal.tsx +1 -1
- package/src/modules/customers/components/calendar/EventBlock.tsx +2 -2
- package/src/modules/customers/components/calendar/EventPeekPopover.tsx +4 -2
- package/src/modules/customers/components/calendar/editor/PeopleField.tsx +61 -5
- package/src/modules/customers/components/calendar/editor/hooks.ts +7 -1
- package/src/modules/customers/components/calendar/types.ts +2 -2
- package/src/modules/customers/components/detail/CompanyKpiBar.tsx +5 -4
- package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +8 -1
- package/src/modules/customers/components/detail/DealForm.tsx +22 -2
- package/src/modules/customers/components/detail/DealsSection.tsx +11 -5
- package/src/modules/customers/components/detail/EntityTagsDialog.tsx +58 -12
- package/src/modules/customers/components/detail/PersonCompaniesSection.tsx +8 -1
- package/src/modules/customers/components/detail/hooks/usePersonTasks.ts +23 -14
- package/src/modules/customers/components/detail/schedule/ParticipantsField.tsx +5 -5
- package/src/modules/customers/components/detail/schedule/useScheduleFormState.ts +5 -5
- package/src/modules/customers/components/detail/types.ts +1 -1
- package/src/modules/customers/components/detail/utils.ts +15 -5
- package/src/modules/customers/data/entities.ts +1 -1
- package/src/modules/customers/data/validators.ts +50 -9
- package/src/modules/customers/events.ts +5 -0
- package/src/modules/customers/i18n/de.json +9 -1
- package/src/modules/customers/i18n/en.json +9 -1
- package/src/modules/customers/i18n/es.json +9 -1
- package/src/modules/customers/i18n/ko.json +9 -1
- package/src/modules/customers/i18n/pl.json +9 -1
- package/src/modules/customers/lib/calendar/conflicts.ts +10 -2
- package/src/modules/customers/lib/calendar/editorPayload.ts +4 -3
- package/src/modules/customers/lib/calendar/mapItem.ts +8 -3
- package/src/modules/customers/lib/calendar/participantIdentity.ts +17 -0
- package/src/modules/customers/lib/closureStage.ts +76 -0
- package/src/modules/customers/lib/dealStatus.ts +42 -0
- package/src/modules/customers/lib/detailReadAccess.ts +35 -0
- package/src/modules/customers/lib/findPeopleByAddresses.ts +8 -6
- package/src/modules/customers/lib/personCompanies.ts +136 -1
- package/src/modules/customers/lib/todoCompatibility.ts +19 -1
- package/src/modules/dashboards/i18n/es.json +4 -4
- package/src/modules/dashboards/i18n/pl.json +7 -7
- package/src/modules/dashboards/lib/widgetScope.ts +6 -0
- package/src/modules/data_sync/AGENTS.md +1 -1
- package/src/modules/data_sync/backend/data-sync/page.tsx +4 -1
- package/src/modules/data_sync/lib/abandoned-run.ts +56 -0
- package/src/modules/data_sync/lib/adapter.ts +36 -0
- package/src/modules/data_sync/lib/sync-engine.ts +113 -5
- package/src/modules/data_sync/workers/sync-export.ts +4 -0
- package/src/modules/data_sync/workers/sync-import.ts +4 -0
- package/src/modules/devices/AGENTS.md +20 -1
- package/src/modules/devices/acl.ts +9 -1
- package/src/modules/devices/api/admin/devices/[id]/route.ts +5 -34
- package/src/modules/devices/api/admin/devices/route.ts +14 -1
- package/src/modules/devices/api/deviceList.ts +135 -11
- package/src/modules/devices/api/deviceSerialization.ts +50 -0
- package/src/modules/devices/api/openapi.ts +9 -1
- package/src/modules/devices/api/route.ts +9 -1
- package/src/modules/devices/backend/devices/[id]/page.tsx +18 -32
- package/src/modules/devices/backend/devices/create/page.tsx +17 -1
- package/src/modules/devices/backend/devices/page.tsx +44 -45
- package/src/modules/devices/backend/devices/useDeviceUserLabels.ts +45 -0
- package/src/modules/devices/backend/devices/userOptions.ts +99 -0
- package/src/modules/devices/i18n/de.json +3 -2
- package/src/modules/devices/i18n/en.json +3 -2
- package/src/modules/devices/i18n/es.json +3 -2
- package/src/modules/devices/i18n/ko.json +3 -2
- package/src/modules/devices/i18n/pl.json +3 -2
- package/src/modules/devices/setup.ts +6 -2
- package/src/modules/directory/backend/directory/organizations/page.tsx +3 -1
- package/src/modules/directory/backend/directory/tenants/page.tsx +3 -1
- package/src/modules/directory/di.ts +14 -2
- package/src/modules/directory/services/organizationHierarchyService.ts +34 -0
- package/src/modules/directory/services/organizationScopeService.ts +85 -0
- package/src/modules/directory/utils/organizationScope.ts +4 -15
- package/src/modules/entities/api/records.ts +2 -0
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +4 -1
- package/src/modules/eudr/api/plots/route.ts +4 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.tsx +4 -0
- package/src/modules/eudr/backend/eudr/plots/page.tsx +4 -0
- package/src/modules/eudr/backend/eudr/product-mappings/page.tsx +4 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/page.tsx +4 -0
- package/src/modules/eudr/backend/eudr/statements/page.tsx +4 -0
- package/src/modules/eudr/commands/statements.ts +0 -3
- package/src/modules/eudr/data/validators.ts +16 -1
- package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +2 -1
- package/src/modules/feature_toggles/components/OverridesTable.tsx +2 -1
- package/src/modules/feature_toggles/defaults.json +0 -8
- package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +4 -0
- package/src/modules/inbox_ops/backend/inbox-ops/page.tsx +4 -0
- package/src/modules/inbox_ops/lib/htmlToPlainText.ts +1 -17
- package/src/modules/integrations/api/[id]/credentials/route.ts +6 -4
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +61 -31
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +44 -9
- package/src/modules/integrations/backend/integrations/credential-secret-fields.ts +84 -0
- package/src/modules/integrations/data/validators.ts +12 -2
- package/src/modules/integrations/i18n/de.json +1 -0
- package/src/modules/integrations/i18n/en.json +1 -0
- package/src/modules/integrations/i18n/es.json +1 -0
- package/src/modules/integrations/i18n/ko.json +1 -0
- package/src/modules/integrations/i18n/pl.json +1 -0
- package/src/modules/integrations/lib/credentials-masking.ts +10 -6
- package/src/modules/messages/api/[id]/route.ts +55 -1
- package/src/modules/messages/api/openapi.ts +20 -0
- package/src/modules/messages/api/route.ts +31 -2
- package/src/modules/messages/components/MessagesInboxPageClient.tsx +9 -16
- package/src/modules/messages/components/inboxFilters.ts +36 -0
- package/src/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.ts +14 -1
- package/src/modules/messages/components/message-detail/panels/MessageHeader.tsx +3 -1
- package/src/modules/messages/components/message-detail/panels/thread-panel.tsx +2 -1
- package/src/modules/messages/components/message-detail/types.ts +3 -0
- package/src/modules/messages/components/messageListLabels.ts +52 -3
- package/src/modules/messages/data/validators.ts +43 -4
- package/src/modules/messages/lib/channel-sender-identity.ts +55 -0
- package/src/modules/messages/lib/composeSourceChannelType.ts +95 -0
- package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +4 -6
- package/src/modules/payment_gateways/backend/payment-gateways/page.tsx +4 -1
- package/src/modules/payment_gateways/lib/webhook-processor.ts +11 -0
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +4 -0
- package/src/modules/push_notifications/backend/push_notifications/page.tsx +4 -1
- package/src/modules/push_notifications/backend/push_notifications/send/page.tsx +4 -4
- package/src/modules/query_index/lib/engine.ts +249 -61
- package/src/modules/query_index/lib/search-entity-policy.ts +46 -0
- package/src/modules/query_index/lib/search-tokens.ts +135 -3
- package/src/modules/resources/backend/resources/resource-types/page.tsx +4 -1
- package/src/modules/resources/backend/resources/resources/page.tsx +4 -1
- package/src/modules/sales/backend/sales/channels/offers/page.tsx +4 -0
- package/src/modules/sales/backend/sales/channels/page.tsx +4 -0
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +14 -8
- package/src/modules/sales/commands/documents.ts +93 -0
- package/src/modules/sales/components/PriceWithCurrency.tsx +17 -5
- package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +4 -0
- package/src/modules/sales/components/documents/AdjustmentsSection.tsx +6 -5
- package/src/modules/sales/components/documents/ItemsSection.tsx +56 -18
- package/src/modules/sales/components/documents/LineItemDialog.tsx +137 -20
- package/src/modules/sales/components/documents/PaymentsSection.tsx +20 -9
- package/src/modules/sales/components/documents/ReturnsSection.tsx +6 -5
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +106 -14
- package/src/modules/sales/components/documents/SalesOrderDraftLines.tsx +6 -5
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +5 -4
- package/src/modules/sales/components/documents/ShipmentsSection.tsx +6 -5
- package/src/modules/sales/components/documents/lineItemShipmentLock.ts +74 -0
- package/src/modules/sales/components/documents/lineItemUtils.ts +7 -2
- package/src/modules/sales/data/entities.ts +6 -0
- package/src/modules/sales/extension-points.ts +1 -0
- package/src/modules/sales/i18n/de.json +8 -0
- package/src/modules/sales/i18n/en.json +8 -0
- package/src/modules/sales/i18n/es.json +8 -0
- package/src/modules/sales/i18n/ko.json +8 -0
- package/src/modules/sales/i18n/pl.json +8 -0
- package/src/modules/sales/lib/salesChannelsToggleSeed.ts +42 -0
- package/src/modules/sales/migrations/.snapshot-open-mercato.json +60 -0
- package/src/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.ts +87 -0
- package/src/modules/sales/setup.ts +2 -0
- package/src/modules/sales/widgets/injection/payment-gateway-status-column/widget.ts +9 -1
- package/src/modules/sales/widgets/injection-table.ts +4 -7
- package/src/modules/staff/backend/staff/leave-requests/page.tsx +4 -0
- package/src/modules/staff/backend/staff/my-leave-requests/page.tsx +4 -0
- package/src/modules/staff/backend/staff/team-members/page.tsx +6 -0
- package/src/modules/staff/backend/staff/team-roles/page.tsx +4 -0
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +4 -0
- package/src/modules/staff/backend/staff/teams/page.tsx +4 -0
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +4 -0
- package/src/modules/sync_excel/lib/adapters/customers.ts +5 -0
- package/src/modules/warranty_claims/api/assignees/route.ts +3 -3
- package/src/modules/warranty_claims/api/portal/attachments/route.ts +2 -2
- package/src/modules/warranty_claims/api/portal/claims/route.ts +12 -9
- package/src/modules/warranty_claims/backend/page.tsx +4 -0
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/page.tsx +4 -0
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.tsx +4 -0
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.tsx +4 -0
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.tsx +4 -0
- package/src/modules/wms/api/warehouseSearch.ts +23 -0
- package/src/modules/wms/api/warehouses/route.ts +13 -9
- package/src/modules/wms/api/zones/route.ts +16 -0
- package/src/modules/wms/commands/configuration.ts +159 -10
- package/src/modules/wms/commands/inventory-actions.ts +3 -0
- package/src/modules/wms/commands/shared.ts +17 -0
- package/src/modules/wms/components/backend/WarehouseEditDialog.tsx +216 -0
- package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +95 -141
- package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +2 -0
- package/src/modules/wms/components/backend/WmsLotsListPage.tsx +2 -0
- package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +36 -20
- package/src/modules/wms/components/backend/warehouseFormOptions.ts +72 -0
- package/src/modules/wms/i18n/de.json +2 -0
- package/src/modules/wms/i18n/en.json +2 -0
- package/src/modules/wms/i18n/es.json +2 -0
- package/src/modules/wms/i18n/ko.json +2 -0
- package/src/modules/wms/i18n/pl.json +2 -0
- package/src/modules/workflows/backend/definitions/page.tsx +4 -1
- package/src/modules/workflows/backend/events/page.tsx +4 -1
- package/src/modules/workflows/backend/instances/page.tsx +4 -1
- package/src/modules/workflows/backend/tasks/page.tsx +4 -1
- package/src/modules/workflows/lib/activity-executor.ts +9 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/messages/components/MessagesInboxPageClient.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { extensionPoints } from '@open-mercato/core/modules/messages/extension-points'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useAppEvent } from '@open-mercato/ui/backend/injection/useAppEvent'\nimport { Archive, ChevronDown, FilePenLine, Inbox, Layers, Send } from 'lucide-react'\nimport { getMessageUiComponentRegistry } from './utils/typeUiRegistry'\nimport { DefaultMessageListItem } from './defaults/DefaultMessageListItem'\nimport { getMessageListParticipantLabel } from './messageListLabels'\nimport { toErrorMessage } from './message-detail/utils'\nimport { useMessagesInboxBulkActions, type MessageFolder } from './useMessagesInboxBulkActions'\nimport {\n buildMessagesInboxFilters,\n buildMessagesListParams,\n type SenderOption,\n} from './inboxFilters'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('messages').child({ component: 'MessagesInboxPageClient' })\n\ntype MessageListItem = {\n id: string\n type: string\n subject: string\n bodyPreview: string\n senderUserId: string\n senderName?: string | null\n senderEmail?: string | null\n priority: string\n status: string\n hasObjects: boolean\n objectCount: number\n hasAttachments: boolean\n attachmentCount: number\n recipientCount?: number\n hasActions: boolean\n actionTaken?: string | null\n sentAt?: string | null\n readAt?: string | null\n threadId?: string | null\n}\n\ntype MessageListResponse = {\n items?: MessageListItem[]\n total?: number\n page?: number\n pageSize?: number\n totalPages?: number\n}\n\ntype MessageTypeItem = {\n type: string\n module: string\n labelKey: string\n ui?: {\n listItemComponent?: string | null\n } | null\n}\n\ntype UserListItem = {\n id: string\n email?: string | null\n name?: string | null\n}\n\nexport function MessagesInboxPageClient() {\n const router = useRouter()\n const t = useT()\n const queryClient = useQueryClient()\n const scopeVersion = useOrganizationScopeVersion()\n\n const invalidateMessageListQueries = React.useCallback(() => {\n void queryClient.invalidateQueries({ queryKey: ['messages', 'list'] })\n }, [queryClient])\n\n useAppEvent('messages.message.*', invalidateMessageListQueries, [invalidateMessageListQueries])\n\n useAppEvent('om:bridge:reconnected', invalidateMessageListQueries, [invalidateMessageListQueries])\n\n const [folder, setFolder] = React.useState<MessageFolder>('inbox')\n const [folderMenuOpen, setFolderMenuOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [page, setPage] = React.useState(1)\n const pageSize = 20\n const folderMenuRef = React.useRef<HTMLDivElement | null>(null)\n const messageUiRegistry = React.useMemo(() => getMessageUiComponentRegistry(), [])\n const { bulkActions, selectionScopeKey, injectionContext, ConfirmDialogElement } = useMessagesInboxBulkActions<MessageListItem>({\n folder,\n page,\n search,\n filterValues,\n })\n\n const listQuery = useQuery({\n queryKey: [\n 'messages',\n 'list',\n folder,\n search,\n page,\n pageSize,\n JSON.stringify(filterValues),\n scopeVersion,\n ],\n queryFn: async () => {\n const params = buildMessagesListParams({\n folder,\n page,\n pageSize,\n search,\n filterValues,\n })\n\n const call = await apiCall<MessageListResponse>(`/api/messages?${params.toString()}`)\n if (!call.ok) {\n throw new Error(\n toErrorMessage(call.result)\n ?? t('messages.errors.loadListFailed', 'Failed to load messages.'),\n )\n }\n\n return {\n items: Array.isArray(call.result?.items) ? call.result?.items ?? [] : [],\n total: Number(call.result?.total ?? 0),\n page: Number(call.result?.page ?? page),\n pageSize: Number(call.result?.pageSize ?? pageSize),\n totalPages: Number(call.result?.totalPages ?? 0),\n }\n },\n })\n\n const messageTypesQuery = useQuery({\n queryKey: ['messages', 'types', scopeVersion],\n queryFn: async () => {\n const call = await apiCall<{ items?: MessageTypeItem[] }>('/api/messages/types')\n if (!call.ok) {\n throw new Error(\n toErrorMessage(call.result)\n ?? t('messages.errors.loadTypesFailed', 'Failed to load message types.'),\n )\n }\n return Array.isArray(call.result?.items) ? call.result?.items ?? [] : []\n },\n })\n\n React.useEffect(() => {\n if (!listQuery.error) return\n flash(\n listQuery.error instanceof Error\n ? listQuery.error.message\n : t('messages.errors.loadListFailed', 'Failed to load messages.'),\n 'error',\n )\n }, [listQuery.error, t])\n\n React.useEffect(() => {\n if (!messageTypesQuery.error) return\n flash(\n messageTypesQuery.error instanceof Error\n ? messageTypesQuery.error.message\n : t('messages.errors.loadTypesFailed', 'Failed to load message types.'),\n 'error',\n )\n }, [messageTypesQuery.error, t])\n\n const messageTypeLabelMap = React.useMemo(() => {\n const map: Record<string, string> = {}\n for (const item of messageTypesQuery.data ?? []) {\n map[item.type] = t(item.labelKey, item.type)\n }\n return map\n }, [messageTypesQuery.data, t])\n\n const [senderOptions, setSenderOptions] = React.useState<SenderOption[]>([])\n const senderOptionsScopeRef = React.useRef(scopeVersion)\n\n const mergeSenderOptions = React.useCallback((incoming: SenderOption[]) => {\n if (incoming.length === 0) return\n setSenderOptions((prev) => {\n const map = new Map<string, SenderOption>()\n for (const opt of prev) map.set(opt.value, opt)\n for (const opt of incoming) map.set(opt.value, opt)\n return Array.from(map.values())\n })\n }, [])\n\n const loadSenderOptions = React.useCallback(async (query?: string) => {\n const params = new URLSearchParams()\n params.set('page', '1')\n params.set('pageSize', '20')\n if (query && query.trim().length > 0) {\n params.set('search', query.trim())\n }\n\n const call = await apiCall<{ items?: UserListItem[] }>(\n `/api/auth/users?${params.toString()}`,\n {\n headers: {\n 'x-om-forbidden-redirect': '0',\n },\n },\n ).catch(() => null)\n if (!call) return []\n if (!call.ok) return []\n\n const items = Array.isArray(call.result?.items) ? call.result?.items ?? [] : []\n const next: SenderOption[] = items.flatMap((item) => {\n if (!item || typeof item.id !== 'string' || item.id.trim().length === 0) return []\n const name = typeof item.name === 'string' && item.name.trim().length > 0 ? item.name.trim() : null\n const email = typeof item.email === 'string' && item.email.trim().length > 0 ? item.email.trim() : null\n const label = name ?? email ?? item.id\n return [{\n value: item.id,\n label,\n description: email && email !== label ? email : null,\n }]\n })\n if (senderOptionsScopeRef.current === scopeVersion) {\n mergeSenderOptions(next)\n }\n return next\n }, [mergeSenderOptions, scopeVersion])\n\n React.useEffect(() => {\n const items = listQuery.data?.items ?? []\n const next = items.flatMap((item): SenderOption[] => {\n if (typeof item.senderUserId !== 'string' || item.senderUserId.trim().length === 0) return []\n const name = typeof item.senderName === 'string' && item.senderName.trim().length > 0\n ? item.senderName.trim()\n : null\n const email = typeof item.senderEmail === 'string' && item.senderEmail.trim().length > 0\n ? item.senderEmail.trim()\n : null\n const label = name ?? email ?? item.senderUserId\n return [{\n value: item.senderUserId,\n label,\n description: email && email !== label ? email : null,\n }]\n })\n mergeSenderOptions(next)\n }, [listQuery.data?.items, mergeSenderOptions])\n\n React.useEffect(() => {\n senderOptionsScopeRef.current = scopeVersion\n setSenderOptions([])\n loadSenderOptions().catch((error: unknown) => {\n logger.warn('Failed to load sender filter options', { err: error })\n })\n }, [loadSenderOptions, scopeVersion])\n\n const listItemComponentKeyByType = React.useMemo(() => {\n const map: Record<string, string | null> = {}\n for (const item of messageTypesQuery.data ?? []) {\n map[item.type] = item.ui?.listItemComponent ?? null\n }\n return map\n }, [messageTypesQuery.data])\n\n const filters = React.useMemo<FilterDef[]>(() => {\n const typeOptions = (messageTypesQuery.data ?? []).map((item) => ({\n value: item.type,\n label: t(item.labelKey, item.type),\n }))\n\n return buildMessagesInboxFilters({\n t,\n typeOptions,\n senderOptions,\n loadSenderOptions,\n })\n }, [loadSenderOptions, messageTypesQuery.data, senderOptions, t])\n\n const columns = React.useMemo<ColumnDef<MessageListItem>[]>(() => [\n {\n accessorKey: 'message',\n header: t('messages.title', 'Messages'),\n meta: {\n truncate: false,\n maxWidth: '100%',\n },\n cell: ({ row }) => {\n const item = row.original\n const listItemComponentKey = listItemComponentKeyByType[item.type]\n const ListItemComponent = listItemComponentKey\n ? messageUiRegistry.listItemComponents[listItemComponentKey] ?? null\n : null\n const ComponentToUse = ListItemComponent || DefaultMessageListItem\n\n return (\n <ComponentToUse\n message={{\n id: item.id,\n type: item.type,\n typeLabel: messageTypeLabelMap[item.type] ?? item.type,\n subject: item.subject,\n body: item.bodyPreview,\n bodyFormat: 'text' as const,\n priority: (item.priority as 'low' | 'normal' | 'high' | 'urgent') ?? 'normal',\n sentAt: item.sentAt ? new Date(item.sentAt) : null,\n senderName: getMessageListParticipantLabel(item, folder, t),\n hasObjects: item.hasObjects,\n objectCount: item.objectCount,\n hasAttachments: item.hasAttachments,\n attachmentCount: item.attachmentCount,\n recipientCount: item.recipientCount ?? 0,\n hasActions: item.hasActions,\n actionTaken: item.actionTaken ?? null,\n unread: item.status === 'unread',\n }}\n onClick={() => router.push(`/backend/messages/${item.id}`)}\n />\n )\n },\n },\n ], [folder, listItemComponentKeyByType, messageTypeLabelMap, messageUiRegistry, router, t])\n\n const folderOptions = React.useMemo(() => [\n { id: 'inbox' as const, label: t('messages.folder.inbox', 'Inbox'), icon: Inbox },\n { id: 'sent' as const, label: t('messages.folder.sent', 'Sent'), icon: Send },\n { id: 'drafts' as const, label: t('messages.folder.drafts', 'Drafts'), icon: FilePenLine },\n { id: 'archived' as const, label: t('messages.folder.archived', 'Archived'), icon: Archive },\n { id: 'all' as const, label: t('messages.folder.all', 'All'), icon: Layers },\n ], [t])\n\n const activeFolderOption = folderOptions.find((option) => option.id === folder) ?? folderOptions[0]\n const ActiveFolderIcon = activeFolderOption.icon\n\n React.useEffect(() => {\n if (!folderMenuOpen) return\n const handleClickOutside = (event: MouseEvent) => {\n if (!folderMenuRef.current) return\n const target = event.target\n if (target instanceof Node && !folderMenuRef.current.contains(target)) {\n setFolderMenuOpen(false)\n }\n }\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') setFolderMenuOpen(false)\n }\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleEscape)\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleEscape)\n }\n }, [folderMenuOpen])\n\n const rows = listQuery.data?.items ?? []\n const total = listQuery.data?.total ?? 0\n const totalPages = listQuery.data?.totalPages ?? 0\n\n return (\n <div className=\"space-y-4\">\n <DataTable\n title={t('messages.title', 'Messages')}\n // UMES extension surface \u2014 opt into widget injection at:\n // data-table:messages:columns / :row-actions / :bulk-actions / :filters / :toolbar / :search-trailing\n // (SPEC-045d \u00A79.3a \u2014 communication_channels hub renders channel badge + delivery status here)\n extensionTableId={extensionPoints.hosts.inboxTable.tableId}\n columns={columns}\n data={rows}\n bulkActions={bulkActions}\n selectionScopeKey={selectionScopeKey}\n searchValue={search}\n onSearchChange={(value) => {\n setSearch(value)\n setPage(1)\n }}\n searchPlaceholder={t('messages.searchPlaceholder', 'Search messages')}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={(value) => {\n setFilterValues(value)\n setPage(1)\n }}\n onFiltersClear={() => {\n setFilterValues({})\n setPage(1)\n }}\n injectionContext={injectionContext}\n isLoading={listQuery.isLoading || listQuery.isFetching}\n pagination={{\n page,\n pageSize,\n total,\n totalPages,\n onPageChange: setPage,\n }}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <div className=\"relative\" ref={folderMenuRef}>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"gap-2\"\n aria-expanded={folderMenuOpen}\n aria-haspopup=\"menu\"\n onClick={() => setFolderMenuOpen((value) => !value)}\n >\n <ActiveFolderIcon className=\"h-4 w-4\" aria-hidden />\n <span>{t('messages.folder.selector', 'Folder')}:</span>\n <span>{activeFolderOption.label}</span>\n <ChevronDown className=\"h-4 w-4 opacity-70\" aria-hidden />\n </Button>\n {folderMenuOpen ? (\n <div\n className=\"absolute right-0 z-dropdown mt-1 min-w-52 rounded-md border bg-background p-1 shadow\"\n role=\"menu\"\n >\n {folderOptions.map((option) => {\n const Icon = option.icon\n const isActive = option.id === folder\n return (\n <Button\n key={option.id}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"menuitemradio\"\n aria-checked={isActive}\n className={`w-full justify-start h-auto px-2 py-1.5 text-sm font-normal ${isActive ? 'bg-accent/60' : ''}`}\n onClick={() => {\n setFolder(option.id)\n setPage(1)\n setFolderMenuOpen(false)\n }}\n >\n <Icon className=\"h-4 w-4\" aria-hidden />\n <span>{option.label}</span>\n </Button>\n )\n })}\n </div>\n ) : null}\n </div>\n <Button asChild>\n <Link href=\"/backend/messages/compose\">{t('messages.compose', 'Compose message')}</Link>\n </Button>\n </div>\n }\n onRowClick={(row) => {\n router.push(`/backend/messages/${row.id}`)\n }}\n emptyState={(\n <ListEmptyState\n entityName={t('messages.title', 'Messages')}\n createHref=\"/backend/messages/compose\"\n createLabel={t('messages.compose', 'Compose message')}\n />\n )}\n embedded\n />\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { extensionPoints } from '@open-mercato/core/modules/messages/extension-points'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useAppEvent } from '@open-mercato/ui/backend/injection/useAppEvent'\nimport { Archive, ChevronDown, FilePenLine, Inbox, Layers, Send } from 'lucide-react'\nimport { getMessageUiComponentRegistry } from './utils/typeUiRegistry'\nimport { DefaultMessageListItem } from './defaults/DefaultMessageListItem'\nimport { getMessageListParticipantLabel } from './messageListLabels'\nimport { toErrorMessage } from './message-detail/utils'\nimport { useMessagesInboxBulkActions, type MessageFolder } from './useMessagesInboxBulkActions'\nimport {\n buildMessagesInboxFilters,\n buildMessagesListParams,\n buildSenderOptionsFromMessages,\n type SenderOption,\n} from './inboxFilters'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('messages').child({ component: 'MessagesInboxPageClient' })\n\ntype MessageListItem = {\n id: string\n type: string\n subject: string\n bodyPreview: string\n senderUserId: string\n senderName?: string | null\n senderEmail?: string | null\n externalName?: string | null\n externalEmail?: string | null\n sourceEntityType?: string | null\n priority: string\n status: string\n hasObjects: boolean\n objectCount: number\n hasAttachments: boolean\n attachmentCount: number\n recipientCount?: number\n hasActions: boolean\n actionTaken?: string | null\n sentAt?: string | null\n readAt?: string | null\n threadId?: string | null\n}\n\ntype MessageListResponse = {\n items?: MessageListItem[]\n total?: number\n page?: number\n pageSize?: number\n totalPages?: number\n totalIsCapped?: boolean\n}\n\ntype MessageTypeItem = {\n type: string\n module: string\n labelKey: string\n ui?: {\n listItemComponent?: string | null\n } | null\n}\n\ntype UserListItem = {\n id: string\n email?: string | null\n name?: string | null\n}\n\nexport function MessagesInboxPageClient() {\n const router = useRouter()\n const t = useT()\n const queryClient = useQueryClient()\n const scopeVersion = useOrganizationScopeVersion()\n\n const invalidateMessageListQueries = React.useCallback(() => {\n void queryClient.invalidateQueries({ queryKey: ['messages', 'list'] })\n }, [queryClient])\n\n useAppEvent('messages.message.*', invalidateMessageListQueries, [invalidateMessageListQueries])\n\n useAppEvent('om:bridge:reconnected', invalidateMessageListQueries, [invalidateMessageListQueries])\n\n const [folder, setFolder] = React.useState<MessageFolder>('inbox')\n const [folderMenuOpen, setFolderMenuOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [page, setPage] = React.useState(1)\n const pageSize = 20\n const folderMenuRef = React.useRef<HTMLDivElement | null>(null)\n const messageUiRegistry = React.useMemo(() => getMessageUiComponentRegistry(), [])\n const { bulkActions, selectionScopeKey, injectionContext, ConfirmDialogElement } = useMessagesInboxBulkActions<MessageListItem>({\n folder,\n page,\n search,\n filterValues,\n })\n\n const listQuery = useQuery({\n queryKey: [\n 'messages',\n 'list',\n folder,\n search,\n page,\n pageSize,\n JSON.stringify(filterValues),\n scopeVersion,\n ],\n queryFn: async () => {\n const params = buildMessagesListParams({\n folder,\n page,\n pageSize,\n search,\n filterValues,\n })\n\n const call = await apiCall<MessageListResponse>(`/api/messages?${params.toString()}`)\n if (!call.ok) {\n throw new Error(\n toErrorMessage(call.result)\n ?? t('messages.errors.loadListFailed', 'Failed to load messages.'),\n )\n }\n\n return {\n items: Array.isArray(call.result?.items) ? call.result?.items ?? [] : [],\n total: Number(call.result?.total ?? 0),\n page: Number(call.result?.page ?? page),\n pageSize: Number(call.result?.pageSize ?? pageSize),\n totalPages: Number(call.result?.totalPages ?? 0),\n totalIsCapped: call.result?.totalIsCapped === true,\n }\n },\n })\n\n const messageTypesQuery = useQuery({\n queryKey: ['messages', 'types', scopeVersion],\n queryFn: async () => {\n const call = await apiCall<{ items?: MessageTypeItem[] }>('/api/messages/types')\n if (!call.ok) {\n throw new Error(\n toErrorMessage(call.result)\n ?? t('messages.errors.loadTypesFailed', 'Failed to load message types.'),\n )\n }\n return Array.isArray(call.result?.items) ? call.result?.items ?? [] : []\n },\n })\n\n React.useEffect(() => {\n if (!listQuery.error) return\n flash(\n listQuery.error instanceof Error\n ? listQuery.error.message\n : t('messages.errors.loadListFailed', 'Failed to load messages.'),\n 'error',\n )\n }, [listQuery.error, t])\n\n React.useEffect(() => {\n if (!messageTypesQuery.error) return\n flash(\n messageTypesQuery.error instanceof Error\n ? messageTypesQuery.error.message\n : t('messages.errors.loadTypesFailed', 'Failed to load message types.'),\n 'error',\n )\n }, [messageTypesQuery.error, t])\n\n const messageTypeLabelMap = React.useMemo(() => {\n const map: Record<string, string> = {}\n for (const item of messageTypesQuery.data ?? []) {\n map[item.type] = t(item.labelKey, item.type)\n }\n return map\n }, [messageTypesQuery.data, t])\n\n const [senderOptions, setSenderOptions] = React.useState<SenderOption[]>([])\n const senderOptionsScopeRef = React.useRef(scopeVersion)\n\n const mergeSenderOptions = React.useCallback((incoming: SenderOption[]) => {\n if (incoming.length === 0) return\n setSenderOptions((prev) => {\n const map = new Map<string, SenderOption>()\n for (const opt of prev) map.set(opt.value, opt)\n for (const opt of incoming) map.set(opt.value, opt)\n return Array.from(map.values())\n })\n }, [])\n\n const loadSenderOptions = React.useCallback(async (query?: string) => {\n const params = new URLSearchParams()\n params.set('page', '1')\n params.set('pageSize', '20')\n if (query && query.trim().length > 0) {\n params.set('search', query.trim())\n }\n\n const call = await apiCall<{ items?: UserListItem[] }>(\n `/api/auth/users?${params.toString()}`,\n {\n headers: {\n 'x-om-forbidden-redirect': '0',\n },\n },\n ).catch(() => null)\n if (!call) return []\n if (!call.ok) return []\n\n const items = Array.isArray(call.result?.items) ? call.result?.items ?? [] : []\n const next: SenderOption[] = items.flatMap((item) => {\n if (!item || typeof item.id !== 'string' || item.id.trim().length === 0) return []\n const name = typeof item.name === 'string' && item.name.trim().length > 0 ? item.name.trim() : null\n const email = typeof item.email === 'string' && item.email.trim().length > 0 ? item.email.trim() : null\n const label = name ?? email ?? item.id\n return [{\n value: item.id,\n label,\n description: email && email !== label ? email : null,\n }]\n })\n if (senderOptionsScopeRef.current === scopeVersion) {\n mergeSenderOptions(next)\n }\n return next\n }, [mergeSenderOptions, scopeVersion])\n\n React.useEffect(() => {\n const items = listQuery.data?.items ?? []\n mergeSenderOptions(buildSenderOptionsFromMessages(items))\n }, [listQuery.data?.items, mergeSenderOptions])\n\n React.useEffect(() => {\n senderOptionsScopeRef.current = scopeVersion\n setSenderOptions([])\n loadSenderOptions().catch((error: unknown) => {\n logger.warn('Failed to load sender filter options', { err: error })\n })\n }, [loadSenderOptions, scopeVersion])\n\n const listItemComponentKeyByType = React.useMemo(() => {\n const map: Record<string, string | null> = {}\n for (const item of messageTypesQuery.data ?? []) {\n map[item.type] = item.ui?.listItemComponent ?? null\n }\n return map\n }, [messageTypesQuery.data])\n\n const filters = React.useMemo<FilterDef[]>(() => {\n const typeOptions = (messageTypesQuery.data ?? []).map((item) => ({\n value: item.type,\n label: t(item.labelKey, item.type),\n }))\n\n return buildMessagesInboxFilters({\n t,\n typeOptions,\n senderOptions,\n loadSenderOptions,\n })\n }, [loadSenderOptions, messageTypesQuery.data, senderOptions, t])\n\n const columns = React.useMemo<ColumnDef<MessageListItem>[]>(() => [\n {\n accessorKey: 'message',\n header: t('messages.title', 'Messages'),\n meta: {\n truncate: false,\n maxWidth: '100%',\n },\n cell: ({ row }) => {\n const item = row.original\n const listItemComponentKey = listItemComponentKeyByType[item.type]\n const ListItemComponent = listItemComponentKey\n ? messageUiRegistry.listItemComponents[listItemComponentKey] ?? null\n : null\n const ComponentToUse = ListItemComponent || DefaultMessageListItem\n\n return (\n <ComponentToUse\n message={{\n id: item.id,\n type: item.type,\n typeLabel: messageTypeLabelMap[item.type] ?? item.type,\n subject: item.subject,\n body: item.bodyPreview,\n bodyFormat: 'text' as const,\n priority: (item.priority as 'low' | 'normal' | 'high' | 'urgent') ?? 'normal',\n sentAt: item.sentAt ? new Date(item.sentAt) : null,\n senderName: getMessageListParticipantLabel(item, folder, t),\n hasObjects: item.hasObjects,\n objectCount: item.objectCount,\n hasAttachments: item.hasAttachments,\n attachmentCount: item.attachmentCount,\n recipientCount: item.recipientCount ?? 0,\n hasActions: item.hasActions,\n actionTaken: item.actionTaken ?? null,\n unread: item.status === 'unread',\n }}\n onClick={() => router.push(`/backend/messages/${item.id}`)}\n />\n )\n },\n },\n ], [folder, listItemComponentKeyByType, messageTypeLabelMap, messageUiRegistry, router, t])\n\n const folderOptions = React.useMemo(() => [\n { id: 'inbox' as const, label: t('messages.folder.inbox', 'Inbox'), icon: Inbox },\n { id: 'sent' as const, label: t('messages.folder.sent', 'Sent'), icon: Send },\n { id: 'drafts' as const, label: t('messages.folder.drafts', 'Drafts'), icon: FilePenLine },\n { id: 'archived' as const, label: t('messages.folder.archived', 'Archived'), icon: Archive },\n { id: 'all' as const, label: t('messages.folder.all', 'All'), icon: Layers },\n ], [t])\n\n const activeFolderOption = folderOptions.find((option) => option.id === folder) ?? folderOptions[0]\n const ActiveFolderIcon = activeFolderOption.icon\n\n React.useEffect(() => {\n if (!folderMenuOpen) return\n const handleClickOutside = (event: MouseEvent) => {\n if (!folderMenuRef.current) return\n const target = event.target\n if (target instanceof Node && !folderMenuRef.current.contains(target)) {\n setFolderMenuOpen(false)\n }\n }\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') setFolderMenuOpen(false)\n }\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleEscape)\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleEscape)\n }\n }, [folderMenuOpen])\n\n const rows = listQuery.data?.items ?? []\n const total = listQuery.data?.total ?? 0\n const totalIsCapped = listQuery.data?.totalIsCapped === true\n const totalPages = listQuery.data?.totalPages ?? 0\n\n return (\n <div className=\"space-y-4\">\n <DataTable\n title={t('messages.title', 'Messages')}\n // UMES extension surface \u2014 opt into widget injection at:\n // data-table:messages:columns / :row-actions / :bulk-actions / :filters / :toolbar / :search-trailing\n // (SPEC-045d \u00A79.3a \u2014 communication_channels hub renders channel badge + delivery status here)\n extensionTableId={extensionPoints.hosts.inboxTable.tableId}\n columns={columns}\n data={rows}\n bulkActions={bulkActions}\n selectionScopeKey={selectionScopeKey}\n searchValue={search}\n onSearchChange={(value) => {\n setSearch(value)\n setPage(1)\n }}\n searchPlaceholder={t('messages.searchPlaceholder', 'Search messages')}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={(value) => {\n setFilterValues(value)\n setPage(1)\n }}\n onFiltersClear={() => {\n setFilterValues({})\n setPage(1)\n }}\n injectionContext={injectionContext}\n isLoading={listQuery.isLoading || listQuery.isFetching}\n pagination={{\n page,\n pageSize,\n total,\n totalPages,\n totalIsCapped,\n onPageChange: setPage,\n }}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <div className=\"relative\" ref={folderMenuRef}>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"gap-2\"\n aria-expanded={folderMenuOpen}\n aria-haspopup=\"menu\"\n onClick={() => setFolderMenuOpen((value) => !value)}\n >\n <ActiveFolderIcon className=\"h-4 w-4\" aria-hidden />\n <span>{t('messages.folder.selector', 'Folder')}:</span>\n <span>{activeFolderOption.label}</span>\n <ChevronDown className=\"h-4 w-4 opacity-70\" aria-hidden />\n </Button>\n {folderMenuOpen ? (\n <div\n className=\"absolute right-0 z-dropdown mt-1 min-w-52 rounded-md border bg-background p-1 shadow\"\n role=\"menu\"\n >\n {folderOptions.map((option) => {\n const Icon = option.icon\n const isActive = option.id === folder\n return (\n <Button\n key={option.id}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"menuitemradio\"\n aria-checked={isActive}\n className={`w-full justify-start h-auto px-2 py-1.5 text-sm font-normal ${isActive ? 'bg-accent/60' : ''}`}\n onClick={() => {\n setFolder(option.id)\n setPage(1)\n setFolderMenuOpen(false)\n }}\n >\n <Icon className=\"h-4 w-4\" aria-hidden />\n <span>{option.label}</span>\n </Button>\n )\n })}\n </div>\n ) : null}\n </div>\n <Button asChild>\n <Link href=\"/backend/messages/compose\">{t('messages.compose', 'Compose message')}</Link>\n </Button>\n </div>\n }\n onRowClick={(row) => {\n router.push(`/backend/messages/${row.id}`)\n }}\n emptyState={(\n <ListEmptyState\n entityName={t('messages.title', 'Messages')}\n createHref=\"/backend/messages/compose\"\n createLabel={t('messages.compose', 'Compose message')}\n />\n )}\n embedded\n />\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAsSU,cAkHM,YAlHN;AApSV,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,UAAU,sBAAsB;AAEzC,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAC5C,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAE/B,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,SAAS,aAAa,aAAa,OAAO,QAAQ,YAAY;AACvE,SAAS,qCAAqC;AAC9C,SAAS,8BAA8B;AACvC,SAAS,sCAAsC;AAC/C,SAAS,sBAAsB;AAC/B,SAAS,mCAAuD;AAChE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,UAAU,EAAE,MAAM,EAAE,WAAW,0BAA0B,CAAC;AAmD/E,SAAS,0BAA0B;AACxC,QAAM,SAAS,UAAU;AACzB,QAAM,IAAI,KAAK;AACf,QAAM,cAAc,eAAe;AACnC,QAAM,eAAe,4BAA4B;AAEjD,QAAM,+BAA+B,MAAM,YAAY,MAAM;AAC3D,SAAK,YAAY,kBAAkB,EAAE,UAAU,CAAC,YAAY,MAAM,EAAE,CAAC;AAAA,EACvE,GAAG,CAAC,WAAW,CAAC;AAEhB,cAAY,sBAAsB,8BAA8B,CAAC,4BAA4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ptionsFromMessages(items) {
|
|
2
|
+
return items.flatMap((item) => {
|
|
3
|
+
if (typeof item.senderUserId !== "string" || item.senderUserId.trim().length === 0) return [];
|
|
4
|
+
const name = typeof item.senderName === "string" && item.senderName.trim().length > 0 ? item.senderName.trim() : null;
|
|
5
|
+
const email = typeof item.senderEmail === "string" && item.senderEmail.trim().length > 0 ? item.senderEmail.trim() : null;
|
|
6
|
+
const label = name ?? email;
|
|
7
|
+
if (!label) return [];
|
|
8
|
+
return [{
|
|
9
|
+
value: item.senderUserId,
|
|
10
|
+
label,
|
|
11
|
+
description: email && email !== label ? email : null
|
|
12
|
+
}];
|
|
13
|
+
});
|
|
14
|
+
}
|
|
1
15
|
function buildMessagesInboxFilters({
|
|
2
16
|
t,
|
|
3
17
|
typeOptions,
|
|
@@ -130,6 +144,7 @@ function buildMessagesListParams({
|
|
|
130
144
|
export {
|
|
131
145
|
buildMessagesInboxFilters,
|
|
132
146
|
buildMessagesListParams,
|
|
147
|
+
buildSenderOptionsFromMessages,
|
|
133
148
|
normalizeMessagesSinceValue
|
|
134
149
|
};
|
|
135
150
|
//# sourceMappingURL=inboxFilters.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/messages/components/inboxFilters.ts"],
|
|
4
|
-
"sourcesContent": ["import type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\n\ntype Translator = (key: string, fallback?: string) => string\n\nexport type SenderOption = {\n value: string\n label: string\n description?: string | null\n}\n\nexport type MessagesInboxFilterContext = {\n t: Translator\n typeOptions: { value: string; label: string }[]\n senderOptions: SenderOption[]\n loadSenderOptions: (query?: string) => Promise<SenderOption[]>\n}\n\nexport function buildMessagesInboxFilters({\n t,\n typeOptions,\n senderOptions,\n loadSenderOptions,\n}: MessagesInboxFilterContext): FilterDef[] {\n const senderLabel = (val: string): string => {\n const match = senderOptions.find((opt) => opt.value === val)\n return match?.label ?? val\n }\n\n return [\n {\n id: 'status',\n label: t('messages.filters.status', 'Status'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'unread', label: t('messages.status.unread', 'Unread') },\n { value: 'read', label: t('messages.status.read', 'Read') },\n { value: 'archived', label: t('messages.status.archived', 'Archived') },\n ],\n },\n {\n id: 'type',\n label: t('messages.filters.type', 'Type'),\n type: 'select',\n options: [{ value: '', label: t('messages.filters.all', 'All') }, ...typeOptions],\n },\n {\n id: 'hasObjects',\n label: t('messages.filters.hasObjects', 'Has related records'),\n tooltip: t('messages.filters.hasObjectsTooltip', 'Shows messages that have Open Mercato records attached \u2014 such as orders, quotes, or customers.'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'true', label: t('common.yes', 'Yes') },\n { value: 'false', label: t('common.no', 'No') },\n ],\n },\n {\n id: 'hasAttachments',\n label: t('messages.filters.hasAttachments', 'Has attachments'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'true', label: t('common.yes', 'Yes') },\n { value: 'false', label: t('common.no', 'No') },\n ],\n },\n {\n id: 'hasActions',\n label: t('messages.filters.hasActions', 'Has action requests'),\n tooltip: t('messages.filters.hasActionsTooltip', 'Shows messages where one or more attached records require a response (approval, rejection, or review).'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'true', label: t('common.yes', 'Yes') },\n { value: 'false', label: t('common.no', 'No') },\n ],\n },\n {\n id: 'senderId',\n label: t('messages.filters.sender', 'Sender'),\n type: 'combobox',\n placeholder: t('messages.filters.senderEmpty', 'Type to search users'),\n options: senderOptions,\n loadOptions: loadSenderOptions,\n formatValue: senderLabel,\n formatDescription: (val: string) =>\n senderOptions.find((opt) => opt.value === val)?.description ?? null,\n },\n {\n id: 'since',\n label: t('messages.filters.since', 'Sent after'),\n type: 'text',\n placeholder: t('messages.filters.sincePlaceholder', 'YYYY-MM-DD'),\n },\n ]\n}\n\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/\n\nexport function normalizeMessagesSinceValue(input: string): string | null {\n const trimmed = input.trim()\n if (!trimmed) return null\n if (DATE_ONLY_PATTERN.test(trimmed)) {\n const parsed = new Date(`${trimmed}T00:00:00.000Z`)\n if (Number.isNaN(parsed.getTime())) return null\n if (parsed.toISOString().slice(0, 10) !== trimmed) return null\n return parsed.toISOString()\n }\n const parsed = new Date(trimmed)\n if (Number.isNaN(parsed.getTime())) return null\n return parsed.toISOString()\n}\n\nexport type BuildMessagesListParamsOptions = {\n folder: string\n page: number\n pageSize: number\n search: string\n filterValues: FilterValues\n}\n\nexport function buildMessagesListParams({\n folder,\n page,\n pageSize,\n search,\n filterValues,\n}: BuildMessagesListParamsOptions): URLSearchParams {\n const params = new URLSearchParams()\n params.set('folder', folder)\n params.set('page', String(page))\n params.set('pageSize', String(pageSize))\n\n if (search.trim()) {\n params.set('search', search.trim())\n }\n\n const stringValue = (id: string): string => {\n const raw = filterValues[id]\n return typeof raw === 'string' ? raw.trim() : ''\n }\n\n const status = stringValue('status')\n const type = stringValue('type')\n const hasObjects = stringValue('hasObjects')\n const hasAttachments = stringValue('hasAttachments')\n const hasActions = stringValue('hasActions')\n const senderId = stringValue('senderId')\n const sinceRaw = stringValue('since')\n\n if (status) params.set('status', status)\n if (type) params.set('type', type)\n if (hasObjects) params.set('hasObjects', hasObjects)\n if (hasAttachments) params.set('hasAttachments', hasAttachments)\n if (hasActions) params.set('hasActions', hasActions)\n if (senderId) params.set('senderId', senderId)\n if (sinceRaw) {\n const normalized = normalizeMessagesSinceValue(sinceRaw)\n if (normalized) params.set('since', normalized)\n }\n\n return params\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\n\ntype Translator = (key: string, fallback?: string) => string\n\nexport type SenderOption = {\n value: string\n label: string\n description?: string | null\n}\n\ntype SenderOptionSource = {\n senderUserId?: string | null\n senderName?: string | null\n senderEmail?: string | null\n}\n\n/**\n * Sender-filter options derived from the rows currently in the list.\n *\n * The filter narrows by `senderUserId`, so a row only yields an honest option\n * when it also carries the platform identity behind that id. Ingested external\n * mail does not: every such message in a tenant is composed under one\n * system-user id, so labelling that id with one external sender's name would\n * collapse every external sender into a single option that quietly returns all\n * of their mail. Those rows are skipped, and the directory-loaded options \u2014\n * which are real platform users \u2014 stand alone.\n */\nexport function buildSenderOptionsFromMessages(items: SenderOptionSource[]): SenderOption[] {\n return items.flatMap((item): SenderOption[] => {\n if (typeof item.senderUserId !== 'string' || item.senderUserId.trim().length === 0) return []\n const name = typeof item.senderName === 'string' && item.senderName.trim().length > 0\n ? item.senderName.trim()\n : null\n const email = typeof item.senderEmail === 'string' && item.senderEmail.trim().length > 0\n ? item.senderEmail.trim()\n : null\n const label = name ?? email\n if (!label) return []\n return [{\n value: item.senderUserId,\n label,\n description: email && email !== label ? email : null,\n }]\n })\n}\n\nexport type MessagesInboxFilterContext = {\n t: Translator\n typeOptions: { value: string; label: string }[]\n senderOptions: SenderOption[]\n loadSenderOptions: (query?: string) => Promise<SenderOption[]>\n}\n\nexport function buildMessagesInboxFilters({\n t,\n typeOptions,\n senderOptions,\n loadSenderOptions,\n}: MessagesInboxFilterContext): FilterDef[] {\n const senderLabel = (val: string): string => {\n const match = senderOptions.find((opt) => opt.value === val)\n return match?.label ?? val\n }\n\n return [\n {\n id: 'status',\n label: t('messages.filters.status', 'Status'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'unread', label: t('messages.status.unread', 'Unread') },\n { value: 'read', label: t('messages.status.read', 'Read') },\n { value: 'archived', label: t('messages.status.archived', 'Archived') },\n ],\n },\n {\n id: 'type',\n label: t('messages.filters.type', 'Type'),\n type: 'select',\n options: [{ value: '', label: t('messages.filters.all', 'All') }, ...typeOptions],\n },\n {\n id: 'hasObjects',\n label: t('messages.filters.hasObjects', 'Has related records'),\n tooltip: t('messages.filters.hasObjectsTooltip', 'Shows messages that have Open Mercato records attached \u2014 such as orders, quotes, or customers.'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'true', label: t('common.yes', 'Yes') },\n { value: 'false', label: t('common.no', 'No') },\n ],\n },\n {\n id: 'hasAttachments',\n label: t('messages.filters.hasAttachments', 'Has attachments'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'true', label: t('common.yes', 'Yes') },\n { value: 'false', label: t('common.no', 'No') },\n ],\n },\n {\n id: 'hasActions',\n label: t('messages.filters.hasActions', 'Has action requests'),\n tooltip: t('messages.filters.hasActionsTooltip', 'Shows messages where one or more attached records require a response (approval, rejection, or review).'),\n type: 'select',\n options: [\n { value: '', label: t('messages.filters.all', 'All') },\n { value: 'true', label: t('common.yes', 'Yes') },\n { value: 'false', label: t('common.no', 'No') },\n ],\n },\n {\n id: 'senderId',\n label: t('messages.filters.sender', 'Sender'),\n type: 'combobox',\n placeholder: t('messages.filters.senderEmpty', 'Type to search users'),\n options: senderOptions,\n loadOptions: loadSenderOptions,\n formatValue: senderLabel,\n formatDescription: (val: string) =>\n senderOptions.find((opt) => opt.value === val)?.description ?? null,\n },\n {\n id: 'since',\n label: t('messages.filters.since', 'Sent after'),\n type: 'text',\n placeholder: t('messages.filters.sincePlaceholder', 'YYYY-MM-DD'),\n },\n ]\n}\n\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/\n\nexport function normalizeMessagesSinceValue(input: string): string | null {\n const trimmed = input.trim()\n if (!trimmed) return null\n if (DATE_ONLY_PATTERN.test(trimmed)) {\n const parsed = new Date(`${trimmed}T00:00:00.000Z`)\n if (Number.isNaN(parsed.getTime())) return null\n if (parsed.toISOString().slice(0, 10) !== trimmed) return null\n return parsed.toISOString()\n }\n const parsed = new Date(trimmed)\n if (Number.isNaN(parsed.getTime())) return null\n return parsed.toISOString()\n}\n\nexport type BuildMessagesListParamsOptions = {\n folder: string\n page: number\n pageSize: number\n search: string\n filterValues: FilterValues\n}\n\nexport function buildMessagesListParams({\n folder,\n page,\n pageSize,\n search,\n filterValues,\n}: BuildMessagesListParamsOptions): URLSearchParams {\n const params = new URLSearchParams()\n params.set('folder', folder)\n params.set('page', String(page))\n params.set('pageSize', String(pageSize))\n\n if (search.trim()) {\n params.set('search', search.trim())\n }\n\n const stringValue = (id: string): string => {\n const raw = filterValues[id]\n return typeof raw === 'string' ? raw.trim() : ''\n }\n\n const status = stringValue('status')\n const type = stringValue('type')\n const hasObjects = stringValue('hasObjects')\n const hasAttachments = stringValue('hasAttachments')\n const hasActions = stringValue('hasActions')\n const senderId = stringValue('senderId')\n const sinceRaw = stringValue('since')\n\n if (status) params.set('status', status)\n if (type) params.set('type', type)\n if (hasObjects) params.set('hasObjects', hasObjects)\n if (hasAttachments) params.set('hasAttachments', hasAttachments)\n if (hasActions) params.set('hasActions', hasActions)\n if (senderId) params.set('senderId', senderId)\n if (sinceRaw) {\n const normalized = normalizeMessagesSinceValue(sinceRaw)\n if (normalized) params.set('since', normalized)\n }\n\n return params\n}\n"],
|
|
5
|
+
"mappings": "AA2BO,SAAS,+BAA+B,OAA6C;AAC1F,SAAO,MAAM,QAAQ,CAAC,SAAyB;AAC7C,QAAI,OAAO,KAAK,iBAAiB,YAAY,KAAK,aAAa,KAAK,EAAE,WAAW,EAAG,QAAO,CAAC;AAC5F,UAAM,OAAO,OAAO,KAAK,eAAe,YAAY,KAAK,WAAW,KAAK,EAAE,SAAS,IAChF,KAAK,WAAW,KAAK,IACrB;AACJ,UAAM,QAAQ,OAAO,KAAK,gBAAgB,YAAY,KAAK,YAAY,KAAK,EAAE,SAAS,IACnF,KAAK,YAAY,KAAK,IACtB;AACJ,UAAM,QAAQ,QAAQ;AACtB,QAAI,CAAC,MAAO,QAAO,CAAC;AACpB,WAAO,CAAC;AAAA,MACN,OAAO,KAAK;AAAA,MACZ;AAAA,MACA,aAAa,SAAS,UAAU,QAAQ,QAAQ;AAAA,IAClD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AI,UAAU;AACZ,UAAM,aAAa,4BAA4B,QAAQ;AACvD,QAAI,WAAY,QAAO,IAAI,SAAS,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": ["parsed"]
|
|
7
7
|
}
|
package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { getMessageParticipantLabel } from "../../messageListLabels.js";
|
|
3
4
|
function useMessageDetailsConversation({
|
|
4
5
|
detail,
|
|
5
6
|
t
|
|
@@ -12,6 +13,9 @@ function useMessageDetailsConversation({
|
|
|
12
13
|
senderUserId: detail.senderUserId,
|
|
13
14
|
senderName: detail.senderName,
|
|
14
15
|
senderEmail: detail.senderEmail,
|
|
16
|
+
externalName: detail.externalName,
|
|
17
|
+
externalEmail: detail.externalEmail,
|
|
18
|
+
sourceEntityType: detail.sourceEntityType,
|
|
15
19
|
body: detail.body,
|
|
16
20
|
bodyFormat: detail.bodyFormat,
|
|
17
21
|
sentAt: detail.sentAt,
|
|
@@ -23,6 +27,9 @@ function useMessageDetailsConversation({
|
|
|
23
27
|
senderUserId: item.senderUserId,
|
|
24
28
|
senderName: item.senderName,
|
|
25
29
|
senderEmail: item.senderEmail,
|
|
30
|
+
externalName: item.externalName,
|
|
31
|
+
externalEmail: item.externalEmail,
|
|
32
|
+
sourceEntityType: item.sourceEntityType,
|
|
26
33
|
body: item.body,
|
|
27
34
|
bodyFormat: item.bodyFormat,
|
|
28
35
|
sentAt: item.sentAt,
|
|
@@ -34,6 +41,9 @@ function useMessageDetailsConversation({
|
|
|
34
41
|
senderUserId: detail.senderUserId,
|
|
35
42
|
senderName: detail.senderName,
|
|
36
43
|
senderEmail: detail.senderEmail,
|
|
44
|
+
externalName: detail.externalName,
|
|
45
|
+
externalEmail: detail.externalEmail,
|
|
46
|
+
sourceEntityType: detail.sourceEntityType,
|
|
37
47
|
body: detail.body,
|
|
38
48
|
bodyFormat: detail.bodyFormat,
|
|
39
49
|
sentAt: detail.sentAt,
|
|
@@ -80,7 +90,7 @@ function useMessageDetailsConversation({
|
|
|
80
90
|
bodyFormat: item.bodyFormat ?? "text",
|
|
81
91
|
priority: "normal",
|
|
82
92
|
sentAt: item.sentAt ? new Date(item.sentAt) : null,
|
|
83
|
-
senderName: item
|
|
93
|
+
senderName: getMessageParticipantLabel(item),
|
|
84
94
|
hasObjects: (item.objects ?? []).length > 0,
|
|
85
95
|
objectCount: (item.objects ?? []).length,
|
|
86
96
|
hasAttachments: false,
|
package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.ts"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport type { TranslateFn } from '@open-mercato/shared/lib/i18n/context'\nimport type { MessageListItemProps } from '@open-mercato/shared/modules/messages/types'\nimport type { MessageDetail } from '../types'\n\nexport type ConversationItem = {\n id: string\n senderUserId: string\n senderName?: string | null\n senderEmail?: string | null\n body: string\n bodyFormat?: 'text' | 'markdown'\n sentAt?: string | null\n objects?: Array<{ id: string }>\n}\n\ntype UseMessageDetailsConversationInput = {\n detail: MessageDetail | null\n t: TranslateFn\n}\n\nexport function useMessageDetailsConversation({\n detail,\n t,\n}: UseMessageDetailsConversationInput) {\n const conversationItems = React.useMemo<ConversationItem[]>(() => {\n const thread = detail?.thread ?? []\n if (thread.length === 0 && detail) {\n return [{\n id: detail.id,\n senderUserId: detail.senderUserId,\n senderName: detail.senderName,\n senderEmail: detail.senderEmail,\n body: detail.body,\n bodyFormat: detail.bodyFormat,\n sentAt: detail.sentAt,\n objects: detail.objects.map((item) => ({ id: item.id })),\n }]\n }\n\n const items = thread\n .map((item) => ({\n id: item.id,\n senderUserId: item.senderUserId,\n senderName: item.senderName,\n senderEmail: item.senderEmail,\n body: item.body,\n bodyFormat: item.bodyFormat,\n sentAt: item.sentAt,\n objects: item.objects?.map((entry) => ({ id: entry.id })) ?? [],\n }))\n\n if (detail && !items.some((item) => item.id === detail.id)) {\n items.push({\n id: detail.id,\n senderUserId: detail.senderUserId,\n senderName: detail.senderName,\n senderEmail: detail.senderEmail,\n body: detail.body,\n bodyFormat: detail.bodyFormat,\n sentAt: detail.sentAt,\n objects: detail.objects.map((entry) => ({ id: entry.id })),\n })\n }\n\n items.sort((a, b) => {\n const aTime = a.sentAt ? new Date(a.sentAt).getTime() : 0\n const bTime = b.sentAt ? new Date(b.sentAt).getTime() : 0\n return aTime - bTime\n })\n\n return items\n }, [detail])\n\n const forcedExpandedItemId = conversationItems.length > 0\n ? conversationItems[conversationItems.length - 1].id\n : null\n\n const [expandedById, setExpandedById] = React.useState<Record<string, boolean>>({})\n const conversationIdsKey = React.useMemo(\n () => conversationItems.map((item) => item.id).join('|'),\n [conversationItems],\n )\n\n React.useEffect(() => {\n const nextState: Record<string, boolean> = {}\n for (const item of conversationItems) {\n nextState[item.id] = forcedExpandedItemId === item.id\n }\n setExpandedById(nextState)\n }, [conversationIdsKey, conversationItems, forcedExpandedItemId])\n\n const toggleConversationItem = React.useCallback((itemId: string) => {\n if (itemId === forcedExpandedItemId) return\n setExpandedById((previous) => ({\n ...previous,\n [itemId]: !previous[itemId],\n }))\n }, [forcedExpandedItemId])\n\n const isConversationItemExpanded = React.useCallback((itemId: string) => {\n if (itemId === forcedExpandedItemId) return true\n return Boolean(expandedById[itemId])\n }, [expandedById, forcedExpandedItemId])\n\n const buildConversationListItemMessage = React.useCallback((item: ConversationItem): MessageListItemProps['message'] => ({\n id: item.id,\n type: detail?.type ?? 'default',\n typeLabel: detail ? t(detail.typeDefinition.labelKey, detail.type) : undefined,\n subject: detail?.subject ?? '',\n body: item.body,\n bodyFormat: item.bodyFormat ?? 'text',\n priority: 'normal',\n sentAt: item.sentAt ? new Date(item.sentAt) : null,\n senderName: item
|
|
5
|
-
"mappings": ";AAEA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport type { TranslateFn } from '@open-mercato/shared/lib/i18n/context'\nimport type { MessageListItemProps } from '@open-mercato/shared/modules/messages/types'\nimport type { MessageDetail } from '../types'\nimport { getMessageParticipantLabel } from '../../messageListLabels'\n\nexport type ConversationItem = {\n id: string\n senderUserId: string\n senderName?: string | null\n senderEmail?: string | null\n externalName?: string | null\n externalEmail?: string | null\n sourceEntityType?: string | null\n body: string\n bodyFormat?: 'text' | 'markdown'\n sentAt?: string | null\n objects?: Array<{ id: string }>\n}\n\ntype UseMessageDetailsConversationInput = {\n detail: MessageDetail | null\n t: TranslateFn\n}\n\nexport function useMessageDetailsConversation({\n detail,\n t,\n}: UseMessageDetailsConversationInput) {\n const conversationItems = React.useMemo<ConversationItem[]>(() => {\n const thread = detail?.thread ?? []\n if (thread.length === 0 && detail) {\n return [{\n id: detail.id,\n senderUserId: detail.senderUserId,\n senderName: detail.senderName,\n senderEmail: detail.senderEmail,\n externalName: detail.externalName,\n externalEmail: detail.externalEmail,\n sourceEntityType: detail.sourceEntityType,\n body: detail.body,\n bodyFormat: detail.bodyFormat,\n sentAt: detail.sentAt,\n objects: detail.objects.map((item) => ({ id: item.id })),\n }]\n }\n\n const items = thread\n .map((item) => ({\n id: item.id,\n senderUserId: item.senderUserId,\n senderName: item.senderName,\n senderEmail: item.senderEmail,\n externalName: item.externalName,\n externalEmail: item.externalEmail,\n sourceEntityType: item.sourceEntityType,\n body: item.body,\n bodyFormat: item.bodyFormat,\n sentAt: item.sentAt,\n objects: item.objects?.map((entry) => ({ id: entry.id })) ?? [],\n }))\n\n if (detail && !items.some((item) => item.id === detail.id)) {\n items.push({\n id: detail.id,\n senderUserId: detail.senderUserId,\n senderName: detail.senderName,\n senderEmail: detail.senderEmail,\n externalName: detail.externalName,\n externalEmail: detail.externalEmail,\n sourceEntityType: detail.sourceEntityType,\n body: detail.body,\n bodyFormat: detail.bodyFormat,\n sentAt: detail.sentAt,\n objects: detail.objects.map((entry) => ({ id: entry.id })),\n })\n }\n\n items.sort((a, b) => {\n const aTime = a.sentAt ? new Date(a.sentAt).getTime() : 0\n const bTime = b.sentAt ? new Date(b.sentAt).getTime() : 0\n return aTime - bTime\n })\n\n return items\n }, [detail])\n\n const forcedExpandedItemId = conversationItems.length > 0\n ? conversationItems[conversationItems.length - 1].id\n : null\n\n const [expandedById, setExpandedById] = React.useState<Record<string, boolean>>({})\n const conversationIdsKey = React.useMemo(\n () => conversationItems.map((item) => item.id).join('|'),\n [conversationItems],\n )\n\n React.useEffect(() => {\n const nextState: Record<string, boolean> = {}\n for (const item of conversationItems) {\n nextState[item.id] = forcedExpandedItemId === item.id\n }\n setExpandedById(nextState)\n }, [conversationIdsKey, conversationItems, forcedExpandedItemId])\n\n const toggleConversationItem = React.useCallback((itemId: string) => {\n if (itemId === forcedExpandedItemId) return\n setExpandedById((previous) => ({\n ...previous,\n [itemId]: !previous[itemId],\n }))\n }, [forcedExpandedItemId])\n\n const isConversationItemExpanded = React.useCallback((itemId: string) => {\n if (itemId === forcedExpandedItemId) return true\n return Boolean(expandedById[itemId])\n }, [expandedById, forcedExpandedItemId])\n\n const buildConversationListItemMessage = React.useCallback((item: ConversationItem): MessageListItemProps['message'] => ({\n id: item.id,\n type: detail?.type ?? 'default',\n typeLabel: detail ? t(detail.typeDefinition.labelKey, detail.type) : undefined,\n subject: detail?.subject ?? '',\n body: item.body,\n bodyFormat: item.bodyFormat ?? 'text',\n priority: 'normal',\n sentAt: item.sentAt ? new Date(item.sentAt) : null,\n senderName: getMessageParticipantLabel(item),\n hasObjects: (item.objects ?? []).length > 0,\n objectCount: (item.objects ?? []).length,\n hasAttachments: false,\n attachmentCount: 0,\n hasActions: false,\n actionTaken: null,\n unread: false,\n }), [detail, t])\n\n return {\n conversationItems,\n forcedExpandedItemId,\n toggleConversationItem,\n isConvers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;AAEzB,QAAM,6BAA6B,MAAM,YAAY,CAAC,WAAmB;AACvE,QAAI,WAAW,qBAAsB,QAAO;AAC5C,WAAO,QAAQ,aAAa,MAAM,CAAC;AAAA,EACrC,GAAG,CAAC,cAAc,oBAAoB,CAAC;AAEvC,QAAM,mCAAmC,MAAM,YAAY,CAAC,UAA6D;AAAA,IACvH,IAAI,KAAK;AAAA,IACT,MAAM,QAAQ,QAAQ;AAAA,IACtB,WAAW,SAAS,EAAE,OAAO,eAAe,UAAU,OAAO,IAAI,IAAI;AAAA,IACrE,SAAS,QAAQ,WAAW;AAAA,IAC5B,MAAM,KAAK;AAAA,IACX,YAAY,KAAK,cAAc;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,IAAI;AAAA,IAC9C,YAAY,2BAA2B,IAAI;AAAA,IAC3C,aAAa,KAAK,WAAW,CAAC,GAAG,SAAS;AAAA,IAC1C,cAAc,KAAK,WAAW,CAAC,GAAG;AAAA,IAClC,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,QAAQ;AAAA,EACV,IAAI,CAAC,QAAQ,CAAC,CAAC;AAEf,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,10 +17,12 @@ import {
|
|
|
17
17
|
Trash2
|
|
18
18
|
} from "lucide-react";
|
|
19
19
|
import { formatDateTime } from "../utils.js";
|
|
20
|
+
import { getMessageParticipantLabel } from "../../messageListLabels.js";
|
|
20
21
|
function MessageHeader(props) {
|
|
21
22
|
const t = useT();
|
|
22
23
|
const showSubject = props.showSubject !== false;
|
|
23
24
|
const canReply = !props.detail.isDraft && props.detail.typeDefinition.allowReply;
|
|
25
|
+
const senderLabel = getMessageParticipantLabel(props.detail);
|
|
24
26
|
const actionItems = React.useMemo(() => {
|
|
25
27
|
const items = [];
|
|
26
28
|
if (props.detail.isDraft && props.detail.canEditDraft) {
|
|
@@ -84,7 +86,7 @@ function MessageHeader(props) {
|
|
|
84
86
|
{
|
|
85
87
|
mode: "detail",
|
|
86
88
|
title: showSubject ? props.detail.subject : void 0,
|
|
87
|
-
subtitle: `${t("messages.detail.from", "From")}: ${
|
|
89
|
+
subtitle: `${t("messages.detail.from", "From")}: ${senderLabel}`,
|
|
88
90
|
statusBadge: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: formatDateTime(props.detail.sentAt) }),
|
|
89
91
|
utilityActions: canReply ? /* @__PURE__ */ jsx(
|
|
90
92
|
IconButton,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/messages/components/message-detail/panels/MessageHeader.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { FormHeader, type ActionItem } from '@open-mercato/ui/backend/forms'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport {\n Archive,\n ArchiveRestore,\n ChevronDown,\n ChevronUp,\n FilePenLine,\n Forward,\n Mail,\n MailOpen,\n Reply,\n Trash2,\n} from 'lucide-react'\nimport type { MessageDetail } from '../types'\nimport { formatDateTime } from '../utils'\n\ntype MessageHeaderProps = {\n detail: MessageDetail\n updatingState: boolean\n isArchived: boolean\n showSubject?: boolean\n onReply: () => void\n onForward: () => void\n onEdit: () => void\n onToggleRead: () => void\n onToggleArchive: () => void\n onDelete: () => void\n collapseToggle?: {\n expanded: boolean\n onToggle: () => void\n }\n}\n\nexport function MessageHeader(props: MessageHeaderProps) {\n const t = useT()\n const showSubject = props.showSubject !== false\n const canReply = !props.detail.isDraft && props.detail.typeDefinition.allowReply\n const actionItems = React.useMemo(() => {\n const items: ActionItem[] = []\n\n if (props.detail.isDraft && props.detail.canEditDraft) {\n items.push({\n id: 'edit',\n label: t('messages.actions.edit', 'Edit'),\n icon: FilePenLine,\n onSelect: props.onEdit,\n })\n }\n\n if (!props.detail.isDraft && props.detail.typeDefinition.allowForward) {\n items.push({\n id: 'forward',\n label: t('messages.forward', 'Forward'),\n icon: Forward,\n onSelect: props.onForward,\n })\n }\n\n if (!props.detail.isDraft) {\n items.push({\n id: 'toggle-read',\n label: props.detail.isRead\n ? t('messages.actions.markUnread', 'Mark unread')\n : t('messages.actions.markRead', 'Mark read'),\n icon: props.detail.isRead ? Mail : MailOpen,\n onSelect: props.onToggleRead,\n disabled: props.updatingState,\n })\n }\n\n if (!props.detail.isDraft && props.detail.canArchive) {\n items.push({\n id: 'toggle-archive',\n label: props.isArchived\n ? t('messages.actions.unarchive', 'Unarchive')\n : t('messages.actions.archive', 'Archive'),\n icon: props.isArchived ? ArchiveRestore : Archive,\n onSelect: props.onToggleArchive,\n disabled: props.updatingState,\n })\n }\n\n items.push({\n id: 'delete',\n label: t('messages.actions.delete', 'Delete'),\n icon: Trash2,\n onSelect: props.onDelete,\n disabled: props.updatingState,\n })\n\n return items\n }, [props, t])\n\n return (\n <div className=\"flex items-start gap-2\">\n {props.collapseToggle ? (\n <IconButton\n type=\"button\"\n onClick={props.collapseToggle.onToggle}\n variant=\"ghost\"\n size=\"sm\"\n className=\"mt-1 text-muted-foreground hover:text-foreground\"\n aria-label={props.collapseToggle.expanded\n ? t('messages.detail.hideDetails', 'Hide details')\n : t('messages.detail.showDetails', 'Show details')}\n >\n {props.collapseToggle.expanded ? (\n <ChevronUp className=\"h-4 w-4\" aria-hidden />\n ) : (\n <ChevronDown className=\"h-4 w-4\" aria-hidden />\n )}\n </IconButton>\n ) : null}\n\n <div className=\"min-w-0 flex-1\">\n <FormHeader\n mode=\"detail\"\n title={showSubject ? props.detail.subject : undefined}\n subtitle={`${t('messages.detail.from', 'From')}: ${
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { FormHeader, type ActionItem } from '@open-mercato/ui/backend/forms'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport {\n Archive,\n ArchiveRestore,\n ChevronDown,\n ChevronUp,\n FilePenLine,\n Forward,\n Mail,\n MailOpen,\n Reply,\n Trash2,\n} from 'lucide-react'\nimport type { MessageDetail } from '../types'\nimport { formatDateTime } from '../utils'\nimport { getMessageParticipantLabel } from '../../messageListLabels'\n\ntype MessageHeaderProps = {\n detail: MessageDetail\n updatingState: boolean\n isArchived: boolean\n showSubject?: boolean\n onReply: () => void\n onForward: () => void\n onEdit: () => void\n onToggleRead: () => void\n onToggleArchive: () => void\n onDelete: () => void\n collapseToggle?: {\n expanded: boolean\n onToggle: () => void\n }\n}\n\nexport function MessageHeader(props: MessageHeaderProps) {\n const t = useT()\n const showSubject = props.showSubject !== false\n const canReply = !props.detail.isDraft && props.detail.typeDefinition.allowReply\n const senderLabel = getMessageParticipantLabel(props.detail)\n const actionItems = React.useMemo(() => {\n const items: ActionItem[] = []\n\n if (props.detail.isDraft && props.detail.canEditDraft) {\n items.push({\n id: 'edit',\n label: t('messages.actions.edit', 'Edit'),\n icon: FilePenLine,\n onSelect: props.onEdit,\n })\n }\n\n if (!props.detail.isDraft && props.detail.typeDefinition.allowForward) {\n items.push({\n id: 'forward',\n label: t('messages.forward', 'Forward'),\n icon: Forward,\n onSelect: props.onForward,\n })\n }\n\n if (!props.detail.isDraft) {\n items.push({\n id: 'toggle-read',\n label: props.detail.isRead\n ? t('messages.actions.markUnread', 'Mark unread')\n : t('messages.actions.markRead', 'Mark read'),\n icon: props.detail.isRead ? Mail : MailOpen,\n onSelect: props.onToggleRead,\n disabled: props.updatingState,\n })\n }\n\n if (!props.detail.isDraft && props.detail.canArchive) {\n items.push({\n id: 'toggle-archive',\n label: props.isArchived\n ? t('messages.actions.unarchive', 'Unarchive')\n : t('messages.actions.archive', 'Archive'),\n icon: props.isArchived ? ArchiveRestore : Archive,\n onSelect: props.onToggleArchive,\n disabled: props.updatingState,\n })\n }\n\n items.push({\n id: 'delete',\n label: t('messages.actions.delete', 'Delete'),\n icon: Trash2,\n onSelect: props.onDelete,\n disabled: props.updatingState,\n })\n\n return items\n }, [props, t])\n\n return (\n <div className=\"flex items-start gap-2\">\n {props.collapseToggle ? (\n <IconButton\n type=\"button\"\n onClick={props.collapseToggle.onToggle}\n variant=\"ghost\"\n size=\"sm\"\n className=\"mt-1 text-muted-foreground hover:text-foreground\"\n aria-label={props.collapseToggle.expanded\n ? t('messages.detail.hideDetails', 'Hide details')\n : t('messages.detail.showDetails', 'Show details')}\n >\n {props.collapseToggle.expanded ? (\n <ChevronUp className=\"h-4 w-4\" aria-hidden />\n ) : (\n <ChevronDown className=\"h-4 w-4\" aria-hidden />\n )}\n </IconButton>\n ) : null}\n\n <div className=\"min-w-0 flex-1\">\n <FormHeader\n mode=\"detail\"\n title={showSubject ? props.detail.subject : undefined}\n subtitle={`${t('messages.detail.from', 'From')}: ${senderLabel}`}\n statusBadge={<p className=\"text-xs text-muted-foreground\">{formatDateTime(props.detail.sentAt)}</p>}\n utilityActions={canReply ? (\n <IconButton\n type=\"button\"\n variant=\"outline\"\n size=\"default\"\n aria-label={t('messages.reply', 'Reply')}\n onClick={props.onReply}\n >\n <Reply className=\"h-4 w-4\" aria-hidden />\n </IconButton>\n ) : undefined}\n menuTriggerMode=\"icon\"\n menuAriaLabel={t('ui.actions.actions', 'Actions')}\n menuActions={actionItems}\n />\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAqGI,SAaQ,KAbR;AAnGJ,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,kBAAmC;AAC5C,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,s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7
7
|
}
|
|
@@ -5,6 +5,7 @@ import { MarkdownContent } from "@open-mercato/ui/backend/markdown/MarkdownConte
|
|
|
5
5
|
import { getMessageUiComponentRegistry } from "../../utils/typeUiRegistry.js";
|
|
6
6
|
import { getMessageObjectType } from "../../../lib/message-objects-registry.js";
|
|
7
7
|
import { formatDateTime } from "../utils.js";
|
|
8
|
+
import { getMessageParticipantLabel } from "../../messageListLabels.js";
|
|
8
9
|
function MessageDetailThreadSection({ detail }) {
|
|
9
10
|
const t = useT();
|
|
10
11
|
const messageUiRegistry = getMessageUiComponentRegistry();
|
|
@@ -13,7 +14,7 @@ function MessageDetailThreadSection({ detail }) {
|
|
|
13
14
|
/* @__PURE__ */ jsx("h2", { className: "text-base font-semibold", children: t("messages.detail.thread", "Thread") }),
|
|
14
15
|
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: (detail.thread ?? []).map((threadItem) => /* @__PURE__ */ jsxs("article", { className: "rounded border p-3", children: [
|
|
15
16
|
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
16
|
-
threadItem
|
|
17
|
+
getMessageParticipantLabel(threadItem),
|
|
17
18
|
" \u2022 ",
|
|
18
19
|
formatDateTime(threadItem.sentAt)
|
|
19
20
|
] }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/messages/components/message-detail/panels/thread-panel.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { MarkdownContent } from '@open-mercato/ui/backend/markdown/MarkdownContent'\nimport { getMessageUiComponentRegistry } from '../../utils/typeUiRegistry'\nimport { getMessageObjectType } from '../../../lib/message-objects-registry'\nimport type { MessageDetail, MessageDetailObject } from '../types'\nimport { formatDateTime } from '../utils'\n\nexport function MessageDetailThreadSection({ detail }: { detail: MessageDetail }) {\n const t = useT()\n const messageUiRegistry = getMessageUiComponentRegistry()\n\n if ((detail.thread ?? []).length === 0) return null\n\n return (\n <section className=\"space-y-3 border-l pl-4 py-2\">\n <h2 className=\"text-base font-semibold\">{t('messages.detail.thread', 'Thread')}</h2>\n <div className=\"space-y-3\">\n {(detail.thread ?? []).map((threadItem) => (\n <article key={threadItem.id} className=\"rounded border p-3\">\n <p className=\"text-xs text-muted-foreground\">\n {(threadItem
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { MarkdownContent } from '@open-mercato/ui/backend/markdown/MarkdownContent'\nimport { getMessageUiComponentRegistry } from '../../utils/typeUiRegistry'\nimport { getMessageObjectType } from '../../../lib/message-objects-registry'\nimport type { MessageDetail, MessageDetailObject } from '../types'\nimport { formatDateTime } from '../utils'\nimport { getMessageParticipantLabel } from '../../messageListLabels'\n\nexport function MessageDetailThreadSection({ detail }: { detail: MessageDetail }) {\n const t = useT()\n const messageUiRegistry = getMessageUiComponentRegistry()\n\n if ((detail.thread ?? []).length === 0) return null\n\n return (\n <section className=\"space-y-3 border-l pl-4 py-2\">\n <h2 className=\"text-base font-semibold\">{t('messages.detail.thread', 'Thread')}</h2>\n <div className=\"space-y-3\">\n {(detail.thread ?? []).map((threadItem) => (\n <article key={threadItem.id} className=\"rounded border p-3\">\n <p className=\"text-xs text-muted-foreground\">\n {getMessageParticipantLabel(threadItem)} \u2022 {formatDateTime(threadItem.sentAt)}\n </p>\n <div className=\"mt-2 max-h-[60vh] overflow-y-auto pr-1\">\n <MarkdownContent\n body={threadItem.body}\n format={threadItem.bodyFormat ?? 'text'}\n className=\"text-sm whitespace-pre-wrap [&>*]:mb-2 [&>*:last-child]:mb-0 [&_ul]:ml-4 [&_ul]:list-disc [&_ol]:ml-4 [&_ol]:list-decimal [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:text-xs\"\n />\n </div>\n\n {(threadItem.objects ?? []).length > 0 && (\n <div className=\"mt-3 space-y-2\">\n <p className=\"text-xs text-muted-foreground font-medium\">\n {t('messages.attachedObjects', 'Attached objects')}\n </p>\n {(threadItem.objects ?? []).map((obj: MessageDetailObject) => {\n const componentKey = `${obj.entityModule}:${obj.entityType}`\n const PreviewComponent = messageUiRegistry.objectPreviewComponents[componentKey]\n ?? messageUiRegistry.objectPreviewComponents['messages:default']\n const objectType = getMessageObjectType(obj.entityModule, obj.entityType)\n if (!PreviewComponent) return null\n\n return (\n <div key={obj.id} className=\"scale-95 origin-left\">\n <PreviewComponent\n entityId={obj.entityId}\n entityModule={obj.entityModule}\n entityType={obj.entityType}\n snapshot={obj.snapshot ?? undefined}\n previewData={obj.preview ?? undefined}\n actionRequired={obj.actionRequired}\n actionType={obj.actionType ?? undefined}\n actionLabel={obj.actionLabel ?? undefined}\n icon={objectType?.icon}\n />\n </div>\n )\n })}\n </div>\n )}\n </article>\n ))}\n </div>\n </section>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAkBM,cAIM,YAJN;AAhBN,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,qCAAqC;AAC9C,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAEpC,SAAS,2BAA2B,EAAE,OAAO,GAA8B;AAChF,QAAM,IAAI,KAAK;AACf,QAAM,oBAAoB,8BAA8B;AAExD,OAAK,OAAO,UAAU,CAAC,GAAG,WAAW,EAAG,QAAO;AAE/C,SACE,qBAAC,aAAQ,WAAU,gCACjB;AAAA,wBAAC,QAAG,WAAU,2BAA2B,YAAE,0BAA0B,QAAQ,GAAE;AAAA,IAC/E,oBAAC,SAAI,WAAU,aACX,kBAAO,UAAU,CAAC,GAAG,IAAI,CAAC,eAC1B,qBAAC,aAA4B,WAAU,sBACrC;AAAA,2BAAC,OAAE,WAAU,iCACV;AAAA,mCAA2B,UAAU;AAAA,QAAE;AAAA,QAAI,eAAe,WAAW,MAAM;AAAA,SAC9E;AAAA,MACA,oBAAC,SAAI,WAAU,0CACb;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,WAAW;AAAA,UACjB,QAAQ,WAAW,cAAc;AAAA,UACjC,WAAU;AAAA;AAAA,MACZ,GACF;AAAA,OAEE,WAAW,WAAW,CAAC,GAAG,SAAS,KACnC,qBAAC,SAAI,WAAU,kBACb;AAAA,4BAAC,OAAE,WAAU,6CACV,YAAE,4BAA4B,kBAAkB,GACnD;AAAA,SACE,WAAW,WAAW,CAAC,GAAG,IAAI,CAAC,QAA6B;AAC5D,gBAAM,eAAe,GAAG,IAAI,YAAY,IAAI,IAAI,UAAU;AAC1D,gBAAM,mBAAmB,kBAAkB,wBAAwB,YAAY,KAC1E,kBAAkB,wBAAwB,kBAAkB;AACjE,gBAAM,aAAa,qBAAqB,IAAI,cAAc,IAAI,UAAU;AACxE,cAAI,CAAC,iBAAkB,QAAO;AAE9B,iBACE,oBAAC,SAAiB,WAAU,wBAC1B;AAAA,YAAC;AAAA;AAAA,cACC,UAAU,IAAI;AAAA,cACd,cAAc,IAAI;AAAA,cAClB,YAAY,IAAI;AAAA,cAChB,UAAU,IAAI,YAAY;AAAA,cAC1B,aAAa,IAAI,WAAW;AAAA,cAC5B,gBAAgB,IAAI;AAAA,cACpB,YAAY,IAAI,cAAc;AAAA,cAC9B,aAAa,IAAI,eAAe;AAAA,cAChC,MAAM,YAAY;AAAA;AAAA,UACpB,KAXQ,IAAI,EAYd;AAAA,QAEJ,CAAC;AAAA,SACH;AAAA,SAxCU,WAAW,EA0CzB,CACD,GACH;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
const INBOUND_EXTERNAL_SOURCE_ENTITY_TYPE = "communication_channels.external_conversation";
|
|
1
2
|
function normalizeLabel(value) {
|
|
2
3
|
const normalized = value?.trim();
|
|
3
4
|
return normalized ? normalized : null;
|
|
4
5
|
}
|
|
6
|
+
function isInboundExternalMessage(item) {
|
|
7
|
+
return item.sourceEntityType === INBOUND_EXTERNAL_SOURCE_ENTITY_TYPE;
|
|
8
|
+
}
|
|
9
|
+
function getMessageParticipantLabel(item) {
|
|
10
|
+
const platformIdentity = normalizeLabel(item.senderName) ?? normalizeLabel(item.senderEmail);
|
|
11
|
+
const externalIdentity = normalizeLabel(item.externalName) ?? normalizeLabel(item.externalEmail);
|
|
12
|
+
const preferred = isInboundExternalMessage(item) ? externalIdentity : platformIdentity;
|
|
13
|
+
const fallback = isInboundExternalMessage(item) ? platformIdentity : externalIdentity;
|
|
14
|
+
return preferred ?? fallback ?? item.senderUserId;
|
|
15
|
+
}
|
|
5
16
|
function getMessageListParticipantLabel(item, folder, t) {
|
|
6
17
|
if ((folder === "sent" || folder === "drafts") && Number(item.recipientCount ?? 0) <= 0) {
|
|
7
18
|
return t("messages.list.noRecipient", "(No recipient)");
|
|
8
19
|
}
|
|
9
|
-
return
|
|
20
|
+
return getMessageParticipantLabel(item);
|
|
10
21
|
}
|
|
11
22
|
export {
|
|
12
|
-
getMessageListParticipantLabel
|
|
23
|
+
getMessageListParticipantLabel,
|
|
24
|
+
getMessageParticipantLabel
|
|
13
25
|
};
|
|
14
26
|
//# sourceMappingURL=messageListLabels.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/messages/components/messageListLabels.ts"],
|
|
4
|
-
"sourcesContent": ["import type { MessageFolder } from './useMessagesInboxBulkActions'\n\ntype Translate = (key: string, fallback: string, params?: Record<string, string | number>) => string\n\ntype MessageParticipantSource = {\n senderName?: string | null\n senderEmail?: string | null\n senderUserId: string\n recipientCount?: number | null\n}\n\nfunction normalizeLabel(value: string | null | undefined): string | null {\n const normalized = value?.trim()\n return normalized ? normalized : null\n}\n\nexport function getMessageListParticipantLabel(\n item: MessageParticipantSource,\n folder: MessageFolder,\n t: Translate,\n): string {\n if ((folder === 'sent' || folder === 'drafts') && Number(item.recipientCount ?? 0) <= 0) {\n return t('messages.list.noRecipient', '(No recipient)')\n }\n\n return
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { MessageFolder } from './useMessagesInboxBulkActions'\n\ntype Translate = (key: string, fallback: string, params?: Record<string, string | number>) => string\n\n/**\n * `Message.sourceEntityType` written by `communication_channels`'\n * `ingest-inbound-message` command, and by nothing else \u2014 the outbound bridge\n * treats it as the marker that a message arrived from outside the platform\n * rather than being sent from it. It is the only reliable inbound\n * discriminator: `type` is `channel.<provider>` on the outbound\n * `send-as-user` path too, where `externalName` carries the recipient side.\n */\nconst INBOUND_EXTERNAL_SOURCE_ENTITY_TYPE = 'communication_channels.external_conversation'\n\ntype MessageParticipantSource = {\n senderName?: string | null\n senderEmail?: string | null\n /**\n * The external counterparty on a message that crosses the platform boundary \u2014\n * the sender for an inbound email/chat ingested by `communication_channels`,\n * the recipient for an outbound reply sent through `inbox_ops`. Which side it\n * represents is decided by `sourceEntityType`, not by whether a platform\n * sender happens to be present.\n */\n externalName?: string | null\n externalEmail?: string | null\n sourceEntityType?: string | null\n senderUserId: string\n recipientCount?: number | null\n}\n\nfunction normalizeLabel(value: string | null | undefined): string | null {\n const normalized = value?.trim()\n return normalized ? normalized : null\n}\n\nfunction isInboundExternalMessage(item: MessageParticipantSource): boolean {\n return item.sourceEntityType === INBOUND_EXTERNAL_SOURCE_ENTITY_TYPE\n}\n\n/**\n * Human-readable label for a message's author.\n *\n * An ingested inbound message is authored by the external counterparty, even\n * though it is composed under a platform user id: that id is the\n * `communication_channels` system user, or \u2014 once an operator assigns the\n * conversation \u2014 the assigned agent, who resolves to a real name in the user\n * directory and would otherwise be printed as the author of the customer's own\n * email. So on the inbound side the external identity wins, and the platform\n * identity is only the fallback. Everywhere else the platform sender is the\n * author and the external identity describes the recipient, so the order is\n * reversed. The raw user id remains the last resort in both directions.\n *\n * The single source of truth for every place the messages module prints a\n * participant \u2014 the inbox list, the detail header and the conversation rows \u2014\n * so an ingested email renders as \"Jane Doe\" / \"jane@example.com\" rather than\n * the `communication_channels` system user id or the agent handling it.\n */\nexport function getMessageParticipantLabel(item: MessageParticipantSource): string {\n const platformIdentity = normalizeLabel(item.senderName) ?? normalizeLabel(item.senderEmail)\n const externalIdentity = normalizeLabel(item.externalName) ?? normalizeLabel(item.externalEmail)\n const preferred = isInboundExternalMessage(item) ? externalIdentity : platformIdentity\n const fallback = isInboundExternalMessage(item) ? platformIdentity : externalIdentity\n\n return preferred ?? fallback ?? item.senderUserId\n}\n\nexport function getMessageListParticipantLabel(\n item: MessageParticipantSource,\n folder: MessageFolder,\n t: Translate,\n): string {\n if ((folder === 'sent' || folder === 'drafts') && Number(item.recipientCount ?? 0) <= 0) {\n return t('messages.list.noRecipient', '(No recipient)')\n }\n\n return getMessageParticipantLabel(item)\n}\n"],
|
|
5
|
+
"mappings": "AAYA,MAAM,sCAAsC;AAmB5C,SAAS,eAAe,OAAiD;AACvE,QAAM,aAAa,OAAO,KAAK;AAC/B,SAAO,aAAa,aAAa;AACnC;AAEA,SAAS,yBAAyB,MAAyC;AACzE,SAAO,KAAK,qBAAqB;AACnC;AAoBO,SAAS,2BAA2B,MAAwC;AACjF,QAAM,mBAAmB,eAAe,KAAK,UAAU,KAAK,eAAe,KAAK,WAAW;AAC3F,QAAM,mBAAmB,eAAe,KAAK,YAAY,KAAK,eAAe,KAAK,aAAa;AAC/F,QAAM,YAAY,yBAAyB,IAAI,IAAI,mBAAmB;AACtE,QAAM,WAAW,yBAAyB,IAAI,IAAI,mBAAmB;AAErE,SAAO,aAAa,YAAY,KAAK;AACvC;AAEO,SAAS,+BACd,MACA,QACA,GACQ;AACR,OAAK,WAAW,UAAU,WAAW,aAAa,OAAO,KAAK,kBAAkB,CAAC,KAAK,GAAG;AACvF,WAAO,EAAE,6BAA6B,gBAAgB;AAAA,EACxD;AAEA,SAAO,2BAA2B,IAAI;AACxC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { parseBooleanFlag } from "@open-mercato/shared/lib/boolean";
|
|
3
3
|
import { sanitizeRichTextHref } from "@open-mercato/shared/lib/html/sanitizeRichText";
|
|
4
|
+
import { channelTypeRequiresExternalEmail } from "../lib/channel-sender-identity.js";
|
|
4
5
|
function collectDuplicateRecipientIds(recipients) {
|
|
5
6
|
const seen = /* @__PURE__ */ new Set();
|
|
6
7
|
const duplicates = /* @__PURE__ */ new Set();
|
|
@@ -79,13 +80,22 @@ const messageActionDataSchema = z.object({
|
|
|
79
80
|
primaryActionId: z.string().optional(),
|
|
80
81
|
expiresAt: z.string().datetime().optional()
|
|
81
82
|
});
|
|
82
|
-
const
|
|
83
|
+
const composeMessageBaseSchema = z.object({
|
|
83
84
|
type: z.string().optional().default("default"),
|
|
84
85
|
visibility: z.enum(["public", "internal"]).nullable().optional(),
|
|
85
86
|
sourceEntityType: z.string().min(1).optional(),
|
|
86
87
|
sourceEntityId: z.string().uuid().optional(),
|
|
87
88
|
externalEmail: z.string().email().optional(),
|
|
88
89
|
externalName: z.string().min(1).max(255).optional(),
|
|
90
|
+
/**
|
|
91
|
+
* Channel type the message originates from, when the caller knows it (#4975).
|
|
92
|
+
* Non-email channels (Discord, Slack, SMS…) have senders with no address, so
|
|
93
|
+
* `externalEmail` is not required for them. Resolved server-side — the HTTP
|
|
94
|
+
* route strips any client-sent value and derives it from the referenced
|
|
95
|
+
* conversation or parent message, so a caller cannot waive the requirement by
|
|
96
|
+
* asserting its own channel type.
|
|
97
|
+
*/
|
|
98
|
+
sourceChannelType: z.string().min(1).max(64).optional(),
|
|
89
99
|
recipients: z.array(messageRecipientSchema).max(100).optional().default([]),
|
|
90
100
|
subject: z.string().max(500).optional().default(""),
|
|
91
101
|
body: z.string().max(5e4).optional().default(""),
|
|
@@ -98,7 +108,8 @@ const composeMessageSchema = z.object({
|
|
|
98
108
|
sendViaEmail: z.boolean().optional().default(false),
|
|
99
109
|
parentMessageId: z.string().uuid().optional(),
|
|
100
110
|
isDraft: z.boolean().optional().default(false)
|
|
101
|
-
})
|
|
111
|
+
});
|
|
112
|
+
function refineComposeMessage(value, ctx) {
|
|
102
113
|
const isDraft = value.isDraft ?? false;
|
|
103
114
|
const visibility = value.visibility ?? "internal";
|
|
104
115
|
const recipientCount = value.recipients.length;
|
|
@@ -107,7 +118,7 @@ const composeMessageSchema = z.object({
|
|
|
107
118
|
const hasBody = value.body.trim().length > 0;
|
|
108
119
|
if (!isDraft) {
|
|
109
120
|
if (visibility === "public") {
|
|
110
|
-
if (!hasExternalEmail) {
|
|
121
|
+
if (!hasExternalEmail && channelTypeRequiresExternalEmail(value.sourceChannelType)) {
|
|
111
122
|
ctx.addIssue({
|
|
112
123
|
code: z.ZodIssueCode.custom,
|
|
113
124
|
path: ["externalEmail"],
|
|
@@ -152,7 +163,9 @@ const composeMessageSchema = z.object({
|
|
|
152
163
|
});
|
|
153
164
|
}
|
|
154
165
|
validateDefaultWithObjectsPayload(value, ctx);
|
|
155
|
-
}
|
|
166
|
+
}
|
|
167
|
+
const composeMessageSchema = composeMessageBaseSchema.superRefine(refineComposeMessage);
|
|
168
|
+
const composeMessageRequestSchema = composeMessageBaseSchema.omit({ sourceChannelType: true }).superRefine(refineComposeMessage);
|
|
156
169
|
const updateDraftSchema = z.object({
|
|
157
170
|
type: z.string().optional(),
|
|
158
171
|
visibility: z.enum(["public", "internal"]).nullable().optional(),
|
|
@@ -261,6 +274,7 @@ const unlinkAttachmentPayloadSchema = z.object({
|
|
|
261
274
|
);
|
|
262
275
|
export {
|
|
263
276
|
attachmentIdsPayloadSchema,
|
|
277
|
+
composeMessageRequestSchema,
|
|
264
278
|
composeMessageSchema,
|
|
265
279
|
confirmMessageSchema,
|
|
266
280
|
executeActionSchema,
|