@open-mercato/core 0.6.8-develop.7099.1.7ba2771d06 → 0.7.0
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 +1 -13
- package/dist/helpers/integration/api.js.map +2 -2
- package/dist/helpers/integration/communicationChannelsFixtures.js +0 -19
- 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 +1 -3
- package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
- 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 +0 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/di.js +1 -11
- package/dist/modules/attachments/di.js.map +2 -2
- package/dist/modules/attachments/index.js.map +1 -1
- package/dist/modules/attachments/lib/scoped-upload-service.js +2 -15
- package/dist/modules/attachments/lib/scoped-upload-service.js.map +2 -2
- package/dist/modules/attachments/lib/upload-limits.js +2 -6
- package/dist/modules/attachments/lib/upload-limits.js.map +2 -2
- package/dist/modules/audit_logs/backend/audit-logs/page.js +0 -6
- package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
- package/dist/modules/audit_logs/lib/display-helpers.js +11 -19
- package/dist/modules/audit_logs/lib/display-helpers.js.map +2 -2
- package/dist/modules/audit_logs/services/actionLogService.js +12 -57
- package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
- package/dist/modules/auth/acl.js +5 -30
- package/dist/modules/auth/acl.js.map +2 -2
- package/dist/modules/auth/api/feature-check.js +2 -8
- package/dist/modules/auth/api/feature-check.js.map +2 -2
- package/dist/modules/auth/api/login.js +20 -4
- package/dist/modules/auth/api/login.js.map +2 -2
- package/dist/modules/auth/api/roles/acl/route.js +33 -28
- package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
- package/dist/modules/auth/api/routeError.js +11 -0
- package/dist/modules/auth/api/routeError.js.map +7 -0
- package/dist/modules/auth/api/session/refresh.js +1 -25
- package/dist/modules/auth/api/session/refresh.js.map +2 -2
- package/dist/modules/auth/api/users/acl/route.js +73 -102
- package/dist/modules/auth/api/users/acl/route.js.map +2 -2
- package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js +1 -5
- package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +1 -3
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.meta.js +1 -5
- package/dist/modules/auth/backend/users/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/auth/backend/users/page.js +1 -2
- package/dist/modules/auth/backend/users/page.js.map +2 -2
- package/dist/modules/auth/components/AclEditor.js +30 -39
- 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 +1 -5
- package/dist/modules/auth/data/validators.js.map +2 -2
- package/dist/modules/auth/di.js +9 -35
- package/dist/modules/auth/di.js.map +2 -2
- package/dist/modules/auth/frontend/reset/[token]/page.js +0 -46
- 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/services/authService.js +2 -16
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +24 -67
- package/dist/modules/auth/services/rbacService.js.map +3 -3
- package/dist/modules/business_rules/backend/logs/page.js +1 -3
- package/dist/modules/business_rules/backend/logs/page.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/[id]/page.meta.js +6 -1
- package/dist/modules/business_rules/backend/rules/[id]/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/create/page.meta.js +5 -1
- package/dist/modules/business_rules/backend/rules/create/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/page.js +1 -3
- package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/[id]/page.meta.js +6 -1
- package/dist/modules/business_rules/backend/sets/[id]/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/create/page.meta.js +5 -1
- package/dist/modules/business_rules/backend/sets/create/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/page.js +1 -3
- 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 +9 -10
- 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 +2 -5
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js.map +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js +0 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js +1 -7
- package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
- package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js +0 -2
- 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 +1 -9
- 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 +10 -95
- 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 +0 -3
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js.map +2 -2
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js +1 -14
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
- package/dist/modules/communication_channels/di.js +1 -7
- package/dist/modules/communication_channels/di.js.map +2 -2
- package/dist/modules/communication_channels/lib/email-capabilities.js +1 -4
- package/dist/modules/communication_channels/lib/email-capabilities.js.map +2 -2
- package/dist/modules/communication_channels/lib/test-seed.js +2 -41
- package/dist/modules/communication_channels/lib/test-seed.js.map +2 -2
- package/dist/modules/configs/lib/system-status.js +0 -9
- package/dist/modules/configs/lib/system-status.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/page.js +1 -3
- package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js +1 -3
- package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js +0 -9
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js +1 -3
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js +84 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/page.js +7 -81
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js +523 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.js +731 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +7 -727
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +7 -521
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
- package/dist/modules/customer_accounts/extension-points.js +1 -1
- package/dist/modules/customer_accounts/extension-points.js.map +2 -2
- package/dist/modules/customer_accounts/lib/portalUrl.js +69 -0
- package/dist/modules/customer_accounts/lib/portalUrl.js.map +7 -0
- package/dist/modules/customer_accounts/services/domainMappingService.js +0 -10
- package/dist/modules/customer_accounts/services/domainMappingService.js.map +2 -2
- package/dist/modules/customers/ai-tools/companies-pack.js +1 -4
- package/dist/modules/customers/ai-tools/companies-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js +2 -13
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/deals-pack.js +6 -52
- package/dist/modules/customers/ai-tools/deals-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/people-pack.js +1 -4
- package/dist/modules/customers/ai-tools/people-pack.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +6 -48
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +64 -20
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +94 -17
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js +5 -8
- 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 +25 -8
- package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/stats/route.js +22 -3
- package/dist/modules/customers/api/deals/[id]/stats/route.js.map +2 -2
- package/dist/modules/customers/api/deals/aggregate/route.js +4 -11
- package/dist/modules/customers/api/deals/aggregate/route.js.map +2 -2
- package/dist/modules/customers/api/deals/map/route.js +1 -2
- package/dist/modules/customers/api/deals/map/route.js.map +2 -2
- package/dist/modules/customers/api/deals/route.js +1 -38
- 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 +1 -3
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/tasks/route.js +4 -27
- package/dist/modules/customers/api/interactions/tasks/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +3 -4
- 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 +10 -11
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/check-phone/route.js +9 -51
- package/dist/modules/customers/api/people/check-phone/route.js.map +2 -2
- package/dist/modules/customers/api/todos/route.js +5 -30
- package/dist/modules/customers/api/todos/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +4 -6
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +1 -6
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +4 -7
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js +13 -4
- 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 +14 -85
- package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +4 -6
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js +3 -9
- package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +34 -21
- 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 +2 -131
- package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
- package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
- package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
- package/dist/modules/customers/components/DealsKpiStrip.js +6 -7
- 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 +2 -3
- package/dist/modules/customers/components/calendar/EventPeekPopover.js.map +2 -2
- package/dist/modules/customers/components/calendar/editor/PeopleField.js +5 -40
- package/dist/modules/customers/components/calendar/editor/PeopleField.js.map +2 -2
- package/dist/modules/customers/components/calendar/editor/hooks.js +1 -2
- 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/AssignRoleDialog.js +33 -28
- package/dist/modules/customers/components/detail/AssignRoleDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyKpiBar.js +4 -5
- package/dist/modules/customers/components/detail/CompanyKpiBar.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js +1 -3
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +7 -19
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/DealsSection.js +5 -6
- package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
- package/dist/modules/customers/components/detail/EntityTagsDialog.js +11 -35
- package/dist/modules/customers/components/detail/EntityTagsDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonCompaniesSection.js +1 -3
- package/dist/modules/customers/components/detail/PersonCompaniesSection.js.map +2 -2
- package/dist/modules/customers/components/detail/hooks/usePersonTasks.js +13 -19
- 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 +3 -32
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/events.js +0 -5
- package/dist/modules/customers/events.js.map +2 -2
- package/dist/modules/customers/lib/calendar/conflicts.js +2 -8
- package/dist/modules/customers/lib/calendar/conflicts.js.map +2 -2
- package/dist/modules/customers/lib/calendar/editorPayload.js +2 -3
- package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
- package/dist/modules/customers/lib/calendar/mapItem.js +3 -8
- package/dist/modules/customers/lib/calendar/mapItem.js.map +2 -2
- package/dist/modules/customers/lib/dealStatus.js +0 -30
- package/dist/modules/customers/lib/dealStatus.js.map +2 -2
- package/dist/modules/customers/lib/findPeopleByAddresses.js +0 -1
- package/dist/modules/customers/lib/findPeopleByAddresses.js.map +2 -2
- package/dist/modules/customers/lib/personCompanies.js +2 -100
- package/dist/modules/customers/lib/personCompanies.js.map +2 -2
- package/dist/modules/customers/lib/todoCompatibility.js +0 -12
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetScope.js +1 -6
- package/dist/modules/dashboards/lib/widgetScope.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +1 -3
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +6 -72
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-export.js +1 -5
- package/dist/modules/data_sync/workers/sync-export.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-import.js +1 -5
- package/dist/modules/data_sync/workers/sync-import.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/[id]/route.js +32 -5
- package/dist/modules/devices/api/admin/devices/[id]/route.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/route.js +1 -14
- package/dist/modules/devices/api/admin/devices/route.js.map +2 -2
- package/dist/modules/devices/api/deviceList.js +12 -99
- package/dist/modules/devices/api/deviceList.js.map +2 -2
- package/dist/modules/devices/api/openapi.js +1 -3
- package/dist/modules/devices/api/openapi.js.map +2 -2
- package/dist/modules/devices/api/route.js +1 -9
- package/dist/modules/devices/api/route.js.map +2 -2
- package/dist/modules/devices/backend/devices/[id]/page.js +8 -8
- package/dist/modules/devices/backend/devices/[id]/page.js.map +2 -2
- package/dist/modules/devices/backend/devices/page.js +13 -15
- package/dist/modules/devices/backend/devices/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js +1 -2
- package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js +1 -2
- package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
- package/dist/modules/directory/di.js +0 -9
- package/dist/modules/directory/di.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/entities/api/records.js +2 -4
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +1 -3
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
- package/dist/modules/eudr/api/plots/route.js +1 -5
- package/dist/modules/eudr/api/plots/route.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/page.meta.js +2 -2
- package/dist/modules/eudr/backend/eudr/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.js +8 -2
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/create/page.js +8 -2
- package/dist/modules/eudr/backend/eudr/plots/create/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/plots/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/plots/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.js +2 -0
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/page.js +30 -28
- package/dist/modules/eudr/backend/eudr/statements/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/statements/page.meta.js.map +2 -2
- package/dist/modules/eudr/commands/statements.js +8 -3
- package/dist/modules/eudr/commands/statements.js.map +2 -2
- package/dist/modules/eudr/components/crudErrorI18n.js +21 -1
- package/dist/modules/eudr/components/crudErrorI18n.js.map +2 -2
- package/dist/modules/eudr/components/formConfig.js +6 -2
- package/dist/modules/eudr/components/formConfig.js.map +2 -2
- package/dist/modules/eudr/data/validators.js +1 -4
- package/dist/modules/eudr/data/validators.js.map +2 -2
- package/dist/modules/eudr/lib/statement-lifecycle.js +9 -1
- package/dist/modules/eudr/lib/statement-lifecycle.js.map +2 -2
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +0 -1
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/OverridesTable.js +0 -1
- package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
- package/dist/modules/feature_toggles/defaults.json +8 -0
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +0 -3
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js +0 -3
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js.map +2 -2
- package/dist/modules/inbox_ops/lib/htmlToPlainText.js +12 -1
- package/dist/modules/inbox_ops/lib/htmlToPlainText.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +1 -6
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +29 -38
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +9 -36
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
- package/dist/modules/integrations/data/validators.js +3 -11
- package/dist/modules/integrations/data/validators.js.map +2 -2
- package/dist/modules/integrations/lib/credentials-masking.js +2 -6
- package/dist/modules/integrations/lib/credentials-masking.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +1 -29
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/openapi.js +2 -17
- package/dist/modules/messages/api/openapi.js.map +2 -2
- package/dist/modules/messages/api/route.js +2 -17
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/components/MessagesInboxPageClient.js +14 -7
- package/dist/modules/messages/components/MessagesInboxPageClient.js.map +2 -2
- package/dist/modules/messages/components/inboxFilters.js +0 -15
- package/dist/modules/messages/components/inboxFilters.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js +1 -11
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js +1 -3
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js +1 -2
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js.map +2 -2
- package/dist/modules/messages/components/messageListLabels.js +2 -14
- package/dist/modules/messages/components/messageListLabels.js.map +2 -2
- package/dist/modules/messages/data/validators.js +4 -18
- package/dist/modules/messages/data/validators.js.map +2 -2
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +6 -4
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js +1 -3
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js.map +2 -2
- package/dist/modules/payment_gateways/lib/webhook-processor.js +0 -7
- package/dist/modules/payment_gateways/lib/webhook-processor.js.map +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +0 -3
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/push_notifications/backend/push_notifications/page.js +1 -3
- 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 +51 -150
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +3 -79
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +1 -3
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +1 -3
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -3
- package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +0 -3
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +8 -10
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +1 -79
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/components/PriceWithCurrency.js +5 -7
- package/dist/modules/sales/components/PriceWithCurrency.js.map +2 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -3
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js +6 -8
- package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +22 -51
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +19 -84
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +9 -23
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ReturnsSection.js +6 -8
- package/dist/modules/sales/components/documents/ReturnsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +14 -68
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js +5 -6
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +4 -5
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentsSection.js +6 -8
- package/dist/modules/sales/components/documents/ShipmentsSection.js.map +2 -2
- 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 +2 -8
- package/dist/modules/sales/data/entities.js.map +2 -2
- package/dist/modules/sales/extension-points.js +0 -1
- package/dist/modules/sales/extension-points.js.map +2 -2
- package/dist/modules/sales/setup.js +0 -2
- package/dist/modules/sales/setup.js.map +2 -2
- package/dist/modules/sales/widgets/injection/document-history/widget.client.js +44 -2
- package/dist/modules/sales/widgets/injection/document-history/widget.client.js.map +2 -2
- package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js +2 -10
- package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js.map +2 -2
- package/dist/modules/sales/widgets/injection-table.js +7 -4
- package/dist/modules/sales/widgets/injection-table.js.map +2 -2
- package/dist/modules/staff/backend/staff/leave-requests/page.js +0 -3
- package/dist/modules/staff/backend/staff/leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js +0 -3
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/page.js +0 -3
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +0 -3
- package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +0 -3
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +0 -3
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.js +18 -29
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +0 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/sync_excel/lib/adapters/customers.js +0 -1
- 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 +9 -12
- package/dist/modules/warranty_claims/api/portal/claims/route.js.map +2 -2
- package/dist/modules/warranty_claims/backend/page.js +0 -3
- package/dist/modules/warranty_claims/backend/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js +0 -3
- 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 +0 -3
- 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 +0 -3
- 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 +0 -3
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js.map +2 -2
- package/dist/modules/wms/api/warehouses/route.js +9 -13
- package/dist/modules/wms/api/warehouses/route.js.map +2 -2
- package/dist/modules/wms/api/zones/route.js +2 -15
- package/dist/modules/wms/api/zones/route.js.map +2 -2
- package/dist/modules/wms/commands/configuration.js +9 -121
- package/dist/modules/wms/commands/configuration.js.map +2 -2
- package/dist/modules/wms/commands/inventory-actions.js +0 -3
- package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
- package/dist/modules/wms/commands/shared.js +1 -9
- package/dist/modules/wms/commands/shared.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js +111 -76
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +3 -3
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +0 -1
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +20 -16
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js +10 -6
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotsListPage.js +0 -1
- package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +11 -7
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +10 -6
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +20 -27
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/page.js +1 -3
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/events/page.js +1 -3
- package/dist/modules/workflows/backend/events/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +1 -3
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +1 -3
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +0 -4
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/package.json +10 -9
- package/src/helpers/integration/api.ts +1 -33
- package/src/helpers/integration/communicationChannelsFixtures.ts +1 -69
- package/src/modules/api_keys/api/keys/route.ts +1 -3
- package/src/modules/api_keys/backend/api-keys/page.tsx +1 -4
- package/src/modules/attachments/AGENTS.md +0 -15
- package/src/modules/attachments/api/route.ts +2 -2
- package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -3
- package/src/modules/attachments/di.ts +0 -16
- package/src/modules/attachments/i18n/de.json +0 -5
- package/src/modules/attachments/i18n/en.json +0 -5
- package/src/modules/attachments/i18n/es.json +0 -5
- package/src/modules/attachments/i18n/ko.json +0 -5
- package/src/modules/attachments/i18n/pl.json +0 -5
- package/src/modules/attachments/index.ts +0 -10
- package/src/modules/attachments/lib/scoped-upload-service.ts +0 -46
- package/src/modules/attachments/lib/upload-limits.ts +2 -6
- package/src/modules/audit_logs/backend/audit-logs/page.tsx +0 -8
- package/src/modules/audit_logs/lib/display-helpers.tsx +32 -42
- package/src/modules/audit_logs/services/actionLogService.ts +11 -74
- package/src/modules/auth/acl.ts +6 -30
- package/src/modules/auth/api/feature-check.ts +3 -10
- package/src/modules/auth/api/login.ts +24 -9
- package/src/modules/auth/api/roles/acl/route.ts +39 -42
- package/src/modules/auth/api/routeError.ts +30 -0
- package/src/modules/auth/api/session/refresh.ts +1 -32
- package/src/modules/auth/api/users/acl/route.ts +101 -185
- package/src/modules/auth/backend/roles/[id]/edit/page.meta.ts +2 -5
- package/src/modules/auth/backend/roles/page.tsx +2 -4
- package/src/modules/auth/backend/users/[id]/edit/page.meta.ts +2 -5
- package/src/modules/auth/backend/users/page.tsx +2 -3
- package/src/modules/auth/components/AclEditor.tsx +33 -63
- package/src/modules/auth/data/entities.ts +1 -4
- package/src/modules/auth/data/validators.ts +0 -5
- package/src/modules/auth/di.ts +16 -46
- package/src/modules/auth/frontend/reset/[token]/page.tsx +0 -74
- package/src/modules/auth/i18n/de.json +0 -389
- package/src/modules/auth/i18n/en.json +0 -389
- package/src/modules/auth/i18n/es.json +0 -389
- package/src/modules/auth/i18n/ko.json +0 -389
- package/src/modules/auth/i18n/pl.json +2 -391
- package/src/modules/auth/lib/grantChecks.ts +0 -6
- package/src/modules/auth/services/authService.ts +2 -18
- package/src/modules/auth/services/rbacService.ts +24 -110
- package/src/modules/business_rules/backend/logs/page.tsx +1 -4
- package/src/modules/business_rules/backend/rules/[id]/page.meta.ts +5 -0
- package/src/modules/business_rules/backend/rules/create/page.meta.ts +5 -1
- package/src/modules/business_rules/backend/rules/page.tsx +1 -4
- package/src/modules/business_rules/backend/sets/[id]/page.meta.ts +5 -0
- package/src/modules/business_rules/backend/sets/create/page.meta.ts +5 -1
- package/src/modules/business_rules/backend/sets/page.tsx +1 -4
- package/src/modules/business_rules/lib/expression-evaluator.ts +9 -9
- package/src/modules/business_rules/lib/rule-evaluator.ts +9 -10
- 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 +5 -12
- package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +0 -3
- package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -7
- package/src/modules/catalog/i18n/de.json +0 -1
- package/src/modules/catalog/i18n/en.json +0 -1
- package/src/modules/catalog/i18n/es.json +0 -1
- package/src/modules/catalog/i18n/ko.json +0 -1
- package/src/modules/catalog/i18n/pl.json +0 -1
- package/src/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.tsx +0 -4
- package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +1 -17
- package/src/modules/communication_channels/api/post/test-seed/route.ts +16 -155
- package/src/modules/communication_channels/backend/communication_channels/channels/page.tsx +0 -4
- package/src/modules/communication_channels/commands/ingest-inbound-message.ts +1 -38
- package/src/modules/communication_channels/di.ts +0 -7
- package/src/modules/communication_channels/lib/adapter.ts +0 -14
- package/src/modules/communication_channels/lib/email-capabilities.ts +0 -4
- package/src/modules/communication_channels/lib/test-seed.ts +4 -64
- package/src/modules/configs/i18n/de.json +0 -2
- package/src/modules/configs/i18n/en.json +0 -2
- package/src/modules/configs/i18n/es.json +0 -2
- package/src/modules/configs/i18n/ko.json +0 -2
- package/src/modules/configs/i18n/pl.json +0 -2
- package/src/modules/configs/lib/system-status.ts +0 -9
- package/src/modules/currencies/backend/currencies/page.tsx +1 -4
- package/src/modules/currencies/backend/exchange-rates/page.tsx +1 -4
- package/src/modules/customer_accounts/api/admin/domain-mappings.ts +0 -7
- package/src/modules/customer_accounts/backend/customer_accounts/roles/page.tsx +1 -4
- package/src/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.tsx +138 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/page.tsx +8 -132
- package/src/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.tsx +598 -0
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.tsx +838 -0
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +6 -838
- package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +6 -590
- package/src/modules/customer_accounts/extension-points.ts +1 -1
- package/src/modules/customer_accounts/lib/portalUrl.ts +112 -0
- package/src/modules/customer_accounts/services/domainMappingService.ts +0 -10
- package/src/modules/customers/ai-tools/companies-pack.ts +1 -4
- package/src/modules/customers/ai-tools/deal-analyzer-pack.ts +2 -17
- package/src/modules/customers/ai-tools/deals-pack.ts +1 -66
- package/src/modules/customers/ai-tools/people-pack.ts +1 -4
- package/src/modules/customers/api/activities/route.ts +0 -45
- package/src/modules/customers/api/companies/[id]/people/route.ts +73 -24
- package/src/modules/customers/api/companies/[id]/route.ts +107 -24
- package/src/modules/customers/api/dashboard/widgets/customer-todos/route.ts +8 -16
- package/src/modules/customers/api/deals/[id]/companies/route.ts +1 -4
- package/src/modules/customers/api/deals/[id]/people/route.ts +1 -4
- package/src/modules/customers/api/deals/[id]/route.ts +28 -17
- package/src/modules/customers/api/deals/[id]/stats/route.ts +25 -10
- package/src/modules/customers/api/deals/aggregate/route.ts +4 -14
- package/src/modules/customers/api/deals/map/route.ts +0 -1
- package/src/modules/customers/api/deals/route.ts +1 -50
- package/src/modules/customers/api/entity-roles-factory.ts +4 -8
- package/src/modules/customers/api/interactions/route.ts +2 -8
- package/src/modules/customers/api/interactions/tasks/route.ts +1 -24
- package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +4 -12
- package/src/modules/customers/api/people/[id]/companies/context.ts +1 -4
- package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +1 -4
- package/src/modules/customers/api/people/[id]/route.ts +11 -16
- package/src/modules/customers/api/people/check-phone/route.ts +10 -75
- package/src/modules/customers/api/todos/route.ts +2 -27
- package/src/modules/customers/backend/customers/companies/page.tsx +4 -7
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +2 -7
- package/src/modules/customers/backend/customers/deals/page.tsx +4 -10
- package/src/modules/customers/backend/customers/deals/pipeline/components/Lane.tsx +14 -5
- package/src/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.tsx +27 -109
- package/src/modules/customers/backend/customers/people/page.tsx +4 -7
- package/src/modules/customers/backend/hooks/useEmailDuplicateCheck.ts +4 -12
- package/src/modules/customers/commands/deals.ts +59 -34
- package/src/modules/customers/commands/interactions.ts +1 -1
- package/src/modules/customers/commands/personCompanyLinks.ts +8 -224
- package/src/modules/customers/components/CustomerTodosTable.tsx +0 -2
- 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 +2 -4
- package/src/modules/customers/components/calendar/editor/PeopleField.tsx +5 -61
- package/src/modules/customers/components/calendar/editor/hooks.ts +1 -7
- package/src/modules/customers/components/calendar/types.ts +2 -2
- package/src/modules/customers/components/detail/AssignRoleDialog.tsx +12 -7
- package/src/modules/customers/components/detail/CompanyKpiBar.tsx +4 -5
- package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +1 -8
- package/src/modules/customers/components/detail/DealForm.tsx +2 -22
- package/src/modules/customers/components/detail/DealsSection.tsx +5 -11
- package/src/modules/customers/components/detail/EntityTagsDialog.tsx +12 -58
- package/src/modules/customers/components/detail/PersonCompaniesSection.tsx +1 -8
- package/src/modules/customers/components/detail/hooks/usePersonTasks.ts +14 -23
- 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 +5 -15
- package/src/modules/customers/data/entities.ts +1 -1
- package/src/modules/customers/data/validators.ts +9 -50
- package/src/modules/customers/events.ts +0 -5
- package/src/modules/customers/i18n/de.json +1 -9
- package/src/modules/customers/i18n/en.json +1 -9
- package/src/modules/customers/i18n/es.json +1 -9
- package/src/modules/customers/i18n/ko.json +1 -9
- package/src/modules/customers/i18n/pl.json +1 -9
- package/src/modules/customers/lib/calendar/conflicts.ts +2 -10
- package/src/modules/customers/lib/calendar/editorPayload.ts +3 -4
- package/src/modules/customers/lib/calendar/mapItem.ts +3 -8
- package/src/modules/customers/lib/dealStatus.ts +0 -42
- package/src/modules/customers/lib/findPeopleByAddresses.ts +6 -8
- package/src/modules/customers/lib/personCompanies.ts +1 -136
- package/src/modules/customers/lib/todoCompatibility.ts +1 -19
- 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 +0 -6
- package/src/modules/data_sync/AGENTS.md +1 -1
- package/src/modules/data_sync/backend/data-sync/page.tsx +1 -4
- package/src/modules/data_sync/lib/adapter.ts +0 -36
- package/src/modules/data_sync/lib/sync-engine.ts +5 -113
- package/src/modules/data_sync/workers/sync-export.ts +0 -4
- package/src/modules/data_sync/workers/sync-import.ts +0 -4
- package/src/modules/devices/AGENTS.md +0 -8
- package/src/modules/devices/api/admin/devices/[id]/route.ts +34 -5
- package/src/modules/devices/api/admin/devices/route.ts +1 -14
- package/src/modules/devices/api/deviceList.ts +11 -135
- package/src/modules/devices/api/openapi.ts +1 -9
- package/src/modules/devices/api/route.ts +1 -9
- package/src/modules/devices/backend/devices/[id]/page.tsx +15 -15
- package/src/modules/devices/backend/devices/page.tsx +21 -24
- package/src/modules/directory/backend/directory/organizations/page.tsx +1 -3
- package/src/modules/directory/backend/directory/tenants/page.tsx +1 -3
- package/src/modules/directory/di.ts +2 -14
- package/src/modules/directory/utils/organizationScope.ts +15 -4
- package/src/modules/entities/api/records.ts +0 -2
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +1 -4
- package/src/modules/eudr/api/plots/route.ts +0 -4
- package/src/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/page.meta.ts +2 -2
- package/src/modules/eudr/backend/eudr/plots/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/plots/[id]/page.tsx +8 -2
- package/src/modules/eudr/backend/eudr/plots/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/plots/create/page.tsx +8 -2
- package/src/modules/eudr/backend/eudr/plots/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/plots/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/product-mappings/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/product-mappings/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/product-mappings/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/risk-assessments/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/statements/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/statements/[id]/page.tsx +2 -0
- package/src/modules/eudr/backend/eudr/statements/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/statements/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/statements/page.tsx +32 -30
- package/src/modules/eudr/commands/statements.ts +7 -2
- package/src/modules/eudr/components/crudErrorI18n.ts +31 -0
- package/src/modules/eudr/components/formConfig.tsx +9 -1
- package/src/modules/eudr/data/validators.ts +1 -16
- package/src/modules/eudr/i18n/de.json +3 -2
- package/src/modules/eudr/i18n/en.json +3 -2
- package/src/modules/eudr/i18n/es.json +3 -2
- package/src/modules/eudr/i18n/ko.json +3 -2
- package/src/modules/eudr/i18n/pl.json +3 -2
- package/src/modules/eudr/lib/statement-lifecycle.ts +8 -0
- package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +1 -2
- package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -2
- package/src/modules/feature_toggles/defaults.json +8 -0
- package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +0 -4
- package/src/modules/inbox_ops/backend/inbox-ops/page.tsx +0 -4
- package/src/modules/inbox_ops/lib/htmlToPlainText.ts +17 -1
- package/src/modules/integrations/api/[id]/credentials/route.ts +4 -6
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +31 -61
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +9 -44
- package/src/modules/integrations/data/validators.ts +2 -12
- package/src/modules/integrations/i18n/de.json +0 -1
- package/src/modules/integrations/i18n/en.json +0 -1
- package/src/modules/integrations/i18n/es.json +0 -1
- package/src/modules/integrations/i18n/ko.json +0 -1
- package/src/modules/integrations/i18n/pl.json +0 -1
- package/src/modules/integrations/lib/credentials-masking.ts +6 -10
- package/src/modules/messages/api/[id]/route.ts +1 -55
- package/src/modules/messages/api/openapi.ts +0 -20
- package/src/modules/messages/api/route.ts +2 -31
- package/src/modules/messages/components/MessagesInboxPageClient.tsx +16 -9
- package/src/modules/messages/components/inboxFilters.ts +0 -36
- package/src/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.ts +1 -14
- package/src/modules/messages/components/message-detail/panels/MessageHeader.tsx +1 -3
- package/src/modules/messages/components/message-detail/panels/thread-panel.tsx +1 -2
- package/src/modules/messages/components/message-detail/types.ts +0 -3
- package/src/modules/messages/components/messageListLabels.ts +3 -52
- package/src/modules/messages/data/validators.ts +4 -43
- package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +6 -4
- package/src/modules/payment_gateways/backend/payment-gateways/page.tsx +1 -4
- package/src/modules/payment_gateways/lib/webhook-processor.ts +0 -11
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +0 -4
- package/src/modules/push_notifications/backend/push_notifications/page.tsx +1 -4
- package/src/modules/push_notifications/backend/push_notifications/send/page.tsx +4 -4
- package/src/modules/query_index/lib/engine.ts +61 -249
- package/src/modules/query_index/lib/search-tokens.ts +3 -135
- package/src/modules/resources/backend/resources/resource-types/page.tsx +1 -4
- package/src/modules/resources/backend/resources/resources/page.tsx +1 -4
- package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -4
- package/src/modules/sales/backend/sales/channels/page.tsx +0 -4
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +8 -14
- package/src/modules/sales/commands/documents.ts +0 -93
- package/src/modules/sales/components/PriceWithCurrency.tsx +5 -17
- package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -4
- package/src/modules/sales/components/documents/AdjustmentsSection.tsx +5 -6
- package/src/modules/sales/components/documents/ItemsSection.tsx +18 -56
- package/src/modules/sales/components/documents/LineItemDialog.tsx +21 -138
- package/src/modules/sales/components/documents/PaymentsSection.tsx +9 -20
- package/src/modules/sales/components/documents/ReturnsSection.tsx +5 -6
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +14 -106
- package/src/modules/sales/components/documents/SalesOrderDraftLines.tsx +5 -6
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +4 -5
- package/src/modules/sales/components/documents/ShipmentsSection.tsx +5 -6
- package/src/modules/sales/components/documents/lineItemUtils.ts +2 -7
- package/src/modules/sales/data/entities.ts +0 -6
- package/src/modules/sales/extension-points.ts +0 -1
- package/src/modules/sales/i18n/de.json +37 -8
- package/src/modules/sales/i18n/en.json +37 -8
- package/src/modules/sales/i18n/es.json +37 -8
- package/src/modules/sales/i18n/ko.json +37 -8
- package/src/modules/sales/i18n/pl.json +37 -8
- package/src/modules/sales/migrations/.snapshot-open-mercato.json +0 -60
- package/src/modules/sales/setup.ts +0 -2
- package/src/modules/sales/widgets/injection/document-history/widget.client.tsx +42 -2
- package/src/modules/sales/widgets/injection/payment-gateway-status-column/widget.ts +1 -9
- package/src/modules/sales/widgets/injection-table.ts +7 -4
- package/src/modules/staff/backend/staff/leave-requests/page.tsx +0 -4
- package/src/modules/staff/backend/staff/my-leave-requests/page.tsx +0 -4
- package/src/modules/staff/backend/staff/team-members/page.tsx +0 -6
- package/src/modules/staff/backend/staff/team-roles/page.tsx +0 -4
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +0 -4
- package/src/modules/staff/backend/staff/teams/page.tsx +0 -4
- package/src/modules/staff/backend/staff/timesheets/page.tsx +1 -12
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +0 -4
- package/src/modules/sync_excel/lib/adapters/customers.ts +0 -5
- 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 +9 -12
- package/src/modules/warranty_claims/backend/page.tsx +0 -4
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/page.tsx +0 -4
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.tsx +0 -4
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.tsx +0 -4
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.tsx +0 -4
- package/src/modules/wms/api/warehouses/route.ts +9 -13
- package/src/modules/wms/api/zones/route.ts +0 -16
- package/src/modules/wms/commands/configuration.ts +10 -159
- package/src/modules/wms/commands/inventory-actions.ts +0 -3
- package/src/modules/wms/commands/shared.ts +0 -17
- package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +141 -95
- package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +0 -2
- package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +30 -26
- package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +21 -17
- package/src/modules/wms/components/backend/WmsLotsListPage.tsx +0 -2
- package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +17 -13
- package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +16 -12
- package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +20 -36
- package/src/modules/wms/i18n/de.json +0 -2
- package/src/modules/wms/i18n/en.json +0 -2
- package/src/modules/wms/i18n/es.json +0 -2
- package/src/modules/wms/i18n/ko.json +0 -2
- package/src/modules/wms/i18n/pl.json +0 -2
- package/src/modules/workflows/backend/definitions/page.tsx +1 -4
- package/src/modules/workflows/backend/events/page.tsx +1 -4
- package/src/modules/workflows/backend/instances/page.tsx +1 -4
- package/src/modules/workflows/backend/tasks/page.tsx +1 -4
- package/src/modules/workflows/lib/activity-executor.ts +0 -9
- package/dist/modules/api_keys/di.js +0 -9
- package/dist/modules/api_keys/di.js.map +0 -7
- package/dist/modules/api_keys/services/principalService.js +0 -31
- package/dist/modules/api_keys/services/principalService.js.map +0 -7
- package/dist/modules/attachments/lib/attachment-service.js +0 -313
- package/dist/modules/attachments/lib/attachment-service.js.map +0 -7
- package/dist/modules/auth/api/reset/validate.js +0 -55
- package/dist/modules/auth/api/reset/validate.js.map +0 -7
- package/dist/modules/auth/commands/acl.js +0 -254
- package/dist/modules/auth/commands/acl.js.map +0 -7
- package/dist/modules/auth/services/principalService.js +0 -200
- package/dist/modules/auth/services/principalService.js.map +0 -7
- package/dist/modules/auth/services/roleOrganizationScope.js +0 -41
- package/dist/modules/auth/services/roleOrganizationScope.js.map +0 -7
- package/dist/modules/communication_channels/lib/outbound-recipient.js +0 -33
- package/dist/modules/communication_channels/lib/outbound-recipient.js.map +0 -7
- package/dist/modules/communication_channels/lib/resolve-channel-type.js +0 -51
- package/dist/modules/communication_channels/lib/resolve-channel-type.js.map +0 -7
- package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js +0 -18
- package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js.map +0 -7
- package/dist/modules/customers/lib/calendar/participantIdentity.js +0 -9
- package/dist/modules/customers/lib/calendar/participantIdentity.js.map +0 -7
- package/dist/modules/customers/lib/closureStage.js +0 -45
- package/dist/modules/customers/lib/closureStage.js.map +0 -7
- package/dist/modules/customers/lib/detailReadAccess.js +0 -12
- package/dist/modules/customers/lib/detailReadAccess.js.map +0 -7
- package/dist/modules/data_sync/lib/abandoned-run.js +0 -19
- package/dist/modules/data_sync/lib/abandoned-run.js.map +0 -7
- package/dist/modules/devices/api/deviceSerialization.js +0 -46
- package/dist/modules/devices/api/deviceSerialization.js.map +0 -7
- package/dist/modules/directory/services/organizationHierarchyService.js +0 -29
- package/dist/modules/directory/services/organizationHierarchyService.js.map +0 -7
- package/dist/modules/directory/services/organizationScopeService.js +0 -56
- package/dist/modules/directory/services/organizationScopeService.js.map +0 -7
- package/dist/modules/integrations/backend/integrations/credential-secret-fields.js +0 -55
- package/dist/modules/integrations/backend/integrations/credential-secret-fields.js.map +0 -7
- package/dist/modules/messages/lib/channel-sender-identity.js +0 -26
- package/dist/modules/messages/lib/channel-sender-identity.js.map +0 -7
- package/dist/modules/messages/lib/composeSourceChannelType.js +0 -41
- package/dist/modules/messages/lib/composeSourceChannelType.js.map +0 -7
- package/dist/modules/query_index/lib/search-entity-policy.js +0 -14
- package/dist/modules/query_index/lib/search-entity-policy.js.map +0 -7
- package/dist/modules/sales/components/documents/lineItemShipmentLock.js +0 -54
- package/dist/modules/sales/components/documents/lineItemShipmentLock.js.map +0 -7
- package/dist/modules/sales/lib/salesChannelsToggleSeed.js +0 -33
- package/dist/modules/sales/lib/salesChannelsToggleSeed.js.map +0 -7
- package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js +0 -32
- package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js.map +0 -7
- package/dist/modules/wms/api/warehouseSearch.js +0 -21
- package/dist/modules/wms/api/warehouseSearch.js.map +0 -7
- package/dist/modules/wms/components/backend/WarehouseEditDialog.js +0 -158
- package/dist/modules/wms/components/backend/WarehouseEditDialog.js.map +0 -7
- package/dist/modules/wms/components/backend/warehouseFormOptions.js +0 -66
- package/dist/modules/wms/components/backend/warehouseFormOptions.js.map +0 -7
- package/src/modules/api_keys/di.ts +0 -7
- package/src/modules/api_keys/services/principalService.ts +0 -33
- package/src/modules/attachments/lib/attachment-service.ts +0 -468
- package/src/modules/auth/api/reset/validate.ts +0 -57
- package/src/modules/auth/commands/acl.ts +0 -495
- package/src/modules/auth/services/principalService.ts +0 -266
- package/src/modules/auth/services/roleOrganizationScope.ts +0 -70
- package/src/modules/communication_channels/lib/outbound-recipient.ts +0 -71
- package/src/modules/communication_channels/lib/resolve-channel-type.ts +0 -99
- package/src/modules/customers/backend/customers/deals/pipeline/components/toneClasses.ts +0 -21
- package/src/modules/customers/lib/calendar/participantIdentity.ts +0 -17
- package/src/modules/customers/lib/closureStage.ts +0 -76
- package/src/modules/customers/lib/detailReadAccess.ts +0 -35
- package/src/modules/data_sync/lib/abandoned-run.ts +0 -56
- package/src/modules/devices/api/deviceSerialization.ts +0 -50
- package/src/modules/directory/services/organizationHierarchyService.ts +0 -34
- package/src/modules/directory/services/organizationScopeService.ts +0 -85
- package/src/modules/integrations/backend/integrations/credential-secret-fields.ts +0 -84
- package/src/modules/messages/lib/channel-sender-identity.ts +0 -55
- package/src/modules/messages/lib/composeSourceChannelType.ts +0 -95
- package/src/modules/query_index/lib/search-entity-policy.ts +0 -46
- package/src/modules/sales/components/documents/lineItemShipmentLock.ts +0 -74
- package/src/modules/sales/lib/salesChannelsToggleSeed.ts +0 -42
- package/src/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.ts +0 -87
- package/src/modules/wms/api/warehouseSearch.ts +0 -23
- package/src/modules/wms/components/backend/WarehouseEditDialog.tsx +0 -216
- package/src/modules/wms/components/backend/warehouseFormOptions.ts +0 -72
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/wms/components/backend/inventoryMutationLoaders.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CrudFieldOption } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport {\n buildQuery,\n loadCatalogVariantOptions,\n loadWarehouseOptions,\n} from './wmsLookupLoaders'\n\nexport { buildQuery, loadCatalogVariantOptions, loadWarehouseOptions }\n\ntype PagedResponse<T> = {\n items: T[]\n total: number\n totalPages: number\n}\n\ntype InventoryLotListRow = {\n id?: string | null\n lot_number?: string | null\n expires_at?: string | null\n}\n\nasync function loadCrudOptionsByIds<T>(\n endpoint: string,\n ids: string[],\n mapItem: (item: T) => CrudFieldOption | null,\n): Promise<CrudFieldOption[]> {\n const normalizedIds = [...new Set(ids.map((id) => id.trim()).filter(Boolean))]\n if (normalizedIds.length === 0) return []\n const params = buildQuery({\n page: 1,\n pageSize: normalizedIds.length,\n ids: normalizedIds.join(','),\n })\n const call = await apiCall<PagedResponse<T>>(`${endpoint}?${params}`)\n if (!call.ok) return []\n return (call.result?.items ?? [])\n .map(mapItem)\n .filter((option): option is CrudFieldOption => option !== null)\n}\n\nexport async function resolveCatalogVariantLabel(catalogVariantId: string): Promise<string | null> {\n const id = catalogVariantId.trim()\n if (!id) return null\n const params = buildQuery({ page: 1, pageSize: 1, id })\n const call = await apiCall<PagedResponse<{ id?: string | null; name?: string | null; sku?: string | null }>>(\n `/api/catalog/variants?${params}`,\n )\n if (!call.ok) return null\n const item = call.result?.items?.[0]\n if (!item) return null\n return item.sku?.trim() || item.name?.trim() || id\n}\n\nexport async function resolveWarehouseLabel(warehouseId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<{ id?: string | null; name?: string | null; code?: string | null }>(\n '/api/wms/warehouses',\n [warehouseId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n return { value, label: item.name || item.code || value }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveLocationLabel(locationId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<{ id?: string | null; code?: string | null }>(\n '/api/wms/locations',\n [locationId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n return { value, label: item.code || value }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveLotLabel(lotId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n [lotId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const lotNumber = item.lot_number?.trim() || value\n const expiresAt = item.expires_at?.trim()\n const label = expiresAt ? `${lotNumber} \u00B7 exp ${expiresAt.slice(0, 10)}` : lotNumber\n return { value, label }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveLotNumberFromId(lotId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n [lotId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n const lotNumber = item.lot_number?.trim()\n if (!value || !lotNumber) return null\n return { value, label: lotNumber }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveCatalogVariantSku(catalogVariantId: string): Promise<string | null> {\n const id = catalogVariantId.trim()\n if (!id) return null\n const params = buildQuery({ page: 1, pageSize: 1, id })\n const call = await apiCall<PagedResponse<{ id?: string | null; sku?: string | null }>>(\n `/api/catalog/variants?${params}`,\n )\n if (!call.ok) return null\n const sku = call.result?.items?.[0]?.sku?.trim()\n return sku || null\n}\n\ntype InventoryProfileListRow = {\n track_lot?: boolean | null\n track_serial?: boolean | null\n}\n\nexport async function loadInventoryProfileForVariant(\n catalogVariantId: string,\n): Promise<InventoryProfileListRow | null> {\n const variantId = catalogVariantId.trim()\n if (!variantId) return null\n const params = buildQuery({ page: 1, pageSize: 1, catalogVariantId: variantId })\n const call = await apiCall<PagedResponse<InventoryProfileListRow>>(\n `/api/wms/inventory-profiles?${params}`,\n )\n if (!call.ok) return null\n return call.result?.items?.[0] ?? null\n}\n\nexport async function findLotIdByNumber(\n catalogVariantId: string,\n lotNumber: string,\n): Promise<string | null> {\n const variantId = catalogVariantId.trim()\n const normalizedLotNumber = lotNumber.trim()\n if (!variantId || !normalizedLotNumber) return null\n\n const params = buildQuery({\n page: 1,\n pageSize: 20,\n catalogVariantId: variantId,\n search: normalizedLotNumber,\n })\n const call = await apiCall<PagedResponse<InventoryLotListRow>>(`/api/wms/lots?${params}`)\n if (!call.ok) return null\n\n const match = (call.result?.items ?? []).find(\n (item) => item.lot_number?.trim().toLowerCase() === normalizedLotNumber.toLowerCase(),\n )\n return typeof match?.id === 'string' ? match.id : null\n}\n\nexport class InventoryLotMutationError extends Error {\n constructor(message = 'Failed to resolve inventory lot.') {\n super(message)\n this.name = 'InventoryLotMutationError'\n }\n}\n\nexport async function ensureLotIdForInventoryMutation(input: {\n catalogVariantId: string\n lotNumber: string\n organizationId: string\n tenantId: string\n}): Promise<string> {\n const lotNumber = input.lotNumber.trim()\n if (!lotNumber) {\n throw new InventoryLotMutationError('Lot number is required.')\n }\n\n const existingId = await findLotIdByNumber(input.catalogVariantId, lotNumber)\n if (existingId) return existingId\n\n const sku = await resolveCatalogVariantSku(input.catalogVariantId)\n if (!sku) {\n throw new InventoryLotMutationError('Could not resolve SKU for the selected variant.')\n }\n\n const call = await apiCall<{ id?: string | null }>('/api/wms/lots', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n catalogVariantId: input.catalogVariantId,\n sku,\n lotNumber,\n status: 'available',\n }),\n })\n\n if (!call.ok) {\n const racedId = await findLotIdByNumber(input.catalogVariantId, lotNumber)\n if (racedId) return racedId\n throw new InventoryLotMutationError('Failed to create inventory lot.')\n }\n\n const createdId = call.result?.id?.trim()\n if (createdId) return createdId\n\n const resolvedId = await findLotIdByNumber(input.catalogVariantId, lotNumber)\n if (resolvedId) return resolvedId\n\n throw new InventoryLotMutationError('Failed to resolve created inventory lot.')\n}\n\ntype LocationListRow = {\n id?: string | null\n code?: string | null\n type?: string | null\n}\n\ntype ZoneListRow = {\n id?: string | null\n name?: string | null\n code?: string | null\n warehouse_id?: string | null\n warehouseId?: string | null\n}\n\nexport type ZoneCrudFieldOption = CrudFieldOption & {\n warehouseId?: string\n}\n\nfunction readZoneWarehouseId(item: ZoneListRow): string | null {\n if (typeof item.warehouse_id === 'string' && item.warehouse_id.trim()) {\n return item.warehouse_id.trim()\n }\n if (typeof item.warehouseId === 'string' && item.warehouseId.trim()) {\n return item.warehouseId.trim()\n }\n return null\n}\n\ntype AuthUserListRow = {\n id?: string | null\n email?: string | null\n roles?: string[] | null\n}\n\nexport type AssigneeOptionsResult = {\n options: CrudFieldOption[]\n canListUsers: boolean\n}\n\nexport type BalanceLookupErrorCode = 'LOOKUP_FAILED' | 'LOT_REQUIRED' | 'LOT_NOT_FOUND'\n\nexport class BalanceLookupError extends Error {\n code: BalanceLookupErrorCode\n /** Lot IDs present at the ambiguous location (set when `code === 'LOT_REQUIRED'`). */\n candidateLotIds: string[]\n\n constructor(\n message = 'Failed to load inventory balance.',\n code: BalanceLookupErrorCode = 'LOOKUP_FAILED',\n candidateLotIds: string[] = [],\n ) {\n super(message)\n this.name = 'BalanceLookupError'\n this.code = code\n this.candidateLotIds = candidateLotIds\n }\n}\n\nexport class ScopeEstimateError extends Error {\n constructor(message = 'Failed to estimate cycle count scope.') {\n super(message)\n this.name = 'ScopeEstimateError'\n }\n}\n\nfunction compareLocationCodes(left: string, right: string): number {\n return left.localeCompare(right, undefined, { numeric: true, sensitivity: 'base' })\n}\n\nfunction isLocationCodeWithinRange(\n code: string,\n fromCode?: string | null,\n toCode?: string | null,\n): boolean {\n const from = fromCode?.trim()\n const to = toCode?.trim()\n if (from && compareLocationCodes(code, from) < 0) return false\n if (to && compareLocationCodes(code, to) > 0) return false\n return true\n}\n\nexport function formatCycleCountZoneLabel(\n baseLabel: string,\n stats?: { expectedSkus: number; binCount: number },\n): string {\n const trimmed = baseLabel.trim()\n if (!trimmed || !stats) return trimmed\n return `${trimmed} \u00B7 ${stats.expectedSkus} SKUs \u00B7 ${stats.binCount} bins`\n}\n\nexport function mapLocationOptions(items: LocationListRow[]): CrudFieldOption[] {\n return items\n .map((item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const label = item.code || value\n return { value, label }\n })\n .filter((option): option is CrudFieldOption => option !== null)\n}\n\nexport async function loadAllLocations(\n warehouseId: string,\n filters: { type?: string; search?: string },\n): Promise<LocationListRow[]> {\n const items: LocationListRow[] = []\n const pageSize = 100\n let page = 1\n\n // Short-page termination: `totalPages` derives from `total`, which is a\n // display value that can be capped (OM_LIST_COUNT_CAP) \u2014 never a loop bound.\n for (;;) {\n const params = buildQuery({\n page,\n pageSize,\n warehouseId,\n type: filters.type,\n search: filters.search?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<LocationListRow>>(`/api/wms/locations?${params}`)\n if (!call.ok) break\n const batch = call.result?.items ?? []\n items.push(...batch)\n if (batch.length < pageSize) break\n if (page >= 10) break\n page += 1\n }\n\n return items\n}\n\nexport function filterLocationsByCodeRange(\n locations: LocationListRow[],\n fromCode?: string | null,\n toCode?: string | null,\n): LocationListRow[] {\n const from = fromCode?.trim()\n const to = toCode?.trim()\n if (!from && !to) return locations\n return locations.filter((location) => {\n const code = location.code?.trim()\n if (!code) return false\n return isLocationCodeWithinRange(code, from, to)\n })\n}\n\nasync function loadLocationPage(\n warehouseId: string,\n filters: { type?: string; search?: string; page?: number; pageSize?: number },\n): Promise<PagedResponse<LocationListRow>> {\n const params = buildQuery({\n page: filters.page ?? 1,\n pageSize: filters.pageSize ?? 50,\n warehouseId,\n type: filters.type,\n search: filters.search?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<LocationListRow>>(`/api/wms/locations?${params}`)\n if (!call.ok) {\n throw new BalanceLookupError('Failed to load warehouse locations.')\n }\n return call.result ?? { items: [], total: 0, totalPages: 0 }\n}\n\nexport async function loadLocationOptions(\n warehouseId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n if (!warehouseId) return []\n try {\n const page = await loadLocationPage(warehouseId, { search: query })\n return mapLocationOptions(page.items ?? [])\n } catch {\n return []\n }\n}\n\nexport async function loadBinLocationOptions(\n warehouseId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n if (!warehouseId) return []\n try {\n const page = await loadLocationPage(warehouseId, { type: 'bin', search: query })\n return mapLocationOptions(page.items ?? [])\n } catch {\n return []\n }\n}\n\nexport async function loadZoneOptions(\n warehouseId: string,\n query?: string,\n): Promise<ZoneCrudFieldOption[]> {\n const scopedWarehouseId = warehouseId.trim()\n if (!scopedWarehouseId) return []\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n warehouseId: scopedWarehouseId,\n search: query?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<ZoneListRow>>(`/api/wms/zones?${params}`)\n if (!call.ok) return []\n return (call.result?.items ?? [])\n .map((item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const label = item.name?.trim() || item.code?.trim() || value\n const zoneWarehouseId = readZoneWarehouseId(item)\n return {\n value,\n label,\n ...(zoneWarehouseId ? { warehouseId: zoneWarehouseId } : {}),\n }\n })\n .filter((option): option is ZoneCrudFieldOption => option !== null)\n}\n\nexport async function resolveZoneLabel(zoneId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<ZoneListRow>(\n '/api/wms/zones',\n [zoneId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n return { value, label: item.name?.trim() || item.code?.trim() || value }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveZoneWarehouseId(zoneId: string): Promise<string | null> {\n const id = zoneId.trim()\n if (!id) return null\n const [option] = await loadCrudOptionsByIds<ZoneListRow>(\n '/api/wms/zones',\n [id],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n const warehouseId = readZoneWarehouseId(item)\n if (!value || !warehouseId) return null\n return { value, label: warehouseId }\n },\n )\n return option?.label ?? null\n}\n\nexport async function loadAssigneeOptions(\n query?: string,\n fallback?: { userId: string; label: string },\n): Promise<AssigneeOptionsResult> {\n const fallbackUserId = fallback?.userId.trim()\n const fallbackLabel = fallback?.label.trim()\n const fallbackOption =\n fallbackUserId && fallbackLabel\n ? [{ value: fallbackUserId, label: fallbackLabel }]\n : []\n\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n search: query?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<AuthUserListRow>>(`/api/auth/users?${params}`)\n if (!call.ok) {\n return {\n options: fallbackOption,\n canListUsers: false,\n }\n }\n\n const options = (call.result?.items ?? [])\n .map((item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const email = item.email?.trim() || value\n const role = item.roles?.find((entry) => entry.trim().length > 0)?.trim()\n const label = role ? `${email} (${role})` : email\n return { value, label }\n })\n .filter((option): option is CrudFieldOption => option !== null)\n\n return {\n options,\n canListUsers: true,\n }\n}\n\nexport async function resolveAssigneeLabel(userId: string): Promise<string | null> {\n const params = buildQuery({ page: 1, pageSize: 1, id: userId.trim() })\n const call = await apiCall<PagedResponse<AuthUserListRow>>(`/api/auth/users?${params}`)\n if (!call.ok) return null\n const item = call.result?.items?.[0]\n if (!item?.id) return null\n const email = item.email?.trim() || item.id\n const role = item.roles?.find((entry) => entry.trim().length > 0)?.trim()\n return role ? `${email} (${role})` : email\n}\n\nexport async function fetchCycleCountScopeEstimate(input: {\n warehouseId: string\n fromLocationId?: string | null\n toLocationId?: string | null\n}): Promise<{ expectedSkus: number; binCount: number }> {\n const warehouseId = input.warehouseId.trim()\n if (!warehouseId) return { expectedSkus: 0, binCount: 0 }\n\n const bins = await loadAllLocations(warehouseId, { type: 'bin' })\n const locationById = new Map(\n bins\n .map((location) => {\n const id = location.id?.trim()\n return id ? [id, location] as const : null\n })\n .filter((entry): entry is readonly [string, LocationListRow] => entry !== null),\n )\n\n const fromCode = input.fromLocationId ? locationById.get(input.fromLocationId.trim())?.code : undefined\n const toCode = input.toLocationId ? locationById.get(input.toLocationId.trim())?.code : undefined\n const scopedBins = filterLocationsByCodeRange(bins, fromCode, toCode)\n const scopedBinIds = new Set(\n scopedBins.map((location) => location.id?.trim()).filter((id): id is string => Boolean(id)),\n )\n const binCount = scopedBinIds.size\n\n const variantIds = new Set<string>()\n const pageSize = 100\n let page = 1\n\n // Short-page termination: `totalPages` derives from `total`, which is a\n // display value that can be capped (OM_LIST_COUNT_CAP) \u2014 never a loop bound.\n for (;;) {\n const params = buildQuery({\n page,\n pageSize,\n warehouseId,\n })\n const call = await apiCall<PagedResponse<{ catalog_variant_id?: string | null; location_id?: string | null; quantity_on_hand?: string | number | null }>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) {\n throw new ScopeEstimateError()\n }\n\n const batch = call.result?.items ?? []\n for (const row of batch) {\n const locationId = row.location_id?.trim()\n const variantId = row.catalog_variant_id?.trim()\n const onHand = Number(row.quantity_on_hand ?? 0)\n if (!locationId || !variantId || !Number.isFinite(onHand) || onHand <= 0) continue\n if (scopedBinIds.size > 0 && !scopedBinIds.has(locationId)) continue\n variantIds.add(variantId)\n }\n\n if (batch.length < pageSize) break\n if (page >= 10) break\n page += 1\n }\n\n return { expectedSkus: variantIds.size, binCount }\n}\n\nexport type InventoryBalanceLookupRow = {\n lot_id?: string | null\n quantity_on_hand?: string | number | null\n quantity_available?: number | null\n}\n\nfunction normalizeBalanceLotId(value: string | null | undefined): string | null {\n const trimmed = value?.trim()\n return trimmed || null\n}\n\nfunction readBalanceAvailable(row: InventoryBalanceLookupRow): number {\n const available = Number(row.quantity_available ?? row.quantity_on_hand ?? 0)\n return Number.isFinite(available) ? available : 0\n}\n\nfunction selectBalanceLookupRow(\n items: InventoryBalanceLookupRow[],\n lotId?: string | null,\n): InventoryBalanceLookupRow | null {\n if (items.length === 0) return null\n if (items.length === 1) return items[0]\n\n const normalizedLotId = normalizeBalanceLotId(lotId)\n if (normalizedLotId) {\n const exactMatch = items.find(\n (row) => normalizeBalanceLotId(row.lot_id) === normalizedLotId,\n )\n if (exactMatch) return exactMatch\n throw new BalanceLookupError('No balance bucket matches the selected lot.', 'LOT_NOT_FOUND')\n }\n\n const withoutLot = items.filter((row) => !normalizeBalanceLotId(row.lot_id))\n if (withoutLot.length === 1) return withoutLot[0]\n\n const candidateLotIds = [\n ...new Set(\n items\n .map((row) => normalizeBalanceLotId(row.lot_id))\n .filter((id): id is string => Boolean(id)),\n ),\n ]\n throw new BalanceLookupError(\n 'Multiple balance buckets match this location; specify a lot.',\n 'LOT_REQUIRED',\n candidateLotIds,\n )\n}\n\nexport async function fetchBalanceAvailable(input: {\n warehouseId: string\n locationId: string\n catalogVariantId: string\n lotId?: string | null\n}): Promise<number> {\n const params = buildQuery({\n page: 1,\n pageSize: 20,\n warehouseId: input.warehouseId,\n locationId: input.locationId,\n catalogVariantId: input.catalogVariantId,\n lotId: input.lotId?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<InventoryBalanceLookupRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) {\n throw new BalanceLookupError()\n }\n const row = selectBalanceLookupRow(call.result?.items ?? [], input.lotId)\n if (!row) return 0\n return readBalanceAvailable(row)\n}\n\nfunction mapInventoryLotListRowToOption(item: InventoryLotListRow): CrudFieldOption | null {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const lotNumber = item.lot_number?.trim() || value\n const expiresAt = item.expires_at?.trim()\n const label = expiresAt ? `${lotNumber} \u00B7 exp ${expiresAt.slice(0, 10)}` : lotNumber\n return { value, label }\n}\n\nfunction mapInventoryLotListRowToLotNumberOption(item: InventoryLotListRow): CrudFieldOption | null {\n const lotNumber = item.lot_number?.trim()\n if (!lotNumber) return null\n const expiresAt = item.expires_at?.trim()\n const label = expiresAt ? `${lotNumber} \u00B7 exp ${expiresAt.slice(0, 10)}` : lotNumber\n return { value: lotNumber, label }\n}\n\nasync function loadInventoryLotListOptions(\n catalogVariantId: string,\n query: string | undefined,\n mapItem: (item: InventoryLotListRow) => CrudFieldOption | null,\n): Promise<CrudFieldOption[]> {\n if (!catalogVariantId) return []\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n catalogVariantId,\n status: 'available',\n search: query?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<InventoryLotListRow>>(`/api/wms/lots?${params}`)\n if (!call.ok) return []\n return (call.result?.items ?? [])\n .map(mapItem)\n .filter((option): option is CrudFieldOption => option !== null)\n}\n\nexport async function loadLotOptions(\n catalogVariantId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n return loadInventoryLotListOptions(catalogVariantId, query, mapInventoryLotListRowToOption)\n}\n\n/** Resolve display options for known lot IDs (e.g. candidates from a LOT_REQUIRED balance lookup). */\nexport async function loadLotOptionsByIds(lotIds: string[]): Promise<CrudFieldOption[]> {\n return loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n lotIds,\n mapInventoryLotListRowToOption,\n )\n}\n\n// Scopes lot suggestions to the lots actually present in the given warehouse\n// location's balance buckets, instead of every lot ever created for the\n// variant. This is what backs the LOT_REQUIRED disambiguation flow: when a\n// location holds multiple lot-bearing balances for the same variant, the\n// candidates offered here are exactly the ones `selectBalanceLookupRow` would\n// otherwise reject as ambiguous.\nexport async function loadLotOptionsForBalanceLocation(input: {\n warehouseId: string\n locationId: string\n catalogVariantId: string\n query?: string\n}): Promise<CrudFieldOption[]> {\n const warehouseId = input.warehouseId.trim()\n const locationId = input.locationId.trim()\n const catalogVariantId = input.catalogVariantId.trim()\n if (!warehouseId || !locationId || !catalogVariantId) return []\n\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n warehouseId,\n locationId,\n catalogVariantId,\n })\n const call = await apiCall<PagedResponse<InventoryBalanceLookupRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) return []\n\n const lotIds = [\n ...new Set(\n (call.result?.items ?? [])\n .map((row) => normalizeBalanceLotId(row.lot_id))\n .filter((id): id is string => Boolean(id)),\n ),\n ]\n if (lotIds.length === 0) return []\n\n const options = await loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n lotIds,\n mapInventoryLotListRowToOption,\n )\n\n const query = input.query?.trim().toLowerCase()\n if (!query) return options\n return options.filter((option) => option.label.toLowerCase().includes(query))\n}\n\nexport async function loadLotNumberOptions(\n catalogVariantId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n return loadInventoryLotListOptions(catalogVariantId, query, mapInventoryLotListRowToLotNumberOption)\n}\n\nexport class ScopeQueueError extends Error {\n constructor(message = 'Failed to build cycle count scope queue.') {\n super(message)\n this.name = 'ScopeQueueError'\n }\n}\n\nexport type ScopeQueueItem = {\n locationId: string\n locationCode: string\n catalogVariantId: string\n lotId: string | null\n expectedOnHand: number\n}\n\nexport async function buildCycleCountScopeQueue(input: {\n warehouseId: string\n fromLocationId?: string | null\n toLocationId?: string | null\n}): Promise<ScopeQueueItem[]> {\n const warehouseId = input.warehouseId.trim()\n if (!warehouseId) return []\n\n const bins = await loadAllLocations(warehouseId, { type: 'bin' })\n const binById = new Map(\n bins\n .map((b) => {\n const id = b.id?.trim()\n return id ? ([id, b] as const) : null\n })\n .filter((entry): entry is readonly [string, LocationListRow] => entry !== null),\n )\n\n const fromCode = input.fromLocationId?.trim()\n ? binById.get(input.fromLocationId.trim())?.code\n : undefined\n const toCode = input.toLocationId?.trim()\n ? binById.get(input.toLocationId.trim())?.code\n : undefined\n\n const scopedBins = filterLocationsByCodeRange(bins, fromCode, toCode)\n const scopedBinIds = new Set(\n scopedBins.map((b) => b.id?.trim()).filter((id): id is string => Boolean(id)),\n )\n\n if (scopedBinIds.size === 0) return []\n\n type BalanceRow = {\n catalog_variant_id?: string | null\n location_id?: string | null\n lot_id?: string | null\n quantity_on_hand?: string | number | null\n }\n\n const items: ScopeQueueItem[] = []\n const pageSize = 100\n let page = 1\n\n // Short-page termination: `totalPages` derives from `total`, which is a\n // display value that can be capped (OM_LIST_COUNT_CAP) \u2014 never a loop bound.\n for (;;) {\n const params = buildQuery({ page, pageSize, warehouseId })\n const call = await apiCall<PagedResponse<BalanceRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) throw new ScopeQueueError()\n\n const batch = call.result?.items ?? []\n for (const row of batch) {\n const locationId = row.location_id?.trim()\n const variantId = row.catalog_variant_id?.trim()\n const lotId = row.lot_id?.trim() || null\n const onHand = Number(row.quantity_on_hand ?? 0)\n\n if (!locationId || !variantId) continue\n if (!scopedBinIds.has(locationId)) continue\n if (!Number.isFinite(onHand) || onHand <= 0) continue\n\n const bin = binById.get(locationId)\n items.push({\n locationId,\n locationCode: bin?.code?.trim() ?? locationId,\n catalogVariantId: variantId,\n lotId,\n expectedOnHand: onHand,\n })\n }\n\n if (batch.length < pageSize) break\n if (page >= 20) break\n page += 1\n }\n\n items.sort((a, b) => {\n const cmp = a.locationCode.localeCompare(b.locationCode, undefined, {\n numeric: true,\n sensitivity: 'base',\n })\n return cmp !== 0 ? cmp : a.catalogVariantId.localeCompare(b.catalogVariantId)\n })\n\n return items\n}\n\nexport async function fetchVariantReorderPoint(catalogVariantId: string): Promise<number> {\n if (!catalogVariantId) return 0\n const params = buildQuery({\n page: 1,\n pageSize: 1,\n catalogVariantId,\n })\n const call = await apiCall<PagedResponse<{ reorder_point?: string | number | null }>>(\n `/api/wms/inventory-profiles?${params}`,\n )\n if (!call.ok) return 0\n const row = call.result?.items?.[0]\n if (!row) return 0\n const reorderPoint = Number(row.reorder_point ?? 0)\n return Number.isFinite(reorderPoint) ? reorderPoint : 0\n}\n\nexport type LocationCapacitySnapshot = {\n capacityUnits: number | null\n totalOnHand: number\n}\n\nasync function fetchLocationCapacityUnits(locationId: string): Promise<number | null> {\n const id = locationId.trim()\n if (!id) return null\n const params = buildQuery({ page: 1, pageSize: 1, ids: id })\n const call = await apiCall<PagedResponse<{ id?: string | null; capacity_units?: string | number | null }>>(\n `/api/wms/locations?${params}`,\n )\n if (!call.ok) return null\n const raw = call.result?.items?.[0]?.capacity_units\n if (raw == null) return null\n const value = Number(raw)\n return Number.isFinite(value) ? value : null\n}\n\nconst LOCATION_TOTAL_ON_HAND_PAGE_SIZE = 100\nconst LOCATION_TOTAL_ON_HAND_MAX_PAGES = 50\n\nasync function fetchLocationTotalOnHand(input: {\n warehouseId: string\n locationId: string\n}): Promise<number> {\n const locationId = input.locationId.trim()\n if (!locationId) return 0\n let sum = 0\n let page = 1\n // Short-page termination: this sum is user-visible, and `totalPages` derives\n // from `total`, which is a display value that can be capped\n // (OM_LIST_COUNT_CAP) \u2014 never a loop bound.\n for (;;) {\n const params = buildQuery({\n page,\n pageSize: LOCATION_TOTAL_ON_HAND_PAGE_SIZE,\n warehouseId: input.warehouseId,\n locationId,\n })\n const call = await apiCall<PagedResponse<{ quantity_on_hand?: string | number | null }>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) break\n const batch = call.result?.items ?? []\n for (const row of batch) {\n const value = Number(row.quantity_on_hand ?? 0)\n if (Number.isFinite(value)) sum += value\n }\n if (batch.length < LOCATION_TOTAL_ON_HAND_PAGE_SIZE) break\n if (page >= LOCATION_TOTAL_ON_HAND_MAX_PAGES) break\n page += 1\n }\n return sum\n}\n\nexport async function fetchLocationCapacitySnapshot(input: {\n warehouseId: string\n locationId: string\n}): Promise<LocationCapacitySnapshot> {\n const [capacityUnits, totalOnHand] = await Promise.all([\n fetchLocationCapacityUnits(input.locationId),\n fetchLocationTotalOnHand(input),\n ])\n return { capacityUnits, totalOnHand }\n}\n\nexport async function fetchBalanceOnHand(input: {\n warehouseId: string\n locationId: string\n catalogVariantId: string\n lotId?: string | null\n}): Promise<number> {\n const params = buildQuery({\n page: 1,\n pageSize: 20,\n warehouseId: input.warehouseId,\n locationId: input.locationId,\n catalogVariantId: input.catalogVariantId,\n lotId: input.lotId?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<InventoryBalanceLookupRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) {\n throw new BalanceLookupError()\n }\n const row = selectBalanceLookupRow(call.result?.items ?? [], input.lotId)\n if (!row) return 0\n const onHand = Number(row.quantity_on_hand ?? 0)\n return Number.isFinite(onHand) ? onHand : 0\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;A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AA,EAC/B;AACA,QAAM,MAAM,uBAAuB,KAAK,QAAQ,SAAS,CAAC,GAAG,MAAM,KAAK;AACxE,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,SAAS,OAAO,IAAI,oBAAoB,CAAC;AAC/C,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;",
|
|
4
|
+
"sourcesContent": ["import type { CrudFieldOption } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport {\n buildQuery,\n loadCatalogVariantOptions,\n loadWarehouseOptions,\n} from './wmsLookupLoaders'\n\nexport { buildQuery, loadCatalogVariantOptions, loadWarehouseOptions }\n\ntype PagedResponse<T> = {\n items: T[]\n total: number\n totalPages: number\n}\n\ntype InventoryLotListRow = {\n id?: string | null\n lot_number?: string | null\n expires_at?: string | null\n}\n\nasync function loadCrudOptionsByIds<T>(\n endpoint: string,\n ids: string[],\n mapItem: (item: T) => CrudFieldOption | null,\n): Promise<CrudFieldOption[]> {\n const normalizedIds = [...new Set(ids.map((id) => id.trim()).filter(Boolean))]\n if (normalizedIds.length === 0) return []\n const params = buildQuery({\n page: 1,\n pageSize: normalizedIds.length,\n ids: normalizedIds.join(','),\n })\n const call = await apiCall<PagedResponse<T>>(`${endpoint}?${params}`)\n if (!call.ok) return []\n return (call.result?.items ?? [])\n .map(mapItem)\n .filter((option): option is CrudFieldOption => option !== null)\n}\n\nexport async function resolveCatalogVariantLabel(catalogVariantId: string): Promise<string | null> {\n const id = catalogVariantId.trim()\n if (!id) return null\n const params = buildQuery({ page: 1, pageSize: 1, id })\n const call = await apiCall<PagedResponse<{ id?: string | null; name?: string | null; sku?: string | null }>>(\n `/api/catalog/variants?${params}`,\n )\n if (!call.ok) return null\n const item = call.result?.items?.[0]\n if (!item) return null\n return item.sku?.trim() || item.name?.trim() || id\n}\n\nexport async function resolveWarehouseLabel(warehouseId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<{ id?: string | null; name?: string | null; code?: string | null }>(\n '/api/wms/warehouses',\n [warehouseId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n return { value, label: item.name || item.code || value }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveLocationLabel(locationId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<{ id?: string | null; code?: string | null }>(\n '/api/wms/locations',\n [locationId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n return { value, label: item.code || value }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveLotLabel(lotId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n [lotId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const lotNumber = item.lot_number?.trim() || value\n const expiresAt = item.expires_at?.trim()\n const label = expiresAt ? `${lotNumber} \u00B7 exp ${expiresAt.slice(0, 10)}` : lotNumber\n return { value, label }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveLotNumberFromId(lotId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n [lotId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n const lotNumber = item.lot_number?.trim()\n if (!value || !lotNumber) return null\n return { value, label: lotNumber }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveCatalogVariantSku(catalogVariantId: string): Promise<string | null> {\n const id = catalogVariantId.trim()\n if (!id) return null\n const params = buildQuery({ page: 1, pageSize: 1, id })\n const call = await apiCall<PagedResponse<{ id?: string | null; sku?: string | null }>>(\n `/api/catalog/variants?${params}`,\n )\n if (!call.ok) return null\n const sku = call.result?.items?.[0]?.sku?.trim()\n return sku || null\n}\n\ntype InventoryProfileListRow = {\n track_lot?: boolean | null\n track_serial?: boolean | null\n}\n\nexport async function loadInventoryProfileForVariant(\n catalogVariantId: string,\n): Promise<InventoryProfileListRow | null> {\n const variantId = catalogVariantId.trim()\n if (!variantId) return null\n const params = buildQuery({ page: 1, pageSize: 1, catalogVariantId: variantId })\n const call = await apiCall<PagedResponse<InventoryProfileListRow>>(\n `/api/wms/inventory-profiles?${params}`,\n )\n if (!call.ok) return null\n return call.result?.items?.[0] ?? null\n}\n\nexport async function findLotIdByNumber(\n catalogVariantId: string,\n lotNumber: string,\n): Promise<string | null> {\n const variantId = catalogVariantId.trim()\n const normalizedLotNumber = lotNumber.trim()\n if (!variantId || !normalizedLotNumber) return null\n\n const params = buildQuery({\n page: 1,\n pageSize: 20,\n catalogVariantId: variantId,\n search: normalizedLotNumber,\n })\n const call = await apiCall<PagedResponse<InventoryLotListRow>>(`/api/wms/lots?${params}`)\n if (!call.ok) return null\n\n const match = (call.result?.items ?? []).find(\n (item) => item.lot_number?.trim().toLowerCase() === normalizedLotNumber.toLowerCase(),\n )\n return typeof match?.id === 'string' ? match.id : null\n}\n\nexport class InventoryLotMutationError extends Error {\n constructor(message = 'Failed to resolve inventory lot.') {\n super(message)\n this.name = 'InventoryLotMutationError'\n }\n}\n\nexport async function ensureLotIdForInventoryMutation(input: {\n catalogVariantId: string\n lotNumber: string\n organizationId: string\n tenantId: string\n}): Promise<string> {\n const lotNumber = input.lotNumber.trim()\n if (!lotNumber) {\n throw new InventoryLotMutationError('Lot number is required.')\n }\n\n const existingId = await findLotIdByNumber(input.catalogVariantId, lotNumber)\n if (existingId) return existingId\n\n const sku = await resolveCatalogVariantSku(input.catalogVariantId)\n if (!sku) {\n throw new InventoryLotMutationError('Could not resolve SKU for the selected variant.')\n }\n\n const call = await apiCall<{ id?: string | null }>('/api/wms/lots', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n catalogVariantId: input.catalogVariantId,\n sku,\n lotNumber,\n status: 'available',\n }),\n })\n\n if (!call.ok) {\n const racedId = await findLotIdByNumber(input.catalogVariantId, lotNumber)\n if (racedId) return racedId\n throw new InventoryLotMutationError('Failed to create inventory lot.')\n }\n\n const createdId = call.result?.id?.trim()\n if (createdId) return createdId\n\n const resolvedId = await findLotIdByNumber(input.catalogVariantId, lotNumber)\n if (resolvedId) return resolvedId\n\n throw new InventoryLotMutationError('Failed to resolve created inventory lot.')\n}\n\ntype LocationListRow = {\n id?: string | null\n code?: string | null\n type?: string | null\n}\n\ntype ZoneListRow = {\n id?: string | null\n name?: string | null\n code?: string | null\n warehouse_id?: string | null\n warehouseId?: string | null\n}\n\nexport type ZoneCrudFieldOption = CrudFieldOption & {\n warehouseId?: string\n}\n\nfunction readZoneWarehouseId(item: ZoneListRow): string | null {\n if (typeof item.warehouse_id === 'string' && item.warehouse_id.trim()) {\n return item.warehouse_id.trim()\n }\n if (typeof item.warehouseId === 'string' && item.warehouseId.trim()) {\n return item.warehouseId.trim()\n }\n return null\n}\n\ntype AuthUserListRow = {\n id?: string | null\n email?: string | null\n roles?: string[] | null\n}\n\nexport type AssigneeOptionsResult = {\n options: CrudFieldOption[]\n canListUsers: boolean\n}\n\nexport type BalanceLookupErrorCode = 'LOOKUP_FAILED' | 'LOT_REQUIRED' | 'LOT_NOT_FOUND'\n\nexport class BalanceLookupError extends Error {\n code: BalanceLookupErrorCode\n /** Lot IDs present at the ambiguous location (set when `code === 'LOT_REQUIRED'`). */\n candidateLotIds: string[]\n\n constructor(\n message = 'Failed to load inventory balance.',\n code: BalanceLookupErrorCode = 'LOOKUP_FAILED',\n candidateLotIds: string[] = [],\n ) {\n super(message)\n this.name = 'BalanceLookupError'\n this.code = code\n this.candidateLotIds = candidateLotIds\n }\n}\n\nexport class ScopeEstimateError extends Error {\n constructor(message = 'Failed to estimate cycle count scope.') {\n super(message)\n this.name = 'ScopeEstimateError'\n }\n}\n\nfunction compareLocationCodes(left: string, right: string): number {\n return left.localeCompare(right, undefined, { numeric: true, sensitivity: 'base' })\n}\n\nfunction isLocationCodeWithinRange(\n code: string,\n fromCode?: string | null,\n toCode?: string | null,\n): boolean {\n const from = fromCode?.trim()\n const to = toCode?.trim()\n if (from && compareLocationCodes(code, from) < 0) return false\n if (to && compareLocationCodes(code, to) > 0) return false\n return true\n}\n\nexport function formatCycleCountZoneLabel(\n baseLabel: string,\n stats?: { expectedSkus: number; binCount: number },\n): string {\n const trimmed = baseLabel.trim()\n if (!trimmed || !stats) return trimmed\n return `${trimmed} \u00B7 ${stats.expectedSkus} SKUs \u00B7 ${stats.binCount} bins`\n}\n\nexport function mapLocationOptions(items: LocationListRow[]): CrudFieldOption[] {\n return items\n .map((item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const label = item.code || value\n return { value, label }\n })\n .filter((option): option is CrudFieldOption => option !== null)\n}\n\nexport async function loadAllLocations(\n warehouseId: string,\n filters: { type?: string; search?: string },\n): Promise<LocationListRow[]> {\n const items: LocationListRow[] = []\n let page = 1\n let totalPages = 1\n\n while (page <= totalPages && page <= 10) {\n const params = buildQuery({\n page,\n pageSize: 100,\n warehouseId,\n type: filters.type,\n search: filters.search?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<LocationListRow>>(`/api/wms/locations?${params}`)\n if (!call.ok) break\n items.push(...(call.result?.items ?? []))\n totalPages = call.result?.totalPages ?? 1\n page += 1\n }\n\n return items\n}\n\nexport function filterLocationsByCodeRange(\n locations: LocationListRow[],\n fromCode?: string | null,\n toCode?: string | null,\n): LocationListRow[] {\n const from = fromCode?.trim()\n const to = toCode?.trim()\n if (!from && !to) return locations\n return locations.filter((location) => {\n const code = location.code?.trim()\n if (!code) return false\n return isLocationCodeWithinRange(code, from, to)\n })\n}\n\nasync function loadLocationPage(\n warehouseId: string,\n filters: { type?: string; search?: string; page?: number; pageSize?: number },\n): Promise<PagedResponse<LocationListRow>> {\n const params = buildQuery({\n page: filters.page ?? 1,\n pageSize: filters.pageSize ?? 50,\n warehouseId,\n type: filters.type,\n search: filters.search?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<LocationListRow>>(`/api/wms/locations?${params}`)\n if (!call.ok) {\n throw new BalanceLookupError('Failed to load warehouse locations.')\n }\n return call.result ?? { items: [], total: 0, totalPages: 0 }\n}\n\nexport async function loadLocationOptions(\n warehouseId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n if (!warehouseId) return []\n try {\n const page = await loadLocationPage(warehouseId, { search: query })\n return mapLocationOptions(page.items ?? [])\n } catch {\n return []\n }\n}\n\nexport async function loadBinLocationOptions(\n warehouseId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n if (!warehouseId) return []\n try {\n const page = await loadLocationPage(warehouseId, { type: 'bin', search: query })\n return mapLocationOptions(page.items ?? [])\n } catch {\n return []\n }\n}\n\nexport async function loadZoneOptions(\n warehouseId: string,\n query?: string,\n): Promise<ZoneCrudFieldOption[]> {\n const scopedWarehouseId = warehouseId.trim()\n if (!scopedWarehouseId) return []\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n warehouseId: scopedWarehouseId,\n search: query?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<ZoneListRow>>(`/api/wms/zones?${params}`)\n if (!call.ok) return []\n return (call.result?.items ?? [])\n .map((item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const label = item.name?.trim() || item.code?.trim() || value\n const zoneWarehouseId = readZoneWarehouseId(item)\n return {\n value,\n label,\n ...(zoneWarehouseId ? { warehouseId: zoneWarehouseId } : {}),\n }\n })\n .filter((option): option is ZoneCrudFieldOption => option !== null)\n}\n\nexport async function resolveZoneLabel(zoneId: string): Promise<string | null> {\n const [option] = await loadCrudOptionsByIds<ZoneListRow>(\n '/api/wms/zones',\n [zoneId],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n return { value, label: item.name?.trim() || item.code?.trim() || value }\n },\n )\n return option?.label ?? null\n}\n\nexport async function resolveZoneWarehouseId(zoneId: string): Promise<string | null> {\n const id = zoneId.trim()\n if (!id) return null\n const [option] = await loadCrudOptionsByIds<ZoneListRow>(\n '/api/wms/zones',\n [id],\n (item) => {\n const value = typeof item.id === 'string' ? item.id : null\n const warehouseId = readZoneWarehouseId(item)\n if (!value || !warehouseId) return null\n return { value, label: warehouseId }\n },\n )\n return option?.label ?? null\n}\n\nexport async function loadAssigneeOptions(\n query?: string,\n fallback?: { userId: string; label: string },\n): Promise<AssigneeOptionsResult> {\n const fallbackUserId = fallback?.userId.trim()\n const fallbackLabel = fallback?.label.trim()\n const fallbackOption =\n fallbackUserId && fallbackLabel\n ? [{ value: fallbackUserId, label: fallbackLabel }]\n : []\n\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n search: query?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<AuthUserListRow>>(`/api/auth/users?${params}`)\n if (!call.ok) {\n return {\n options: fallbackOption,\n canListUsers: false,\n }\n }\n\n const options = (call.result?.items ?? [])\n .map((item) => {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const email = item.email?.trim() || value\n const role = item.roles?.find((entry) => entry.trim().length > 0)?.trim()\n const label = role ? `${email} (${role})` : email\n return { value, label }\n })\n .filter((option): option is CrudFieldOption => option !== null)\n\n return {\n options,\n canListUsers: true,\n }\n}\n\nexport async function resolveAssigneeLabel(userId: string): Promise<string | null> {\n const params = buildQuery({ page: 1, pageSize: 1, id: userId.trim() })\n const call = await apiCall<PagedResponse<AuthUserListRow>>(`/api/auth/users?${params}`)\n if (!call.ok) return null\n const item = call.result?.items?.[0]\n if (!item?.id) return null\n const email = item.email?.trim() || item.id\n const role = item.roles?.find((entry) => entry.trim().length > 0)?.trim()\n return role ? `${email} (${role})` : email\n}\n\nexport async function fetchCycleCountScopeEstimate(input: {\n warehouseId: string\n fromLocationId?: string | null\n toLocationId?: string | null\n}): Promise<{ expectedSkus: number; binCount: number }> {\n const warehouseId = input.warehouseId.trim()\n if (!warehouseId) return { expectedSkus: 0, binCount: 0 }\n\n const bins = await loadAllLocations(warehouseId, { type: 'bin' })\n const locationById = new Map(\n bins\n .map((location) => {\n const id = location.id?.trim()\n return id ? [id, location] as const : null\n })\n .filter((entry): entry is readonly [string, LocationListRow] => entry !== null),\n )\n\n const fromCode = input.fromLocationId ? locationById.get(input.fromLocationId.trim())?.code : undefined\n const toCode = input.toLocationId ? locationById.get(input.toLocationId.trim())?.code : undefined\n const scopedBins = filterLocationsByCodeRange(bins, fromCode, toCode)\n const scopedBinIds = new Set(\n scopedBins.map((location) => location.id?.trim()).filter((id): id is string => Boolean(id)),\n )\n const binCount = scopedBinIds.size\n\n const variantIds = new Set<string>()\n let page = 1\n let totalPages = 1\n\n while (page <= totalPages && page <= 10) {\n const params = buildQuery({\n page,\n pageSize: 100,\n warehouseId,\n })\n const call = await apiCall<PagedResponse<{ catalog_variant_id?: string | null; location_id?: string | null; quantity_on_hand?: string | number | null }>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) {\n throw new ScopeEstimateError()\n }\n\n for (const row of call.result?.items ?? []) {\n const locationId = row.location_id?.trim()\n const variantId = row.catalog_variant_id?.trim()\n const onHand = Number(row.quantity_on_hand ?? 0)\n if (!locationId || !variantId || !Number.isFinite(onHand) || onHand <= 0) continue\n if (scopedBinIds.size > 0 && !scopedBinIds.has(locationId)) continue\n variantIds.add(variantId)\n }\n\n totalPages = call.result?.totalPages ?? 1\n page += 1\n }\n\n return { expectedSkus: variantIds.size, binCount }\n}\n\nexport type InventoryBalanceLookupRow = {\n lot_id?: string | null\n quantity_on_hand?: string | number | null\n quantity_available?: number | null\n}\n\nfunction normalizeBalanceLotId(value: string | null | undefined): string | null {\n const trimmed = value?.trim()\n return trimmed || null\n}\n\nfunction readBalanceAvailable(row: InventoryBalanceLookupRow): number {\n const available = Number(row.quantity_available ?? row.quantity_on_hand ?? 0)\n return Number.isFinite(available) ? available : 0\n}\n\nfunction selectBalanceLookupRow(\n items: InventoryBalanceLookupRow[],\n lotId?: string | null,\n): InventoryBalanceLookupRow | null {\n if (items.length === 0) return null\n if (items.length === 1) return items[0]\n\n const normalizedLotId = normalizeBalanceLotId(lotId)\n if (normalizedLotId) {\n const exactMatch = items.find(\n (row) => normalizeBalanceLotId(row.lot_id) === normalizedLotId,\n )\n if (exactMatch) return exactMatch\n throw new BalanceLookupError('No balance bucket matches the selected lot.', 'LOT_NOT_FOUND')\n }\n\n const withoutLot = items.filter((row) => !normalizeBalanceLotId(row.lot_id))\n if (withoutLot.length === 1) return withoutLot[0]\n\n const candidateLotIds = [\n ...new Set(\n items\n .map((row) => normalizeBalanceLotId(row.lot_id))\n .filter((id): id is string => Boolean(id)),\n ),\n ]\n throw new BalanceLookupError(\n 'Multiple balance buckets match this location; specify a lot.',\n 'LOT_REQUIRED',\n candidateLotIds,\n )\n}\n\nexport async function fetchBalanceAvailable(input: {\n warehouseId: string\n locationId: string\n catalogVariantId: string\n lotId?: string | null\n}): Promise<number> {\n const params = buildQuery({\n page: 1,\n pageSize: 20,\n warehouseId: input.warehouseId,\n locationId: input.locationId,\n catalogVariantId: input.catalogVariantId,\n lotId: input.lotId?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<InventoryBalanceLookupRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) {\n throw new BalanceLookupError()\n }\n const row = selectBalanceLookupRow(call.result?.items ?? [], input.lotId)\n if (!row) return 0\n return readBalanceAvailable(row)\n}\n\nfunction mapInventoryLotListRowToOption(item: InventoryLotListRow): CrudFieldOption | null {\n const value = typeof item.id === 'string' ? item.id : null\n if (!value) return null\n const lotNumber = item.lot_number?.trim() || value\n const expiresAt = item.expires_at?.trim()\n const label = expiresAt ? `${lotNumber} \u00B7 exp ${expiresAt.slice(0, 10)}` : lotNumber\n return { value, label }\n}\n\nfunction mapInventoryLotListRowToLotNumberOption(item: InventoryLotListRow): CrudFieldOption | null {\n const lotNumber = item.lot_number?.trim()\n if (!lotNumber) return null\n const expiresAt = item.expires_at?.trim()\n const label = expiresAt ? `${lotNumber} \u00B7 exp ${expiresAt.slice(0, 10)}` : lotNumber\n return { value: lotNumber, label }\n}\n\nasync function loadInventoryLotListOptions(\n catalogVariantId: string,\n query: string | undefined,\n mapItem: (item: InventoryLotListRow) => CrudFieldOption | null,\n): Promise<CrudFieldOption[]> {\n if (!catalogVariantId) return []\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n catalogVariantId,\n status: 'available',\n search: query?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<InventoryLotListRow>>(`/api/wms/lots?${params}`)\n if (!call.ok) return []\n return (call.result?.items ?? [])\n .map(mapItem)\n .filter((option): option is CrudFieldOption => option !== null)\n}\n\nexport async function loadLotOptions(\n catalogVariantId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n return loadInventoryLotListOptions(catalogVariantId, query, mapInventoryLotListRowToOption)\n}\n\n/** Resolve display options for known lot IDs (e.g. candidates from a LOT_REQUIRED balance lookup). */\nexport async function loadLotOptionsByIds(lotIds: string[]): Promise<CrudFieldOption[]> {\n return loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n lotIds,\n mapInventoryLotListRowToOption,\n )\n}\n\n// Scopes lot suggestions to the lots actually present in the given warehouse\n// location's balance buckets, instead of every lot ever created for the\n// variant. This is what backs the LOT_REQUIRED disambiguation flow: when a\n// location holds multiple lot-bearing balances for the same variant, the\n// candidates offered here are exactly the ones `selectBalanceLookupRow` would\n// otherwise reject as ambiguous.\nexport async function loadLotOptionsForBalanceLocation(input: {\n warehouseId: string\n locationId: string\n catalogVariantId: string\n query?: string\n}): Promise<CrudFieldOption[]> {\n const warehouseId = input.warehouseId.trim()\n const locationId = input.locationId.trim()\n const catalogVariantId = input.catalogVariantId.trim()\n if (!warehouseId || !locationId || !catalogVariantId) return []\n\n const params = buildQuery({\n page: 1,\n pageSize: 50,\n warehouseId,\n locationId,\n catalogVariantId,\n })\n const call = await apiCall<PagedResponse<InventoryBalanceLookupRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) return []\n\n const lotIds = [\n ...new Set(\n (call.result?.items ?? [])\n .map((row) => normalizeBalanceLotId(row.lot_id))\n .filter((id): id is string => Boolean(id)),\n ),\n ]\n if (lotIds.length === 0) return []\n\n const options = await loadCrudOptionsByIds<InventoryLotListRow>(\n '/api/wms/lots',\n lotIds,\n mapInventoryLotListRowToOption,\n )\n\n const query = input.query?.trim().toLowerCase()\n if (!query) return options\n return options.filter((option) => option.label.toLowerCase().includes(query))\n}\n\nexport async function loadLotNumberOptions(\n catalogVariantId: string,\n query?: string,\n): Promise<CrudFieldOption[]> {\n return loadInventoryLotListOptions(catalogVariantId, query, mapInventoryLotListRowToLotNumberOption)\n}\n\nexport class ScopeQueueError extends Error {\n constructor(message = 'Failed to build cycle count scope queue.') {\n super(message)\n this.name = 'ScopeQueueError'\n }\n}\n\nexport type ScopeQueueItem = {\n locationId: string\n locationCode: string\n catalogVariantId: string\n lotId: string | null\n expectedOnHand: number\n}\n\nexport async function buildCycleCountScopeQueue(input: {\n warehouseId: string\n fromLocationId?: string | null\n toLocationId?: string | null\n}): Promise<ScopeQueueItem[]> {\n const warehouseId = input.warehouseId.trim()\n if (!warehouseId) return []\n\n const bins = await loadAllLocations(warehouseId, { type: 'bin' })\n const binById = new Map(\n bins\n .map((b) => {\n const id = b.id?.trim()\n return id ? ([id, b] as const) : null\n })\n .filter((entry): entry is readonly [string, LocationListRow] => entry !== null),\n )\n\n const fromCode = input.fromLocationId?.trim()\n ? binById.get(input.fromLocationId.trim())?.code\n : undefined\n const toCode = input.toLocationId?.trim()\n ? binById.get(input.toLocationId.trim())?.code\n : undefined\n\n const scopedBins = filterLocationsByCodeRange(bins, fromCode, toCode)\n const scopedBinIds = new Set(\n scopedBins.map((b) => b.id?.trim()).filter((id): id is string => Boolean(id)),\n )\n\n if (scopedBinIds.size === 0) return []\n\n type BalanceRow = {\n catalog_variant_id?: string | null\n location_id?: string | null\n lot_id?: string | null\n quantity_on_hand?: string | number | null\n }\n\n const items: ScopeQueueItem[] = []\n let page = 1\n let totalPages = 1\n\n while (page <= totalPages && page <= 20) {\n const params = buildQuery({ page, pageSize: 100, warehouseId })\n const call = await apiCall<PagedResponse<BalanceRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) throw new ScopeQueueError()\n\n for (const row of call.result?.items ?? []) {\n const locationId = row.location_id?.trim()\n const variantId = row.catalog_variant_id?.trim()\n const lotId = row.lot_id?.trim() || null\n const onHand = Number(row.quantity_on_hand ?? 0)\n\n if (!locationId || !variantId) continue\n if (!scopedBinIds.has(locationId)) continue\n if (!Number.isFinite(onHand) || onHand <= 0) continue\n\n const bin = binById.get(locationId)\n items.push({\n locationId,\n locationCode: bin?.code?.trim() ?? locationId,\n catalogVariantId: variantId,\n lotId,\n expectedOnHand: onHand,\n })\n }\n\n totalPages = call.result?.totalPages ?? 1\n page += 1\n }\n\n items.sort((a, b) => {\n const cmp = a.locationCode.localeCompare(b.locationCode, undefined, {\n numeric: true,\n sensitivity: 'base',\n })\n return cmp !== 0 ? cmp : a.catalogVariantId.localeCompare(b.catalogVariantId)\n })\n\n return items\n}\n\nexport async function fetchVariantReorderPoint(catalogVariantId: string): Promise<number> {\n if (!catalogVariantId) return 0\n const params = buildQuery({\n page: 1,\n pageSize: 1,\n catalogVariantId,\n })\n const call = await apiCall<PagedResponse<{ reorder_point?: string | number | null }>>(\n `/api/wms/inventory-profiles?${params}`,\n )\n if (!call.ok) return 0\n const row = call.result?.items?.[0]\n if (!row) return 0\n const reorderPoint = Number(row.reorder_point ?? 0)\n return Number.isFinite(reorderPoint) ? reorderPoint : 0\n}\n\nexport type LocationCapacitySnapshot = {\n capacityUnits: number | null\n totalOnHand: number\n}\n\nasync function fetchLocationCapacityUnits(locationId: string): Promise<number | null> {\n const id = locationId.trim()\n if (!id) return null\n const params = buildQuery({ page: 1, pageSize: 1, ids: id })\n const call = await apiCall<PagedResponse<{ id?: string | null; capacity_units?: string | number | null }>>(\n `/api/wms/locations?${params}`,\n )\n if (!call.ok) return null\n const raw = call.result?.items?.[0]?.capacity_units\n if (raw == null) return null\n const value = Number(raw)\n return Number.isFinite(value) ? value : null\n}\n\nconst LOCATION_TOTAL_ON_HAND_PAGE_SIZE = 100\nconst LOCATION_TOTAL_ON_HAND_MAX_PAGES = 50\n\nasync function fetchLocationTotalOnHand(input: {\n warehouseId: string\n locationId: string\n}): Promise<number> {\n const locationId = input.locationId.trim()\n if (!locationId) return 0\n let sum = 0\n let page = 1\n let totalPages = 1\n do {\n const params = buildQuery({\n page,\n pageSize: LOCATION_TOTAL_ON_HAND_PAGE_SIZE,\n warehouseId: input.warehouseId,\n locationId,\n })\n const call = await apiCall<PagedResponse<{ quantity_on_hand?: string | number | null }>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) break\n for (const row of call.result?.items ?? []) {\n const value = Number(row.quantity_on_hand ?? 0)\n if (Number.isFinite(value)) sum += value\n }\n totalPages = call.result?.totalPages ?? 1\n page += 1\n } while (page <= totalPages && page <= LOCATION_TOTAL_ON_HAND_MAX_PAGES)\n return sum\n}\n\nexport async function fetchLocationCapacitySnapshot(input: {\n warehouseId: string\n locationId: string\n}): Promise<LocationCapacitySnapshot> {\n const [capacityUnits, totalOnHand] = await Promise.all([\n fetchLocationCapacityUnits(input.locationId),\n fetchLocationTotalOnHand(input),\n ])\n return { capacityUnits, totalOnHand }\n}\n\nexport async function fetchBalanceOnHand(input: {\n warehouseId: string\n locationId: string\n catalogVariantId: string\n lotId?: string | null\n}): Promise<number> {\n const params = buildQuery({\n page: 1,\n pageSize: 20,\n warehouseId: input.warehouseId,\n locationId: input.locationId,\n catalogVariantId: input.catalogVariantId,\n lotId: input.lotId?.trim() || undefined,\n })\n const call = await apiCall<PagedResponse<InventoryBalanceLookupRow>>(\n `/api/wms/inventory/balances?${params}`,\n )\n if (!call.ok) {\n throw new BalanceLookupError()\n }\n const row = selectBalanceLookupRow(call.result?.items ?? [], input.lotId)\n if (!row) return 0\n const onHand = Number(row.quantity_on_hand ?? 0)\n return Number.isFinite(onHand) ? onHand : 0\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,eAAe;AACxB;AAAA,EAC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A,QAAM,MAAM,uBAAuB,KAAK,QAAQ,SAAS,CAAC,GAAG,MAAM,KAAK;AACxE,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,SAAS,OAAO,IAAI,oBAAoB,CAAC;AAC/C,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,6 @@ function WorkflowDefinitionsListPage() {
|
|
|
38
38
|
const [pageSize] = React.useState(20);
|
|
39
39
|
const [total, setTotal] = React.useState(0);
|
|
40
40
|
const [totalPages, setTotalPages] = React.useState(1);
|
|
41
|
-
const [totalIsCapped, setTotalIsCapped] = React.useState(false);
|
|
42
41
|
const t = useT();
|
|
43
42
|
const router = useRouter();
|
|
44
43
|
const queryClient = useQueryClient();
|
|
@@ -67,7 +66,6 @@ function WorkflowDefinitionsListPage() {
|
|
|
67
66
|
setTotal(response.pagination.total || 0);
|
|
68
67
|
const calculatedPages = Math.ceil((response.pagination.total || 0) / pageSize);
|
|
69
68
|
setTotalPages(calculatedPages || 1);
|
|
70
|
-
setTotalIsCapped(response.pagination?.totalIsCapped === true);
|
|
71
69
|
}
|
|
72
70
|
return response?.data || [];
|
|
73
71
|
}
|
|
@@ -329,7 +327,7 @@ function WorkflowDefinitionsListPage() {
|
|
|
329
327
|
createLabel: t("workflows.actions.create")
|
|
330
328
|
}
|
|
331
329
|
),
|
|
332
|
-
pagination: { page, pageSize, total, totalPages,
|
|
330
|
+
pagination: { page, pageSize, total, totalPages, onPageChange: setPage }
|
|
333
331
|
}
|
|
334
332
|
),
|
|
335
333
|
/* @__PURE__ */ jsx(Dialog, { open: !!deleteTarget, onOpenChange: (open) => !open && setDeleteTarget(null), children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/backend/definitions/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { extensionPoints } from '@open-mercato/core/modules/workflows/extension-points'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { apiCall, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { surfaceRecordConflict } from '@open-mercato/ui/backend/conflicts'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport { Trash2 } from 'lucide-react'\n\ntype WorkflowDefinitionSource = 'code' | 'code_override' | 'user'\n\ntype WorkflowDefinition = {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n definition: Record<string, unknown>\n enabled: boolean\n effectiveFrom: string | null\n effectiveTo: string | null\n metadata: {\n tags?: string[]\n category?: string\n icon?: string\n } | null\n tenantId: string\n organizationId: string\n createdAt: string\n updatedAt: string\n createdBy: string | null\n source?: WorkflowDefinitionSource\n isCodeBased?: boolean\n}\n\ntype DefinitionsResponse = {\n data: WorkflowDefinition[]\n pagination: {\n total: number\n limit: number\n offset: number\n hasMore: boolean\n totalIsCapped?: boolean\n }\n}\n\ntype CreateDefinitionResponse = {\n data?: {\n id?: string\n }\n error?: string\n}\n\nconst WORKFLOW_ID_MAX_LENGTH = 100\n\nfunction buildDuplicateWorkflowId(sourceWorkflowId: string, attempt: number): string {\n const suffix = attempt === 0 ? '_copy' : `_copy_${attempt + 1}`\n const maxBaseLength = Math.max(1, WORKFLOW_ID_MAX_LENGTH - suffix.length)\n const base = sourceWorkflowId.slice(0, maxBaseLength)\n return `${base}${suffix}`\n}\n\nexport default function WorkflowDefinitionsListPage() {\n const [page, setPage] = React.useState(1)\n const [pageSize] = React.useState(20)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const [totalIsCapped, setTotalIsCapped] = React.useState(false)\n const t = useT()\n const router = useRouter()\n const queryClient = useQueryClient()\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [deleteTarget, setDeleteTarget] = React.useState<{ id: string; name: string; updatedAt: string | null } | null>(null)\n\n const { data, isLoading, error } = useQuery({\n queryKey: ['workflow-definitions', 'list', filterValues, page],\n queryFn: async () => {\n const params = new URLSearchParams()\n const offset = (page - 1) * pageSize\n params.set('limit', pageSize.toString())\n params.set('offset', offset.toString())\n\n if (filterValues.enabled !== undefined && filterValues.enabled !== '') {\n params.set('enabled', filterValues.enabled as string)\n }\n if (filterValues.workflowId) params.set('workflowId', filterValues.workflowId as string)\n if (filterValues.search) params.set('search', filterValues.search as string)\n\n const result = await apiCall<DefinitionsResponse>(\n `/api/workflows/definitions?${params.toString()}`\n )\n\n if (!result.ok) {\n throw new Error('Failed to fetch workflow definitions')\n }\n\n const response = result.result\n if (response?.pagination) {\n setTotal(response.pagination.total || 0)\n const calculatedPages = Math.ceil((response.pagination.total || 0) / pageSize)\n setTotalPages(calculatedPages || 1)\n setTotalIsCapped(response.pagination?.totalIsCapped === true)\n }\n\n return response?.data || []\n },\n })\n\n const handleDelete = (id: string, workflowName: string, updatedAt: string | null) => {\n setDeleteTarget({ id, name: workflowName, updatedAt })\n }\n\n const confirmDelete = async () => {\n if (!deleteTarget) return\n\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(deleteTarget.updatedAt),\n () => apiCall(`/api/workflows/definitions/${deleteTarget.id}`, {\n method: 'DELETE',\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.deleted'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.deleteFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.deleteFailed'), 'error')\n }\n }\n setDeleteTarget(null)\n }\n\n const handleToggleEnabled = async (id: string, currentEnabled: boolean, updatedAt: string | null) => {\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(updatedAt),\n () => apiCall(`/api/workflows/definitions/${id}`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n enabled: !currentEnabled,\n }),\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.updated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.updateFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.updateFailed'), 'error')\n }\n }\n }\n\n const handleDuplicate = async (definition: WorkflowDefinition) => {\n for (let attempt = 0; attempt < 10; attempt += 1) {\n const duplicateWorkflowId = buildDuplicateWorkflowId(definition.workflowId, attempt)\n const result = await apiCall<CreateDefinitionResponse>('/api/workflows/definitions', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n workflowId: duplicateWorkflowId,\n workflowName: definition.workflowName,\n description: definition.description,\n version: definition.version,\n definition: definition.definition,\n metadata: definition.metadata,\n enabled: definition.enabled,\n }),\n })\n\n if (result.ok) {\n flash(t('workflows.messages.workflowDuplicated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n return\n }\n\n if (result.status !== 409) {\n break\n }\n }\n\n flash(t('workflows.errors.createFailed'), 'error')\n }\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n const next: FilterValues = {}\n Object.entries(values).forEach(([key, value]) => {\n if (value !== undefined && value !== '') next[key] = value\n })\n setFilterValues(next)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const filters: FilterDef[] = [\n {\n id: 'search',\n type: 'text',\n label: t('workflows.filters.search'),\n placeholder: t('workflows.filters.searchPlaceholder'),\n },\n {\n id: 'enabled',\n type: 'select',\n label: t('workflows.filters.status'),\n options: [\n { label: t('common.all'), value: '' },\n { label: t('common.enabled'), value: 'true' },\n { label: t('common.disabled'), value: 'false' },\n ],\n },\n {\n id: 'workflowId',\n type: 'text',\n label: t('workflows.filters.workflowId'),\n placeholder: t('workflows.filters.workflowIdPlaceholder'),\n },\n ]\n\n const columns: ColumnDef<WorkflowDefinition>[] = [\n {\n id: 'workflowId',\n header: t('workflows.fields.workflowId'),\n accessorKey: 'workflowId',\n meta: { truncate: false },\n cell: ({ row }) => (\n <span className=\"font-mono text-sm\">{row.original.workflowId}</span>\n ),\n },\n {\n id: 'workflowName',\n header: t('workflows.fields.workflowName'),\n accessorKey: 'workflowName',\n meta: { truncate: false },\n cell: ({ row }) => (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium\">{row.original.workflowName}</span>\n {row.original.source === 'code' && (\n <Badge variant=\"secondary\">{t('workflows.source.code')}</Badge>\n )}\n {row.original.source === 'code_override' && (\n <Badge variant=\"outline\">{t('workflows.source.code_override')}</Badge>\n )}\n </div>\n {row.original.description && (\n <div className=\"text-xs text-muted-foreground\">\n {row.original.description}\n </div>\n )}\n {row.original.metadata?.category && (\n <div className=\"text-xs text-muted-foreground mt-0.5\">\n {row.original.metadata.category}\n </div>\n )}\n </div>\n ),\n },\n {\n id: 'version',\n header: t('workflows.fields.version'),\n accessorKey: 'version',\n meta: { truncate: false },\n cell: ({ row }) => (\n <Badge variant=\"secondary\" className=\"font-mono\">\n v{row.original.version}\n </Badge>\n ),\n },\n {\n id: 'enabled',\n header: t('workflows.fields.enabled'),\n accessorKey: 'enabled',\n cell: ({ row }) => (\n <button\n onClick={() => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt)}\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium cursor-pointer ${\n row.original.enabled\n ? 'bg-status-success-bg text-status-success-text hover:bg-status-success-border'\n : 'bg-status-neutral-bg text-status-neutral-text hover:bg-status-neutral-border'\n }`}\n title={t('workflows.actions.toggleEnabled')}\n >\n {row.original.enabled ? t('common.yes') : t('common.no')}\n </button>\n ),\n },\n {\n id: 'tags',\n header: t('workflows.fields.tags'),\n cell: ({ row }) => {\n const tags = row.original.metadata?.tags || []\n if (tags.length === 0) return <span className=\"text-muted-foreground\">-</span>\n return (\n <div className=\"flex flex-wrap gap-1\">\n {tags.slice(0, 2).map((tag, idx) => (\n <Badge key={idx} variant=\"secondary\">\n {tag}\n </Badge>\n ))}\n {tags.length > 2 && (\n <Badge variant=\"outline\">+{tags.length - 2}</Badge>\n )}\n </div>\n )\n },\n },\n {\n id: 'createdAt',\n header: t('workflows.fields.createdAt'),\n accessorKey: 'createdAt',\n cell: ({ row }) => {\n const date = new Date(row.original.createdAt)\n return <span className=\"text-sm text-muted-foreground\">{date.toLocaleDateString()}</span>\n },\n },\n {\n id: 'actions',\n header: '',\n cell: ({ row }) => {\n const isCodeOnly = row.original.source === 'code'\n const items = [\n {\n id: 'edit',\n label: isCodeOnly ? t('common.view') : t('common.edit'),\n href: `/backend/definitions/${row.original.id}`,\n },\n ...(!isCodeOnly ? [{\n id: 'edit-visual',\n label: t('workflows.actions.editVisually'),\n href: `/backend/definitions/visual-editor?id=${row.original.id}`,\n }] : []),\n ...(!isCodeOnly ? [{\n id: row.original.enabled ? 'disable' : 'enable',\n label: row.original.enabled ? t('common.disable') : t('common.enable'),\n onSelect: () => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'duplicate',\n label: t('common.duplicate'),\n onSelect: () => handleDuplicate(row.original),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'delete',\n label: t('common.delete'),\n onSelect: () => handleDelete(row.original.id, row.original.workflowName, row.original.updatedAt),\n destructive: true,\n }] : []),\n ]\n return <RowActions items={items} />\n },\n },\n ]\n\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage\n label={t('workflows.messages.loadFailed')}\n description={error.message}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })}>\n {t('common.retry', 'Retry')}\n </Button>\n )}\n />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n <DataTable\n title={t('workflows.list.title')}\n actions={(\n <div className=\"flex items-center gap-2\">\n <Button asChild variant=\"outline\">\n <Link href=\"/backend/definitions/visual-editor\">\n {t('workflows.actions.createVisual')}\n </Link>\n </Button>\n <Button asChild>\n <Link href=\"/backend/definitions/create\">\n {t('workflows.actions.create')}\n </Link>\n </Button>\n </div>\n )}\n columns={columns}\n data={data || []}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n onRowClick={(row) => router.push(`/backend/definitions/visual-editor?id=${row.id}`)}\n perspective={{\n tableId: extensionPoints.hosts.definitionsTable.tableId,\n }}\n emptyState={(\n <ListEmptyState\n entityName={t('workflows.list.title')}\n createHref=\"/backend/definitions/create\"\n createLabel={t('workflows.actions.create')}\n />\n )}\n pagination={{ page, pageSize, total, totalPages, totalIsCapped, onPageChange: setPage }}\n />\n <Dialog open={!!deleteTarget} onOpenChange={(open) => !open && setDeleteTarget(null)}>\n <DialogContent className=\"sm:max-w-md\">\n <DialogHeader>\n <DialogTitle>{t('workflows.confirm.deleteTitle')}</DialogTitle>\n <DialogDescription>\n {t('workflows.confirm.delete', { name: deleteTarget?.name ?? '' })}\n </DialogDescription>\n </DialogHeader>\n <DialogFooter>\n <Button variant=\"outline\" onClick={() => setDeleteTarget(null)}>\n {t('common.cancel')}\n </Button>\n <Button variant=\"destructive-solid\" onClick={confirmDelete}>\n <Trash2/>\n {t('common.delete')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { extensionPoints } from '@open-mercato/core/modules/workflows/extension-points'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { apiCall, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { surfaceRecordConflict } from '@open-mercato/ui/backend/conflicts'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport { Trash2 } from 'lucide-react'\n\ntype WorkflowDefinitionSource = 'code' | 'code_override' | 'user'\n\ntype WorkflowDefinition = {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n definition: Record<string, unknown>\n enabled: boolean\n effectiveFrom: string | null\n effectiveTo: string | null\n metadata: {\n tags?: string[]\n category?: string\n icon?: string\n } | null\n tenantId: string\n organizationId: string\n createdAt: string\n updatedAt: string\n createdBy: string | null\n source?: WorkflowDefinitionSource\n isCodeBased?: boolean\n}\n\ntype DefinitionsResponse = {\n data: WorkflowDefinition[]\n pagination: {\n total: number\n limit: number\n offset: number\n hasMore: boolean\n }\n}\n\ntype CreateDefinitionResponse = {\n data?: {\n id?: string\n }\n error?: string\n}\n\nconst WORKFLOW_ID_MAX_LENGTH = 100\n\nfunction buildDuplicateWorkflowId(sourceWorkflowId: string, attempt: number): string {\n const suffix = attempt === 0 ? '_copy' : `_copy_${attempt + 1}`\n const maxBaseLength = Math.max(1, WORKFLOW_ID_MAX_LENGTH - suffix.length)\n const base = sourceWorkflowId.slice(0, maxBaseLength)\n return `${base}${suffix}`\n}\n\nexport default function WorkflowDefinitionsListPage() {\n const [page, setPage] = React.useState(1)\n const [pageSize] = React.useState(20)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const t = useT()\n const router = useRouter()\n const queryClient = useQueryClient()\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [deleteTarget, setDeleteTarget] = React.useState<{ id: string; name: string; updatedAt: string | null } | null>(null)\n\n const { data, isLoading, error } = useQuery({\n queryKey: ['workflow-definitions', 'list', filterValues, page],\n queryFn: async () => {\n const params = new URLSearchParams()\n const offset = (page - 1) * pageSize\n params.set('limit', pageSize.toString())\n params.set('offset', offset.toString())\n\n if (filterValues.enabled !== undefined && filterValues.enabled !== '') {\n params.set('enabled', filterValues.enabled as string)\n }\n if (filterValues.workflowId) params.set('workflowId', filterValues.workflowId as string)\n if (filterValues.search) params.set('search', filterValues.search as string)\n\n const result = await apiCall<DefinitionsResponse>(\n `/api/workflows/definitions?${params.toString()}`\n )\n\n if (!result.ok) {\n throw new Error('Failed to fetch workflow definitions')\n }\n\n const response = result.result\n if (response?.pagination) {\n setTotal(response.pagination.total || 0)\n const calculatedPages = Math.ceil((response.pagination.total || 0) / pageSize)\n setTotalPages(calculatedPages || 1)\n }\n\n return response?.data || []\n },\n })\n\n const handleDelete = (id: string, workflowName: string, updatedAt: string | null) => {\n setDeleteTarget({ id, name: workflowName, updatedAt })\n }\n\n const confirmDelete = async () => {\n if (!deleteTarget) return\n\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(deleteTarget.updatedAt),\n () => apiCall(`/api/workflows/definitions/${deleteTarget.id}`, {\n method: 'DELETE',\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.deleted'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.deleteFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.deleteFailed'), 'error')\n }\n }\n setDeleteTarget(null)\n }\n\n const handleToggleEnabled = async (id: string, currentEnabled: boolean, updatedAt: string | null) => {\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(updatedAt),\n () => apiCall(`/api/workflows/definitions/${id}`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n enabled: !currentEnabled,\n }),\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.updated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.updateFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.updateFailed'), 'error')\n }\n }\n }\n\n const handleDuplicate = async (definition: WorkflowDefinition) => {\n for (let attempt = 0; attempt < 10; attempt += 1) {\n const duplicateWorkflowId = buildDuplicateWorkflowId(definition.workflowId, attempt)\n const result = await apiCall<CreateDefinitionResponse>('/api/workflows/definitions', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n workflowId: duplicateWorkflowId,\n workflowName: definition.workflowName,\n description: definition.description,\n version: definition.version,\n definition: definition.definition,\n metadata: definition.metadata,\n enabled: definition.enabled,\n }),\n })\n\n if (result.ok) {\n flash(t('workflows.messages.workflowDuplicated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n return\n }\n\n if (result.status !== 409) {\n break\n }\n }\n\n flash(t('workflows.errors.createFailed'), 'error')\n }\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n const next: FilterValues = {}\n Object.entries(values).forEach(([key, value]) => {\n if (value !== undefined && value !== '') next[key] = value\n })\n setFilterValues(next)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const filters: FilterDef[] = [\n {\n id: 'search',\n type: 'text',\n label: t('workflows.filters.search'),\n placeholder: t('workflows.filters.searchPlaceholder'),\n },\n {\n id: 'enabled',\n type: 'select',\n label: t('workflows.filters.status'),\n options: [\n { label: t('common.all'), value: '' },\n { label: t('common.enabled'), value: 'true' },\n { label: t('common.disabled'), value: 'false' },\n ],\n },\n {\n id: 'workflowId',\n type: 'text',\n label: t('workflows.filters.workflowId'),\n placeholder: t('workflows.filters.workflowIdPlaceholder'),\n },\n ]\n\n const columns: ColumnDef<WorkflowDefinition>[] = [\n {\n id: 'workflowId',\n header: t('workflows.fields.workflowId'),\n accessorKey: 'workflowId',\n meta: { truncate: false },\n cell: ({ row }) => (\n <span className=\"font-mono text-sm\">{row.original.workflowId}</span>\n ),\n },\n {\n id: 'workflowName',\n header: t('workflows.fields.workflowName'),\n accessorKey: 'workflowName',\n meta: { truncate: false },\n cell: ({ row }) => (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium\">{row.original.workflowName}</span>\n {row.original.source === 'code' && (\n <Badge variant=\"secondary\">{t('workflows.source.code')}</Badge>\n )}\n {row.original.source === 'code_override' && (\n <Badge variant=\"outline\">{t('workflows.source.code_override')}</Badge>\n )}\n </div>\n {row.original.description && (\n <div className=\"text-xs text-muted-foreground\">\n {row.original.description}\n </div>\n )}\n {row.original.metadata?.category && (\n <div className=\"text-xs text-muted-foreground mt-0.5\">\n {row.original.metadata.category}\n </div>\n )}\n </div>\n ),\n },\n {\n id: 'version',\n header: t('workflows.fields.version'),\n accessorKey: 'version',\n meta: { truncate: false },\n cell: ({ row }) => (\n <Badge variant=\"secondary\" className=\"font-mono\">\n v{row.original.version}\n </Badge>\n ),\n },\n {\n id: 'enabled',\n header: t('workflows.fields.enabled'),\n accessorKey: 'enabled',\n cell: ({ row }) => (\n <button\n onClick={() => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt)}\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium cursor-pointer ${\n row.original.enabled\n ? 'bg-status-success-bg text-status-success-text hover:bg-status-success-border'\n : 'bg-status-neutral-bg text-status-neutral-text hover:bg-status-neutral-border'\n }`}\n title={t('workflows.actions.toggleEnabled')}\n >\n {row.original.enabled ? t('common.yes') : t('common.no')}\n </button>\n ),\n },\n {\n id: 'tags',\n header: t('workflows.fields.tags'),\n cell: ({ row }) => {\n const tags = row.original.metadata?.tags || []\n if (tags.length === 0) return <span className=\"text-muted-foreground\">-</span>\n return (\n <div className=\"flex flex-wrap gap-1\">\n {tags.slice(0, 2).map((tag, idx) => (\n <Badge key={idx} variant=\"secondary\">\n {tag}\n </Badge>\n ))}\n {tags.length > 2 && (\n <Badge variant=\"outline\">+{tags.length - 2}</Badge>\n )}\n </div>\n )\n },\n },\n {\n id: 'createdAt',\n header: t('workflows.fields.createdAt'),\n accessorKey: 'createdAt',\n cell: ({ row }) => {\n const date = new Date(row.original.createdAt)\n return <span className=\"text-sm text-muted-foreground\">{date.toLocaleDateString()}</span>\n },\n },\n {\n id: 'actions',\n header: '',\n cell: ({ row }) => {\n const isCodeOnly = row.original.source === 'code'\n const items = [\n {\n id: 'edit',\n label: isCodeOnly ? t('common.view') : t('common.edit'),\n href: `/backend/definitions/${row.original.id}`,\n },\n ...(!isCodeOnly ? [{\n id: 'edit-visual',\n label: t('workflows.actions.editVisually'),\n href: `/backend/definitions/visual-editor?id=${row.original.id}`,\n }] : []),\n ...(!isCodeOnly ? [{\n id: row.original.enabled ? 'disable' : 'enable',\n label: row.original.enabled ? t('common.disable') : t('common.enable'),\n onSelect: () => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'duplicate',\n label: t('common.duplicate'),\n onSelect: () => handleDuplicate(row.original),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'delete',\n label: t('common.delete'),\n onSelect: () => handleDelete(row.original.id, row.original.workflowName, row.original.updatedAt),\n destructive: true,\n }] : []),\n ]\n return <RowActions items={items} />\n },\n },\n ]\n\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage\n label={t('workflows.messages.loadFailed')}\n description={error.message}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })}>\n {t('common.retry', 'Retry')}\n </Button>\n )}\n />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n <DataTable\n title={t('workflows.list.title')}\n actions={(\n <div className=\"flex items-center gap-2\">\n <Button asChild variant=\"outline\">\n <Link href=\"/backend/definitions/visual-editor\">\n {t('workflows.actions.createVisual')}\n </Link>\n </Button>\n <Button asChild>\n <Link href=\"/backend/definitions/create\">\n {t('workflows.actions.create')}\n </Link>\n </Button>\n </div>\n )}\n columns={columns}\n data={data || []}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n onRowClick={(row) => router.push(`/backend/definitions/visual-editor?id=${row.id}`)}\n perspective={{\n tableId: extensionPoints.hosts.definitionsTable.tableId,\n }}\n emptyState={(\n <ListEmptyState\n entityName={t('workflows.list.title')}\n createHref=\"/backend/definitions/create\"\n createLabel={t('workflows.actions.create')}\n />\n )}\n pagination={{ page, pageSize, total, totalPages, onPageChange: setPage }}\n />\n <Dialog open={!!deleteTarget} onOpenChange={(open) => !open && setDeleteTarget(null)}>\n <DialogContent className=\"sm:max-w-md\">\n <DialogHeader>\n <DialogTitle>{t('workflows.confirm.deleteTitle')}</DialogTitle>\n <DialogDescription>\n {t('workflows.confirm.delete', { name: deleteTarget?.name ?? '' })}\n </DialogDescription>\n </DialogHeader>\n <DialogFooter>\n <Button variant=\"outline\" onClick={() => setDeleteTarget(null)}>\n {t('common.cancel')}\n </Button>\n <Button variant=\"destructive-solid\" onClick={confirmDelete}>\n <Trash2/>\n {t('common.delete')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAmQQ,cAUE,YAVF;AAjQR,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,gBAAgB;AAC/B,SAAS,iBAAiB;AAE1B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,mCAAmC;AACrD,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AACtC,SAAS,aAAa;AACtB,SAAS,UAAU,sBAAsB;AACzC,SAAS,YAAY;AAErB,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AA6CvB,MAAM,yBAAyB;AAE/B,SAAS,yBAAyB,kBAA0B,SAAyB;AACnF,QAAM,SAAS,YAAY,IAAI,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AAAA,UACA,oBAAC,UAAO,SAAO,MACb,8BAAC,QAAK,MAAK,+BACR,YAAE,0BAA0B,GAC/B,GACF;AAAA,WACF;AAAA,QAEF;AAAA,QACA,MAAM,QAAQ,CAAC;AAAA,QACf;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,QAChB,YAAY,CAAC,QAAQ,OAAO,KAAK,yCAAyC,IAAI,EAAE,EAAE;AAAA,QAClF,aAAa;AAAA,UACX,SAAS,gBAAgB,MAAM,iBAAiB;AAAA,QAClD;AAAA,QACA,YACE;AAAA,UAAC;AAAA;AAAA,YACC,YAAY,EAAE,sBAAsB;AAAA,YACpC,YAAW;AAAA,YACX,aAAa,EAAE,0BAA0B;AAAA;AAAA,QAC3C;AAAA,QAEF,YAAY,EAAE,MAAM,UAAU,OAAO,YAAY,cAAc,QAAQ;AAAA;AAAA,IACzE;AAAA,IACA,oBAAC,UAAO,MAAM,CAAC,CAAC,cAAc,cAAc,CAAC,SAAS,CAAC,QAAQ,gBAAgB,IAAI,GACjF,+BAAC,iBAAc,WAAU,eACvB;AAAA,2BAAC,gBACC;AAAA,4BAAC,eAAa,YAAE,+BAA+B,GAAE;AAAA,QACjD,oBAAC,qBACE,YAAE,4BAA4B,EAAE,MAAM,cAAc,QAAQ,GAAG,CAAC,GACnE;AAAA,SACF;AAAA,MACA,qBAAC,gBACC;AAAA,4BAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,gBAAgB,IAAI,GAC1D,YAAE,eAAe,GACpB;AAAA,QACA,qBAAC,UAAO,SAAQ,qBAAoB,SAAS,eAC3C;AAAA,8BAAC,UAAM;AAAA,UACN,EAAE,eAAe;AAAA,WACpB;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,7 +14,6 @@ function WorkflowEventsPage() {
|
|
|
14
14
|
const [pageSize] = React.useState(50);
|
|
15
15
|
const [total, setTotal] = React.useState(0);
|
|
16
16
|
const [totalPages, setTotalPages] = React.useState(1);
|
|
17
|
-
const [totalIsCapped, setTotalIsCapped] = React.useState(false);
|
|
18
17
|
const t = useT();
|
|
19
18
|
const [filterValues, setFilterValues] = React.useState({});
|
|
20
19
|
const { data, isLoading, error, refetch } = useQuery({
|
|
@@ -40,7 +39,6 @@ function WorkflowEventsPage() {
|
|
|
40
39
|
if (response) {
|
|
41
40
|
setTotal(response.total || 0);
|
|
42
41
|
setTotalPages(response.totalPages || 1);
|
|
43
|
-
setTotalIsCapped(response?.totalIsCapped === true);
|
|
44
42
|
}
|
|
45
43
|
return response?.items || [];
|
|
46
44
|
}
|
|
@@ -208,7 +206,7 @@ function WorkflowEventsPage() {
|
|
|
208
206
|
onFiltersApply: handleFiltersApply,
|
|
209
207
|
onFiltersClear: handleFiltersClear,
|
|
210
208
|
isLoading,
|
|
211
|
-
pagination: { page, pageSize, total, totalPages,
|
|
209
|
+
pagination: { page, pageSize, total, totalPages, onPageChange: setPage },
|
|
212
210
|
actions: /* @__PURE__ */ jsx(
|
|
213
211
|
Button,
|
|
214
212
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/backend/events/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useQuery } from '@tanstack/react-query'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\n\ntype WorkflowEvent = {\n id: string\n workflowInstanceId: string\n stepInstanceId: string | null\n eventType: string\n eventData: any\n occurredAt: string\n userId: string | null\n workflowInstance: {\n id: string\n workflowId: string\n workflowName: string\n status: string\n } | null\n}\n\ntype EventsResponse = {\n items: WorkflowEvent[]\n total: number\n page: number\n pageSize: number\n totalPages: number\n totalIsCapped?: boolean\n}\n\nexport default function WorkflowEventsPage() {\n const [page, setPage] = React.useState(1)\n const [pageSize] = React.useState(50)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const [totalIsCapped, setTotalIsCapped] = React.useState(false)\n const t = useT()\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n\n const { data, isLoading, error, refetch } = useQuery({\n queryKey: ['workflows', 'events', filterValues, page],\n queryFn: async () => {\n const params = new URLSearchParams()\n params.set('page', page.toString())\n params.set('pageSize', pageSize.toString())\n params.set('sortField', 'occurredAt')\n params.set('sortDir', 'desc')\n\n if (filterValues.eventType) params.set('eventType', filterValues.eventType as string)\n if (filterValues.workflowInstanceId) params.set('workflowInstanceId', filterValues.workflowInstanceId as string)\n if (filterValues.userId) params.set('userId', filterValues.userId as string)\n if (filterValues.occurredAtFrom) params.set('occurredAtFrom', filterValues.occurredAtFrom as string)\n if (filterValues.occurredAtTo) params.set('occurredAtTo', filterValues.occurredAtTo as string)\n\n const result = await apiCall<EventsResponse>(\n `/api/workflows/events?${params.toString()}`\n )\n\n if (!result.ok) {\n throw new Error('Failed to fetch workflow events')\n }\n\n const response = result.result\n if (response) {\n setTotal(response.total || 0)\n setTotalPages(response.totalPages || 1)\n setTotalIsCapped(response?.totalIsCapped === true)\n }\n\n return response?.items || []\n },\n })\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n const next: FilterValues = {}\n Object.entries(values).forEach(([key, value]) => {\n if (value !== undefined) next[key] = value\n })\n setFilterValues(next)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const filters: FilterDef[] = [\n {\n id: 'eventType',\n type: 'select',\n label: t('workflows.events.filters.eventType'),\n options: [\n { value: '', label: t('common.all') },\n { value: 'WORKFLOW_STARTED', label: t('workflows.events.types.workflow_started') },\n { value: 'WORKFLOW_COMPLETED', label: t('workflows.events.types.workflow_completed') },\n { value: 'WORKFLOW_FAILED', label: t('workflows.events.types.workflow_failed') },\n { value: 'WORKFLOW_CANCELLED', label: t('workflows.events.types.workflow_cancelled') },\n { value: 'STEP_ENTERED', label: t('workflows.events.types.step_entered') },\n { value: 'STEP_EXITED', label: t('workflows.events.types.step_exited') },\n { value: 'TRANSITION_EXECUTED', label: t('workflows.events.types.transition_executed') },\n { value: 'TRANSITION_REJECTED', label: t('workflows.events.types.transition_rejected') },\n { value: 'ACTIVITY_STARTED', label: t('workflows.events.types.activity_started') },\n { value: 'ACTIVITY_COMPLETED', label: t('workflows.events.types.activity_completed') },\n { value: 'ACTIVITY_FAILED', label: t('workflows.events.types.activity_failed') },\n ],\n },\n {\n id: 'workflowInstanceId',\n type: 'text',\n label: t('workflows.events.filters.workflowInstanceId'),\n placeholder: t('workflows.events.filters.workflowInstanceIdPlaceholder'),\n },\n {\n id: 'userId',\n type: 'text',\n label: t('workflows.events.filters.userId'),\n placeholder: t('workflows.events.filters.userIdPlaceholder'),\n },\n ]\n\n const getEventTypeBadgeClass = (eventType: string) => {\n if (eventType.includes('STARTED')) return 'bg-status-info-bg text-status-info-text'\n if (eventType.includes('COMPLETED')) return 'bg-status-success-bg text-status-success-text'\n if (eventType.includes('FAILED') || eventType.includes('REJECTED')) return 'bg-status-error-bg text-status-error-text'\n if (eventType.includes('CANCELLED')) return 'bg-muted text-foreground'\n if (eventType.includes('ENTERED') || eventType.includes('EXITED')) return 'bg-status-neutral-bg text-status-neutral-text'\n return 'bg-muted text-foreground'\n }\n\n const columns: ColumnDef<WorkflowEvent>[] = [\n {\n id: 'occurredAt',\n header: t('workflows.events.fields.occurredAt'),\n accessorKey: 'occurredAt',\n cell: ({ row }) => (\n <div className=\"text-sm\">\n {new Date(row.original.occurredAt).toLocaleString()}\n </div>\n ),\n },\n {\n id: 'eventType',\n header: t('workflows.events.fields.eventType'),\n accessorKey: 'eventType',\n cell: ({ row }) => (\n <span\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium ${getEventTypeBadgeClass(\n row.original.eventType\n )}`}\n >\n {row.original.eventType}\n </span>\n ),\n },\n {\n id: 'workflow',\n header: t('workflows.events.fields.workflow'),\n cell: ({ row }) => (\n <div>\n {row.original.workflowInstance ? (\n <>\n <Link\n href={`/backend/instances/${row.original.workflowInstance.id}`}\n className=\"text-primary hover:text-primary/80 hover:underline font-medium\"\n >\n {row.original.workflowInstance.workflowName}\n </Link>\n <div className=\"text-xs text-muted-foreground mt-0.5\">\n {row.original.workflowInstance.workflowId}\n </div>\n </>\n ) : (\n <span className=\"text-muted-foreground text-sm\">\n {t('workflows.events.workflowNotFound')}\n </span>\n )}\n </div>\n ),\n },\n {\n id: 'instance',\n header: t('workflows.events.fields.instance'),\n cell: ({ row }) => (\n <div className=\"text-sm\">\n <Link\n href={`/backend/instances/${row.original.workflowInstanceId}`}\n className=\"text-primary hover:text-primary/80 hover:underline font-mono text-xs\"\n >\n {row.original.workflowInstanceId.substring(0, 8)}...\n </Link>\n </div>\n ),\n },\n {\n id: 'status',\n header: t('workflows.events.fields.status'),\n cell: ({ row }) => (\n <div>\n {row.original.workflowInstance && (\n <span\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium ${\n row.original.workflowInstance.status === 'COMPLETED'\n ? 'bg-status-success-bg text-status-success-text'\n : row.original.workflowInstance.status === 'RUNNING'\n ? 'bg-status-info-bg text-status-info-text'\n : row.original.workflowInstance.status === 'FAILED'\n ? 'bg-status-error-bg text-status-error-text'\n : 'bg-muted text-foreground'\n }`}\n >\n {row.original.workflowInstance.status}\n </span>\n )}\n </div>\n ),\n },\n {\n id: 'userId',\n header: t('workflows.events.fields.userId'),\n accessorKey: 'userId',\n cell: ({ row }) => (\n <div className=\"text-sm text-muted-foreground font-mono text-xs\">\n {row.original.userId ? row.original.userId.substring(0, 8) + '...' : '-'}\n </div>\n ),\n },\n {\n id: 'eventData',\n header: t('workflows.events.fields.eventData'),\n cell: ({ row }) => (\n <div className=\"text-xs text-muted-foreground max-w-xs truncate\">\n {JSON.stringify(row.original.eventData).substring(0, 50)}...\n </div>\n ),\n },\n {\n id: 'actions',\n header: '',\n cell: ({ row }) => (\n <Link\n href={`/backend/events/${row.original.id}`}\n className=\"text-sm text-primary hover:text-primary/80 hover:underline\"\n >\n {t('common.details')}\n </Link>\n ),\n },\n ]\n\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage\n label={t('workflows.events.messages.loadFailed')}\n description={error.message}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => refetch()}>\n {t('common.retry', 'Retry')}\n </Button>\n )}\n />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n <DataTable\n title={t('workflows.events.list.title')}\n columns={columns}\n data={data || []}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n isLoading={isLoading}\n pagination={{ page, pageSize, total, totalPages, totalIsCapped, onPageChange: setPage }}\n actions={\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => refetch()}\n disabled={isLoading}\n >\n {isLoading ? t('common.refreshing') : t('common.refresh')}\n </Button>\n }\n />\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useQuery } from '@tanstack/react-query'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\n\ntype WorkflowEvent = {\n id: string\n workflowInstanceId: string\n stepInstanceId: string | null\n eventType: string\n eventData: any\n occurredAt: string\n userId: string | null\n workflowInstance: {\n id: string\n workflowId: string\n workflowName: string\n status: string\n } | null\n}\n\ntype EventsResponse = {\n items: WorkflowEvent[]\n total: number\n page: number\n pageSize: number\n totalPages: number\n}\n\nexport default function WorkflowEventsPage() {\n const [page, setPage] = React.useState(1)\n const [pageSize] = React.useState(50)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const t = useT()\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n\n const { data, isLoading, error, refetch } = useQuery({\n queryKey: ['workflows', 'events', filterValues, page],\n queryFn: async () => {\n const params = new URLSearchParams()\n params.set('page', page.toString())\n params.set('pageSize', pageSize.toString())\n params.set('sortField', 'occurredAt')\n params.set('sortDir', 'desc')\n\n if (filterValues.eventType) params.set('eventType', filterValues.eventType as string)\n if (filterValues.workflowInstanceId) params.set('workflowInstanceId', filterValues.workflowInstanceId as string)\n if (filterValues.userId) params.set('userId', filterValues.userId as string)\n if (filterValues.occurredAtFrom) params.set('occurredAtFrom', filterValues.occurredAtFrom as string)\n if (filterValues.occurredAtTo) params.set('occurredAtTo', filterValues.occurredAtTo as string)\n\n const result = await apiCall<EventsResponse>(\n `/api/workflows/events?${params.toString()}`\n )\n\n if (!result.ok) {\n throw new Error('Failed to fetch workflow events')\n }\n\n const response = result.result\n if (response) {\n setTotal(response.total || 0)\n setTotalPages(response.totalPages || 1)\n }\n\n return response?.items || []\n },\n })\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n const next: FilterValues = {}\n Object.entries(values).forEach(([key, value]) => {\n if (value !== undefined) next[key] = value\n })\n setFilterValues(next)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const filters: FilterDef[] = [\n {\n id: 'eventType',\n type: 'select',\n label: t('workflows.events.filters.eventType'),\n options: [\n { value: '', label: t('common.all') },\n { value: 'WORKFLOW_STARTED', label: t('workflows.events.types.workflow_started') },\n { value: 'WORKFLOW_COMPLETED', label: t('workflows.events.types.workflow_completed') },\n { value: 'WORKFLOW_FAILED', label: t('workflows.events.types.workflow_failed') },\n { value: 'WORKFLOW_CANCELLED', label: t('workflows.events.types.workflow_cancelled') },\n { value: 'STEP_ENTERED', label: t('workflows.events.types.step_entered') },\n { value: 'STEP_EXITED', label: t('workflows.events.types.step_exited') },\n { value: 'TRANSITION_EXECUTED', label: t('workflows.events.types.transition_executed') },\n { value: 'TRANSITION_REJECTED', label: t('workflows.events.types.transition_rejected') },\n { value: 'ACTIVITY_STARTED', label: t('workflows.events.types.activity_started') },\n { value: 'ACTIVITY_COMPLETED', label: t('workflows.events.types.activity_completed') },\n { value: 'ACTIVITY_FAILED', label: t('workflows.events.types.activity_failed') },\n ],\n },\n {\n id: 'workflowInstanceId',\n type: 'text',\n label: t('workflows.events.filters.workflowInstanceId'),\n placeholder: t('workflows.events.filters.workflowInstanceIdPlaceholder'),\n },\n {\n id: 'userId',\n type: 'text',\n label: t('workflows.events.filters.userId'),\n placeholder: t('workflows.events.filters.userIdPlaceholder'),\n },\n ]\n\n const getEventTypeBadgeClass = (eventType: string) => {\n if (eventType.includes('STARTED')) return 'bg-status-info-bg text-status-info-text'\n if (eventType.includes('COMPLETED')) return 'bg-status-success-bg text-status-success-text'\n if (eventType.includes('FAILED') || eventType.includes('REJECTED')) return 'bg-status-error-bg text-status-error-text'\n if (eventType.includes('CANCELLED')) return 'bg-muted text-foreground'\n if (eventType.includes('ENTERED') || eventType.includes('EXITED')) return 'bg-status-neutral-bg text-status-neutral-text'\n return 'bg-muted text-foreground'\n }\n\n const columns: ColumnDef<WorkflowEvent>[] = [\n {\n id: 'occurredAt',\n header: t('workflows.events.fields.occurredAt'),\n accessorKey: 'occurredAt',\n cell: ({ row }) => (\n <div className=\"text-sm\">\n {new Date(row.original.occurredAt).toLocaleString()}\n </div>\n ),\n },\n {\n id: 'eventType',\n header: t('workflows.events.fields.eventType'),\n accessorKey: 'eventType',\n cell: ({ row }) => (\n <span\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium ${getEventTypeBadgeClass(\n row.original.eventType\n )}`}\n >\n {row.original.eventType}\n </span>\n ),\n },\n {\n id: 'workflow',\n header: t('workflows.events.fields.workflow'),\n cell: ({ row }) => (\n <div>\n {row.original.workflowInstance ? (\n <>\n <Link\n href={`/backend/instances/${row.original.workflowInstance.id}`}\n className=\"text-primary hover:text-primary/80 hover:underline font-medium\"\n >\n {row.original.workflowInstance.workflowName}\n </Link>\n <div className=\"text-xs text-muted-foreground mt-0.5\">\n {row.original.workflowInstance.workflowId}\n </div>\n </>\n ) : (\n <span className=\"text-muted-foreground text-sm\">\n {t('workflows.events.workflowNotFound')}\n </span>\n )}\n </div>\n ),\n },\n {\n id: 'instance',\n header: t('workflows.events.fields.instance'),\n cell: ({ row }) => (\n <div className=\"text-sm\">\n <Link\n href={`/backend/instances/${row.original.workflowInstanceId}`}\n className=\"text-primary hover:text-primary/80 hover:underline font-mono text-xs\"\n >\n {row.original.workflowInstanceId.substring(0, 8)}...\n </Link>\n </div>\n ),\n },\n {\n id: 'status',\n header: t('workflows.events.fields.status'),\n cell: ({ row }) => (\n <div>\n {row.original.workflowInstance && (\n <span\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium ${\n row.original.workflowInstance.status === 'COMPLETED'\n ? 'bg-status-success-bg text-status-success-text'\n : row.original.workflowInstance.status === 'RUNNING'\n ? 'bg-status-info-bg text-status-info-text'\n : row.original.workflowInstance.status === 'FAILED'\n ? 'bg-status-error-bg text-status-error-text'\n : 'bg-muted text-foreground'\n }`}\n >\n {row.original.workflowInstance.status}\n </span>\n )}\n </div>\n ),\n },\n {\n id: 'userId',\n header: t('workflows.events.fields.userId'),\n accessorKey: 'userId',\n cell: ({ row }) => (\n <div className=\"text-sm text-muted-foreground font-mono text-xs\">\n {row.original.userId ? row.original.userId.substring(0, 8) + '...' : '-'}\n </div>\n ),\n },\n {\n id: 'eventData',\n header: t('workflows.events.fields.eventData'),\n cell: ({ row }) => (\n <div className=\"text-xs text-muted-foreground max-w-xs truncate\">\n {JSON.stringify(row.original.eventData).substring(0, 50)}...\n </div>\n ),\n },\n {\n id: 'actions',\n header: '',\n cell: ({ row }) => (\n <Link\n href={`/backend/events/${row.original.id}`}\n className=\"text-sm text-primary hover:text-primary/80 hover:underline\"\n >\n {t('common.details')}\n </Link>\n ),\n },\n ]\n\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage\n label={t('workflows.events.messages.loadFailed')}\n description={error.message}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => refetch()}>\n {t('common.retry', 'Retry')}\n </Button>\n )}\n />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n <DataTable\n title={t('workflows.events.list.title')}\n columns={columns}\n data={data || []}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n isLoading={isLoading}\n pagination={{ page, pageSize, total, totalPages, onPageChange: setPage }}\n actions={\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => refetch()}\n disabled={isLoading}\n >\n {isLoading ? t('common.refreshing') : t('common.refresh')}\n </Button>\n }\n />\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA8IQ,SAyBI,UAzBJ,KAyBI,YAzBJ;AA5IR,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,iBAAiB;AAE1B,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAErB,SAAS,cAAc;AACvB,SAAS,oBAAoB;AA0Bd,SAAR,qBAAsC;AAC3C,QAAM,CAA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{
|
|
|
18
18
|
const [pageSize] = React.useState(50);
|
|
19
19
|
const [total, setTotal] = React.useState(0);
|
|
20
20
|
const [totalPages, setTotalPages] = React.useState(1);
|
|
21
|
-
const [totalIsCapped, setTotalIsCapped] = React.useState(false);
|
|
22
21
|
const t = useT();
|
|
23
22
|
const router = useRouter();
|
|
24
23
|
const queryClient = useQueryClient();
|
|
@@ -47,7 +46,6 @@ function WorkflowInstancesListPage() {
|
|
|
47
46
|
setTotal(response.pagination.total || 0);
|
|
48
47
|
const calculatedPages = Math.ceil((response.pagination.total || 0) / pageSize);
|
|
49
48
|
setTotalPages(calculatedPages || 1);
|
|
50
|
-
setTotalIsCapped(response.pagination?.totalIsCapped === true);
|
|
51
49
|
}
|
|
52
50
|
return response?.data || [];
|
|
53
51
|
}
|
|
@@ -260,7 +258,7 @@ function WorkflowInstancesListPage() {
|
|
|
260
258
|
perspective: {
|
|
261
259
|
tableId: extensionPoints.hosts.instancesTable.tableId
|
|
262
260
|
},
|
|
263
|
-
pagination: { page, pageSize, total, totalPages,
|
|
261
|
+
pagination: { page, pageSize, total, totalPages, onPageChange: setPage }
|
|
264
262
|
}
|
|
265
263
|
) }),
|
|
266
264
|
ConfirmDialogElement
|