@open-mercato/core 0.6.7-develop.6862.1.c11a64ce0a → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/AGENTS.md +3 -3
- package/agentic/standalone-guide.md +0 -13
- package/dist/bootstrap.js +1 -16
- package/dist/bootstrap.js.map +2 -2
- package/dist/generated/entities/customer_deal_person_link/index.js +0 -2
- package/dist/generated/entities/customer_deal_person_link/index.js.map +2 -2
- package/dist/generated/entities/customer_user_invitation/index.js +0 -2
- package/dist/generated/entities/customer_user_invitation/index.js.map +2 -2
- package/dist/generated/entities/gateway_payment_operation/index.js +0 -2
- package/dist/generated/entities/gateway_payment_operation/index.js.map +2 -2
- package/dist/generated/entities/gateway_transaction/index.js +0 -2
- package/dist/generated/entities/gateway_transaction/index.js.map +2 -2
- package/dist/generated/entities/organization/index.js +0 -2
- package/dist/generated/entities/organization/index.js.map +2 -2
- package/dist/generated/entities/resources_resource/index.js +0 -2
- package/dist/generated/entities/resources_resource/index.js.map +2 -2
- package/dist/generated/entities.ids.generated.js +1 -3
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +0 -23
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/salesFixtures.js +2 -31
- package/dist/helpers/integration/salesFixtures.js.map +2 -2
- package/dist/helpers/integration/salesUi.js +0 -5
- package/dist/helpers/integration/salesUi.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/page.js +1 -2
- package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
- package/dist/modules/attachments/api/route.js +10 -120
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/data/entities.js +1 -67
- package/dist/modules/attachments/data/entities.js.map +2 -2
- package/dist/modules/attachments/di.js +1 -7
- package/dist/modules/attachments/di.js.map +2 -2
- package/dist/modules/attachments/fields/attachment.js +1 -1
- package/dist/modules/attachments/fields/attachment.js.map +2 -2
- package/dist/modules/attachments/lib/drivers/index.js.map +1 -1
- package/dist/modules/attachments/lib/drivers/localDriver.js +6 -19
- package/dist/modules/attachments/lib/drivers/localDriver.js.map +2 -2
- package/dist/modules/attachments/lib/upload-limits.js +0 -33
- package/dist/modules/attachments/lib/upload-limits.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/access/route.js +1 -5
- package/dist/modules/audit_logs/api/audit-logs/access/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js +1 -5
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js +1 -5
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js.map +2 -2
- package/dist/modules/audit_logs/components/AccessLogsTable.js +1 -2
- package/dist/modules/audit_logs/components/AccessLogsTable.js.map +2 -2
- package/dist/modules/audit_logs/components/AuditLogsActions.js +1 -2
- package/dist/modules/audit_logs/components/AuditLogsActions.js.map +2 -2
- package/dist/modules/auth/api/admin/nav.js +4 -17
- package/dist/modules/auth/api/admin/nav.js.map +2 -2
- package/dist/modules/auth/api/profile/route.js +2 -8
- package/dist/modules/auth/api/profile/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +19 -8
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/auth/profile/page.js.map +2 -2
- package/dist/modules/auth/backend/profile/change-password/page.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +1 -2
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/backend/settings/page.js +9 -14
- package/dist/modules/auth/backend/settings/page.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/cli.js +1 -1
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/components/UserConsentsPanel.js +9 -9
- package/dist/modules/auth/components/UserConsentsPanel.js.map +2 -2
- package/dist/modules/auth/frontend/login.js +5 -6
- package/dist/modules/auth/frontend/login.js.map +2 -2
- package/dist/modules/auth/frontend/reset.js +2 -2
- package/dist/modules/auth/frontend/reset.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +29 -45
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +2 -17
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/lib/tenantAccess.js +0 -7
- package/dist/modules/auth/lib/tenantAccess.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +44 -29
- package/dist/modules/auth/services/rbacService.js.map +2 -2
- package/dist/modules/business_rules/api/rules/route.js +4 -71
- package/dist/modules/business_rules/api/rules/route.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/page.js +1 -2
- package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
- package/dist/modules/business_rules/components/ActionBuilder.js +4 -47
- package/dist/modules/business_rules/components/ActionBuilder.js.map +3 -3
- package/dist/modules/business_rules/components/ActionRow.js +16 -106
- package/dist/modules/business_rules/components/ActionRow.js.map +2 -2
- package/dist/modules/business_rules/components/ConditionRow.js +4 -8
- package/dist/modules/business_rules/components/ConditionRow.js.map +2 -2
- package/dist/modules/business_rules/components/utils/actionValidation.js +0 -6
- package/dist/modules/business_rules/components/utils/actionValidation.js.map +2 -2
- package/dist/modules/business_rules/lib/action-executor.js +0 -148
- package/dist/modules/business_rules/lib/action-executor.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-engine.js +1 -5
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +5 -6
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +6 -7
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +3 -3
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js +1 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductCategorizeSection.js +3 -3
- package/dist/modules/catalog/components/products/ProductCategorizeSection.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductMediaManager.js +1 -1
- package/dist/modules/catalog/components/products/ProductMediaManager.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js +2 -3
- package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/VariantBuilder.js +5 -5
- package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
- package/dist/modules/catalog/events.js +0 -1
- package/dist/modules/catalog/events.js.map +2 -2
- package/dist/modules/catalog/widgets/injection/product-seo/widget.js +1 -1
- package/dist/modules/catalog/widgets/injection/product-seo/widget.js.map +2 -2
- package/dist/modules/communication_channels/api/post/test-seed/route.js +2 -52
- package/dist/modules/communication_channels/api/post/test-seed/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/webhook/[provider]/route.js +1 -11
- package/dist/modules/communication_channels/api/post/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/webhooks/gmail/route.js +6 -11
- package/dist/modules/communication_channels/api/post/webhooks/gmail/route.js.map +2 -2
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js +1 -2
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js.map +2 -2
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js +3 -4
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js.map +2 -2
- package/dist/modules/communication_channels/data/enrichers.js +4 -4
- package/dist/modules/communication_channels/data/enrichers.js.map +2 -2
- package/dist/modules/communication_channels/lib/access-control.js +2 -2
- package/dist/modules/communication_channels/lib/access-control.js.map +2 -2
- package/dist/modules/configs/backend/config/system-status/page.js +1 -2
- package/dist/modules/configs/backend/config/system-status/page.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +0 -12
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/page.js +1 -2
- package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js +1 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
- package/dist/modules/currencies/di.js +0 -4
- package/dist/modules/currencies/di.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/users/[id].js +1 -10
- package/dist/modules/customer_accounts/api/admin/users/[id].js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/users-invite.js +4 -63
- package/dist/modules/customer_accounts/api/admin/users-invite.js.map +2 -2
- package/dist/modules/customer_accounts/api/invitations/accept.js +2 -1
- package/dist/modules/customer_accounts/api/invitations/accept.js.map +2 -2
- package/dist/modules/customer_accounts/api/login.js +2 -4
- package/dist/modules/customer_accounts/api/login.js.map +2 -2
- package/dist/modules/customer_accounts/api/magic-link/verify.js +2 -4
- package/dist/modules/customer_accounts/api/magic-link/verify.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/feature-check.js +4 -5
- package/dist/modules/customer_accounts/api/portal/feature-check.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/nav.js +4 -6
- package/dist/modules/customer_accounts/api/portal/nav.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/profile.js +1 -5
- package/dist/modules/customer_accounts/api/portal/profile.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/sessions-refresh.js +3 -3
- package/dist/modules/customer_accounts/api/portal/sessions-refresh.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/users-invite.js +2 -22
- package/dist/modules/customer_accounts/api/portal/users-invite.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js +1 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +1 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
- package/dist/modules/customer_accounts/data/entities.js +0 -3
- package/dist/modules/customer_accounts/data/entities.js.map +2 -2
- package/dist/modules/customer_accounts/data/validators.js +0 -1
- package/dist/modules/customer_accounts/data/validators.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerAuth.js +2 -7
- package/dist/modules/customer_accounts/lib/customerAuth.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerAuthServer.js +1 -2
- package/dist/modules/customer_accounts/lib/customerAuthServer.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerEntityOwnership.js +3 -29
- package/dist/modules/customer_accounts/lib/customerEntityOwnership.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerUrl.js +10 -19
- package/dist/modules/customer_accounts/lib/customerUrl.js.map +2 -2
- package/dist/modules/customer_accounts/services/customerInvitationService.js +2 -32
- package/dist/modules/customer_accounts/services/customerInvitationService.js.map +2 -2
- package/dist/modules/customer_accounts/services/customerRbacService.js +3 -12
- package/dist/modules/customer_accounts/services/customerRbacService.js.map +2 -2
- package/dist/modules/customer_accounts/setup.js +0 -6
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js +7 -47
- package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js.map +2 -2
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js +2 -2
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js.map +2 -2
- package/dist/modules/customer_accounts/widgets/injection/portal-ai-assistant-trigger/widget.client.js +1 -1
- package/dist/modules/customer_accounts/widgets/injection/portal-ai-assistant-trigger/widget.client.js.map +2 -2
- package/dist/modules/customer_accounts/widgets/injection-table.js +1 -1
- package/dist/modules/customer_accounts/widgets/injection-table.js.map +2 -2
- package/dist/modules/customers/analytics.js +1 -4
- package/dist/modules/customers/analytics.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +4 -3
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +2 -4
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/route.js +3 -7
- package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/aggregate/route.js +4 -5
- package/dist/modules/customers/api/deals/aggregate/route.js.map +2 -2
- package/dist/modules/customers/api/deals/summary/route.js +119 -14
- package/dist/modules/customers/api/deals/summary/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js +2 -3
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js.map +2 -2
- package/dist/modules/customers/api/utils.js +18 -12
- package/dist/modules/customers/api/utils.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js +1 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +1 -2
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +5 -16
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +11 -18
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +1 -2
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/QuickDealDialog.js +3 -17
- package/dist/modules/customers/backend/customers/deals/pipeline/components/QuickDealDialog.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/page.js +1 -7
- package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +1 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +1 -2
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +10 -26
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/cli.js +11 -28
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +10 -48
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/people.js +0 -2
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/components/CustomerTodosTable.js +1 -2
- package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
- package/dist/modules/customers/components/detail/ActiveDealCard.js +1 -2
- package/dist/modules/customers/components/detail/ActiveDealCard.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesDayStrip.js +3 -2
- package/dist/modules/customers/components/detail/ActivitiesDayStrip.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyDetailTabs.js +6 -26
- package/dist/modules/customers/components/detail/CompanyDetailTabs.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyKpiBar.js +5 -6
- package/dist/modules/customers/components/detail/CompanyKpiBar.js.map +2 -2
- package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js +1 -1
- package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js.map +1 -1
- package/dist/modules/customers/components/detail/DealDetailTabs.js +8 -30
- package/dist/modules/customers/components/detail/DealDetailTabs.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +1 -2
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/DealsSection.js +1 -1
- package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonDetailTabs.js +8 -30
- package/dist/modules/customers/components/detail/PersonDetailTabs.js.map +2 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +216 -231
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/dashboard/helpers.js +3 -4
- package/dist/modules/customers/components/detail/dashboard/helpers.js.map +2 -2
- package/dist/modules/customers/components/formConfig.js +10 -14
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/customers/data/entities.js +0 -8
- package/dist/modules/customers/data/entities.js.map +2 -2
- package/dist/modules/customers/data/validators.js +2 -5
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/lib/calendar/format.js +4 -8
- package/dist/modules/customers/lib/calendar/format.js.map +2 -2
- package/dist/modules/customers/lib/visibilityFilter.js +4 -6
- package/dist/modules/customers/lib/visibilityFilter.js.map +2 -2
- package/dist/modules/customers/search.js +29 -50
- package/dist/modules/customers/search.js.map +2 -2
- package/dist/modules/dashboards/api/layout/[itemId]/route.js +3 -6
- package/dist/modules/dashboards/api/layout/[itemId]/route.js.map +2 -2
- package/dist/modules/dashboards/api/layout/route.js +9 -22
- package/dist/modules/dashboards/api/layout/route.js.map +2 -2
- package/dist/modules/dashboards/api/roles/widgets/route.js +3 -9
- package/dist/modules/dashboards/api/roles/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/api/users/widgets/route.js +3 -9
- package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/catalog.js +3 -6
- package/dist/modules/dashboards/api/widgets/catalog.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/batch/route.js +3 -12
- package/dist/modules/dashboards/api/widgets/data/batch/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/route.js +3 -28
- package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/schema.js +18 -28
- package/dist/modules/dashboards/api/widgets/data/schema.js.map +2 -2
- package/dist/modules/dashboards/lib/access.js +3 -5
- package/dist/modules/dashboards/lib/access.js.map +2 -2
- package/dist/modules/dashboards/lib/aggregations.js +46 -113
- package/dist/modules/dashboards/lib/aggregations.js.map +2 -2
- package/dist/modules/dashboards/lib/formatters.js +11 -84
- package/dist/modules/dashboards/lib/formatters.js.map +2 -2
- package/dist/modules/dashboards/services/widgetDataService.js +14 -316
- package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/aov-kpi/widget.client.js +3 -9
- package/dist/modules/dashboards/widgets/dashboard/aov-kpi/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/config.js +2 -52
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/config.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.client.js +30 -52
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.js +2 -2
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/revenue-kpi/widget.client.js +3 -9
- package/dist/modules/dashboards/widgets/dashboard/revenue-kpi/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js +3 -8
- package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js +18 -26
- package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js +14 -22
- package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js +4 -10
- package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/[id]/route.js +9 -22
- package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/route.js +4 -13
- package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -7
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/api/run.js +2 -7
- package/dist/modules/data_sync/api/run.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +3 -8
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js +2 -7
- package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/route.js +3 -8
- package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/runs.js +2 -7
- package/dist/modules/data_sync/api/runs.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/[id]/route.js +6 -19
- package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/route.js +4 -13
- package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
- package/dist/modules/data_sync/api/validate.js +4 -9
- package/dist/modules/data_sync/api/validate.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +1 -2
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/queue.js +1 -16
- package/dist/modules/data_sync/lib/queue.js.map +2 -2
- package/dist/modules/data_sync/lib/start-run.js +1 -2
- package/dist/modules/data_sync/lib/start-run.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +2 -35
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-run-service.js +2 -70
- package/dist/modules/data_sync/lib/sync-run-service.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-export.js +2 -9
- package/dist/modules/data_sync/workers/sync-export.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-import.js +2 -9
- package/dist/modules/data_sync/workers/sync-import.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js +12 -34
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js.map +2 -2
- package/dist/modules/dictionaries/api/openapi.js +2 -15
- package/dist/modules/dictionaries/api/openapi.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +1 -1
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
- package/dist/modules/dictionaries/components/hooks/useDictionaryEntries.js +29 -30
- package/dist/modules/dictionaries/components/hooks/useDictionaryEntries.js.map +2 -2
- package/dist/modules/dictionaries/data/validators.js +0 -7
- package/dist/modules/dictionaries/data/validators.js.map +2 -2
- package/dist/modules/dictionaries/lib/clientEntries.js +3 -4
- package/dist/modules/dictionaries/lib/clientEntries.js.map +2 -2
- package/dist/modules/directory/api/organization-branding/route.js +3 -10
- package/dist/modules/directory/api/organization-branding/route.js.map +2 -2
- package/dist/modules/directory/api/organization-switcher/route.js +20 -84
- package/dist/modules/directory/api/organization-switcher/route.js.map +2 -2
- package/dist/modules/directory/api/organizations/route.js +0 -7
- package/dist/modules/directory/api/organizations/route.js.map +3 -3
- package/dist/modules/directory/api/tenants/route.js +2 -8
- package/dist/modules/directory/api/tenants/route.js.map +2 -2
- package/dist/modules/directory/backend/directory/branding/page.js +8 -31
- package/dist/modules/directory/backend/directory/branding/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/[id]/edit/page.js +16 -7
- package/dist/modules/directory/backend/directory/organizations/[id]/edit/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/commands/organizations.js +1 -8
- package/dist/modules/directory/commands/organizations.js.map +2 -2
- package/dist/modules/directory/commands/tenants.js +0 -6
- package/dist/modules/directory/commands/tenants.js.map +2 -2
- package/dist/modules/directory/data/entities.js +0 -4
- package/dist/modules/directory/data/entities.js.map +2 -2
- package/dist/modules/directory/data/validators.js +0 -2
- package/dist/modules/directory/data/validators.js.map +2 -2
- package/dist/modules/directory/subscribers/invalidateOrgScopeCache.js +1 -5
- package/dist/modules/directory/subscribers/invalidateOrgScopeCache.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js +3 -11
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/entities/api/definitions.js +3 -53
- package/dist/modules/entities/api/definitions.js.map +2 -2
- package/dist/modules/entities/api/entities.js +2 -21
- package/dist/modules/entities/api/entities.js.map +2 -2
- package/dist/modules/entities/api/entity-settings.js +9 -59
- package/dist/modules/entities/api/entity-settings.js.map +2 -2
- package/dist/modules/entities/api/records.js +24 -3
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/api/relations/options.js +16 -11
- package/dist/modules/entities/api/relations/options.js.map +2 -2
- package/dist/modules/entities/api/sidebar-entities.js +12 -34
- package/dist/modules/entities/api/sidebar-entities.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +4 -23
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/create/page.js +7 -16
- package/dist/modules/entities/backend/entities/user/create/page.js.map +2 -2
- package/dist/modules/entities/cli.js +19 -193
- package/dist/modules/entities/cli.js.map +2 -2
- package/dist/modules/entities/components/SystemEntitiesTable.js +1 -2
- package/dist/modules/entities/components/SystemEntitiesTable.js.map +2 -2
- package/dist/modules/entities/components/UserEntitiesTable.js +1 -2
- package/dist/modules/entities/components/UserEntitiesTable.js.map +2 -2
- package/dist/modules/entities/lib/entityAcl.js +9 -87
- package/dist/modules/entities/lib/entityAcl.js.map +3 -3
- package/dist/modules/feature_toggles/components/FeatureGuard.js +2 -3
- package/dist/modules/feature_toggles/components/FeatureGuard.js.map +2 -2
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagBoolean.js +2 -5
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagBoolean.js.map +2 -2
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagJson.js +2 -5
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagJson.js.map +2 -2
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagNumber.js +2 -5
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagNumber.js.map +2 -2
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagString.js +2 -5
- package/dist/modules/feature_toggles/components/hooks/useFeatureFlagString.js.map +2 -2
- package/dist/modules/inbox_ops/ai-tools.js +2 -5
- package/dist/modules/inbox_ops/ai-tools.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js +1 -14
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/route.js +1 -16
- package/dist/modules/inbox_ops/api/proposals/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/webhook/inbound.js +10 -14
- package/dist/modules/inbox_ops/api/webhook/inbound.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +6 -6
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
- package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js +20 -25
- package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js.map +2 -2
- package/dist/modules/inbox_ops/search.js +4 -15
- package/dist/modules/inbox_ops/search.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +5 -11
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/health/route.js +3 -6
- package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/route.js +3 -6
- package/dist/modules/integrations/api/[id]/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/state/route.js +3 -6
- package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/version/route.js +3 -6
- package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
- package/dist/modules/integrations/api/logs/route.js +3 -6
- package/dist/modules/integrations/api/logs/route.js.map +2 -2
- package/dist/modules/integrations/api/route.js +3 -6
- package/dist/modules/integrations/api/route.js.map +2 -2
- package/dist/modules/integrations/api/umes-read.js +2 -2
- package/dist/modules/integrations/api/umes-read.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +4 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/lib/organization-scope.js +9 -2
- package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
- package/dist/modules/integrations/widgets/injection/external-ids/widget.client.js +5 -0
- package/dist/modules/integrations/widgets/injection/external-ids/widget.client.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +0 -15
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/route.js +8 -77
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/components/ComposeMessagePageClient.js +1 -2
- package/dist/modules/messages/components/ComposeMessagePageClient.js.map +2 -2
- package/dist/modules/messages/components/MessageDetailPageClient.js +2 -3
- package/dist/modules/messages/components/MessageDetailPageClient.js.map +2 -2
- package/dist/modules/messages/components/MessagesInboxPageClient.js +1 -2
- package/dist/modules/messages/components/MessagesInboxPageClient.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/dialogs.js +1 -1
- package/dist/modules/messages/components/message-detail/panels/dialogs.js.map +1 -1
- package/dist/modules/messages/lib/routeHelpers.js +3 -1
- package/dist/modules/messages/lib/routeHelpers.js.map +2 -2
- package/dist/modules/messages/lib/searchLookup.js +16 -8
- package/dist/modules/messages/lib/searchLookup.js.map +2 -2
- package/dist/modules/messages/search.js +5 -10
- package/dist/modules/messages/search.js.map +2 -2
- package/dist/modules/notifications/api/route.js +4 -83
- package/dist/modules/notifications/api/route.js.map +2 -2
- package/dist/modules/notifications/api/unread-count/route.js +6 -25
- package/dist/modules/notifications/api/unread-count/route.js.map +2 -2
- package/dist/modules/notifications/di.js +1 -1
- package/dist/modules/notifications/di.js.map +2 -2
- package/dist/modules/notifications/events.js +2 -4
- package/dist/modules/notifications/events.js.map +2 -2
- package/dist/modules/notifications/lib/notificationRecipients.js +7 -6
- package/dist/modules/notifications/lib/notificationRecipients.js.map +2 -2
- package/dist/modules/notifications/lib/notificationService.js +4 -48
- package/dist/modules/notifications/lib/notificationService.js.map +2 -2
- package/dist/modules/notifications/lib/routeHelpers.js +2 -16
- package/dist/modules/notifications/lib/routeHelpers.js.map +2 -2
- package/dist/modules/payment_gateways/api/capture/route.js +1 -1
- package/dist/modules/payment_gateways/api/capture/route.js.map +2 -2
- package/dist/modules/payment_gateways/api/sessions/route.js +3 -6
- package/dist/modules/payment_gateways/api/sessions/route.js.map +2 -2
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +1 -11
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js +2 -3
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js.map +2 -2
- package/dist/modules/payment_gateways/data/entities.js +0 -11
- package/dist/modules/payment_gateways/data/entities.js.map +2 -2
- package/dist/modules/payment_gateways/di.js +1 -17
- package/dist/modules/payment_gateways/di.js.map +2 -2
- package/dist/modules/payment_gateways/lib/gateway-service.js +14 -93
- package/dist/modules/payment_gateways/lib/gateway-service.js.map +2 -2
- package/dist/modules/payment_gateways/lib/payment-operation-idempotency.js +0 -1
- package/dist/modules/payment_gateways/lib/payment-operation-idempotency.js.map +2 -2
- package/dist/modules/payment_gateways/lib/session-idempotency.js +0 -33
- package/dist/modules/payment_gateways/lib/session-idempotency.js.map +2 -2
- package/dist/modules/payment_gateways/setup.js +0 -47
- package/dist/modules/payment_gateways/setup.js.map +2 -2
- package/dist/modules/planner/components/AvailabilityRulesEditor.js +4 -4
- package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
- package/dist/modules/planner/components/unavailabilityReasons.js +3 -3
- package/dist/modules/planner/components/unavailabilityReasons.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/dashboard/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/dashboard/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/login/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/login/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/profile/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/profile/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/reset-password/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/reset-password/page.js.map +2 -2
- package/dist/modules/portal/frontend/[orgSlug]/portal/signup/page.js +3 -3
- package/dist/modules/portal/frontend/[orgSlug]/portal/signup/page.js.map +2 -2
- package/dist/modules/progress/lib/progressService.js +0 -2
- package/dist/modules/progress/lib/progressService.js.map +2 -2
- package/dist/modules/progress/lib/progressServiceImpl.js +104 -322
- package/dist/modules/progress/lib/progressServiceImpl.js.map +2 -2
- package/dist/modules/query_index/api/openapi.js +1 -13
- package/dist/modules/query_index/api/openapi.js.map +2 -2
- package/dist/modules/query_index/api/reindex.js +0 -10
- package/dist/modules/query_index/api/reindex.js.map +2 -2
- package/dist/modules/query_index/api/status.js +105 -165
- package/dist/modules/query_index/api/status.js.map +2 -2
- package/dist/modules/query_index/cli.js +1 -125
- package/dist/modules/query_index/cli.js.map +2 -2
- package/dist/modules/query_index/components/QueryIndexesTable.js +42 -130
- package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +1 -2
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/di.js +0 -3
- package/dist/modules/query_index/di.js.map +2 -2
- package/dist/modules/query_index/lib/batch.js +4 -11
- package/dist/modules/query_index/lib/batch.js.map +2 -2
- package/dist/modules/query_index/lib/coverage.js +9 -21
- package/dist/modules/query_index/lib/coverage.js.map +2 -2
- package/dist/modules/query_index/lib/document.js +5 -12
- package/dist/modules/query_index/lib/document.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +48 -105
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/indexer.js +19 -95
- package/dist/modules/query_index/lib/indexer.js.map +2 -2
- package/dist/modules/query_index/lib/reindexer.js +37 -43
- package/dist/modules/query_index/lib/reindexer.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +15 -34
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/query_index/lib/subscriber-scope.js +3 -2
- package/dist/modules/query_index/lib/subscriber-scope.js.map +2 -2
- package/dist/modules/query_index/subscribers/coverage_refresh.js +0 -4
- package/dist/modules/query_index/subscribers/coverage_refresh.js.map +2 -2
- package/dist/modules/query_index/subscribers/delete_one.js +1 -53
- package/dist/modules/query_index/subscribers/delete_one.js.map +3 -3
- package/dist/modules/query_index/subscribers/upsert_one.js +0 -60
- package/dist/modules/query_index/subscribers/upsert_one.js.map +3 -3
- package/dist/modules/resources/api/resources.js +0 -2
- package/dist/modules/resources/api/resources.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +1 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/[id]/page.js +2 -3
- package/dist/modules/resources/backend/resources/resources/[id]/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +1 -2
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/resources/commands/resources.js +0 -9
- package/dist/modules/resources/commands/resources.js.map +2 -2
- package/dist/modules/resources/components/detail/dictionaries.js +3 -3
- package/dist/modules/resources/components/detail/dictionaries.js.map +2 -2
- package/dist/modules/resources/data/entities.js +0 -3
- package/dist/modules/resources/data/entities.js.map +2 -2
- package/dist/modules/resources/data/validators.js +2 -6
- package/dist/modules/resources/data/validators.js.map +2 -2
- package/dist/modules/resources/lib/seeds.js +9 -16
- package/dist/modules/resources/lib/seeds.js.map +2 -2
- package/dist/modules/sales/analytics.js +3 -7
- package/dist/modules/sales/analytics.js.map +2 -2
- package/dist/modules/sales/api/document-history/route.js +1 -2
- package/dist/modules/sales/api/document-history/route.js.map +2 -2
- package/dist/modules/sales/api/documents/factory.js +3 -14
- package/dist/modules/sales/api/documents/factory.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +3 -11
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/create/page.js +14 -11
- package/dist/modules/sales/backend/sales/documents/create/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +23 -184
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +10 -20
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +5 -12
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentForm.js +2 -48
- package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +1 -4
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/sales/components/useSalesChannelsEnabled.js +35 -2
- package/dist/modules/sales/components/useSalesChannelsEnabled.js.map +2 -2
- package/dist/modules/sales/data/validators.js +5 -32
- package/dist/modules/sales/data/validators.js.map +2 -2
- package/dist/modules/sales/di.js +0 -7
- package/dist/modules/sales/di.js.map +2 -2
- package/dist/modules/sales/events.js +0 -1
- package/dist/modules/sales/events.js.map +2 -2
- package/dist/modules/sales/lib/historyHelpers.js +1 -69
- package/dist/modules/sales/lib/historyHelpers.js.map +2 -2
- package/dist/modules/sales/widgets/injection/document-history/widget.client.js +2 -51
- package/dist/modules/sales/widgets/injection/document-history/widget.client.js.map +2 -2
- package/dist/modules/sales/workflows.js +7 -10
- package/dist/modules/sales/workflows.js.map +2 -2
- package/dist/modules/shipping_carriers/api/webhook/[provider]/route.js +1 -11
- package/dist/modules/shipping_carriers/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js +1 -1
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js.map +1 -1
- package/dist/modules/staff/api/interceptors.js +3 -5
- package/dist/modules/staff/api/interceptors.js.map +2 -2
- package/dist/modules/staff/api/leave-requests.js +42 -45
- package/dist/modules/staff/api/leave-requests.js.map +2 -2
- package/dist/modules/staff/components/detail/dictionaries.js +3 -3
- package/dist/modules/staff/components/detail/dictionaries.js.map +2 -2
- package/dist/modules/sync_excel/api/upload/route.js +2 -15
- package/dist/modules/sync_excel/api/upload/route.js.map +2 -2
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js +1 -1
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js.map +1 -1
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js +4 -5
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +3 -4
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +2 -3
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js +2 -3
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotsListPage.js +1 -2
- package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +2 -3
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/page.js +2 -3
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +3 -6
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +9 -10
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +7 -8
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/components/ActivitiesEditor.js +13 -69
- package/dist/modules/workflows/components/ActivitiesEditor.js.map +2 -2
- package/dist/modules/workflows/components/BusinessRulesSelector.js +1 -1
- package/dist/modules/workflows/components/BusinessRulesSelector.js.map +2 -2
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js +2 -2
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +2 -2
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js +2 -1
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js.map +2 -2
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js +2 -1
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js.map +2 -2
- package/dist/modules/workflows/components/StepsEditor.js +2 -2
- package/dist/modules/workflows/components/StepsEditor.js.map +2 -2
- package/dist/modules/workflows/components/TransitionsEditor.js +165 -207
- package/dist/modules/workflows/components/TransitionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowLegend.js +1 -1
- package/dist/modules/workflows/components/WorkflowLegend.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowSelector.js +1 -1
- package/dist/modules/workflows/components/WorkflowSelector.js.map +2 -2
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +1 -1
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js +1 -1
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/MappingArrayEditor.js +1 -1
- package/dist/modules/workflows/components/fields/MappingArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +1 -1
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/WorkflowSelectorField.js +4 -4
- package/dist/modules/workflows/components/fields/WorkflowSelectorField.js.map +2 -2
- package/dist/modules/workflows/data/validators.js +1 -34
- package/dist/modules/workflows/data/validators.js.map +3 -3
- package/dist/modules/workflows/events.js +0 -1
- package/dist/modules/workflows/events.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +14 -59
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/format-validation-error.js +1 -46
- package/dist/modules/workflows/lib/format-validation-error.js.map +2 -2
- package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js +10 -21
- package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js.map +2 -2
- package/generated/entities/customer_deal_person_link/index.ts +0 -1
- package/generated/entities/customer_user_invitation/index.ts +0 -1
- package/generated/entities/gateway_payment_operation/index.ts +0 -1
- package/generated/entities/gateway_transaction/index.ts +0 -1
- package/generated/entities/organization/index.ts +0 -1
- package/generated/entities/resources_resource/index.ts +0 -1
- package/generated/entities.ids.generated.ts +1 -3
- package/generated/entity-fields-registry.ts +0 -23
- package/package.json +18 -19
- package/src/bootstrap.ts +2 -17
- package/src/helpers/integration/salesFixtures.ts +2 -34
- package/src/helpers/integration/salesUi.ts +0 -8
- package/src/modules/api_keys/backend/api-keys/page.tsx +1 -2
- package/src/modules/attachments/api/route.ts +9 -130
- package/src/modules/attachments/data/entities.ts +0 -59
- package/src/modules/attachments/di.ts +1 -9
- package/src/modules/attachments/fields/attachment.tsx +1 -1
- package/src/modules/attachments/i18n/de.json +0 -15
- package/src/modules/attachments/i18n/en.json +0 -15
- package/src/modules/attachments/i18n/es.json +0 -15
- package/src/modules/attachments/i18n/pl.json +0 -15
- package/src/modules/attachments/lib/drivers/index.ts +1 -1
- package/src/modules/attachments/lib/drivers/localDriver.ts +8 -23
- package/src/modules/attachments/lib/drivers/types.ts +0 -5
- package/src/modules/attachments/lib/upload-limits.ts +0 -35
- package/src/modules/attachments/migrations/.snapshot-open-mercato.json +120 -648
- package/src/modules/audit_logs/api/audit-logs/access/route.ts +0 -5
- package/src/modules/audit_logs/api/audit-logs/actions/export/route.ts +0 -5
- package/src/modules/audit_logs/api/audit-logs/actions/route.ts +0 -5
- package/src/modules/audit_logs/components/AccessLogsTable.tsx +1 -2
- package/src/modules/audit_logs/components/AuditLogsActions.tsx +1 -2
- package/src/modules/auth/AGENTS.md +8 -12
- package/src/modules/auth/api/admin/nav.ts +4 -28
- package/src/modules/auth/api/profile/route.ts +2 -8
- package/src/modules/auth/api/users/route.ts +28 -8
- package/src/modules/auth/backend/auth/profile/page.tsx +0 -1
- package/src/modules/auth/backend/profile/change-password/page.tsx +0 -1
- package/src/modules/auth/backend/roles/page.tsx +1 -2
- package/src/modules/auth/backend/settings/page.tsx +8 -17
- package/src/modules/auth/backend/users/page.tsx +1 -2
- package/src/modules/auth/cli.ts +1 -1
- package/src/modules/auth/components/UserConsentsPanel.tsx +9 -9
- package/src/modules/auth/frontend/login.tsx +4 -5
- package/src/modules/auth/frontend/reset.tsx +2 -2
- package/src/modules/auth/i18n/de.json +0 -1
- package/src/modules/auth/i18n/en.json +0 -1
- package/src/modules/auth/i18n/es.json +0 -1
- package/src/modules/auth/i18n/pl.json +0 -1
- package/src/modules/auth/lib/backendChrome.tsx +33 -71
- package/src/modules/auth/lib/setup-app.ts +2 -21
- package/src/modules/auth/lib/tenantAccess.ts +0 -8
- package/src/modules/auth/services/rbacService.ts +46 -41
- package/src/modules/business_rules/api/rules/route.ts +4 -92
- package/src/modules/business_rules/backend/rules/page.tsx +1 -2
- package/src/modules/business_rules/components/ActionBuilder.tsx +5 -54
- package/src/modules/business_rules/components/ActionRow.tsx +18 -156
- package/src/modules/business_rules/components/ConditionRow.tsx +6 -9
- package/src/modules/business_rules/components/utils/actionValidation.ts +0 -6
- package/src/modules/business_rules/i18n/de.json +0 -12
- package/src/modules/business_rules/i18n/en.json +0 -12
- package/src/modules/business_rules/i18n/es.json +0 -12
- package/src/modules/business_rules/i18n/pl.json +0 -12
- package/src/modules/business_rules/lib/action-executor.ts +0 -198
- package/src/modules/business_rules/lib/rule-engine.ts +0 -4
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +5 -6
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +6 -7
- package/src/modules/catalog/components/PriceKindSettings.tsx +3 -3
- package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +1 -2
- package/src/modules/catalog/components/products/ProductCategorizeSection.tsx +3 -3
- package/src/modules/catalog/components/products/ProductMediaManager.tsx +1 -1
- package/src/modules/catalog/components/products/ProductsDataTable.tsx +2 -3
- package/src/modules/catalog/components/products/VariantBuilder.tsx +5 -5
- package/src/modules/catalog/events.ts +0 -1
- package/src/modules/catalog/i18n/de.json +0 -18
- package/src/modules/catalog/i18n/en.json +0 -18
- package/src/modules/catalog/i18n/es.json +0 -18
- package/src/modules/catalog/i18n/pl.json +0 -18
- package/src/modules/catalog/widgets/injection/product-seo/widget.ts +1 -1
- package/src/modules/communication_channels/api/post/test-seed/route.ts +2 -69
- package/src/modules/communication_channels/api/post/webhook/[provider]/route.ts +1 -11
- package/src/modules/communication_channels/api/post/webhooks/gmail/route.ts +11 -17
- package/src/modules/communication_channels/backend/communication_channels/channels/page.tsx +1 -2
- package/src/modules/communication_channels/backend/profile/communication-channels/page.tsx +3 -4
- package/src/modules/communication_channels/data/enrichers.ts +26 -6
- package/src/modules/communication_channels/lib/access-control.ts +3 -3
- package/src/modules/configs/backend/config/system-status/page.tsx +1 -2
- package/src/modules/configs/lib/upgrade-actions.ts +0 -14
- package/src/modules/currencies/backend/currencies/page.tsx +1 -2
- package/src/modules/currencies/backend/exchange-rates/page.tsx +1 -2
- package/src/modules/currencies/di.ts +1 -4
- package/src/modules/currencies/i18n/de.json +0 -1
- package/src/modules/currencies/i18n/en.json +0 -1
- package/src/modules/currencies/i18n/es.json +0 -1
- package/src/modules/currencies/i18n/pl.json +0 -1
- package/src/modules/customer_accounts/AGENTS.md +3 -3
- package/src/modules/customer_accounts/api/admin/users/[id].ts +1 -16
- package/src/modules/customer_accounts/api/admin/users-invite.ts +3 -81
- package/src/modules/customer_accounts/api/invitations/accept.ts +2 -1
- package/src/modules/customer_accounts/api/login.ts +2 -4
- package/src/modules/customer_accounts/api/magic-link/verify.ts +2 -4
- package/src/modules/customer_accounts/api/portal/feature-check.ts +7 -5
- package/src/modules/customer_accounts/api/portal/nav.ts +3 -5
- package/src/modules/customer_accounts/api/portal/profile.ts +1 -5
- package/src/modules/customer_accounts/api/portal/sessions-refresh.ts +3 -3
- package/src/modules/customer_accounts/api/portal/users-invite.ts +1 -25
- package/src/modules/customer_accounts/backend/customer_accounts/roles/page.tsx +1 -2
- package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +1 -2
- package/src/modules/customer_accounts/data/entities.ts +0 -3
- package/src/modules/customer_accounts/data/validators.ts +0 -1
- package/src/modules/customer_accounts/i18n/de.json +0 -6
- package/src/modules/customer_accounts/i18n/en.json +0 -6
- package/src/modules/customer_accounts/i18n/es.json +0 -6
- package/src/modules/customer_accounts/i18n/pl.json +0 -6
- package/src/modules/customer_accounts/lib/customerAuth.ts +2 -8
- package/src/modules/customer_accounts/lib/customerAuthServer.ts +0 -1
- package/src/modules/customer_accounts/lib/customerEntityOwnership.ts +2 -68
- package/src/modules/customer_accounts/lib/customerUrl.ts +11 -27
- package/src/modules/customer_accounts/migrations/.snapshot-open-mercato.json +0 -16
- package/src/modules/customer_accounts/services/customerInvitationService.ts +3 -56
- package/src/modules/customer_accounts/services/customerRbacService.ts +3 -16
- package/src/modules/customer_accounts/setup.ts +0 -7
- package/src/modules/customer_accounts/subscribers/autoLinkCrm.ts +8 -75
- package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +2 -2
- package/src/modules/customer_accounts/widgets/injection/portal-ai-assistant-trigger/widget.client.tsx +3 -1
- package/src/modules/customer_accounts/widgets/injection-table.ts +1 -4
- package/src/modules/customers/analytics.ts +0 -3
- package/src/modules/customers/api/companies/[id]/route.ts +4 -3
- package/src/modules/customers/api/deals/[id]/people/route.ts +0 -3
- package/src/modules/customers/api/deals/[id]/route.ts +2 -10
- package/src/modules/customers/api/deals/aggregate/route.ts +4 -5
- package/src/modules/customers/api/deals/summary/route.ts +162 -15
- package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +2 -3
- package/src/modules/customers/api/utils.ts +31 -12
- package/src/modules/customers/backend/customers/companies/[id]/page.tsx +1 -2
- package/src/modules/customers/backend/customers/companies/page.tsx +1 -2
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +5 -17
- package/src/modules/customers/backend/customers/deals/[id]/hooks/types.ts +0 -1
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +12 -19
- package/src/modules/customers/backend/customers/deals/page.tsx +1 -2
- package/src/modules/customers/backend/customers/deals/pipeline/components/QuickDealDialog.tsx +3 -35
- package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +1 -10
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +1 -2
- package/src/modules/customers/backend/customers/people/page.tsx +1 -2
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +10 -29
- package/src/modules/customers/cli.ts +11 -28
- package/src/modules/customers/commands/deals.ts +9 -50
- package/src/modules/customers/commands/people.ts +0 -3
- package/src/modules/customers/components/CustomerTodosTable.tsx +1 -2
- package/src/modules/customers/components/detail/ActiveDealCard.tsx +1 -2
- package/src/modules/customers/components/detail/ActivitiesDayStrip.tsx +3 -2
- package/src/modules/customers/components/detail/CompanyDetailTabs.tsx +7 -30
- package/src/modules/customers/components/detail/CompanyKpiBar.tsx +5 -6
- package/src/modules/customers/components/detail/ConfirmDealLostDialog.tsx +1 -1
- package/src/modules/customers/components/detail/DealDetailTabs.tsx +9 -34
- package/src/modules/customers/components/detail/DealForm.tsx +1 -5
- package/src/modules/customers/components/detail/DealsSection.tsx +1 -1
- package/src/modules/customers/components/detail/PersonDetailTabs.tsx +9 -34
- package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +13 -28
- package/src/modules/customers/components/detail/dashboard/helpers.ts +3 -4
- package/src/modules/customers/components/formConfig.tsx +8 -12
- package/src/modules/customers/data/entities.ts +1 -9
- package/src/modules/customers/data/validators.ts +1 -6
- package/src/modules/customers/i18n/de.json +0 -72
- package/src/modules/customers/i18n/en.json +0 -72
- package/src/modules/customers/i18n/es.json +0 -72
- package/src/modules/customers/i18n/pl.json +0 -72
- package/src/modules/customers/lib/calendar/format.ts +4 -10
- package/src/modules/customers/lib/visibilityFilter.ts +5 -7
- package/src/modules/customers/migrations/.snapshot-open-mercato.json +1 -27
- package/src/modules/customers/search.ts +27 -59
- package/src/modules/dashboards/api/layout/[itemId]/route.ts +3 -6
- package/src/modules/dashboards/api/layout/route.ts +9 -22
- package/src/modules/dashboards/api/roles/widgets/route.ts +3 -9
- package/src/modules/dashboards/api/users/widgets/route.ts +3 -9
- package/src/modules/dashboards/api/widgets/catalog.ts +3 -6
- package/src/modules/dashboards/api/widgets/data/batch/route.ts +1 -12
- package/src/modules/dashboards/api/widgets/data/route.ts +1 -29
- package/src/modules/dashboards/api/widgets/data/schema.ts +19 -49
- package/src/modules/dashboards/i18n/de.json +0 -5
- package/src/modules/dashboards/i18n/en.json +0 -5
- package/src/modules/dashboards/i18n/es.json +0 -5
- package/src/modules/dashboards/i18n/pl.json +0 -5
- package/src/modules/dashboards/lib/access.ts +3 -5
- package/src/modules/dashboards/lib/aggregations.ts +48 -198
- package/src/modules/dashboards/lib/formatters.ts +12 -137
- package/src/modules/dashboards/services/widgetDataService.ts +12 -453
- package/src/modules/dashboards/widgets/dashboard/aov-kpi/widget.client.tsx +3 -9
- package/src/modules/dashboards/widgets/dashboard/pipeline-summary/config.ts +0 -86
- package/src/modules/dashboards/widgets/dashboard/pipeline-summary/widget.client.tsx +21 -42
- package/src/modules/dashboards/widgets/dashboard/pipeline-summary/widget.ts +2 -2
- package/src/modules/dashboards/widgets/dashboard/revenue-kpi/widget.client.tsx +3 -9
- package/src/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.tsx +2 -7
- package/src/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.tsx +15 -25
- package/src/modules/dashboards/widgets/dashboard/top-customers/widget.client.tsx +11 -21
- package/src/modules/dashboards/widgets/dashboard/top-products/widget.client.tsx +3 -9
- package/src/modules/data_sync/AGENTS.md +0 -1
- package/src/modules/data_sync/api/mappings/[id]/route.ts +9 -22
- package/src/modules/data_sync/api/mappings/route.ts +4 -13
- package/src/modules/data_sync/api/options.ts +2 -7
- package/src/modules/data_sync/api/run.ts +2 -7
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +3 -8
- package/src/modules/data_sync/api/runs/[id]/retry.ts +2 -7
- package/src/modules/data_sync/api/runs/[id]/route.ts +3 -8
- package/src/modules/data_sync/api/runs.ts +2 -7
- package/src/modules/data_sync/api/schedules/[id]/route.ts +6 -19
- package/src/modules/data_sync/api/schedules/route.ts +4 -13
- package/src/modules/data_sync/api/validate.ts +4 -9
- package/src/modules/data_sync/backend/data-sync/page.tsx +1 -2
- package/src/modules/data_sync/lib/adapter.ts +0 -18
- package/src/modules/data_sync/lib/queue.ts +1 -19
- package/src/modules/data_sync/lib/start-run.ts +1 -2
- package/src/modules/data_sync/lib/sync-engine.ts +0 -46
- package/src/modules/data_sync/lib/sync-run-service.ts +1 -82
- package/src/modules/data_sync/workers/sync-export.ts +1 -8
- package/src/modules/data_sync/workers/sync-import.ts +1 -8
- package/src/modules/dictionaries/api/[dictionaryId]/entries/route.ts +11 -39
- package/src/modules/dictionaries/api/openapi.ts +0 -19
- package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +1 -1
- package/src/modules/dictionaries/components/hooks/useDictionaryEntries.ts +36 -35
- package/src/modules/dictionaries/data/validators.ts +0 -14
- package/src/modules/dictionaries/lib/clientEntries.ts +3 -4
- package/src/modules/directory/api/organization-branding/route.ts +1 -12
- package/src/modules/directory/api/organization-switcher/route.ts +26 -97
- package/src/modules/directory/api/organizations/route.ts +0 -7
- package/src/modules/directory/api/tenants/route.ts +1 -9
- package/src/modules/directory/backend/directory/branding/page.tsx +9 -34
- package/src/modules/directory/backend/directory/organizations/[id]/edit/page.tsx +14 -10
- package/src/modules/directory/backend/directory/organizations/page.tsx +1 -2
- package/src/modules/directory/backend/directory/tenants/page.tsx +1 -2
- package/src/modules/directory/commands/organizations.ts +1 -9
- package/src/modules/directory/commands/tenants.ts +0 -6
- package/src/modules/directory/data/entities.ts +0 -3
- package/src/modules/directory/data/validators.ts +0 -2
- package/src/modules/directory/i18n/de.json +1 -4
- package/src/modules/directory/i18n/en.json +1 -4
- package/src/modules/directory/i18n/es.json +1 -4
- package/src/modules/directory/i18n/pl.json +1 -4
- package/src/modules/directory/migrations/.snapshot-open-mercato.json +1 -18
- package/src/modules/directory/subscribers/invalidateOrgScopeCache.ts +1 -4
- package/src/modules/directory/utils/organizationScope.ts +3 -9
- package/src/modules/entities/api/definitions.ts +3 -55
- package/src/modules/entities/api/entities.ts +2 -30
- package/src/modules/entities/api/entity-settings.ts +22 -66
- package/src/modules/entities/api/records.ts +27 -3
- package/src/modules/entities/api/relations/options.ts +25 -11
- package/src/modules/entities/api/sidebar-entities.ts +14 -43
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +75 -96
- package/src/modules/entities/backend/entities/user/create/page.tsx +7 -16
- package/src/modules/entities/cli.ts +21 -238
- package/src/modules/entities/components/SystemEntitiesTable.tsx +1 -2
- package/src/modules/entities/components/UserEntitiesTable.tsx +1 -2
- package/src/modules/entities/i18n/de.json +0 -9
- package/src/modules/entities/i18n/en.json +0 -9
- package/src/modules/entities/i18n/es.json +0 -9
- package/src/modules/entities/i18n/pl.json +0 -9
- package/src/modules/entities/lib/entityAcl.ts +11 -98
- package/src/modules/feature_toggles/components/FeatureGuard.tsx +2 -9
- package/src/modules/feature_toggles/components/hooks/useFeatureFlagBoolean.ts +1 -13
- package/src/modules/feature_toggles/components/hooks/useFeatureFlagJson.ts +3 -12
- package/src/modules/feature_toggles/components/hooks/useFeatureFlagNumber.ts +1 -10
- package/src/modules/feature_toggles/components/hooks/useFeatureFlagString.ts +1 -10
- package/src/modules/inbox_ops/ai-tools.ts +3 -5
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.ts +1 -17
- package/src/modules/inbox_ops/api/proposals/route.ts +1 -20
- package/src/modules/inbox_ops/api/webhook/inbound.ts +12 -14
- package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +6 -6
- package/src/modules/inbox_ops/components/proposals/EditActionDialog.tsx +19 -24
- package/src/modules/inbox_ops/components/proposals/types.ts +0 -1
- package/src/modules/inbox_ops/i18n/de.json +0 -3
- package/src/modules/inbox_ops/i18n/en.json +0 -3
- package/src/modules/inbox_ops/i18n/es.json +0 -3
- package/src/modules/inbox_ops/i18n/pl.json +0 -3
- package/src/modules/inbox_ops/search.ts +4 -20
- package/src/modules/integrations/api/[id]/credentials/route.ts +5 -11
- package/src/modules/integrations/api/[id]/health/route.ts +3 -6
- package/src/modules/integrations/api/[id]/route.ts +3 -6
- package/src/modules/integrations/api/[id]/state/route.ts +3 -6
- package/src/modules/integrations/api/[id]/version/route.ts +3 -6
- package/src/modules/integrations/api/logs/route.ts +3 -6
- package/src/modules/integrations/api/route.ts +3 -6
- package/src/modules/integrations/api/umes-read.ts +2 -2
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +2 -2
- package/src/modules/integrations/lib/organization-scope.ts +25 -5
- package/src/modules/integrations/widgets/injection/external-ids/widget.client.tsx +5 -0
- package/src/modules/messages/api/[id]/route.ts +0 -21
- package/src/modules/messages/api/route.ts +9 -109
- package/src/modules/messages/components/ComposeMessagePageClient.tsx +1 -2
- package/src/modules/messages/components/MessageDetailPageClient.tsx +2 -3
- package/src/modules/messages/components/MessagesInboxPageClient.tsx +1 -2
- package/src/modules/messages/components/message-detail/panels/dialogs.tsx +1 -1
- package/src/modules/messages/i18n/de.json +0 -2
- package/src/modules/messages/i18n/en.json +0 -2
- package/src/modules/messages/i18n/es.json +0 -2
- package/src/modules/messages/i18n/pl.json +0 -2
- package/src/modules/messages/lib/routeHelpers.ts +6 -4
- package/src/modules/messages/lib/searchLookup.ts +34 -11
- package/src/modules/messages/search.ts +5 -11
- package/src/modules/notifications/api/route.ts +3 -123
- package/src/modules/notifications/api/unread-count/route.ts +5 -42
- package/src/modules/notifications/di.ts +1 -1
- package/src/modules/notifications/events.ts +0 -2
- package/src/modules/notifications/lib/notificationRecipients.ts +8 -6
- package/src/modules/notifications/lib/notificationService.ts +1 -63
- package/src/modules/notifications/lib/routeHelpers.ts +2 -19
- package/src/modules/payment_gateways/api/capture/route.ts +1 -1
- package/src/modules/payment_gateways/api/sessions/route.ts +3 -6
- package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +1 -13
- package/src/modules/payment_gateways/backend/payment-gateways/page.tsx +2 -3
- package/src/modules/payment_gateways/data/entities.ts +2 -13
- package/src/modules/payment_gateways/di.ts +2 -28
- package/src/modules/payment_gateways/i18n/de.json +1 -8
- package/src/modules/payment_gateways/i18n/en.json +1 -8
- package/src/modules/payment_gateways/i18n/es.json +1 -8
- package/src/modules/payment_gateways/i18n/pl.json +1 -8
- package/src/modules/payment_gateways/lib/gateway-service.ts +18 -114
- package/src/modules/payment_gateways/lib/payment-operation-idempotency.ts +0 -1
- package/src/modules/payment_gateways/lib/session-idempotency.ts +0 -36
- package/src/modules/payment_gateways/migrations/.snapshot-open-mercato.json +1 -44
- package/src/modules/payment_gateways/setup.ts +0 -62
- package/src/modules/planner/components/AvailabilityRulesEditor.tsx +4 -4
- package/src/modules/planner/components/unavailabilityReasons.ts +3 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/dashboard/page.tsx +3 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/login/page.tsx +3 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/page.tsx +3 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/profile/page.tsx +3 -3
- package/src/modules/portal/frontend/[orgSlug]/portal/reset-password/page.tsx +4 -4
- package/src/modules/portal/frontend/[orgSlug]/portal/signup/page.tsx +3 -3
- package/src/modules/portal/i18n/de.json +0 -18
- package/src/modules/portal/i18n/en.json +0 -18
- package/src/modules/portal/i18n/es.json +0 -18
- package/src/modules/portal/i18n/pl.json +0 -18
- package/src/modules/progress/AGENTS.md +1 -11
- package/src/modules/progress/lib/progressService.ts +0 -1
- package/src/modules/progress/lib/progressServiceImpl.ts +117 -385
- package/src/modules/query_index/api/openapi.ts +0 -12
- package/src/modules/query_index/api/reindex.ts +0 -15
- package/src/modules/query_index/api/status.ts +136 -238
- package/src/modules/query_index/cli.ts +1 -180
- package/src/modules/query_index/components/QueryIndexesTable.tsx +47 -194
- package/src/modules/query_index/data/entities.ts +0 -7
- package/src/modules/query_index/di.ts +0 -6
- package/src/modules/query_index/i18n/de.json +3 -5
- package/src/modules/query_index/i18n/en.json +3 -5
- package/src/modules/query_index/i18n/es.json +3 -5
- package/src/modules/query_index/i18n/pl.json +3 -5
- package/src/modules/query_index/lib/batch.ts +4 -11
- package/src/modules/query_index/lib/coverage.ts +14 -47
- package/src/modules/query_index/lib/document.ts +4 -35
- package/src/modules/query_index/lib/engine.ts +59 -136
- package/src/modules/query_index/lib/indexer.ts +21 -130
- package/src/modules/query_index/lib/reindexer.ts +40 -62
- package/src/modules/query_index/lib/search-tokens.ts +16 -48
- package/src/modules/query_index/lib/subscriber-scope.ts +7 -2
- package/src/modules/query_index/migrations/.snapshot-open-mercato.json +0 -12
- package/src/modules/query_index/subscribers/coverage_refresh.ts +0 -4
- package/src/modules/query_index/subscribers/delete_one.ts +1 -65
- package/src/modules/query_index/subscribers/upsert_one.ts +1 -68
- package/src/modules/resources/api/resources.ts +0 -2
- package/src/modules/resources/backend/resources/resource-types/page.tsx +1 -2
- package/src/modules/resources/backend/resources/resources/[id]/page.tsx +3 -9
- package/src/modules/resources/backend/resources/resources/page.tsx +1 -2
- package/src/modules/resources/commands/resources.ts +0 -10
- package/src/modules/resources/components/detail/dictionaries.ts +3 -3
- package/src/modules/resources/data/entities.ts +0 -3
- package/src/modules/resources/data/validators.ts +0 -5
- package/src/modules/resources/lib/seeds.ts +9 -16
- package/src/modules/resources/migrations/.snapshot-open-mercato.json +1 -17
- package/src/modules/sales/analytics.ts +0 -4
- package/src/modules/sales/api/document-history/route.ts +0 -1
- package/src/modules/sales/api/documents/factory.ts +3 -28
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +3 -11
- package/src/modules/sales/backend/sales/documents/create/page.tsx +4 -2
- package/src/modules/sales/commands/documents.ts +31 -298
- package/src/modules/sales/components/documents/ItemsSection.tsx +11 -21
- package/src/modules/sales/components/documents/LineItemDialog.tsx +5 -13
- package/src/modules/sales/components/documents/SalesDocumentForm.tsx +6 -48
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +1 -6
- package/src/modules/sales/components/useSalesChannelsEnabled.ts +48 -2
- package/src/modules/sales/data/validators.ts +6 -59
- package/src/modules/sales/di.ts +0 -9
- package/src/modules/sales/events.ts +0 -1
- package/src/modules/sales/i18n/de.json +0 -22
- package/src/modules/sales/i18n/en.json +0 -22
- package/src/modules/sales/i18n/es.json +0 -22
- package/src/modules/sales/i18n/pl.json +0 -22
- package/src/modules/sales/lib/historyHelpers.ts +1 -88
- package/src/modules/sales/widgets/injection/document-history/widget.client.tsx +3 -64
- package/src/modules/sales/workflows.ts +7 -10
- package/src/modules/shipping_carriers/api/webhook/[provider]/route.ts +1 -11
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.tsx +1 -1
- package/src/modules/staff/api/interceptors.ts +4 -6
- package/src/modules/staff/api/leave-requests.ts +47 -54
- package/src/modules/staff/components/detail/dictionaries.ts +3 -3
- package/src/modules/sync_excel/api/upload/route.ts +2 -15
- package/src/modules/wms/components/backend/ReleaseReservationDialog.tsx +1 -1
- package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +4 -5
- package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +3 -4
- package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +2 -3
- package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +2 -3
- package/src/modules/wms/components/backend/WmsLotsListPage.tsx +1 -2
- package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +2 -3
- 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/pl.json +0 -2
- package/src/modules/workflows/backend/definitions/page.tsx +2 -3
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +4 -13
- package/src/modules/workflows/backend/instances/page.tsx +9 -10
- package/src/modules/workflows/backend/tasks/page.tsx +7 -8
- package/src/modules/workflows/components/ActivitiesEditor.tsx +14 -98
- package/src/modules/workflows/components/BusinessRulesSelector.tsx +1 -1
- package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +2 -2
- package/src/modules/workflows/components/EdgeEditDialogCrudForm.tsx +2 -1
- package/src/modules/workflows/components/NodeEditDialogCrudForm.tsx +2 -1
- package/src/modules/workflows/components/StepsEditor.tsx +2 -2
- package/src/modules/workflows/components/TransitionsEditor.tsx +20 -78
- package/src/modules/workflows/components/WorkflowLegend.tsx +1 -1
- package/src/modules/workflows/components/WorkflowSelector.tsx +1 -1
- package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/FormFieldArrayEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/MappingArrayEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/WorkflowSelectorField.tsx +4 -4
- package/src/modules/workflows/data/validators.ts +1 -52
- package/src/modules/workflows/events.ts +0 -1
- package/src/modules/workflows/i18n/de.json +0 -3
- package/src/modules/workflows/i18n/en.json +0 -3
- package/src/modules/workflows/i18n/es.json +0 -3
- package/src/modules/workflows/i18n/pl.json +0 -3
- package/src/modules/workflows/lib/activity-executor.ts +20 -99
- package/src/modules/workflows/lib/format-validation-error.ts +0 -60
- package/src/modules/workflows/widgets/injection/order-approval/widget.client.tsx +11 -27
- package/dist/generated/entities/attachment_quota_reservation/index.js +0 -33
- package/dist/generated/entities/attachment_quota_reservation/index.js.map +0 -7
- package/dist/modules/api_keys/extension-points.js +0 -16
- package/dist/modules/api_keys/extension-points.js.map +0 -7
- package/dist/modules/attachments/lib/quota-recovery-queue.js +0 -9
- package/dist/modules/attachments/lib/quota-recovery-queue.js.map +0 -7
- package/dist/modules/attachments/lib/quota-service.js +0 -224
- package/dist/modules/attachments/lib/quota-service.js.map +0 -7
- package/dist/modules/attachments/migrations/Migration20260709234741_attachments.js +0 -13
- package/dist/modules/attachments/migrations/Migration20260709234741_attachments.js.map +0 -7
- package/dist/modules/attachments/workers/quota-recovery.js +0 -45
- package/dist/modules/attachments/workers/quota-recovery.js.map +0 -7
- package/dist/modules/audit_logs/api/audit-logs/readScope.js +0 -12
- package/dist/modules/audit_logs/api/audit-logs/readScope.js.map +0 -7
- package/dist/modules/audit_logs/extension-points.js +0 -14
- package/dist/modules/audit_logs/extension-points.js.map +0 -7
- package/dist/modules/auth/extension-points.js +0 -21
- package/dist/modules/auth/extension-points.js.map +0 -7
- package/dist/modules/business_rules/api/openmercato-call-options/route.js +0 -85
- package/dist/modules/business_rules/api/openmercato-call-options/route.js.map +0 -7
- package/dist/modules/business_rules/events.js +0 -13
- package/dist/modules/business_rules/events.js.map +0 -7
- package/dist/modules/business_rules/extension-points.js +0 -13
- package/dist/modules/business_rules/extension-points.js.map +0 -7
- package/dist/modules/business_rules/lib/openmercato-call-options-types.js +0 -5
- package/dist/modules/business_rules/lib/openmercato-call-options-types.js.map +0 -7
- package/dist/modules/business_rules/lib/openmercato-call-options.js +0 -231
- package/dist/modules/business_rules/lib/openmercato-call-options.js.map +0 -7
- package/dist/modules/catalog/extension-points.js +0 -27
- package/dist/modules/catalog/extension-points.js.map +0 -7
- package/dist/modules/communication_channels/extension-points.js +0 -20
- package/dist/modules/communication_channels/extension-points.js.map +0 -7
- package/dist/modules/configs/extension-points.js +0 -18
- package/dist/modules/configs/extension-points.js.map +0 -7
- package/dist/modules/currencies/extension-points.js +0 -14
- package/dist/modules/currencies/extension-points.js.map +0 -7
- package/dist/modules/currencies/services/baseCurrencyService.js +0 -42
- package/dist/modules/currencies/services/baseCurrencyService.js.map +0 -7
- package/dist/modules/customer_accounts/emails/CustomerInvitationEmail.js +0 -26
- package/dist/modules/customer_accounts/emails/CustomerInvitationEmail.js.map +0 -7
- package/dist/modules/customer_accounts/extension-points.js +0 -14
- package/dist/modules/customer_accounts/extension-points.js.map +0 -7
- package/dist/modules/customer_accounts/lib/invitationEmail.js +0 -35
- package/dist/modules/customer_accounts/lib/invitationEmail.js.map +0 -7
- package/dist/modules/customer_accounts/migrations/Migration20260723120000_customer_accounts.js +0 -13
- package/dist/modules/customer_accounts/migrations/Migration20260723120000_customer_accounts.js.map +0 -7
- package/dist/modules/customers/extension-points.js +0 -42
- package/dist/modules/customers/extension-points.js.map +0 -7
- package/dist/modules/customers/lib/dealStatus.js +0 -38
- package/dist/modules/customers/lib/dealStatus.js.map +0 -7
- package/dist/modules/customers/lib/dealsSummaryQueries.js +0 -144
- package/dist/modules/customers/lib/dealsSummaryQueries.js.map +0 -7
- package/dist/modules/customers/lib/optionalBaseCurrency.js +0 -19
- package/dist/modules/customers/lib/optionalBaseCurrency.js.map +0 -7
- package/dist/modules/customers/migrations/Migration20260723210000_customers.js +0 -15
- package/dist/modules/customers/migrations/Migration20260723210000_customers.js.map +0 -7
- package/dist/modules/dashboards/components/UnlabelledAmountNotice.js +0 -33
- package/dist/modules/dashboards/components/UnlabelledAmountNotice.js.map +0 -7
- package/dist/modules/dashboards/lib/exactDecimal.js +0 -69
- package/dist/modules/dashboards/lib/exactDecimal.js.map +0 -7
- package/dist/modules/dashboards/lib/optionalBaseCurrency.js +0 -11
- package/dist/modules/dashboards/lib/optionalBaseCurrency.js.map +0 -7
- package/dist/modules/dashboards/subscribers/invalidateWidgetDataCache.js +0 -26
- package/dist/modules/dashboards/subscribers/invalidateWidgetDataCache.js.map +0 -7
- package/dist/modules/data_sync/extension-points.js +0 -13
- package/dist/modules/data_sync/extension-points.js.map +0 -7
- package/dist/modules/data_sync/lib/queue-policy.js +0 -15
- package/dist/modules/data_sync/lib/queue-policy.js.map +0 -7
- package/dist/modules/design_system/acl.js +0 -9
- package/dist/modules/design_system/acl.js.map +0 -7
- package/dist/modules/design_system/backend/design-system/page.js +0 -11
- package/dist/modules/design_system/backend/design-system/page.js.map +0 -7
- package/dist/modules/design_system/backend/design-system/page.meta.js +0 -15
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +0 -7
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +0 -52
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +0 -7
- package/dist/modules/design_system/gallery/components/EntryCard.js +0 -63
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +0 -7
- package/dist/modules/design_system/gallery/components/GalleryShell.js +0 -163
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +0 -7
- package/dist/modules/design_system/gallery/components/VariantPreview.js +0 -9
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/banners.js +0 -186
- package/dist/modules/design_system/gallery/entries/banners.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/buttons.js +0 -361
- package/dist/modules/design_system/gallery/entries/buttons.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/charts.js +0 -457
- package/dist/modules/design_system/gallery/entries/charts.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/dates.js +0 -306
- package/dist/modules/design_system/gallery/entries/dates.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/detail.js +0 -358
- package/dist/modules/design_system/gallery/entries/detail.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/display.js +0 -785
- package/dist/modules/design_system/gallery/entries/display.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/feedback.js +0 -658
- package/dist/modules/design_system/gallery/entries/feedback.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/filters.js +0 -505
- package/dist/modules/design_system/gallery/entries/filters.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/foundations.js +0 -453
- package/dist/modules/design_system/gallery/entries/foundations.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/icons.js +0 -140
- package/dist/modules/design_system/gallery/entries/icons.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/inputs.js +0 -1217
- package/dist/modules/design_system/gallery/entries/inputs.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/messages.js +0 -334
- package/dist/modules/design_system/gallery/entries/messages.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/navigation.js +0 -475
- package/dist/modules/design_system/gallery/entries/navigation.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/notifications.js +0 -257
- package/dist/modules/design_system/gallery/entries/notifications.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/overlays.js +0 -576
- package/dist/modules/design_system/gallery/entries/overlays.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/scaffolding.js +0 -378
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +0 -7
- package/dist/modules/design_system/gallery/entries/schedule.js +0 -297
- package/dist/modules/design_system/gallery/entries/schedule.js.map +0 -7
- package/dist/modules/design_system/gallery/registry.js +0 -139
- package/dist/modules/design_system/gallery/registry.js.map +0 -7
- package/dist/modules/design_system/gallery/types.js +0 -1
- package/dist/modules/design_system/gallery/types.js.map +0 -7
- package/dist/modules/design_system/index.js +0 -9
- package/dist/modules/design_system/index.js.map +0 -7
- package/dist/modules/design_system/setup.js +0 -14
- package/dist/modules/design_system/setup.js.map +0 -7
- package/dist/modules/dictionaries/lib/fetchAllEntries.js +0 -43
- package/dist/modules/dictionaries/lib/fetchAllEntries.js.map +0 -7
- package/dist/modules/directory/extension-points.js +0 -14
- package/dist/modules/directory/extension-points.js.map +0 -7
- package/dist/modules/directory/migrations/Migration20260626145500_directory_logo_preserve_aspect_ratio.js +0 -13
- package/dist/modules/directory/migrations/Migration20260626145500_directory_logo_preserve_aspect_ratio.js.map +0 -7
- package/dist/modules/entities/backend/config/settings/page.js +0 -10
- package/dist/modules/entities/backend/config/settings/page.js.map +0 -7
- package/dist/modules/entities/backend/config/settings/page.meta.js +0 -36
- package/dist/modules/entities/backend/config/settings/page.meta.js.map +0 -7
- package/dist/modules/entities/components/EntitySettingsManager.js +0 -136
- package/dist/modules/entities/components/EntitySettingsManager.js.map +0 -7
- package/dist/modules/entities/components/RecordListRelationCell.js +0 -63
- package/dist/modules/entities/components/RecordListRelationCell.js.map +0 -7
- package/dist/modules/entities/components/recordListRelationDisplays.js +0 -80
- package/dist/modules/entities/components/recordListRelationDisplays.js.map +0 -7
- package/dist/modules/entities/extension-points.js +0 -21
- package/dist/modules/entities/extension-points.js.map +0 -7
- package/dist/modules/feature_toggles/components/hooks/staleTime.js +0 -5
- package/dist/modules/feature_toggles/components/hooks/staleTime.js.map +0 -7
- package/dist/modules/inbox_ops/subscribers/search-reindex-proposal-created.js +0 -32
- package/dist/modules/inbox_ops/subscribers/search-reindex-proposal-created.js.map +0 -7
- package/dist/modules/integrations/extension-points.js +0 -30
- package/dist/modules/integrations/extension-points.js.map +0 -7
- package/dist/modules/integrations/widgets/injection/external-ids/widget.js +0 -14
- package/dist/modules/integrations/widgets/injection/external-ids/widget.js.map +0 -7
- package/dist/modules/messages/extension-points.js +0 -16
- package/dist/modules/messages/extension-points.js.map +0 -7
- package/dist/modules/messages/lib/participantScope.js +0 -15
- package/dist/modules/messages/lib/participantScope.js.map +0 -7
- package/dist/modules/notifications/lib/notificationScope.js +0 -26
- package/dist/modules/notifications/lib/notificationScope.js.map +0 -7
- package/dist/modules/payment_gateways/extension-points.js +0 -19
- package/dist/modules/payment_gateways/extension-points.js.map +0 -7
- package/dist/modules/payment_gateways/lib/capture-ledger.js +0 -183
- package/dist/modules/payment_gateways/lib/capture-ledger.js.map +0 -7
- package/dist/modules/payment_gateways/lib/order-amount-reconciliation.js +0 -58
- package/dist/modules/payment_gateways/lib/order-amount-reconciliation.js.map +0 -7
- package/dist/modules/payment_gateways/migrations/Migration20260725101500_payment_gateways.js +0 -16
- package/dist/modules/payment_gateways/migrations/Migration20260725101500_payment_gateways.js.map +0 -7
- package/dist/modules/payment_gateways/migrations/Migration20260803103035_payment_gateways.js +0 -18
- package/dist/modules/payment_gateways/migrations/Migration20260803103035_payment_gateways.js.map +0 -7
- package/dist/modules/payment_gateways/workers/session-initialization-prune.js +0 -50
- package/dist/modules/payment_gateways/workers/session-initialization-prune.js.map +0 -7
- package/dist/modules/portal/extension-points.js +0 -32
- package/dist/modules/portal/extension-points.js.map +0 -7
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.js +0 -134
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.js.map +0 -7
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.meta.js +0 -11
- package/dist/modules/portal/frontend/[orgSlug]/portal/invite/page.meta.js.map +0 -7
- package/dist/modules/portal/lib/navigation.js +0 -7
- package/dist/modules/portal/lib/navigation.js.map +0 -7
- package/dist/modules/query_index/events.js +0 -20
- package/dist/modules/query_index/events.js.map +0 -7
- package/dist/modules/query_index/extension-points.js +0 -13
- package/dist/modules/query_index/extension-points.js.map +0 -7
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +0 -17
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +0 -7
- package/dist/modules/resources/extension-points.js +0 -14
- package/dist/modules/resources/extension-points.js.map +0 -7
- package/dist/modules/resources/migrations/Migration20260608231000.js +0 -13
- package/dist/modules/resources/migrations/Migration20260608231000.js.map +0 -7
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js +0 -167
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js.map +0 -7
- package/dist/modules/sales/extension-points.js +0 -36
- package/dist/modules/sales/extension-points.js.map +0 -7
- package/dist/modules/sales/services/paymentOrderTotalResolver.js +0 -52
- package/dist/modules/sales/services/paymentOrderTotalResolver.js.map +0 -7
- package/dist/modules/wms/extension-points.js +0 -26
- package/dist/modules/wms/extension-points.js.map +0 -7
- package/dist/modules/workflows/extension-points.js +0 -15
- package/dist/modules/workflows/extension-points.js.map +0 -7
- package/dist/modules/workflows/widgets/injection/order-approval/context-keys.js +0 -10
- package/dist/modules/workflows/widgets/injection/order-approval/context-keys.js.map +0 -7
- package/generated/entities/attachment_quota_reservation/index.ts +0 -15
- package/src/modules/api_keys/extension-points.ts +0 -13
- package/src/modules/api_keys/i18n/ko.json +0 -42
- package/src/modules/attachments/i18n/ko.json +0 -175
- package/src/modules/attachments/lib/quota-recovery-queue.ts +0 -16
- package/src/modules/attachments/lib/quota-service.ts +0 -442
- package/src/modules/attachments/migrations/Migration20260709234741_attachments.ts +0 -12
- package/src/modules/attachments/workers/quota-recovery.ts +0 -68
- package/src/modules/audit_logs/api/audit-logs/readScope.ts +0 -28
- package/src/modules/audit_logs/extension-points.ts +0 -11
- package/src/modules/audit_logs/i18n/ko.json +0 -66
- package/src/modules/auth/extension-points.ts +0 -18
- package/src/modules/auth/i18n/ko.json +0 -255
- package/src/modules/business_rules/api/openmercato-call-options/route.ts +0 -94
- package/src/modules/business_rules/events.ts +0 -10
- package/src/modules/business_rules/extension-points.ts +0 -10
- package/src/modules/business_rules/i18n/ko.json +0 -396
- package/src/modules/business_rules/lib/openmercato-call-options-types.ts +0 -31
- package/src/modules/business_rules/lib/openmercato-call-options.ts +0 -297
- package/src/modules/catalog/extension-points.ts +0 -24
- package/src/modules/catalog/i18n/ko.json +0 -723
- package/src/modules/communication_channels/extension-points.ts +0 -17
- package/src/modules/communication_channels/i18n/ko.json +0 -138
- package/src/modules/configs/extension-points.ts +0 -15
- package/src/modules/configs/i18n/ko.json +0 -197
- package/src/modules/currencies/extension-points.ts +0 -11
- package/src/modules/currencies/i18n/ko.json +0 -160
- package/src/modules/currencies/services/baseCurrencyService.ts +0 -59
- package/src/modules/customer_accounts/emails/CustomerInvitationEmail.tsx +0 -45
- package/src/modules/customer_accounts/extension-points.ts +0 -11
- package/src/modules/customer_accounts/i18n/ko.json +0 -354
- package/src/modules/customer_accounts/lib/invitationEmail.ts +0 -42
- package/src/modules/customer_accounts/migrations/Migration20260723120000_customer_accounts.ts +0 -13
- package/src/modules/customers/extension-points.ts +0 -40
- package/src/modules/customers/i18n/ko.json +0 -2855
- package/src/modules/customers/lib/dealStatus.ts +0 -48
- package/src/modules/customers/lib/dealsSummaryQueries.ts +0 -211
- package/src/modules/customers/lib/optionalBaseCurrency.ts +0 -34
- package/src/modules/customers/migrations/Migration20260723210000_customers.ts +0 -15
- package/src/modules/dashboards/components/UnlabelledAmountNotice.tsx +0 -43
- package/src/modules/dashboards/i18n/ko.json +0 -118
- package/src/modules/dashboards/lib/exactDecimal.ts +0 -96
- package/src/modules/dashboards/lib/optionalBaseCurrency.ts +0 -22
- package/src/modules/dashboards/subscribers/invalidateWidgetDataCache.ts +0 -32
- package/src/modules/data_sync/extension-points.ts +0 -10
- package/src/modules/data_sync/i18n/ko.json +0 -125
- package/src/modules/data_sync/lib/queue-policy.ts +0 -30
- package/src/modules/design_system/AGENTS.md +0 -34
- package/src/modules/design_system/acl.ts +0 -5
- package/src/modules/design_system/backend/design-system/page.meta.ts +0 -11
- package/src/modules/design_system/backend/design-system/page.tsx +0 -14
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +0 -55
- package/src/modules/design_system/gallery/components/EntryCard.tsx +0 -95
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +0 -206
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +0 -15
- package/src/modules/design_system/gallery/entries/banners.tsx +0 -226
- package/src/modules/design_system/gallery/entries/buttons.tsx +0 -422
- package/src/modules/design_system/gallery/entries/charts.tsx +0 -518
- package/src/modules/design_system/gallery/entries/dates.tsx +0 -325
- package/src/modules/design_system/gallery/entries/detail.tsx +0 -403
- package/src/modules/design_system/gallery/entries/display.tsx +0 -893
- package/src/modules/design_system/gallery/entries/feedback.tsx +0 -746
- package/src/modules/design_system/gallery/entries/filters.tsx +0 -570
- package/src/modules/design_system/gallery/entries/foundations.tsx +0 -529
- package/src/modules/design_system/gallery/entries/icons.tsx +0 -168
- package/src/modules/design_system/gallery/entries/inputs.tsx +0 -1516
- package/src/modules/design_system/gallery/entries/messages.tsx +0 -339
- package/src/modules/design_system/gallery/entries/navigation.tsx +0 -573
- package/src/modules/design_system/gallery/entries/notifications.tsx +0 -285
- package/src/modules/design_system/gallery/entries/overlays.tsx +0 -677
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +0 -430
- package/src/modules/design_system/gallery/entries/schedule.tsx +0 -307
- package/src/modules/design_system/gallery/registry.ts +0 -152
- package/src/modules/design_system/gallery/types.ts +0 -32
- package/src/modules/design_system/i18n/.hardcoded-allowlist.json +0 -71
- package/src/modules/design_system/i18n/de.json +0 -58
- package/src/modules/design_system/i18n/en.json +0 -58
- package/src/modules/design_system/i18n/es.json +0 -58
- package/src/modules/design_system/i18n/ko.json +0 -58
- package/src/modules/design_system/i18n/pl.json +0 -58
- package/src/modules/design_system/index.ts +0 -7
- package/src/modules/design_system/setup.ts +0 -12
- package/src/modules/dictionaries/i18n/ko.json +0 -130
- package/src/modules/dictionaries/lib/fetchAllEntries.ts +0 -72
- package/src/modules/directory/extension-points.ts +0 -11
- package/src/modules/directory/i18n/ko.json +0 -105
- package/src/modules/directory/migrations/Migration20260626145500_directory_logo_preserve_aspect_ratio.ts +0 -13
- package/src/modules/entities/backend/config/settings/page.meta.ts +0 -34
- package/src/modules/entities/backend/config/settings/page.tsx +0 -12
- package/src/modules/entities/components/EntitySettingsManager.tsx +0 -160
- package/src/modules/entities/components/RecordListRelationCell.tsx +0 -90
- package/src/modules/entities/components/recordListRelationDisplays.ts +0 -109
- package/src/modules/entities/extension-points.ts +0 -18
- package/src/modules/entities/i18n/ko.json +0 -260
- package/src/modules/feature_toggles/components/hooks/staleTime.ts +0 -5
- package/src/modules/feature_toggles/i18n/ko.json +0 -96
- package/src/modules/inbox_ops/i18n/ko.json +0 -196
- package/src/modules/inbox_ops/subscribers/search-reindex-proposal-created.ts +0 -39
- package/src/modules/integrations/extension-points.ts +0 -27
- package/src/modules/integrations/i18n/ko.json +0 -129
- package/src/modules/integrations/widgets/injection/external-ids/widget.ts +0 -13
- package/src/modules/messages/extension-points.ts +0 -13
- package/src/modules/messages/i18n/ko.json +0 -263
- package/src/modules/messages/lib/participantScope.ts +0 -64
- package/src/modules/notifications/i18n/ko.json +0 -55
- package/src/modules/notifications/lib/notificationScope.ts +0 -40
- package/src/modules/payment_gateways/extension-points.ts +0 -16
- package/src/modules/payment_gateways/i18n/ko.json +0 -87
- package/src/modules/payment_gateways/lib/capture-ledger.ts +0 -260
- package/src/modules/payment_gateways/lib/order-amount-reconciliation.ts +0 -93
- package/src/modules/payment_gateways/migrations/Migration20260725101500_payment_gateways.ts +0 -21
- package/src/modules/payment_gateways/migrations/Migration20260803103035_payment_gateways.ts +0 -17
- package/src/modules/payment_gateways/workers/session-initialization-prune.ts +0 -63
- package/src/modules/planner/i18n/ko.json +0 -565
- package/src/modules/portal/extension-points.ts +0 -30
- package/src/modules/portal/frontend/[orgSlug]/portal/invite/page.meta.ts +0 -9
- package/src/modules/portal/frontend/[orgSlug]/portal/invite/page.tsx +0 -164
- package/src/modules/portal/i18n/ko.json +0 -143
- package/src/modules/portal/lib/navigation.ts +0 -3
- package/src/modules/progress/i18n/ko.json +0 -20
- package/src/modules/query_index/events.ts +0 -17
- package/src/modules/query_index/extension-points.ts +0 -10
- package/src/modules/query_index/i18n/ko.json +0 -69
- package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +0 -35
- package/src/modules/resources/extension-points.ts +0 -11
- package/src/modules/resources/i18n/ko.json +0 -770
- package/src/modules/resources/migrations/Migration20260608231000.ts +0 -13
- package/src/modules/sales/components/documents/SalesOrderDraftLines.tsx +0 -198
- package/src/modules/sales/extension-points.ts +0 -33
- package/src/modules/sales/i18n/ko.json +0 -1442
- package/src/modules/sales/services/paymentOrderTotalResolver.ts +0 -67
- package/src/modules/shipping_carriers/i18n/ko.json +0 -85
- package/src/modules/staff/i18n/ko.json +0 -1162
- package/src/modules/sync_excel/i18n/ko.json +0 -107
- package/src/modules/translations/i18n/ko.json +0 -45
- package/src/modules/wms/extension-points.ts +0 -23
- package/src/modules/wms/i18n/ko.json +0 -1053
- package/src/modules/workflows/extension-points.ts +0 -12
- package/src/modules/workflows/i18n/ko.json +0 -1204
- package/src/modules/workflows/widgets/injection/order-approval/context-keys.ts +0 -18
|
@@ -18,7 +18,6 @@ const MANAGE_FEATURE = "staff.leave_requests.manage";
|
|
|
18
18
|
const SEND_FEATURE = "staff.leave_requests.send";
|
|
19
19
|
const MY_VIEW_FEATURE = "staff.my_leave_requests.view";
|
|
20
20
|
const MY_SEND_FEATURE = "staff.my_leave_requests.send";
|
|
21
|
-
const NIL_UUID = "00000000-0000-0000-0000-000000000000";
|
|
22
21
|
const routeMetadata = {
|
|
23
22
|
GET: { requireAuth: true },
|
|
24
23
|
POST: { requireAuth: true },
|
|
@@ -92,48 +91,6 @@ async function resolveLeaveRequestAccess(ctx) {
|
|
|
92
91
|
);
|
|
93
92
|
return { canManage, canSend, canView, memberId: member?.id ?? null };
|
|
94
93
|
}
|
|
95
|
-
async function buildLeaveRequestFilters(query, ctx) {
|
|
96
|
-
const filters = {};
|
|
97
|
-
if (typeof query.ids === "string" && query.ids.trim().length > 0) {
|
|
98
|
-
const ids = query.ids.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
|
|
99
|
-
if (ids.length > 0) {
|
|
100
|
-
filters[F.id] = { $in: ids };
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (query.status) {
|
|
104
|
-
filters[F.status] = query.status;
|
|
105
|
-
}
|
|
106
|
-
if (query.memberId) {
|
|
107
|
-
filters[F.member_id] = query.memberId;
|
|
108
|
-
}
|
|
109
|
-
const term = sanitizeSearchTerm(query.search);
|
|
110
|
-
if (term) {
|
|
111
|
-
const like = `%${escapeLikePattern(term)}%`;
|
|
112
|
-
const em = ctx.container.resolve("em").fork();
|
|
113
|
-
const members = await findWithDecryption(
|
|
114
|
-
em,
|
|
115
|
-
StaffTeamMember,
|
|
116
|
-
{ displayName: { $ilike: like }, deletedAt: null },
|
|
117
|
-
{ fields: ["id"] },
|
|
118
|
-
{ tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null }
|
|
119
|
-
);
|
|
120
|
-
const memberIds = members.map((member) => member.id);
|
|
121
|
-
if (!memberIds.length) {
|
|
122
|
-
filters[F.id] = NIL_UUID;
|
|
123
|
-
} else {
|
|
124
|
-
filters[F.member_id] = { $in: memberIds };
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const access = await resolveLeaveRequestAccess(ctx);
|
|
128
|
-
if (!access.canManage) {
|
|
129
|
-
if (!access.canView || !access.memberId) {
|
|
130
|
-
filters[F.id] = NIL_UUID;
|
|
131
|
-
} else {
|
|
132
|
-
filters[F.member_id] = access.memberId;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return filters;
|
|
136
|
-
}
|
|
137
94
|
const crud = makeCrudRoute({
|
|
138
95
|
metadata: routeMetadata,
|
|
139
96
|
orm: {
|
|
@@ -172,7 +129,48 @@ const crud = makeCrudRoute({
|
|
|
172
129
|
createdAt: F.created_at,
|
|
173
130
|
updatedAt: F.updated_at
|
|
174
131
|
},
|
|
175
|
-
buildFilters:
|
|
132
|
+
buildFilters: async (query, ctx) => {
|
|
133
|
+
const filters = {};
|
|
134
|
+
if (typeof query.ids === "string" && query.ids.trim().length > 0) {
|
|
135
|
+
const ids = query.ids.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
|
|
136
|
+
if (ids.length > 0) {
|
|
137
|
+
filters[F.id] = { $in: ids };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (query.status) {
|
|
141
|
+
filters[F.status] = query.status;
|
|
142
|
+
}
|
|
143
|
+
if (query.memberId) {
|
|
144
|
+
filters[F.member_id] = query.memberId;
|
|
145
|
+
}
|
|
146
|
+
const term = sanitizeSearchTerm(query.search);
|
|
147
|
+
if (term) {
|
|
148
|
+
const like = `%${escapeLikePattern(term)}%`;
|
|
149
|
+
const em = ctx.container.resolve("em").fork();
|
|
150
|
+
const members = await findWithDecryption(
|
|
151
|
+
em,
|
|
152
|
+
StaffTeamMember,
|
|
153
|
+
{ displayName: { $ilike: like }, deletedAt: null },
|
|
154
|
+
{ fields: ["id"] },
|
|
155
|
+
{ tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null }
|
|
156
|
+
);
|
|
157
|
+
const memberIds = members.map((member) => member.id);
|
|
158
|
+
if (!memberIds.length) {
|
|
159
|
+
filters[F.id] = "__no_match__";
|
|
160
|
+
} else {
|
|
161
|
+
filters[F.member_id] = { $in: memberIds };
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const access = await resolveLeaveRequestAccess(ctx);
|
|
165
|
+
if (!access.canManage) {
|
|
166
|
+
if (!access.canView || !access.memberId) {
|
|
167
|
+
filters[F.id] = "__no_access__";
|
|
168
|
+
} else {
|
|
169
|
+
filters[F.member_id] = access.memberId;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return filters;
|
|
173
|
+
}
|
|
176
174
|
},
|
|
177
175
|
hooks: {
|
|
178
176
|
afterList: async (payload, ctx) => {
|
|
@@ -361,7 +359,6 @@ export {
|
|
|
361
359
|
GET,
|
|
362
360
|
POST,
|
|
363
361
|
PUT,
|
|
364
|
-
buildLeaveRequestFilters,
|
|
365
362
|
metadata,
|
|
366
363
|
openApi
|
|
367
364
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/staff/api/leave-requests.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'\nimport { makeCrudRoute, type CrudCtx } from '@open-mercato/shared/lib/crud/factory'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { resolveCrudRecordId, parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'\nimport { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'\nimport { findWithDecryption, findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { StaffLeaveRequest, StaffTeamMember } from '../data/entities'\nimport {\n staffLeaveRequestCreateSchema,\n staffLeaveRequestUpdateSchema,\n staffLeaveRequestDecisionSchema,\n} from '../data/validators'\nimport { sanitizeSearchTerm } from './helpers'\nimport { E } from '#generated/entities.ids.generated'\nimport { createStaffCrudOpenApi, createPagedListResponseSchema, defaultOkResponseSchema } from './openapi'\n\nconst MANAGE_FEATURE = 'staff.leave_requests.manage'\nconst SEND_FEATURE = 'staff.leave_requests.send'\nconst MY_VIEW_FEATURE = 'staff.my_leave_requests.view'\nconst MY_SEND_FEATURE = 'staff.my_leave_requests.send'\n\nconst NIL_UUID = '00000000-0000-0000-0000-000000000000'\n\nconst routeMetadata = {\n GET: { requireAuth: true },\n POST: { requireAuth: true },\n PUT: { requireAuth: true },\n DELETE: { requireAuth: true },\n}\n\nexport const metadata = routeMetadata\n\n// Field constants for StaffLeaveRequest entity\nconst F = {\n id: 'id',\n tenant_id: 'tenant_id',\n organization_id: 'organization_id',\n member_id: 'member_id',\n start_date: 'start_date',\n end_date: 'end_date',\n timezone: 'timezone',\n status: 'status',\n unavailability_reason_entry_id: 'unavailability_reason_entry_id',\n unavailability_reason_value: 'unavailability_reason_value',\n note: 'note',\n decision_comment: 'decision_comment',\n submitted_by_user_id: 'submitted_by_user_id',\n decided_by_user_id: 'decided_by_user_id',\n decided_at: 'decided_at',\n created_at: 'created_at',\n updated_at: 'updated_at',\n deleted_at: 'deleted_at',\n} as const\n\nconst rawBodySchema = z.object({}).passthrough()\n\nconst listSchema = z\n .object({\n page: z.coerce.number().min(1).default(1),\n pageSize: z.coerce.number().min(1).max(100).default(50),\n search: z.string().optional(),\n status: z.enum(['pending', 'approved', 'rejected']).optional(),\n memberId: z.string().uuid().optional(),\n ids: z.string().optional(),\n sortField: z.string().optional(),\n sortDir: z.enum(['asc', 'desc']).optional(),\n })\n .passthrough()\n\ntype LeaveRequestAccess = {\n canManage: boolean\n canSend: boolean\n canView: boolean\n memberId: string | null\n}\n\nconst uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/\n\nfunction resolveActorUserId(ctx: { auth?: { sub?: string | null; isApiKey?: boolean } | null }): string | null {\n if (!ctx.auth || ctx.auth.isApiKey) return null\n const sub = ctx.auth.sub ?? null\n if (!sub || !uuidRegex.test(sub)) return null\n return sub\n}\n\nasync function resolveLeaveRequestAccess(ctx: any): Promise<LeaveRequestAccess> {\n const auth = ctx.auth\n if (!auth || !auth.sub || auth.isApiKey) {\n return { canManage: false, canSend: false, canView: false, memberId: null }\n }\n const tenantId = ctx.organizationScope?.tenantId ?? auth.tenantId ?? null\n const organizationId = ctx.selectedOrganizationId ?? ctx.organizationScope?.selectedId ?? auth.orgId ?? null\n const rbac = (ctx.container.resolve('rbacService') as RbacService)\n const [canManage, canSendLegacy, canSendSelf, canViewSelf] = await Promise.all([\n rbac.userHasAllFeatures(auth.sub, [MANAGE_FEATURE], { tenantId, organizationId }),\n rbac.userHasAllFeatures(auth.sub, [SEND_FEATURE], { tenantId, organizationId }),\n rbac.userHasAllFeatures(auth.sub, [MY_SEND_FEATURE], { tenantId, organizationId }),\n rbac.userHasAllFeatures(auth.sub, [MY_VIEW_FEATURE], { tenantId, organizationId }),\n ])\n const canSend = canSendLegacy || canSendSelf\n const canView = canManage || canSend || canViewSelf\n if (!canManage && !canView) {\n return { canManage, canSend, canView, memberId: null }\n }\n const member = await findOneWithDecryption(\n ctx.container.resolve('em') as EntityManager,\n StaffTeamMember,\n { userId: auth.sub, deletedAt: null },\n undefined,\n { tenantId, organizationId },\n )\n return { canManage, canSend, canView, memberId: member?.id ?? null }\n}\n\nexport async function buildLeaveRequestFilters(\n query: z.infer<typeof listSchema>,\n ctx: CrudCtx,\n) {\n const filters: Record<string, unknown> = {}\n if (typeof query.ids === 'string' && query.ids.trim().length > 0) {\n const ids = query.ids\n .split(',')\n .map((value) => value.trim())\n .filter((value) => value.length > 0)\n if (ids.length > 0) {\n filters[F.id] = { $in: ids }\n }\n }\n if (query.status) {\n filters[F.status] = query.status\n }\n if (query.memberId) {\n filters[F.member_id] = query.memberId\n }\n const term = sanitizeSearchTerm(query.search)\n if (term) {\n const like = `%${escapeLikePattern(term)}%`\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const members = await findWithDecryption(\n em,\n StaffTeamMember,\n { displayName: { $ilike: like }, deletedAt: null },\n { fields: ['id'] },\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n const memberIds = members.map((member) => member.id)\n if (!memberIds.length) {\n filters[F.id] = NIL_UUID\n } else {\n filters[F.member_id] = { $in: memberIds }\n }\n }\n\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage) {\n if (!access.canView || !access.memberId) {\n filters[F.id] = NIL_UUID\n } else {\n filters[F.member_id] = access.memberId\n }\n }\n return filters\n}\n\nconst crud = makeCrudRoute({\n metadata: routeMetadata,\n orm: {\n entity: StaffLeaveRequest,\n idField: 'id',\n orgField: 'organizationId',\n tenantField: 'tenantId',\n softDeleteField: 'deletedAt',\n },\n indexer: { entityType: E.staff.staff_leave_request },\n list: {\n schema: listSchema,\n entityId: E.staff.staff_leave_request,\n fields: [\n F.id,\n F.organization_id,\n F.tenant_id,\n F.member_id,\n F.start_date,\n F.end_date,\n F.timezone,\n F.status,\n F.unavailability_reason_entry_id,\n F.unavailability_reason_value,\n F.note,\n F.decision_comment,\n F.submitted_by_user_id,\n F.decided_by_user_id,\n F.decided_at,\n F.created_at,\n F.updated_at,\n ],\n sortFieldMap: {\n startDate: F.start_date,\n endDate: F.end_date,\n createdAt: F.created_at,\n updatedAt: F.updated_at,\n },\n buildFilters: buildLeaveRequestFilters,\n },\n hooks: {\n afterList: async (payload, ctx) => {\n const items: Array<Record<string, unknown>> = Array.isArray(payload?.items)\n ? (payload.items as Array<Record<string, unknown>>)\n : []\n if (!items.length) {\n payload.viewer = await resolveLeaveRequestAccess(ctx)\n return\n }\n const memberIds = new Set<string>()\n items.forEach((item) => {\n const memberId = typeof item.memberId === 'string'\n ? item.memberId\n : typeof item.member_id === 'string'\n ? item.member_id\n : null\n if (memberId) memberIds.add(memberId)\n })\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const members = memberIds.size\n ? await findWithDecryption(\n em,\n StaffTeamMember,\n { id: { $in: Array.from(memberIds) } },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n : []\n const memberById = new Map(members.map((member) => [member.id, member]))\n items.forEach((item) => {\n const memberId = typeof item.memberId === 'string'\n ? item.memberId\n : typeof item.member_id === 'string'\n ? item.member_id\n : null\n if (!memberId) return\n const member = memberById.get(memberId)\n if (!member) return\n item.member = {\n id: member.id,\n displayName: member.displayName,\n userId: member.userId ?? null,\n }\n })\n payload.viewer = await resolveLeaveRequestAccess(ctx)\n },\n },\n actions: {\n create: {\n commandId: 'staff.leave-requests.create',\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations()\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage && !access.canSend) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n const payload = raw && typeof raw === 'object' ? { ...(raw as Record<string, unknown>) } : {}\n const actorUserId = resolveActorUserId(ctx)\n if (actorUserId) payload.submittedByUserId = actorUserId\n if (!access.canManage) {\n if (!access.memberId) {\n throw new CrudHttpError(400, { error: translate('staff.leaveRequests.errors.profileRequired', 'Create your profile first.') })\n }\n payload.memberId = access.memberId\n }\n return parseScopedCommandInput(staffLeaveRequestCreateSchema, payload, ctx, translate)\n },\n response: ({ result }) => ({ id: result?.requestId ?? null }),\n status: 201,\n },\n update: {\n commandId: 'staff.leave-requests.update',\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations()\n const parsed = parseScopedCommandInput(staffLeaveRequestUpdateSchema, raw ?? {}, ctx, translate)\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage && !access.canSend) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n if (!access.canManage) {\n if (!access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n const em = (ctx.container.resolve('em') as EntityManager)\n const request = await findOneWithDecryption(\n em,\n StaffLeaveRequest,\n { id: parsed.id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n const memberId = request ? (typeof request.member === 'string' ? request.member : request.member.id) : null\n if (!request || memberId !== access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n if (parsed.memberId && parsed.memberId !== memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n }\n return parsed\n },\n response: () => ({ ok: true }),\n },\n delete: {\n commandId: 'staff.leave-requests.delete',\n schema: rawBodySchema,\n mapInput: async ({ parsed, ctx }) => {\n const { translate } = await resolveTranslations()\n const id = resolveCrudRecordId(parsed, ctx, translate)\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage && !access.canSend) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n if (!access.canManage) {\n if (!access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n const em = (ctx.container.resolve('em') as EntityManager)\n const request = await findOneWithDecryption(\n em,\n StaffLeaveRequest,\n { id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n const memberId = request ? (typeof request.member === 'string' ? request.member : request.member.id) : null\n if (!request || memberId !== access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n }\n return { id }\n },\n response: () => ({ ok: true }),\n },\n },\n})\n\nexport const GET = crud.GET\nexport const POST = crud.POST\nexport const PUT = crud.PUT\nexport const DELETE = crud.DELETE\n\nconst leaveRequestListItemSchema = z.object({\n id: z.string().uuid().nullable().optional(),\n organization_id: z.string().uuid().nullable().optional(),\n tenant_id: z.string().uuid().nullable().optional(),\n member_id: z.string().uuid().nullable().optional(),\n start_date: z.string().nullable().optional(),\n end_date: z.string().nullable().optional(),\n timezone: z.string().nullable().optional(),\n status: z.enum(['pending', 'approved', 'rejected']).nullable().optional(),\n unavailability_reason_entry_id: z.string().uuid().nullable().optional(),\n unavailability_reason_value: z.string().nullable().optional(),\n note: z.string().nullable().optional(),\n decision_comment: z.string().nullable().optional(),\n submitted_by_user_id: z.string().uuid().nullable().optional(),\n decided_by_user_id: z.string().uuid().nullable().optional(),\n decided_at: z.string().nullable().optional(),\n created_at: z.string().nullable().optional(),\n updated_at: z.string().nullable().optional(),\n member: z\n .object({\n id: z.string().uuid().nullable().optional(),\n displayName: z.string().nullable().optional(),\n userId: z.string().uuid().nullable().optional(),\n })\n .nullable()\n .optional(),\n})\n\nconst leaveRequestListResponseSchema = createPagedListResponseSchema(leaveRequestListItemSchema).extend({\n viewer: z\n .object({\n canManage: z.boolean(),\n canSend: z.boolean(),\n canView: z.boolean(),\n memberId: z.string().uuid().nullable(),\n })\n .optional(),\n})\n\nexport const openApi = createStaffCrudOpenApi({\n resourceName: 'Leave request',\n pluralName: 'Leave requests',\n querySchema: listSchema,\n listResponseSchema: leaveRequestListResponseSchema,\n create: {\n schema: staffLeaveRequestCreateSchema,\n description: 'Creates a leave request for a staff member.',\n },\n update: {\n schema: staffLeaveRequestUpdateSchema,\n responseSchema: defaultOkResponseSchema,\n description: 'Updates a leave request by id.',\n },\n del: {\n schema: staffLeaveRequestDecisionSchema.pick({ id: true }),\n responseSchema: defaultOkResponseSchema,\n description: 'Deletes a leave request by id.',\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAGlB,SAAS,
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'\nimport { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { resolveCrudRecordId, parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'\nimport { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'\nimport { findWithDecryption, findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { StaffLeaveRequest, StaffTeamMember } from '../data/entities'\nimport {\n staffLeaveRequestCreateSchema,\n staffLeaveRequestUpdateSchema,\n staffLeaveRequestDecisionSchema,\n} from '../data/validators'\nimport { sanitizeSearchTerm } from './helpers'\nimport { E } from '#generated/entities.ids.generated'\nimport { createStaffCrudOpenApi, createPagedListResponseSchema, defaultOkResponseSchema } from './openapi'\n\nconst MANAGE_FEATURE = 'staff.leave_requests.manage'\nconst SEND_FEATURE = 'staff.leave_requests.send'\nconst MY_VIEW_FEATURE = 'staff.my_leave_requests.view'\nconst MY_SEND_FEATURE = 'staff.my_leave_requests.send'\n\nconst routeMetadata = {\n GET: { requireAuth: true },\n POST: { requireAuth: true },\n PUT: { requireAuth: true },\n DELETE: { requireAuth: true },\n}\n\nexport const metadata = routeMetadata\n\n// Field constants for StaffLeaveRequest entity\nconst F = {\n id: 'id',\n tenant_id: 'tenant_id',\n organization_id: 'organization_id',\n member_id: 'member_id',\n start_date: 'start_date',\n end_date: 'end_date',\n timezone: 'timezone',\n status: 'status',\n unavailability_reason_entry_id: 'unavailability_reason_entry_id',\n unavailability_reason_value: 'unavailability_reason_value',\n note: 'note',\n decision_comment: 'decision_comment',\n submitted_by_user_id: 'submitted_by_user_id',\n decided_by_user_id: 'decided_by_user_id',\n decided_at: 'decided_at',\n created_at: 'created_at',\n updated_at: 'updated_at',\n deleted_at: 'deleted_at',\n} as const\n\nconst rawBodySchema = z.object({}).passthrough()\n\nconst listSchema = z\n .object({\n page: z.coerce.number().min(1).default(1),\n pageSize: z.coerce.number().min(1).max(100).default(50),\n search: z.string().optional(),\n status: z.enum(['pending', 'approved', 'rejected']).optional(),\n memberId: z.string().uuid().optional(),\n ids: z.string().optional(),\n sortField: z.string().optional(),\n sortDir: z.enum(['asc', 'desc']).optional(),\n })\n .passthrough()\n\ntype LeaveRequestAccess = {\n canManage: boolean\n canSend: boolean\n canView: boolean\n memberId: string | null\n}\n\nconst uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/\n\nfunction resolveActorUserId(ctx: { auth?: { sub?: string | null; isApiKey?: boolean } | null }): string | null {\n if (!ctx.auth || ctx.auth.isApiKey) return null\n const sub = ctx.auth.sub ?? null\n if (!sub || !uuidRegex.test(sub)) return null\n return sub\n}\n\nasync function resolveLeaveRequestAccess(ctx: any): Promise<LeaveRequestAccess> {\n const auth = ctx.auth\n if (!auth || !auth.sub || auth.isApiKey) {\n return { canManage: false, canSend: false, canView: false, memberId: null }\n }\n const tenantId = ctx.organizationScope?.tenantId ?? auth.tenantId ?? null\n const organizationId = ctx.selectedOrganizationId ?? ctx.organizationScope?.selectedId ?? auth.orgId ?? null\n const rbac = (ctx.container.resolve('rbacService') as RbacService)\n const [canManage, canSendLegacy, canSendSelf, canViewSelf] = await Promise.all([\n rbac.userHasAllFeatures(auth.sub, [MANAGE_FEATURE], { tenantId, organizationId }),\n rbac.userHasAllFeatures(auth.sub, [SEND_FEATURE], { tenantId, organizationId }),\n rbac.userHasAllFeatures(auth.sub, [MY_SEND_FEATURE], { tenantId, organizationId }),\n rbac.userHasAllFeatures(auth.sub, [MY_VIEW_FEATURE], { tenantId, organizationId }),\n ])\n const canSend = canSendLegacy || canSendSelf\n const canView = canManage || canSend || canViewSelf\n if (!canManage && !canView) {\n return { canManage, canSend, canView, memberId: null }\n }\n const member = await findOneWithDecryption(\n ctx.container.resolve('em') as EntityManager,\n StaffTeamMember,\n { userId: auth.sub, deletedAt: null },\n undefined,\n { tenantId, organizationId },\n )\n return { canManage, canSend, canView, memberId: member?.id ?? null }\n}\n\nconst crud = makeCrudRoute({\n metadata: routeMetadata,\n orm: {\n entity: StaffLeaveRequest,\n idField: 'id',\n orgField: 'organizationId',\n tenantField: 'tenantId',\n softDeleteField: 'deletedAt',\n },\n indexer: { entityType: E.staff.staff_leave_request },\n list: {\n schema: listSchema,\n entityId: E.staff.staff_leave_request,\n fields: [\n F.id,\n F.organization_id,\n F.tenant_id,\n F.member_id,\n F.start_date,\n F.end_date,\n F.timezone,\n F.status,\n F.unavailability_reason_entry_id,\n F.unavailability_reason_value,\n F.note,\n F.decision_comment,\n F.submitted_by_user_id,\n F.decided_by_user_id,\n F.decided_at,\n F.created_at,\n F.updated_at,\n ],\n sortFieldMap: {\n startDate: F.start_date,\n endDate: F.end_date,\n createdAt: F.created_at,\n updatedAt: F.updated_at,\n },\n buildFilters: async (query, ctx) => {\n const filters: Record<string, unknown> = {}\n if (typeof query.ids === 'string' && query.ids.trim().length > 0) {\n const ids = query.ids\n .split(',')\n .map((value) => value.trim())\n .filter((value) => value.length > 0)\n if (ids.length > 0) {\n filters[F.id] = { $in: ids }\n }\n }\n if (query.status) {\n filters[F.status] = query.status\n }\n if (query.memberId) {\n filters[F.member_id] = query.memberId\n }\n const term = sanitizeSearchTerm(query.search)\n if (term) {\n const like = `%${escapeLikePattern(term)}%`\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const members = await findWithDecryption(\n em,\n StaffTeamMember,\n { displayName: { $ilike: like }, deletedAt: null },\n { fields: ['id'] },\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n const memberIds = members.map((member) => member.id)\n if (!memberIds.length) {\n filters[F.id] = '__no_match__'\n } else {\n filters[F.member_id] = { $in: memberIds }\n }\n }\n\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage) {\n if (!access.canView || !access.memberId) {\n filters[F.id] = '__no_access__'\n } else {\n filters[F.member_id] = access.memberId\n }\n }\n return filters\n },\n },\n hooks: {\n afterList: async (payload, ctx) => {\n const items: Array<Record<string, unknown>> = Array.isArray(payload?.items)\n ? (payload.items as Array<Record<string, unknown>>)\n : []\n if (!items.length) {\n payload.viewer = await resolveLeaveRequestAccess(ctx)\n return\n }\n const memberIds = new Set<string>()\n items.forEach((item) => {\n const memberId = typeof item.memberId === 'string'\n ? item.memberId\n : typeof item.member_id === 'string'\n ? item.member_id\n : null\n if (memberId) memberIds.add(memberId)\n })\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const members = memberIds.size\n ? await findWithDecryption(\n em,\n StaffTeamMember,\n { id: { $in: Array.from(memberIds) } },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n : []\n const memberById = new Map(members.map((member) => [member.id, member]))\n items.forEach((item) => {\n const memberId = typeof item.memberId === 'string'\n ? item.memberId\n : typeof item.member_id === 'string'\n ? item.member_id\n : null\n if (!memberId) return\n const member = memberById.get(memberId)\n if (!member) return\n item.member = {\n id: member.id,\n displayName: member.displayName,\n userId: member.userId ?? null,\n }\n })\n payload.viewer = await resolveLeaveRequestAccess(ctx)\n },\n },\n actions: {\n create: {\n commandId: 'staff.leave-requests.create',\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations()\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage && !access.canSend) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n const payload = raw && typeof raw === 'object' ? { ...(raw as Record<string, unknown>) } : {}\n const actorUserId = resolveActorUserId(ctx)\n if (actorUserId) payload.submittedByUserId = actorUserId\n if (!access.canManage) {\n if (!access.memberId) {\n throw new CrudHttpError(400, { error: translate('staff.leaveRequests.errors.profileRequired', 'Create your profile first.') })\n }\n payload.memberId = access.memberId\n }\n return parseScopedCommandInput(staffLeaveRequestCreateSchema, payload, ctx, translate)\n },\n response: ({ result }) => ({ id: result?.requestId ?? null }),\n status: 201,\n },\n update: {\n commandId: 'staff.leave-requests.update',\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations()\n const parsed = parseScopedCommandInput(staffLeaveRequestUpdateSchema, raw ?? {}, ctx, translate)\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage && !access.canSend) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n if (!access.canManage) {\n if (!access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n const em = (ctx.container.resolve('em') as EntityManager)\n const request = await findOneWithDecryption(\n em,\n StaffLeaveRequest,\n { id: parsed.id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n const memberId = request ? (typeof request.member === 'string' ? request.member : request.member.id) : null\n if (!request || memberId !== access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n if (parsed.memberId && parsed.memberId !== memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n }\n return parsed\n },\n response: () => ({ ok: true }),\n },\n delete: {\n commandId: 'staff.leave-requests.delete',\n schema: rawBodySchema,\n mapInput: async ({ parsed, ctx }) => {\n const { translate } = await resolveTranslations()\n const id = resolveCrudRecordId(parsed, ctx, translate)\n const access = await resolveLeaveRequestAccess(ctx)\n if (!access.canManage && !access.canSend) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n if (!access.canManage) {\n if (!access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n const em = (ctx.container.resolve('em') as EntityManager)\n const request = await findOneWithDecryption(\n em,\n StaffLeaveRequest,\n { id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.selectedOrganizationId ?? null },\n )\n const memberId = request ? (typeof request.member === 'string' ? request.member : request.member.id) : null\n if (!request || memberId !== access.memberId) {\n throw new CrudHttpError(403, { error: translate('staff.leaveRequests.errors.forbidden', 'Forbidden') })\n }\n }\n return { id }\n },\n response: () => ({ ok: true }),\n },\n },\n})\n\nexport const GET = crud.GET\nexport const POST = crud.POST\nexport const PUT = crud.PUT\nexport const DELETE = crud.DELETE\n\nconst leaveRequestListItemSchema = z.object({\n id: z.string().uuid().nullable().optional(),\n organization_id: z.string().uuid().nullable().optional(),\n tenant_id: z.string().uuid().nullable().optional(),\n member_id: z.string().uuid().nullable().optional(),\n start_date: z.string().nullable().optional(),\n end_date: z.string().nullable().optional(),\n timezone: z.string().nullable().optional(),\n status: z.enum(['pending', 'approved', 'rejected']).nullable().optional(),\n unavailability_reason_entry_id: z.string().uuid().nullable().optional(),\n unavailability_reason_value: z.string().nullable().optional(),\n note: z.string().nullable().optional(),\n decision_comment: z.string().nullable().optional(),\n submitted_by_user_id: z.string().uuid().nullable().optional(),\n decided_by_user_id: z.string().uuid().nullable().optional(),\n decided_at: z.string().nullable().optional(),\n created_at: z.string().nullable().optional(),\n updated_at: z.string().nullable().optional(),\n member: z\n .object({\n id: z.string().uuid().nullable().optional(),\n displayName: z.string().nullable().optional(),\n userId: z.string().uuid().nullable().optional(),\n })\n .nullable()\n .optional(),\n})\n\nconst leaveRequestListResponseSchema = createPagedListResponseSchema(leaveRequestListItemSchema).extend({\n viewer: z\n .object({\n canManage: z.boolean(),\n canSend: z.boolean(),\n canView: z.boolean(),\n memberId: z.string().uuid().nullable(),\n })\n .optional(),\n})\n\nexport const openApi = createStaffCrudOpenApi({\n resourceName: 'Leave request',\n pluralName: 'Leave requests',\n querySchema: listSchema,\n listResponseSchema: leaveRequestListResponseSchema,\n create: {\n schema: staffLeaveRequestCreateSchema,\n description: 'Creates a leave request for a staff member.',\n },\n update: {\n schema: staffLeaveRequestUpdateSchema,\n responseSchema: defaultOkResponseSchema,\n description: 'Updates a leave request by id.',\n },\n del: {\n schema: staffLeaveRequestDecisionSchema.pick({ id: true }),\n responseSchema: defaultOkResponseSchema,\n description: 'Deletes a leave request by id.',\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAGlB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,qBAAqB,+BAA+B;AAC7D,SAAS,yBAAyB;AAClC,SAAS,oBAAoB,6BAA6B;AAC1D,SAAS,mBAAmB,uBAAuB;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,SAAS;AAClB,SAAS,wBAAwB,+BAA+B,+BAA+B;AAE/F,MAAM,iBAAiB;AACvB,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;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client";
|
|
2
2
|
import { apiCall, apiCallOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
|
|
3
|
-
import { fetchAllDictionaryEntries } from "@open-mercato/core/modules/dictionaries/lib/fetchAllEntries";
|
|
4
3
|
const STAFF_DICTIONARY_KEYS = {
|
|
5
4
|
activityTypes: "staff-activity-types",
|
|
6
5
|
addressTypes: "staff-address-types"
|
|
@@ -32,9 +31,10 @@ async function loadStaffDictionary(kind) {
|
|
|
32
31
|
const name = kind === "activityTypes" ? "Staff activity types" : "Staff address types";
|
|
33
32
|
const dictionary = await ensureDictionary(key, name);
|
|
34
33
|
if (!dictionary) return { dictionary: null, entries: [] };
|
|
35
|
-
const entriesCall = await
|
|
34
|
+
const entriesCall = await apiCall(`/api/dictionaries/${dictionary.id}/entries`);
|
|
36
35
|
if (!entriesCall.ok) return { dictionary, entries: [] };
|
|
37
|
-
const
|
|
36
|
+
const items = Array.isArray(entriesCall.result?.items) ? entriesCall.result?.items ?? [] : [];
|
|
37
|
+
const entries = items.map((entry) => {
|
|
38
38
|
if (!entry || typeof entry !== "object") return null;
|
|
39
39
|
const record = entry;
|
|
40
40
|
const value = typeof record.value === "string" ? record.value : null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/staff/components/detail/dictionaries.ts"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\
|
|
5
|
-
"mappings": ";AAEA,SAAS,SAAS,sBAAsB;
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\n\nexport type DictionaryEntryOption = {\n value: string\n label: string\n color: string | null\n icon: string | null\n}\n\ntype DictionarySummary = {\n id: string\n key: string\n name: string\n}\n\nconst STAFF_DICTIONARY_KEYS = {\n activityTypes: 'staff-activity-types',\n addressTypes: 'staff-address-types',\n} as const\n\nasync function ensureDictionary(key: string, name: string): Promise<DictionarySummary | null> {\n const listCall = await apiCall<{ items?: DictionarySummary[] }>('/api/dictionaries')\n const items = Array.isArray(listCall.result?.items) ? listCall.result?.items ?? [] : []\n const existing = items.find((item) => item && item.key === key)\n if (existing) return existing\n if (!listCall.ok) return null\n const created = await apiCallOrThrow<DictionarySummary>(\n '/api/dictionaries',\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ key, name }),\n },\n )\n const result = created.result as DictionarySummary | undefined\n if (result && result.id && result.key) return result\n return null\n}\n\nexport async function loadStaffDictionaryEntries(kind: keyof typeof STAFF_DICTIONARY_KEYS): Promise<DictionaryEntryOption[]> {\n const { entries } = await loadStaffDictionary(kind)\n return entries\n}\n\nexport async function loadStaffDictionary(\n kind: keyof typeof STAFF_DICTIONARY_KEYS,\n): Promise<{ dictionary: DictionarySummary | null; entries: DictionaryEntryOption[] }> {\n const key = STAFF_DICTIONARY_KEYS[kind]\n const name = kind === 'activityTypes' ? 'Staff activity types' : 'Staff address types'\n const dictionary = await ensureDictionary(key, name)\n if (!dictionary) return { dictionary: null, entries: [] }\n const entriesCall = await apiCall<{ items?: Record<string, unknown>[] }>(`/api/dictionaries/${dictionary.id}/entries`)\n if (!entriesCall.ok) return { dictionary, entries: [] }\n const items = Array.isArray(entriesCall.result?.items) ? entriesCall.result?.items ?? [] : []\n const entries = items\n .map((entry) => {\n if (!entry || typeof entry !== 'object') return null\n const record = entry as Record<string, unknown>\n const value = typeof record.value === 'string' ? record.value : null\n if (!value) return null\n const label = typeof record.label === 'string' && record.label.trim().length ? record.label : value\n const color = typeof record.color === 'string' ? record.color : null\n const icon = typeof record.icon === 'string' ? record.icon : null\n return { value, label, color, icon }\n })\n .filter((entry): entry is DictionaryEntryOption => !!entry)\n return { dictionary, entries }\n}\n\nexport async function createStaffDictionaryEntry(\n kind: keyof typeof STAFF_DICTIONARY_KEYS,\n input: { value: string; label?: string; color?: string | null; icon?: string | null },\n): Promise<DictionaryEntryOption | null> {\n const key = STAFF_DICTIONARY_KEYS[kind]\n const name = kind === 'activityTypes' ? 'Staff activity types' : 'Staff address types'\n const dictionary = await ensureDictionary(key, name)\n if (!dictionary) return null\n const response = await apiCallOrThrow<Record<string, unknown>>(\n `/api/dictionaries/${dictionary.id}/entries`,\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n value: input.value,\n label: input.label ?? undefined,\n color: input.color ?? undefined,\n icon: input.icon ?? undefined,\n }),\n },\n )\n const payload = response.result ?? {}\n const value = typeof payload.value === 'string' && payload.value.trim().length ? payload.value : input.value\n const label = typeof payload.label === 'string' && payload.label.trim().length ? payload.label : value\n const color = typeof payload.color === 'string' ? payload.color : input.color ?? null\n const icon = typeof payload.icon === 'string' ? payload.icon : input.icon ?? null\n return { value, label, color, icon }\n}\n"],
|
|
5
|
+
"mappings": ";AAEA,SAAS,SAAS,sBAAsB;AAexC,MAAM,wBAAwB;AAAA,EAC5B,eAAe;AAAA,EACf,cAAc;AAChB;AAEA,eAAe,iBAAiB,KAAa,MAAiD;AAC5F,QAAM,WAAW,MAAM,QAAyC,mBAAmB;AACnF,QAAM,QAAQ,MAAM,QAAQ,SAAS,QAAQ,KAAK,IAAI,SAAS,QAAQ,SAAS,CAAC,IAAI,CAAC;AACtF,QAAM,WAAW,MAAM,KAAK,CAAC,SAAS,QAAQ,KAAK,QAAQ,GAAG;AAC9D,MAAI,SAAU,QAAO;AACrB,MAAI,CAAC,SAAS,GAAI,QAAO;AACzB,QAAM,UAAU,MAAM;AAAA,IACpB;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU,EAAE,KAAK,KAAK,CAAC;AAAA,IACpC;AAAA,EACF;AACA,QAAM,SAAS,QAAQ;AACvB,MAAI,UAAU,OAAO,MAAM,OAAO,IAAK,QAAO;AAC9C,SAAO;AACT;AAEA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AAO;AACxB,QAAM,WAAW,MAAM;AAAA,IACrB,qBAAqB,WAAW,EAAE;AAAA,IAClC;AAAA,MACE,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU;AAAA,QACnB,OAAO,MAAM;AAAA,QACb,OAAO,MAAM,SAAS;AAAA,QACtB,OAAO,MAAM,SAAS;AAAA,QACtB,MAAM,MAAM,QAAQ;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,UAAU,SAAS,UAAU,CAAC;AACpC,QAAM,QAAQ,OAAO,QAAQ,UAAU,YAAY,QAAQ,MAAM,KAAK,EAAE,SAAS,QAAQ,QAAQ,MAAM;AACvG,QAAM,QAAQ,OAAO,QAAQ,UAAU,YAAY,QAAQ,MAAM,KAAK,EAAE,SAAS,QAAQ,QAAQ;AACjG,QAAM,QAAQ,OAAO,QAAQ,UAAU,WAAW,QAAQ,QAAQ,MAAM,SAAS;AACjF,QAAM,OAAO,OAAO,QAAQ,SAAS,WAAW,QAAQ,OAAO,MAAM,QAAQ;AAC7E,SAAO,EAAE,OAAO,OAAO,OAAO,KAAK;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,12 +9,7 @@ import { buildSuggestedMapping } from "../../lib/mapping.js";
|
|
|
9
9
|
import { parseCsvPreview } from "../../lib/parser.js";
|
|
10
10
|
import { createSyncExcelUploadAttachment } from "../../lib/upload-storage.js";
|
|
11
11
|
import { resolveSyncExcelConcreteScope } from "../../lib/scope.js";
|
|
12
|
-
import {
|
|
13
|
-
isMultipartRequestWithinUploadLimit,
|
|
14
|
-
isMultipartUploadLimitError,
|
|
15
|
-
parseMultipartFormDataWithinUploadLimit,
|
|
16
|
-
resolveDefaultAttachmentMaxUploadBytes
|
|
17
|
-
} from "../../../attachments/lib/upload-limits.js";
|
|
12
|
+
import { isMultipartRequestWithinUploadLimit, resolveDefaultAttachmentMaxUploadBytes } from "../../../attachments/lib/upload-limits.js";
|
|
18
13
|
const metadata = {
|
|
19
14
|
POST: { requireAuth: true, requireFeatures: ["sync_excel.run"] }
|
|
20
15
|
};
|
|
@@ -63,15 +58,7 @@ async function POST(request) {
|
|
|
63
58
|
if (!isMultipartRequestWithinUploadLimit(request.headers.get("content-length"))) {
|
|
64
59
|
return NextResponse.json({ error: "CSV upload exceeds the maximum upload size." }, { status: 413 });
|
|
65
60
|
}
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
formData = await parseMultipartFormDataWithinUploadLimit(request);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
if (isMultipartUploadLimitError(error)) {
|
|
71
|
-
return NextResponse.json({ error: "CSV upload exceeds the maximum upload size." }, { status: 413 });
|
|
72
|
-
}
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
61
|
+
const formData = await request.formData();
|
|
75
62
|
const parsedPayload = multipartSchema.safeParse({
|
|
76
63
|
entityType: typeof formData.get("entityType") === "string" ? formData.get("entityType") : void 0
|
|
77
64
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/sync_excel/api/upload/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { randomUUID } from 'crypto'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { NextResponse } from 'next/server'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { z } from 'zod'\nimport { syncExcelUploadResponseSchema, syncExcelEntityTypeSchema } from '../../data/validators'\nimport { SyncExcelUpload } from '../../data/entities'\nimport { buildSuggestedMapping } from '../../lib/mapping'\nimport { parseCsvPreview } from '../../lib/parser'\nimport { createSyncExcelUploadAttachment } from '../../lib/upload-storage'\nimport { resolveSyncExcelConcreteScope } from '../../lib/scope'\nimport {
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AACvC,SAAS,SAAS;AAClB,SAAS,+BAA+B,iCAAiC;AACzE,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,SAAS,uCAAuC;AAChD,SAAS,qCAAqC;AAC9C
|
|
4
|
+
"sourcesContent": ["import { randomUUID } from 'crypto'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { NextResponse } from 'next/server'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { z } from 'zod'\nimport { syncExcelUploadResponseSchema, syncExcelEntityTypeSchema } from '../../data/validators'\nimport { SyncExcelUpload } from '../../data/entities'\nimport { buildSuggestedMapping } from '../../lib/mapping'\nimport { parseCsvPreview } from '../../lib/parser'\nimport { createSyncExcelUploadAttachment } from '../../lib/upload-storage'\nimport { resolveSyncExcelConcreteScope } from '../../lib/scope'\nimport { isMultipartRequestWithinUploadLimit, resolveDefaultAttachmentMaxUploadBytes } from '../../../attachments/lib/upload-limits'\n\nexport const metadata = {\n POST: { requireAuth: true, requireFeatures: ['sync_excel.run'] },\n}\n\nconst multipartSchema = z.object({\n entityType: syncExcelEntityTypeSchema.default('customers.person'),\n})\n\nconst errorSchema = z.object({\n error: z.string(),\n})\n\nexport const openApi = {\n tags: ['SyncExcel'],\n summary: 'Upload CSV file for sync_excel preview',\n methods: {\n POST: {\n summary: 'Upload CSV file',\n requestBody: {\n contentType: 'multipart/form-data',\n },\n responses: [\n { status: 200, description: 'CSV uploaded and preview parsed', schema: syncExcelUploadResponseSchema },\n ],\n errors: [\n { status: 400, description: 'Invalid multipart payload', schema: errorSchema },\n { status: 401, description: 'Unauthorized', schema: errorSchema },\n { status: 413, description: 'CSV upload exceeds the maximum upload size', schema: errorSchema },\n { status: 422, description: 'Unsupported entity type or file type', schema: errorSchema },\n ],\n },\n },\n}\n\nexport async function POST(request: Request) {\n const auth = await getAuthFromRequest(request)\n if (!auth?.tenantId) {\n return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })\n }\n\n const container = await createRequestContainer()\n const scopeResult = await resolveSyncExcelConcreteScope({ auth, container, request })\n if (!scopeResult.ok) {\n return NextResponse.json({ error: scopeResult.error }, { status: scopeResult.status })\n }\n const { scope } = scopeResult\n\n const contentType = request.headers.get('content-type') || ''\n if (!contentType.toLowerCase().includes('multipart/form-data')) {\n return NextResponse.json({ error: 'Expected multipart/form-data' }, { status: 400 })\n }\n if (!isMultipartRequestWithinUploadLimit(request.headers.get('content-length'))) {\n return NextResponse.json({ error: 'CSV upload exceeds the maximum upload size.' }, { status: 413 })\n }\n\n const formData = await request.formData()\n const parsedPayload = multipartSchema.safeParse({\n entityType: typeof formData.get('entityType') === 'string' ? formData.get('entityType') : undefined,\n })\n\n if (!parsedPayload.success) {\n return NextResponse.json({ error: 'Invalid upload payload.' }, { status: 422 })\n }\n\n const file = formData.get('file')\n if (!(file instanceof File)) {\n return NextResponse.json({ error: 'Select a CSV file to upload.' }, { status: 400 })\n }\n\n const supportedMimeTypes = new Set(['text/csv', 'application/vnd.ms-excel', 'application/csv'])\n const isCsvByMime = supportedMimeTypes.has(file.type)\n const isCsvByName = file.name.toLowerCase().endsWith('.csv')\n\n if (!isCsvByMime && !isCsvByName) {\n return NextResponse.json({ error: 'Only CSV uploads are supported in this foundation slice.' }, { status: 422 })\n }\n\n const maxUploadBytes = resolveDefaultAttachmentMaxUploadBytes()\n if (file.size > maxUploadBytes) {\n return NextResponse.json({ error: 'CSV upload exceeds the maximum upload size.' }, { status: 413 })\n }\n\n const fileBuffer = Buffer.from(await file.arrayBuffer())\n const preview = parseCsvPreview(fileBuffer, { maxRows: 5 })\n const suggestedMapping = buildSuggestedMapping(parsedPayload.data.entityType, preview.headers)\n\n const em = container.resolve('em') as EntityManager\n const uploadId = randomUUID()\n const attachment = await createSyncExcelUploadAttachment({\n em,\n uploadId,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n fileName: file.name,\n mimeType: file.type || 'text/csv',\n buffer: fileBuffer,\n })\n\n const upload = em.create(SyncExcelUpload, {\n id: uploadId,\n attachmentId: attachment.id,\n filename: file.name,\n mimeType: file.type || 'text/csv',\n fileSize: fileBuffer.length,\n entityType: parsedPayload.data.entityType,\n delimiter: preview.delimiter,\n encoding: preview.encoding,\n headers: preview.headers,\n sampleRows: preview.sampleRows,\n totalRows: preview.totalRows,\n status: 'uploaded',\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n })\n\n em.persist(upload)\n await em.flush()\n\n return NextResponse.json(syncExcelUploadResponseSchema.parse({\n uploadId: upload.id,\n filename: upload.filename,\n mimeType: upload.mimeType,\n fileSize: upload.fileSize,\n entityType: upload.entityType,\n headers: upload.headers,\n sampleRows: upload.sampleRows,\n totalRows: upload.totalRows,\n suggestedMapping,\n }))\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AACvC,SAAS,SAAS;AAClB,SAAS,+BAA+B,iCAAiC;AACzE,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,SAAS,uCAAuC;AAChD,SAAS,qCAAqC;AAC9C,SAAS,qCAAqC,8CAA8C;AAErF,MAAM,WAAW;AAAA,EACtB,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,gBAAgB,EAAE;AACjE;AAEA,MAAM,kBAAkB,EAAE,OAAO;AAAA,EAC/B,YAAY,0BAA0B,QAAQ,kBAAkB;AAClE,CAAC;AAED,MAAM,cAAc,EAAE,OAAO;AAAA,EAC3B,OAAO,EAAE,OAAO;AAClB,CAAC;AAEM,MAAM,UAAU;AAAA,EACrB,MAAM,CAAC,WAAW;AAAA,EAClB,SAAS;AAAA,EACT,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,QACX,aAA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,QAAQ;AAAA,IACvB,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,SAAS,GAAG,OAAO,iBAAiB;AAAA,IACxC,IAAI;AAAA,IACJ,cAAc,WAAW;AAAA,IACzB,UAAU,KAAK;AAAA,IACf,UAAU,KAAK,QAAQ;AAAA,IACvB,UAAU,WAAW;AAAA,IACrB,YAAY,cAAc,KAAK;AAAA,IAC/B,WAAW,QAAQ;AAAA,IACnB,UAAU,QAAQ;AAAA,IAClB,SAAS,QAAQ;AAAA,IACjB,YAAY,QAAQ;AAAA,IACpB,WAAW,QAAQ;AAAA,IACnB,QAAQ;AAAA,IACR,gBAAgB,MAAM;AAAA,IACtB,UAAU,MAAM;AAAA,EAClB,CAAC;AAED,KAAG,QAAQ,MAAM;AACjB,QAAM,GAAG,MAAM;AAEf,SAAO,aAAa,KAAK,8BAA8B,MAAM;AAAA,IAC3D,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO;AAAA,IACjB,YAAY,OAAO;AAAA,IACnB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,WAAW,OAAO;AAAA,IAClB;AAAA,EACF,CAAC,CAAC;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -325,7 +325,7 @@ function ReleaseReservationDialog({
|
|
|
325
325
|
Button,
|
|
326
326
|
{
|
|
327
327
|
type: "submit",
|
|
328
|
-
variant: "destructive
|
|
328
|
+
variant: "destructive",
|
|
329
329
|
disabled: submitDisabled,
|
|
330
330
|
"data-testid": "wms-inventory-release-submit",
|
|
331
331
|
children: t("wms.backend.inventory.release.dialog.submit", "Release reservation")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/wms/components/backend/ReleaseReservationDialog.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { ShieldOff } from 'lucide-react'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { flashMutationError } from '../../lib/flashMutationError'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { KbdShortcut } from '@open-mercato/ui/primitives/kbd'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n createInventoryQuantityFormatter,\n formatReservationSourceLabel,\n} from '../../lib/inventoryDisplayUi'\nimport { parseInventoryQuantity } from '../../lib/inventoryMutationUi'\nimport type { WmsInventoryMutationAccess } from './useWmsInventoryMutationAccess'\n\nconst RELEASE_REASON_CODES = ['order_cancelled', 'manual_release', 'correction', 'other'] as const\n\ntype ReleaseReasonCode = (typeof RELEASE_REASON_CODES)[number]\n\ntype ReservationSummary = {\n id: string\n warehouse_name?: string | null\n warehouse_code?: string | null\n variant_name?: string | null\n variant_sku?: string | null\n quantity?: string | number | null\n source_type?: string | null\n source_id?: string | null\n source_label?: string | null\n status?: string | null\n}\n\ntype ReleaseReservationDialogProps = {\n open: boolean\n onOpenChange: (open: boolean) => void\n access: WmsInventoryMutationAccess\n reservation: ReservationSummary | null\n onSuccess?: () => void\n}\n\nfunction formatVariantLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n const name = (row.variant_name ?? '').trim()\n const sku = (row.variant_sku ?? '').trim()\n if (name && sku) return `${name} (${sku})`\n if (name) return name\n if (sku) return sku\n return notAvailableLabel\n}\n\nfunction formatWarehouseLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n return (\n row.warehouse_name?.trim() ||\n row.warehouse_code?.trim() ||\n notAvailableLabel\n )\n}\n\nexport function ReleaseReservationDialog({\n open,\n onOpenChange,\n access,\n reservation,\n onSuccess,\n}: ReleaseReservationDialogProps) {\n const t = useT()\n const locale = useLocale()\n const quantityFormatter = React.useMemo(\n () => createInventoryQuantityFormatter(locale),\n [locale],\n )\n const notAvailableLabel = t('wms.backend.inventory.common.notAvailable', '\u2014')\n const queryClient = useQueryClient()\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: 'wms-inventory-release',\n })\n const mutationContext = React.useMemo(\n () => ({ retryLastMutation }),\n [retryLastMutation],\n )\n const releaseFormSchema = React.useMemo(\n () =>\n z.object({\n reasonCode: z.enum(RELEASE_REASON_CODES),\n notes: z.string().trim().max(500).optional(),\n }),\n [],\n )\n const [submitting, setSubmitting] = React.useState(false)\n const [reasonCode, setReasonCode] = React.useState<ReleaseReasonCode | ''>('')\n const [notes, setNotes] = React.useState('')\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({})\n\n const reasonLabel = React.useCallback(\n (code: ReleaseReasonCode) => {\n const fallbacks: Record<ReleaseReasonCode, string> = {\n order_cancelled: 'Order cancelled',\n manual_release: 'Manual release',\n correction: 'Correction',\n other: 'Other',\n }\n return t(`wms.backend.inventory.release.reasons.${code}`, fallbacks[code])\n },\n [t],\n )\n\n const resetDialog = React.useCallback(() => {\n setReasonCode('')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [])\n\n React.useEffect(() => {\n if (!open || !reservation?.id) return\n setReasonCode('manual_release')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [open, reservation?.id])\n\n const closeDialog = React.useCallback(() => {\n onOpenChange(false)\n resetDialog()\n }, [onOpenChange, resetDialog])\n\n const handleSubmit = React.useCallback(\n async (event?: React.FormEvent) => {\n event?.preventDefault()\n if (!reservation?.id) {\n flash(\n t(\n 'wms.backend.inventory.release.errors.missingReservation',\n 'Reservation context is missing. Close the dialog and try again from the reservations table.',\n ),\n 'error',\n )\n return\n }\n\n const parsed = releaseFormSchema.safeParse({\n reasonCode,\n notes: notes.trim() || undefined,\n })\n if (!parsed.success) {\n const nextErrors: Record<string, string> = {}\n for (const issue of parsed.error.issues) {\n const key = String(issue.path[0] ?? 'form')\n if (!nextErrors[key]) nextErrors[key] = issue.message\n }\n setFieldErrors(nextErrors)\n return\n }\n\n if (!access.scopeReady || !access.organizationId || !access.tenantId) {\n flash(\n t(\n 'wms.backend.inventory.mutations.errors.scope',\n 'Select an organization and sign in before posting inventory changes.',\n ),\n 'error',\n )\n return\n }\n\n setSubmitting(true)\n try {\n const reasonParts = [reasonLabel(parsed.data.reasonCode)]\n if (parsed.data.notes?.trim()) reasonParts.push(parsed.data.notes.trim())\n const payload = {\n organizationId: access.organizationId,\n tenantId: access.tenantId,\n reservationId: reservation.id,\n reason: reasonParts.join(' \u2014 ').slice(0, 120),\n reasonCode: parsed.data.reasonCode,\n }\n\n await runMutation({\n operation: async () => {\n const call = await apiCall<{ ok?: boolean }>('/api/wms/inventory/release', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n if (!call.ok) {\n if (call.response.status === 409 && (call.result as { error?: string } | null)?.error === 'balance_integrity_violation') {\n flash(\n t(\n 'wms.backend.inventory.release.errors.balanceIntegrityViolation',\n 'Balance integrity error \u2014 run \"mercato wms verify-balances --repair\" to diagnose and fix drift before retrying.',\n ),\n 'error',\n )\n return {}\n }\n await raiseCrudError(\n call.response,\n t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'),\n )\n }\n return call.result ?? {}\n },\n context: mutationContext,\n mutationPayload: payload,\n })\n\n flash(t('wms.backend.inventory.release.flash.success', 'Reservation released'), 'success')\n await queryClient.invalidateQueries({ queryKey: ['wms-inventory-console'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-sku-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-location-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-lot-detail'] })\n closeDialog()\n onSuccess?.()\n } catch (error) {\n flashMutationError(error, t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'), t)\n } finally {\n setSubmitting(false)\n }\n },\n [\n access,\n closeDialog,\n mutationContext,\n notes,\n onSuccess,\n queryClient,\n reasonCode,\n reasonLabel,\n releaseFormSchema,\n reservation,\n runMutation,\n t,\n ],\n )\n\n const submitDisabled = submitting || access.loading || !access.scopeReady\n\n const handleDialogKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n closeDialog()\n return\n }\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n if (!submitDisabled) void handleSubmit()\n }\n },\n [closeDialog, handleSubmit, submitDisabled],\n )\n\n if (!reservation) return null\n\n return (\n <Dialog open={open} onOpenChange={(next) => (next ? onOpenChange(true) : closeDialog())}>\n <DialogContent\n className=\"max-w-lg gap-0 overflow-hidden p-0\"\n onKeyDown={handleDialogKeyDown}\n >\n <div className=\"border-b px-6 py-4 pr-12\">\n <DialogHeader className=\"space-y-1 text-left\">\n <DialogTitle>\n {t('wms.backend.inventory.release.dialog.title', 'Release reservation')}\n </DialogTitle>\n <DialogDescription>\n {t(\n 'wms.backend.inventory.release.dialog.description',\n 'Return reserved quantity to available stock for this bucket.',\n )}\n </DialogDescription>\n </DialogHeader>\n </div>\n\n <form onSubmit={handleSubmit} className=\"flex min-h-0 flex-1 flex-col\">\n <div className=\"flex flex-col gap-5 overflow-y-auto px-6 py-6\">\n <div className=\"rounded-lg border bg-muted/40 px-4 py-3.5\">\n <div className=\"flex items-start gap-3\">\n <ShieldOff className=\"mt-0.5 size-4 text-muted-foreground\" aria-hidden=\"true\" />\n <dl className=\"grid gap-2 text-sm\">\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.variant', 'Variant')}\n </dt>\n <dd className=\"font-medium\">\n {formatVariantLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.warehouse', 'Warehouse')}\n </dt>\n <dd className=\"font-medium\">\n {formatWarehouseLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.quantity', 'Quantity')}\n </dt>\n <dd className=\"font-medium tabular-nums\">\n {quantityFormatter.format(parseInventoryQuantity(reservation.quantity))}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.source', 'Source')}\n </dt>\n <dd className=\"font-medium\">\n {formatReservationSourceLabel(reservation, t) || notAvailableLabel}\n </dd>\n </div>\n </dl>\n </div>\n </div>\n\n <p className=\"rounded-lg border border-status-warning-border bg-status-warning-bg px-3 py-2.5 text-sm text-status-warning-text\">\n {t(\n 'wms.backend.inventory.release.warning',\n 'This action cannot be undone \u2014 the reserved quantity will be released immediately.',\n )}\n </p>\n\n <FormField\n label={t('wms.backend.inventory.release.form.reason', 'Reason')}\n required\n error={fieldErrors.reasonCode}\n >\n <Select\n value={reasonCode || undefined}\n onValueChange={(next) => {\n setReasonCode(next as ReleaseReasonCode)\n setFieldErrors({})\n }}\n disabled={submitting}\n >\n <SelectTrigger>\n <SelectValue\n placeholder={t(\n 'wms.backend.inventory.release.form.reasonPlaceholder',\n 'Select reason',\n )}\n />\n </SelectTrigger>\n <SelectContent>\n {RELEASE_REASON_CODES.map((code) => (\n <SelectItem key={code} value={code}>\n {reasonLabel(code)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </FormField>\n\n <FormField label={t('wms.backend.inventory.release.form.notes', 'Notes')}>\n <Textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n placeholder={t(\n 'wms.backend.inventory.release.form.notesPlaceholder',\n 'Optional \u2014 additional context',\n )}\n rows={3}\n disabled={submitting}\n />\n </FormField>\n </div>\n\n <DialogFooter bordered={false} className=\"border-t px-6 py-4 sm:justify-between\">\n <p className=\"hidden text-xs text-muted-foreground sm:inline-flex sm:items-center sm:gap-1.5\">\n <KbdShortcut keys={['\u2318', 'Enter']} />\n <span>/</span>\n <KbdShortcut keys={['Ctrl', 'Enter']} />\n <span>{t('wms.backend.inventory.release.dialog.shortcutSave', 'to confirm')}</span>\n </p>\n <div className=\"flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row\">\n <Button type=\"button\" variant=\"outline\" onClick={closeDialog} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n variant=\"destructive-solid\"\n disabled={submitDisabled}\n data-testid=\"wms-inventory-release-submit\"\n >\n {t('wms.backend.inventory.release.dialog.submit', 'Release reservation')}\n </Button>\n </div>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { ShieldOff } from 'lucide-react'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { flashMutationError } from '../../lib/flashMutationError'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { KbdShortcut } from '@open-mercato/ui/primitives/kbd'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n createInventoryQuantityFormatter,\n formatReservationSourceLabel,\n} from '../../lib/inventoryDisplayUi'\nimport { parseInventoryQuantity } from '../../lib/inventoryMutationUi'\nimport type { WmsInventoryMutationAccess } from './useWmsInventoryMutationAccess'\n\nconst RELEASE_REASON_CODES = ['order_cancelled', 'manual_release', 'correction', 'other'] as const\n\ntype ReleaseReasonCode = (typeof RELEASE_REASON_CODES)[number]\n\ntype ReservationSummary = {\n id: string\n warehouse_name?: string | null\n warehouse_code?: string | null\n variant_name?: string | null\n variant_sku?: string | null\n quantity?: string | number | null\n source_type?: string | null\n source_id?: string | null\n source_label?: string | null\n status?: string | null\n}\n\ntype ReleaseReservationDialogProps = {\n open: boolean\n onOpenChange: (open: boolean) => void\n access: WmsInventoryMutationAccess\n reservation: ReservationSummary | null\n onSuccess?: () => void\n}\n\nfunction formatVariantLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n const name = (row.variant_name ?? '').trim()\n const sku = (row.variant_sku ?? '').trim()\n if (name && sku) return `${name} (${sku})`\n if (name) return name\n if (sku) return sku\n return notAvailableLabel\n}\n\nfunction formatWarehouseLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n return (\n row.warehouse_name?.trim() ||\n row.warehouse_code?.trim() ||\n notAvailableLabel\n )\n}\n\nexport function ReleaseReservationDialog({\n open,\n onOpenChange,\n access,\n reservation,\n onSuccess,\n}: ReleaseReservationDialogProps) {\n const t = useT()\n const locale = useLocale()\n const quantityFormatter = React.useMemo(\n () => createInventoryQuantityFormatter(locale),\n [locale],\n )\n const notAvailableLabel = t('wms.backend.inventory.common.notAvailable', '\u2014')\n const queryClient = useQueryClient()\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: 'wms-inventory-release',\n })\n const mutationContext = React.useMemo(\n () => ({ retryLastMutation }),\n [retryLastMutation],\n )\n const releaseFormSchema = React.useMemo(\n () =>\n z.object({\n reasonCode: z.enum(RELEASE_REASON_CODES),\n notes: z.string().trim().max(500).optional(),\n }),\n [],\n )\n const [submitting, setSubmitting] = React.useState(false)\n const [reasonCode, setReasonCode] = React.useState<ReleaseReasonCode | ''>('')\n const [notes, setNotes] = React.useState('')\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({})\n\n const reasonLabel = React.useCallback(\n (code: ReleaseReasonCode) => {\n const fallbacks: Record<ReleaseReasonCode, string> = {\n order_cancelled: 'Order cancelled',\n manual_release: 'Manual release',\n correction: 'Correction',\n other: 'Other',\n }\n return t(`wms.backend.inventory.release.reasons.${code}`, fallbacks[code])\n },\n [t],\n )\n\n const resetDialog = React.useCallback(() => {\n setReasonCode('')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [])\n\n React.useEffect(() => {\n if (!open || !reservation?.id) return\n setReasonCode('manual_release')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [open, reservation?.id])\n\n const closeDialog = React.useCallback(() => {\n onOpenChange(false)\n resetDialog()\n }, [onOpenChange, resetDialog])\n\n const handleSubmit = React.useCallback(\n async (event?: React.FormEvent) => {\n event?.preventDefault()\n if (!reservation?.id) {\n flash(\n t(\n 'wms.backend.inventory.release.errors.missingReservation',\n 'Reservation context is missing. Close the dialog and try again from the reservations table.',\n ),\n 'error',\n )\n return\n }\n\n const parsed = releaseFormSchema.safeParse({\n reasonCode,\n notes: notes.trim() || undefined,\n })\n if (!parsed.success) {\n const nextErrors: Record<string, string> = {}\n for (const issue of parsed.error.issues) {\n const key = String(issue.path[0] ?? 'form')\n if (!nextErrors[key]) nextErrors[key] = issue.message\n }\n setFieldErrors(nextErrors)\n return\n }\n\n if (!access.scopeReady || !access.organizationId || !access.tenantId) {\n flash(\n t(\n 'wms.backend.inventory.mutations.errors.scope',\n 'Select an organization and sign in before posting inventory changes.',\n ),\n 'error',\n )\n return\n }\n\n setSubmitting(true)\n try {\n const reasonParts = [reasonLabel(parsed.data.reasonCode)]\n if (parsed.data.notes?.trim()) reasonParts.push(parsed.data.notes.trim())\n const payload = {\n organizationId: access.organizationId,\n tenantId: access.tenantId,\n reservationId: reservation.id,\n reason: reasonParts.join(' \u2014 ').slice(0, 120),\n reasonCode: parsed.data.reasonCode,\n }\n\n await runMutation({\n operation: async () => {\n const call = await apiCall<{ ok?: boolean }>('/api/wms/inventory/release', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n if (!call.ok) {\n if (call.response.status === 409 && (call.result as { error?: string } | null)?.error === 'balance_integrity_violation') {\n flash(\n t(\n 'wms.backend.inventory.release.errors.balanceIntegrityViolation',\n 'Balance integrity error \u2014 run \"mercato wms verify-balances --repair\" to diagnose and fix drift before retrying.',\n ),\n 'error',\n )\n return {}\n }\n await raiseCrudError(\n call.response,\n t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'),\n )\n }\n return call.result ?? {}\n },\n context: mutationContext,\n mutationPayload: payload,\n })\n\n flash(t('wms.backend.inventory.release.flash.success', 'Reservation released'), 'success')\n await queryClient.invalidateQueries({ queryKey: ['wms-inventory-console'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-sku-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-location-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-lot-detail'] })\n closeDialog()\n onSuccess?.()\n } catch (error) {\n flashMutationError(error, t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'), t)\n } finally {\n setSubmitting(false)\n }\n },\n [\n access,\n closeDialog,\n mutationContext,\n notes,\n onSuccess,\n queryClient,\n reasonCode,\n reasonLabel,\n releaseFormSchema,\n reservation,\n runMutation,\n t,\n ],\n )\n\n const submitDisabled = submitting || access.loading || !access.scopeReady\n\n const handleDialogKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n closeDialog()\n return\n }\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n if (!submitDisabled) void handleSubmit()\n }\n },\n [closeDialog, handleSubmit, submitDisabled],\n )\n\n if (!reservation) return null\n\n return (\n <Dialog open={open} onOpenChange={(next) => (next ? onOpenChange(true) : closeDialog())}>\n <DialogContent\n className=\"max-w-lg gap-0 overflow-hidden p-0\"\n onKeyDown={handleDialogKeyDown}\n >\n <div className=\"border-b px-6 py-4 pr-12\">\n <DialogHeader className=\"space-y-1 text-left\">\n <DialogTitle>\n {t('wms.backend.inventory.release.dialog.title', 'Release reservation')}\n </DialogTitle>\n <DialogDescription>\n {t(\n 'wms.backend.inventory.release.dialog.description',\n 'Return reserved quantity to available stock for this bucket.',\n )}\n </DialogDescription>\n </DialogHeader>\n </div>\n\n <form onSubmit={handleSubmit} className=\"flex min-h-0 flex-1 flex-col\">\n <div className=\"flex flex-col gap-5 overflow-y-auto px-6 py-6\">\n <div className=\"rounded-lg border bg-muted/40 px-4 py-3.5\">\n <div className=\"flex items-start gap-3\">\n <ShieldOff className=\"mt-0.5 size-4 text-muted-foreground\" aria-hidden=\"true\" />\n <dl className=\"grid gap-2 text-sm\">\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.variant', 'Variant')}\n </dt>\n <dd className=\"font-medium\">\n {formatVariantLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.warehouse', 'Warehouse')}\n </dt>\n <dd className=\"font-medium\">\n {formatWarehouseLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.quantity', 'Quantity')}\n </dt>\n <dd className=\"font-medium tabular-nums\">\n {quantityFormatter.format(parseInventoryQuantity(reservation.quantity))}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.source', 'Source')}\n </dt>\n <dd className=\"font-medium\">\n {formatReservationSourceLabel(reservation, t) || notAvailableLabel}\n </dd>\n </div>\n </dl>\n </div>\n </div>\n\n <p className=\"rounded-lg border border-status-warning-border bg-status-warning-bg px-3 py-2.5 text-sm text-status-warning-text\">\n {t(\n 'wms.backend.inventory.release.warning',\n 'This action cannot be undone \u2014 the reserved quantity will be released immediately.',\n )}\n </p>\n\n <FormField\n label={t('wms.backend.inventory.release.form.reason', 'Reason')}\n required\n error={fieldErrors.reasonCode}\n >\n <Select\n value={reasonCode || undefined}\n onValueChange={(next) => {\n setReasonCode(next as ReleaseReasonCode)\n setFieldErrors({})\n }}\n disabled={submitting}\n >\n <SelectTrigger>\n <SelectValue\n placeholder={t(\n 'wms.backend.inventory.release.form.reasonPlaceholder',\n 'Select reason',\n )}\n />\n </SelectTrigger>\n <SelectContent>\n {RELEASE_REASON_CODES.map((code) => (\n <SelectItem key={code} value={code}>\n {reasonLabel(code)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </FormField>\n\n <FormField label={t('wms.backend.inventory.release.form.notes', 'Notes')}>\n <Textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n placeholder={t(\n 'wms.backend.inventory.release.form.notesPlaceholder',\n 'Optional \u2014 additional context',\n )}\n rows={3}\n disabled={submitting}\n />\n </FormField>\n </div>\n\n <DialogFooter bordered={false} className=\"border-t px-6 py-4 sm:justify-between\">\n <p className=\"hidden text-xs text-muted-foreground sm:inline-flex sm:items-center sm:gap-1.5\">\n <KbdShortcut keys={['\u2318', 'Enter']} />\n <span>/</span>\n <KbdShortcut keys={['Ctrl', 'Enter']} />\n <span>{t('wms.backend.inventory.release.dialog.shortcutSave', 'to confirm')}</span>\n </p>\n <div className=\"flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row\">\n <Button type=\"button\" variant=\"outline\" onClick={closeDialog} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n variant=\"destructive\"\n disabled={submitDisabled}\n data-testid=\"wms-inventory-release-submit\"\n >\n {t('wms.backend.inventory.release.dialog.submit', 'Release reservation')}\n </Button>\n </div>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
5
5
|
"mappings": ";AAmSU,SACE,KADF;AAjSV,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,WAAW,YAAY;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AAGvC,MAAM,uBAAuB,CAAC,mBAAmB,kBAAkB,cAAc,OAAO;AAyBxF,SAAS,mBACP,KACA,mBACQ;AACR,QAAM,QAAQ,IAAI,gBAAgB,IAAI,KAAK;AAC3C,QAAM,OAAO,IAAI,eAAe,IAAI,KAAK;AACzC,MAAI,QAAQ,IAAK,QAAO,GAAG,IAAI,KAAK,GAAG;AACvC,MAAI,KAAM,QAAO;AACjB,MAAI,IAAK,QAAO;AAChB,SAAO;AACT;AA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
3
3
|
import * as React from "react";
|
|
4
|
-
import { extensionPoints } from "@open-mercato/core/modules/wms/extension-points";
|
|
5
4
|
import Link from "next/link";
|
|
6
5
|
import { useRouter } from "next/navigation";
|
|
7
6
|
import { z } from "zod";
|
|
@@ -357,7 +356,7 @@ function WarehouseSection({ viewAllHref } = {}) {
|
|
|
357
356
|
totalPages: query.data?.totalPages ?? 1,
|
|
358
357
|
onPageChange: setPage
|
|
359
358
|
},
|
|
360
|
-
perspective: { tableId:
|
|
359
|
+
perspective: { tableId: "wms.config.warehouses" },
|
|
361
360
|
emptyState: /* @__PURE__ */ jsx(
|
|
362
361
|
EmptyState,
|
|
363
362
|
{
|
|
@@ -595,7 +594,7 @@ function ZoneSection({ viewAllHref } = {}) {
|
|
|
595
594
|
totalPages: query.data?.totalPages ?? 1,
|
|
596
595
|
onPageChange: setPage
|
|
597
596
|
},
|
|
598
|
-
perspective: { tableId:
|
|
597
|
+
perspective: { tableId: "wms.config.zones" },
|
|
599
598
|
emptyState: /* @__PURE__ */ jsx(
|
|
600
599
|
EmptyState,
|
|
601
600
|
{
|
|
@@ -782,7 +781,7 @@ function LocationSection({ viewAllHref } = {}) {
|
|
|
782
781
|
totalPages: query.data?.totalPages ?? 1,
|
|
783
782
|
onPageChange: setPage
|
|
784
783
|
},
|
|
785
|
-
perspective: { tableId:
|
|
784
|
+
perspective: { tableId: "wms.config.locations" },
|
|
786
785
|
emptyState: /* @__PURE__ */ jsx(
|
|
787
786
|
EmptyState,
|
|
788
787
|
{
|
|
@@ -1057,7 +1056,7 @@ function InventoryProfilesSection() {
|
|
|
1057
1056
|
totalPages: query.data?.totalPages ?? 1,
|
|
1058
1057
|
onPageChange: setPage
|
|
1059
1058
|
},
|
|
1060
|
-
perspective: { tableId:
|
|
1059
|
+
perspective: { tableId: "wms.config.inventoryProfiles" },
|
|
1061
1060
|
emptyState: /* @__PURE__ */ jsx(
|
|
1062
1061
|
EmptyState,
|
|
1063
1062
|
{
|