@open-mercato/core 0.8.1-develop.7296.1.2111d779db → 0.8.1-develop.7441.1.b42958b98c
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 +4 -5
- package/dist/generated/entities/availability_policy/index.js +41 -0
- package/dist/generated/entities/availability_policy/index.js.map +7 -0
- package/dist/generated/entities/communication_channel/index.js +3 -1
- package/dist/generated/entities/communication_channel/index.js.map +2 -2
- package/dist/generated/entities/customer_email_conversation_share/index.js +21 -0
- package/dist/generated/entities/customer_email_conversation_share/index.js.map +7 -0
- package/dist/generated/entities/customer_group/index.js +33 -0
- package/dist/generated/entities/customer_group/index.js.map +7 -0
- package/dist/generated/entities/customer_group_membership/index.js +29 -0
- package/dist/generated/entities/customer_group_membership/index.js.map +7 -0
- package/dist/generated/entities/customer_group_terms/index.js +33 -0
- package/dist/generated/entities/customer_group_terms/index.js.map +7 -0
- package/dist/generated/entities/customer_interaction/index.js +2 -0
- package/dist/generated/entities/customer_interaction/index.js.map +2 -2
- package/dist/generated/entities/form/index.js +35 -0
- package/dist/generated/entities/form/index.js.map +7 -0
- package/dist/generated/entities/form_access_audit/index.js +21 -0
- package/dist/generated/entities/form_access_audit/index.js.map +7 -0
- package/dist/generated/entities/form_attachment/index.js +29 -0
- package/dist/generated/entities/form_attachment/index.js.map +7 -0
- package/dist/generated/entities/form_consent_record/index.js +37 -0
- package/dist/generated/entities/form_consent_record/index.js.map +7 -0
- package/dist/generated/entities/form_distribution/index.js +47 -0
- package/dist/generated/entities/form_distribution/index.js.map +7 -0
- package/dist/generated/entities/form_invitation/index.js +49 -0
- package/dist/generated/entities/form_invitation/index.js.map +7 -0
- package/dist/generated/entities/form_submission/index.js +39 -0
- package/dist/generated/entities/form_submission/index.js.map +7 -0
- package/dist/generated/entities/form_submission_actor/index.js +23 -0
- package/dist/generated/entities/form_submission_actor/index.js.map +7 -0
- package/dist/generated/entities/form_submission_revision/index.js +29 -0
- package/dist/generated/entities/form_submission_revision/index.js.map +7 -0
- package/dist/generated/entities/form_version/index.js +37 -0
- package/dist/generated/entities/form_version/index.js.map +7 -0
- package/dist/generated/entities/forms_encryption_key/index.js +15 -0
- package/dist/generated/entities/forms_encryption_key/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +27 -2
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +269 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/communicationChannelsFixtures.js +16 -0
- package/dist/helpers/integration/communicationChannelsFixtures.js.map +2 -2
- package/dist/helpers/integration/customerGroupsFixtures.js +88 -0
- package/dist/helpers/integration/customerGroupsFixtures.js.map +7 -0
- package/dist/helpers/integration/formsFixtures.js +448 -0
- package/dist/helpers/integration/formsFixtures.js.map +7 -0
- package/dist/modules/api_docs/api/get/version.js +19 -7
- package/dist/modules/api_docs/api/get/version.js.map +2 -2
- package/dist/modules/api_keys/api/keys/route.js +74 -169
- package/dist/modules/api_keys/api/keys/route.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/create/page.js +1 -1
- package/dist/modules/api_keys/backend/api-keys/create/page.js.map +2 -2
- package/dist/modules/api_keys/commands/keys.js +140 -0
- package/dist/modules/api_keys/commands/keys.js.map +7 -0
- package/dist/modules/api_keys/services/apiKeyService.js +72 -43
- package/dist/modules/api_keys/services/apiKeyService.js.map +2 -2
- package/dist/modules/attachments/api/file/[id]/route.js +9 -2
- package/dist/modules/attachments/api/file/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js +6 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +10 -4
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js +16 -6
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/lib/access.js +1 -3
- package/dist/modules/attachments/lib/access.js.map +2 -2
- package/dist/modules/attachments/lib/requestScope.js +13 -4
- package/dist/modules/attachments/lib/requestScope.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js +6 -1
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js +36 -6
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js.map +3 -3
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js +6 -1
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js +34 -4
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js.map +2 -2
- package/dist/modules/audit_logs/data/validators.js +1 -0
- package/dist/modules/audit_logs/data/validators.js.map +2 -2
- package/dist/modules/audit_logs/lib/actorSubject.js +65 -0
- package/dist/modules/audit_logs/lib/actorSubject.js.map +7 -0
- package/dist/modules/audit_logs/lib/replayAuthorization.js +41 -0
- package/dist/modules/audit_logs/lib/replayAuthorization.js.map +7 -0
- package/dist/modules/audit_logs/services/actionLogService.js +162 -39
- package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
- package/dist/modules/auth/api/features.js +1 -1
- package/dist/modules/auth/api/features.js.map +2 -2
- package/dist/modules/auth/cli.js +29 -17
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/acl.js +25 -36
- package/dist/modules/auth/commands/acl.js.map +2 -2
- package/dist/modules/auth/commands/interceptors.js +22 -0
- package/dist/modules/auth/commands/interceptors.js.map +7 -0
- package/dist/modules/auth/commands/roles.js +421 -147
- package/dist/modules/auth/commands/roles.js.map +2 -2
- package/dist/modules/auth/commands/users.js +543 -69
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/lib/authorizationStateLocks.js +249 -0
- package/dist/modules/auth/lib/authorizationStateLocks.js.map +7 -0
- package/dist/modules/auth/lib/commandReplay.js +144 -0
- package/dist/modules/auth/lib/commandReplay.js.map +7 -0
- package/dist/modules/auth/lib/executionPrincipal.js +32 -25
- package/dist/modules/auth/lib/executionPrincipal.js.map +2 -2
- package/dist/modules/auth/lib/grantChecks.js +7 -2
- package/dist/modules/auth/lib/grantChecks.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +85 -49
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/lib/tokenHash.js +13 -1
- package/dist/modules/auth/lib/tokenHash.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +386 -5
- package/dist/modules/auth/services/rbacService.js.map +3 -3
- package/dist/modules/availability/acl.js +16 -0
- package/dist/modules/availability/acl.js.map +7 -0
- package/dist/modules/availability/api/check/route.js +115 -0
- package/dist/modules/availability/api/check/route.js.map +7 -0
- package/dist/modules/availability/api/openapi.js +27 -0
- package/dist/modules/availability/api/openapi.js.map +7 -0
- package/dist/modules/availability/api/policies/resolve-preview/route.js +72 -0
- package/dist/modules/availability/api/policies/resolve-preview/route.js.map +7 -0
- package/dist/modules/availability/api/policies/route.js +203 -0
- package/dist/modules/availability/api/policies/route.js.map +7 -0
- package/dist/modules/availability/backend/availability/check/page.js +185 -0
- package/dist/modules/availability/backend/availability/check/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/check/page.meta.js +16 -0
- package/dist/modules/availability/backend/availability/check/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/ResolutionPreviewPanel.js +83 -0
- package/dist/modules/availability/backend/availability/policies/ResolutionPreviewPanel.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/ScopeFields.js +53 -0
- package/dist/modules/availability/backend/availability/policies/ScopeFields.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/StockManagedField.js +32 -0
- package/dist/modules/availability/backend/availability/policies/StockManagedField.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.js +168 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.meta.js +12 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/create/page.js +119 -0
- package/dist/modules/availability/backend/availability/policies/create/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/create/page.meta.js +12 -0
- package/dist/modules/availability/backend/availability/policies/create/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/formGroups.js +77 -0
- package/dist/modules/availability/backend/availability/policies/formGroups.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/page.js +207 -0
- package/dist/modules/availability/backend/availability/policies/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/page.meta.js +16 -0
- package/dist/modules/availability/backend/availability/policies/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/policyPayload.js +28 -0
- package/dist/modules/availability/backend/availability/policies/policyPayload.js.map +7 -0
- package/dist/modules/availability/commands/policies.js +364 -0
- package/dist/modules/availability/commands/policies.js.map +7 -0
- package/dist/modules/availability/commands/scope.js +19 -0
- package/dist/modules/availability/commands/scope.js.map +7 -0
- package/dist/modules/availability/data/entities.js +94 -0
- package/dist/modules/availability/data/entities.js.map +7 -0
- package/dist/modules/availability/data/validators.js +59 -0
- package/dist/modules/availability/data/validators.js.map +7 -0
- package/dist/modules/availability/di.js +50 -0
- package/dist/modules/availability/di.js.map +7 -0
- package/dist/modules/availability/events.js +18 -0
- package/dist/modules/availability/events.js.map +7 -0
- package/dist/modules/availability/index.js +15 -0
- package/dist/modules/availability/index.js.map +7 -0
- package/dist/modules/availability/lib/catalogTarget.js +42 -0
- package/dist/modules/availability/lib/catalogTarget.js.map +7 -0
- package/dist/modules/availability/lib/organizationScope.js +10 -0
- package/dist/modules/availability/lib/organizationScope.js.map +7 -0
- package/dist/modules/availability/lib/policyResolution.js +150 -0
- package/dist/modules/availability/lib/policyResolution.js.map +7 -0
- package/dist/modules/availability/lib/tryResolve.js +11 -0
- package/dist/modules/availability/lib/tryResolve.js.map +7 -0
- package/dist/modules/availability/migrations/Migration20260922095844_availability.js +16 -0
- package/dist/modules/availability/migrations/Migration20260922095844_availability.js.map +7 -0
- package/dist/modules/availability/migrations/Migration20260930120000_availability.js +20 -0
- package/dist/modules/availability/migrations/Migration20260930120000_availability.js.map +7 -0
- package/dist/modules/availability/setup.js +12 -0
- package/dist/modules/availability/setup.js.map +7 -0
- package/dist/modules/catalog/api/categories/bulk-create/route.js +110 -0
- package/dist/modules/catalog/api/categories/bulk-create/route.js.map +7 -0
- package/dist/modules/catalog/api/categories/route.js +56 -8
- package/dist/modules/catalog/api/categories/route.js.map +2 -2
- package/dist/modules/catalog/api/products/bulk-create/route.js +110 -0
- package/dist/modules/catalog/api/products/bulk-create/route.js.map +7 -0
- package/dist/modules/catalog/api/products/route.js +55 -31
- package/dist/modules/catalog/api/products/route.js.map +3 -3
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +2 -6
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +12 -4
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/commands/categories.js +1 -0
- package/dist/modules/catalog/commands/categories.js.map +2 -2
- package/dist/modules/catalog/commands/productDeleteChildren.js +389 -0
- package/dist/modules/catalog/commands/productDeleteChildren.js.map +7 -0
- package/dist/modules/catalog/commands/products.js +57 -19
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +5 -19
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductUomSection.js +26 -29
- package/dist/modules/catalog/components/products/ProductUomSection.js.map +2 -2
- package/dist/modules/catalog/components/products/productForm.js +3 -2
- package/dist/modules/catalog/components/products/productForm.js.map +2 -2
- package/dist/modules/catalog/data/validators.js +15 -0
- package/dist/modules/catalog/data/validators.js.map +2 -2
- package/dist/modules/catalog/di.js +3 -2
- package/dist/modules/catalog/di.js.map +2 -2
- package/dist/modules/catalog/events.js +9 -3
- package/dist/modules/catalog/events.js.map +2 -2
- package/dist/modules/catalog/lib/bulkCreateCategories.js +237 -0
- package/dist/modules/catalog/lib/bulkCreateCategories.js.map +7 -0
- package/dist/modules/catalog/lib/bulkCreateCheckpoint.js +82 -0
- package/dist/modules/catalog/lib/bulkCreateCheckpoint.js.map +7 -0
- package/dist/modules/catalog/lib/bulkCreateMutationGuards.js +39 -0
- package/dist/modules/catalog/lib/bulkCreateMutationGuards.js.map +7 -0
- package/dist/modules/catalog/lib/bulkCreateProducts.js +241 -0
- package/dist/modules/catalog/lib/bulkCreateProducts.js.map +7 -0
- package/dist/modules/catalog/lib/bulkDelete.js +10 -11
- package/dist/modules/catalog/lib/bulkDelete.js.map +2 -2
- package/dist/modules/catalog/lib/catalogQueue.js +14 -0
- package/dist/modules/catalog/lib/catalogQueue.js.map +7 -0
- package/dist/modules/catalog/lib/currencyOptions.js +25 -0
- package/dist/modules/catalog/lib/currencyOptions.js.map +7 -0
- package/dist/modules/catalog/lib/productSearch.js +8 -0
- package/dist/modules/catalog/lib/productSearch.js.map +7 -0
- package/dist/modules/catalog/lib/seeds.js +2 -42
- package/dist/modules/catalog/lib/seeds.js.map +2 -2
- package/dist/modules/catalog/lib/unitLabels.js +53 -0
- package/dist/modules/catalog/lib/unitLabels.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20260914120000.js +29 -0
- package/dist/modules/catalog/migrations/Migration20260914120000.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20260914120100.js +28 -0
- package/dist/modules/catalog/migrations/Migration20260914120100.js.map +7 -0
- package/dist/modules/catalog/workers/catalog-category-bulk-create.js +40 -0
- package/dist/modules/catalog/workers/catalog-category-bulk-create.js.map +7 -0
- package/dist/modules/catalog/workers/catalog-product-bulk-create.js +40 -0
- package/dist/modules/catalog/workers/catalog-product-bulk-create.js.map +7 -0
- package/dist/modules/communication_channels/acl.js +8 -0
- package/dist/modules/communication_channels/acl.js.map +2 -2
- package/dist/modules/communication_channels/api/get/me/channels/route.js +4 -0
- package/dist/modules/communication_channels/api/get/me/channels/route.js.map +2 -2
- package/dist/modules/communication_channels/api/get/oauth/[provider]/callback/route.js +22 -0
- package/dist/modules/communication_channels/api/get/oauth/[provider]/callback/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/[id]/import-history/route.js +4 -4
- package/dist/modules/communication_channels/api/post/channels/[id]/import-history/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js +2 -1
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/connect/credentials/route.js +4 -6
- package/dist/modules/communication_channels/api/post/channels/connect/credentials/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/connect/tenant-credentials/route.js +4 -6
- package/dist/modules/communication_channels/api/post/channels/connect/tenant-credentials/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/test-seed/route.js +90 -20
- package/dist/modules/communication_channels/api/post/test-seed/route.js.map +3 -3
- package/dist/modules/communication_channels/api/put/channels/[id]/visibility/route.js +137 -0
- package/dist/modules/communication_channels/api/put/channels/[id]/visibility/route.js.map +7 -0
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js +175 -107
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js.map +2 -2
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js +2 -1
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
- package/dist/modules/communication_channels/commands/set-channel-visibility.js +88 -0
- package/dist/modules/communication_channels/commands/set-channel-visibility.js.map +7 -0
- package/dist/modules/communication_channels/data/enrichers.js +18 -9
- package/dist/modules/communication_channels/data/enrichers.js.map +2 -2
- package/dist/modules/communication_channels/data/entities.js +4 -0
- package/dist/modules/communication_channels/data/entities.js.map +2 -2
- package/dist/modules/communication_channels/di.js +9 -1
- package/dist/modules/communication_channels/di.js.map +2 -2
- package/dist/modules/communication_channels/events.js +7 -0
- package/dist/modules/communication_channels/events.js.map +2 -2
- package/dist/modules/communication_channels/index.js +1 -1
- package/dist/modules/communication_channels/index.js.map +1 -1
- package/dist/modules/communication_channels/lib/access-control.js +2 -1
- package/dist/modules/communication_channels/lib/access-control.js.map +2 -2
- package/dist/modules/communication_channels/lib/channel-thread-access.js +60 -0
- package/dist/modules/communication_channels/lib/channel-thread-access.js.map +7 -0
- package/dist/modules/communication_channels/lib/credential-refresh.js +11 -2
- package/dist/modules/communication_channels/lib/credential-refresh.js.map +2 -2
- package/dist/modules/communication_channels/lib/inbound-message-origin.js +18 -0
- package/dist/modules/communication_channels/lib/inbound-message-origin.js.map +7 -0
- package/dist/modules/communication_channels/lib/oauth-state.js +37 -0
- package/dist/modules/communication_channels/lib/oauth-state.js.map +2 -2
- package/dist/modules/communication_channels/lib/outbound-delivery-intent.js +12 -0
- package/dist/modules/communication_channels/lib/outbound-delivery-intent.js.map +7 -0
- package/dist/modules/communication_channels/lib/send-as-user.js +1 -1
- package/dist/modules/communication_channels/lib/send-as-user.js.map +2 -2
- package/dist/modules/communication_channels/migrations/Migration20260825141000_communication_channels.js +14 -0
- package/dist/modules/communication_channels/migrations/Migration20260825141000_communication_channels.js.map +7 -0
- package/dist/modules/communication_channels/setup.js +6 -2
- package/dist/modules/communication_channels/setup.js.map +2 -2
- package/dist/modules/communication_channels/subscribers/outbound-bridge.js +8 -2
- package/dist/modules/communication_channels/subscribers/outbound-bridge.js.map +2 -2
- package/dist/modules/communication_channels/workers/gmail-history-sync.js +1 -1
- package/dist/modules/communication_channels/workers/gmail-history-sync.js.map +2 -2
- package/dist/modules/communication_channels/workers/poll-channel.js +1 -1
- package/dist/modules/communication_channels/workers/poll-channel.js.map +2 -2
- package/dist/modules/communication_channels/workers/reaction-processor.js +2 -2
- package/dist/modules/communication_channels/workers/reaction-processor.js.map +2 -2
- package/dist/modules/configs/api/upgrade-actions/route.js +2 -1
- package/dist/modules/configs/api/upgrade-actions/route.js.map +2 -2
- package/dist/modules/configs/cli.js +2 -2
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +28 -6
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/configs/services/upgradeActionsService.js +44 -30
- package/dist/modules/configs/services/upgradeActionsService.js.map +2 -2
- package/dist/modules/currencies/api/currencies/route.js +11 -5
- package/dist/modules/currencies/api/currencies/route.js.map +2 -2
- package/dist/modules/currencies/api/exchange-rates/route.js +11 -5
- package/dist/modules/currencies/api/exchange-rates/route.js.map +2 -2
- package/dist/modules/customer_groups/acl.js +14 -0
- package/dist/modules/customer_groups/acl.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/[id]/terms/route.js +266 -0
- package/dist/modules/customer_groups/api/customer-groups/[id]/terms/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/crud.js +473 -0
- package/dist/modules/customer_groups/api/customer-groups/crud.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/explain-terms/route.js +143 -0
- package/dist/modules/customer_groups/api/customer-groups/explain-terms/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/crud.js +383 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/crud.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/route.js +66 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/adopt/route.js +133 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/adopt/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/route.js +80 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/reorder/route.js +127 -0
- package/dist/modules/customer_groups/api/customer-groups/reorder/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/route.js +62 -0
- package/dist/modules/customer_groups/api/customer-groups/route.js.map +7 -0
- package/dist/modules/customer_groups/api/openapi.js +27 -0
- package/dist/modules/customer_groups/api/openapi.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.js +328 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.meta.js +16 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.js +249 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.meta.js +27 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.js +139 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.meta.js +16 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.js +364 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.meta.js +15 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/cli.js +72 -0
- package/dist/modules/customer_groups/cli.js.map +7 -0
- package/dist/modules/customer_groups/commands/reorderGroups.js +96 -0
- package/dist/modules/customer_groups/commands/reorderGroups.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupDefaultField.js +41 -0
- package/dist/modules/customer_groups/components/CustomerGroupDefaultField.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupParentField.js +156 -0
- package/dist/modules/customer_groups/components/CustomerGroupParentField.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsPriceKindField.js +94 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsPriceKindField.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsSection.js +197 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsSection.js.map +7 -0
- package/dist/modules/customer_groups/components/GroupPickerField.js +116 -0
- package/dist/modules/customer_groups/components/GroupPickerField.js.map +7 -0
- package/dist/modules/customer_groups/components/OrphanBanner.js +75 -0
- package/dist/modules/customer_groups/components/OrphanBanner.js.map +7 -0
- package/dist/modules/customer_groups/components/customerGroupTree.js +57 -0
- package/dist/modules/customer_groups/components/customerGroupTree.js.map +7 -0
- package/dist/modules/customer_groups/data/entities.js +226 -0
- package/dist/modules/customer_groups/data/entities.js.map +7 -0
- package/dist/modules/customer_groups/data/validators.js +153 -0
- package/dist/modules/customer_groups/data/validators.js.map +7 -0
- package/dist/modules/customer_groups/di.js +20 -0
- package/dist/modules/customer_groups/di.js.map +7 -0
- package/dist/modules/customer_groups/events.js +22 -0
- package/dist/modules/customer_groups/events.js.map +7 -0
- package/dist/modules/customer_groups/index.js +15 -0
- package/dist/modules/customer_groups/index.js.map +7 -0
- package/dist/modules/customer_groups/lib/createConflictRecheck.js +29 -0
- package/dist/modules/customer_groups/lib/createConflictRecheck.js.map +7 -0
- package/dist/modules/customer_groups/lib/customerScope.js +81 -0
- package/dist/modules/customer_groups/lib/customerScope.js.map +7 -0
- package/dist/modules/customer_groups/lib/groupEvents.js +31 -0
- package/dist/modules/customer_groups/lib/groupEvents.js.map +7 -0
- package/dist/modules/customer_groups/lib/priceKindScope.js +16 -0
- package/dist/modules/customer_groups/lib/priceKindScope.js.map +7 -0
- package/dist/modules/customer_groups/lib/reconcile.js +161 -0
- package/dist/modules/customer_groups/lib/reconcile.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260922095316_customer_groups.js +27 -0
- package/dist/modules/customer_groups/migrations/Migration20260922095316_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260922103033_customer_groups.js +19 -0
- package/dist/modules/customer_groups/migrations/Migration20260922103033_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260922105444_customer_groups.js +19 -0
- package/dist/modules/customer_groups/migrations/Migration20260922105444_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260923193330_customer_groups.js +19 -0
- package/dist/modules/customer_groups/migrations/Migration20260923193330_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260929083000_customer_groups.js +20 -0
- package/dist/modules/customer_groups/migrations/Migration20260929083000_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/services/customerGroupsService.js +190 -0
- package/dist/modules/customer_groups/services/customerGroupsService.js.map +7 -0
- package/dist/modules/customer_groups/setup.js +13 -0
- package/dist/modules/customer_groups/setup.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/group-picker-field/widget.js +31 -0
- package/dist/modules/customer_groups/widgets/injection/group-picker-field/widget.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-explain-terms.js +166 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-explain-terms.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab/widget.js +17 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab/widget.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab.js +457 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection-table.js +33 -0
- package/dist/modules/customer_groups/widgets/injection-table.js.map +7 -0
- package/dist/modules/customers/acl.js +13 -0
- package/dist/modules/customers/acl.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +9 -1
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +2 -1
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +19 -7
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js +2 -1
- package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +60 -6
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/map/route.js +7 -2
- package/dist/modules/customers/api/deals/map/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/context.js +2 -1
- package/dist/modules/customers/api/dictionaries/context.js.map +2 -2
- package/dist/modules/customers/api/entity-roles-factory.js +3 -2
- package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
- package/dist/modules/customers/api/interactions/[id]/visibility/route.js +2 -1
- package/dist/modules/customers/api/interactions/[id]/visibility/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/cancel/route.js +2 -1
- package/dist/modules/customers/api/interactions/cancel/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/complete/route.js +2 -1
- package/dist/modules/customers/api/interactions/complete/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js +10 -6
- package/dist/modules/customers/api/interactions/conflicts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js +24 -4
- package/dist/modules/customers/api/interactions/counts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +31 -8
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/labels/assign/route.js +2 -1
- package/dist/modules/customers/api/labels/assign/route.js.map +2 -2
- package/dist/modules/customers/api/labels/route.js +3 -2
- package/dist/modules/customers/api/labels/route.js.map +2 -2
- package/dist/modules/customers/api/labels/unassign/route.js +2 -1
- package/dist/modules/customers/api/labels/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/context.js +7 -2
- package/dist/modules/customers/api/people/[id]/companies/context.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/email-share/route.js +218 -0
- package/dist/modules/customers/api/people/[id]/email-share/route.js.map +7 -0
- package/dist/modules/customers/api/people/[id]/email-threads/route.js +11 -2
- package/dist/modules/customers/api/people/[id]/email-threads/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/emails/route.js +2 -1
- package/dist/modules/customers/api/people/[id]/emails/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +20 -19
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/check-phone/route.js +2 -1
- package/dist/modules/customers/api/people/check-phone/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js +3 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/route.js +3 -3
- package/dist/modules/customers/api/pipeline-stages/route.js.map +2 -2
- package/dist/modules/customers/api/pipelines/route.js +3 -3
- package/dist/modules/customers/api/pipelines/route.js.map +2 -2
- package/dist/modules/customers/api/settings/address-format/route.js +2 -1
- package/dist/modules/customers/api/settings/address-format/route.js.map +2 -2
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js +2 -1
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js.map +2 -2
- package/dist/modules/customers/api/settings/stuck-threshold/route.js +2 -1
- package/dist/modules/customers/api/settings/stuck-threshold/route.js.map +2 -2
- package/dist/modules/customers/api/tags/assign/route.js +2 -1
- package/dist/modules/customers/api/tags/assign/route.js.map +2 -2
- package/dist/modules/customers/api/tags/unassign/route.js +2 -1
- package/dist/modules/customers/api/tags/unassign/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js +4 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.js +6 -25
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +21 -18
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/components/ReassignOwnerDialog.js +93 -0
- package/dist/modules/customers/backend/customers/deals/components/ReassignOwnerDialog.js.map +7 -0
- package/dist/modules/customers/backend/customers/deals/page.js +111 -1
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +4 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/commands/addresses.js +83 -15
- package/dist/modules/customers/commands/addresses.js.map +2 -2
- package/dist/modules/customers/commands/companies.js +10 -4
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/customers/commands/emailConversationShares.js +177 -0
- package/dist/modules/customers/commands/emailConversationShares.js.map +7 -0
- package/dist/modules/customers/commands/index.js +1 -0
- package/dist/modules/customers/commands/index.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js +48 -23
- package/dist/modules/customers/commands/interactions.js.map +3 -3
- package/dist/modules/customers/commands/people.js +3 -2
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/commands/shared.js +4 -0
- package/dist/modules/customers/commands/shared.js.map +2 -2
- package/dist/modules/customers/components/calendar/types.js.map +1 -1
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js +81 -354
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
- package/dist/modules/customers/components/detail/CreatePersonDialog.js +12 -11
- package/dist/modules/customers/components/detail/CreatePersonDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +73 -5
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/DealOwnerSelect.js +96 -0
- package/dist/modules/customers/components/detail/DealOwnerSelect.js.map +7 -0
- package/dist/modules/customers/components/detail/DealPeopleSection.js +206 -0
- package/dist/modules/customers/components/detail/DealPeopleSection.js.map +7 -0
- package/dist/modules/customers/components/detail/DealsSection.js +8 -14
- package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
- package/dist/modules/customers/components/detail/LinkedPeopleSection.js +342 -0
- package/dist/modules/customers/components/detail/LinkedPeopleSection.js.map +7 -0
- package/dist/modules/customers/components/detail/PersonCard.js +5 -2
- package/dist/modules/customers/components/detail/PersonCard.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonEmailShareControl.js +190 -0
- package/dist/modules/customers/components/detail/PersonEmailShareControl.js.map +7 -0
- package/dist/modules/customers/components/detail/PersonEmailThreadsTab.js +17 -0
- package/dist/modules/customers/components/detail/PersonEmailThreadsTab.js.map +2 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +5 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/create/CreateDealForm.js +19 -0
- package/dist/modules/customers/components/detail/create/CreateDealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/create/DealDetailsFields.js +11 -0
- package/dist/modules/customers/components/detail/create/DealDetailsFields.js.map +2 -2
- package/dist/modules/customers/components/detail/create/DealSectionCard.js +2 -2
- package/dist/modules/customers/components/detail/create/DealSectionCard.js.map +2 -2
- package/dist/modules/customers/components/detail/create/dealFormTypes.js +1 -0
- package/dist/modules/customers/components/detail/create/dealFormTypes.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js +1 -1
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js.map +2 -2
- package/dist/modules/customers/components/formConfig.js +2 -0
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/customers/components/linking/LinkEntityDialog.js +8 -0
- package/dist/modules/customers/components/linking/LinkEntityDialog.js.map +2 -2
- package/dist/modules/customers/components/linking/adapters/personAdapter.js +3 -0
- package/dist/modules/customers/components/linking/adapters/personAdapter.js.map +2 -2
- package/dist/modules/customers/data/enrichers.js +40 -2
- package/dist/modules/customers/data/enrichers.js.map +2 -2
- package/dist/modules/customers/data/entities.js +56 -0
- package/dist/modules/customers/data/entities.js.map +2 -2
- package/dist/modules/customers/data/validators.js +11 -0
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/events.js +6 -1
- package/dist/modules/customers/events.js.map +2 -2
- package/dist/modules/customers/lib/assignableStaff.js +14 -0
- package/dist/modules/customers/lib/assignableStaff.js.map +2 -2
- package/dist/modules/customers/lib/calendar/editorPayload.js +17 -13
- package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
- package/dist/modules/customers/lib/calendar/mapItem.js +1 -0
- package/dist/modules/customers/lib/calendar/mapItem.js.map +2 -2
- package/dist/modules/customers/lib/conversationShares.js +126 -0
- package/dist/modules/customers/lib/conversationShares.js.map +7 -0
- package/dist/modules/customers/lib/dealsOrganizationScope.js +5 -3
- package/dist/modules/customers/lib/dealsOrganizationScope.js.map +2 -2
- package/dist/modules/customers/lib/interactionRequestContext.js +2 -1
- package/dist/modules/customers/lib/interactionRequestContext.js.map +2 -2
- package/dist/modules/customers/lib/link-channel-message-handler.js +19 -9
- package/dist/modules/customers/lib/link-channel-message-handler.js.map +2 -2
- package/dist/modules/customers/lib/personDetailCacheTags.js +32 -0
- package/dist/modules/customers/lib/personDetailCacheTags.js.map +7 -0
- package/dist/modules/customers/lib/personEmailThreads.js +26 -5
- package/dist/modules/customers/lib/personEmailThreads.js.map +2 -2
- package/dist/modules/customers/lib/reassignDealOwner.js +25 -0
- package/dist/modules/customers/lib/reassignDealOwner.js.map +7 -0
- package/dist/modules/customers/lib/userNames.js +26 -0
- package/dist/modules/customers/lib/userNames.js.map +7 -0
- package/dist/modules/customers/lib/visibilityFilter.js +70 -2
- package/dist/modules/customers/lib/visibilityFilter.js.map +2 -2
- package/dist/modules/customers/migrations/Migration20260825120000_customers.js +18 -0
- package/dist/modules/customers/migrations/Migration20260825120000_customers.js.map +7 -0
- package/dist/modules/customers/migrations/Migration20260825140000_customers.js +27 -0
- package/dist/modules/customers/migrations/Migration20260825140000_customers.js.map +7 -0
- package/dist/modules/customers/setup.js +1 -0
- package/dist/modules/customers/setup.js.map +2 -2
- package/dist/modules/customers/subscribers/channel-visibility-changed.js +16 -0
- package/dist/modules/customers/subscribers/channel-visibility-changed.js.map +7 -0
- package/dist/modules/dashboards/api/widgets/data/batch/route.js +3 -8
- package/dist/modules/dashboards/api/widgets/data/batch/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/route.js +10 -15
- package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
- package/dist/modules/dashboards/lib/aggregations.js +1 -1
- package/dist/modules/dashboards/lib/aggregations.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetScope.js +2 -7
- package/dist/modules/dashboards/lib/widgetScope.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +4 -1
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +497 -329
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +248 -113
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +3 -3
- package/dist/modules/data_sync/components/useDataSyncRunAccess.js +17 -0
- package/dist/modules/data_sync/components/useDataSyncRunAccess.js.map +7 -0
- package/dist/modules/data_sync/lib/resume-point.js +21 -0
- package/dist/modules/data_sync/lib/resume-point.js.map +7 -0
- package/dist/modules/data_sync/lib/start-run.js +52 -2
- package/dist/modules/data_sync/lib/start-run.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-run-service.js +22 -33
- package/dist/modules/data_sync/lib/sync-run-service.js.map +3 -3
- package/dist/modules/devices/api/[id]/route.js +3 -2
- package/dist/modules/devices/api/[id]/route.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/route.js +2 -1
- package/dist/modules/devices/api/admin/devices/route.js.map +2 -2
- package/dist/modules/devices/api/route.js +2 -1
- package/dist/modules/devices/api/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/context.js +2 -1
- package/dist/modules/dictionaries/api/context.js.map +2 -2
- package/dist/modules/dictionaries/api/route.js +4 -0
- package/dist/modules/dictionaries/api/route.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionariesManager.js +4 -3
- package/dist/modules/dictionaries/components/DictionariesManager.js.map +2 -2
- package/dist/modules/dictionaries/data/validators.js +3 -1
- package/dist/modules/dictionaries/data/validators.js.map +2 -2
- package/dist/modules/directory/api/organization-branding/route.js +10 -1
- package/dist/modules/directory/api/organization-branding/route.js.map +2 -2
- package/dist/modules/directory/api/organizations/route.js +1 -1
- package/dist/modules/directory/api/organizations/route.js.map +1 -1
- package/dist/modules/directory/backend/directory/branding/page.js +17 -4
- package/dist/modules/directory/backend/directory/branding/page.js.map +3 -3
- package/dist/modules/directory/commands/organizations.js +136 -74
- package/dist/modules/directory/commands/organizations.js.map +2 -2
- package/dist/modules/directory/lib/hierarchy.js +19 -1
- package/dist/modules/directory/lib/hierarchy.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js +66 -12
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/directory/utils/organizationScopeFilter.js +7 -4
- package/dist/modules/directory/utils/organizationScopeFilter.js.map +2 -2
- package/dist/modules/directory/utils/organizationScopeGuard.js +6 -2
- package/dist/modules/directory/utils/organizationScopeGuard.js.map +2 -2
- package/dist/modules/entities/api/encryption.js +68 -25
- package/dist/modules/entities/api/encryption.js.map +2 -2
- package/dist/modules/entities/api/records.js +9 -8
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/cli.js +33 -22
- package/dist/modules/entities/cli.js.map +2 -2
- package/dist/modules/entities/data/entities.js +8 -0
- package/dist/modules/entities/data/entities.js.map +2 -2
- package/dist/modules/entities/lib/definition-scope.js +3 -1
- package/dist/modules/entities/lib/definition-scope.js.map +2 -2
- package/dist/modules/entities/lib/encryption-maps.js +117 -0
- package/dist/modules/entities/lib/encryption-maps.js.map +7 -0
- package/dist/modules/entities/lib/helpers.js +30 -6
- package/dist/modules/entities/lib/helpers.js.map +2 -2
- package/dist/modules/entities/migrations/Migration20260910120000.js +17 -0
- package/dist/modules/entities/migrations/Migration20260910120000.js.map +7 -0
- package/dist/modules/entities/migrations/Migration20261004120000_encryption_map_scope_uniqueness.js +130 -0
- package/dist/modules/entities/migrations/Migration20261004120000_encryption_map_scope_uniqueness.js.map +7 -0
- package/dist/modules/eudr/api/dashboard/widgets/compliance-overview/route.js +2 -1
- package/dist/modules/eudr/api/dashboard/widgets/compliance-overview/route.js.map +2 -2
- package/dist/modules/eudr/api/plots/import/route.js +2 -1
- package/dist/modules/eudr/api/plots/import/route.js.map +2 -2
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js +2 -1
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js.map +2 -2
- package/dist/modules/eudr/api/product-mappings/suggestions/route.js +2 -1
- package/dist/modules/eudr/api/product-mappings/suggestions/route.js.map +2 -2
- package/dist/modules/eudr/api/reports/annual/route.js +2 -1
- package/dist/modules/eudr/api/reports/annual/route.js.map +2 -2
- package/dist/modules/eudr/api/statements/[id]/export/route.js +2 -1
- package/dist/modules/eudr/api/statements/[id]/export/route.js.map +2 -2
- package/dist/modules/eudr/api/statements/[id]/readiness/route.js +2 -1
- package/dist/modules/eudr/api/statements/[id]/readiness/route.js.map +2 -2
- package/dist/modules/eudr/api/suppliers/compliance/route.js +2 -1
- package/dist/modules/eudr/api/suppliers/compliance/route.js.map +2 -2
- package/dist/modules/feature_toggles/commands/global.js +13 -13
- package/dist/modules/feature_toggles/commands/global.js.map +2 -2
- package/dist/modules/feature_toggles/lib/feature-flag-check.js +8 -2
- package/dist/modules/feature_toggles/lib/feature-flag-check.js.map +2 -2
- package/dist/modules/forms/acl.js +14 -0
- package/dist/modules/forms/acl.js.map +7 -0
- package/dist/modules/forms/api/[id]/analytics/route.js +113 -0
- package/dist/modules/forms/api/[id]/analytics/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/distributions/route.js +176 -0
- package/dist/modules/forms/api/[id]/distributions/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/route.js +225 -0
- package/dist/modules/forms/api/[id]/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/run/context/route.js +115 -0
- package/dist/modules/forms/api/[id]/run/context/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/run/submissions/route.js +109 -0
- package/dist/modules/forms/api/[id]/run/submissions/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/submissions/route.js +83 -0
- package/dist/modules/forms/api/[id]/submissions/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/theme-logo/route.js +117 -0
- package/dist/modules/forms/api/[id]/theme-logo/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/diff/route.js +125 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/diff/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/publish/route.js +99 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/publish/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/route.js +176 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/fork/route.js +92 -0
- package/dist/modules/forms/api/[id]/versions/fork/route.js.map +7 -0
- package/dist/modules/forms/api/attachment-helpers.js +111 -0
- package/dist/modules/forms/api/attachment-helpers.js.map +7 -0
- package/dist/modules/forms/api/by-key/[key]/active/route.js +140 -0
- package/dist/modules/forms/api/by-key/[key]/active/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/route.js +84 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/send/route.js +88 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/send/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/route.js +183 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/route.js +191 -0
- package/dist/modules/forms/api/distributions/[distributionId]/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/attachments/route.js +91 -0
- package/dist/modules/forms/api/form-submissions/[id]/attachments/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/resume-token/route.js +110 -0
- package/dist/modules/forms/api/form-submissions/[id]/resume-token/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/route.js +146 -0
- package/dist/modules/forms/api/form-submissions/[id]/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/submit/route.js +74 -0
- package/dist/modules/forms/api/form-submissions/[id]/submit/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/by-subject/[subject_type]/[subject_id]/route.js +76 -0
- package/dist/modules/forms/api/form-submissions/by-subject/[subject_type]/[subject_id]/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/route.js +113 -0
- package/dist/modules/forms/api/form-submissions/route.js.map +7 -0
- package/dist/modules/forms/api/helpers.js +124 -0
- package/dist/modules/forms/api/helpers.js.map +7 -0
- package/dist/modules/forms/api/public/distributions/[slug]/embed-policy/route.js +47 -0
- package/dist/modules/forms/api/public/distributions/[slug]/embed-policy/route.js.map +7 -0
- package/dist/modules/forms/api/public/distributions/[slug]/route.js +81 -0
- package/dist/modules/forms/api/public/distributions/[slug]/route.js.map +7 -0
- package/dist/modules/forms/api/public/embed-loader/route.js +116 -0
- package/dist/modules/forms/api/public/embed-loader/route.js.map +7 -0
- package/dist/modules/forms/api/public/invitations/[token]/route.js +87 -0
- package/dist/modules/forms/api/public/invitations/[token]/route.js.map +7 -0
- package/dist/modules/forms/api/public/rate-limit.js +54 -0
- package/dist/modules/forms/api/public/rate-limit.js.map +7 -0
- package/dist/modules/forms/api/public/start/route.js +142 -0
- package/dist/modules/forms/api/public/start/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/[attachmentId]/route.js +67 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/[attachmentId]/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/route.js +85 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/pdf/route.js +72 -0
- package/dist/modules/forms/api/public/submissions/[id]/pdf/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/route.js +154 -0
- package/dist/modules/forms/api/public/submissions/[id]/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/submit/route.js +127 -0
- package/dist/modules/forms/api/public/submissions/[id]/submit/route.js.map +7 -0
- package/dist/modules/forms/api/route.js +216 -0
- package/dist/modules/forms/api/route.js.map +7 -0
- package/dist/modules/forms/api/runtime-helpers.js +149 -0
- package/dist/modules/forms/api/runtime-helpers.js.map +7 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/consents/route.js +137 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/consents/route.js.map +7 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/export/route.js +101 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/export/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/access-audit/route.js +76 -0
- package/dist/modules/forms/api/submissions/[submissionId]/access-audit/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/[actorId]/route.js +56 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/[actorId]/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/route.js +76 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/anonymize/route.js +107 -0
- package/dist/modules/forms/api/submissions/[submissionId]/anonymize/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/attachments/[attachmentId]/route.js +73 -0
- package/dist/modules/forms/api/submissions/[submissionId]/attachments/[attachmentId]/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/export/route.js +90 -0
- package/dist/modules/forms/api/submissions/[submissionId]/export/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/pdf/route.js +91 -0
- package/dist/modules/forms/api/submissions/[submissionId]/pdf/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/reopen/route.js +55 -0
- package/dist/modules/forms/api/submissions/[submissionId]/reopen/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/revisions/route.js +61 -0
- package/dist/modules/forms/api/submissions/[submissionId]/revisions/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/route.js +75 -0
- package/dist/modules/forms/api/submissions/[submissionId]/route.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/FormStudio.js +2811 -0
- package/dist/modules/forms/backend/forms/[id]/FormStudio.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.js +214 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.meta.js +19 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.js +12 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.meta.js +19 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.js +152 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.meta.js +15 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/page.js +13 -0
- package/dist/modules/forms/backend/forms/[id]/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/page.meta.js +15 -0
- package/dist/modules/forms/backend/forms/[id]/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/YesNoRow.js +51 -0
- package/dist/modules/forms/backend/forms/[id]/studio/YesNoRow.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/autosave-guard.js +21 -0
- package/dist/modules/forms/backend/forms/[id]/studio/autosave-guard.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DragOverlayCard.js +18 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DragOverlayCard.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DropIndicator.js +41 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DropIndicator.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FieldRow.js +277 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FieldRow.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FormCanvas.js +196 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FormCanvas.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/GridSlot.js +151 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/GridSlot.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/SectionContainer.js +340 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/SectionContainer.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/grid-collision.js +24 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/grid-collision.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/keyboard-coordinates.js +91 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/keyboard-coordinates.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/overlay-size.js +11 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/overlay-size.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/resize-math.js +27 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/resize-math.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/row-layout.js +80 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/row-layout.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/ConditionBuilder.js +210 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/ConditionBuilder.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/HiddenFieldsPanel.js +91 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/HiddenFieldsPanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/JumpsEditor.js +201 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/JumpsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/RecallTokenPicker.js +66 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/RecallTokenPicker.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/VariablesPanel.js +223 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/VariablesPanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/condition-model.js +151 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/condition-model.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/lucide-icons.js +88 -0
- package/dist/modules/forms/backend/forms/[id]/studio/lucide-icons.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormAppearancePanel.js +493 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormAppearancePanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormPalettePanel.js +44 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormPalettePanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/InputParametersTab.js +350 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/InputParametersTab.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/PaletteCard.js +40 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/PaletteCard.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/RolesEditor.js +202 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/RolesEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/entries.js +66 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/entries.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/PreviewSurface.js +1200 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/PreviewSurface.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/ViewportFrame.js +34 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/ViewportFrame.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/recall.js +76 -0
- package/dist/modules/forms/backend/forms/[id]/studio/recall.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/schema-helpers.js +1693 -0
- package/dist/modules/forms/backend/forms/[id]/studio/schema-helpers.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/BackgroundControl.js +127 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/BackgroundControl.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/ColorControl.js +181 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/ColorControl.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/contrast.js +75 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/contrast.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/presets.js +91 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/presets.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/type-label.js +11 -0
- package/dist/modules/forms/backend/forms/[id]/studio/type-label.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/types.js +1 -0
- package/dist/modules/forms/backend/forms/[id]/studio/types.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/undo-controller.js +43 -0
- package/dist/modules/forms/backend/forms/[id]/studio/undo-controller.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/FileConstraintsEditor.js +74 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/FileConstraintsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/GroupConfigEditor.js +134 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/GroupConfigEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/LengthRangeEditor.js +61 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/LengthRangeEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixColumnsEditor.js +149 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixColumnsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixRowsEditor.js +168 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixRowsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MessageOverridesEditor.js +64 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MessageOverridesEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NpsAnchorsEditor.js +52 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NpsAnchorsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NumberRangeEditor.js +59 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NumberRangeEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/OpinionIconSelect.js +31 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/OpinionIconSelect.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/PatternEditor.js +105 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/PatternEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/RankingExhaustiveSwitch.js +15 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/RankingExhaustiveSwitch.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/SignatureConfigEditor.js +75 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/SignatureConfigEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/ValidationPanel.js +293 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/ValidationPanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/RowBadges.js +42 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/RowBadges.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/SubmissionDrawer.js +473 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/SubmissionDrawer.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.js +208 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.meta.js +12 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/create/page.js +101 -0
- package/dist/modules/forms/backend/forms/create/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/create/page.meta.js +15 -0
- package/dist/modules/forms/backend/forms/create/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/page.js +227 -0
- package/dist/modules/forms/backend/forms/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/page.meta.js +33 -0
- package/dist/modules/forms/backend/forms/page.meta.js.map +7 -0
- package/dist/modules/forms/commands/distribution.js +417 -0
- package/dist/modules/forms/commands/distribution.js.map +7 -0
- package/dist/modules/forms/commands/form-version.js +640 -0
- package/dist/modules/forms/commands/form-version.js.map +7 -0
- package/dist/modules/forms/commands/form.js +406 -0
- package/dist/modules/forms/commands/form.js.map +7 -0
- package/dist/modules/forms/commands/index.js +11 -0
- package/dist/modules/forms/commands/index.js.map +7 -0
- package/dist/modules/forms/commands/invitation.js +329 -0
- package/dist/modules/forms/commands/invitation.js.map +7 -0
- package/dist/modules/forms/commands/shared.js +151 -0
- package/dist/modules/forms/commands/shared.js.map +7 -0
- package/dist/modules/forms/commands/submission.js +132 -0
- package/dist/modules/forms/commands/submission.js.map +7 -0
- package/dist/modules/forms/data/entities.js +654 -0
- package/dist/modules/forms/data/entities.js.map +7 -0
- package/dist/modules/forms/data/validators.js +254 -0
- package/dist/modules/forms/data/validators.js.map +7 -0
- package/dist/modules/forms/di.js +199 -0
- package/dist/modules/forms/di.js.map +7 -0
- package/dist/modules/forms/encryption.js +15 -0
- package/dist/modules/forms/encryption.js.map +7 -0
- package/dist/modules/forms/events-payloads.js +81 -0
- package/dist/modules/forms/events-payloads.js.map +7 -0
- package/dist/modules/forms/events.js +33 -0
- package/dist/modules/forms/events.js.map +7 -0
- package/dist/modules/forms/extension-points.js +36 -0
- package/dist/modules/forms/extension-points.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.js +33 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.js +41 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.meta.js +11 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.js +105 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.js.map +7 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/f/[slug]/page.js +12 -0
- package/dist/modules/forms/frontend/f/[slug]/page.js.map +7 -0
- package/dist/modules/forms/frontend/f/[slug]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/f/[slug]/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.js +62 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.js.map +7 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.meta.js +11 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/i/[token]/page.js +12 -0
- package/dist/modules/forms/frontend/i/[token]/page.js.map +7 -0
- package/dist/modules/forms/frontend/i/[token]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/i/[token]/page.meta.js.map +7 -0
- package/dist/modules/forms/index.js +20 -0
- package/dist/modules/forms/index.js.map +7 -0
- package/dist/modules/forms/lib/embed-frame-policy.js +68 -0
- package/dist/modules/forms/lib/embed-frame-policy.js.map +7 -0
- package/dist/modules/forms/lib/form-definition-slicing.js +38 -0
- package/dist/modules/forms/lib/form-definition-slicing.js.map +7 -0
- package/dist/modules/forms/lib/log-redaction.js +38 -0
- package/dist/modules/forms/lib/log-redaction.js.map +7 -0
- package/dist/modules/forms/lib/navigable-url.js +24 -0
- package/dist/modules/forms/lib/navigable-url.js.map +7 -0
- package/dist/modules/forms/lib/retention.js +20 -0
- package/dist/modules/forms/lib/retention.js.map +7 -0
- package/dist/modules/forms/lib/runtime-principal.js +59 -0
- package/dist/modules/forms/lib/runtime-principal.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260508135459_forms.js +17 -0
- package/dist/modules/forms/migrations/Migration20260508135459_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260508140932_forms.js +23 -0
- package/dist/modules/forms/migrations/Migration20260508140932_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260508155737_forms.js +15 -0
- package/dist/modules/forms/migrations/Migration20260508155737_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260520120000_forms.js +23 -0
- package/dist/modules/forms/migrations/Migration20260520120000_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260521090000_forms.js +13 -0
- package/dist/modules/forms/migrations/Migration20260521090000_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260521120000_forms.js +17 -0
- package/dist/modules/forms/migrations/Migration20260521120000_forms.js.map +7 -0
- package/dist/modules/forms/runner/FormRunner.js +786 -0
- package/dist/modules/forms/runner/FormRunner.js.map +7 -0
- package/dist/modules/forms/runner/MatrixField.js +150 -0
- package/dist/modules/forms/runner/MatrixField.js.map +7 -0
- package/dist/modules/forms/runner/RankingField.js +131 -0
- package/dist/modules/forms/runner/RankingField.js.map +7 -0
- package/dist/modules/forms/runner/ScaleField.js +78 -0
- package/dist/modules/forms/runner/ScaleField.js.map +7 -0
- package/dist/modules/forms/runner/SignatureField.js +132 -0
- package/dist/modules/forms/runner/SignatureField.js.map +7 -0
- package/dist/modules/forms/runner/tamper-check.js +85 -0
- package/dist/modules/forms/runner/tamper-check.js.map +7 -0
- package/dist/modules/forms/schema/address-countries.js +43 -0
- package/dist/modules/forms/schema/address-countries.js.map +7 -0
- package/dist/modules/forms/schema/field-type-patterns.js +15 -0
- package/dist/modules/forms/schema/field-type-patterns.js.map +7 -0
- package/dist/modules/forms/schema/field-type-registry-advanced.js +32 -0
- package/dist/modules/forms/schema/field-type-registry-advanced.js.map +7 -0
- package/dist/modules/forms/schema/field-type-registry.js +625 -0
- package/dist/modules/forms/schema/field-type-registry.js.map +7 -0
- package/dist/modules/forms/schema/file-field.js +64 -0
- package/dist/modules/forms/schema/file-field.js.map +7 -0
- package/dist/modules/forms/schema/group-field.js +143 -0
- package/dist/modules/forms/schema/group-field.js.map +7 -0
- package/dist/modules/forms/schema/jsonlogic-grammar.js +66 -0
- package/dist/modules/forms/schema/jsonlogic-grammar.js.map +7 -0
- package/dist/modules/forms/schema/jsonschema-extensions.js +739 -0
- package/dist/modules/forms/schema/jsonschema-extensions.js.map +7 -0
- package/dist/modules/forms/schema/layout-catalog.js +38 -0
- package/dist/modules/forms/schema/layout-catalog.js.map +7 -0
- package/dist/modules/forms/schema/signature-field.js +67 -0
- package/dist/modules/forms/schema/signature-field.js.map +7 -0
- package/dist/modules/forms/schema/style-extensions.js +77 -0
- package/dist/modules/forms/schema/style-extensions.js.map +7 -0
- package/dist/modules/forms/schema/style-validators.js +181 -0
- package/dist/modules/forms/schema/style-validators.js.map +7 -0
- package/dist/modules/forms/services/access-audit-logger.js +179 -0
- package/dist/modules/forms/services/access-audit-logger.js.map +7 -0
- package/dist/modules/forms/services/analytics-service.js +306 -0
- package/dist/modules/forms/services/analytics-service.js.map +7 -0
- package/dist/modules/forms/services/anonymize-service.js +123 -0
- package/dist/modules/forms/services/anonymize-service.js.map +7 -0
- package/dist/modules/forms/services/attachment-service.js +123 -0
- package/dist/modules/forms/services/attachment-service.js.map +7 -0
- package/dist/modules/forms/services/captcha-verifier.js +76 -0
- package/dist/modules/forms/services/captcha-verifier.js.map +7 -0
- package/dist/modules/forms/services/consent-record-service.js +96 -0
- package/dist/modules/forms/services/consent-record-service.js.map +7 -0
- package/dist/modules/forms/services/distribution-service.js +366 -0
- package/dist/modules/forms/services/distribution-service.js.map +7 -0
- package/dist/modules/forms/services/distribution-token.js +93 -0
- package/dist/modules/forms/services/distribution-token.js.map +7 -0
- package/dist/modules/forms/services/encryption-service.js +328 -0
- package/dist/modules/forms/services/encryption-service.js.map +7 -0
- package/dist/modules/forms/services/export-service.js +210 -0
- package/dist/modules/forms/services/export-service.js.map +7 -0
- package/dist/modules/forms/services/field-validation-service.js +168 -0
- package/dist/modules/forms/services/field-validation-service.js.map +7 -0
- package/dist/modules/forms/services/form-logic-evaluator.js +517 -0
- package/dist/modules/forms/services/form-logic-evaluator.js.map +7 -0
- package/dist/modules/forms/services/form-version-compiler.js +518 -0
- package/dist/modules/forms/services/form-version-compiler.js.map +7 -0
- package/dist/modules/forms/services/form-version-differ.js +89 -0
- package/dist/modules/forms/services/form-version-differ.js.map +7 -0
- package/dist/modules/forms/services/jsonlogic-evaluator.js +171 -0
- package/dist/modules/forms/services/jsonlogic-evaluator.js.map +7 -0
- package/dist/modules/forms/services/pdf-snapshot-service.js +526 -0
- package/dist/modules/forms/services/pdf-snapshot-service.js.map +7 -0
- package/dist/modules/forms/services/prefill-resolver.js +53 -0
- package/dist/modules/forms/services/prefill-resolver.js.map +7 -0
- package/dist/modules/forms/services/role-policy-service.js +55 -0
- package/dist/modules/forms/services/role-policy-service.js.map +7 -0
- package/dist/modules/forms/services/style-compiler.js +234 -0
- package/dist/modules/forms/services/style-compiler.js.map +7 -0
- package/dist/modules/forms/services/submission-service.js +858 -0
- package/dist/modules/forms/services/submission-service.js.map +7 -0
- package/dist/modules/forms/services/upload-scanner.js +9 -0
- package/dist/modules/forms/services/upload-scanner.js.map +7 -0
- package/dist/modules/forms/services/upload-validation.js +54 -0
- package/dist/modules/forms/services/upload-validation.js.map +7 -0
- package/dist/modules/forms/services/visibility-resolver.js +30 -0
- package/dist/modules/forms/services/visibility-resolver.js.map +7 -0
- package/dist/modules/forms/setup.js +18 -0
- package/dist/modules/forms/setup.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-consent-projector.js +58 -0
- package/dist/modules/forms/subscribers/forms-consent-projector.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-pdf-snapshot.js +68 -0
- package/dist/modules/forms/subscribers/forms-pdf-snapshot.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge-anonymized.js +29 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge-anonymized.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge.js +35 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge.js.map +7 -0
- package/dist/modules/forms/subscribers/invitation-email.js +100 -0
- package/dist/modules/forms/subscribers/invitation-email.js.map +7 -0
- package/dist/modules/forms/translations.js +10 -0
- package/dist/modules/forms/translations.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/CreateDistributionDialog.js +376 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/CreateDistributionDialog.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/DistributionsPanel.js +313 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/DistributionsPanel.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/EmbedSettingsDialog.js +263 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/EmbedSettingsDialog.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/RecipientsTable.js +373 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/RecipientsTable.js.map +7 -0
- package/dist/modules/forms/ui/public/EmbeddedForm.js +166 -0
- package/dist/modules/forms/ui/public/EmbeddedForm.js.map +7 -0
- package/dist/modules/forms/ui/public/FormRunner.js +359 -0
- package/dist/modules/forms/ui/public/FormRunner.js.map +7 -0
- package/dist/modules/forms/ui/public/FormTrigger.js +45 -0
- package/dist/modules/forms/ui/public/FormTrigger.js.map +7 -0
- package/dist/modules/forms/ui/public/PublicFormRunnerPage.js +14 -0
- package/dist/modules/forms/ui/public/PublicFormRunnerPage.js.map +7 -0
- package/dist/modules/forms/ui/public/components/CompletionScreen.js +55 -0
- package/dist/modules/forms/ui/public/components/CompletionScreen.js.map +7 -0
- package/dist/modules/forms/ui/public/components/LocaleSwitch.js +28 -0
- package/dist/modules/forms/ui/public/components/LocaleSwitch.js.map +7 -0
- package/dist/modules/forms/ui/public/components/ResumeGate.js +52 -0
- package/dist/modules/forms/ui/public/components/ResumeGate.js.map +7 -0
- package/dist/modules/forms/ui/public/components/ReviewStep.js +90 -0
- package/dist/modules/forms/ui/public/components/ReviewStep.js.map +7 -0
- package/dist/modules/forms/ui/public/components/SaveIndicator.js +65 -0
- package/dist/modules/forms/ui/public/components/SaveIndicator.js.map +7 -0
- package/dist/modules/forms/ui/public/components/SectionStepper.js +52 -0
- package/dist/modules/forms/ui/public/components/SectionStepper.js.map +7 -0
- package/dist/modules/forms/ui/public/index.js +38 -0
- package/dist/modules/forms/ui/public/index.js.map +7 -0
- package/dist/modules/forms/ui/public/renderers/index.js +737 -0
- package/dist/modules/forms/ui/public/renderers/index.js.map +7 -0
- package/dist/modules/forms/ui/public/state/logic-derivation.js +42 -0
- package/dist/modules/forms/ui/public/state/logic-derivation.js.map +7 -0
- package/dist/modules/forms/ui/public/state/runtime-client.js +306 -0
- package/dist/modules/forms/ui/public/state/runtime-client.js.map +7 -0
- package/dist/modules/forms/ui/public/state/useAutosave.js +64 -0
- package/dist/modules/forms/ui/public/state/useAutosave.js.map +7 -0
- package/dist/modules/forms/ui/public/state/useFormRunner.js +394 -0
- package/dist/modules/forms/ui/public/state/useFormRunner.js.map +7 -0
- package/dist/modules/forms/ui/public/style/LogoHeader.js +33 -0
- package/dist/modules/forms/ui/public/style/LogoHeader.js.map +7 -0
- package/dist/modules/forms/ui/public/style/applyStyle.js +12 -0
- package/dist/modules/forms/ui/public/style/applyStyle.js.map +7 -0
- package/dist/modules/forms/ui/public/types.js +18 -0
- package/dist/modules/forms/ui/public/types.js.map +7 -0
- package/dist/modules/forms/widgets/injection/access-audit-panel/widget.js +100 -0
- package/dist/modules/forms/widgets/injection/access-audit-panel/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/anonymize-button/widget.js +148 -0
- package/dist/modules/forms/widgets/injection/anonymize-button/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/audit-format.js +33 -0
- package/dist/modules/forms/widgets/injection/audit-format.js.map +7 -0
- package/dist/modules/forms/widgets/injection/context.js +5 -0
- package/dist/modules/forms/widgets/injection/context.js.map +7 -0
- package/dist/modules/forms/widgets/injection/embedded-form/widget.js +52 -0
- package/dist/modules/forms/widgets/injection/embedded-form/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/pdf-download-button/widget.js +83 -0
- package/dist/modules/forms/widgets/injection/pdf-download-button/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/self-audit-footer/widget.js +38 -0
- package/dist/modules/forms/widgets/injection/self-audit-footer/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection-table.js +32 -0
- package/dist/modules/forms/widgets/injection-table.js.map +7 -0
- package/dist/modules/forms/workers/pdf-snapshot.js +60 -0
- package/dist/modules/forms/workers/pdf-snapshot.js.map +7 -0
- package/dist/modules/forms/workers/retention-purge.js +112 -0
- package/dist/modules/forms/workers/retention-purge.js.map +7 -0
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js +7 -1
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js.map +2 -2
- package/dist/modules/inbox_ops/data/validators.js +2 -2
- package/dist/modules/inbox_ops/data/validators.js.map +2 -2
- package/dist/modules/inbox_ops/lib/llmProvider.js +5 -1
- package/dist/modules/inbox_ops/lib/llmProvider.js.map +2 -2
- package/dist/modules/inbox_ops/widgets/notifications/ProposalCreatedRenderer.js +2 -2
- package/dist/modules/inbox_ops/widgets/notifications/ProposalCreatedRenderer.js.map +2 -2
- package/dist/modules/integrations/di.js +3 -1
- package/dist/modules/integrations/di.js.map +2 -2
- package/dist/modules/integrations/lib/credentials-service.js +29 -36
- package/dist/modules/integrations/lib/credentials-service.js.map +2 -2
- package/dist/modules/messages/api/[id]/attachments/route.js +7 -3
- package/dist/modules/messages/api/[id]/attachments/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/forward-preview/route.js +4 -3
- package/dist/modules/messages/api/[id]/forward-preview/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +29 -3
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/route.js +91 -2
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/commands/messages.js +40 -6
- package/dist/modules/messages/commands/messages.js.map +2 -2
- package/dist/modules/messages/components/ComposeMessagePageClient.js +24 -1
- package/dist/modules/messages/components/ComposeMessagePageClient.js.map +2 -2
- package/dist/modules/messages/data/validators.js +11 -1
- package/dist/modules/messages/data/validators.js.map +2 -2
- package/dist/modules/messages/lib/channelThreadAccess.js +30 -0
- package/dist/modules/messages/lib/channelThreadAccess.js.map +7 -0
- package/dist/modules/messages/lib/composeSenderDelegation.js +87 -0
- package/dist/modules/messages/lib/composeSenderDelegation.js.map +7 -0
- package/dist/modules/messages/lib/composeSenderOptions.js +24 -0
- package/dist/modules/messages/lib/composeSenderOptions.js.map +7 -0
- package/dist/modules/messages/lib/email-sender.js +1 -11
- package/dist/modules/messages/lib/email-sender.js.map +2 -2
- package/dist/modules/messages/lib/forwarding.js +4 -4
- package/dist/modules/messages/lib/forwarding.js.map +2 -2
- package/dist/modules/messages/lib/markdownEmailBody.js +15 -0
- package/dist/modules/messages/lib/markdownEmailBody.js.map +7 -0
- package/dist/modules/messages/lib/messageSourceEntityTypes.js +7 -0
- package/dist/modules/messages/lib/messageSourceEntityTypes.js.map +7 -0
- package/dist/modules/messages/lib/routeHelpers.js +43 -0
- package/dist/modules/messages/lib/routeHelpers.js.map +2 -2
- package/dist/modules/messages/subscribers/message-notification.js +30 -1
- package/dist/modules/messages/subscribers/message-notification.js.map +2 -2
- package/dist/modules/notifications/api/[id]/action/route.js +2 -1
- package/dist/modules/notifications/api/[id]/action/route.js.map +2 -2
- package/dist/modules/notifications/api/openapi.js +2 -1
- package/dist/modules/notifications/api/openapi.js.map +2 -2
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +47 -28
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +2 -2
- package/dist/modules/notifications/lib/deliveryConfig.js +27 -2
- package/dist/modules/notifications/lib/deliveryConfig.js.map +2 -2
- package/dist/modules/notifications/lib/notificationMapper.js +3 -1
- package/dist/modules/notifications/lib/notificationMapper.js.map +2 -2
- package/dist/modules/notifications/lib/safeHref.js +4 -0
- package/dist/modules/notifications/lib/safeHref.js.map +2 -2
- package/dist/modules/planner/api/availability-date-specific.js +2 -1
- package/dist/modules/planner/api/availability-date-specific.js.map +2 -2
- package/dist/modules/planner/api/availability-weekly.js +2 -1
- package/dist/modules/planner/api/availability-weekly.js.map +2 -2
- package/dist/modules/progress/api/active/route.js +14 -2
- package/dist/modules/progress/api/active/route.js.map +2 -2
- package/dist/modules/progress/api/jobs/[id]/route.js +38 -22
- package/dist/modules/progress/api/jobs/[id]/route.js.map +2 -2
- package/dist/modules/progress/api/jobs/route.js +20 -6
- package/dist/modules/progress/api/jobs/route.js.map +2 -2
- package/dist/modules/progress/api/requestScope.js +32 -0
- package/dist/modules/progress/api/requestScope.js.map +7 -0
- package/dist/modules/progress/lib/organizationScope.js +10 -0
- package/dist/modules/progress/lib/organizationScope.js.map +7 -0
- package/dist/modules/progress/lib/progressService.js.map +2 -2
- package/dist/modules/progress/lib/progressServiceImpl.js +48 -15
- package/dist/modules/progress/lib/progressServiceImpl.js.map +2 -2
- package/dist/modules/push_notifications/api/custom-send/route.js +4 -1
- package/dist/modules/push_notifications/api/custom-send/route.js.map +2 -2
- package/dist/modules/query_index/api/status.js +5 -3
- package/dist/modules/query_index/api/status.js.map +2 -2
- package/dist/modules/query_index/di.js +2 -1
- package/dist/modules/query_index/di.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +2 -1
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/request-encryption.js +16 -0
- package/dist/modules/query_index/lib/request-encryption.js.map +7 -0
- package/dist/modules/query_index/lib/search-tokens.js +31 -1
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js +2 -1
- package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js +2 -1
- package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
- package/dist/modules/resources/commands/activities.js +2 -2
- package/dist/modules/resources/commands/activities.js.map +2 -2
- package/dist/modules/sales/api/document-history/route.js +5 -1
- package/dist/modules/sales/api/document-history/route.js.map +2 -2
- package/dist/modules/sales/api/document-numbers/route.js +2 -1
- package/dist/modules/sales/api/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/convert/route.js +2 -1
- package/dist/modules/sales/api/quotes/convert/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/send/route.js +2 -1
- package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js +7 -1
- package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/settings/order-editing/route.js +7 -1
- package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +354 -138
- package/dist/modules/sales/commands/documents.js.map +3 -3
- package/dist/modules/sales/commands/payments.js +2 -1
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/commands/settings.js +25 -5
- package/dist/modules/sales/commands/settings.js.map +2 -2
- package/dist/modules/sales/commands/shipments.js +2 -1
- package/dist/modules/sales/commands/shipments.js.map +2 -2
- package/dist/modules/sales/components/DocumentNumberSettings.js +32 -21
- package/dist/modules/sales/components/DocumentNumberSettings.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +49 -11
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +159 -81
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/lineItemUtils.js +7 -0
- package/dist/modules/sales/components/documents/lineItemUtils.js.map +2 -2
- package/dist/modules/sales/lib/lineSnapshots.js +19 -0
- package/dist/modules/sales/lib/lineSnapshots.js.map +2 -2
- package/dist/modules/sales/setup.js +4 -4
- package/dist/modules/sales/setup.js.map +2 -2
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +2 -2
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +2 -2
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +2 -2
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +2 -1
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +2 -1
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests.js +2 -1
- package/dist/modules/staff/api/leave-requests.js.map +2 -2
- package/dist/modules/staff/api/team-members/self/route.js +2 -1
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +2 -1
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +2 -1
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +12 -11
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +2 -1
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +2 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/route.js +2 -1
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +2 -1
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +2 -1
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +3 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +3 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +3 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +2 -1
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/shared.js +2 -1
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +2 -2
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +2 -1
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/commands/activities.js +2 -2
- package/dist/modules/staff/commands/activities.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +55 -14
- package/dist/modules/staff/commands/timesheets-reports.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +2 -1
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +32 -3
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-reports/reportPeriod.js +16 -0
- package/dist/modules/staff/lib/timesheets-reports/reportPeriod.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js +15 -10
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js.map +2 -2
- package/dist/modules/sync_excel/api/import/route.js +35 -12
- package/dist/modules/sync_excel/api/import/route.js.map +2 -2
- package/dist/modules/sync_excel/api/upload/route.js +29 -4
- package/dist/modules/sync_excel/api/upload/route.js.map +2 -2
- package/dist/modules/translations/api/context.js +2 -1
- package/dist/modules/translations/api/context.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/assess/route.js +2 -1
- package/dist/modules/warranty_claims/api/ai/assess/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/draft-reply/route.js +2 -1
- package/dist/modules/warranty_claims/api/ai/draft-reply/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/suggest/route.js +2 -1
- package/dist/modules/warranty_claims/api/ai/suggest/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/assign/route.js +2 -1
- package/dist/modules/warranty_claims/api/assign/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/credit-memo/route.js +2 -1
- package/dist/modules/warranty_claims/api/credit-memo/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/entitlement/route.js +2 -1
- package/dist/modules/warranty_claims/api/entitlement/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/events/route.js +2 -1
- package/dist/modules/warranty_claims/api/events/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/external/claims/route.js +2 -1
- package/dist/modules/warranty_claims/api/external/claims/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/receiving/route.js +2 -1
- package/dist/modules/warranty_claims/api/receiving/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/replacement-order/route.js +2 -1
- package/dist/modules/warranty_claims/api/replacement-order/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/return-label/route.js +2 -1
- package/dist/modules/warranty_claims/api/return-label/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/risk/route.js +2 -1
- package/dist/modules/warranty_claims/api/risk/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/sales-return/route.js +2 -1
- package/dist/modules/warranty_claims/api/sales-return/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/settings-general/route.js +2 -1
- package/dist/modules/warranty_claims/api/settings-general/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/stats/route.js +9 -5
- package/dist/modules/warranty_claims/api/stats/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/submit/route.js +2 -1
- package/dist/modules/warranty_claims/api/submit/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/transition/route.js +2 -1
- package/dist/modules/warranty_claims/api/transition/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js +2 -1
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/vendor-recovery-suggestions/route.js +2 -1
- package/dist/modules/warranty_claims/api/vendor-recovery-suggestions/route.js.map +2 -2
- package/dist/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.js +1 -1
- package/dist/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.js.map +2 -2
- package/dist/modules/wms/api/dashboard/operational/route.js +2 -1
- package/dist/modules/wms/api/dashboard/operational/route.js.map +2 -2
- package/dist/modules/wms/api/inventory/cycle-count/route.js +1 -0
- package/dist/modules/wms/api/inventory/cycle-count/route.js.map +2 -2
- package/dist/modules/wms/api/inventory/helpers.js +2 -1
- package/dist/modules/wms/api/inventory/helpers.js.map +2 -2
- package/dist/modules/wms/api/inventory/import/helpers.js +2 -1
- package/dist/modules/wms/api/inventory/import/helpers.js.map +2 -2
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +2 -1
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +2 -2
- package/dist/modules/wms/commands/inventory-actions.js +39 -1
- package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js +14 -1
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js.map +2 -2
- package/dist/modules/wms/di.js +5 -0
- package/dist/modules/wms/di.js.map +2 -2
- package/dist/modules/wms/lib/availabilityCache.js +86 -0
- package/dist/modules/wms/lib/availabilityCache.js.map +7 -0
- package/dist/modules/wms/lib/availabilityCalculation.js +212 -0
- package/dist/modules/wms/lib/availabilityCalculation.js.map +7 -0
- package/dist/modules/wms/lib/availabilityProvider.js +24 -0
- package/dist/modules/wms/lib/availabilityProvider.js.map +7 -0
- package/dist/modules/wms/lib/loadOperationalDashboard.js +42 -5
- package/dist/modules/wms/lib/loadOperationalDashboard.js.map +2 -2
- package/dist/modules/wms/lib/lowStockBalanceFilter.js +23 -10
- package/dist/modules/wms/lib/lowStockBalanceFilter.js.map +2 -2
- package/dist/modules/wms/lib/sqlInClause.js +9 -0
- package/dist/modules/wms/lib/sqlInClause.js.map +7 -0
- package/dist/modules/wms/lib/tryResolve.js +11 -0
- package/dist/modules/wms/lib/tryResolve.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-policy.js +14 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-policy.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-profile.js +14 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-profile.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache.js +16 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js +2 -2
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js.map +2 -2
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js +4 -3
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js.map +2 -2
- package/dist/modules/workflows/api/commands/route.js +4 -1
- package/dist/modules/workflows/api/commands/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/callers/route.js +4 -1
- package/dist/modules/workflows/api/definitions/[id]/callers/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/context-schema/route.js +4 -2
- package/dist/modules/workflows/api/definitions/[id]/context-schema/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js +4 -1
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/draft/route.js +6 -1
- package/dist/modules/workflows/api/definitions/[id]/draft/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/publish/route.js +6 -1
- package/dist/modules/workflows/api/definitions/[id]/publish/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js +4 -1
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/route.js +5 -3
- package/dist/modules/workflows/api/definitions/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/test-step/route.js +4 -2
- package/dist/modules/workflows/api/definitions/[id]/test-step/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/generate/route.js +4 -1
- package/dist/modules/workflows/api/definitions/generate/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/route.js +4 -2
- package/dist/modules/workflows/api/definitions/route.js.map +2 -2
- package/dist/modules/workflows/api/endpoints/route.js +4 -1
- package/dist/modules/workflows/api/endpoints/route.js.map +2 -2
- package/dist/modules/workflows/api/functions/route.js +4 -1
- package/dist/modules/workflows/api/functions/route.js.map +2 -2
- package/dist/modules/workflows/api/grantable-features/route.js +2 -1
- package/dist/modules/workflows/api/grantable-features/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/advance/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/advance/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/cancel/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/cancel/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/context/route.js +2 -1
- package/dist/modules/workflows/api/instances/[id]/context/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/rerun-step/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/rerun-step/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/retry/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/retry/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/signal/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/signal/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/step-through/route.js +4 -2
- package/dist/modules/workflows/api/instances/[id]/step-through/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/route.js +4 -2
- package/dist/modules/workflows/api/instances/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/validate-start/route.js +4 -1
- package/dist/modules/workflows/api/instances/validate-start/route.js.map +2 -2
- package/dist/modules/workflows/api/rule-usage/route.js +4 -1
- package/dist/modules/workflows/api/rule-usage/route.js.map +2 -2
- package/dist/modules/workflows/api/signals/route.js +4 -1
- package/dist/modules/workflows/api/signals/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js +4 -1
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js +4 -1
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/reassign/route.js +2 -1
- package/dist/modules/workflows/api/tasks/[id]/reassign/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/unclaim/route.js +4 -1
- package/dist/modules/workflows/api/tasks/[id]/unclaim/route.js.map +2 -2
- package/dist/modules/workflows/api/templates/route.js +4 -1
- package/dist/modules/workflows/api/templates/route.js.map +2 -2
- package/dist/modules/workflows/api/work-inbox/next/route.js +4 -1
- package/dist/modules/workflows/api/work-inbox/next/route.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +87 -20
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/activity-types.js +4 -4
- package/dist/modules/workflows/lib/activity-types.js.map +2 -2
- package/dist/modules/workflows/lib/activity-worker-handler.js +16 -11
- package/dist/modules/workflows/lib/activity-worker-handler.js.map +2 -2
- package/dist/modules/workflows/lib/event-trigger-service.js +8 -1
- package/dist/modules/workflows/lib/event-trigger-service.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +4 -4
- package/dist/modules/workflows/lib/step-handler.js.map +2 -2
- package/dist/test-utils/transactionalEntityManagerDouble.js +37 -0
- package/dist/test-utils/transactionalEntityManagerDouble.js.map +7 -0
- package/generated/entities/availability_policy/index.ts +19 -0
- package/generated/entities/communication_channel/index.ts +1 -0
- package/generated/entities/customer_email_conversation_share/index.ts +9 -0
- package/generated/entities/customer_group/index.ts +15 -0
- package/generated/entities/customer_group_membership/index.ts +13 -0
- package/generated/entities/customer_group_terms/index.ts +15 -0
- package/generated/entities/customer_interaction/index.ts +1 -0
- package/generated/entities/form/index.ts +16 -0
- package/generated/entities/form_access_audit/index.ts +9 -0
- package/generated/entities/form_attachment/index.ts +13 -0
- package/generated/entities/form_consent_record/index.ts +17 -0
- package/generated/entities/form_distribution/index.ts +22 -0
- package/generated/entities/form_invitation/index.ts +23 -0
- package/generated/entities/form_submission/index.ts +18 -0
- package/generated/entities/form_submission_actor/index.ts +10 -0
- package/generated/entities/form_submission_revision/index.ts +13 -0
- package/generated/entities/form_version/index.ts +17 -0
- package/generated/entities/forms_encryption_key/index.ts +6 -0
- package/generated/entities.ids.generated.ts +27 -2
- package/generated/entity-fields-registry.ts +269 -0
- package/package.json +18 -7
- package/src/helpers/integration/communicationChannelsFixtures.ts +43 -0
- package/src/helpers/integration/customerGroupsFixtures.ts +171 -0
- package/src/helpers/integration/formsFixtures.ts +757 -0
- package/src/modules/api_docs/api/get/version.ts +28 -11
- package/src/modules/api_keys/api/keys/route.ts +89 -199
- package/src/modules/api_keys/backend/api-keys/create/page.tsx +2 -2
- package/src/modules/api_keys/commands/keys.ts +172 -0
- package/src/modules/api_keys/i18n/de.json +1 -0
- package/src/modules/api_keys/i18n/en.json +1 -0
- package/src/modules/api_keys/i18n/es.json +1 -0
- package/src/modules/api_keys/i18n/ko.json +1 -0
- package/src/modules/api_keys/i18n/pl.json +1 -0
- package/src/modules/api_keys/services/apiKeyService.ts +82 -49
- package/src/modules/attachments/api/file/[id]/route.ts +9 -4
- package/src/modules/attachments/api/image/[id]/[[...slug]]/route.ts +6 -4
- package/src/modules/attachments/api/route.ts +10 -4
- package/src/modules/attachments/components/AttachmentLibrary.tsx +16 -5
- package/src/modules/attachments/lib/access.ts +1 -3
- package/src/modules/attachments/lib/requestScope.ts +35 -3
- package/src/modules/audit_logs/api/audit-logs/actions/export/route.ts +6 -1
- package/src/modules/audit_logs/api/audit-logs/actions/redo/route.ts +41 -6
- package/src/modules/audit_logs/api/audit-logs/actions/route.ts +6 -1
- package/src/modules/audit_logs/api/audit-logs/actions/undo/route.ts +39 -4
- package/src/modules/audit_logs/data/validators.ts +1 -0
- package/src/modules/audit_logs/lib/actorSubject.ts +82 -0
- package/src/modules/audit_logs/lib/replayAuthorization.ts +61 -0
- package/src/modules/audit_logs/services/actionLogService.ts +191 -47
- package/src/modules/auth/api/features.ts +1 -1
- package/src/modules/auth/cli.ts +31 -17
- package/src/modules/auth/commands/acl.ts +26 -36
- package/src/modules/auth/commands/interceptors.ts +23 -0
- package/src/modules/auth/commands/roles.ts +475 -148
- package/src/modules/auth/commands/users.ts +693 -81
- package/src/modules/auth/i18n/de.json +22 -0
- package/src/modules/auth/i18n/en.json +22 -0
- package/src/modules/auth/i18n/es.json +22 -0
- package/src/modules/auth/i18n/ko.json +22 -0
- package/src/modules/auth/i18n/pl.json +22 -0
- package/src/modules/auth/lib/authorizationStateLocks.ts +340 -0
- package/src/modules/auth/lib/commandReplay.ts +194 -0
- package/src/modules/auth/lib/executionPrincipal.ts +36 -28
- package/src/modules/auth/lib/grantChecks.ts +10 -2
- package/src/modules/auth/lib/setup-app.ts +97 -50
- package/src/modules/auth/lib/tokenHash.ts +16 -1
- package/src/modules/auth/services/rbacService.ts +578 -6
- package/src/modules/availability/acl.ts +12 -0
- package/src/modules/availability/api/check/route.ts +136 -0
- package/src/modules/availability/api/openapi.ts +28 -0
- package/src/modules/availability/api/policies/resolve-preview/route.ts +83 -0
- package/src/modules/availability/api/policies/route.ts +244 -0
- package/src/modules/availability/backend/availability/check/page.meta.ts +12 -0
- package/src/modules/availability/backend/availability/check/page.tsx +223 -0
- package/src/modules/availability/backend/availability/policies/ResolutionPreviewPanel.tsx +112 -0
- package/src/modules/availability/backend/availability/policies/ScopeFields.tsx +55 -0
- package/src/modules/availability/backend/availability/policies/StockManagedField.tsx +37 -0
- package/src/modules/availability/backend/availability/policies/[id]/page.meta.ts +8 -0
- package/src/modules/availability/backend/availability/policies/[id]/page.tsx +202 -0
- package/src/modules/availability/backend/availability/policies/create/page.meta.ts +8 -0
- package/src/modules/availability/backend/availability/policies/create/page.tsx +131 -0
- package/src/modules/availability/backend/availability/policies/formGroups.ts +83 -0
- package/src/modules/availability/backend/availability/policies/page.meta.ts +12 -0
- package/src/modules/availability/backend/availability/policies/page.tsx +232 -0
- package/src/modules/availability/backend/availability/policies/policyPayload.ts +29 -0
- package/src/modules/availability/commands/policies.ts +430 -0
- package/src/modules/availability/commands/scope.ts +26 -0
- package/src/modules/availability/data/entities.ts +93 -0
- package/src/modules/availability/data/validators.ts +87 -0
- package/src/modules/availability/di.ts +68 -0
- package/src/modules/availability/events.ts +17 -0
- package/src/modules/availability/i18n/de.json +92 -0
- package/src/modules/availability/i18n/en.json +92 -0
- package/src/modules/availability/i18n/es.json +92 -0
- package/src/modules/availability/i18n/ko.json +92 -0
- package/src/modules/availability/i18n/pl.json +92 -0
- package/src/modules/availability/index.ts +13 -0
- package/src/modules/availability/lib/catalogTarget.ts +72 -0
- package/src/modules/availability/lib/organizationScope.ts +18 -0
- package/src/modules/availability/lib/policyResolution.ts +289 -0
- package/src/modules/availability/lib/tryResolve.ts +8 -0
- package/src/modules/availability/migrations/.snapshot-open-mercato.json +375 -0
- package/src/modules/availability/migrations/Migration20260922095844_availability.ts +13 -0
- package/src/modules/availability/migrations/Migration20260930120000_availability.ts +22 -0
- package/src/modules/availability/setup.ts +10 -0
- package/src/modules/catalog/api/categories/bulk-create/route.ts +119 -0
- package/src/modules/catalog/api/categories/route.ts +70 -8
- package/src/modules/catalog/api/products/bulk-create/route.ts +119 -0
- package/src/modules/catalog/api/products/route.ts +55 -24
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +8 -16
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +16 -10
- package/src/modules/catalog/commands/categories.ts +1 -0
- package/src/modules/catalog/commands/productDeleteChildren.ts +557 -0
- package/src/modules/catalog/commands/products.ts +69 -24
- package/src/modules/catalog/components/PriceKindSettings.tsx +6 -20
- package/src/modules/catalog/components/products/ProductUomSection.tsx +26 -37
- package/src/modules/catalog/components/products/productForm.ts +6 -4
- package/src/modules/catalog/data/validators.ts +22 -0
- package/src/modules/catalog/di.ts +2 -1
- package/src/modules/catalog/events.ts +9 -3
- package/src/modules/catalog/i18n/de.json +40 -0
- package/src/modules/catalog/i18n/en.json +40 -0
- package/src/modules/catalog/i18n/es.json +40 -0
- package/src/modules/catalog/i18n/ko.json +40 -0
- package/src/modules/catalog/i18n/pl.json +40 -0
- package/src/modules/catalog/lib/bulkCreateCategories.ts +349 -0
- package/src/modules/catalog/lib/bulkCreateCheckpoint.ts +176 -0
- package/src/modules/catalog/lib/bulkCreateMutationGuards.ts +62 -0
- package/src/modules/catalog/lib/bulkCreateProducts.ts +340 -0
- package/src/modules/catalog/lib/bulkDelete.ts +10 -14
- package/src/modules/catalog/lib/catalogQueue.ts +14 -0
- package/src/modules/catalog/lib/currencyOptions.ts +28 -0
- package/src/modules/catalog/lib/productSearch.ts +16 -0
- package/src/modules/catalog/lib/seeds.ts +2 -43
- package/src/modules/catalog/lib/unitLabels.ts +52 -0
- package/src/modules/catalog/migrations/Migration20260914120000.ts +51 -0
- package/src/modules/catalog/migrations/Migration20260914120100.ts +50 -0
- package/src/modules/catalog/workers/catalog-category-bulk-create.ts +48 -0
- package/src/modules/catalog/workers/catalog-product-bulk-create.ts +48 -0
- package/src/modules/communication_channels/acl.ts +8 -0
- package/src/modules/communication_channels/api/get/me/channels/route.ts +4 -0
- package/src/modules/communication_channels/api/get/oauth/[provider]/callback/route.ts +23 -0
- package/src/modules/communication_channels/api/post/channels/[id]/import-history/route.ts +3 -4
- package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +9 -1
- package/src/modules/communication_channels/api/post/channels/connect/credentials/route.ts +4 -6
- package/src/modules/communication_channels/api/post/channels/connect/tenant-credentials/route.ts +4 -6
- package/src/modules/communication_channels/api/post/test-seed/route.ts +109 -24
- package/src/modules/communication_channels/api/put/channels/[id]/visibility/route.ts +165 -0
- package/src/modules/communication_channels/backend/profile/communication-channels/page.tsx +247 -129
- package/src/modules/communication_channels/commands/ingest-inbound-message.ts +2 -1
- package/src/modules/communication_channels/commands/set-channel-visibility.ts +138 -0
- package/src/modules/communication_channels/data/enrichers.ts +42 -19
- package/src/modules/communication_channels/data/entities.ts +21 -0
- package/src/modules/communication_channels/di.ts +9 -0
- package/src/modules/communication_channels/events.ts +7 -0
- package/src/modules/communication_channels/i18n/de.json +16 -3
- package/src/modules/communication_channels/i18n/en.json +16 -3
- package/src/modules/communication_channels/i18n/es.json +16 -3
- package/src/modules/communication_channels/i18n/ko.json +16 -3
- package/src/modules/communication_channels/i18n/pl.json +16 -3
- package/src/modules/communication_channels/index.ts +1 -1
- package/src/modules/communication_channels/lib/access-control.ts +4 -1
- package/src/modules/communication_channels/lib/adapter.ts +16 -6
- package/src/modules/communication_channels/lib/channel-thread-access.ts +133 -0
- package/src/modules/communication_channels/lib/credential-refresh.ts +27 -5
- package/src/modules/communication_channels/lib/inbound-message-origin.ts +62 -0
- package/src/modules/communication_channels/lib/oauth-state.ts +96 -1
- package/src/modules/communication_channels/lib/outbound-delivery-intent.ts +57 -0
- package/src/modules/communication_channels/lib/send-as-user.ts +2 -2
- package/src/modules/communication_channels/migrations/.snapshot-open-mercato.json +18 -1
- package/src/modules/communication_channels/migrations/Migration20260825141000_communication_channels.ts +22 -0
- package/src/modules/communication_channels/setup.ts +4 -0
- package/src/modules/communication_channels/subscribers/outbound-bridge.ts +34 -9
- package/src/modules/communication_channels/workers/gmail-history-sync.ts +1 -1
- package/src/modules/communication_channels/workers/poll-channel.ts +1 -1
- package/src/modules/communication_channels/workers/reaction-processor.ts +2 -2
- package/src/modules/configs/api/upgrade-actions/route.ts +2 -1
- package/src/modules/configs/cli.ts +2 -2
- package/src/modules/configs/i18n/de.json +2 -0
- package/src/modules/configs/i18n/en.json +2 -0
- package/src/modules/configs/i18n/es.json +2 -0
- package/src/modules/configs/i18n/ko.json +2 -0
- package/src/modules/configs/i18n/pl.json +2 -0
- package/src/modules/configs/lib/upgrade-actions.ts +29 -6
- package/src/modules/configs/services/upgradeActionsService.ts +45 -30
- package/src/modules/currencies/api/currencies/route.ts +11 -5
- package/src/modules/currencies/api/exchange-rates/route.ts +11 -5
- package/src/modules/customer_groups/acl.ts +10 -0
- package/src/modules/customer_groups/api/customer-groups/[id]/terms/route.ts +355 -0
- package/src/modules/customer_groups/api/customer-groups/crud.ts +627 -0
- package/src/modules/customer_groups/api/customer-groups/explain-terms/route.ts +195 -0
- package/src/modules/customer_groups/api/customer-groups/memberships/crud.ts +525 -0
- package/src/modules/customer_groups/api/customer-groups/memberships/route.ts +65 -0
- package/src/modules/customer_groups/api/customer-groups/reconcile/adopt/route.ts +150 -0
- package/src/modules/customer_groups/api/customer-groups/reconcile/route.ts +90 -0
- package/src/modules/customer_groups/api/customer-groups/reorder/route.ts +147 -0
- package/src/modules/customer_groups/api/customer-groups/route.ts +65 -0
- package/src/modules/customer_groups/api/openapi.ts +28 -0
- package/src/modules/customer_groups/backend/customer-groups/[id]/edit/page.meta.ts +12 -0
- package/src/modules/customer_groups/backend/customer-groups/[id]/edit/page.tsx +392 -0
- package/src/modules/customer_groups/backend/customer-groups/create/page.meta.ts +25 -0
- package/src/modules/customer_groups/backend/customer-groups/create/page.tsx +279 -0
- package/src/modules/customer_groups/backend/customer-groups/orphans/page.meta.ts +12 -0
- package/src/modules/customer_groups/backend/customer-groups/orphans/page.tsx +216 -0
- package/src/modules/customer_groups/backend/customer-groups/page.meta.ts +11 -0
- package/src/modules/customer_groups/backend/customer-groups/page.tsx +478 -0
- package/src/modules/customer_groups/cli.ts +87 -0
- package/src/modules/customer_groups/commands/reorderGroups.ts +163 -0
- package/src/modules/customer_groups/components/CustomerGroupDefaultField.tsx +55 -0
- package/src/modules/customer_groups/components/CustomerGroupParentField.tsx +194 -0
- package/src/modules/customer_groups/components/CustomerGroupTermsPriceKindField.tsx +111 -0
- package/src/modules/customer_groups/components/CustomerGroupTermsSection.tsx +273 -0
- package/src/modules/customer_groups/components/GroupPickerField.tsx +142 -0
- package/src/modules/customer_groups/components/OrphanBanner.tsx +92 -0
- package/src/modules/customer_groups/components/customerGroupTree.ts +84 -0
- package/src/modules/customer_groups/data/entities.ts +244 -0
- package/src/modules/customer_groups/data/validators.ts +232 -0
- package/src/modules/customer_groups/di.ts +25 -0
- package/src/modules/customer_groups/events.ts +22 -0
- package/src/modules/customer_groups/i18n/de.json +199 -0
- package/src/modules/customer_groups/i18n/en.json +199 -0
- package/src/modules/customer_groups/i18n/es.json +199 -0
- package/src/modules/customer_groups/i18n/ko.json +199 -0
- package/src/modules/customer_groups/i18n/pl.json +199 -0
- package/src/modules/customer_groups/index.ts +13 -0
- package/src/modules/customer_groups/lib/createConflictRecheck.ts +39 -0
- package/src/modules/customer_groups/lib/customerScope.ts +145 -0
- package/src/modules/customer_groups/lib/groupEvents.ts +50 -0
- package/src/modules/customer_groups/lib/priceKindScope.ts +22 -0
- package/src/modules/customer_groups/lib/reconcile.ts +299 -0
- package/src/modules/customer_groups/migrations/.snapshot-open-mercato.json +905 -0
- package/src/modules/customer_groups/migrations/Migration20260922095316_customer_groups.ts +26 -0
- package/src/modules/customer_groups/migrations/Migration20260922103033_customer_groups.ts +22 -0
- package/src/modules/customer_groups/migrations/Migration20260922105444_customer_groups.ts +17 -0
- package/src/modules/customer_groups/migrations/Migration20260923193330_customer_groups.ts +20 -0
- package/src/modules/customer_groups/migrations/Migration20260929083000_customer_groups.ts +21 -0
- package/src/modules/customer_groups/services/customerGroupsService.ts +358 -0
- package/src/modules/customer_groups/setup.ts +11 -0
- package/src/modules/customer_groups/widgets/injection/group-picker-field/widget.ts +41 -0
- package/src/modules/customer_groups/widgets/injection/person-groups-explain-terms.tsx +227 -0
- package/src/modules/customer_groups/widgets/injection/person-groups-tab/widget.ts +21 -0
- package/src/modules/customer_groups/widgets/injection/person-groups-tab.tsx +573 -0
- package/src/modules/customer_groups/widgets/injection-table.ts +35 -0
- package/src/modules/customers/acl.ts +13 -0
- package/src/modules/customers/api/activities/route.ts +10 -0
- package/src/modules/customers/api/companies/[id]/people/route.ts +2 -1
- package/src/modules/customers/api/companies/[id]/route.ts +20 -6
- package/src/modules/customers/api/deals/[id]/companies/route.ts +2 -1
- package/src/modules/customers/api/deals/[id]/people/route.ts +84 -4
- package/src/modules/customers/api/deals/map/route.ts +11 -10
- package/src/modules/customers/api/dictionaries/context.ts +2 -1
- package/src/modules/customers/api/entity-roles-factory.ts +3 -2
- package/src/modules/customers/api/interactions/[id]/visibility/route.ts +2 -1
- package/src/modules/customers/api/interactions/cancel/route.ts +2 -1
- package/src/modules/customers/api/interactions/complete/route.ts +2 -1
- package/src/modules/customers/api/interactions/conflicts/route.ts +10 -10
- package/src/modules/customers/api/interactions/counts/route.ts +25 -7
- package/src/modules/customers/api/interactions/route.ts +34 -10
- package/src/modules/customers/api/labels/assign/route.ts +2 -1
- package/src/modules/customers/api/labels/route.ts +3 -2
- package/src/modules/customers/api/labels/unassign/route.ts +2 -1
- package/src/modules/customers/api/people/[id]/companies/context.ts +11 -2
- package/src/modules/customers/api/people/[id]/email-share/route.ts +276 -0
- package/src/modules/customers/api/people/[id]/email-threads/route.ts +14 -1
- package/src/modules/customers/api/people/[id]/emails/route.ts +2 -1
- package/src/modules/customers/api/people/[id]/route.ts +31 -22
- package/src/modules/customers/api/people/check-phone/route.ts +2 -1
- package/src/modules/customers/api/pipeline-stages/reorder/route.ts +3 -2
- package/src/modules/customers/api/pipeline-stages/route.ts +3 -3
- package/src/modules/customers/api/pipelines/route.ts +3 -3
- package/src/modules/customers/api/settings/address-format/route.ts +2 -1
- package/src/modules/customers/api/settings/dictionary-sort-modes/route.ts +2 -1
- package/src/modules/customers/api/settings/stuck-threshold/route.ts +2 -1
- package/src/modules/customers/api/tags/assign/route.ts +2 -1
- package/src/modules/customers/api/tags/unassign/route.ts +2 -1
- package/src/modules/customers/backend/customers/companies/[id]/page.tsx +4 -2
- package/src/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.ts +10 -35
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +21 -18
- package/src/modules/customers/backend/customers/deals/components/ReassignOwnerDialog.tsx +115 -0
- package/src/modules/customers/backend/customers/deals/page.tsx +121 -1
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +4 -2
- package/src/modules/customers/commands/addresses.ts +117 -15
- package/src/modules/customers/commands/companies.ts +10 -4
- package/src/modules/customers/commands/emailConversationShares.ts +261 -0
- package/src/modules/customers/commands/index.ts +1 -0
- package/src/modules/customers/commands/interactions.ts +61 -21
- package/src/modules/customers/commands/people.ts +3 -2
- package/src/modules/customers/commands/shared.ts +4 -0
- package/src/modules/customers/components/calendar/types.ts +1 -1
- package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +97 -399
- package/src/modules/customers/components/detail/CreatePersonDialog.tsx +39 -19
- package/src/modules/customers/components/detail/DealForm.tsx +118 -5
- package/src/modules/customers/components/detail/DealOwnerSelect.tsx +161 -0
- package/src/modules/customers/components/detail/DealPeopleSection.tsx +256 -0
- package/src/modules/customers/components/detail/DealsSection.tsx +8 -14
- package/src/modules/customers/components/detail/LinkedPeopleSection.tsx +474 -0
- package/src/modules/customers/components/detail/PersonCard.tsx +12 -4
- package/src/modules/customers/components/detail/PersonEmailShareControl.tsx +273 -0
- package/src/modules/customers/components/detail/PersonEmailThreadsTab.tsx +26 -0
- package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +10 -2
- package/src/modules/customers/components/detail/create/CreateDealForm.tsx +30 -0
- package/src/modules/customers/components/detail/create/DealDetailsFields.tsx +12 -0
- package/src/modules/customers/components/detail/create/DealSectionCard.tsx +7 -2
- package/src/modules/customers/components/detail/create/dealFormTypes.ts +3 -0
- package/src/modules/customers/components/detail/schedule/useScheduleFormState.ts +16 -4
- package/src/modules/customers/components/formConfig.tsx +3 -0
- package/src/modules/customers/components/linking/LinkEntityDialog.tsx +8 -0
- package/src/modules/customers/components/linking/adapters/personAdapter.tsx +4 -0
- package/src/modules/customers/data/enrichers.ts +64 -5
- package/src/modules/customers/data/entities.ts +105 -1
- package/src/modules/customers/data/validators.ts +22 -0
- package/src/modules/customers/events.ts +5 -0
- package/src/modules/customers/i18n/de.json +49 -13
- package/src/modules/customers/i18n/en.json +44 -8
- package/src/modules/customers/i18n/es.json +44 -8
- package/src/modules/customers/i18n/ko.json +44 -8
- package/src/modules/customers/i18n/pl.json +44 -8
- package/src/modules/customers/lib/assignableStaff.ts +17 -0
- package/src/modules/customers/lib/calendar/editorPayload.ts +20 -13
- package/src/modules/customers/lib/calendar/mapItem.ts +1 -0
- package/src/modules/customers/lib/conversationShares.ts +250 -0
- package/src/modules/customers/lib/dealsOrganizationScope.ts +5 -3
- package/src/modules/customers/lib/interactionRequestContext.ts +2 -1
- package/src/modules/customers/lib/link-channel-message-handler.ts +27 -4
- package/src/modules/customers/lib/personDetailCacheTags.ts +68 -0
- package/src/modules/customers/lib/personEmailThreads.ts +61 -6
- package/src/modules/customers/lib/reassignDealOwner.ts +51 -0
- package/src/modules/customers/lib/userNames.ts +39 -0
- package/src/modules/customers/lib/visibilityFilter.ts +170 -3
- package/src/modules/customers/migrations/.snapshot-open-mercato.json +240 -0
- package/src/modules/customers/migrations/Migration20260825120000_customers.ts +19 -0
- package/src/modules/customers/migrations/Migration20260825140000_customers.ts +41 -0
- package/src/modules/customers/setup.ts +1 -0
- package/src/modules/customers/subscribers/channel-visibility-changed.ts +50 -0
- package/src/modules/dashboards/api/widgets/data/batch/route.ts +3 -8
- package/src/modules/dashboards/api/widgets/data/route.ts +12 -18
- package/src/modules/dashboards/lib/aggregations.ts +1 -1
- package/src/modules/dashboards/lib/widgetScope.ts +2 -7
- package/src/modules/data_sync/AGENTS.md +35 -1
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +5 -1
- package/src/modules/data_sync/backend/data-sync/page.tsx +292 -19
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +205 -21
- package/src/modules/data_sync/components/useDataSyncRunAccess.ts +27 -0
- package/src/modules/data_sync/i18n/de.json +24 -0
- package/src/modules/data_sync/i18n/en.json +24 -0
- package/src/modules/data_sync/i18n/es.json +24 -0
- package/src/modules/data_sync/i18n/ko.json +24 -0
- package/src/modules/data_sync/i18n/pl.json +24 -0
- package/src/modules/data_sync/lib/adapter.ts +37 -0
- package/src/modules/data_sync/lib/resume-point.ts +63 -0
- package/src/modules/data_sync/lib/start-run.ts +61 -2
- package/src/modules/data_sync/lib/sync-run-service.ts +27 -34
- package/src/modules/devices/api/[id]/route.ts +3 -2
- package/src/modules/devices/api/admin/devices/route.ts +2 -1
- package/src/modules/devices/api/route.ts +2 -1
- package/src/modules/dictionaries/api/[dictionaryId]/route.ts +3 -5
- package/src/modules/dictionaries/api/context.ts +2 -1
- package/src/modules/dictionaries/api/route.ts +4 -0
- package/src/modules/dictionaries/components/DictionariesManager.tsx +4 -3
- package/src/modules/dictionaries/data/validators.ts +9 -1
- package/src/modules/dictionaries/i18n/de.json +3 -3
- package/src/modules/dictionaries/i18n/en.json +3 -3
- package/src/modules/dictionaries/i18n/es.json +3 -3
- package/src/modules/dictionaries/i18n/ko.json +3 -3
- package/src/modules/dictionaries/i18n/pl.json +3 -3
- package/src/modules/directory/api/organization-branding/route.ts +10 -1
- package/src/modules/directory/api/organizations/route.ts +1 -1
- package/src/modules/directory/backend/directory/branding/page.tsx +24 -2
- package/src/modules/directory/commands/organizations.ts +173 -80
- package/src/modules/directory/i18n/de.json +1 -0
- package/src/modules/directory/i18n/en.json +1 -0
- package/src/modules/directory/i18n/es.json +1 -0
- package/src/modules/directory/i18n/ko.json +1 -0
- package/src/modules/directory/i18n/pl.json +1 -0
- package/src/modules/directory/lib/hierarchy.ts +22 -1
- package/src/modules/directory/utils/organizationScope.ts +102 -15
- package/src/modules/directory/utils/organizationScopeFilter.ts +6 -3
- package/src/modules/directory/utils/organizationScopeGuard.ts +9 -5
- package/src/modules/entities/api/encryption.ts +73 -27
- package/src/modules/entities/api/records.ts +9 -8
- package/src/modules/entities/cli.ts +46 -24
- package/src/modules/entities/data/entities.ts +15 -0
- package/src/modules/entities/lib/definition-scope.ts +5 -1
- package/src/modules/entities/lib/encryption-maps.ts +164 -0
- package/src/modules/entities/lib/helpers.ts +95 -8
- package/src/modules/entities/migrations/.snapshot-open-mercato.json +21 -0
- package/src/modules/entities/migrations/.snapshot-openmercato.json +12 -0
- package/src/modules/entities/migrations/Migration20260910120000.ts +42 -0
- package/src/modules/entities/migrations/Migration20261004120000_encryption_map_scope_uniqueness.ts +130 -0
- package/src/modules/eudr/api/dashboard/widgets/compliance-overview/route.ts +2 -1
- package/src/modules/eudr/api/plots/import/route.ts +2 -1
- package/src/modules/eudr/api/product-mappings/suggestions/apply/route.ts +2 -1
- package/src/modules/eudr/api/product-mappings/suggestions/route.ts +2 -1
- package/src/modules/eudr/api/reports/annual/route.ts +2 -1
- package/src/modules/eudr/api/statements/[id]/export/route.ts +2 -1
- package/src/modules/eudr/api/statements/[id]/readiness/route.ts +2 -1
- package/src/modules/eudr/api/suppliers/compliance/route.ts +2 -1
- package/src/modules/feature_toggles/commands/global.ts +18 -15
- package/src/modules/feature_toggles/lib/feature-flag-check.ts +8 -3
- package/src/modules/forms/acl.ts +10 -0
- package/src/modules/forms/api/[id]/analytics/route.ts +137 -0
- package/src/modules/forms/api/[id]/distributions/route.ts +192 -0
- package/src/modules/forms/api/[id]/route.ts +245 -0
- package/src/modules/forms/api/[id]/run/context/route.ts +142 -0
- package/src/modules/forms/api/[id]/run/submissions/route.ts +147 -0
- package/src/modules/forms/api/[id]/submissions/route.ts +100 -0
- package/src/modules/forms/api/[id]/theme-logo/route.ts +147 -0
- package/src/modules/forms/api/[id]/versions/[versionId]/diff/route.ts +137 -0
- package/src/modules/forms/api/[id]/versions/[versionId]/publish/route.ts +108 -0
- package/src/modules/forms/api/[id]/versions/[versionId]/route.ts +200 -0
- package/src/modules/forms/api/[id]/versions/fork/route.ts +98 -0
- package/src/modules/forms/api/attachment-helpers.ts +160 -0
- package/src/modules/forms/api/by-key/[key]/active/route.ts +165 -0
- package/src/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/route.ts +92 -0
- package/src/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/send/route.ts +96 -0
- package/src/modules/forms/api/distributions/[distributionId]/invitations/route.ts +207 -0
- package/src/modules/forms/api/distributions/[distributionId]/route.ts +213 -0
- package/src/modules/forms/api/form-submissions/[id]/attachments/route.ts +114 -0
- package/src/modules/forms/api/form-submissions/[id]/resume-token/route.ts +140 -0
- package/src/modules/forms/api/form-submissions/[id]/route.ts +176 -0
- package/src/modules/forms/api/form-submissions/[id]/submit/route.ts +91 -0
- package/src/modules/forms/api/form-submissions/by-subject/[subject_type]/[subject_id]/route.ts +93 -0
- package/src/modules/forms/api/form-submissions/route.ts +133 -0
- package/src/modules/forms/api/helpers.ts +175 -0
- package/src/modules/forms/api/public/distributions/[slug]/embed-policy/route.ts +74 -0
- package/src/modules/forms/api/public/distributions/[slug]/route.ts +101 -0
- package/src/modules/forms/api/public/embed-loader/route.ts +136 -0
- package/src/modules/forms/api/public/invitations/[token]/route.ts +107 -0
- package/src/modules/forms/api/public/rate-limit.ts +69 -0
- package/src/modules/forms/api/public/start/route.ts +195 -0
- package/src/modules/forms/api/public/submissions/[id]/attachments/[attachmentId]/route.ts +86 -0
- package/src/modules/forms/api/public/submissions/[id]/attachments/route.ts +108 -0
- package/src/modules/forms/api/public/submissions/[id]/pdf/route.ts +96 -0
- package/src/modules/forms/api/public/submissions/[id]/route.ts +189 -0
- package/src/modules/forms/api/public/submissions/[id]/submit/route.ts +159 -0
- package/src/modules/forms/api/route.ts +240 -0
- package/src/modules/forms/api/runtime-helpers.ts +208 -0
- package/src/modules/forms/api/subjects/[subjectType]/[subjectId]/consents/route.ts +178 -0
- package/src/modules/forms/api/subjects/[subjectType]/[subjectId]/export/route.ts +135 -0
- package/src/modules/forms/api/submissions/[submissionId]/access-audit/route.ts +100 -0
- package/src/modules/forms/api/submissions/[submissionId]/actors/[actorId]/route.ts +70 -0
- package/src/modules/forms/api/submissions/[submissionId]/actors/route.ts +92 -0
- package/src/modules/forms/api/submissions/[submissionId]/anonymize/route.ts +134 -0
- package/src/modules/forms/api/submissions/[submissionId]/attachments/[attachmentId]/route.ts +90 -0
- package/src/modules/forms/api/submissions/[submissionId]/export/route.ts +111 -0
- package/src/modules/forms/api/submissions/[submissionId]/pdf/route.ts +118 -0
- package/src/modules/forms/api/submissions/[submissionId]/reopen/route.ts +69 -0
- package/src/modules/forms/api/submissions/[submissionId]/revisions/route.ts +75 -0
- package/src/modules/forms/api/submissions/[submissionId]/route.ts +90 -0
- package/src/modules/forms/backend/forms/[id]/FormStudio.tsx +3269 -0
- package/src/modules/forms/backend/forms/[id]/analytics/page.meta.ts +15 -0
- package/src/modules/forms/backend/forms/[id]/analytics/page.tsx +289 -0
- package/src/modules/forms/backend/forms/[id]/distributions/page.meta.ts +15 -0
- package/src/modules/forms/backend/forms/[id]/distributions/page.tsx +16 -0
- package/src/modules/forms/backend/forms/[id]/history/page.meta.ts +11 -0
- package/src/modules/forms/backend/forms/[id]/history/page.tsx +229 -0
- package/src/modules/forms/backend/forms/[id]/page.meta.ts +11 -0
- package/src/modules/forms/backend/forms/[id]/page.tsx +17 -0
- package/src/modules/forms/backend/forms/[id]/studio/YesNoRow.tsx +65 -0
- package/src/modules/forms/backend/forms/[id]/studio/autosave-guard.ts +25 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/DragOverlayCard.tsx +24 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/DropIndicator.tsx +36 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/FieldRow.tsx +308 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/FormCanvas.tsx +265 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/GridSlot.tsx +176 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/SectionContainer.tsx +473 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/grid-collision.ts +25 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/keyboard-coordinates.ts +128 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/overlay-size.ts +15 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/resize-math.ts +36 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/row-layout.ts +110 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/ConditionBuilder.tsx +264 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/HiddenFieldsPanel.tsx +121 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/JumpsEditor.tsx +237 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/RecallTokenPicker.tsx +87 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/VariablesPanel.tsx +260 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/condition-model.ts +207 -0
- package/src/modules/forms/backend/forms/[id]/studio/lucide-icons.ts +87 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/FormAppearancePanel.tsx +561 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/FormPalettePanel.tsx +52 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/InputParametersTab.tsx +378 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/PaletteCard.tsx +40 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/RolesEditor.tsx +225 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/entries.ts +102 -0
- package/src/modules/forms/backend/forms/[id]/studio/preview/PreviewSurface.tsx +1459 -0
- package/src/modules/forms/backend/forms/[id]/studio/preview/ViewportFrame.tsx +49 -0
- package/src/modules/forms/backend/forms/[id]/studio/recall.ts +0 -0
- package/src/modules/forms/backend/forms/[id]/studio/schema-helpers.ts +2525 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/BackgroundControl.tsx +137 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/ColorControl.tsx +257 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/contrast.ts +114 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/presets.ts +104 -0
- package/src/modules/forms/backend/forms/[id]/studio/type-label.ts +13 -0
- package/src/modules/forms/backend/forms/[id]/studio/types.ts +31 -0
- package/src/modules/forms/backend/forms/[id]/studio/undo-controller.ts +52 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/FileConstraintsEditor.tsx +89 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/GroupConfigEditor.tsx +167 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/LengthRangeEditor.tsx +67 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/MatrixColumnsEditor.tsx +166 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/MatrixRowsEditor.tsx +184 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/MessageOverridesEditor.tsx +83 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/NpsAnchorsEditor.tsx +60 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/NumberRangeEditor.tsx +65 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/OpinionIconSelect.tsx +46 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/PatternEditor.tsx +122 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/RankingExhaustiveSwitch.tsx +28 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/SignatureConfigEditor.tsx +84 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/ValidationPanel.tsx +369 -0
- package/src/modules/forms/backend/forms/[id]/submissions/components/RowBadges.ts +56 -0
- package/src/modules/forms/backend/forms/[id]/submissions/components/SubmissionDrawer.tsx +604 -0
- package/src/modules/forms/backend/forms/[id]/submissions/page.meta.ts +10 -0
- package/src/modules/forms/backend/forms/[id]/submissions/page.tsx +264 -0
- package/src/modules/forms/backend/forms/create/page.meta.ts +11 -0
- package/src/modules/forms/backend/forms/create/page.tsx +113 -0
- package/src/modules/forms/backend/forms/page.meta.ts +31 -0
- package/src/modules/forms/backend/forms/page.tsx +269 -0
- package/src/modules/forms/commands/distribution.ts +502 -0
- package/src/modules/forms/commands/form-version.ts +806 -0
- package/src/modules/forms/commands/form.ts +472 -0
- package/src/modules/forms/commands/index.ts +18 -0
- package/src/modules/forms/commands/invitation.ts +424 -0
- package/src/modules/forms/commands/shared.ts +261 -0
- package/src/modules/forms/commands/submission.ts +209 -0
- package/src/modules/forms/data/entities.ts +686 -0
- package/src/modules/forms/data/validators.ts +483 -0
- package/src/modules/forms/di.ts +246 -0
- package/src/modules/forms/encryption.ts +31 -0
- package/src/modules/forms/events-payloads.ts +103 -0
- package/src/modules/forms/events.ts +50 -0
- package/src/modules/forms/extension-points.ts +41 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.meta.ts +9 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.tsx +45 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.meta.ts +9 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.tsx +56 -0
- package/src/modules/forms/frontend/embed/[slug]/page.meta.ts +42 -0
- package/src/modules/forms/frontend/embed/[slug]/page.tsx +171 -0
- package/src/modules/forms/frontend/f/[slug]/page.meta.ts +9 -0
- package/src/modules/forms/frontend/f/[slug]/page.tsx +10 -0
- package/src/modules/forms/frontend/forms/[id]/run/page.meta.ts +17 -0
- package/src/modules/forms/frontend/forms/[id]/run/page.tsx +83 -0
- package/src/modules/forms/frontend/i/[token]/page.meta.ts +9 -0
- package/src/modules/forms/frontend/i/[token]/page.tsx +10 -0
- package/src/modules/forms/i18n/de.json +800 -0
- package/src/modules/forms/i18n/en.json +800 -0
- package/src/modules/forms/i18n/es.json +800 -0
- package/src/modules/forms/i18n/ko.json +800 -0
- package/src/modules/forms/i18n/pl.json +800 -0
- package/src/modules/forms/index.ts +18 -0
- package/src/modules/forms/lib/embed-frame-policy.ts +144 -0
- package/src/modules/forms/lib/form-definition-slicing.ts +54 -0
- package/src/modules/forms/lib/log-redaction.ts +91 -0
- package/src/modules/forms/lib/navigable-url.ts +57 -0
- package/src/modules/forms/lib/retention.ts +73 -0
- package/src/modules/forms/lib/runtime-principal.ts +101 -0
- package/src/modules/forms/migrations/.snapshot-open-mercato.json +3185 -0
- package/src/modules/forms/migrations/Migration20260508135459_forms.ts +17 -0
- package/src/modules/forms/migrations/Migration20260508140932_forms.ts +26 -0
- package/src/modules/forms/migrations/Migration20260508155737_forms.ts +15 -0
- package/src/modules/forms/migrations/Migration20260520120000_forms.ts +26 -0
- package/src/modules/forms/migrations/Migration20260521090000_forms.ts +15 -0
- package/src/modules/forms/migrations/Migration20260521120000_forms.ts +21 -0
- package/src/modules/forms/runner/FormRunner.tsx +924 -0
- package/src/modules/forms/runner/MatrixField.tsx +210 -0
- package/src/modules/forms/runner/RankingField.tsx +207 -0
- package/src/modules/forms/runner/ScaleField.tsx +102 -0
- package/src/modules/forms/runner/SignatureField.tsx +158 -0
- package/src/modules/forms/runner/tamper-check.ts +131 -0
- package/src/modules/forms/schema/address-countries.ts +60 -0
- package/src/modules/forms/schema/field-type-patterns.ts +21 -0
- package/src/modules/forms/schema/field-type-registry-advanced.ts +58 -0
- package/src/modules/forms/schema/field-type-registry.ts +819 -0
- package/src/modules/forms/schema/file-field.ts +102 -0
- package/src/modules/forms/schema/group-field.ts +235 -0
- package/src/modules/forms/schema/jsonlogic-grammar.ts +95 -0
- package/src/modules/forms/schema/jsonschema-extensions.ts +1060 -0
- package/src/modules/forms/schema/layout-catalog.ts +68 -0
- package/src/modules/forms/schema/signature-field.ts +120 -0
- package/src/modules/forms/schema/style-extensions.ts +194 -0
- package/src/modules/forms/schema/style-validators.ts +252 -0
- package/src/modules/forms/services/access-audit-logger.ts +275 -0
- package/src/modules/forms/services/analytics-service.ts +498 -0
- package/src/modules/forms/services/anonymize-service.ts +177 -0
- package/src/modules/forms/services/attachment-service.ts +223 -0
- package/src/modules/forms/services/captcha-verifier.ts +156 -0
- package/src/modules/forms/services/consent-record-service.ts +162 -0
- package/src/modules/forms/services/distribution-service.ts +509 -0
- package/src/modules/forms/services/distribution-token.ts +153 -0
- package/src/modules/forms/services/encryption-service.ts +500 -0
- package/src/modules/forms/services/export-service.ts +360 -0
- package/src/modules/forms/services/field-validation-service.ts +300 -0
- package/src/modules/forms/services/form-logic-evaluator.ts +718 -0
- package/src/modules/forms/services/form-version-compiler.ts +829 -0
- package/src/modules/forms/services/form-version-differ.ts +143 -0
- package/src/modules/forms/services/jsonlogic-evaluator.ts +228 -0
- package/src/modules/forms/services/pdf-snapshot-service.ts +782 -0
- package/src/modules/forms/services/prefill-resolver.ts +125 -0
- package/src/modules/forms/services/role-policy-service.ts +90 -0
- package/src/modules/forms/services/style-compiler.ts +378 -0
- package/src/modules/forms/services/submission-service.ts +1259 -0
- package/src/modules/forms/services/upload-scanner.ts +36 -0
- package/src/modules/forms/services/upload-validation.ts +94 -0
- package/src/modules/forms/services/visibility-resolver.ts +63 -0
- package/src/modules/forms/setup.ts +16 -0
- package/src/modules/forms/subscribers/forms-consent-projector.ts +100 -0
- package/src/modules/forms/subscribers/forms-pdf-snapshot.ts +112 -0
- package/src/modules/forms/subscribers/forms-webhook-bridge-anonymized.ts +36 -0
- package/src/modules/forms/subscribers/forms-webhook-bridge.ts +56 -0
- package/src/modules/forms/subscribers/invitation-email.ts +180 -0
- package/src/modules/forms/translations.ts +14 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/CreateDistributionDialog.tsx +401 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/DistributionsPanel.tsx +381 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/EmbedSettingsDialog.tsx +332 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/RecipientsTable.tsx +460 -0
- package/src/modules/forms/ui/public/EmbeddedForm.tsx +248 -0
- package/src/modules/forms/ui/public/FormRunner.tsx +491 -0
- package/src/modules/forms/ui/public/FormTrigger.tsx +80 -0
- package/src/modules/forms/ui/public/PublicFormRunnerPage.tsx +34 -0
- package/src/modules/forms/ui/public/components/CompletionScreen.tsx +97 -0
- package/src/modules/forms/ui/public/components/LocaleSwitch.tsx +42 -0
- package/src/modules/forms/ui/public/components/ResumeGate.tsx +61 -0
- package/src/modules/forms/ui/public/components/ReviewStep.tsx +153 -0
- package/src/modules/forms/ui/public/components/SaveIndicator.tsx +69 -0
- package/src/modules/forms/ui/public/components/SectionStepper.tsx +60 -0
- package/src/modules/forms/ui/public/index.ts +48 -0
- package/src/modules/forms/ui/public/renderers/index.tsx +889 -0
- package/src/modules/forms/ui/public/state/logic-derivation.ts +91 -0
- package/src/modules/forms/ui/public/state/runtime-client.ts +495 -0
- package/src/modules/forms/ui/public/state/useAutosave.ts +97 -0
- package/src/modules/forms/ui/public/state/useFormRunner.ts +547 -0
- package/src/modules/forms/ui/public/style/LogoHeader.tsx +43 -0
- package/src/modules/forms/ui/public/style/applyStyle.ts +26 -0
- package/src/modules/forms/ui/public/types.ts +228 -0
- package/src/modules/forms/widgets/injection/access-audit-panel/widget.tsx +144 -0
- package/src/modules/forms/widgets/injection/anonymize-button/widget.tsx +177 -0
- package/src/modules/forms/widgets/injection/audit-format.ts +60 -0
- package/src/modules/forms/widgets/injection/context.ts +24 -0
- package/src/modules/forms/widgets/injection/embedded-form/widget.tsx +102 -0
- package/src/modules/forms/widgets/injection/pdf-download-button/widget.tsx +111 -0
- package/src/modules/forms/widgets/injection/self-audit-footer/widget.tsx +56 -0
- package/src/modules/forms/widgets/injection-table.ts +54 -0
- package/src/modules/forms/workers/pdf-snapshot.ts +110 -0
- package/src/modules/forms/workers/retention-purge.ts +169 -0
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.ts +7 -1
- package/src/modules/inbox_ops/data/validators.ts +2 -1
- package/src/modules/inbox_ops/lib/llmProvider.ts +11 -0
- package/src/modules/inbox_ops/widgets/notifications/ProposalCreatedRenderer.tsx +2 -2
- package/src/modules/integrations/di.ts +5 -1
- package/src/modules/integrations/lib/credentials-service.ts +45 -36
- package/src/modules/messages/api/[id]/attachments/route.ts +12 -3
- package/src/modules/messages/api/[id]/forward-preview/route.ts +9 -3
- package/src/modules/messages/api/[id]/route.ts +83 -4
- package/src/modules/messages/api/route.ts +123 -2
- package/src/modules/messages/commands/messages.ts +81 -7
- package/src/modules/messages/components/ComposeMessagePageClient.tsx +29 -1
- package/src/modules/messages/data/validators.ts +10 -0
- package/src/modules/messages/i18n/de.json +8 -0
- package/src/modules/messages/i18n/en.json +8 -0
- package/src/modules/messages/i18n/es.json +8 -0
- package/src/modules/messages/i18n/ko.json +8 -0
- package/src/modules/messages/i18n/pl.json +8 -0
- package/src/modules/messages/lib/channelThreadAccess.ts +101 -0
- package/src/modules/messages/lib/composeSenderDelegation.ts +182 -0
- package/src/modules/messages/lib/composeSenderOptions.ts +56 -0
- package/src/modules/messages/lib/email-sender.ts +1 -17
- package/src/modules/messages/lib/forwarding.ts +17 -2
- package/src/modules/messages/lib/markdownEmailBody.ts +25 -0
- package/src/modules/messages/lib/messageSourceEntityTypes.ts +12 -0
- package/src/modules/messages/lib/routeHelpers.ts +92 -0
- package/src/modules/messages/subscribers/message-notification.ts +47 -1
- package/src/modules/notifications/api/[id]/action/route.ts +2 -1
- package/src/modules/notifications/api/openapi.ts +1 -0
- package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +77 -48
- package/src/modules/notifications/i18n/de.json +1 -0
- package/src/modules/notifications/i18n/en.json +1 -0
- package/src/modules/notifications/i18n/es.json +1 -0
- package/src/modules/notifications/i18n/ko.json +1 -0
- package/src/modules/notifications/i18n/pl.json +1 -0
- package/src/modules/notifications/lib/deliveryConfig.ts +31 -2
- package/src/modules/notifications/lib/notificationMapper.ts +2 -0
- package/src/modules/notifications/lib/safeHref.ts +7 -0
- package/src/modules/planner/api/availability-date-specific.ts +2 -1
- package/src/modules/planner/api/availability-weekly.ts +2 -1
- package/src/modules/progress/AGENTS.md +2 -0
- package/src/modules/progress/api/active/route.ts +14 -2
- package/src/modules/progress/api/jobs/[id]/route.ts +44 -27
- package/src/modules/progress/api/jobs/route.ts +22 -8
- package/src/modules/progress/api/requestScope.ts +43 -0
- package/src/modules/progress/lib/organizationScope.ts +17 -0
- package/src/modules/progress/lib/progressService.ts +3 -2
- package/src/modules/progress/lib/progressServiceImpl.ts +63 -14
- package/src/modules/push_notifications/api/custom-send/route.ts +4 -1
- package/src/modules/query_index/api/status.ts +4 -9
- package/src/modules/query_index/di.ts +2 -1
- package/src/modules/query_index/lib/engine.ts +2 -0
- package/src/modules/query_index/lib/request-encryption.ts +31 -0
- package/src/modules/query_index/lib/search-tokens.ts +42 -1
- package/src/modules/resources/api/resources/tags/assign/route.ts +2 -1
- package/src/modules/resources/api/resources/tags/unassign/route.ts +2 -1
- package/src/modules/resources/commands/activities.ts +2 -2
- package/src/modules/sales/api/document-history/route.ts +5 -1
- package/src/modules/sales/api/document-numbers/route.ts +2 -1
- package/src/modules/sales/api/quotes/convert/route.ts +2 -1
- package/src/modules/sales/api/quotes/send/route.ts +2 -1
- package/src/modules/sales/api/settings/document-numbers/route.ts +7 -1
- package/src/modules/sales/api/settings/order-editing/route.ts +7 -1
- package/src/modules/sales/commands/documents.ts +451 -131
- package/src/modules/sales/commands/payments.ts +2 -1
- package/src/modules/sales/commands/settings.ts +34 -6
- package/src/modules/sales/commands/shipments.ts +2 -1
- package/src/modules/sales/components/DocumentNumberSettings.tsx +41 -28
- package/src/modules/sales/components/documents/ItemsSection.tsx +58 -13
- package/src/modules/sales/components/documents/LineItemDialog.tsx +194 -111
- package/src/modules/sales/components/documents/lineItemUtils.ts +18 -0
- package/src/modules/sales/i18n/de.json +2 -0
- package/src/modules/sales/i18n/en.json +2 -0
- package/src/modules/sales/i18n/es.json +2 -0
- package/src/modules/sales/i18n/ko.json +2 -0
- package/src/modules/sales/i18n/pl.json +2 -0
- package/src/modules/sales/lib/lineSnapshots.ts +36 -0
- package/src/modules/sales/setup.ts +4 -4
- package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +2 -2
- package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +2 -2
- package/src/modules/staff/api/leave-requests/accept/route.ts +2 -1
- package/src/modules/staff/api/leave-requests/reject/route.ts +2 -1
- package/src/modules/staff/api/leave-requests.ts +2 -1
- package/src/modules/staff/api/team-members/self/route.ts +2 -1
- package/src/modules/staff/api/team-members/tags/assign/route.ts +2 -1
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +2 -1
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +16 -16
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +2 -1
- package/src/modules/staff/api/timesheets/my-projects/route.ts +2 -1
- package/src/modules/staff/api/timesheets/my-work/route.ts +2 -1
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +2 -1
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +2 -1
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +3 -2
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +3 -2
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +3 -2
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +2 -1
- package/src/modules/staff/api/timesheets/reports/shared.ts +2 -1
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +2 -1
- package/src/modules/staff/commands/activities.ts +2 -2
- package/src/modules/staff/commands/timesheets-entries.ts +3 -2
- package/src/modules/staff/commands/timesheets-reports.ts +88 -15
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +1 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +69 -8
- package/src/modules/staff/lib/timesheets-reports/reportPeriod.ts +18 -0
- package/src/modules/staff/lib/timesheets-ui/CalendarPicker.tsx +21 -10
- package/src/modules/sync_excel/api/import/route.ts +40 -12
- package/src/modules/sync_excel/api/upload/route.ts +34 -4
- package/src/modules/translations/api/context.ts +2 -1
- package/src/modules/warranty_claims/api/ai/assess/route.ts +2 -1
- package/src/modules/warranty_claims/api/ai/draft-reply/route.ts +2 -1
- package/src/modules/warranty_claims/api/ai/suggest/route.ts +2 -1
- package/src/modules/warranty_claims/api/assign/route.ts +2 -1
- package/src/modules/warranty_claims/api/credit-memo/route.ts +2 -1
- package/src/modules/warranty_claims/api/entitlement/route.ts +2 -1
- package/src/modules/warranty_claims/api/events/route.ts +2 -1
- package/src/modules/warranty_claims/api/external/claims/route.ts +2 -1
- package/src/modules/warranty_claims/api/receiving/route.ts +2 -1
- package/src/modules/warranty_claims/api/replacement-order/route.ts +2 -1
- package/src/modules/warranty_claims/api/return-label/route.ts +2 -1
- package/src/modules/warranty_claims/api/risk/route.ts +2 -1
- package/src/modules/warranty_claims/api/sales-return/route.ts +2 -1
- package/src/modules/warranty_claims/api/settings-general/route.ts +2 -1
- package/src/modules/warranty_claims/api/stats/route.ts +11 -11
- package/src/modules/warranty_claims/api/submit/route.ts +2 -1
- package/src/modules/warranty_claims/api/transition/route.ts +2 -1
- package/src/modules/warranty_claims/api/vendor-recovery/route.ts +2 -1
- package/src/modules/warranty_claims/api/vendor-recovery-suggestions/route.ts +2 -1
- package/src/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.tsx +1 -1
- package/src/modules/wms/api/dashboard/operational/route.ts +2 -1
- package/src/modules/wms/api/inventory/cycle-count/route.ts +1 -0
- package/src/modules/wms/api/inventory/helpers.ts +2 -1
- package/src/modules/wms/api/inventory/import/helpers.ts +2 -1
- package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +2 -1
- package/src/modules/wms/commands/inventory-actions.ts +45 -1
- package/src/modules/wms/components/backend/CycleCountWizardDialog.tsx +14 -1
- package/src/modules/wms/di.ts +6 -0
- package/src/modules/wms/i18n/de.json +1 -0
- package/src/modules/wms/i18n/en.json +1 -0
- package/src/modules/wms/i18n/es.json +1 -0
- package/src/modules/wms/i18n/ko.json +1 -0
- package/src/modules/wms/i18n/pl.json +1 -0
- package/src/modules/wms/lib/availabilityCache.ts +137 -0
- package/src/modules/wms/lib/availabilityCalculation.ts +351 -0
- package/src/modules/wms/lib/availabilityProvider.ts +47 -0
- package/src/modules/wms/lib/loadOperationalDashboard.ts +51 -3
- package/src/modules/wms/lib/lowStockBalanceFilter.ts +23 -10
- package/src/modules/wms/lib/sqlInClause.ts +21 -0
- package/src/modules/wms/lib/tryResolve.ts +8 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache-policy.ts +18 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache-profile.ts +18 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache.ts +30 -0
- package/src/modules/wms/widgets/notifications/WmsLowStockRenderer.tsx +2 -2
- package/src/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.tsx +4 -3
- package/src/modules/workflows/AGENTS.md +7 -5
- package/src/modules/workflows/api/commands/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/callers/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/context-schema/route.ts +4 -2
- package/src/modules/workflows/api/definitions/[id]/customize/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/draft/route.ts +6 -1
- package/src/modules/workflows/api/definitions/[id]/publish/route.ts +10 -1
- package/src/modules/workflows/api/definitions/[id]/reset-to-code/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/route.ts +5 -3
- package/src/modules/workflows/api/definitions/[id]/test-step/route.ts +4 -2
- package/src/modules/workflows/api/definitions/generate/route.ts +4 -1
- package/src/modules/workflows/api/definitions/route.ts +4 -2
- package/src/modules/workflows/api/endpoints/route.ts +4 -1
- package/src/modules/workflows/api/functions/route.ts +4 -1
- package/src/modules/workflows/api/grantable-features/route.ts +2 -1
- package/src/modules/workflows/api/instances/[id]/advance/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/cancel/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/context/route.ts +2 -1
- package/src/modules/workflows/api/instances/[id]/rerun-step/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/retry/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/signal/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/step-through/route.ts +4 -2
- package/src/modules/workflows/api/instances/route.ts +4 -2
- package/src/modules/workflows/api/instances/validate-start/route.ts +4 -1
- package/src/modules/workflows/api/rule-usage/route.ts +4 -1
- package/src/modules/workflows/api/signals/route.ts +4 -1
- package/src/modules/workflows/api/tasks/[id]/claim/route.ts +4 -1
- package/src/modules/workflows/api/tasks/[id]/complete/route.ts +4 -1
- package/src/modules/workflows/api/tasks/[id]/reassign/route.ts +2 -1
- package/src/modules/workflows/api/tasks/[id]/unclaim/route.ts +4 -1
- package/src/modules/workflows/api/templates/route.ts +4 -1
- package/src/modules/workflows/api/work-inbox/next/route.ts +4 -1
- package/src/modules/workflows/lib/activity-executor.ts +125 -28
- package/src/modules/workflows/lib/activity-types.ts +8 -4
- package/src/modules/workflows/lib/activity-worker-handler.ts +16 -12
- package/src/modules/workflows/lib/event-trigger-service.ts +18 -2
- package/src/modules/workflows/lib/step-handler.ts +13 -8
- package/src/test-utils/transactionalEntityManagerDouble.ts +51 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/sales/commands/shipments.ts"],
|
|
4
|
-
"sourcesContent": ["// @ts-nocheck\n\nimport { randomUUID } from 'crypto'\nimport { registerCommand, type CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { LockMode } from '@mikro-orm/core'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { CrudHttpError, notFound } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { loadCustomFieldValues } from '@open-mercato/shared/lib/crud/custom-fields'\nimport { setRecordCustomFields } from '@open-mercato/core/modules/entities/lib/helpers'\nimport { E } from '#generated/entities.ids.generated'\nimport { SalesOrder, SalesOrderLine, SalesShipment, SalesShipmentItem } from '../data/entities'\nimport {\n shipmentCreateSchema,\n shipmentUpdateSchema,\n type ShipmentCreateInput,\n type ShipmentUpdateInput,\n} from '../data/validators'\nimport {\n coerceShipmentQuantity as toNumber,\n readShipmentItemsSnapshot,\n refreshShipmentItemsSnapshot,\n type ShipmentItemSnapshot,\n buildShipmentItemSnapshots,\n} from '../lib/shipments/snapshots'\nimport {\n cloneJson,\n ensureOrganizationScope,\n ensureSameScope,\n ensureTenantScope,\n extractUndoPayload,\n enforceSalesDocumentOptimisticLock,\n SALES_RESOURCE_KIND_ORDER,\n} from './shared'\nimport { resolveDictionaryEntryValue } from '../lib/dictionaries'\nimport { resolveRedoSnapshot } from '@open-mercato/shared/lib/commands/redo'\nimport type { DataEngine } from '@open-mercato/shared/lib/data/engine'\nimport { emitCrudSideEffects } from '@open-mercato/shared/lib/commands/helpers'\nimport type { CrudEventsConfig } from '@open-mercato/shared/lib/crud/types'\nimport { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst fallbackShipmentLogger = createLogger('sales').child({ component: 'shipments' })\n\nconst shipmentCrudEvents: CrudEventsConfig = {\n module: 'sales',\n entity: 'shipment',\n persistent: true,\n buildPayload: (ctx) => ({\n id: ctx.identifiers.id,\n organizationId: ctx.identifiers.organizationId,\n tenantId: ctx.identifiers.tenantId,\n }),\n}\n\nconst ADDRESS_SNAPSHOT_KEY = 'shipmentAddressSnapshot'\n\nexport type ShipmentSnapshot = {\n id: string\n orderId: string\n organizationId: string\n tenantId: string\n shipmentNumber: string | null\n shippingMethodId: string | null\n statusEntryId: string | null\n status: string | null\n carrierName: string | null\n trackingNumbers: string[] | null\n shippedAt: string | null\n deliveredAt: string | null\n weightValue: number | null\n weightUnit: string | null\n declaredValueNet: number | null\n declaredValueGross: number | null\n currencyCode: string | null\n notesText: string | null\n metadata: Record<string, unknown> | null\n customFields?: Record<string, unknown> | null\n items: ShipmentItemSnapshot[]\n itemsSnapshot?: ShipmentItemSnapshot[] | null\n}\n\ntype ShipmentUndoPayload = {\n before?: ShipmentSnapshot | null\n after?: ShipmentSnapshot | null\n}\n\nconst buildShipmentCreateRedoInput = (snapshot: ShipmentSnapshot): ShipmentCreateInput => ({\n orderId: snapshot.orderId,\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n shipmentNumber: snapshot.shipmentNumber ?? undefined,\n shippingMethodId: snapshot.shippingMethodId ?? undefined,\n statusEntryId: snapshot.statusEntryId ?? undefined,\n carrierName: snapshot.carrierName ?? undefined,\n trackingNumbers: snapshot.trackingNumbers ?? undefined,\n shippedAt: snapshot.shippedAt ? new Date(snapshot.shippedAt) : undefined,\n deliveredAt: snapshot.deliveredAt ? new Date(snapshot.deliveredAt) : undefined,\n weightValue: snapshot.weightValue ?? undefined,\n weightUnit: snapshot.weightUnit ?? undefined,\n declaredValueNet: snapshot.declaredValueNet ?? undefined,\n declaredValueGross: snapshot.declaredValueGross ?? undefined,\n currencyCode: snapshot.currencyCode ?? undefined,\n notes: snapshot.notesText ?? undefined,\n metadata: snapshot.metadata ? cloneJson(snapshot.metadata) : undefined,\n customFields: snapshot.customFields ? cloneJson(snapshot.customFields) : undefined,\n items: snapshot.items.map((item) => ({\n orderLineId: item.orderLineId,\n quantity: item.quantity,\n metadata: item.metadata ? cloneJson(item.metadata) : undefined,\n })),\n})\n\nconst parseTrackingNumbers = (input: unknown): string[] | null => {\n if (typeof input === 'string') {\n const entries = input\n .split(/[\\n,]/g)\n .map((value) => value.trim())\n .filter((value) => value.length > 0)\n return entries.length ? entries : null\n }\n if (Array.isArray(input)) {\n const entries = input\n .map((value) => (typeof value === 'string' ? value.trim() : ''))\n .filter((value) => value.length > 0)\n return entries.length ? entries : null\n }\n return null\n}\n\nconst normalizeCustomFieldsInput = (input: unknown): Record<string, unknown> =>\n input && typeof input === 'object' && !Array.isArray(input) ? (input as Record<string, unknown>) : {}\n\nconst resolveLogger = (ctx: any): { warn?: (meta: any, message?: string) => void } | null => {\n const container = ctx?.container as any\n if (!container) return null\n const cradleLogger = container?.cradle?.logger ?? null\n if (cradleLogger?.warn) return cradleLogger\n const hasRegistration = typeof container.hasRegistration === 'function' ? container.hasRegistration.bind(container) : null\n if (hasRegistration?.('logger')) {\n const logger = container.resolve('logger')\n if (logger?.warn) return logger\n }\n if (hasRegistration?.('coreLogger')) {\n const logger = container.resolve('coreLogger')\n if (logger?.warn) return logger\n }\n return null\n}\n\nconst logShipmentDeleteScopeRejection = (\n ctx: any,\n reason: string,\n meta: Record<string, unknown>\n): void => {\n const logger = resolveLogger(ctx)\n const payload = { ...meta, command: 'sales.shipments.delete' }\n if (logger?.warn) {\n logger.warn(payload, reason)\n return\n }\n fallbackShipmentLogger.warn(reason, payload)\n}\n\nexport async function loadShipmentSnapshot(em: EntityManager, id: string): Promise<ShipmentSnapshot | null> {\n const shipment = await em.findOne(\n SalesShipment,\n { id },\n { populate: ['order', 'items', 'items.orderLine'] }\n )\n if (!shipment || !shipment.order) return null\n const storedSnapshot = readShipmentItemsSnapshot(\n (shipment as any).itemsSnapshot ?? (shipment as any).items_snapshot ?? null\n )\n const lineMap = new Map(\n Array.from(shipment.items ?? [])\n .map((item) => {\n const line = typeof item.orderLine === 'string' ? null : (item.orderLine as SalesOrderLine | null)\n return line ? [line.id, line] : null\n })\n .filter((entry): entry is [string, SalesOrderLine] => Boolean(entry))\n )\n const fallbackItems = buildShipmentItemSnapshots(Array.from(shipment.items ?? []), { lineMap })\n const itemsSnapshot = storedSnapshot.length ? storedSnapshot : fallbackItems\n const customFieldValues = await loadCustomFieldValues({\n em,\n entityId: E.sales.sales_shipment,\n recordIds: [shipment.id],\n tenantIdByRecord: { [shipment.id]: shipment.tenantId ?? null },\n organizationIdByRecord: { [shipment.id]: shipment.organizationId ?? null },\n })\n const customFields = customFieldValues[shipment.id]\n return {\n id: shipment.id,\n orderId: typeof shipment.order === 'string' ? shipment.order : shipment.order.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n shipmentNumber: shipment.shipmentNumber ?? null,\n shippingMethodId: shipment.shippingMethodId ?? null,\n statusEntryId: shipment.statusEntryId ?? null,\n status: shipment.status ?? null,\n carrierName: shipment.carrierName ?? null,\n trackingNumbers: shipment.trackingNumbers ? [...shipment.trackingNumbers] : null,\n shippedAt: shipment.shippedAt ? shipment.shippedAt.toISOString() : null,\n deliveredAt: shipment.deliveredAt ? shipment.deliveredAt.toISOString() : null,\n weightValue: shipment.weightValue !== undefined && shipment.weightValue !== null ? Number(shipment.weightValue) : null,\n weightUnit: shipment.weightUnit ?? null,\n declaredValueNet:\n shipment.declaredValueNet !== undefined && shipment.declaredValueNet !== null\n ? Number(shipment.declaredValueNet)\n : null,\n declaredValueGross:\n shipment.declaredValueGross !== undefined && shipment.declaredValueGross !== null\n ? Number(shipment.declaredValueGross)\n : null,\n currencyCode: shipment.currencyCode ?? null,\n notesText: shipment.notesText ?? null,\n metadata: shipment.metadata ? cloneJson(shipment.metadata) : null,\n customFields: customFields && Object.keys(customFields).length ? customFields : null,\n items: itemsSnapshot,\n itemsSnapshot,\n }\n}\n\nexport async function restoreShipmentSnapshot(em: EntityManager, snapshot: ShipmentSnapshot): Promise<void> {\n const order = await findOneWithDecryption(em, SalesOrder, { id: snapshot.orderId }, {}, { tenantId: snapshot.tenantId, organizationId: snapshot.organizationId })\n if (!order) return\n const existing = await em.findOne(SalesShipment, { id: snapshot.id })\n const entity =\n existing ??\n em.create(SalesShipment, {\n id: snapshot.id,\n createdAt: new Date(),\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n })\n entity.order = order\n entity.organizationId = snapshot.organizationId\n entity.tenantId = snapshot.tenantId\n entity.shipmentNumber = snapshot.shipmentNumber ?? null\n entity.shippingMethodId = snapshot.shippingMethodId ?? null\n entity.statusEntryId = snapshot.statusEntryId ?? null\n entity.status = snapshot.status ?? null\n entity.carrierName = snapshot.carrierName ?? null\n entity.trackingNumbers = snapshot.trackingNumbers ? [...snapshot.trackingNumbers] : null\n entity.shippedAt = snapshot.shippedAt ? new Date(snapshot.shippedAt) : null\n entity.deliveredAt = snapshot.deliveredAt ? new Date(snapshot.deliveredAt) : null\n entity.weightValue = snapshot.weightValue !== null ? snapshot.weightValue.toString() : null\n entity.weightUnit = snapshot.weightUnit ?? null\n entity.declaredValueNet = snapshot.declaredValueNet !== null ? snapshot.declaredValueNet.toString() : null\n entity.declaredValueGross = snapshot.declaredValueGross !== null ? snapshot.declaredValueGross.toString() : null\n entity.currencyCode = snapshot.currencyCode ?? null\n entity.notesText = snapshot.notesText ?? null\n entity.metadata = snapshot.metadata ? cloneJson(snapshot.metadata) : null\n entity.updatedAt = new Date()\n em.persist(entity)\n await em.flush()\n\n const existingItems = await em.find(SalesShipmentItem, { shipment: entity })\n existingItems.forEach((item) => em.remove(item))\n const items = Array.isArray(snapshot.items) ? snapshot.items : []\n const lineIds = items\n .map((item) => item.orderLineId)\n .filter((id): id is string => typeof id === 'string' && id.length > 0)\n const lines = lineIds.length\n ? await em.find(SalesOrderLine, { id: { $in: lineIds }, order: order.id })\n : []\n const lineMap = new Map(lines.map((line) => [line.id, line]))\n const restoredItems: ShipmentItemSnapshot[] = []\n items.forEach((item) => {\n const line = lineMap.get(item.orderLineId)\n if (!line) return\n restoredItems.push(item)\n const lineRef = em.getReference(SalesOrderLine, line.id)\n const shipmentItem = em.create(SalesShipmentItem, {\n id: item.id ?? randomUUID(),\n shipment: entity,\n orderLine: lineRef,\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n quantity: item.quantity.toString(),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })\n em.persist(shipmentItem)\n })\n const snapshotItems = (snapshot.itemsSnapshot ?? restoredItems).filter((entry) =>\n entry?.orderLineId ? lineMap.has(entry.orderLineId) : false\n )\n entity.itemsSnapshot = snapshotItems && snapshotItems.length ? cloneJson(snapshotItems) : null\n if (!entity.itemsSnapshot) {\n await refreshShipmentItemsSnapshot(em, entity)\n }\n if ((snapshot as any).customFields !== undefined) {\n await setRecordCustomFields(em, {\n entityId: E.sales.sales_shipment,\n recordId: entity.id,\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n values: normalizeCustomFieldsInput((snapshot as any).customFields),\n })\n }\n em.persist(entity)\n}\n\nasync function deleteShipmentWithItems(em: EntityManager, shipment: SalesShipment): Promise<void> {\n const scope = { tenantId: shipment.tenantId, organizationId: shipment.organizationId }\n const items = await findWithDecryption(em, SalesShipmentItem, { shipment }, {}, scope)\n items.forEach((item) => em.remove(item))\n em.remove(shipment)\n await em.flush()\n}\n\nasync function recomputeFulfilledQuantities(em: EntityManager, order: SalesOrder): Promise<void> {\n const scope = { tenantId: order.tenantId, organizationId: order.organizationId }\n const shipments = await findWithDecryption(em, SalesShipment, { order, deletedAt: null }, {}, scope)\n const shipmentIds = shipments.map((entry) => entry.id)\n const shipmentItems = shipmentIds.length\n ? await findWithDecryption(em, SalesShipmentItem, { shipment: { $in: shipmentIds } }, {}, scope)\n : []\n const totals = shipmentItems.reduce<Map<string, number>>((acc, item) => {\n const lineId =\n typeof item.orderLine === 'string'\n ? item.orderLine\n : item.orderLine?.id ?? (item as any).orderLineId ?? null\n if (!lineId) return acc\n const next = (acc.get(lineId) ?? 0) + toNumber(item.quantity)\n acc.set(lineId, next)\n return acc\n }, new Map())\n const lines = await findWithDecryption(em, SalesOrderLine, { order }, { lockMode: LockMode.PESSIMISTIC_WRITE }, scope)\n lines.forEach((line) => {\n const shipped = totals.get(line.id) ?? 0\n line.fulfilledQuantity = shipped.toString()\n })\n}\n\nasync function loadOrder(\n em: EntityManager,\n id: string,\n scope?: { tenantId: string; organizationId: string }\n): Promise<SalesOrder> {\n const order = await findOneWithDecryption(em, SalesOrder, { id, deletedAt: null }, {}, scope)\n if (!order) throw notFound('sales.shipments.not_found')\n return order\n}\n\nasync function loadShippedTotals(\n em: EntityManager,\n order: SalesOrder,\n excludeShipmentId?: string | null\n): Promise<Map<string, number>> {\n const scope = { tenantId: order.tenantId, organizationId: order.organizationId }\n const shipments = await findWithDecryption(em, SalesShipment, { order, deletedAt: null }, {}, scope)\n const shipmentIds = shipments\n .map((entry) => entry.id)\n .filter((id) => !excludeShipmentId || id !== excludeShipmentId)\n if (!shipmentIds.length) return new Map()\n const items = await findWithDecryption(em, SalesShipmentItem, { shipment: { $in: shipmentIds } }, {}, scope)\n return items.reduce<Map<string, number>>((acc, item) => {\n const lineId =\n typeof item.orderLine === 'string'\n ? item.orderLine\n : item.orderLine?.id ?? (item as any).orderLineId ?? null\n if (!lineId) return acc\n const next = (acc.get(lineId) ?? 0) + toNumber(item.quantity)\n acc.set(lineId, next)\n return acc\n }, new Map())\n}\n\nasync function validateShipmentItems(params: {\n em: EntityManager\n order: SalesOrder\n items?: ShipmentCreateInput['items']\n excludeShipmentId?: string | null\n lockOrderLines?: boolean\n}): Promise<{\n items: Array<{ orderLineId: string; quantity: number; metadata: Record<string, unknown> | null }>\n lineMap: Map<string, SalesOrderLine>\n}> {\n const { em, order, items, excludeShipmentId, lockOrderLines } = params\n const { translate } = await resolveTranslations()\n if (!items || !items.length) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.items_required', 'Add at least one line to ship.') })\n }\n const scope = { tenantId: order.tenantId, organizationId: order.organizationId }\n const orderLines = await findWithDecryption(\n em,\n SalesOrderLine,\n { order },\n lockOrderLines ? { lockMode: LockMode.PESSIMISTIC_WRITE } : undefined,\n scope,\n )\n const lineMap = new Map(orderLines.map((line) => [line.id, line]))\n const shippedTotals = await loadShippedTotals(em, order, excludeShipmentId)\n const requestedTotals = new Map<string, number>()\n\n for (const item of items) {\n const lineId = item.orderLineId\n const quantity = toNumber(item.quantity)\n if (!lineId || quantity <= 0) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.items_required', 'Add at least one line to ship.') })\n }\n const line = lineMap.get(lineId)\n if (!line) {\n throw notFound(translate('sales.shipments.line_missing', 'Order line not found.'))\n }\n const lineTotal = toNumber(line.quantity)\n const alreadyShipped = shippedTotals.get(lineId) ?? 0\n const nextTotal = (requestedTotals.get(lineId) ?? 0) + quantity\n if (nextTotal + alreadyShipped - 1e-6 > lineTotal) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.quantity_exceeded', 'Cannot ship more than the remaining quantity.') })\n }\n requestedTotals.set(lineId, nextTotal)\n }\n\n return {\n items: items.map((item) => ({\n orderLineId: item.orderLineId,\n quantity: toNumber(item.quantity),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })),\n lineMap,\n }\n}\n\nfunction mergeAddressSnapshot(\n baseMetadata: Record<string, unknown> | null | undefined,\n snapshot: Record<string, unknown> | null | undefined\n): Record<string, unknown> | null {\n const metadata = baseMetadata ? { ...baseMetadata } : {}\n if (snapshot && typeof snapshot === 'object') {\n metadata[ADDRESS_SNAPSHOT_KEY] = cloneJson(snapshot)\n }\n return Object.keys(metadata).length ? metadata : null\n}\n\nconst createShipmentCommand: CommandHandler<ShipmentCreateInput, { shipmentId: string }> = {\n id: 'sales.shipments.create',\n async execute(rawInput, ctx) {\n const input = shipmentCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, input.tenantId)\n ensureOrganizationScope(ctx, input.organizationId)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const { translate } = await resolveTranslations()\n const shipment = await em.transactional(async (tx) => {\n const order = await loadOrder(tx, input.orderId, { tenantId: input.tenantId, organizationId: input.organizationId })\n ensureSameScope(order, input.organizationId, input.tenantId)\n // Guard the parent order's aggregate version (Gap B): a shipment mutation\n // recalculates the order's fulfilled quantities, so a stale parent must 409\n // before we touch it.\n await enforceSalesDocumentOptimisticLock(ctx, order, SALES_RESOURCE_KIND_ORDER)\n const { items: normalizedItems, lineMap } = await validateShipmentItems({\n em: tx,\n order,\n items: input.items,\n lockOrderLines: true,\n })\n const statusValue = await resolveDictionaryEntryValue(tx, input.statusEntryId ?? null, { tenantId: input.tenantId })\n const trackingNumbers = parseTrackingNumbers(input.trackingNumbers) ?? null\n const metadata =\n mergeAddressSnapshot(\n input.metadata ? cloneJson(input.metadata) : null,\n input.shipmentAddressSnapshot ?? order.shippingAddressSnapshot ?? null\n ) ?? null\n\n const shipmentId = randomUUID()\n const entity = tx.create(SalesShipment, {\n id: shipmentId,\n order,\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n shipmentNumber: input.shipmentNumber ?? null,\n shippingMethodId: input.shippingMethodId ?? null,\n statusEntryId: input.statusEntryId ?? null,\n status: statusValue,\n carrierName: input.carrierName ?? null,\n trackingNumbers,\n shippedAt: input.shippedAt ?? null,\n deliveredAt: input.deliveredAt ?? null,\n weightValue: input.weightValue !== undefined ? input.weightValue.toString() : null,\n weightUnit: input.weightUnit ?? null,\n declaredValueNet: input.declaredValueNet !== undefined ? input.declaredValueNet.toString() : null,\n declaredValueGross: input.declaredValueGross !== undefined ? input.declaredValueGross.toString() : null,\n currencyCode: input.currencyCode ?? order.currencyCode ?? null,\n notesText: input.notes ?? null,\n metadata,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n const createdItems: SalesShipmentItem[] = []\n normalizedItems.forEach((item) => {\n const lineRef = tx.getReference(SalesOrderLine, item.orderLineId)\n const shipmentItem = tx.create(SalesShipmentItem, {\n id: randomUUID(),\n shipment: entity,\n orderLine: lineRef,\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n quantity: item.quantity.toString(),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })\n createdItems.push(shipmentItem)\n tx.persist(shipmentItem)\n })\n tx.persist(entity)\n if (input.customFields !== undefined) {\n await setRecordCustomFields(tx, {\n entityId: E.sales.sales_shipment,\n recordId: entity.id,\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n values: normalizeCustomFieldsInput(input.customFields),\n })\n }\n if (input.documentStatusEntryId !== undefined) {\n const orderStatus = await resolveDictionaryEntryValue(tx, input.documentStatusEntryId ?? null, { tenantId: input.tenantId })\n if (input.documentStatusEntryId && !orderStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n order.statusEntryId = input.documentStatusEntryId ?? null\n order.status = orderStatus\n order.updatedAt = new Date()\n }\n if (input.lineStatusEntryId !== undefined) {\n const lineStatus = await resolveDictionaryEntryValue(tx, input.lineStatusEntryId ?? null, { tenantId: input.tenantId })\n if (input.lineStatusEntryId && !lineStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n const uniqueLineIds = Array.from(new Set(normalizedItems.map((item) => item.orderLineId)))\n uniqueLineIds.forEach((lineId) => {\n const line = lineMap.get(lineId)\n if (!line) return\n line.statusEntryId = input.lineStatusEntryId ?? null\n line.status = lineStatus\n line.updatedAt = new Date()\n })\n }\n await refreshShipmentItemsSnapshot(tx, entity, { items: createdItems, lineMap })\n await tx.flush()\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n return entity\n })\n\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'created',\n entity: shipment,\n identifiers: {\n id: shipment.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n\n return { shipmentId: shipment.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return loadShipmentSnapshot(em, result.shipmentId)\n },\n buildLog: async ({ result, snapshots }) => {\n const after = snapshots.after as ShipmentSnapshot | undefined\n if (!after) return null\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('sales.audit.shipments.create', 'Create shipment'),\n resourceKind: 'sales.shipment',\n resourceId: result.shipmentId,\n parentResourceKind: 'sales.order',\n parentResourceId: after.orderId ?? null,\n tenantId: after.tenantId,\n organizationId: after.organizationId,\n snapshotAfter: after,\n payload: {\n undo: { after } satisfies ShipmentUndoPayload,\n __redoInput: buildShipmentCreateRedoInput(after),\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ShipmentUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n const existing = await findOneWithDecryption(\n tx,\n SalesShipment,\n { id: after.id },\n { populate: ['order'] },\n { tenantId: after.tenantId, organizationId: after.organizationId },\n )\n if (!existing) return\n const order = existing.order as SalesOrder | null\n await deleteShipmentWithItems(tx, existing)\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n },\n redo: async ({ ctx, logEntry }) => {\n const after = resolveRedoSnapshot<ShipmentSnapshot>(logEntry)\n const shipmentId = after?.id ?? logEntry.resourceId ?? null\n if (!after || !shipmentId) {\n throw new CrudHttpError(400, { error: '[internal] redo snapshot unavailable for sales.shipments.create' })\n }\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n await restoreShipmentSnapshot(tx, after)\n const order = await findOneWithDecryption(tx, SalesOrder, { id: after.orderId }, {}, { tenantId: after.tenantId, organizationId: after.organizationId })\n await tx.flush()\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n\n const shipment = await findOneWithDecryption(\n em,\n SalesShipment,\n { id: after.id },\n {},\n { tenantId: after.tenantId, organizationId: after.organizationId },\n )\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'created',\n entity: shipment,\n identifiers: {\n id: after.id,\n organizationId: after.organizationId,\n tenantId: after.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n\n return { shipmentId: after.id }\n },\n}\n\nconst updateShipmentCommand: CommandHandler<ShipmentUpdateInput, { shipmentId: string }> = {\n id: 'sales.shipments.update',\n async prepare(rawInput, ctx) {\n const parsed = shipmentUpdateSchema.parse(rawInput ?? {})\n if (!parsed.id) return {}\n const em = ctx.container.resolve('em') as EntityManager\n const snapshot = await loadShipmentSnapshot(em, parsed.id)\n if (snapshot) {\n ensureTenantScope(ctx, snapshot.tenantId)\n ensureOrganizationScope(ctx, snapshot.organizationId)\n }\n return snapshot ? { before: snapshot } : {}\n },\n async execute(rawInput, ctx) {\n const input = shipmentUpdateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, input.tenantId)\n ensureOrganizationScope(ctx, input.organizationId)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const { translate } = await resolveTranslations()\n\n const shipment = await em.transactional(async (tx) => {\n const shipmentEntity = await findOneWithDecryption(\n tx,\n SalesShipment,\n { id: input.id },\n { populate: ['order'] },\n { tenantId: input.tenantId, organizationId: input.organizationId },\n )\n if (!shipmentEntity || !shipmentEntity.order) {\n throw notFound('sales.shipments.not_found')\n }\n ensureSameScope(shipmentEntity, input.organizationId, input.tenantId)\n const order = shipmentEntity.order as SalesOrder\n if (input.orderId && input.orderId !== order.id) {\n throw new CrudHttpError(400, { error: 'sales.shipments.invalid_order' })\n }\n // Guard the parent order's aggregate version (Gap B): updating a shipment\n // recalculates the order's fulfilled quantities, so a stale parent must 409\n // before we touch it.\n await enforceSalesDocumentOptimisticLock(ctx, order, SALES_RESOURCE_KIND_ORDER)\n\n // Check if order is financially closed - prevent modifications to shipments\n const paidAmount = parseFloat(order.paidTotalAmount || '0')\n const refundedAmount = parseFloat(order.refundedTotalAmount || '0')\n const grandTotal = parseFloat(order.grandTotalGrossAmount || '0')\n const tolerance = 1e-4 // Tolerance for floating-point comparisons\n\n // Check for full refund first (higher priority than payment)\n const isFullyRefunded = refundedAmount >= grandTotal - tolerance\n if (isFullyRefunded) {\n throw new CrudHttpError(422, { error: translate('sales.shipments.fully_returned', 'Cannot modify shipment: order is fully returned') })\n }\n\n // Check for completed payment\n const isFullyPaid = paidAmount >= grandTotal - tolerance\n if (isFullyPaid) {\n throw new CrudHttpError(422, { error: translate('sales.shipments.payment_completed', 'Cannot modify shipment: order payment is completed') })\n }\n const validatedItems = input.items\n ? await validateShipmentItems({\n em: tx,\n order,\n items: input.items,\n excludeShipmentId: shipmentEntity.id,\n })\n : null\n const normalizedItems = validatedItems?.items ?? null\n const lineMap = validatedItems?.lineMap ?? new Map<string, SalesOrderLine>()\n // Resolve the status label BEFORE mutating shipment scalars so this\n // dictionary read does not interleave with (and drop) the pending\n // shipment changeset under MikroORM v7 (SPEC-018 / #2453 class).\n const resolvedShipmentStatus = input.statusEntryId !== undefined\n ? await resolveDictionaryEntryValue(tx, input.statusEntryId ?? null, { tenantId: shipmentEntity.tenantId })\n : undefined\n if (input.shipmentNumber !== undefined) shipmentEntity.shipmentNumber = input.shipmentNumber ?? null\n if (input.shippingMethodId !== undefined) shipmentEntity.shippingMethodId = input.shippingMethodId ?? null\n if (input.statusEntryId !== undefined) {\n shipmentEntity.statusEntryId = input.statusEntryId ?? null\n shipmentEntity.status = resolvedShipmentStatus ?? null\n }\n if (input.carrierName !== undefined) shipmentEntity.carrierName = input.carrierName ?? null\n if (input.trackingNumbers !== undefined) shipmentEntity.trackingNumbers = parseTrackingNumbers(input.trackingNumbers)\n if (input.shippedAt !== undefined) shipmentEntity.shippedAt = input.shippedAt ?? null\n if (input.deliveredAt !== undefined) shipmentEntity.deliveredAt = input.deliveredAt ?? null\n if (input.weightValue !== undefined) shipmentEntity.weightValue = input.weightValue !== null ? input.weightValue.toString() : null\n if (input.weightUnit !== undefined) shipmentEntity.weightUnit = input.weightUnit ?? null\n if (input.declaredValueNet !== undefined) {\n shipmentEntity.declaredValueNet = input.declaredValueNet !== null ? input.declaredValueNet.toString() : null\n }\n if (input.declaredValueGross !== undefined) {\n shipmentEntity.declaredValueGross = input.declaredValueGross !== null ? input.declaredValueGross.toString() : null\n }\n if (input.currencyCode !== undefined) shipmentEntity.currencyCode = input.currencyCode ?? null\n if (input.notes !== undefined) shipmentEntity.notesText = input.notes ?? null\n if (input.metadata !== undefined || input.shipmentAddressSnapshot !== undefined) {\n shipmentEntity.metadata = mergeAddressSnapshot(\n input.metadata ? cloneJson(input.metadata) : shipmentEntity.metadata ?? null,\n input.shipmentAddressSnapshot\n )\n }\n shipmentEntity.updatedAt = new Date()\n\n // Persist the shipment scalar mutations before the item reads below run on\n // the same EntityManager. Under MikroORM v7 an interleaved query (the\n // findWithDecryption on SalesShipmentItem here and in the snapshot step)\n // resets the identity-map changeset, so shippingMethodId/status/carrier/etc.\n // would silently not persist even though the write returns 200 (#2453).\n await tx.flush()\n\n const shouldLoadItems = Boolean(normalizedItems || input.lineStatusEntryId !== undefined)\n const existingItems = shouldLoadItems ? await findWithDecryption(tx, SalesShipmentItem, { shipment: shipmentEntity }, {}, { tenantId: shipmentEntity.tenantId, organizationId: shipmentEntity.organizationId }) : []\n const newItems: SalesShipmentItem[] = []\n if (normalizedItems) {\n existingItems.forEach((item) => tx.remove(item))\n normalizedItems.forEach((item) => {\n const lineRef = tx.getReference(SalesOrderLine, item.orderLineId)\n const shipmentItem = tx.create(SalesShipmentItem, {\n id: randomUUID(),\n shipment: shipmentEntity,\n orderLine: lineRef,\n organizationId: shipmentEntity.organizationId,\n tenantId: shipmentEntity.tenantId,\n quantity: item.quantity.toString(),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })\n newItems.push(shipmentItem)\n tx.persist(shipmentItem)\n })\n }\n\n if (input.customFields !== undefined) {\n await setRecordCustomFields(tx, {\n entityId: E.sales.sales_shipment,\n recordId: shipmentEntity.id,\n organizationId: shipmentEntity.organizationId,\n tenantId: shipmentEntity.tenantId,\n values: normalizeCustomFieldsInput(input.customFields),\n })\n }\n if (input.documentStatusEntryId !== undefined) {\n const orderStatus = await resolveDictionaryEntryValue(tx, input.documentStatusEntryId ?? null, { tenantId: shipmentEntity.tenantId })\n if (input.documentStatusEntryId && !orderStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n order.statusEntryId = input.documentStatusEntryId ?? null\n order.status = orderStatus\n order.updatedAt = new Date()\n }\n if (input.lineStatusEntryId !== undefined) {\n const lineStatus = await resolveDictionaryEntryValue(tx, input.lineStatusEntryId ?? null, { tenantId: shipmentEntity.tenantId })\n if (input.lineStatusEntryId && !lineStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n const targetLineIds = normalizedItems\n ? Array.from(new Set(normalizedItems.map((item) => item.orderLineId)))\n : Array.from(\n new Set(\n existingItems\n .map((item) =>\n typeof item.orderLine === 'string'\n ? item.orderLine\n : (item.orderLine as SalesOrderLine | null)?.id ?? null\n )\n .filter((id): id is string => Boolean(id))\n )\n )\n if (targetLineIds.length) {\n const missing = targetLineIds.filter((id) => !lineMap.has(id))\n if (missing.length) {\n const fetched = await tx.find(SalesOrderLine, { id: { $in: missing } })\n fetched.forEach((line) => lineMap.set(line.id, line))\n }\n targetLineIds.forEach((lineId) => {\n const line = lineMap.get(lineId)\n if (!line) return\n line.statusEntryId = input.lineStatusEntryId ?? null\n line.status = lineStatus\n line.updatedAt = new Date()\n })\n }\n }\n\n // Flush any order/line status mutations applied above before the snapshot\n // read below queries the same EntityManager (same interleaved-read hazard).\n await tx.flush()\n const itemsForSnapshot =\n normalizedItems || shouldLoadItems\n ? (normalizedItems ? newItems : existingItems)\n : await findWithDecryption(tx, SalesShipmentItem, { shipment: shipmentEntity }, {}, { tenantId: shipmentEntity.tenantId, organizationId: shipmentEntity.organizationId })\n await refreshShipmentItemsSnapshot(tx, shipmentEntity, { items: itemsForSnapshot, lineMap })\n await tx.flush()\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n return shipmentEntity\n })\n\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'updated',\n entity: shipment,\n identifiers: {\n id: shipment.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n\n return { shipmentId: shipment.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return loadShipmentSnapshot(em, result.shipmentId)\n },\n buildLog: async ({ snapshots, result }) => {\n const { translate } = await resolveTranslations()\n const before = snapshots.before as ShipmentSnapshot | undefined\n const after = snapshots.after as ShipmentSnapshot | undefined\n return {\n actionLabel: translate('sales.audit.shipments.update', 'Update shipment'),\n resourceKind: 'sales.shipment',\n resourceId: result.shipmentId,\n parentResourceKind: 'sales.order',\n parentResourceId: after?.orderId ?? before?.orderId ?? null,\n tenantId: after?.tenantId ?? before?.tenantId ?? null,\n organizationId: after?.organizationId ?? before?.organizationId ?? null,\n snapshotBefore: before ?? null,\n snapshotAfter: after ?? null,\n payload: {\n undo: { before, after } satisfies ShipmentUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ShipmentUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n await restoreShipmentSnapshot(tx, before)\n const order = await findOneWithDecryption(tx, SalesOrder, { id: before.orderId }, {}, { tenantId: before.tenantId, organizationId: before.organizationId })\n await tx.flush()\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n },\n}\n\nconst deleteShipmentCommand: CommandHandler<\n { id: string; orderId: string; organizationId: string; tenantId: string },\n { shipmentId: string }\n> = {\n id: 'sales.shipments.delete',\n async prepare(rawInput, ctx) {\n const parsed = shipmentUpdateSchema.parse(rawInput ?? {})\n if (!parsed.id) return {}\n const em = ctx.container.resolve('em') as EntityManager\n const snapshot = await loadShipmentSnapshot(em, parsed.id)\n if (snapshot) {\n try {\n ensureTenantScope(ctx, snapshot.tenantId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Tenant mismatch while preparing shipment delete', {\n shipmentId: snapshot.id,\n snapshotTenantId: snapshot.tenantId,\n authTenantId: ctx.auth?.tenantId ?? null,\n })\n throw error\n }\n try {\n ensureOrganizationScope(ctx, snapshot.organizationId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Organization mismatch while preparing shipment delete', {\n shipmentId: snapshot.id,\n snapshotOrganizationId: snapshot.organizationId,\n selectedOrganizationId: ctx.selectedOrganizationId ?? null,\n authOrganizationId: ctx.auth?.orgId ?? null,\n })\n throw error\n }\n }\n return snapshot ? { before: snapshot } : {}\n },\n async execute(rawInput, ctx) {\n const { translate } = await resolveTranslations()\n const payload = shipmentUpdateSchema\n .pick({ id: true, orderId: true, organizationId: true, tenantId: true })\n .parse(rawInput ?? {})\n try {\n ensureTenantScope(ctx, payload.tenantId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Tenant mismatch while executing shipment delete', {\n shipmentId: payload.id,\n payloadTenantId: payload.tenantId,\n authTenantId: ctx.auth?.tenantId ?? null,\n })\n throw error\n }\n try {\n ensureOrganizationScope(ctx, payload.organizationId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Organization mismatch while executing shipment delete', {\n shipmentId: payload.id,\n payloadOrganizationId: payload.organizationId,\n selectedOrganizationId: ctx.selectedOrganizationId ?? null,\n authOrganizationId: ctx.auth?.orgId ?? null,\n })\n throw error\n }\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n\n const { shipment, shipmentItems } = await em.transactional(async (tx) => {\n const shipmentEntity = await findOneWithDecryption(\n tx,\n SalesShipment,\n { id: payload.id },\n { populate: ['order'] },\n { tenantId: payload.tenantId, organizationId: payload.organizationId },\n )\n if (!shipmentEntity || !shipmentEntity.order) {\n throw notFound(translate('sales.shipments.not_found', 'Shipment not found'))\n }\n try {\n ensureSameScope(shipmentEntity, payload.organizationId, payload.tenantId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Shipment scope mismatch against payload', {\n shipmentId: payload.id,\n shipmentOrganizationId: shipmentEntity.organizationId,\n shipmentTenantId: shipmentEntity.tenantId,\n payloadOrganizationId: payload.organizationId,\n payloadTenantId: payload.tenantId,\n })\n throw error\n }\n const order = shipmentEntity.order as SalesOrder\n if (order.id !== payload.orderId) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.invalid_order', 'Shipment does not belong to this order') })\n }\n // Guard the parent order's aggregate version (Gap B): deleting a shipment\n // recalculates the order's fulfilled quantities, so a stale parent must 409\n // before we touch it.\n await enforceSalesDocumentOptimisticLock(ctx, order, SALES_RESOURCE_KIND_ORDER)\n const scope = { tenantId: shipmentEntity.tenantId, organizationId: shipmentEntity.organizationId }\n const items = await findWithDecryption(tx, SalesShipmentItem, { shipment: shipmentEntity }, {}, scope)\n items.forEach((item) => tx.remove(item))\n tx.remove(shipmentEntity)\n await tx.flush()\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n return { shipment: shipmentEntity, shipmentItems: items }\n })\n\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'deleted',\n entity: shipment,\n identifiers: {\n id: shipment.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n if (shipmentItems.length) {\n await Promise.all(\n shipmentItems.map((item) =>\n emitCrudSideEffects({\n dataEngine,\n action: 'deleted',\n entity: item,\n identifiers: {\n id: item.id,\n organizationId: item.organizationId ?? null,\n tenantId: item.tenantId ?? null,\n },\n indexer: { entityType: E.sales.sales_shipment_item },\n })\n )\n )\n }\n return { shipmentId: shipment.id }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ShipmentUndoPayload>(logEntry)\n const snapshot = payload?.before ?? null\n if (!snapshot) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n await restoreShipmentSnapshot(tx, snapshot)\n const order = await findOneWithDecryption(tx, SalesOrder, { id: snapshot.orderId }, {}, { tenantId: snapshot.tenantId, organizationId: snapshot.organizationId })\n await tx.flush()\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n },\n buildLog: async ({ snapshots }) => {\n const before = snapshots.before as ShipmentSnapshot | undefined\n if (!before) return null\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('sales.audit.shipments.delete', 'Delete shipment'),\n resourceKind: 'sales.shipment',\n resourceId: before.id ?? null,\n parentResourceKind: 'sales.order',\n parentResourceId: before.orderId ?? null,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n snapshotBefore: before,\n payload: {\n undo: { before } satisfies ShipmentUndoPayload,\n },\n }\n },\n}\n\nregisterCommand(createShipmentCommand)\nregisterCommand(updateShipmentCommand)\nregisterCommand(deleteShipmentCommand)\n\nexport const shipmentCommands = [createShipmentCommand, updateShipmentCommand, deleteShipmentCommand]\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,kBAAkB;AAC3B,SAAS,uBAA4C;AACrD,SAAS,gBAAgB;AAEzB,SAAS,eAAe,gBAAgB;AACxC,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,6BAA6B;AACtC,SAAS,SAAS;AAClB,SAAS,YAAY,gBAAgB,eAAe,yBAAyB;AAC7E;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAC5C,SAAS,2BAA2B;AAEpC,SAAS,2BAA2B;AAEpC,SAAS,uBAAuB,0BAA0B;AAC1D,SAAS,oBAAoB;AAE7B,MAAM,yBAAyB,aAAa,OAAO,EAAE,MAAM,EAAE,WAAW,YAAY,CAAC;AAErF,MAAM,qBAAuC;AAAA,EAC3C,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,cAAc,CAAC,SAAS;AAAA,IACtB,IAAI,IAAI,YAAY;AAAA,IACpB,gBAAgB,IAAI,YAAY;AAAA,IAChC,UAAU,IAAI,YAAY;AAAA,EAC5B;AACF;AAEA,MAAM,uBAAuB;AAgC7B,MAAM,+BAA+B,CAAC,cAAqD;AAAA,EACzF,SAAS,SAAS;AAAA,EAClB,gBAAg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/D,UAAM,GAAG,cAAc,OAAO,OAAO;AACnC,YAAM,wBAAwB,IAAI,QAAQ;AAC1C,YAAM,QAAQ,MAAM,sBAAsB,IAAI,YAAY,EAAE,IAAI,SAAS,QAAQ,GAAG,CAAC,GAAG,EAAE,UAAU,SAAS,UAAU,gBAAgB,SAAS,eAAe,CAAC;AAChK,YAAM,GAAG,MAAM;AACf,UAAI,OAAO;AACT,cAAM,6BAA6B,IAAI,KAAK;AAC5C,cAAM,GAAG,MAAM;AAAA,MACjB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,UAAU,OAAO,EAAE,UAAU,MAAM;AACjC,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,OAAQ,QAAO;AACpB,UAAM,EAAE,UAAU,IAAI,MAAM,oBAAoB;AAChD,WAAO;AAAA,MACL,aAAa,UAAU,gCAAgC,iBAAiB;AAAA,MACxE,cAAc;AAAA,MACd,YAAY,OAAO,MAAM;AAAA,MACzB,oBAAoB;AAAA,MACpB,kBAAkB,OAAO,WAAW;AAAA,MACpC,UAAU,OAAO;AAAA,MACjB,gBAAgB,OAAO;AAAA,MACvB,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACP,MAAM,EAAE,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;AAEA,gBAAgB,qBAAqB;AACrC,gBAAgB,qBAAqB;AACrC,gBAAgB,qBAAqB;AAE9B,MAAM,mBAAmB,CAAC,uBAAuB,uBAAuB,qBAAqB;",
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\n\nimport { randomUUID } from 'crypto'\nimport { registerCommand, type CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { LockMode } from '@mikro-orm/core'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { CrudHttpError, notFound } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { loadCustomFieldValues } from '@open-mercato/shared/lib/crud/custom-fields'\nimport { normalizeCustomFieldResponse } from '@open-mercato/shared/lib/custom-fields/normalize'\nimport { setRecordCustomFields } from '@open-mercato/core/modules/entities/lib/helpers'\nimport { E } from '#generated/entities.ids.generated'\nimport { SalesOrder, SalesOrderLine, SalesShipment, SalesShipmentItem } from '../data/entities'\nimport {\n shipmentCreateSchema,\n shipmentUpdateSchema,\n type ShipmentCreateInput,\n type ShipmentUpdateInput,\n} from '../data/validators'\nimport {\n coerceShipmentQuantity as toNumber,\n readShipmentItemsSnapshot,\n refreshShipmentItemsSnapshot,\n type ShipmentItemSnapshot,\n buildShipmentItemSnapshots,\n} from '../lib/shipments/snapshots'\nimport {\n cloneJson,\n ensureOrganizationScope,\n ensureSameScope,\n ensureTenantScope,\n extractUndoPayload,\n enforceSalesDocumentOptimisticLock,\n SALES_RESOURCE_KIND_ORDER,\n} from './shared'\nimport { resolveDictionaryEntryValue } from '../lib/dictionaries'\nimport { resolveRedoSnapshot } from '@open-mercato/shared/lib/commands/redo'\nimport type { DataEngine } from '@open-mercato/shared/lib/data/engine'\nimport { emitCrudSideEffects } from '@open-mercato/shared/lib/commands/helpers'\nimport type { CrudEventsConfig } from '@open-mercato/shared/lib/crud/types'\nimport { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst fallbackShipmentLogger = createLogger('sales').child({ component: 'shipments' })\n\nconst shipmentCrudEvents: CrudEventsConfig = {\n module: 'sales',\n entity: 'shipment',\n persistent: true,\n buildPayload: (ctx) => ({\n id: ctx.identifiers.id,\n organizationId: ctx.identifiers.organizationId,\n tenantId: ctx.identifiers.tenantId,\n }),\n}\n\nconst ADDRESS_SNAPSHOT_KEY = 'shipmentAddressSnapshot'\n\nexport type ShipmentSnapshot = {\n id: string\n orderId: string\n organizationId: string\n tenantId: string\n shipmentNumber: string | null\n shippingMethodId: string | null\n statusEntryId: string | null\n status: string | null\n carrierName: string | null\n trackingNumbers: string[] | null\n shippedAt: string | null\n deliveredAt: string | null\n weightValue: number | null\n weightUnit: string | null\n declaredValueNet: number | null\n declaredValueGross: number | null\n currencyCode: string | null\n notesText: string | null\n metadata: Record<string, unknown> | null\n customFields?: Record<string, unknown> | null\n items: ShipmentItemSnapshot[]\n itemsSnapshot?: ShipmentItemSnapshot[] | null\n}\n\ntype ShipmentUndoPayload = {\n before?: ShipmentSnapshot | null\n after?: ShipmentSnapshot | null\n}\n\nconst buildShipmentCreateRedoInput = (snapshot: ShipmentSnapshot): ShipmentCreateInput => ({\n orderId: snapshot.orderId,\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n shipmentNumber: snapshot.shipmentNumber ?? undefined,\n shippingMethodId: snapshot.shippingMethodId ?? undefined,\n statusEntryId: snapshot.statusEntryId ?? undefined,\n carrierName: snapshot.carrierName ?? undefined,\n trackingNumbers: snapshot.trackingNumbers ?? undefined,\n shippedAt: snapshot.shippedAt ? new Date(snapshot.shippedAt) : undefined,\n deliveredAt: snapshot.deliveredAt ? new Date(snapshot.deliveredAt) : undefined,\n weightValue: snapshot.weightValue ?? undefined,\n weightUnit: snapshot.weightUnit ?? undefined,\n declaredValueNet: snapshot.declaredValueNet ?? undefined,\n declaredValueGross: snapshot.declaredValueGross ?? undefined,\n currencyCode: snapshot.currencyCode ?? undefined,\n notes: snapshot.notesText ?? undefined,\n metadata: snapshot.metadata ? cloneJson(snapshot.metadata) : undefined,\n customFields: snapshot.customFields ? cloneJson(snapshot.customFields) : undefined,\n items: snapshot.items.map((item) => ({\n orderLineId: item.orderLineId,\n quantity: item.quantity,\n metadata: item.metadata ? cloneJson(item.metadata) : undefined,\n })),\n})\n\nconst parseTrackingNumbers = (input: unknown): string[] | null => {\n if (typeof input === 'string') {\n const entries = input\n .split(/[\\n,]/g)\n .map((value) => value.trim())\n .filter((value) => value.length > 0)\n return entries.length ? entries : null\n }\n if (Array.isArray(input)) {\n const entries = input\n .map((value) => (typeof value === 'string' ? value.trim() : ''))\n .filter((value) => value.length > 0)\n return entries.length ? entries : null\n }\n return null\n}\n\nconst normalizeCustomFieldsInput = (input: unknown): Record<string, unknown> =>\n input && typeof input === 'object' && !Array.isArray(input) ? (input as Record<string, unknown>) : {}\n\nconst resolveLogger = (ctx: any): { warn?: (meta: any, message?: string) => void } | null => {\n const container = ctx?.container as any\n if (!container) return null\n const cradleLogger = container?.cradle?.logger ?? null\n if (cradleLogger?.warn) return cradleLogger\n const hasRegistration = typeof container.hasRegistration === 'function' ? container.hasRegistration.bind(container) : null\n if (hasRegistration?.('logger')) {\n const logger = container.resolve('logger')\n if (logger?.warn) return logger\n }\n if (hasRegistration?.('coreLogger')) {\n const logger = container.resolve('coreLogger')\n if (logger?.warn) return logger\n }\n return null\n}\n\nconst logShipmentDeleteScopeRejection = (\n ctx: any,\n reason: string,\n meta: Record<string, unknown>\n): void => {\n const logger = resolveLogger(ctx)\n const payload = { ...meta, command: 'sales.shipments.delete' }\n if (logger?.warn) {\n logger.warn(payload, reason)\n return\n }\n fallbackShipmentLogger.warn(reason, payload)\n}\n\nexport async function loadShipmentSnapshot(em: EntityManager, id: string): Promise<ShipmentSnapshot | null> {\n const shipment = await em.findOne(\n SalesShipment,\n { id },\n { populate: ['order', 'items', 'items.orderLine'] }\n )\n if (!shipment || !shipment.order) return null\n const storedSnapshot = readShipmentItemsSnapshot(\n (shipment as any).itemsSnapshot ?? (shipment as any).items_snapshot ?? null\n )\n const lineMap = new Map(\n Array.from(shipment.items ?? [])\n .map((item) => {\n const line = typeof item.orderLine === 'string' ? null : (item.orderLine as SalesOrderLine | null)\n return line ? [line.id, line] : null\n })\n .filter((entry): entry is [string, SalesOrderLine] => Boolean(entry))\n )\n const fallbackItems = buildShipmentItemSnapshots(Array.from(shipment.items ?? []), { lineMap })\n const itemsSnapshot = storedSnapshot.length ? storedSnapshot : fallbackItems\n const customFieldValues = await loadCustomFieldValues({\n em,\n entityId: E.sales.sales_shipment,\n recordIds: [shipment.id],\n tenantIdByRecord: { [shipment.id]: shipment.tenantId ?? null },\n organizationIdByRecord: { [shipment.id]: shipment.organizationId ?? null },\n })\n const customFields = customFieldValues[shipment.id]\n return {\n id: shipment.id,\n orderId: typeof shipment.order === 'string' ? shipment.order : shipment.order.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n shipmentNumber: shipment.shipmentNumber ?? null,\n shippingMethodId: shipment.shippingMethodId ?? null,\n statusEntryId: shipment.statusEntryId ?? null,\n status: shipment.status ?? null,\n carrierName: shipment.carrierName ?? null,\n trackingNumbers: shipment.trackingNumbers ? [...shipment.trackingNumbers] : null,\n shippedAt: shipment.shippedAt ? shipment.shippedAt.toISOString() : null,\n deliveredAt: shipment.deliveredAt ? shipment.deliveredAt.toISOString() : null,\n weightValue: shipment.weightValue !== undefined && shipment.weightValue !== null ? Number(shipment.weightValue) : null,\n weightUnit: shipment.weightUnit ?? null,\n declaredValueNet:\n shipment.declaredValueNet !== undefined && shipment.declaredValueNet !== null\n ? Number(shipment.declaredValueNet)\n : null,\n declaredValueGross:\n shipment.declaredValueGross !== undefined && shipment.declaredValueGross !== null\n ? Number(shipment.declaredValueGross)\n : null,\n currencyCode: shipment.currencyCode ?? null,\n notesText: shipment.notesText ?? null,\n metadata: shipment.metadata ? cloneJson(shipment.metadata) : null,\n customFields: customFields && Object.keys(customFields).length ? customFields : null,\n items: itemsSnapshot,\n itemsSnapshot,\n }\n}\n\nexport async function restoreShipmentSnapshot(em: EntityManager, snapshot: ShipmentSnapshot): Promise<void> {\n const order = await findOneWithDecryption(em, SalesOrder, { id: snapshot.orderId }, {}, { tenantId: snapshot.tenantId, organizationId: snapshot.organizationId })\n if (!order) return\n const existing = await em.findOne(SalesShipment, { id: snapshot.id })\n const entity =\n existing ??\n em.create(SalesShipment, {\n id: snapshot.id,\n createdAt: new Date(),\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n })\n entity.order = order\n entity.organizationId = snapshot.organizationId\n entity.tenantId = snapshot.tenantId\n entity.shipmentNumber = snapshot.shipmentNumber ?? null\n entity.shippingMethodId = snapshot.shippingMethodId ?? null\n entity.statusEntryId = snapshot.statusEntryId ?? null\n entity.status = snapshot.status ?? null\n entity.carrierName = snapshot.carrierName ?? null\n entity.trackingNumbers = snapshot.trackingNumbers ? [...snapshot.trackingNumbers] : null\n entity.shippedAt = snapshot.shippedAt ? new Date(snapshot.shippedAt) : null\n entity.deliveredAt = snapshot.deliveredAt ? new Date(snapshot.deliveredAt) : null\n entity.weightValue = snapshot.weightValue !== null ? snapshot.weightValue.toString() : null\n entity.weightUnit = snapshot.weightUnit ?? null\n entity.declaredValueNet = snapshot.declaredValueNet !== null ? snapshot.declaredValueNet.toString() : null\n entity.declaredValueGross = snapshot.declaredValueGross !== null ? snapshot.declaredValueGross.toString() : null\n entity.currencyCode = snapshot.currencyCode ?? null\n entity.notesText = snapshot.notesText ?? null\n entity.metadata = snapshot.metadata ? cloneJson(snapshot.metadata) : null\n entity.updatedAt = new Date()\n em.persist(entity)\n await em.flush()\n\n const existingItems = await em.find(SalesShipmentItem, { shipment: entity })\n existingItems.forEach((item) => em.remove(item))\n const items = Array.isArray(snapshot.items) ? snapshot.items : []\n const lineIds = items\n .map((item) => item.orderLineId)\n .filter((id): id is string => typeof id === 'string' && id.length > 0)\n const lines = lineIds.length\n ? await em.find(SalesOrderLine, { id: { $in: lineIds }, order: order.id })\n : []\n const lineMap = new Map(lines.map((line) => [line.id, line]))\n const restoredItems: ShipmentItemSnapshot[] = []\n items.forEach((item) => {\n const line = lineMap.get(item.orderLineId)\n if (!line) return\n restoredItems.push(item)\n const lineRef = em.getReference(SalesOrderLine, line.id)\n const shipmentItem = em.create(SalesShipmentItem, {\n id: item.id ?? randomUUID(),\n shipment: entity,\n orderLine: lineRef,\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n quantity: item.quantity.toString(),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })\n em.persist(shipmentItem)\n })\n const snapshotItems = (snapshot.itemsSnapshot ?? restoredItems).filter((entry) =>\n entry?.orderLineId ? lineMap.has(entry.orderLineId) : false\n )\n entity.itemsSnapshot = snapshotItems && snapshotItems.length ? cloneJson(snapshotItems) : null\n if (!entity.itemsSnapshot) {\n await refreshShipmentItemsSnapshot(em, entity)\n }\n if ((snapshot as any).customFields !== undefined) {\n await setRecordCustomFields(em, {\n entityId: E.sales.sales_shipment,\n recordId: entity.id,\n organizationId: snapshot.organizationId,\n tenantId: snapshot.tenantId,\n values: normalizeCustomFieldResponse(normalizeCustomFieldsInput((snapshot as any).customFields)) ?? {},\n })\n }\n em.persist(entity)\n}\n\nasync function deleteShipmentWithItems(em: EntityManager, shipment: SalesShipment): Promise<void> {\n const scope = { tenantId: shipment.tenantId, organizationId: shipment.organizationId }\n const items = await findWithDecryption(em, SalesShipmentItem, { shipment }, {}, scope)\n items.forEach((item) => em.remove(item))\n em.remove(shipment)\n await em.flush()\n}\n\nasync function recomputeFulfilledQuantities(em: EntityManager, order: SalesOrder): Promise<void> {\n const scope = { tenantId: order.tenantId, organizationId: order.organizationId }\n const shipments = await findWithDecryption(em, SalesShipment, { order, deletedAt: null }, {}, scope)\n const shipmentIds = shipments.map((entry) => entry.id)\n const shipmentItems = shipmentIds.length\n ? await findWithDecryption(em, SalesShipmentItem, { shipment: { $in: shipmentIds } }, {}, scope)\n : []\n const totals = shipmentItems.reduce<Map<string, number>>((acc, item) => {\n const lineId =\n typeof item.orderLine === 'string'\n ? item.orderLine\n : item.orderLine?.id ?? (item as any).orderLineId ?? null\n if (!lineId) return acc\n const next = (acc.get(lineId) ?? 0) + toNumber(item.quantity)\n acc.set(lineId, next)\n return acc\n }, new Map())\n const lines = await findWithDecryption(em, SalesOrderLine, { order }, { lockMode: LockMode.PESSIMISTIC_WRITE }, scope)\n lines.forEach((line) => {\n const shipped = totals.get(line.id) ?? 0\n line.fulfilledQuantity = shipped.toString()\n })\n}\n\nasync function loadOrder(\n em: EntityManager,\n id: string,\n scope?: { tenantId: string; organizationId: string }\n): Promise<SalesOrder> {\n const order = await findOneWithDecryption(em, SalesOrder, { id, deletedAt: null }, {}, scope)\n if (!order) throw notFound('sales.shipments.not_found')\n return order\n}\n\nasync function loadShippedTotals(\n em: EntityManager,\n order: SalesOrder,\n excludeShipmentId?: string | null\n): Promise<Map<string, number>> {\n const scope = { tenantId: order.tenantId, organizationId: order.organizationId }\n const shipments = await findWithDecryption(em, SalesShipment, { order, deletedAt: null }, {}, scope)\n const shipmentIds = shipments\n .map((entry) => entry.id)\n .filter((id) => !excludeShipmentId || id !== excludeShipmentId)\n if (!shipmentIds.length) return new Map()\n const items = await findWithDecryption(em, SalesShipmentItem, { shipment: { $in: shipmentIds } }, {}, scope)\n return items.reduce<Map<string, number>>((acc, item) => {\n const lineId =\n typeof item.orderLine === 'string'\n ? item.orderLine\n : item.orderLine?.id ?? (item as any).orderLineId ?? null\n if (!lineId) return acc\n const next = (acc.get(lineId) ?? 0) + toNumber(item.quantity)\n acc.set(lineId, next)\n return acc\n }, new Map())\n}\n\nasync function validateShipmentItems(params: {\n em: EntityManager\n order: SalesOrder\n items?: ShipmentCreateInput['items']\n excludeShipmentId?: string | null\n lockOrderLines?: boolean\n}): Promise<{\n items: Array<{ orderLineId: string; quantity: number; metadata: Record<string, unknown> | null }>\n lineMap: Map<string, SalesOrderLine>\n}> {\n const { em, order, items, excludeShipmentId, lockOrderLines } = params\n const { translate } = await resolveTranslations()\n if (!items || !items.length) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.items_required', 'Add at least one line to ship.') })\n }\n const scope = { tenantId: order.tenantId, organizationId: order.organizationId }\n const orderLines = await findWithDecryption(\n em,\n SalesOrderLine,\n { order },\n lockOrderLines ? { lockMode: LockMode.PESSIMISTIC_WRITE } : undefined,\n scope,\n )\n const lineMap = new Map(orderLines.map((line) => [line.id, line]))\n const shippedTotals = await loadShippedTotals(em, order, excludeShipmentId)\n const requestedTotals = new Map<string, number>()\n\n for (const item of items) {\n const lineId = item.orderLineId\n const quantity = toNumber(item.quantity)\n if (!lineId || quantity <= 0) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.items_required', 'Add at least one line to ship.') })\n }\n const line = lineMap.get(lineId)\n if (!line) {\n throw notFound(translate('sales.shipments.line_missing', 'Order line not found.'))\n }\n const lineTotal = toNumber(line.quantity)\n const alreadyShipped = shippedTotals.get(lineId) ?? 0\n const nextTotal = (requestedTotals.get(lineId) ?? 0) + quantity\n if (nextTotal + alreadyShipped - 1e-6 > lineTotal) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.quantity_exceeded', 'Cannot ship more than the remaining quantity.') })\n }\n requestedTotals.set(lineId, nextTotal)\n }\n\n return {\n items: items.map((item) => ({\n orderLineId: item.orderLineId,\n quantity: toNumber(item.quantity),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })),\n lineMap,\n }\n}\n\nfunction mergeAddressSnapshot(\n baseMetadata: Record<string, unknown> | null | undefined,\n snapshot: Record<string, unknown> | null | undefined\n): Record<string, unknown> | null {\n const metadata = baseMetadata ? { ...baseMetadata } : {}\n if (snapshot && typeof snapshot === 'object') {\n metadata[ADDRESS_SNAPSHOT_KEY] = cloneJson(snapshot)\n }\n return Object.keys(metadata).length ? metadata : null\n}\n\nconst createShipmentCommand: CommandHandler<ShipmentCreateInput, { shipmentId: string }> = {\n id: 'sales.shipments.create',\n async execute(rawInput, ctx) {\n const input = shipmentCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, input.tenantId)\n ensureOrganizationScope(ctx, input.organizationId)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const { translate } = await resolveTranslations()\n const shipment = await em.transactional(async (tx) => {\n const order = await loadOrder(tx, input.orderId, { tenantId: input.tenantId, organizationId: input.organizationId })\n ensureSameScope(order, input.organizationId, input.tenantId)\n // Guard the parent order's aggregate version (Gap B): a shipment mutation\n // recalculates the order's fulfilled quantities, so a stale parent must 409\n // before we touch it.\n await enforceSalesDocumentOptimisticLock(ctx, order, SALES_RESOURCE_KIND_ORDER)\n const { items: normalizedItems, lineMap } = await validateShipmentItems({\n em: tx,\n order,\n items: input.items,\n lockOrderLines: true,\n })\n const statusValue = await resolveDictionaryEntryValue(tx, input.statusEntryId ?? null, { tenantId: input.tenantId })\n const trackingNumbers = parseTrackingNumbers(input.trackingNumbers) ?? null\n const metadata =\n mergeAddressSnapshot(\n input.metadata ? cloneJson(input.metadata) : null,\n input.shipmentAddressSnapshot ?? order.shippingAddressSnapshot ?? null\n ) ?? null\n\n const shipmentId = randomUUID()\n const entity = tx.create(SalesShipment, {\n id: shipmentId,\n order,\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n shipmentNumber: input.shipmentNumber ?? null,\n shippingMethodId: input.shippingMethodId ?? null,\n statusEntryId: input.statusEntryId ?? null,\n status: statusValue,\n carrierName: input.carrierName ?? null,\n trackingNumbers,\n shippedAt: input.shippedAt ?? null,\n deliveredAt: input.deliveredAt ?? null,\n weightValue: input.weightValue !== undefined ? input.weightValue.toString() : null,\n weightUnit: input.weightUnit ?? null,\n declaredValueNet: input.declaredValueNet !== undefined ? input.declaredValueNet.toString() : null,\n declaredValueGross: input.declaredValueGross !== undefined ? input.declaredValueGross.toString() : null,\n currencyCode: input.currencyCode ?? order.currencyCode ?? null,\n notesText: input.notes ?? null,\n metadata,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n const createdItems: SalesShipmentItem[] = []\n normalizedItems.forEach((item) => {\n const lineRef = tx.getReference(SalesOrderLine, item.orderLineId)\n const shipmentItem = tx.create(SalesShipmentItem, {\n id: randomUUID(),\n shipment: entity,\n orderLine: lineRef,\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n quantity: item.quantity.toString(),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })\n createdItems.push(shipmentItem)\n tx.persist(shipmentItem)\n })\n tx.persist(entity)\n if (input.customFields !== undefined) {\n await setRecordCustomFields(tx, {\n entityId: E.sales.sales_shipment,\n recordId: entity.id,\n organizationId: input.organizationId,\n tenantId: input.tenantId,\n values: normalizeCustomFieldsInput(input.customFields),\n })\n }\n if (input.documentStatusEntryId !== undefined) {\n const orderStatus = await resolveDictionaryEntryValue(tx, input.documentStatusEntryId ?? null, { tenantId: input.tenantId })\n if (input.documentStatusEntryId && !orderStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n order.statusEntryId = input.documentStatusEntryId ?? null\n order.status = orderStatus\n order.updatedAt = new Date()\n }\n if (input.lineStatusEntryId !== undefined) {\n const lineStatus = await resolveDictionaryEntryValue(tx, input.lineStatusEntryId ?? null, { tenantId: input.tenantId })\n if (input.lineStatusEntryId && !lineStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n const uniqueLineIds = Array.from(new Set(normalizedItems.map((item) => item.orderLineId)))\n uniqueLineIds.forEach((lineId) => {\n const line = lineMap.get(lineId)\n if (!line) return\n line.statusEntryId = input.lineStatusEntryId ?? null\n line.status = lineStatus\n line.updatedAt = new Date()\n })\n }\n await refreshShipmentItemsSnapshot(tx, entity, { items: createdItems, lineMap })\n await tx.flush()\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n return entity\n })\n\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'created',\n entity: shipment,\n identifiers: {\n id: shipment.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n\n return { shipmentId: shipment.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return loadShipmentSnapshot(em, result.shipmentId)\n },\n buildLog: async ({ result, snapshots }) => {\n const after = snapshots.after as ShipmentSnapshot | undefined\n if (!after) return null\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('sales.audit.shipments.create', 'Create shipment'),\n resourceKind: 'sales.shipment',\n resourceId: result.shipmentId,\n parentResourceKind: 'sales.order',\n parentResourceId: after.orderId ?? null,\n tenantId: after.tenantId,\n organizationId: after.organizationId,\n snapshotAfter: after,\n payload: {\n undo: { after } satisfies ShipmentUndoPayload,\n __redoInput: buildShipmentCreateRedoInput(after),\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ShipmentUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n const existing = await findOneWithDecryption(\n tx,\n SalesShipment,\n { id: after.id },\n { populate: ['order'] },\n { tenantId: after.tenantId, organizationId: after.organizationId },\n )\n if (!existing) return\n const order = existing.order as SalesOrder | null\n await deleteShipmentWithItems(tx, existing)\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n },\n redo: async ({ ctx, logEntry }) => {\n const after = resolveRedoSnapshot<ShipmentSnapshot>(logEntry)\n const shipmentId = after?.id ?? logEntry.resourceId ?? null\n if (!after || !shipmentId) {\n throw new CrudHttpError(400, { error: '[internal] redo snapshot unavailable for sales.shipments.create' })\n }\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n await restoreShipmentSnapshot(tx, after)\n const order = await findOneWithDecryption(tx, SalesOrder, { id: after.orderId }, {}, { tenantId: after.tenantId, organizationId: after.organizationId })\n await tx.flush()\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n\n const shipment = await findOneWithDecryption(\n em,\n SalesShipment,\n { id: after.id },\n {},\n { tenantId: after.tenantId, organizationId: after.organizationId },\n )\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'created',\n entity: shipment,\n identifiers: {\n id: after.id,\n organizationId: after.organizationId,\n tenantId: after.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n\n return { shipmentId: after.id }\n },\n}\n\nconst updateShipmentCommand: CommandHandler<ShipmentUpdateInput, { shipmentId: string }> = {\n id: 'sales.shipments.update',\n async prepare(rawInput, ctx) {\n const parsed = shipmentUpdateSchema.parse(rawInput ?? {})\n if (!parsed.id) return {}\n const em = ctx.container.resolve('em') as EntityManager\n const snapshot = await loadShipmentSnapshot(em, parsed.id)\n if (snapshot) {\n ensureTenantScope(ctx, snapshot.tenantId)\n ensureOrganizationScope(ctx, snapshot.organizationId)\n }\n return snapshot ? { before: snapshot } : {}\n },\n async execute(rawInput, ctx) {\n const input = shipmentUpdateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, input.tenantId)\n ensureOrganizationScope(ctx, input.organizationId)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const { translate } = await resolveTranslations()\n\n const shipment = await em.transactional(async (tx) => {\n const shipmentEntity = await findOneWithDecryption(\n tx,\n SalesShipment,\n { id: input.id },\n { populate: ['order'] },\n { tenantId: input.tenantId, organizationId: input.organizationId },\n )\n if (!shipmentEntity || !shipmentEntity.order) {\n throw notFound('sales.shipments.not_found')\n }\n ensureSameScope(shipmentEntity, input.organizationId, input.tenantId)\n const order = shipmentEntity.order as SalesOrder\n if (input.orderId && input.orderId !== order.id) {\n throw new CrudHttpError(400, { error: 'sales.shipments.invalid_order' })\n }\n // Guard the parent order's aggregate version (Gap B): updating a shipment\n // recalculates the order's fulfilled quantities, so a stale parent must 409\n // before we touch it.\n await enforceSalesDocumentOptimisticLock(ctx, order, SALES_RESOURCE_KIND_ORDER)\n\n // Check if order is financially closed - prevent modifications to shipments\n const paidAmount = parseFloat(order.paidTotalAmount || '0')\n const refundedAmount = parseFloat(order.refundedTotalAmount || '0')\n const grandTotal = parseFloat(order.grandTotalGrossAmount || '0')\n const tolerance = 1e-4 // Tolerance for floating-point comparisons\n\n // Check for full refund first (higher priority than payment)\n const isFullyRefunded = refundedAmount >= grandTotal - tolerance\n if (isFullyRefunded) {\n throw new CrudHttpError(422, { error: translate('sales.shipments.fully_returned', 'Cannot modify shipment: order is fully returned') })\n }\n\n // Check for completed payment\n const isFullyPaid = paidAmount >= grandTotal - tolerance\n if (isFullyPaid) {\n throw new CrudHttpError(422, { error: translate('sales.shipments.payment_completed', 'Cannot modify shipment: order payment is completed') })\n }\n const validatedItems = input.items\n ? await validateShipmentItems({\n em: tx,\n order,\n items: input.items,\n excludeShipmentId: shipmentEntity.id,\n })\n : null\n const normalizedItems = validatedItems?.items ?? null\n const lineMap = validatedItems?.lineMap ?? new Map<string, SalesOrderLine>()\n // Resolve the status label BEFORE mutating shipment scalars so this\n // dictionary read does not interleave with (and drop) the pending\n // shipment changeset under MikroORM v7 (SPEC-018 / #2453 class).\n const resolvedShipmentStatus = input.statusEntryId !== undefined\n ? await resolveDictionaryEntryValue(tx, input.statusEntryId ?? null, { tenantId: shipmentEntity.tenantId })\n : undefined\n if (input.shipmentNumber !== undefined) shipmentEntity.shipmentNumber = input.shipmentNumber ?? null\n if (input.shippingMethodId !== undefined) shipmentEntity.shippingMethodId = input.shippingMethodId ?? null\n if (input.statusEntryId !== undefined) {\n shipmentEntity.statusEntryId = input.statusEntryId ?? null\n shipmentEntity.status = resolvedShipmentStatus ?? null\n }\n if (input.carrierName !== undefined) shipmentEntity.carrierName = input.carrierName ?? null\n if (input.trackingNumbers !== undefined) shipmentEntity.trackingNumbers = parseTrackingNumbers(input.trackingNumbers)\n if (input.shippedAt !== undefined) shipmentEntity.shippedAt = input.shippedAt ?? null\n if (input.deliveredAt !== undefined) shipmentEntity.deliveredAt = input.deliveredAt ?? null\n if (input.weightValue !== undefined) shipmentEntity.weightValue = input.weightValue !== null ? input.weightValue.toString() : null\n if (input.weightUnit !== undefined) shipmentEntity.weightUnit = input.weightUnit ?? null\n if (input.declaredValueNet !== undefined) {\n shipmentEntity.declaredValueNet = input.declaredValueNet !== null ? input.declaredValueNet.toString() : null\n }\n if (input.declaredValueGross !== undefined) {\n shipmentEntity.declaredValueGross = input.declaredValueGross !== null ? input.declaredValueGross.toString() : null\n }\n if (input.currencyCode !== undefined) shipmentEntity.currencyCode = input.currencyCode ?? null\n if (input.notes !== undefined) shipmentEntity.notesText = input.notes ?? null\n if (input.metadata !== undefined || input.shipmentAddressSnapshot !== undefined) {\n shipmentEntity.metadata = mergeAddressSnapshot(\n input.metadata ? cloneJson(input.metadata) : shipmentEntity.metadata ?? null,\n input.shipmentAddressSnapshot\n )\n }\n shipmentEntity.updatedAt = new Date()\n\n // Persist the shipment scalar mutations before the item reads below run on\n // the same EntityManager. Under MikroORM v7 an interleaved query (the\n // findWithDecryption on SalesShipmentItem here and in the snapshot step)\n // resets the identity-map changeset, so shippingMethodId/status/carrier/etc.\n // would silently not persist even though the write returns 200 (#2453).\n await tx.flush()\n\n const shouldLoadItems = Boolean(normalizedItems || input.lineStatusEntryId !== undefined)\n const existingItems = shouldLoadItems ? await findWithDecryption(tx, SalesShipmentItem, { shipment: shipmentEntity }, {}, { tenantId: shipmentEntity.tenantId, organizationId: shipmentEntity.organizationId }) : []\n const newItems: SalesShipmentItem[] = []\n if (normalizedItems) {\n existingItems.forEach((item) => tx.remove(item))\n normalizedItems.forEach((item) => {\n const lineRef = tx.getReference(SalesOrderLine, item.orderLineId)\n const shipmentItem = tx.create(SalesShipmentItem, {\n id: randomUUID(),\n shipment: shipmentEntity,\n orderLine: lineRef,\n organizationId: shipmentEntity.organizationId,\n tenantId: shipmentEntity.tenantId,\n quantity: item.quantity.toString(),\n metadata: item.metadata ? cloneJson(item.metadata) : null,\n })\n newItems.push(shipmentItem)\n tx.persist(shipmentItem)\n })\n }\n\n if (input.customFields !== undefined) {\n await setRecordCustomFields(tx, {\n entityId: E.sales.sales_shipment,\n recordId: shipmentEntity.id,\n organizationId: shipmentEntity.organizationId,\n tenantId: shipmentEntity.tenantId,\n values: normalizeCustomFieldsInput(input.customFields),\n })\n }\n if (input.documentStatusEntryId !== undefined) {\n const orderStatus = await resolveDictionaryEntryValue(tx, input.documentStatusEntryId ?? null, { tenantId: shipmentEntity.tenantId })\n if (input.documentStatusEntryId && !orderStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n order.statusEntryId = input.documentStatusEntryId ?? null\n order.status = orderStatus\n order.updatedAt = new Date()\n }\n if (input.lineStatusEntryId !== undefined) {\n const lineStatus = await resolveDictionaryEntryValue(tx, input.lineStatusEntryId ?? null, { tenantId: shipmentEntity.tenantId })\n if (input.lineStatusEntryId && !lineStatus) {\n throw new CrudHttpError(400, { error: translate('sales.documents.detail.statusInvalid', 'Selected status could not be found.') })\n }\n const targetLineIds = normalizedItems\n ? Array.from(new Set(normalizedItems.map((item) => item.orderLineId)))\n : Array.from(\n new Set(\n existingItems\n .map((item) =>\n typeof item.orderLine === 'string'\n ? item.orderLine\n : (item.orderLine as SalesOrderLine | null)?.id ?? null\n )\n .filter((id): id is string => Boolean(id))\n )\n )\n if (targetLineIds.length) {\n const missing = targetLineIds.filter((id) => !lineMap.has(id))\n if (missing.length) {\n const fetched = await tx.find(SalesOrderLine, { id: { $in: missing } })\n fetched.forEach((line) => lineMap.set(line.id, line))\n }\n targetLineIds.forEach((lineId) => {\n const line = lineMap.get(lineId)\n if (!line) return\n line.statusEntryId = input.lineStatusEntryId ?? null\n line.status = lineStatus\n line.updatedAt = new Date()\n })\n }\n }\n\n // Flush any order/line status mutations applied above before the snapshot\n // read below queries the same EntityManager (same interleaved-read hazard).\n await tx.flush()\n const itemsForSnapshot =\n normalizedItems || shouldLoadItems\n ? (normalizedItems ? newItems : existingItems)\n : await findWithDecryption(tx, SalesShipmentItem, { shipment: shipmentEntity }, {}, { tenantId: shipmentEntity.tenantId, organizationId: shipmentEntity.organizationId })\n await refreshShipmentItemsSnapshot(tx, shipmentEntity, { items: itemsForSnapshot, lineMap })\n await tx.flush()\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n return shipmentEntity\n })\n\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'updated',\n entity: shipment,\n identifiers: {\n id: shipment.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n\n return { shipmentId: shipment.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return loadShipmentSnapshot(em, result.shipmentId)\n },\n buildLog: async ({ snapshots, result }) => {\n const { translate } = await resolveTranslations()\n const before = snapshots.before as ShipmentSnapshot | undefined\n const after = snapshots.after as ShipmentSnapshot | undefined\n return {\n actionLabel: translate('sales.audit.shipments.update', 'Update shipment'),\n resourceKind: 'sales.shipment',\n resourceId: result.shipmentId,\n parentResourceKind: 'sales.order',\n parentResourceId: after?.orderId ?? before?.orderId ?? null,\n tenantId: after?.tenantId ?? before?.tenantId ?? null,\n organizationId: after?.organizationId ?? before?.organizationId ?? null,\n snapshotBefore: before ?? null,\n snapshotAfter: after ?? null,\n payload: {\n undo: { before, after } satisfies ShipmentUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ShipmentUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n await restoreShipmentSnapshot(tx, before)\n const order = await findOneWithDecryption(tx, SalesOrder, { id: before.orderId }, {}, { tenantId: before.tenantId, organizationId: before.organizationId })\n await tx.flush()\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n },\n}\n\nconst deleteShipmentCommand: CommandHandler<\n { id: string; orderId: string; organizationId: string; tenantId: string },\n { shipmentId: string }\n> = {\n id: 'sales.shipments.delete',\n async prepare(rawInput, ctx) {\n const parsed = shipmentUpdateSchema.parse(rawInput ?? {})\n if (!parsed.id) return {}\n const em = ctx.container.resolve('em') as EntityManager\n const snapshot = await loadShipmentSnapshot(em, parsed.id)\n if (snapshot) {\n try {\n ensureTenantScope(ctx, snapshot.tenantId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Tenant mismatch while preparing shipment delete', {\n shipmentId: snapshot.id,\n snapshotTenantId: snapshot.tenantId,\n authTenantId: ctx.auth?.tenantId ?? null,\n })\n throw error\n }\n try {\n ensureOrganizationScope(ctx, snapshot.organizationId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Organization mismatch while preparing shipment delete', {\n shipmentId: snapshot.id,\n snapshotOrganizationId: snapshot.organizationId,\n selectedOrganizationId: ctx.selectedOrganizationId ?? null,\n authOrganizationId: ctx.auth?.orgId ?? null,\n })\n throw error\n }\n }\n return snapshot ? { before: snapshot } : {}\n },\n async execute(rawInput, ctx) {\n const { translate } = await resolveTranslations()\n const payload = shipmentUpdateSchema\n .pick({ id: true, orderId: true, organizationId: true, tenantId: true })\n .parse(rawInput ?? {})\n try {\n ensureTenantScope(ctx, payload.tenantId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Tenant mismatch while executing shipment delete', {\n shipmentId: payload.id,\n payloadTenantId: payload.tenantId,\n authTenantId: ctx.auth?.tenantId ?? null,\n })\n throw error\n }\n try {\n ensureOrganizationScope(ctx, payload.organizationId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Organization mismatch while executing shipment delete', {\n shipmentId: payload.id,\n payloadOrganizationId: payload.organizationId,\n selectedOrganizationId: ctx.selectedOrganizationId ?? null,\n authOrganizationId: ctx.auth?.orgId ?? null,\n })\n throw error\n }\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n\n const { shipment, shipmentItems } = await em.transactional(async (tx) => {\n const shipmentEntity = await findOneWithDecryption(\n tx,\n SalesShipment,\n { id: payload.id },\n { populate: ['order'] },\n { tenantId: payload.tenantId, organizationId: payload.organizationId },\n )\n if (!shipmentEntity || !shipmentEntity.order) {\n throw notFound(translate('sales.shipments.not_found', 'Shipment not found'))\n }\n try {\n ensureSameScope(shipmentEntity, payload.organizationId, payload.tenantId)\n } catch (error) {\n logShipmentDeleteScopeRejection(ctx, 'Shipment scope mismatch against payload', {\n shipmentId: payload.id,\n shipmentOrganizationId: shipmentEntity.organizationId,\n shipmentTenantId: shipmentEntity.tenantId,\n payloadOrganizationId: payload.organizationId,\n payloadTenantId: payload.tenantId,\n })\n throw error\n }\n const order = shipmentEntity.order as SalesOrder\n if (order.id !== payload.orderId) {\n throw new CrudHttpError(400, { error: translate('sales.shipments.invalid_order', 'Shipment does not belong to this order') })\n }\n // Guard the parent order's aggregate version (Gap B): deleting a shipment\n // recalculates the order's fulfilled quantities, so a stale parent must 409\n // before we touch it.\n await enforceSalesDocumentOptimisticLock(ctx, order, SALES_RESOURCE_KIND_ORDER)\n const scope = { tenantId: shipmentEntity.tenantId, organizationId: shipmentEntity.organizationId }\n const items = await findWithDecryption(tx, SalesShipmentItem, { shipment: shipmentEntity }, {}, scope)\n items.forEach((item) => tx.remove(item))\n tx.remove(shipmentEntity)\n await tx.flush()\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n return { shipment: shipmentEntity, shipmentItems: items }\n })\n\n const dataEngine = ctx.container.resolve('dataEngine') as DataEngine\n await emitCrudSideEffects({\n dataEngine,\n action: 'deleted',\n entity: shipment,\n identifiers: {\n id: shipment.id,\n organizationId: shipment.organizationId,\n tenantId: shipment.tenantId,\n },\n indexer: { entityType: E.sales.sales_shipment },\n events: shipmentCrudEvents,\n })\n if (shipmentItems.length) {\n await Promise.all(\n shipmentItems.map((item) =>\n emitCrudSideEffects({\n dataEngine,\n action: 'deleted',\n entity: item,\n identifiers: {\n id: item.id,\n organizationId: item.organizationId ?? null,\n tenantId: item.tenantId ?? null,\n },\n indexer: { entityType: E.sales.sales_shipment_item },\n })\n )\n )\n }\n return { shipmentId: shipment.id }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ShipmentUndoPayload>(logEntry)\n const snapshot = payload?.before ?? null\n if (!snapshot) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n await em.transactional(async (tx) => {\n await restoreShipmentSnapshot(tx, snapshot)\n const order = await findOneWithDecryption(tx, SalesOrder, { id: snapshot.orderId }, {}, { tenantId: snapshot.tenantId, organizationId: snapshot.organizationId })\n await tx.flush()\n if (order) {\n await recomputeFulfilledQuantities(tx, order)\n await tx.flush()\n }\n })\n },\n buildLog: async ({ snapshots }) => {\n const before = snapshots.before as ShipmentSnapshot | undefined\n if (!before) return null\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('sales.audit.shipments.delete', 'Delete shipment'),\n resourceKind: 'sales.shipment',\n resourceId: before.id ?? null,\n parentResourceKind: 'sales.order',\n parentResourceId: before.orderId ?? null,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n snapshotBefore: before,\n payload: {\n undo: { before } satisfies ShipmentUndoPayload,\n },\n }\n },\n}\n\nregisterCommand(createShipmentCommand)\nregisterCommand(updateShipmentCommand)\nregisterCommand(deleteShipmentCommand)\n\nexport const shipmentCommands = [createShipmentCommand, updateShipmentCommand, deleteShipmentCommand]\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,kBAAkB;AAC3B,SAAS,uBAA4C;AACrD,SAAS,gBAAgB;AAEzB,SAAS,eAAe,gBAAgB;AACxC,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,oCAAoC;AAC7C,SAAS,6BAA6B;AACtC,SAAS,SAAS;AAClB,SAAS,YAAY,gBAAgB,eAAe,yBAAyB;AAC7E;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAC5C,SAAS,2BAA2B;AAEpC,SAAS,2BAA2B;AAEpC,SAAS,uBAAuB,0BAA0B;AAC1D,SAAS,oBAAoB;AAE7B,MAAM,yBAAyB,aAAa,OAAO,EAAE,MAAM,EAAE,WAAW,YAAY,CA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AC,uBAAuB,uBAAuB,qBAAqB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,8 @@ import { Loader2, RefreshCw } from "lucide-react";
|
|
|
5
5
|
import { Button } from "@open-mercato/ui/primitives/button";
|
|
6
6
|
import { Input } from "@open-mercato/ui/primitives/input";
|
|
7
7
|
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
8
|
-
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
8
|
+
import { apiCall, apiCallOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
|
|
9
|
+
import { normalizeCrudServerError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
9
10
|
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
10
11
|
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
11
12
|
import { useOrganizationScopeVersion } from "@open-mercato/shared/lib/frontend/useOrganizationScope";
|
|
@@ -29,11 +30,23 @@ const normalizeState = (payload) => ({
|
|
|
29
30
|
orderNextNumber: typeof payload?.nextOrderNumber === "number" && Number.isFinite(payload.nextOrderNumber) ? String(payload.nextOrderNumber) : "1",
|
|
30
31
|
quoteNextNumber: typeof payload?.nextQuoteNumber === "number" && Number.isFinite(payload.nextQuoteNumber) ? String(payload.nextQuoteNumber) : "1"
|
|
31
32
|
});
|
|
33
|
+
const parseCounter = (value) => Number.parseInt(value, 10) || void 0;
|
|
34
|
+
function buildDocumentNumberSettingsPayload(formState, loadedState) {
|
|
35
|
+
const orderNextNumber = parseCounter(formState.orderNextNumber);
|
|
36
|
+
const quoteNextNumber = parseCounter(formState.quoteNextNumber);
|
|
37
|
+
return {
|
|
38
|
+
orderNumberFormat: formState.orderNumberFormat.trim(),
|
|
39
|
+
quoteNumberFormat: formState.quoteNumberFormat.trim(),
|
|
40
|
+
orderNextNumber: orderNextNumber !== parseCounter(loadedState.orderNextNumber) ? orderNextNumber : void 0,
|
|
41
|
+
quoteNextNumber: quoteNextNumber !== parseCounter(loadedState.quoteNextNumber) ? quoteNextNumber : void 0
|
|
42
|
+
};
|
|
43
|
+
}
|
|
32
44
|
const SAVE_CONTEXT_ID = "sales-document-number-settings";
|
|
33
45
|
function DocumentNumberSettings() {
|
|
34
46
|
const t = useT();
|
|
35
47
|
const scopeVersion = useOrganizationScopeVersion();
|
|
36
48
|
const [formState, setFormState] = React.useState(DEFAULT_STATE);
|
|
49
|
+
const loadedStateRef = React.useRef(DEFAULT_STATE);
|
|
37
50
|
const [loading, setLoading] = React.useState(false);
|
|
38
51
|
const [saving, setSaving] = React.useState(false);
|
|
39
52
|
const [tokens, setTokens] = React.useState(DOCUMENT_NUMBER_TOKENS);
|
|
@@ -73,7 +86,9 @@ function DocumentNumberSettings() {
|
|
|
73
86
|
try {
|
|
74
87
|
const call = await apiCall("/api/sales/settings/document-numbers");
|
|
75
88
|
if (call.ok) {
|
|
76
|
-
|
|
89
|
+
const loaded = normalizeState(call.result);
|
|
90
|
+
loadedStateRef.current = loaded;
|
|
91
|
+
setFormState(loaded);
|
|
77
92
|
setTokens(Array.isArray(call.result?.tokens) && call.result.tokens.length ? call.result.tokens : DOCUMENT_NUMBER_TOKENS);
|
|
78
93
|
} else {
|
|
79
94
|
flash(translations.errors.load, "error");
|
|
@@ -95,25 +110,18 @@ function DocumentNumberSettings() {
|
|
|
95
110
|
event.preventDefault();
|
|
96
111
|
setSaving(true);
|
|
97
112
|
try {
|
|
98
|
-
const payload =
|
|
99
|
-
orderNumberFormat: formState.orderNumberFormat.trim(),
|
|
100
|
-
quoteNumberFormat: formState.quoteNumberFormat.trim(),
|
|
101
|
-
orderNextNumber: Number.parseInt(formState.orderNextNumber, 10) || void 0,
|
|
102
|
-
quoteNextNumber: Number.parseInt(formState.quoteNextNumber, 10) || void 0
|
|
103
|
-
};
|
|
113
|
+
const payload = buildDocumentNumberSettingsPayload(formState, loadedStateRef.current);
|
|
104
114
|
const call = await runMutation({
|
|
105
115
|
// optimistic-lock-exempt: single-row tenant numbering settings blob — no per-record version / concurrent record edit
|
|
106
|
-
operation:
|
|
107
|
-
|
|
116
|
+
operation: () => apiCallOrThrow(
|
|
117
|
+
"/api/sales/settings/document-numbers",
|
|
118
|
+
{
|
|
108
119
|
method: "PUT",
|
|
109
120
|
headers: { "content-type": "application/json" },
|
|
110
121
|
body: JSON.stringify(payload)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
return response;
|
|
116
|
-
},
|
|
122
|
+
},
|
|
123
|
+
{ errorMessage: translations.errors.save }
|
|
124
|
+
),
|
|
117
125
|
context: {
|
|
118
126
|
formId: SAVE_CONTEXT_ID,
|
|
119
127
|
resourceKind: "sales.settings",
|
|
@@ -121,18 +129,20 @@ function DocumentNumberSettings() {
|
|
|
121
129
|
},
|
|
122
130
|
mutationPayload: payload
|
|
123
131
|
});
|
|
124
|
-
|
|
132
|
+
const saved = normalizeState(call.result);
|
|
133
|
+
loadedStateRef.current = saved;
|
|
134
|
+
setFormState(saved);
|
|
125
135
|
setTokens(Array.isArray(call.result?.tokens) && call.result.tokens.length ? call.result.tokens : DOCUMENT_NUMBER_TOKENS);
|
|
126
136
|
flash(translations.messages.saved, "success");
|
|
127
137
|
} catch (err) {
|
|
128
138
|
logger.error("sales.document-number-settings.save failed", { err });
|
|
129
|
-
flash(translations.errors.save, "error");
|
|
139
|
+
flash(normalizeCrudServerError(err).message || translations.errors.save, "error");
|
|
130
140
|
} finally {
|
|
131
141
|
setSaving(false);
|
|
132
142
|
}
|
|
133
|
-
}, [formState
|
|
143
|
+
}, [formState, retryLastMutation, runMutation, translations.errors.save, translations.messages.saved]);
|
|
134
144
|
const handleReset = React.useCallback(() => {
|
|
135
|
-
setFormState(
|
|
145
|
+
setFormState(loadedStateRef.current);
|
|
136
146
|
void handleLoad();
|
|
137
147
|
}, [handleLoad]);
|
|
138
148
|
return /* @__PURE__ */ jsxs("section", { className: "rounded-none border bg-card/30 p-5 shadow-sm", children: [
|
|
@@ -235,6 +245,7 @@ function DocumentNumberSettings() {
|
|
|
235
245
|
] });
|
|
236
246
|
}
|
|
237
247
|
export {
|
|
238
|
-
DocumentNumberSettings
|
|
248
|
+
DocumentNumberSettings,
|
|
249
|
+
buildDocumentNumberSettingsPayload
|
|
239
250
|
};
|
|
240
251
|
//# sourceMappingURL=DocumentNumberSettings.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/sales/components/DocumentNumberSettings.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Loader2, RefreshCw } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n DOCUMENT_NUMBER_TOKENS,\n DEFAULT_ORDER_NUMBER_FORMAT,\n DEFAULT_QUOTE_NUMBER_FORMAT,\n} from '../lib/documentNumberTokens'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('sales')\n\ntype SettingsResponse = {\n orderNumberFormat: string\n quoteNumberFormat: string\n nextOrderNumber: number\n nextQuoteNumber: number\n tokens?: typeof DOCUMENT_NUMBER_TOKENS\n}\n\ntype FormState = {\n orderNumberFormat: string\n quoteNumberFormat: string\n orderNextNumber: string\n quoteNextNumber: string\n}\n\nconst DEFAULT_STATE: FormState = {\n orderNumberFormat: DEFAULT_ORDER_NUMBER_FORMAT,\n quoteNumberFormat: DEFAULT_QUOTE_NUMBER_FORMAT,\n orderNextNumber: '1',\n quoteNextNumber: '1',\n}\n\nconst normalizeState = (payload?: Partial<SettingsResponse> | null): FormState => ({\n orderNumberFormat:\n typeof payload?.orderNumberFormat === 'string' && payload.orderNumberFormat.trim().length\n ? payload.orderNumberFormat\n : DEFAULT_ORDER_NUMBER_FORMAT,\n quoteNumberFormat:\n typeof payload?.quoteNumberFormat === 'string' && payload.quoteNumberFormat.trim().length\n ? payload.quoteNumberFormat\n : DEFAULT_QUOTE_NUMBER_FORMAT,\n orderNextNumber:\n typeof payload?.nextOrderNumber === 'number' && Number.isFinite(payload.nextOrderNumber)\n ? String(payload.nextOrderNumber)\n : '1',\n quoteNextNumber:\n typeof payload?.nextQuoteNumber === 'number' && Number.isFinite(payload.nextQuoteNumber)\n ? String(payload.nextQuoteNumber)\n : '1',\n})\n\nconst SAVE_CONTEXT_ID = 'sales-document-number-settings'\n\nexport function DocumentNumberSettings() {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [formState, setFormState] = React.useState<FormState>(DEFAULT_STATE)\n const [loading, setLoading] = React.useState(false)\n const [saving, setSaving] = React.useState(false)\n const [tokens, setTokens] = React.useState(DOCUMENT_NUMBER_TOKENS)\n\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: SAVE_CONTEXT_ID,\n blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),\n })\n\n const translations = React.useMemo(() => ({\n title: t('sales.config.numbering.title', 'Document numbers'),\n description: t(\n 'sales.config.numbering.description',\n 'Control how sales orders and quotes are numbered. Formats can include dates, sequences, and random fragments.'\n ),\n orderLabel: t('sales.config.numbering.orderFormat', 'Order number format'),\n quoteLabel: t('sales.config.numbering.quoteFormat', 'Quote number format'),\n orderNext: t('sales.config.numbering.orderNext', 'Next order sequence'),\n quoteNext: t('sales.config.numbering.quoteNext', 'Next quote sequence'),\n save: t('sales.config.numbering.actions.save', 'Save settings'),\n reset: t('sales.config.numbering.actions.reset', 'Reset changes'),\n refresh: t('sales.config.numbering.actions.refresh', 'Refresh'),\n refreshing: t('sales.config.numbering.actions.refreshing', 'Refreshing\u2026'),\n tokensTitle: t('sales.config.numbering.tokensTitle', 'Available tokens'),\n tokensHint: t(\n 'sales.config.numbering.tokensHint',\n 'Combine tokens to shape your identifiers, e.g. ORDER/{yyyy}/{seq:5}.'\n ),\n errors: {\n load: t('sales.config.numbering.errors.load', 'Failed to load numbering settings.'),\n save: t('sales.config.numbering.errors.save', 'Failed to save numbering settings.'),\n },\n messages: {\n saved: t('sales.config.numbering.messages.saved', 'Numbering settings saved.'),\n },\n }), [t])\n\n const handleLoad = React.useCallback(async () => {\n setLoading(true)\n try {\n const call = await apiCall<SettingsResponse>('/api/sales/settings/document-numbers')\n if (call.ok) {\n setFormState(normalizeState(call.result))\n setTokens(Array.isArray(call.result?.tokens) && call.result.tokens.length ? call.result.tokens : DOCUMENT_NUMBER_TOKENS)\n } else {\n flash(translations.errors.load, 'error')\n }\n } catch (err) {\n logger.error('sales.document-number-settings.load failed', { err })\n flash(translations.errors.load, 'error')\n } finally {\n setLoading(false)\n }\n }, [translations.errors.load])\n\n React.useEffect(() => {\n void handleLoad()\n }, [handleLoad, scopeVersion])\n\n const handleChange = (key: keyof FormState) => (event: React.ChangeEvent<HTMLInputElement>) => {\n setFormState((prev) => ({ ...prev, [key]: event.target.value }))\n }\n\n const handleSubmit = React.useCallback(async (event: React.FormEvent) => {\n event.preventDefault()\n setSaving(true)\n try {\n const payload = {\n orderNumberFormat: formState.orderNumberFormat.trim(),\n quoteNumberFormat: formState.quoteNumberFormat.trim(),\n orderNextNumber: Number.parseInt(formState.orderNextNumber, 10) || undefined,\n quoteNextNumber: Number.parseInt(formState.quoteNextNumber, 10) || undefined,\n }\n const call = await runMutation({\n // optimistic-lock-exempt: single-row tenant numbering settings blob \u2014 no per-record version / concurrent record edit\n operation: async () => {\n const response = await apiCall<SettingsResponse>('/api/sales/settings/document-numbers', {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n if (!response.ok) {\n throw new Error(translations.errors.save)\n }\n return response\n },\n context: {\n formId: SAVE_CONTEXT_ID,\n resourceKind: 'sales.settings',\n retryLastMutation,\n },\n mutationPayload: payload,\n })\n setFormState(normalizeState(call.result))\n setTokens(Array.isArray(call.result?.tokens) && call.result.tokens.length ? call.result.tokens : DOCUMENT_NUMBER_TOKENS)\n flash(translations.messages.saved, 'success')\n } catch (err) {\n logger.error('sales.document-number-settings.save failed', { err })\n flash(translations.errors.save, 'error')\n } finally {\n setSaving(false)\n }\n }, [formState.orderNextNumber, formState.orderNumberFormat, formState.quoteNextNumber, formState.quoteNumberFormat, retryLastMutation, runMutation, translations.errors.save, translations.messages.saved])\n\n const handleReset = React.useCallback(() => {\n setFormState(DEFAULT_STATE)\n void handleLoad()\n }, [handleLoad])\n\n return (\n <section className=\"rounded-none border bg-card/30 p-5 shadow-sm\">\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"space-y-1\">\n <h2 className=\"text-lg font-semibold\">{translations.title}</h2>\n <p className=\"text-sm text-muted-foreground\">{translations.description}</p>\n </div>\n <div className=\"flex gap-2\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n type=\"button\"\n className=\"rounded-none border-0 shadow-none hover:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0\"\n onClick={handleLoad}\n disabled={loading || saving}\n aria-label={translations.refresh}\n >\n {loading ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <RefreshCw className=\"h-4 w-4\" />}\n <span className=\"sr-only\">{loading ? translations.refreshing : translations.refresh}</span>\n </Button>\n </div>\n </div>\n <form className=\"mt-4 space-y-5\" onSubmit={handleSubmit}>\n <div className=\"grid gap-4 md:grid-cols-2\">\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.orderLabel}</div>\n <Input\n value={formState.orderNumberFormat}\n onChange={handleChange('orderNumberFormat')}\n disabled={loading || saving}\n spellCheck={false}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.orderHint', 'Example: ORDER/{yyyy}/{seq:5}')}\n </p>\n </label>\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.quoteLabel}</div>\n <Input\n value={formState.quoteNumberFormat}\n onChange={handleChange('quoteNumberFormat')}\n disabled={loading || saving}\n spellCheck={false}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.quoteHint', 'Example: QUOTE/{yy}/{mm}/{seq:4}')}\n </p>\n </label>\n </div>\n <div className=\"grid gap-4 md:grid-cols-2\">\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.orderNext}</div>\n <Input\n type=\"number\"\n min={1}\n value={formState.orderNextNumber}\n onChange={handleChange('orderNextNumber')}\n disabled={loading || saving}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.sequenceHint', 'Applied on the next generated number for this type.')}\n </p>\n </label>\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.quoteNext}</div>\n <Input\n type=\"number\"\n min={1}\n value={formState.quoteNextNumber}\n onChange={handleChange('quoteNextNumber')}\n disabled={loading || saving}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.sequenceHintQuote', 'Resets the quote counter for the next document.')}\n </p>\n </label>\n </div>\n <div className=\"space-y-2 rounded-lg border bg-muted/50 p-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium\">\n {translations.tokensTitle}\n <span className=\"text-xs font-normal text-muted-foreground\">{translations.tokensHint}</span>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n {tokens.map((entry) => (\n <div key={entry.token} className=\"flex items-center gap-2 rounded border bg-background px-2 py-1\">\n <Badge variant=\"secondary\" className=\"font-mono text-xs\">\n {entry.token}\n </Badge>\n <span className=\"text-xs text-muted-foreground\">{entry.description}</span>\n </div>\n ))}\n </div>\n </div>\n <div className=\"flex items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={handleReset} disabled={loading || saving}>\n {translations.reset}\n </Button>\n <Button type=\"submit\" disabled={saving}>\n {saving ? t('sales.config.numbering.actions.saving', 'Saving\u2026') : translations.save}\n </Button>\n </div>\n </form>\n </section>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Loader2, RefreshCw } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { normalizeCrudServerError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n DOCUMENT_NUMBER_TOKENS,\n DEFAULT_ORDER_NUMBER_FORMAT,\n DEFAULT_QUOTE_NUMBER_FORMAT,\n} from '../lib/documentNumberTokens'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('sales')\n\ntype SettingsResponse = {\n orderNumberFormat: string\n quoteNumberFormat: string\n nextOrderNumber: number\n nextQuoteNumber: number\n tokens?: typeof DOCUMENT_NUMBER_TOKENS\n}\n\nexport type DocumentNumberSettingsFormState = {\n orderNumberFormat: string\n quoteNumberFormat: string\n orderNextNumber: string\n quoteNextNumber: string\n}\n\nconst DEFAULT_STATE: DocumentNumberSettingsFormState = {\n orderNumberFormat: DEFAULT_ORDER_NUMBER_FORMAT,\n quoteNumberFormat: DEFAULT_QUOTE_NUMBER_FORMAT,\n orderNextNumber: '1',\n quoteNextNumber: '1',\n}\n\nconst normalizeState = (payload?: Partial<SettingsResponse> | null): DocumentNumberSettingsFormState => ({\n orderNumberFormat:\n typeof payload?.orderNumberFormat === 'string' && payload.orderNumberFormat.trim().length\n ? payload.orderNumberFormat\n : DEFAULT_ORDER_NUMBER_FORMAT,\n quoteNumberFormat:\n typeof payload?.quoteNumberFormat === 'string' && payload.quoteNumberFormat.trim().length\n ? payload.quoteNumberFormat\n : DEFAULT_QUOTE_NUMBER_FORMAT,\n orderNextNumber:\n typeof payload?.nextOrderNumber === 'number' && Number.isFinite(payload.nextOrderNumber)\n ? String(payload.nextOrderNumber)\n : '1',\n quoteNextNumber:\n typeof payload?.nextQuoteNumber === 'number' && Number.isFinite(payload.nextQuoteNumber)\n ? String(payload.nextQuoteNumber)\n : '1',\n})\n\nconst parseCounter = (value: string): number | undefined => Number.parseInt(value, 10) || undefined\n\nexport function buildDocumentNumberSettingsPayload(formState: DocumentNumberSettingsFormState, loadedState: DocumentNumberSettingsFormState) {\n const orderNextNumber = parseCounter(formState.orderNextNumber)\n const quoteNextNumber = parseCounter(formState.quoteNextNumber)\n return {\n orderNumberFormat: formState.orderNumberFormat.trim(),\n quoteNumberFormat: formState.quoteNumberFormat.trim(),\n orderNextNumber: orderNextNumber !== parseCounter(loadedState.orderNextNumber) ? orderNextNumber : undefined,\n quoteNextNumber: quoteNextNumber !== parseCounter(loadedState.quoteNextNumber) ? quoteNextNumber : undefined,\n }\n}\n\nconst SAVE_CONTEXT_ID = 'sales-document-number-settings'\n\nexport function DocumentNumberSettings() {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [formState, setFormState] = React.useState<DocumentNumberSettingsFormState>(DEFAULT_STATE)\n const loadedStateRef = React.useRef<DocumentNumberSettingsFormState>(DEFAULT_STATE)\n const [loading, setLoading] = React.useState(false)\n const [saving, setSaving] = React.useState(false)\n const [tokens, setTokens] = React.useState(DOCUMENT_NUMBER_TOKENS)\n\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: SAVE_CONTEXT_ID,\n blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),\n })\n\n const translations = React.useMemo(() => ({\n title: t('sales.config.numbering.title', 'Document numbers'),\n description: t(\n 'sales.config.numbering.description',\n 'Control how sales orders and quotes are numbered. Formats can include dates, sequences, and random fragments.'\n ),\n orderLabel: t('sales.config.numbering.orderFormat', 'Order number format'),\n quoteLabel: t('sales.config.numbering.quoteFormat', 'Quote number format'),\n orderNext: t('sales.config.numbering.orderNext', 'Next order sequence'),\n quoteNext: t('sales.config.numbering.quoteNext', 'Next quote sequence'),\n save: t('sales.config.numbering.actions.save', 'Save settings'),\n reset: t('sales.config.numbering.actions.reset', 'Reset changes'),\n refresh: t('sales.config.numbering.actions.refresh', 'Refresh'),\n refreshing: t('sales.config.numbering.actions.refreshing', 'Refreshing\u2026'),\n tokensTitle: t('sales.config.numbering.tokensTitle', 'Available tokens'),\n tokensHint: t(\n 'sales.config.numbering.tokensHint',\n 'Combine tokens to shape your identifiers, e.g. ORDER/{yyyy}/{seq:5}.'\n ),\n errors: {\n load: t('sales.config.numbering.errors.load', 'Failed to load numbering settings.'),\n save: t('sales.config.numbering.errors.save', 'Failed to save numbering settings.'),\n },\n messages: {\n saved: t('sales.config.numbering.messages.saved', 'Numbering settings saved.'),\n },\n }), [t])\n\n const handleLoad = React.useCallback(async () => {\n setLoading(true)\n try {\n const call = await apiCall<SettingsResponse>('/api/sales/settings/document-numbers')\n if (call.ok) {\n const loaded = normalizeState(call.result)\n loadedStateRef.current = loaded\n setFormState(loaded)\n setTokens(Array.isArray(call.result?.tokens) && call.result.tokens.length ? call.result.tokens : DOCUMENT_NUMBER_TOKENS)\n } else {\n flash(translations.errors.load, 'error')\n }\n } catch (err) {\n logger.error('sales.document-number-settings.load failed', { err })\n flash(translations.errors.load, 'error')\n } finally {\n setLoading(false)\n }\n }, [translations.errors.load])\n\n React.useEffect(() => {\n void handleLoad()\n }, [handleLoad, scopeVersion])\n\n const handleChange = (key: keyof DocumentNumberSettingsFormState) => (event: React.ChangeEvent<HTMLInputElement>) => {\n setFormState((prev) => ({ ...prev, [key]: event.target.value }))\n }\n\n const handleSubmit = React.useCallback(async (event: React.FormEvent) => {\n event.preventDefault()\n setSaving(true)\n try {\n const payload = buildDocumentNumberSettingsPayload(formState, loadedStateRef.current)\n const call = await runMutation({\n // optimistic-lock-exempt: single-row tenant numbering settings blob \u2014 no per-record version / concurrent record edit\n operation: () =>\n apiCallOrThrow<SettingsResponse>(\n '/api/sales/settings/document-numbers',\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n { errorMessage: translations.errors.save },\n ),\n context: {\n formId: SAVE_CONTEXT_ID,\n resourceKind: 'sales.settings',\n retryLastMutation,\n },\n mutationPayload: payload,\n })\n const saved = normalizeState(call.result)\n loadedStateRef.current = saved\n setFormState(saved)\n setTokens(Array.isArray(call.result?.tokens) && call.result.tokens.length ? call.result.tokens : DOCUMENT_NUMBER_TOKENS)\n flash(translations.messages.saved, 'success')\n } catch (err) {\n logger.error('sales.document-number-settings.save failed', { err })\n flash(normalizeCrudServerError(err).message || translations.errors.save, 'error')\n } finally {\n setSaving(false)\n }\n }, [formState, retryLastMutation, runMutation, translations.errors.save, translations.messages.saved])\n\n const handleReset = React.useCallback(() => {\n setFormState(loadedStateRef.current)\n void handleLoad()\n }, [handleLoad])\n\n return (\n <section className=\"rounded-none border bg-card/30 p-5 shadow-sm\">\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"space-y-1\">\n <h2 className=\"text-lg font-semibold\">{translations.title}</h2>\n <p className=\"text-sm text-muted-foreground\">{translations.description}</p>\n </div>\n <div className=\"flex gap-2\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n type=\"button\"\n className=\"rounded-none border-0 shadow-none hover:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0\"\n onClick={handleLoad}\n disabled={loading || saving}\n aria-label={translations.refresh}\n >\n {loading ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <RefreshCw className=\"h-4 w-4\" />}\n <span className=\"sr-only\">{loading ? translations.refreshing : translations.refresh}</span>\n </Button>\n </div>\n </div>\n <form className=\"mt-4 space-y-5\" onSubmit={handleSubmit}>\n <div className=\"grid gap-4 md:grid-cols-2\">\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.orderLabel}</div>\n <Input\n value={formState.orderNumberFormat}\n onChange={handleChange('orderNumberFormat')}\n disabled={loading || saving}\n spellCheck={false}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.orderHint', 'Example: ORDER/{yyyy}/{seq:5}')}\n </p>\n </label>\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.quoteLabel}</div>\n <Input\n value={formState.quoteNumberFormat}\n onChange={handleChange('quoteNumberFormat')}\n disabled={loading || saving}\n spellCheck={false}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.quoteHint', 'Example: QUOTE/{yy}/{mm}/{seq:4}')}\n </p>\n </label>\n </div>\n <div className=\"grid gap-4 md:grid-cols-2\">\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.orderNext}</div>\n <Input\n type=\"number\"\n min={1}\n value={formState.orderNextNumber}\n onChange={handleChange('orderNextNumber')}\n disabled={loading || saving}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.sequenceHint', 'Applied on the next generated number for this type.')}\n </p>\n </label>\n <label className=\"space-y-2\">\n <div className=\"text-sm font-medium\">{translations.quoteNext}</div>\n <Input\n type=\"number\"\n min={1}\n value={formState.quoteNextNumber}\n onChange={handleChange('quoteNextNumber')}\n disabled={loading || saving}\n />\n <p className=\"text-xs text-muted-foreground\">\n {t('sales.config.numbering.sequenceHintQuote', 'Resets the quote counter for the next document.')}\n </p>\n </label>\n </div>\n <div className=\"space-y-2 rounded-lg border bg-muted/50 p-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium\">\n {translations.tokensTitle}\n <span className=\"text-xs font-normal text-muted-foreground\">{translations.tokensHint}</span>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n {tokens.map((entry) => (\n <div key={entry.token} className=\"flex items-center gap-2 rounded border bg-background px-2 py-1\">\n <Badge variant=\"secondary\" className=\"font-mono text-xs\">\n {entry.token}\n </Badge>\n <span className=\"text-xs text-muted-foreground\">{entry.description}</span>\n </div>\n ))}\n </div>\n </div>\n <div className=\"flex items-center justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={handleReset} disabled={loading || saving}>\n {translations.reset}\n </Button>\n <Button type=\"submit\" disabled={saving}>\n {saving ? t('sales.config.numbering.actions.saving', 'Saving\u2026') : translations.save}\n </Button>\n </div>\n </form>\n </section>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAqMQ,SACE,KADF;AAnMR,YAAY,WAAW;AACvB,SAAS,SAAS,iBAAiB;AACnC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,SAAS,sBAAsB;AACxC,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AACnC,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,OAAO;AAiBnC,MAAM,gBAAiD;AAAA,EACrD,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;AAEA,MAAM,iBAAiB,CAAC,aAAiF;AAAA,EACvG,mBACE,OAAO,SAAS,sBAAsB,YAAY,QAAQ,kBAAkB,KAAK,EAAE,SAC/E,QAAQ,oBACR;AAAA,EACN,mBACE,OAAO,SAAS,sBAAsB,YAAY,QAAQ,kBAAkB,KAAK,EAAE,SAC/E,QAAQ,oBACR;AAAA,EACN,iBACE,OAAO,SAAS,oBAAoB,YAAY,OAAO,SAAS,QAAQ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