@open-mercato/core 0.6.6-develop.6465.1.019f0fb26f → 0.6.6-develop.6471.1.9ab5bdd79a
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/dist/bootstrap.js +13 -11
- package/dist/bootstrap.js.map +2 -2
- package/dist/helpers/integration/queue-runner.js +4 -2
- package/dist/helpers/integration/queue-runner.js.map +2 -2
- package/dist/modules/api_keys/services/apiKeyService.js +5 -3
- package/dist/modules/api_keys/services/apiKeyService.js.map +2 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js +4 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js.map +2 -2
- package/dist/modules/attachments/api/library/[id]/route.js +3 -1
- package/dist/modules/attachments/api/library/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +8 -6
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js +5 -3
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
- package/dist/modules/attachments/lib/assignmentDetails.js +3 -1
- package/dist/modules/attachments/lib/assignmentDetails.js.map +2 -2
- package/dist/modules/attachments/lib/drivers/driverFactory.js +3 -1
- package/dist/modules/attachments/lib/drivers/driverFactory.js.map +2 -2
- package/dist/modules/attachments/lib/ocrQueue.js +10 -11
- package/dist/modules/attachments/lib/ocrQueue.js.map +2 -2
- package/dist/modules/attachments/lib/ocrService.js +6 -4
- package/dist/modules/attachments/lib/ocrService.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js +3 -1
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js +3 -1
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js.map +2 -2
- package/dist/modules/audit_logs/backend/audit-logs/page.js +3 -1
- package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
- package/dist/modules/audit_logs/components/AuditLogsActions.js +4 -2
- package/dist/modules/audit_logs/components/AuditLogsActions.js.map +2 -2
- package/dist/modules/audit_logs/services/accessLogService.js +4 -2
- package/dist/modules/audit_logs/services/accessLogService.js.map +2 -2
- package/dist/modules/audit_logs/services/actionLogService.js +7 -5
- package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
- package/dist/modules/auth/api/profile/route.js +4 -2
- package/dist/modules/auth/api/profile/route.js.map +2 -2
- package/dist/modules/auth/api/reset/confirm.js +3 -1
- package/dist/modules/auth/api/reset/confirm.js.map +2 -2
- package/dist/modules/auth/api/reset.js +4 -2
- package/dist/modules/auth/api/reset.js.map +2 -2
- package/dist/modules/auth/api/roles/route.js +3 -1
- package/dist/modules/auth/api/roles/route.js.map +2 -2
- package/dist/modules/auth/api/sidebar/variants/route.js +3 -1
- package/dist/modules/auth/api/sidebar/variants/route.js.map +2 -2
- package/dist/modules/auth/api/users/resend-invite/route.js +4 -2
- package/dist/modules/auth/api/users/resend-invite/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +3 -1
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/auth/profile/page.js +3 -1
- package/dist/modules/auth/backend/auth/profile/page.js.map +2 -2
- package/dist/modules/auth/backend/profile/change-password/page.js +3 -1
- package/dist/modules/auth/backend/profile/change-password/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.js +5 -3
- package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/users/create/page.js +4 -2
- package/dist/modules/auth/backend/users/create/page.js.map +2 -2
- package/dist/modules/auth/cli.js +10 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/users.js +4 -2
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/lib/consentIntegrity.js +3 -3
- package/dist/modules/auth/lib/consentIntegrity.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +9 -10
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/lib/tenantAccess.js +3 -1
- package/dist/modules/auth/lib/tenantAccess.js.map +2 -2
- package/dist/modules/auth/lib/tokenHash.js +3 -3
- package/dist/modules/auth/lib/tokenHash.js.map +2 -2
- package/dist/modules/business_rules/api/rules/route.js +4 -2
- package/dist/modules/business_rules/api/rules/route.js.map +2 -2
- package/dist/modules/business_rules/lib/expression-evaluator.js +7 -5
- package/dist/modules/business_rules/lib/expression-evaluator.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-engine.js +5 -3
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-evaluator.js +11 -12
- package/dist/modules/business_rules/lib/rule-evaluator.js.map +2 -2
- package/dist/modules/business_rules/subscribers/crud-rule-trigger.js +3 -1
- package/dist/modules/business_rules/subscribers/crud-rule-trigger.js.map +2 -2
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +3 -1
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +2 -2
- package/dist/modules/catalog/ai-agents-context.js +4 -5
- package/dist/modules/catalog/ai-agents-context.js.map +2 -2
- package/dist/modules/catalog/ai-tools/_shared.js +3 -1
- package/dist/modules/catalog/ai-tools/_shared.js.map +2 -2
- package/dist/modules/catalog/ai-tools/authoring-pack.js +3 -1
- package/dist/modules/catalog/ai-tools/authoring-pack.js.map +2 -2
- package/dist/modules/catalog/ai-tools/merchandising-pack.js +3 -1
- package/dist/modules/catalog/ai-tools/merchandising-pack.js.map +2 -2
- package/dist/modules/catalog/api/dictionaries/[key]/route.js +3 -1
- package/dist/modules/catalog/api/dictionaries/[key]/route.js.map +2 -2
- package/dist/modules/catalog/api/prices/route.js +3 -1
- package/dist/modules/catalog/api/prices/route.js.map +2 -2
- package/dist/modules/catalog/api/products/route.js +5 -3
- package/dist/modules/catalog/api/products/route.js.map +2 -2
- package/dist/modules/catalog/api/settings/route.js +4 -2
- package/dist/modules/catalog/api/settings/route.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +14 -12
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js +8 -6
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js +5 -3
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +5 -6
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/optionSchemaClient.js +3 -1
- package/dist/modules/catalog/backend/catalog/products/optionSchemaClient.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +5 -3
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/UnitPriceDisplaySettings.js +4 -2
- package/dist/modules/catalog/components/UnitPriceDisplaySettings.js.map +2 -2
- package/dist/modules/catalog/inbox-actions.js +4 -2
- package/dist/modules/catalog/inbox-actions.js.map +2 -2
- package/dist/modules/catalog/seed/examples.js +4 -5
- package/dist/modules/catalog/seed/examples.js.map +2 -2
- package/dist/modules/catalog/subscribers/low-stock-notification.js +3 -1
- package/dist/modules/catalog/subscribers/low-stock-notification.js.map +2 -2
- package/dist/modules/catalog/widgets/injection/product-seo/state.js +3 -1
- package/dist/modules/catalog/widgets/injection/product-seo/state.js.map +2 -2
- package/dist/modules/communication_channels/api/get/oauth/[provider]/callback/route.js +12 -11
- 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 +3 -1
- 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]/push/register/route.js +3 -1
- package/dist/modules/communication_channels/api/post/channels/[id]/push/register/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/webhook/[provider]/route.js +5 -3
- package/dist/modules/communication_channels/api/post/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/webhooks/gmail/route.js +6 -6
- package/dist/modules/communication_channels/api/post/webhooks/gmail/route.js.map +2 -2
- package/dist/modules/communication_channels/commands/connect-credential-channel.js +4 -6
- package/dist/modules/communication_channels/commands/connect-credential-channel.js.map +2 -2
- package/dist/modules/communication_channels/commands/delete-channel.js +3 -3
- package/dist/modules/communication_channels/commands/delete-channel.js.map +2 -2
- package/dist/modules/communication_channels/commands/deliver-outbound-message.js +4 -5
- package/dist/modules/communication_channels/commands/deliver-outbound-message.js.map +2 -2
- package/dist/modules/communication_channels/commands/disconnect-channel.js +3 -3
- package/dist/modules/communication_channels/commands/disconnect-channel.js.map +2 -2
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js +5 -12
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
- package/dist/modules/communication_channels/commands/push-unregister.js +3 -3
- package/dist/modules/communication_channels/commands/push-unregister.js.map +2 -2
- package/dist/modules/communication_channels/commands/reassign-conversation.js +5 -3
- package/dist/modules/communication_channels/commands/reassign-conversation.js.map +2 -2
- package/dist/modules/communication_channels/lib/dead-letter.js +3 -3
- package/dist/modules/communication_channels/lib/dead-letter.js.map +2 -2
- package/dist/modules/communication_channels/lib/email-mime.js +4 -6
- package/dist/modules/communication_channels/lib/email-mime.js.map +2 -2
- package/dist/modules/communication_channels/lib/oauth-client-config.js +5 -3
- package/dist/modules/communication_channels/lib/oauth-client-config.js.map +2 -2
- package/dist/modules/communication_channels/lib/send-as-user.js +3 -1
- package/dist/modules/communication_channels/lib/send-as-user.js.map +2 -2
- package/dist/modules/communication_channels/lib/thread-token.js +4 -2
- package/dist/modules/communication_channels/lib/thread-token.js.map +2 -2
- package/dist/modules/communication_channels/setup.js +3 -4
- package/dist/modules/communication_channels/setup.js.map +2 -2
- package/dist/modules/communication_channels/workers/channel-import-history.js +4 -6
- package/dist/modules/communication_channels/workers/channel-import-history.js.map +2 -2
- package/dist/modules/communication_channels/workers/gmail-history-sync.js +8 -16
- package/dist/modules/communication_channels/workers/gmail-history-sync.js.map +2 -2
- package/dist/modules/communication_channels/workers/gmail-renew-watch.js +5 -7
- package/dist/modules/communication_channels/workers/gmail-renew-watch.js.map +2 -2
- package/dist/modules/communication_channels/workers/outbound-delivery.js +6 -12
- package/dist/modules/communication_channels/workers/outbound-delivery.js.map +2 -2
- package/dist/modules/communication_channels/workers/poll-channel.js +7 -15
- package/dist/modules/communication_channels/workers/poll-channel.js.map +2 -2
- package/dist/modules/communication_channels/workers/poll-tick.js +5 -6
- package/dist/modules/communication_channels/workers/poll-tick.js.map +2 -2
- package/dist/modules/communication_channels/workers/reaction-processor.js +5 -9
- package/dist/modules/communication_channels/workers/reaction-processor.js.map +2 -2
- package/dist/modules/configs/api/cache/route.js +4 -2
- package/dist/modules/configs/api/cache/route.js.map +2 -2
- package/dist/modules/configs/api/system-status/route.js +4 -2
- package/dist/modules/configs/api/system-status/route.js.map +2 -2
- package/dist/modules/configs/api/upgrade-actions/route.js +4 -2
- package/dist/modules/configs/api/upgrade-actions/route.js.map +2 -2
- package/dist/modules/configs/components/ModuleTelemetryPanel.js +3 -1
- package/dist/modules/configs/components/ModuleTelemetryPanel.js.map +2 -2
- package/dist/modules/configs/lib/touchGeneratedBarrels.js +2 -1
- package/dist/modules/configs/lib/touchGeneratedBarrels.js.map +2 -2
- package/dist/modules/configs/services/upgradeActionsService.js +6 -3
- package/dist/modules/configs/services/upgradeActionsService.js.map +2 -2
- package/dist/modules/currencies/components/CurrencyFetchingConfig.js +3 -1
- package/dist/modules/currencies/components/CurrencyFetchingConfig.js.map +2 -2
- package/dist/modules/currencies/lib/exchangeRateFormConfig.js +3 -1
- package/dist/modules/currencies/lib/exchangeRateFormConfig.js.map +2 -2
- package/dist/modules/currencies/services/providers/nbp.js +6 -4
- package/dist/modules/currencies/services/providers/nbp.js.map +2 -2
- package/dist/modules/currencies/services/providers/raiffeisen.js +7 -7
- package/dist/modules/currencies/services/providers/raiffeisen.js.map +2 -2
- package/dist/modules/customer_accounts/api/domain-resolve/all.js +6 -5
- package/dist/modules/customer_accounts/api/domain-resolve/all.js.map +2 -2
- package/dist/modules/customer_accounts/api/signup.js +4 -2
- package/dist/modules/customer_accounts/api/signup.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerAuthServer.js +3 -1
- package/dist/modules/customer_accounts/lib/customerAuthServer.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js +3 -1
- package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/autoLinkCrmReverse.js +3 -1
- package/dist/modules/customer_accounts/subscribers/autoLinkCrmReverse.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/unlinkOnCompanyDelete.js +3 -1
- package/dist/modules/customer_accounts/subscribers/unlinkOnCompanyDelete.js.map +2 -2
- package/dist/modules/customer_accounts/subscribers/unlinkOnPersonDelete.js +3 -1
- package/dist/modules/customer_accounts/subscribers/unlinkOnPersonDelete.js.map +2 -2
- package/dist/modules/customers/ai-agents-context.js +4 -5
- package/dist/modules/customers/ai-agents-context.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +6 -4
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/comments/route.js +3 -1
- package/dist/modules/customers/api/comments/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +3 -1
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +5 -3
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/companies/route.js +5 -3
- package/dist/modules/customers/api/companies/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js +3 -1
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/new-customers/route.js +3 -1
- package/dist/modules/customers/api/dashboard/widgets/new-customers/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/new-deals/route.js +3 -1
- package/dist/modules/customers/api/dashboard/widgets/new-deals/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/next-interactions/route.js +3 -1
- package/dist/modules/customers/api/dashboard/widgets/next-interactions/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js +3 -1
- package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +3 -1
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/aggregate/route.js +3 -1
- package/dist/modules/customers/api/deals/aggregate/route.js.map +2 -2
- package/dist/modules/customers/api/deals/bulk-update-owner/route.js +7 -5
- package/dist/modules/customers/api/deals/bulk-update-owner/route.js.map +2 -2
- package/dist/modules/customers/api/deals/bulk-update-stage/route.js +7 -5
- package/dist/modules/customers/api/deals/bulk-update-stage/route.js.map +2 -2
- package/dist/modules/customers/api/deals/route.js +3 -1
- package/dist/modules/customers/api/deals/route.js.map +2 -2
- package/dist/modules/customers/api/deals/summary/route.js +3 -1
- package/dist/modules/customers/api/deals/summary/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js +4 -2
- package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/[kind]/route.js +5 -3
- package/dist/modules/customers/api/dictionaries/[kind]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/cache.js +3 -1
- package/dist/modules/customers/api/dictionaries/cache.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/context.js +3 -1
- package/dist/modules/customers/api/dictionaries/context.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/currency/route.js +3 -1
- package/dist/modules/customers/api/dictionaries/currency/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/kind-settings/route.js +4 -2
- package/dist/modules/customers/api/dictionaries/kind-settings/route.js.map +2 -2
- package/dist/modules/customers/api/entity-roles-factory.js +7 -5
- package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
- package/dist/modules/customers/api/interactions/cancel/route.js +3 -1
- package/dist/modules/customers/api/interactions/cancel/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/complete/route.js +3 -1
- package/dist/modules/customers/api/interactions/complete/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js +3 -1
- package/dist/modules/customers/api/interactions/conflicts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js +3 -1
- package/dist/modules/customers/api/interactions/counts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +7 -4
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/tasks/route.js +3 -1
- package/dist/modules/customers/api/interactions/tasks/route.js.map +2 -2
- package/dist/modules/customers/api/labels/assign/route.js +3 -1
- package/dist/modules/customers/api/labels/assign/route.js.map +2 -2
- package/dist/modules/customers/api/labels/route.js +6 -3
- package/dist/modules/customers/api/labels/route.js.map +2 -2
- package/dist/modules/customers/api/labels/unassign/route.js +3 -1
- package/dist/modules/customers/api/labels/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js +3 -1
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +5 -3
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/route.js +5 -3
- package/dist/modules/customers/api/people/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js +3 -1
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/route.js +6 -4
- package/dist/modules/customers/api/pipeline-stages/route.js.map +2 -2
- package/dist/modules/customers/api/pipelines/route.js +6 -4
- package/dist/modules/customers/api/pipelines/route.js.map +2 -2
- package/dist/modules/customers/api/settings/address-format/route.js +4 -2
- package/dist/modules/customers/api/settings/address-format/route.js.map +2 -2
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js +4 -2
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js.map +2 -2
- package/dist/modules/customers/api/settings/stuck-threshold/route.js +4 -2
- package/dist/modules/customers/api/settings/stuck-threshold/route.js.map +2 -2
- package/dist/modules/customers/api/tags/assign/route.js +3 -1
- package/dist/modules/customers/api/tags/assign/route.js.map +2 -2
- package/dist/modules/customers/api/tags/unassign/route.js +3 -1
- package/dist/modules/customers/api/tags/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/todos/route.js +6 -4
- package/dist/modules/customers/api/todos/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +5 -3
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealActivities.js +3 -1
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealActivities.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealClosure.js +3 -1
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealClosure.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/map/components/DealsMapCanvasImpl.js +4 -2
- package/dist/modules/customers/backend/customers/deals/map/components/DealsMapCanvasImpl.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +4 -2
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +5 -3
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +3 -1
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/dictionaries.js +3 -1
- package/dist/modules/customers/commands/dictionaries.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js +4 -2
- package/dist/modules/customers/commands/interactions.js.map +2 -2
- package/dist/modules/customers/commands/shared.js +4 -2
- package/dist/modules/customers/commands/shared.js.map +2 -2
- package/dist/modules/customers/commands/todos.js +3 -1
- package/dist/modules/customers/commands/todos.js.map +2 -2
- package/dist/modules/customers/components/DictionarySettings.js +5 -3
- package/dist/modules/customers/components/DictionarySettings.js.map +2 -2
- package/dist/modules/customers/components/DictionarySortSettings.js +3 -1
- package/dist/modules/customers/components/DictionarySortSettings.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesCard.js +3 -1
- package/dist/modules/customers/components/detail/ActivitiesCard.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesDayStrip.js +3 -1
- package/dist/modules/customers/components/detail/ActivitiesDayStrip.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesSection.js +6 -4
- package/dist/modules/customers/components/detail/ActivitiesSection.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivityCard.js +3 -1
- package/dist/modules/customers/components/detail/ActivityCard.js.map +2 -2
- package/dist/modules/customers/components/detail/ChangelogTab.js +3 -1
- package/dist/modules/customers/components/detail/ChangelogTab.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyCard.js +3 -1
- package/dist/modules/customers/components/detail/CompanyCard.js.map +2 -2
- package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js +3 -1
- package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/EntityTagsDialog.js +3 -1
- package/dist/modules/customers/components/detail/EntityTagsDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/InlineActivityComposer.js +3 -1
- package/dist/modules/customers/components/detail/InlineActivityComposer.js.map +2 -2
- package/dist/modules/customers/components/detail/ManageTagsDialog.js +3 -1
- package/dist/modules/customers/components/detail/ManageTagsDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/RoleAssignmentRow.js +5 -3
- package/dist/modules/customers/components/detail/RoleAssignmentRow.js.map +2 -2
- package/dist/modules/customers/components/detail/RolesSection.js +4 -2
- package/dist/modules/customers/components/detail/RolesSection.js.map +2 -2
- package/dist/modules/customers/components/detail/hooks/useInteractionMutations.js +5 -3
- package/dist/modules/customers/components/detail/hooks/useInteractionMutations.js.map +2 -2
- package/dist/modules/customers/components/linking/LinkEntityDialog.js +4 -2
- package/dist/modules/customers/components/linking/LinkEntityDialog.js.map +2 -2
- package/dist/modules/customers/inbox-actions.js +3 -1
- package/dist/modules/customers/inbox-actions.js.map +2 -2
- package/dist/modules/customers/lib/bulkDeals.js +3 -1
- package/dist/modules/customers/lib/bulkDeals.js.map +2 -2
- package/dist/modules/customers/lib/dealClosureNotification.js +4 -2
- package/dist/modules/customers/lib/dealClosureNotification.js.map +2 -2
- package/dist/modules/customers/lib/dealStageTransitionTable.js +3 -1
- package/dist/modules/customers/lib/dealStageTransitionTable.js.map +2 -2
- package/dist/modules/customers/lib/interactionFeatureFlags.js +3 -1
- package/dist/modules/customers/lib/interactionFeatureFlags.js.map +2 -2
- package/dist/modules/customers/lib/todoCompatibility.js +3 -1
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/customers/search.js +14 -7
- package/dist/modules/customers/search.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/customer-todos/widget.client.js +3 -1
- package/dist/modules/customers/widgets/dashboard/customer-todos/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/new-customers/widget.client.js +3 -1
- package/dist/modules/customers/widgets/dashboard/new-customers/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/new-deals/widget.client.js +3 -1
- package/dist/modules/customers/widgets/dashboard/new-deals/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/next-interactions/widget.client.js +3 -1
- package/dist/modules/customers/widgets/dashboard/next-interactions/widget.client.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/batch/route.js +3 -1
- package/dist/modules/dashboards/api/widgets/data/batch/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/route.js +3 -1
- package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +5 -3
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/aov-kpi/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/aov-kpi/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/new-customers-kpi/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/new-customers-kpi/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/orders-kpi/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/orders-kpi/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/revenue-kpi/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/revenue-kpi/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js +3 -1
- package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js.map +2 -2
- package/dist/modules/data_sync/api/run.js +3 -1
- package/dist/modules/data_sync/api/run.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +1 -1
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +2 -2
- package/dist/modules/data_sync/lib/adapter-registry.js +11 -4
- package/dist/modules/data_sync/lib/adapter-registry.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +23 -2
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-export.js +3 -1
- package/dist/modules/data_sync/workers/sync-export.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-import.js +3 -1
- package/dist/modules/data_sync/workers/sync-import.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js +4 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js +3 -1
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js +4 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js +3 -1
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js +5 -3
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/context.js +3 -1
- package/dist/modules/dictionaries/api/context.js.map +2 -2
- package/dist/modules/dictionaries/api/route.js +4 -2
- package/dist/modules/dictionaries/api/route.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionariesManager.js +5 -3
- package/dist/modules/dictionaries/components/DictionariesManager.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js +4 -2
- package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +4 -2
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionarySelectControl.js +3 -1
- package/dist/modules/dictionaries/components/DictionarySelectControl.js.map +2 -2
- package/dist/modules/dictionaries/fields/dictionary.js +3 -1
- package/dist/modules/dictionaries/fields/dictionary.js.map +2 -2
- package/dist/modules/directory/api/organization-branding/route.js +3 -1
- package/dist/modules/directory/api/organization-branding/route.js.map +2 -2
- package/dist/modules/directory/api/organization-switcher/route.js +3 -1
- package/dist/modules/directory/api/organization-switcher/route.js.map +2 -2
- package/dist/modules/directory/commands/tenants.js +5 -3
- package/dist/modules/directory/commands/tenants.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js +6 -4
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/entities/api/definitions.cache.js +3 -1
- package/dist/modules/entities/api/definitions.cache.js.map +2 -2
- package/dist/modules/entities/api/definitions.js +7 -5
- package/dist/modules/entities/api/definitions.js.map +2 -2
- package/dist/modules/entities/api/records.js +4 -8
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/components/EncryptionManager.js +3 -1
- package/dist/modules/entities/components/EncryptionManager.js.map +2 -2
- package/dist/modules/entities/lib/makeActivityRoute.js +3 -1
- package/dist/modules/entities/lib/makeActivityRoute.js.map +2 -2
- package/dist/modules/feature_toggles/api/overrides/route.js +3 -1
- package/dist/modules/feature_toggles/api/overrides/route.js.map +2 -2
- package/dist/modules/feature_toggles/lib/feature-flag-check.js +5 -9
- package/dist/modules/feature_toggles/lib/feature-flag-check.js.map +2 -2
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js +4 -2
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/emails/[id]/route.js +4 -2
- package/dist/modules/inbox_ops/api/emails/[id]/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/emails/route.js +3 -1
- package/dist/modules/inbox_ops/api/emails/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/extract/route.js +3 -1
- package/dist/modules/inbox_ops/api/extract/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js +3 -1
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/[id]/replies/[replyId]/send/route.js +4 -2
- package/dist/modules/inbox_ops/api/proposals/[id]/replies/[replyId]/send/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/counts/route.js +4 -2
- package/dist/modules/inbox_ops/api/proposals/counts/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/route.js +3 -1
- package/dist/modules/inbox_ops/api/proposals/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/routeHelpers.js +3 -1
- package/dist/modules/inbox_ops/api/routeHelpers.js.map +2 -2
- package/dist/modules/inbox_ops/api/settings/route.js +3 -1
- package/dist/modules/inbox_ops/api/settings/route.js.map +2 -2
- package/dist/modules/inbox_ops/api/webhook/inbound.js +7 -5
- package/dist/modules/inbox_ops/api/webhook/inbound.js.map +2 -2
- package/dist/modules/inbox_ops/lib/cache.js +4 -2
- package/dist/modules/inbox_ops/lib/cache.js.map +2 -2
- package/dist/modules/inbox_ops/lib/catalogLookup.js +3 -1
- package/dist/modules/inbox_ops/lib/catalogLookup.js.map +2 -2
- package/dist/modules/inbox_ops/lib/eventBus.js +3 -4
- package/dist/modules/inbox_ops/lib/eventBus.js.map +2 -2
- package/dist/modules/inbox_ops/lib/messagesIntegration.js +4 -8
- package/dist/modules/inbox_ops/lib/messagesIntegration.js.map +2 -2
- package/dist/modules/inbox_ops/subscribers/executionAuditor.js +3 -1
- package/dist/modules/inbox_ops/subscribers/executionAuditor.js.map +2 -2
- package/dist/modules/inbox_ops/subscribers/extractionWorker.js +10 -8
- package/dist/modules/inbox_ops/subscribers/extractionWorker.js.map +2 -2
- package/dist/modules/inbox_ops/subscribers/proposalNotifier.js +3 -1
- package/dist/modules/inbox_ops/subscribers/proposalNotifier.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +3 -4
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/commands/actions.js +3 -1
- package/dist/modules/messages/commands/actions.js.map +2 -2
- package/dist/modules/messages/components/MessagesInboxPageClient.js +3 -1
- package/dist/modules/messages/components/MessagesInboxPageClient.js.map +2 -2
- package/dist/modules/messages/lib/email-sender.js +3 -7
- package/dist/modules/messages/lib/email-sender.js.map +2 -2
- package/dist/modules/messages/lib/message-objects-registry.js +3 -1
- package/dist/modules/messages/lib/message-objects-registry.js.map +2 -2
- package/dist/modules/messages/lib/message-types-registry.js +3 -1
- package/dist/modules/messages/lib/message-types-registry.js.map +2 -2
- package/dist/modules/messages/workers/send-email.worker.js +6 -4
- package/dist/modules/messages/workers/send-email.worker.js.map +2 -2
- package/dist/modules/notifications/lib/notificationMapper.js +3 -4
- package/dist/modules/notifications/lib/notificationMapper.js.map +2 -2
- package/dist/modules/notifications/lib/notificationService.js +4 -5
- package/dist/modules/notifications/lib/notificationService.js.map +2 -2
- package/dist/modules/notifications/subscribers/deliver-notification.js +8 -13
- package/dist/modules/notifications/subscribers/deliver-notification.js.map +2 -2
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +3 -1
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/perspectives/services/perspectiveService.js +3 -3
- package/dist/modules/perspectives/services/perspectiveService.js.map +2 -2
- package/dist/modules/planner/api/access.js +3 -3
- package/dist/modules/planner/api/access.js.map +2 -2
- package/dist/modules/planner/api/availability-date-specific.js +3 -1
- package/dist/modules/planner/api/availability-date-specific.js.map +2 -2
- package/dist/modules/planner/api/availability-weekly.js +3 -1
- package/dist/modules/planner/api/availability-weekly.js.map +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +4 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/planner/components/AvailabilityRulesEditor.js +3 -1
- package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
- package/dist/modules/progress/api/jobs/route.js +3 -1
- package/dist/modules/progress/api/jobs/route.js.map +2 -2
- package/dist/modules/query_index/components/QueryIndexesTable.js +5 -3
- package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
- package/dist/modules/query_index/lib/batch.js +4 -2
- package/dist/modules/query_index/lib/batch.js.map +2 -2
- package/dist/modules/query_index/lib/coverage.js +3 -1
- package/dist/modules/query_index/lib/coverage.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +13 -18
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/reindexer.js +8 -6
- package/dist/modules/query_index/lib/reindexer.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +3 -1
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/query_index/subscribers/coverage_refresh.js +3 -1
- package/dist/modules/query_index/subscribers/coverage_refresh.js.map +2 -2
- package/dist/modules/resources/api/comments.js +3 -1
- package/dist/modules/resources/api/comments.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js +3 -1
- package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js +3 -1
- package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js +3 -1
- package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +4 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/commands/activities.js +6 -5
- package/dist/modules/resources/commands/activities.js.map +2 -2
- package/dist/modules/resources/commands/comments.js +6 -4
- package/dist/modules/resources/commands/comments.js.map +2 -2
- package/dist/modules/resources/commands/shared.js +24 -1
- package/dist/modules/resources/commands/shared.js.map +2 -2
- package/dist/modules/sales/api/channels/route.js +3 -1
- package/dist/modules/sales/api/channels/route.js.map +2 -2
- package/dist/modules/sales/api/document-history/route.js +3 -1
- package/dist/modules/sales/api/document-history/route.js.map +2 -2
- package/dist/modules/sales/api/document-numbers/route.js +3 -1
- package/dist/modules/sales/api/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/accept/route.js +4 -2
- package/dist/modules/sales/api/quotes/accept/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/convert/route.js +3 -1
- package/dist/modules/sales/api/quotes/convert/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/public/[token]/route.js +3 -1
- package/dist/modules/sales/api/quotes/public/[token]/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/send/route.js +3 -1
- package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
- package/dist/modules/sales/api/returns/[id]/route.js +3 -1
- package/dist/modules/sales/api/returns/[id]/route.js.map +2 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js +4 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/settings/order-editing/route.js +4 -2
- package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js +3 -1
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js +6 -4
- package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +4 -2
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +20 -18
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +4 -8
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +3 -1
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/commands/shipments.js +3 -1
- package/dist/modules/sales/commands/shipments.js.map +2 -2
- package/dist/modules/sales/components/AdjustmentKindSettings.js +5 -3
- package/dist/modules/sales/components/AdjustmentKindSettings.js.map +2 -2
- package/dist/modules/sales/components/DocumentNumberSettings.js +4 -2
- package/dist/modules/sales/components/DocumentNumberSettings.js.map +2 -2
- package/dist/modules/sales/components/OrderEditingSettings.js +4 -2
- package/dist/modules/sales/components/OrderEditingSettings.js.map +2 -2
- package/dist/modules/sales/components/PaymentMethodsSettings.js +5 -3
- package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/ShippingMethodsSettings.js +5 -3
- package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/StatusSettings.js +5 -3
- package/dist/modules/sales/components/StatusSettings.js.map +2 -2
- package/dist/modules/sales/components/TaxRatesSettings.js +5 -3
- package/dist/modules/sales/components/TaxRatesSettings.js.map +2 -2
- package/dist/modules/sales/components/channels/ChannelOfferForm.js +16 -14
- package/dist/modules/sales/components/channels/ChannelOfferForm.js.map +2 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +4 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
- package/dist/modules/sales/components/documents/AddressesSection.js +5 -3
- package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentDialog.js +3 -1
- package/dist/modules/sales/components/documents/AdjustmentDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js +5 -3
- package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +6 -4
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +8 -6
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentDialog.js +5 -3
- package/dist/modules/sales/components/documents/PaymentDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +4 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentForm.js +14 -12
- package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +5 -3
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +9 -7
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentsSection.js +4 -2
- package/dist/modules/sales/components/documents/ShipmentsSection.js.map +2 -2
- package/dist/modules/sales/frontend/quote/[token]/page.js +4 -2
- package/dist/modules/sales/frontend/quote/[token]/page.js.map +2 -2
- package/dist/modules/sales/seed/examples.js +7 -9
- package/dist/modules/sales/seed/examples.js.map +2 -2
- package/dist/modules/sales/subscribers/quote-expiring-notification.js +3 -1
- package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +2 -2
- package/dist/modules/sales/subscribers/reconcileOnAddressDelete.js +3 -1
- package/dist/modules/sales/subscribers/reconcileOnAddressDelete.js.map +2 -2
- package/dist/modules/sales/subscribers/reconcileOnCompanyDelete.js +3 -1
- package/dist/modules/sales/subscribers/reconcileOnCompanyDelete.js.map +2 -2
- package/dist/modules/sales/subscribers/reconcileOnCustomerDelete.js +3 -1
- package/dist/modules/sales/subscribers/reconcileOnCustomerDelete.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.js +5 -3
- package/dist/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js +3 -1
- package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js +3 -1
- package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js.map +2 -2
- package/dist/modules/shipping_carriers/api/tracking/route.js +5 -0
- package/dist/modules/shipping_carriers/api/tracking/route.js.map +2 -2
- package/dist/modules/shipping_carriers/api/webhook/[provider]/route.js +3 -1
- package/dist/modules/shipping_carriers/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipping-service.js +41 -19
- package/dist/modules/shipping_carriers/lib/shipping-service.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/upstream-error-response.js +3 -1
- package/dist/modules/shipping_carriers/lib/upstream-error-response.js.map +2 -2
- package/dist/modules/shipping_carriers/workers/webhook-processor.js +3 -5
- package/dist/modules/shipping_carriers/workers/webhook-processor.js.map +2 -2
- package/dist/modules/staff/api/comments.js +3 -1
- package/dist/modules/staff/api/comments.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +3 -1
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +3 -1
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/assignable/route.js +3 -1
- package/dist/modules/staff/api/team-members/assignable/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/self/route.js +4 -2
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +3 -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 +3 -1
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +3 -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 +3 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +3 -1
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +3 -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 +4 -2
- 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 +4 -2
- 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 +3 -1
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +3 -1
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/page.js +4 -2
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +4 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +4 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +4 -2
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.js +7 -5
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +3 -1
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +3 -1
- package/dist/modules/staff/commands/timesheets-entries.js.map +2 -2
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js +3 -1
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js.map +2 -2
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js +5 -3
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js.map +2 -2
- package/dist/modules/sync_excel/api/import/route.js +3 -1
- package/dist/modules/sync_excel/api/import/route.js.map +2 -2
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js +5 -3
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js.map +2 -2
- package/dist/modules/translations/api/get/locales.js +3 -1
- package/dist/modules/translations/api/get/locales.js.map +2 -2
- package/dist/modules/translations/api/put/locales.js +3 -1
- package/dist/modules/translations/api/put/locales.js.map +2 -2
- package/dist/modules/translations/components/TranslationManager.js +3 -1
- package/dist/modules/translations/components/TranslationManager.js.map +2 -2
- package/dist/modules/translations/subscribers/cleanup.js +3 -1
- package/dist/modules/translations/subscribers/cleanup.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js +4 -2
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js +4 -2
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/route.js +6 -4
- package/dist/modules/workflows/api/definitions/[id]/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/events/[id]/route.js +3 -1
- package/dist/modules/workflows/api/events/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/events/route.js +3 -1
- package/dist/modules/workflows/api/events/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/advance/route.js +3 -1
- package/dist/modules/workflows/api/instances/[id]/advance/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/cancel/route.js +3 -1
- package/dist/modules/workflows/api/instances/[id]/cancel/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/events/route.js +3 -1
- package/dist/modules/workflows/api/instances/[id]/events/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/retry/route.js +3 -1
- package/dist/modules/workflows/api/instances/[id]/retry/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/route.js +3 -1
- package/dist/modules/workflows/api/instances/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/signal/route.js +5 -7
- package/dist/modules/workflows/api/instances/[id]/signal/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/route.js +5 -3
- package/dist/modules/workflows/api/instances/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/validate-start/route.js +3 -1
- package/dist/modules/workflows/api/instances/validate-start/route.js.map +2 -2
- package/dist/modules/workflows/api/signals/route.js +3 -1
- package/dist/modules/workflows/api/signals/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js +3 -1
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js +3 -1
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/route.js +3 -1
- package/dist/modules/workflows/api/tasks/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/route.js +3 -1
- package/dist/modules/workflows/api/tasks/route.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +4 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/[id]/page.js +5 -3
- package/dist/modules/workflows/backend/instances/[id]/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/[id]/page.js +3 -1
- package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
- package/dist/modules/workflows/components/BusinessRulesSelector.js +5 -3
- package/dist/modules/workflows/components/BusinessRulesSelector.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowSelector.js +5 -3
- package/dist/modules/workflows/components/WorkflowSelector.js.map +2 -2
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +3 -1
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +3 -1
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/WorkflowSelectorField.js +3 -1
- package/dist/modules/workflows/components/fields/WorkflowSelectorField.js.map +2 -2
- package/dist/modules/workflows/frontend/checkout-demo/page.js +8 -7
- package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +25 -21
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/activity-worker-handler.js +8 -15
- package/dist/modules/workflows/lib/activity-worker-handler.js.map +2 -2
- package/dist/modules/workflows/lib/code-registry.js +7 -7
- package/dist/modules/workflows/lib/code-registry.js.map +2 -2
- package/dist/modules/workflows/lib/compensation-handler.js +4 -2
- package/dist/modules/workflows/lib/compensation-handler.js.map +2 -2
- package/dist/modules/workflows/lib/edgeFormTransforms.js +3 -1
- package/dist/modules/workflows/lib/edgeFormTransforms.js.map +2 -2
- package/dist/modules/workflows/lib/event-trigger-service.js +5 -3
- package/dist/modules/workflows/lib/event-trigger-service.js.map +2 -2
- package/dist/modules/workflows/lib/nodeFormTransforms.js +3 -1
- package/dist/modules/workflows/lib/nodeFormTransforms.js.map +2 -2
- package/dist/modules/workflows/lib/seeds.js +16 -2
- package/dist/modules/workflows/lib/seeds.js.map +2 -2
- package/dist/modules/workflows/lib/signal-handler.js +3 -1
- package/dist/modules/workflows/lib/signal-handler.js.map +2 -2
- package/dist/modules/workflows/lib/start-validator.js +9 -3
- package/dist/modules/workflows/lib/start-validator.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +3 -1
- package/dist/modules/workflows/lib/step-handler.js.map +2 -2
- package/dist/modules/workflows/lib/task-handler.js +3 -1
- package/dist/modules/workflows/lib/task-handler.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +5 -3
- package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-executor.js +27 -15
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/dist/modules/workflows/subscribers/event-trigger.js +21 -18
- package/dist/modules/workflows/subscribers/event-trigger.js.map +2 -2
- package/dist/modules/workflows/subscribers/task-assigned-notification.js +3 -1
- package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +2 -2
- package/dist/modules/workflows/workers/workflow-activities.worker.js +30 -20
- package/dist/modules/workflows/workers/workflow-activities.worker.js.map +2 -2
- package/package.json +7 -7
- package/src/bootstrap.ts +14 -11
- package/src/helpers/integration/queue-runner.ts +2 -2
- package/src/modules/api_keys/services/apiKeyService.ts +6 -3
- package/src/modules/attachments/api/image/[id]/[[...slug]]/route.ts +5 -2
- package/src/modules/attachments/api/library/[id]/route.ts +4 -1
- package/src/modules/attachments/api/route.ts +9 -6
- package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +6 -3
- package/src/modules/attachments/lib/assignmentDetails.ts +4 -1
- package/src/modules/attachments/lib/drivers/driverFactory.ts +4 -1
- package/src/modules/attachments/lib/ocrQueue.ts +11 -11
- package/src/modules/attachments/lib/ocrService.ts +7 -4
- package/src/modules/audit_logs/api/audit-logs/actions/redo/route.ts +4 -1
- package/src/modules/audit_logs/api/audit-logs/actions/undo/route.ts +4 -1
- package/src/modules/audit_logs/backend/audit-logs/page.tsx +4 -1
- package/src/modules/audit_logs/components/AuditLogsActions.tsx +5 -2
- package/src/modules/audit_logs/services/accessLogService.ts +5 -4
- package/src/modules/audit_logs/services/actionLogService.ts +5 -2
- package/src/modules/auth/api/profile/route.ts +5 -2
- package/src/modules/auth/api/reset/confirm.ts +4 -1
- package/src/modules/auth/api/reset.ts +5 -2
- package/src/modules/auth/api/roles/route.ts +4 -1
- package/src/modules/auth/api/sidebar/variants/route.ts +4 -2
- package/src/modules/auth/api/users/resend-invite/route.ts +5 -2
- package/src/modules/auth/api/users/route.ts +4 -1
- package/src/modules/auth/backend/auth/profile/page.tsx +4 -1
- package/src/modules/auth/backend/profile/change-password/page.tsx +4 -1
- package/src/modules/auth/backend/users/[id]/edit/page.tsx +6 -3
- package/src/modules/auth/backend/users/create/page.tsx +5 -2
- package/src/modules/auth/cli.ts +10 -0
- package/src/modules/auth/commands/users.ts +5 -2
- package/src/modules/auth/lib/consentIntegrity.ts +4 -4
- package/src/modules/auth/lib/setup-app.ts +10 -10
- package/src/modules/auth/lib/tenantAccess.ts +4 -1
- package/src/modules/auth/lib/tokenHash.ts +4 -4
- package/src/modules/business_rules/api/rules/route.ts +5 -2
- package/src/modules/business_rules/lib/expression-evaluator.ts +8 -6
- package/src/modules/business_rules/lib/rule-engine.ts +6 -3
- package/src/modules/business_rules/lib/rule-evaluator.ts +11 -11
- package/src/modules/business_rules/subscribers/crud-rule-trigger.ts +4 -1
- package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +4 -1
- package/src/modules/catalog/ai-agents-context.ts +5 -5
- package/src/modules/catalog/ai-tools/_shared.ts +4 -1
- package/src/modules/catalog/ai-tools/authoring-pack.ts +4 -1
- package/src/modules/catalog/ai-tools/merchandising-pack.ts +4 -1
- package/src/modules/catalog/api/dictionaries/[key]/route.ts +4 -1
- package/src/modules/catalog/api/prices/route.ts +4 -1
- package/src/modules/catalog/api/products/route.ts +6 -3
- package/src/modules/catalog/api/settings/route.ts +5 -2
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +15 -12
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +9 -6
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/create/page.tsx +6 -3
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +6 -6
- package/src/modules/catalog/backend/catalog/products/optionSchemaClient.ts +4 -1
- package/src/modules/catalog/components/PriceKindSettings.tsx +6 -3
- package/src/modules/catalog/components/UnitPriceDisplaySettings.tsx +5 -2
- package/src/modules/catalog/inbox-actions.ts +5 -2
- package/src/modules/catalog/seed/examples.ts +5 -5
- package/src/modules/catalog/subscribers/low-stock-notification.ts +4 -1
- package/src/modules/catalog/widgets/injection/product-seo/state.ts +4 -1
- package/src/modules/communication_channels/api/get/oauth/[provider]/callback/route.ts +13 -13
- package/src/modules/communication_channels/api/post/channels/[id]/import-history/route.ts +4 -1
- package/src/modules/communication_channels/api/post/channels/[id]/push/register/route.ts +4 -1
- package/src/modules/communication_channels/api/post/webhook/[provider]/route.ts +6 -3
- package/src/modules/communication_channels/api/post/webhooks/gmail/route.ts +7 -6
- package/src/modules/communication_channels/commands/connect-credential-channel.ts +5 -10
- package/src/modules/communication_channels/commands/delete-channel.ts +4 -5
- package/src/modules/communication_channels/commands/deliver-outbound-message.ts +5 -5
- package/src/modules/communication_channels/commands/disconnect-channel.ts +4 -5
- package/src/modules/communication_channels/commands/ingest-inbound-message.ts +6 -12
- package/src/modules/communication_channels/commands/push-unregister.ts +4 -3
- package/src/modules/communication_channels/commands/reassign-conversation.ts +6 -3
- package/src/modules/communication_channels/lib/dead-letter.ts +4 -5
- package/src/modules/communication_channels/lib/email-mime.ts +5 -6
- package/src/modules/communication_channels/lib/oauth-client-config.ts +7 -3
- package/src/modules/communication_channels/lib/send-as-user.ts +4 -1
- package/src/modules/communication_channels/lib/thread-token.ts +5 -2
- package/src/modules/communication_channels/setup.ts +4 -4
- package/src/modules/communication_channels/workers/channel-import-history.ts +5 -8
- package/src/modules/communication_channels/workers/gmail-history-sync.ts +9 -18
- package/src/modules/communication_channels/workers/gmail-renew-watch.ts +6 -9
- package/src/modules/communication_channels/workers/outbound-delivery.ts +7 -12
- package/src/modules/communication_channels/workers/poll-channel.ts +8 -15
- package/src/modules/communication_channels/workers/poll-tick.ts +6 -6
- package/src/modules/communication_channels/workers/reaction-processor.ts +6 -9
- package/src/modules/configs/api/cache/route.ts +5 -2
- package/src/modules/configs/api/system-status/route.ts +5 -2
- package/src/modules/configs/api/upgrade-actions/route.ts +5 -2
- package/src/modules/configs/components/ModuleTelemetryPanel.tsx +4 -1
- package/src/modules/configs/lib/touchGeneratedBarrels.ts +1 -1
- package/src/modules/configs/services/upgradeActionsService.ts +7 -3
- package/src/modules/currencies/components/CurrencyFetchingConfig.tsx +4 -1
- package/src/modules/currencies/lib/exchangeRateFormConfig.ts +4 -1
- package/src/modules/currencies/services/providers/nbp.ts +7 -4
- package/src/modules/currencies/services/providers/raiffeisen.ts +8 -7
- package/src/modules/customer_accounts/api/domain-resolve/all.ts +7 -5
- package/src/modules/customer_accounts/api/signup.ts +5 -2
- package/src/modules/customer_accounts/lib/customerAuthServer.ts +4 -1
- package/src/modules/customer_accounts/subscribers/autoLinkCrm.ts +4 -1
- package/src/modules/customer_accounts/subscribers/autoLinkCrmReverse.ts +4 -1
- package/src/modules/customer_accounts/subscribers/unlinkOnCompanyDelete.ts +4 -1
- package/src/modules/customer_accounts/subscribers/unlinkOnPersonDelete.ts +4 -1
- package/src/modules/customers/ai-agents-context.ts +5 -5
- package/src/modules/customers/api/activities/route.ts +7 -4
- package/src/modules/customers/api/comments/route.ts +4 -1
- package/src/modules/customers/api/companies/[id]/people/route.ts +4 -1
- package/src/modules/customers/api/companies/[id]/route.ts +6 -3
- package/src/modules/customers/api/companies/route.ts +6 -3
- package/src/modules/customers/api/dashboard/widgets/customer-todos/route.ts +4 -1
- package/src/modules/customers/api/dashboard/widgets/new-customers/route.ts +4 -1
- package/src/modules/customers/api/dashboard/widgets/new-deals/route.ts +4 -1
- package/src/modules/customers/api/dashboard/widgets/next-interactions/route.ts +4 -1
- package/src/modules/customers/api/deals/[id]/companies/route.ts +4 -1
- package/src/modules/customers/api/deals/[id]/people/route.ts +4 -1
- package/src/modules/customers/api/deals/aggregate/route.ts +4 -1
- package/src/modules/customers/api/deals/bulk-update-owner/route.ts +8 -5
- package/src/modules/customers/api/deals/bulk-update-stage/route.ts +8 -5
- package/src/modules/customers/api/deals/route.ts +4 -1
- package/src/modules/customers/api/deals/summary/route.ts +4 -1
- package/src/modules/customers/api/dictionaries/[kind]/[id]/route.ts +5 -2
- package/src/modules/customers/api/dictionaries/[kind]/route.ts +6 -3
- package/src/modules/customers/api/dictionaries/cache.ts +4 -1
- package/src/modules/customers/api/dictionaries/context.ts +4 -1
- package/src/modules/customers/api/dictionaries/currency/route.ts +4 -1
- package/src/modules/customers/api/dictionaries/kind-settings/route.ts +5 -2
- package/src/modules/customers/api/entity-roles-factory.ts +8 -5
- package/src/modules/customers/api/interactions/cancel/route.ts +4 -1
- package/src/modules/customers/api/interactions/complete/route.ts +4 -1
- package/src/modules/customers/api/interactions/conflicts/route.ts +4 -1
- package/src/modules/customers/api/interactions/counts/route.ts +4 -1
- package/src/modules/customers/api/interactions/route.ts +8 -4
- package/src/modules/customers/api/interactions/tasks/route.ts +4 -1
- package/src/modules/customers/api/labels/assign/route.ts +4 -1
- package/src/modules/customers/api/labels/route.ts +7 -3
- package/src/modules/customers/api/labels/unassign/route.ts +4 -1
- package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +4 -1
- package/src/modules/customers/api/people/[id]/route.ts +6 -3
- package/src/modules/customers/api/people/route.ts +6 -3
- package/src/modules/customers/api/pipeline-stages/reorder/route.ts +4 -1
- package/src/modules/customers/api/pipeline-stages/route.ts +7 -4
- package/src/modules/customers/api/pipelines/route.ts +7 -4
- package/src/modules/customers/api/settings/address-format/route.ts +5 -2
- package/src/modules/customers/api/settings/dictionary-sort-modes/route.ts +5 -2
- package/src/modules/customers/api/settings/stuck-threshold/route.ts +5 -2
- package/src/modules/customers/api/tags/assign/route.ts +4 -1
- package/src/modules/customers/api/tags/unassign/route.ts +4 -1
- package/src/modules/customers/api/todos/route.ts +7 -4
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +6 -3
- package/src/modules/customers/backend/customers/deals/[id]/hooks/useDealActivities.ts +4 -1
- package/src/modules/customers/backend/customers/deals/[id]/hooks/useDealClosure.ts +4 -1
- package/src/modules/customers/backend/customers/deals/map/components/DealsMapCanvasImpl.tsx +5 -3
- package/src/modules/customers/backend/customers/deals/page.tsx +5 -2
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +6 -3
- package/src/modules/customers/commands/deals.ts +4 -1
- package/src/modules/customers/commands/dictionaries.ts +4 -1
- package/src/modules/customers/commands/interactions.ts +5 -2
- package/src/modules/customers/commands/shared.ts +5 -2
- package/src/modules/customers/commands/todos.ts +4 -1
- package/src/modules/customers/components/DictionarySettings.tsx +6 -3
- package/src/modules/customers/components/DictionarySortSettings.tsx +4 -1
- package/src/modules/customers/components/detail/ActivitiesCard.tsx +4 -1
- package/src/modules/customers/components/detail/ActivitiesDayStrip.tsx +4 -1
- package/src/modules/customers/components/detail/ActivitiesSection.tsx +7 -4
- package/src/modules/customers/components/detail/ActivityCard.tsx +4 -1
- package/src/modules/customers/components/detail/ChangelogTab.tsx +4 -1
- package/src/modules/customers/components/detail/CompanyCard.tsx +4 -1
- package/src/modules/customers/components/detail/ConfirmDealLostDialog.tsx +4 -1
- package/src/modules/customers/components/detail/EntityTagsDialog.tsx +4 -1
- package/src/modules/customers/components/detail/InlineActivityComposer.tsx +4 -1
- package/src/modules/customers/components/detail/ManageTagsDialog.tsx +4 -1
- package/src/modules/customers/components/detail/RoleAssignmentRow.tsx +6 -3
- package/src/modules/customers/components/detail/RolesSection.tsx +5 -2
- package/src/modules/customers/components/detail/hooks/useInteractionMutations.ts +6 -3
- package/src/modules/customers/components/linking/LinkEntityDialog.tsx +5 -2
- package/src/modules/customers/inbox-actions.ts +4 -1
- package/src/modules/customers/lib/bulkDeals.ts +4 -1
- package/src/modules/customers/lib/dealClosureNotification.ts +5 -2
- package/src/modules/customers/lib/dealStageTransitionTable.ts +4 -1
- package/src/modules/customers/lib/interactionFeatureFlags.ts +5 -1
- package/src/modules/customers/lib/todoCompatibility.ts +4 -1
- package/src/modules/customers/search.ts +15 -7
- package/src/modules/customers/widgets/dashboard/customer-todos/widget.client.tsx +4 -1
- package/src/modules/customers/widgets/dashboard/new-customers/widget.client.tsx +4 -1
- package/src/modules/customers/widgets/dashboard/new-deals/widget.client.tsx +4 -1
- package/src/modules/customers/widgets/dashboard/next-interactions/widget.client.tsx +4 -1
- package/src/modules/dashboards/api/widgets/data/batch/route.ts +4 -1
- package/src/modules/dashboards/api/widgets/data/route.ts +4 -1
- package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +6 -3
- package/src/modules/dashboards/widgets/dashboard/aov-kpi/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/new-customers-kpi/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/orders-kpi/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/pipeline-summary/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/revenue-kpi/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/top-customers/widget.client.tsx +4 -1
- package/src/modules/dashboards/widgets/dashboard/top-products/widget.client.tsx +4 -1
- package/src/modules/data_sync/api/run.ts +4 -1
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +3 -1
- package/src/modules/data_sync/lib/adapter-registry.ts +16 -4
- package/src/modules/data_sync/lib/sync-engine.ts +31 -2
- package/src/modules/data_sync/workers/sync-export.ts +4 -1
- package/src/modules/data_sync/workers/sync-import.ts +4 -1
- package/src/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.ts +5 -2
- package/src/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.ts +4 -1
- package/src/modules/dictionaries/api/[dictionaryId]/entries/route.ts +5 -2
- package/src/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.ts +4 -1
- package/src/modules/dictionaries/api/[dictionaryId]/route.ts +6 -3
- package/src/modules/dictionaries/api/context.ts +4 -1
- package/src/modules/dictionaries/api/route.ts +5 -2
- package/src/modules/dictionaries/components/DictionariesManager.tsx +6 -3
- package/src/modules/dictionaries/components/DictionaryEntriesEditor.tsx +5 -2
- package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +5 -2
- package/src/modules/dictionaries/components/DictionarySelectControl.tsx +4 -1
- package/src/modules/dictionaries/fields/dictionary.tsx +4 -1
- package/src/modules/directory/api/organization-branding/route.ts +4 -1
- package/src/modules/directory/api/organization-switcher/route.ts +4 -1
- package/src/modules/directory/commands/tenants.ts +6 -3
- package/src/modules/directory/utils/organizationScope.ts +7 -4
- package/src/modules/entities/api/definitions.cache.ts +4 -1
- package/src/modules/entities/api/definitions.ts +8 -5
- package/src/modules/entities/api/records.ts +5 -2
- package/src/modules/entities/components/EncryptionManager.tsx +4 -1
- package/src/modules/entities/lib/makeActivityRoute.ts +4 -1
- package/src/modules/feature_toggles/api/overrides/route.ts +4 -1
- package/src/modules/feature_toggles/lib/feature-flag-check.ts +6 -9
- package/src/modules/inbox_ops/api/emails/[id]/reprocess/route.ts +5 -2
- package/src/modules/inbox_ops/api/emails/[id]/route.ts +5 -2
- package/src/modules/inbox_ops/api/emails/route.ts +4 -1
- package/src/modules/inbox_ops/api/extract/route.ts +4 -1
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.ts +4 -1
- package/src/modules/inbox_ops/api/proposals/[id]/replies/[replyId]/send/route.ts +5 -2
- package/src/modules/inbox_ops/api/proposals/counts/route.ts +5 -2
- package/src/modules/inbox_ops/api/proposals/route.ts +4 -1
- package/src/modules/inbox_ops/api/routeHelpers.ts +4 -1
- package/src/modules/inbox_ops/api/settings/route.ts +4 -1
- package/src/modules/inbox_ops/api/webhook/inbound.ts +8 -5
- package/src/modules/inbox_ops/lib/cache.ts +5 -2
- package/src/modules/inbox_ops/lib/catalogLookup.ts +4 -1
- package/src/modules/inbox_ops/lib/eventBus.ts +4 -4
- package/src/modules/inbox_ops/lib/messagesIntegration.ts +5 -8
- package/src/modules/inbox_ops/subscribers/executionAuditor.ts +5 -1
- package/src/modules/inbox_ops/subscribers/extractionWorker.ts +11 -8
- package/src/modules/inbox_ops/subscribers/proposalNotifier.ts +4 -1
- package/src/modules/messages/api/[id]/route.ts +4 -4
- package/src/modules/messages/commands/actions.ts +4 -1
- package/src/modules/messages/components/MessagesInboxPageClient.tsx +4 -1
- package/src/modules/messages/lib/email-sender.ts +4 -7
- package/src/modules/messages/lib/message-objects-registry.ts +4 -1
- package/src/modules/messages/lib/message-types-registry.ts +4 -1
- package/src/modules/messages/workers/send-email.worker.ts +7 -4
- package/src/modules/notifications/lib/notificationMapper.ts +4 -4
- package/src/modules/notifications/lib/notificationService.ts +4 -5
- package/src/modules/notifications/subscribers/deliver-notification.ts +9 -14
- package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +4 -1
- package/src/modules/perspectives/services/perspectiveService.ts +4 -3
- package/src/modules/planner/api/access.ts +4 -3
- package/src/modules/planner/api/availability-date-specific.ts +4 -1
- package/src/modules/planner/api/availability-weekly.ts +4 -1
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +5 -2
- package/src/modules/planner/components/AvailabilityRulesEditor.tsx +4 -1
- package/src/modules/progress/api/jobs/route.ts +4 -1
- package/src/modules/query_index/components/QueryIndexesTable.tsx +6 -3
- package/src/modules/query_index/lib/batch.ts +5 -2
- package/src/modules/query_index/lib/coverage.ts +4 -1
- package/src/modules/query_index/lib/engine.ts +14 -17
- package/src/modules/query_index/lib/reindexer.ts +9 -6
- package/src/modules/query_index/lib/search-tokens.ts +4 -2
- package/src/modules/query_index/subscribers/coverage_refresh.ts +4 -1
- package/src/modules/resources/api/comments.ts +4 -1
- package/src/modules/resources/api/resources/tags/assign/route.ts +4 -1
- package/src/modules/resources/api/resources/tags/unassign/route.ts +4 -1
- package/src/modules/resources/backend/resources/resource-types/[id]/edit/page.tsx +4 -1
- package/src/modules/resources/backend/resources/resource-types/page.tsx +5 -2
- package/src/modules/resources/commands/activities.ts +5 -4
- package/src/modules/resources/commands/comments.ts +6 -4
- package/src/modules/resources/commands/shared.ts +36 -0
- package/src/modules/sales/api/channels/route.ts +4 -1
- package/src/modules/sales/api/document-history/route.ts +4 -1
- package/src/modules/sales/api/document-numbers/route.ts +4 -1
- package/src/modules/sales/api/quotes/accept/route.ts +5 -2
- package/src/modules/sales/api/quotes/convert/route.ts +4 -1
- package/src/modules/sales/api/quotes/public/[token]/route.ts +4 -1
- package/src/modules/sales/api/quotes/send/route.ts +4 -1
- package/src/modules/sales/api/returns/[id]/route.ts +4 -1
- package/src/modules/sales/api/settings/document-numbers/route.ts +5 -2
- package/src/modules/sales/api/settings/order-editing/route.ts +5 -2
- package/src/modules/sales/backend/sales/channels/[channelId]/edit/page.tsx +4 -1
- package/src/modules/sales/backend/sales/channels/offers/page.tsx +7 -4
- package/src/modules/sales/backend/sales/channels/page.tsx +5 -2
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +21 -18
- package/src/modules/sales/commands/documents.ts +5 -8
- package/src/modules/sales/commands/payments.ts +4 -1
- package/src/modules/sales/commands/shipments.ts +4 -2
- package/src/modules/sales/components/AdjustmentKindSettings.tsx +6 -3
- package/src/modules/sales/components/DocumentNumberSettings.tsx +5 -2
- package/src/modules/sales/components/OrderEditingSettings.tsx +5 -2
- package/src/modules/sales/components/PaymentMethodsSettings.tsx +6 -3
- package/src/modules/sales/components/ShippingMethodsSettings.tsx +6 -3
- package/src/modules/sales/components/StatusSettings.tsx +6 -3
- package/src/modules/sales/components/TaxRatesSettings.tsx +6 -3
- package/src/modules/sales/components/channels/ChannelOfferForm.tsx +17 -14
- package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +5 -2
- package/src/modules/sales/components/documents/AddressesSection.tsx +6 -3
- package/src/modules/sales/components/documents/AdjustmentDialog.tsx +4 -1
- package/src/modules/sales/components/documents/AdjustmentsSection.tsx +6 -3
- package/src/modules/sales/components/documents/ItemsSection.tsx +7 -4
- package/src/modules/sales/components/documents/LineItemDialog.tsx +9 -6
- package/src/modules/sales/components/documents/PaymentDialog.tsx +6 -3
- package/src/modules/sales/components/documents/PaymentsSection.tsx +5 -2
- package/src/modules/sales/components/documents/SalesDocumentForm.tsx +15 -12
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +6 -3
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +10 -7
- package/src/modules/sales/components/documents/ShipmentsSection.tsx +5 -2
- package/src/modules/sales/frontend/quote/[token]/page.tsx +5 -2
- package/src/modules/sales/seed/examples.ts +8 -9
- package/src/modules/sales/subscribers/quote-expiring-notification.ts +4 -1
- package/src/modules/sales/subscribers/reconcileOnAddressDelete.ts +4 -1
- package/src/modules/sales/subscribers/reconcileOnCompanyDelete.ts +4 -1
- package/src/modules/sales/subscribers/reconcileOnCustomerDelete.ts +4 -1
- package/src/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.ts +6 -3
- package/src/modules/sales/widgets/dashboard/new-orders/widget.client.tsx +274 -271
- package/src/modules/sales/widgets/dashboard/new-quotes/widget.client.tsx +280 -277
- package/src/modules/shipping_carriers/api/tracking/route.ts +5 -1
- package/src/modules/shipping_carriers/api/webhook/[provider]/route.ts +4 -1
- package/src/modules/shipping_carriers/lib/shipping-service.ts +47 -22
- package/src/modules/shipping_carriers/lib/upstream-error-response.ts +4 -1
- package/src/modules/shipping_carriers/workers/webhook-processor.ts +4 -5
- package/src/modules/staff/api/comments.ts +4 -1
- package/src/modules/staff/api/leave-requests/accept/route.ts +4 -1
- package/src/modules/staff/api/leave-requests/reject/route.ts +4 -1
- package/src/modules/staff/api/team-members/assignable/route.ts +4 -1
- package/src/modules/staff/api/team-members/self/route.ts +5 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +4 -1
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +4 -1
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +4 -1
- package/src/modules/staff/api/timesheets/my-projects/route.ts +4 -1
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +4 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +4 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +5 -2
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +5 -2
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +4 -1
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +4 -1
- package/src/modules/staff/backend/staff/team-members/page.tsx +5 -2
- package/src/modules/staff/backend/staff/team-roles/page.tsx +5 -2
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +5 -2
- package/src/modules/staff/backend/staff/teams/page.tsx +5 -2
- package/src/modules/staff/backend/staff/timesheets/page.tsx +8 -5
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -1
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +5 -2
- package/src/modules/staff/commands/timesheets-entries.ts +4 -1
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.tsx +4 -1
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.tsx +6 -3
- package/src/modules/sync_excel/api/import/route.ts +4 -1
- package/src/modules/translations/api/[entityType]/[entityId]/route.ts +6 -3
- package/src/modules/translations/api/get/locales.ts +4 -1
- package/src/modules/translations/api/put/locales.ts +4 -1
- package/src/modules/translations/components/TranslationManager.tsx +4 -1
- package/src/modules/translations/subscribers/cleanup.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/customize/route.ts +5 -2
- package/src/modules/workflows/api/definitions/[id]/reset-to-code/route.ts +5 -2
- package/src/modules/workflows/api/definitions/[id]/route.ts +7 -4
- package/src/modules/workflows/api/definitions/route.ts +5 -2
- package/src/modules/workflows/api/events/[id]/route.ts +4 -1
- package/src/modules/workflows/api/events/route.ts +4 -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]/events/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/retry/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/signal/route.ts +6 -7
- package/src/modules/workflows/api/instances/route.ts +6 -3
- package/src/modules/workflows/api/instances/validate-start/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]/route.ts +4 -1
- package/src/modules/workflows/api/tasks/route.ts +4 -1
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +5 -2
- package/src/modules/workflows/backend/instances/[id]/page.tsx +6 -3
- package/src/modules/workflows/backend/tasks/[id]/page.tsx +4 -1
- package/src/modules/workflows/components/BusinessRulesSelector.tsx +6 -3
- package/src/modules/workflows/components/WorkflowSelector.tsx +6 -3
- package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +4 -1
- package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +4 -1
- package/src/modules/workflows/components/fields/WorkflowSelectorField.tsx +4 -1
- package/src/modules/workflows/frontend/checkout-demo/page.tsx +9 -7
- package/src/modules/workflows/lib/activity-executor.ts +26 -21
- package/src/modules/workflows/lib/activity-worker-handler.ts +9 -15
- package/src/modules/workflows/lib/code-registry.ts +8 -7
- package/src/modules/workflows/lib/compensation-handler.ts +5 -2
- package/src/modules/workflows/lib/edgeFormTransforms.ts +4 -1
- package/src/modules/workflows/lib/event-trigger-service.ts +6 -3
- package/src/modules/workflows/lib/nodeFormTransforms.ts +4 -1
- package/src/modules/workflows/lib/seeds.ts +17 -2
- package/src/modules/workflows/lib/signal-handler.ts +4 -1
- package/src/modules/workflows/lib/start-validator.ts +10 -3
- package/src/modules/workflows/lib/step-handler.ts +4 -1
- package/src/modules/workflows/lib/task-handler.ts +4 -1
- package/src/modules/workflows/lib/transition-handler.ts +6 -3
- package/src/modules/workflows/lib/workflow-executor.ts +28 -15
- package/src/modules/workflows/subscribers/event-trigger.ts +22 -24
- package/src/modules/workflows/subscribers/task-assigned-notification.ts +4 -1
- package/src/modules/workflows/workers/workflow-activities.worker.ts +31 -20
|
@@ -7,6 +7,8 @@ import { Button } from "@open-mercato/ui/primitives/button";
|
|
|
7
7
|
import { Input } from "@open-mercato/ui/primitives/input";
|
|
8
8
|
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
9
9
|
import { Plus, Loader2, AlertCircle, Workflow } from "lucide-react";
|
|
10
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
11
|
+
const logger = createLogger("workflows");
|
|
10
12
|
function WorkflowSelector({
|
|
11
13
|
isOpen,
|
|
12
14
|
onClose,
|
|
@@ -50,15 +52,15 @@ function WorkflowSelector({
|
|
|
50
52
|
}
|
|
51
53
|
} catch {
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
logger.error("Failed to fetch workflows", {
|
|
54
56
|
url,
|
|
55
57
|
status: response.status,
|
|
56
|
-
|
|
58
|
+
message: errorMessage
|
|
57
59
|
});
|
|
58
60
|
setError(errorMessage);
|
|
59
61
|
}
|
|
60
62
|
} catch (err) {
|
|
61
|
-
|
|
63
|
+
logger.error("Failed to fetch workflows", { err });
|
|
62
64
|
const errorMessage = err instanceof Error ? err.message : "Network error loading workflows";
|
|
63
65
|
setError(errorMessage);
|
|
64
66
|
} finally {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/workflows/components/WorkflowSelector.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@open-mercato/ui/primitives/dialog'\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 { Plus, Loader2, AlertCircle, Workflow } from 'lucide-react'\n\nexport interface WorkflowDefinition {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n enabled: boolean\n createdAt: string\n updatedAt: string\n}\n\nexport interface WorkflowSelectorProps {\n /** Whether the dialog is open */\n isOpen: boolean\n\n /** Callback when dialog is closed */\n onClose: () => void\n\n /** Callback when a workflow is selected */\n onSelect: (workflowId: string, workflow: WorkflowDefinition) => void\n\n /** Array of workflow IDs to exclude from the list (already selected) */\n excludeWorkflowIds?: string[]\n\n /** Dialog title */\n title?: string\n\n /** Dialog description */\n description?: string\n\n /** Whether to show only enabled workflows */\n onlyEnabled?: boolean\n\n /** Custom empty state message */\n emptyMessage?: string\n\n /** Custom search placeholder */\n searchPlaceholder?: string\n}\n\n/**\n * WorkflowSelector - Reusable dialog for searching and selecting workflow definitions\n *\n * Features:\n * - Search/filter workflows by name, ID, description\n * - Display workflow details (version, enabled status, description)\n * - Exclude already-selected workflows\n * - Loading and error states\n * - Responsive grid layout\n */\nexport function WorkflowSelector({\n isOpen,\n onClose,\n onSelect,\n excludeWorkflowIds = [],\n title = 'Select Workflow',\n description = 'Choose a workflow to invoke as a sub-workflow',\n onlyEnabled = true,\n emptyMessage,\n searchPlaceholder = 'Search by workflow ID, name, or description...',\n}: WorkflowSelectorProps) {\n const [workflows, setWorkflows] = useState<WorkflowDefinition[]>([])\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [searchQuery, setSearchQuery] = useState('')\n\n // Fetch workflows on mount\n useEffect(() => {\n if (isOpen) {\n fetchWorkflows()\n }\n }, [isOpen])\n\n const fetchWorkflows = async () => {\n setLoading(true)\n setError(null)\n try {\n // Build query params\n const params = new URLSearchParams()\n params.set('limit', '50') // Reasonable limit for selector\n\n if (onlyEnabled) {\n params.set('enabled', 'true')\n }\n\n const url = `/api/workflows/definitions?${params.toString()}`\n const response = await apiFetch(url)\n\n if (response.ok) {\n const result = await response.json()\n setWorkflows(result.data || [])\n } else {\n let errorMessage = `Failed to load workflows (${response.status})`\n try {\n const errorData = await response.json()\n if (errorData.error) {\n errorMessage = errorData.error\n }\n } catch {\n // Use default error message\n }\n console.error('Failed to fetch workflows:', {\n url,\n status: response.status,\n error: errorMessage,\n })\n setError(errorMessage)\n }\n } catch (err) {\n console.error('Failed to fetch workflows:', err)\n const errorMessage = err instanceof Error ? err.message : 'Network error loading workflows'\n setError(errorMessage)\n } finally {\n setLoading(false)\n }\n }\n\n // Filter workflows based on search query and exclusions\n const getFilteredWorkflows = (): WorkflowDefinition[] => {\n return workflows\n .filter(wf => !excludeWorkflowIds.includes(wf.workflowId))\n .filter(wf => {\n if (!searchQuery) return true\n const query = searchQuery.toLowerCase()\n return (\n wf.workflowName.toLowerCase().includes(query) ||\n wf.workflowId.toLowerCase().includes(query) ||\n wf.description?.toLowerCase().includes(query)\n )\n })\n }\n\n const handleSelect = (workflow: WorkflowDefinition) => {\n onSelect(workflow.workflowId, workflow)\n setSearchQuery('') // Clear search on select\n }\n\n const handleClose = () => {\n setSearchQuery('')\n onClose()\n }\n\n const filteredWorkflows = getFilteredWorkflows()\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent className=\"sm:max-w-4xl max-h-[85vh] flex flex-col\">\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {/* Search Input */}\n <div className=\"px-6\">\n <Input\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder={searchPlaceholder}\n autoFocus\n disabled={loading}\n />\n </div>\n\n {/* Workflows List */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4 min-h-[400px]\">\n {loading ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Loader2 className=\"h-12 w-12 animate-spin text-primary mb-4\" />\n <p className=\"text-muted-foreground text-sm\">Loading workflows...</p>\n </div>\n ) : error ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <AlertCircle className=\"h-16 w-16 text-destructive mb-4\" />\n <p className=\"text-destructive text-sm font-medium mb-2\">{error}</p>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={fetchWorkflows}\n >\n Retry\n </Button>\n </div>\n ) : filteredWorkflows.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Workflow className=\"w-16 h-16 text-muted mb-4\" />\n <p className=\"text-muted-foreground text-sm mb-2\">\n {emptyMessage || (\n searchQuery\n ? 'No workflows found matching your search'\n : workflows.length === 0\n ? 'No workflows exist yet'\n : 'All workflows have already been excluded'\n )}\n </p>\n <p className=\"text-muted-foreground text-xs mb-3\">\n {workflows.length === 0\n ? 'Create workflows in the Workflow Definitions page first'\n : searchQuery\n ? `Showing 0 of ${workflows.length} total workflows`\n : `${workflows.length} workflows already excluded`\n }\n </p>\n {searchQuery && (\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => setSearchQuery('')}\n >\n Clear search\n </Button>\n )}\n </div>\n ) : (\n <>\n <div className=\"mb-3 text-sm text-muted-foreground\">\n {filteredWorkflows.length} workflow{filteredWorkflows.length !== 1 ? 's' : ''} available\n </div>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n {filteredWorkflows.map((workflow) => (\n <button\n key={workflow.id}\n onClick={() => handleSelect(workflow)}\n className=\"text-left p-4 border-2 border-border rounded-lg hover:border-primary hover:bg-accent transition-all group\"\n >\n <div className=\"flex items-start justify-between mb-2\">\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"text-sm font-semibold group-hover:text-primary truncate\">\n {workflow.workflowName}\n </h4>\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5 truncate\">\n {workflow.workflowId}\n </p>\n </div>\n <Plus className=\"size-5 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0 ml-2\" />\n </div>\n\n <div className=\"flex items-center gap-2 mb-2 flex-wrap\">\n <Badge variant=\"secondary\" className=\"text-xs\">\n v{workflow.version}\n </Badge>\n {workflow.enabled ? (\n <Badge variant=\"default\" className=\"bg-emerald-500 text-xs\">\n Enabled\n </Badge>\n ) : (\n <Badge variant=\"secondary\" className=\"text-xs\">\n Disabled\n </Badge>\n )}\n </div>\n\n {workflow.description && (\n <p className=\"text-xs text-muted-foreground line-clamp-2\">\n {workflow.description}\n </p>\n )}\n </button>\n ))}\n </div>\n </>\n )}\n </div>\n\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleClose}\n >\n Cancel\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@open-mercato/ui/primitives/dialog'\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 { Plus, Loader2, AlertCircle, Workflow } from 'lucide-react'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nexport interface WorkflowDefinition {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n enabled: boolean\n createdAt: string\n updatedAt: string\n}\n\nexport interface WorkflowSelectorProps {\n /** Whether the dialog is open */\n isOpen: boolean\n\n /** Callback when dialog is closed */\n onClose: () => void\n\n /** Callback when a workflow is selected */\n onSelect: (workflowId: string, workflow: WorkflowDefinition) => void\n\n /** Array of workflow IDs to exclude from the list (already selected) */\n excludeWorkflowIds?: string[]\n\n /** Dialog title */\n title?: string\n\n /** Dialog description */\n description?: string\n\n /** Whether to show only enabled workflows */\n onlyEnabled?: boolean\n\n /** Custom empty state message */\n emptyMessage?: string\n\n /** Custom search placeholder */\n searchPlaceholder?: string\n}\n\n/**\n * WorkflowSelector - Reusable dialog for searching and selecting workflow definitions\n *\n * Features:\n * - Search/filter workflows by name, ID, description\n * - Display workflow details (version, enabled status, description)\n * - Exclude already-selected workflows\n * - Loading and error states\n * - Responsive grid layout\n */\nexport function WorkflowSelector({\n isOpen,\n onClose,\n onSelect,\n excludeWorkflowIds = [],\n title = 'Select Workflow',\n description = 'Choose a workflow to invoke as a sub-workflow',\n onlyEnabled = true,\n emptyMessage,\n searchPlaceholder = 'Search by workflow ID, name, or description...',\n}: WorkflowSelectorProps) {\n const [workflows, setWorkflows] = useState<WorkflowDefinition[]>([])\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [searchQuery, setSearchQuery] = useState('')\n\n // Fetch workflows on mount\n useEffect(() => {\n if (isOpen) {\n fetchWorkflows()\n }\n }, [isOpen])\n\n const fetchWorkflows = async () => {\n setLoading(true)\n setError(null)\n try {\n // Build query params\n const params = new URLSearchParams()\n params.set('limit', '50') // Reasonable limit for selector\n\n if (onlyEnabled) {\n params.set('enabled', 'true')\n }\n\n const url = `/api/workflows/definitions?${params.toString()}`\n const response = await apiFetch(url)\n\n if (response.ok) {\n const result = await response.json()\n setWorkflows(result.data || [])\n } else {\n let errorMessage = `Failed to load workflows (${response.status})`\n try {\n const errorData = await response.json()\n if (errorData.error) {\n errorMessage = errorData.error\n }\n } catch {\n // Use default error message\n }\n logger.error('Failed to fetch workflows', {\n url,\n status: response.status,\n message: errorMessage,\n })\n setError(errorMessage)\n }\n } catch (err) {\n logger.error('Failed to fetch workflows', { err })\n const errorMessage = err instanceof Error ? err.message : 'Network error loading workflows'\n setError(errorMessage)\n } finally {\n setLoading(false)\n }\n }\n\n // Filter workflows based on search query and exclusions\n const getFilteredWorkflows = (): WorkflowDefinition[] => {\n return workflows\n .filter(wf => !excludeWorkflowIds.includes(wf.workflowId))\n .filter(wf => {\n if (!searchQuery) return true\n const query = searchQuery.toLowerCase()\n return (\n wf.workflowName.toLowerCase().includes(query) ||\n wf.workflowId.toLowerCase().includes(query) ||\n wf.description?.toLowerCase().includes(query)\n )\n })\n }\n\n const handleSelect = (workflow: WorkflowDefinition) => {\n onSelect(workflow.workflowId, workflow)\n setSearchQuery('') // Clear search on select\n }\n\n const handleClose = () => {\n setSearchQuery('')\n onClose()\n }\n\n const filteredWorkflows = getFilteredWorkflows()\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent className=\"sm:max-w-4xl max-h-[85vh] flex flex-col\">\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {/* Search Input */}\n <div className=\"px-6\">\n <Input\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder={searchPlaceholder}\n autoFocus\n disabled={loading}\n />\n </div>\n\n {/* Workflows List */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4 min-h-[400px]\">\n {loading ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Loader2 className=\"h-12 w-12 animate-spin text-primary mb-4\" />\n <p className=\"text-muted-foreground text-sm\">Loading workflows...</p>\n </div>\n ) : error ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <AlertCircle className=\"h-16 w-16 text-destructive mb-4\" />\n <p className=\"text-destructive text-sm font-medium mb-2\">{error}</p>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={fetchWorkflows}\n >\n Retry\n </Button>\n </div>\n ) : filteredWorkflows.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Workflow className=\"w-16 h-16 text-muted mb-4\" />\n <p className=\"text-muted-foreground text-sm mb-2\">\n {emptyMessage || (\n searchQuery\n ? 'No workflows found matching your search'\n : workflows.length === 0\n ? 'No workflows exist yet'\n : 'All workflows have already been excluded'\n )}\n </p>\n <p className=\"text-muted-foreground text-xs mb-3\">\n {workflows.length === 0\n ? 'Create workflows in the Workflow Definitions page first'\n : searchQuery\n ? `Showing 0 of ${workflows.length} total workflows`\n : `${workflows.length} workflows already excluded`\n }\n </p>\n {searchQuery && (\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => setSearchQuery('')}\n >\n Clear search\n </Button>\n )}\n </div>\n ) : (\n <>\n <div className=\"mb-3 text-sm text-muted-foreground\">\n {filteredWorkflows.length} workflow{filteredWorkflows.length !== 1 ? 's' : ''} available\n </div>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n {filteredWorkflows.map((workflow) => (\n <button\n key={workflow.id}\n onClick={() => handleSelect(workflow)}\n className=\"text-left p-4 border-2 border-border rounded-lg hover:border-primary hover:bg-accent transition-all group\"\n >\n <div className=\"flex items-start justify-between mb-2\">\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"text-sm font-semibold group-hover:text-primary truncate\">\n {workflow.workflowName}\n </h4>\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5 truncate\">\n {workflow.workflowId}\n </p>\n </div>\n <Plus className=\"size-5 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0 ml-2\" />\n </div>\n\n <div className=\"flex items-center gap-2 mb-2 flex-wrap\">\n <Badge variant=\"secondary\" className=\"text-xs\">\n v{workflow.version}\n </Badge>\n {workflow.enabled ? (\n <Badge variant=\"default\" className=\"bg-emerald-500 text-xs\">\n Enabled\n </Badge>\n ) : (\n <Badge variant=\"secondary\" className=\"text-xs\">\n Disabled\n </Badge>\n )}\n </div>\n\n {workflow.description && (\n <p className=\"text-xs text-muted-foreground line-clamp-2\">\n {workflow.description}\n </p>\n )}\n </button>\n ))}\n </div>\n </>\n )}\n </div>\n\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleClose}\n >\n Cancel\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAgKQ,SAmEI,UAlEF,KADF;AA9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kBACb;AAAA,oCAAC,QAAG,WAAU,2DACX,mBAAS,cACZ;AAAA,gBACA,oBAAC,OAAE,WAAU,2DACV,mBAAS,YACZ;AAAA,iBACF;AAAA,cACA,oBAAC,QAAK,WAAU,8FAA6F;AAAA,eAC/G;AAAA,YAEA,qBAAC,SAAI,WAAU,0CACb;AAAA,mCAAC,SAAM,SAAQ,aAAY,WAAU,WAAU;AAAA;AAAA,gBAC3C,SAAS;AAAA,iBACb;AAAA,cACC,SAAS,UACR,oBAAC,SAAM,SAAQ,WAAU,WAAU,0BAAyB,qBAE5D,IAEA,oBAAC,SAAM,SAAQ,aAAY,WAAU,WAAU,sBAE/C;AAAA,eAEJ;AAAA,YAEC,SAAS,eACR,oBAAC,OAAE,WAAU,8CACV,mBAAS,aACZ;AAAA;AAAA;AAAA,QAlCG,SAAS;AAAA,MAoChB,CACD,GACH;AAAA,OACF,GAEJ;AAAA,IAEA,oBAAC,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,SAAS;AAAA,QACV;AAAA;AAAA,IAED,GACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,8 @@ import { EmptyState } from "@open-mercato/ui/backend/EmptyState";
|
|
|
11
11
|
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
12
12
|
import { SwitchField } from "@open-mercato/ui/primitives/switch-field";
|
|
13
13
|
import { ConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
|
|
14
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
15
|
+
const logger = createLogger("workflows");
|
|
14
16
|
function normalizeCondition(raw) {
|
|
15
17
|
if (typeof raw === "string") {
|
|
16
18
|
return { ruleId: raw, required: true };
|
|
@@ -75,7 +77,7 @@ function BusinessRuleConditionsEditor({
|
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
} catch (err) {
|
|
78
|
-
|
|
80
|
+
logger.error("Failed to fetch rule details", { ruleId, err });
|
|
79
81
|
setConditionsWithDetails((prev) => {
|
|
80
82
|
const updated = [...prev];
|
|
81
83
|
if (updated[index]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Plus, Trash2, AlertCircle } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\n\n/**\n * Condition definition structure (supports legacy string format and new object format)\n */\nexport type TransitionCondition = string | { ruleId: string; required: boolean }\n\ninterface BusinessRuleConditionsEditorProps extends CrudCustomFieldRenderProps {\n value: TransitionCondition[]\n filterEntityType?: string\n filterRuleType?: string\n}\n\ninterface ConditionWithDetails {\n ruleId: string\n required: boolean\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * Normalize legacy string format to object format\n */\nfunction normalizeCondition(raw: TransitionCondition): { ruleId: string; required: boolean } {\n if (typeof raw === 'string') {\n return { ruleId: raw, required: true }\n }\n return raw\n}\n\n/**\n * BusinessRuleConditionsEditor - Custom field component for managing pre/post business rule conditions\n *\n * Integrates with BusinessRulesSelector modal to add/remove conditions.\n * Fetches and displays rule names for selected rule IDs.\n * Supports both legacy string format and new object format with required flag.\n *\n * Used by EdgeEditDialog (pre-conditions and post-conditions)\n */\nexport function BusinessRuleConditionsEditor({\n id,\n value = [],\n setValue,\n disabled,\n filterEntityType,\n filterRuleType,\n}: BusinessRuleConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n const conditions = Array.isArray(value) ? value : []\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const normalized = conditions.map(normalizeCondition)\n const withDetails: ConditionWithDetails[] = normalized.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n normalized.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(normalizeCondition))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n console.error(`Failed to fetch rule details for ${ruleId}:`, err)\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: TransitionCondition = { ruleId, required: true }\n setValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const removeCondition = (index: number) => {\n const newConditions = conditions.filter((_, i) => i !== index)\n setValue(newConditions)\n }\n\n const toggleRequired = (index: number) => {\n const normalized = normalizeCondition(conditions[index])\n const updated = [...conditions]\n updated[index] = {\n ruleId: normalized.ruleId,\n required: !normalized.required,\n }\n setValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => normalizeCondition(c).ruleId)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-end\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => setIsModalOpen(true)}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.businessRuleConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 ? (\n <EmptyState\n title={t('workflows.fieldEditors.businessRuleConditions.emptyTitle')}\n description={t('workflows.fieldEditors.businessRuleConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.businessRuleConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n ) : (\n <div className=\"space-y-2\">\n {conditionsWithDetails.map((condition, index) => {\n const normalized = normalizeCondition(conditions[index])\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1 min-w-0 space-y-2\">\n {/* Rule Name/ID */}\n <div className=\"flex items-center gap-2\">\n {condition.loading ? (\n <>\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </>\n ) : condition.error ? (\n <>\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </>\n ) : (\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs ml-2\">\n {condition.ruleType}\n </Badge>\n )}\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Required Toggle */}\n <SwitchField\n id={`${id}-${index}-required`}\n label={t('workflows.fieldEditors.businessRuleConditions.requiredLabel')}\n flip\n checked={normalized.required}\n onCheckedChange={() => toggleRequired(index)}\n disabled={disabled}\n />\n </div>\n\n {/* Delete Button */}\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled}\n className=\"ml-2 flex-shrink-0\"\n >\n <Trash2 className=\"size-4 text-red-600\" />\n </Button>\n }\n title={t('workflows.fieldEditors.businessRuleConditions.removeCondition')}\n text={t('workflows.fieldEditors.businessRuleConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n )\n })}\n </div>\n )}\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRuleDescription')}\n filterEntityType={filterEntityType}\n filterRuleType={filterRuleType}\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Plus, Trash2, AlertCircle } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\n/**\n * Condition definition structure (supports legacy string format and new object format)\n */\nexport type TransitionCondition = string | { ruleId: string; required: boolean }\n\ninterface BusinessRuleConditionsEditorProps extends CrudCustomFieldRenderProps {\n value: TransitionCondition[]\n filterEntityType?: string\n filterRuleType?: string\n}\n\ninterface ConditionWithDetails {\n ruleId: string\n required: boolean\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * Normalize legacy string format to object format\n */\nfunction normalizeCondition(raw: TransitionCondition): { ruleId: string; required: boolean } {\n if (typeof raw === 'string') {\n return { ruleId: raw, required: true }\n }\n return raw\n}\n\n/**\n * BusinessRuleConditionsEditor - Custom field component for managing pre/post business rule conditions\n *\n * Integrates with BusinessRulesSelector modal to add/remove conditions.\n * Fetches and displays rule names for selected rule IDs.\n * Supports both legacy string format and new object format with required flag.\n *\n * Used by EdgeEditDialog (pre-conditions and post-conditions)\n */\nexport function BusinessRuleConditionsEditor({\n id,\n value = [],\n setValue,\n disabled,\n filterEntityType,\n filterRuleType,\n}: BusinessRuleConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n const conditions = Array.isArray(value) ? value : []\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const normalized = conditions.map(normalizeCondition)\n const withDetails: ConditionWithDetails[] = normalized.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n normalized.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(normalizeCondition))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n logger.error('Failed to fetch rule details', { ruleId, err })\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: TransitionCondition = { ruleId, required: true }\n setValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const removeCondition = (index: number) => {\n const newConditions = conditions.filter((_, i) => i !== index)\n setValue(newConditions)\n }\n\n const toggleRequired = (index: number) => {\n const normalized = normalizeCondition(conditions[index])\n const updated = [...conditions]\n updated[index] = {\n ruleId: normalized.ruleId,\n required: !normalized.required,\n }\n setValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => normalizeCondition(c).ruleId)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-end\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => setIsModalOpen(true)}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.businessRuleConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 ? (\n <EmptyState\n title={t('workflows.fieldEditors.businessRuleConditions.emptyTitle')}\n description={t('workflows.fieldEditors.businessRuleConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.businessRuleConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n ) : (\n <div className=\"space-y-2\">\n {conditionsWithDetails.map((condition, index) => {\n const normalized = normalizeCondition(conditions[index])\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1 min-w-0 space-y-2\">\n {/* Rule Name/ID */}\n <div className=\"flex items-center gap-2\">\n {condition.loading ? (\n <>\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </>\n ) : condition.error ? (\n <>\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </>\n ) : (\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs ml-2\">\n {condition.ruleType}\n </Badge>\n )}\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Required Toggle */}\n <SwitchField\n id={`${id}-${index}-required`}\n label={t('workflows.fieldEditors.businessRuleConditions.requiredLabel')}\n flip\n checked={normalized.required}\n onCheckedChange={() => toggleRequired(index)}\n disabled={disabled}\n />\n </div>\n\n {/* Delete Button */}\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled}\n className=\"ml-2 flex-shrink-0\"\n >\n <Trash2 className=\"size-4 text-red-600\" />\n </Button>\n }\n title={t('workflows.fieldEditors.businessRuleConditions.removeCondition')}\n text={t('workflows.fieldEditors.businessRuleConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n )\n })}\n </div>\n )}\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRuleDescription')}\n filterEntityType={filterEntityType}\n filterRuleType={filterRuleType}\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAuKQ,SA4BgB,UAtBd,KANF;AArKR,SAAS,UAAU,iBAAiB;AACpC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,MAAM,QAAQ,mBAAmB;AAE1C,SAAS,6BAAgD;AACzD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAyBvC,SAAS,mBAAmB,KAAiE;AAC3F,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,EAAE,QAAQ,KAAK,UAAU,KAAK;AAAA,EACvC;AACA,SAAO;AACT;AAWO,SAAS,6BAA6B;AAAA,EAC3C;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsC;AACpC,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,CAAC,uBAAuB,wBAAwB,IAAI,SAAiC,CAAC,CAAC;AAE7F,QAAM,aAAa,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;AAGnD,YAAU,MAAM;AACd,UAAM,aAAa,WAAW,IAAI,kBAAkB;AACpD,UAAM,cAAsC,WAAW,IAAI,CAAC,OAAO;AAAA,MACjE,GA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A,gBACL,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL;AAAA,gBACA,WAAU;AAAA,gBAEV,8BAAC,UAAO,WAAU,uBAAsB;AAAA;AAAA,YAC1C;AAAA,YAEF,OAAO,EAAE,+DAA+D;AAAA,YACxE,MAAM,EAAE,6DAA6D;AAAA,YACrE,SAAQ;AAAA,YACR,WAAW,MAAM,gBAAgB,KAAK;AAAA;AAAA,QACxC;AAAA,SACF,KA9DQ,KA+DV;AAAA,IAEJ,CAAC,GACH;AAAA,IAIF;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC,UAAU;AAAA,QACV,gBAAgB,mBAAmB;AAAA,QACnC,OAAO,EAAE,kEAAkE;AAAA,QAC3E,aAAa,EAAE,6EAA6E;AAAA,QAC5F;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,6 +13,8 @@ import { EmptyState } from "@open-mercato/ui/backend/EmptyState";
|
|
|
13
13
|
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
14
14
|
import { SwitchField } from "@open-mercato/ui/primitives/switch-field";
|
|
15
15
|
import { ConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
|
|
16
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
17
|
+
const logger = createLogger("workflows");
|
|
16
18
|
function LocalizedMessageTextarea({
|
|
17
19
|
value,
|
|
18
20
|
onChange,
|
|
@@ -118,7 +120,7 @@ function StartPreConditionsEditor({
|
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
122
|
} catch (err) {
|
|
121
|
-
|
|
123
|
+
logger.error("Failed to fetch rule details", { ruleId, err });
|
|
122
124
|
setConditionsWithDetails((prev) => {
|
|
123
125
|
const updated = [...prev];
|
|
124
126
|
if (updated[index]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/components/fields/StartPreConditionsEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { useState, useEffect, useCallback } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Plus, Trash2, AlertCircle, ChevronUp, ChevronDown } from 'lucide-react'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\n\n/**\n * StartPreCondition interface matching the schema in validators.ts\n */\nexport interface StartPreCondition {\n ruleId: string\n required: boolean\n validationMessage?: Record<string, string> // e.g., { en: 'Message', pl: 'Wiadomo\u015B\u0107' }\n}\n\ninterface StartPreConditionsEditorProps {\n value?: StartPreCondition[] | unknown\n setValue?: ((value: unknown) => void) | ((value: StartPreCondition[]) => void)\n disabled?: boolean\n}\n\ninterface ConditionWithDetails extends StartPreCondition {\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * LocalizedMessageTextarea - Textarea with local state that only updates parent on blur\n */\nfunction LocalizedMessageTextarea({\n value,\n onChange,\n disabled,\n id,\n placeholder,\n hint,\n}: {\n value: Record<string, string> | undefined\n onChange: (messages: Record<string, string>) => void\n disabled?: boolean\n id: string\n placeholder: string\n hint: string\n}) {\n const getValidationMessagesString = (messages: Record<string, string> | undefined): string => {\n if (!messages) return ''\n return Object.entries(messages)\n .filter(([_, msg]) => msg)\n .map(([locale, msg]) => `${locale}: ${msg}`)\n .join('\\n')\n }\n\n const parseValidationMessagesString = (str: string): Record<string, string> => {\n const result: Record<string, string> = {}\n str.split('\\n').forEach(line => {\n const match = line.match(/^(\\w+):\\s*(.*)$/)\n if (match) {\n result[match[1]] = match[2]\n }\n })\n return result\n }\n\n const [localValue, setLocalValue] = useState(() => getValidationMessagesString(value))\n\n // Update local value when external value changes\n useEffect(() => {\n setLocalValue(getValidationMessagesString(value))\n }, [value])\n\n const handleBlur = useCallback(() => {\n onChange(parseValidationMessagesString(localValue))\n }, [localValue, onChange])\n\n return (\n <>\n <Textarea\n id={id}\n value={localValue}\n onChange={(e) => setLocalValue(e.target.value)}\n onBlur={handleBlur}\n placeholder={placeholder}\n rows={2}\n className=\"mt-1 font-mono text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n {hint}\n </p>\n </>\n )\n}\n\n/**\n * StartPreConditionsEditor - Editor for START step pre-conditions\n *\n * Uses BusinessRulesSelector modal for selecting business rules (searchable).\n * Supports localized validation messages for each pre-condition.\n * Matches the style of TransitionsEditor and BusinessRuleConditionsEditor.\n */\nexport function StartPreConditionsEditor({\n value,\n setValue,\n disabled = false,\n}: StartPreConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n // Safely cast value to StartPreCondition array\n const conditions: StartPreCondition[] = Array.isArray(value) ? value : []\n\n // Helper to call setValue with proper typing\n const updateValue = (newValue: StartPreCondition[]) => {\n if (setValue) {\n setValue(newValue)\n }\n }\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const withDetails: ConditionWithDetails[] = conditions.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n conditions.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(c => c.ruleId))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n console.error(`Failed to fetch rule details for ${ruleId}:`, err)\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: StartPreCondition = {\n ruleId,\n required: true,\n validationMessage: { en: '' },\n }\n updateValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const updateCondition = (index: number, updates: Partial<StartPreCondition>) => {\n const updated = [...conditions]\n updated[index] = { ...updated[index], ...updates }\n updateValue(updated)\n }\n\n const removeCondition = (index: number) => {\n updateValue(conditions.filter((_, i) => i !== index))\n }\n\n const moveCondition = (index: number, direction: 'up' | 'down') => {\n const newIndex = direction === 'up' ? index - 1 : index + 1\n if (newIndex < 0 || newIndex >= conditions.length) return\n\n const updated = [...conditions]\n const temp = updated[index]\n updated[index] = updated[newIndex]\n updated[newIndex] = temp\n updateValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => c.ruleId)\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-sm text-muted-foreground\">\n {t('workflows.fieldEditors.preConditions.description')}\n </p>\n </div>\n <Button\n type=\"button\"\n onClick={() => setIsModalOpen(true)}\n variant=\"outline\"\n size=\"sm\"\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('workflows.fieldEditors.preConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 && (\n <EmptyState\n title={t('workflows.fieldEditors.preConditions.emptyTitle')}\n description={t('workflows.fieldEditors.preConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.preConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n )}\n\n <div className=\"space-y-3\">\n {conditionsWithDetails.map((condition, index) => (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"space-y-3\">\n {/* Header row with rule info and actions */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex-1 min-w-0\">\n {/* Rule Name/ID */}\n {condition.loading ? (\n <div className=\"flex items-center gap-2\">\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </div>\n ) : condition.error ? (\n <div className=\"flex items-center gap-2\">\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </div>\n ) : (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {condition.ruleType}\n </Badge>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Action buttons */}\n <div className=\"flex items-center gap-1 self-end sm:self-auto\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'up')}\n disabled={index === 0 || disabled}\n title={t('workflows.common.moveUp')}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'down')}\n disabled={index === conditions.length - 1 || disabled}\n title={t('workflows.common.moveDown')}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n title={t('workflows.common.delete')}\n disabled={disabled}\n >\n <Trash2 className=\"h-4 w-4 text-red-600\" />\n </Button>\n }\n title={t('workflows.fieldEditors.preConditions.removePreCondition')}\n text={t('workflows.fieldEditors.preConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n\n {/* Required toggle */}\n <SwitchField\n id={`precondition-${index}-required`}\n label={t('workflows.fieldEditors.preConditions.requiredLabel')}\n flip\n checked={conditions[index]?.required ?? true}\n onCheckedChange={(checked) => updateCondition(index, { required: checked })}\n disabled={disabled}\n />\n\n {/* Validation Messages */}\n <div>\n <Label htmlFor={`precondition-${index}-messages`} className=\"text-xs\">\n {t('workflows.fieldEditors.preConditions.validationMessages')}\n </Label>\n <LocalizedMessageTextarea\n id={`precondition-${index}-messages`}\n value={conditions[index]?.validationMessage}\n onChange={(messages) => updateCondition(index, { validationMessage: messages })}\n disabled={disabled}\n placeholder={t('workflows.fieldEditors.preConditions.validationMessagesPlaceholder')}\n hint={t('workflows.fieldEditors.preConditions.validationMessagesHint')}\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.preConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.preConditions.selectBusinessRuleDescription')}\n filterRuleType=\"GUARD\"\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { useState, useEffect, useCallback } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Plus, Trash2, AlertCircle, ChevronUp, ChevronDown } from 'lucide-react'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\n/**\n * StartPreCondition interface matching the schema in validators.ts\n */\nexport interface StartPreCondition {\n ruleId: string\n required: boolean\n validationMessage?: Record<string, string> // e.g., { en: 'Message', pl: 'Wiadomo\u015B\u0107' }\n}\n\ninterface StartPreConditionsEditorProps {\n value?: StartPreCondition[] | unknown\n setValue?: ((value: unknown) => void) | ((value: StartPreCondition[]) => void)\n disabled?: boolean\n}\n\ninterface ConditionWithDetails extends StartPreCondition {\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * LocalizedMessageTextarea - Textarea with local state that only updates parent on blur\n */\nfunction LocalizedMessageTextarea({\n value,\n onChange,\n disabled,\n id,\n placeholder,\n hint,\n}: {\n value: Record<string, string> | undefined\n onChange: (messages: Record<string, string>) => void\n disabled?: boolean\n id: string\n placeholder: string\n hint: string\n}) {\n const getValidationMessagesString = (messages: Record<string, string> | undefined): string => {\n if (!messages) return ''\n return Object.entries(messages)\n .filter(([_, msg]) => msg)\n .map(([locale, msg]) => `${locale}: ${msg}`)\n .join('\\n')\n }\n\n const parseValidationMessagesString = (str: string): Record<string, string> => {\n const result: Record<string, string> = {}\n str.split('\\n').forEach(line => {\n const match = line.match(/^(\\w+):\\s*(.*)$/)\n if (match) {\n result[match[1]] = match[2]\n }\n })\n return result\n }\n\n const [localValue, setLocalValue] = useState(() => getValidationMessagesString(value))\n\n // Update local value when external value changes\n useEffect(() => {\n setLocalValue(getValidationMessagesString(value))\n }, [value])\n\n const handleBlur = useCallback(() => {\n onChange(parseValidationMessagesString(localValue))\n }, [localValue, onChange])\n\n return (\n <>\n <Textarea\n id={id}\n value={localValue}\n onChange={(e) => setLocalValue(e.target.value)}\n onBlur={handleBlur}\n placeholder={placeholder}\n rows={2}\n className=\"mt-1 font-mono text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n {hint}\n </p>\n </>\n )\n}\n\n/**\n * StartPreConditionsEditor - Editor for START step pre-conditions\n *\n * Uses BusinessRulesSelector modal for selecting business rules (searchable).\n * Supports localized validation messages for each pre-condition.\n * Matches the style of TransitionsEditor and BusinessRuleConditionsEditor.\n */\nexport function StartPreConditionsEditor({\n value,\n setValue,\n disabled = false,\n}: StartPreConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n // Safely cast value to StartPreCondition array\n const conditions: StartPreCondition[] = Array.isArray(value) ? value : []\n\n // Helper to call setValue with proper typing\n const updateValue = (newValue: StartPreCondition[]) => {\n if (setValue) {\n setValue(newValue)\n }\n }\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const withDetails: ConditionWithDetails[] = conditions.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n conditions.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(c => c.ruleId))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n logger.error('Failed to fetch rule details', { ruleId, err })\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: StartPreCondition = {\n ruleId,\n required: true,\n validationMessage: { en: '' },\n }\n updateValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const updateCondition = (index: number, updates: Partial<StartPreCondition>) => {\n const updated = [...conditions]\n updated[index] = { ...updated[index], ...updates }\n updateValue(updated)\n }\n\n const removeCondition = (index: number) => {\n updateValue(conditions.filter((_, i) => i !== index))\n }\n\n const moveCondition = (index: number, direction: 'up' | 'down') => {\n const newIndex = direction === 'up' ? index - 1 : index + 1\n if (newIndex < 0 || newIndex >= conditions.length) return\n\n const updated = [...conditions]\n const temp = updated[index]\n updated[index] = updated[newIndex]\n updated[newIndex] = temp\n updateValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => c.ruleId)\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-sm text-muted-foreground\">\n {t('workflows.fieldEditors.preConditions.description')}\n </p>\n </div>\n <Button\n type=\"button\"\n onClick={() => setIsModalOpen(true)}\n variant=\"outline\"\n size=\"sm\"\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('workflows.fieldEditors.preConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 && (\n <EmptyState\n title={t('workflows.fieldEditors.preConditions.emptyTitle')}\n description={t('workflows.fieldEditors.preConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.preConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n )}\n\n <div className=\"space-y-3\">\n {conditionsWithDetails.map((condition, index) => (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"space-y-3\">\n {/* Header row with rule info and actions */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex-1 min-w-0\">\n {/* Rule Name/ID */}\n {condition.loading ? (\n <div className=\"flex items-center gap-2\">\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </div>\n ) : condition.error ? (\n <div className=\"flex items-center gap-2\">\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </div>\n ) : (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {condition.ruleType}\n </Badge>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Action buttons */}\n <div className=\"flex items-center gap-1 self-end sm:self-auto\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'up')}\n disabled={index === 0 || disabled}\n title={t('workflows.common.moveUp')}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'down')}\n disabled={index === conditions.length - 1 || disabled}\n title={t('workflows.common.moveDown')}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n title={t('workflows.common.delete')}\n disabled={disabled}\n >\n <Trash2 className=\"h-4 w-4 text-red-600\" />\n </Button>\n }\n title={t('workflows.fieldEditors.preConditions.removePreCondition')}\n text={t('workflows.fieldEditors.preConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n\n {/* Required toggle */}\n <SwitchField\n id={`precondition-${index}-required`}\n label={t('workflows.fieldEditors.preConditions.requiredLabel')}\n flip\n checked={conditions[index]?.required ?? true}\n onCheckedChange={(checked) => updateCondition(index, { required: checked })}\n disabled={disabled}\n />\n\n {/* Validation Messages */}\n <div>\n <Label htmlFor={`precondition-${index}-messages`} className=\"text-xs\">\n {t('workflows.fieldEditors.preConditions.validationMessages')}\n </Label>\n <LocalizedMessageTextarea\n id={`precondition-${index}-messages`}\n value={conditions[index]?.validationMessage}\n onChange={(messages) => updateCondition(index, { validationMessage: messages })}\n disabled={disabled}\n placeholder={t('workflows.fieldEditors.preConditions.validationMessagesPlaceholder')}\n hint={t('workflows.fieldEditors.preConditions.validationMessagesHint')}\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.preConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.preConditions.selectBusinessRuleDescription')}\n filterRuleType=\"GUARD\"\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA0FI,mBACE,KADF;AAxFJ,SAAS,UAAU,WAAW,mBAAmB;AACjD,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,MAAM,QAAQ,aAAa,WAAW,mBAAmB;AAClE,SAAS,6BAAgD;AACzD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AA2BvC,SAAS,yBAAyB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOG;AACD,QAAM,8BAA8B,CAAC,aAAyD;AAC5F,QAAI,CAAC,SAAU,QAAO;AACtB,WAAO,OAAO,QAAQ,QAAQ,EAC3B,OAAO,CAAC,CAAC,GAAG,GAAG,MAAM,GAAG,EACxB,IAAI,CAAC,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,KAAK,GAAG,EAAE,EAC1C,KAAK,IAAI;AAAA,EACd;AAEA,QAAM,gCAAgC,CAAC,QAAwC;AAC7E,UAAM,SAAiC,CAAC;AACxC,QAAI,MAAM,IAAI,EAAE,QAAQ,UAAQ;AAC9B,YAAM,QAAQ,KAAK,MAAM,iBAAiB;AAC1C,UAAI,OAAO;AACT,eAAO,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,MAC5B;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,MAAM,4BAA4B,KAAK,CAAC;AAGrF,YAAU,MAAM;AACd,kBA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AAoE;AAAA,YACnF,MAAM,EAAE,6DAA6D;AAAA;AAAA,QACvE;AAAA,SACF;AAAA,OACF,KAtGQ,KAuGV,CACD,GACH;AAAA,IAGA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC,UAAU;AAAA,QACV,gBAAgB,mBAAmB;AAAA,QACnC,OAAO,EAAE,yDAAyD;AAAA,QAClE,aAAa,EAAE,oEAAoE;AAAA,QACnF,gBAAe;AAAA,QACf,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,6 +9,8 @@ import { Label } from "@open-mercato/ui/primitives/label";
|
|
|
9
9
|
import { Search, X, Loader2, AlertCircle, Workflow } from "lucide-react";
|
|
10
10
|
import { WorkflowSelector } from "../WorkflowSelector.js";
|
|
11
11
|
import { apiFetch } from "@open-mercato/ui/backend/utils/api";
|
|
12
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
13
|
+
const logger = createLogger("workflows");
|
|
12
14
|
function WorkflowSelectorField({
|
|
13
15
|
id,
|
|
14
16
|
value = "",
|
|
@@ -57,7 +59,7 @@ function WorkflowSelectorField({
|
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
} catch (err) {
|
|
60
|
-
|
|
62
|
+
logger.error("Failed to fetch workflow details", { workflowId: wfId, err });
|
|
61
63
|
setWorkflowDetails({
|
|
62
64
|
workflowId: wfId,
|
|
63
65
|
loading: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/components/fields/WorkflowSelectorField.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Search, X, Loader2, AlertCircle, Workflow } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { WorkflowSelector, type WorkflowDefinition } from '../WorkflowSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\n\ninterface WorkflowSelectorFieldProps extends CrudCustomFieldRenderProps {\n value: string\n label?: string\n description?: string\n}\n\ninterface WorkflowDetails {\n workflowId: string\n workflowName?: string\n version?: number\n enabled?: boolean\n description?: string | null\n loading?: boolean\n error?: boolean\n}\n\n/**\n * WorkflowSelectorField - Custom field component for selecting a sub-workflow\n *\n * Integrates with WorkflowSelector modal to pick a workflow.\n * Fetches and displays workflow details for the selected workflow ID.\n * Allows clearing the selection.\n *\n * Used by NodeEditDialog (SubWorkflow type only)\n */\nexport function WorkflowSelectorField({\n id,\n value = '',\n error,\n setValue,\n disabled,\n label: labelProp,\n description: descriptionProp,\n}: WorkflowSelectorFieldProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const label = labelProp ?? t('workflows.fieldEditors.workflowSelector.label')\n const description = descriptionProp ?? t('workflows.fieldEditors.workflowSelector.description')\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [workflowDetails, setWorkflowDetails] = useState<WorkflowDetails | null>(null)\n\n const workflowId = value || ''\n\n // Fetch workflow details when workflowId changes\n useEffect(() => {\n if (workflowId) {\n setWorkflowDetails({ workflowId, loading: true })\n fetchWorkflowDetails(workflowId)\n } else {\n setWorkflowDetails(null)\n }\n }, [workflowId])\n\n const fetchWorkflowDetails = async (wfId: string) => {\n try {\n const params = new URLSearchParams({ workflowId: wfId, limit: '1' })\n const response = await apiFetch(`/api/workflows/definitions?${params.toString()}`)\n\n if (response.ok) {\n const result = await response.json()\n const workflow = result.data?.[0] as WorkflowDefinition | undefined\n\n setWorkflowDetails({\n workflowId: wfId,\n workflowName: workflow?.workflowName,\n version: workflow?.version,\n enabled: workflow?.enabled,\n description: workflow?.description,\n loading: false,\n error: !workflow,\n })\n } else {\n setWorkflowDetails({\n workflowId: wfId,\n loading: false,\n error: true,\n })\n }\n } catch (err) {\n
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Search, X, Loader2, AlertCircle, Workflow } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { WorkflowSelector, type WorkflowDefinition } from '../WorkflowSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\ninterface WorkflowSelectorFieldProps extends CrudCustomFieldRenderProps {\n value: string\n label?: string\n description?: string\n}\n\ninterface WorkflowDetails {\n workflowId: string\n workflowName?: string\n version?: number\n enabled?: boolean\n description?: string | null\n loading?: boolean\n error?: boolean\n}\n\n/**\n * WorkflowSelectorField - Custom field component for selecting a sub-workflow\n *\n * Integrates with WorkflowSelector modal to pick a workflow.\n * Fetches and displays workflow details for the selected workflow ID.\n * Allows clearing the selection.\n *\n * Used by NodeEditDialog (SubWorkflow type only)\n */\nexport function WorkflowSelectorField({\n id,\n value = '',\n error,\n setValue,\n disabled,\n label: labelProp,\n description: descriptionProp,\n}: WorkflowSelectorFieldProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const label = labelProp ?? t('workflows.fieldEditors.workflowSelector.label')\n const description = descriptionProp ?? t('workflows.fieldEditors.workflowSelector.description')\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [workflowDetails, setWorkflowDetails] = useState<WorkflowDetails | null>(null)\n\n const workflowId = value || ''\n\n // Fetch workflow details when workflowId changes\n useEffect(() => {\n if (workflowId) {\n setWorkflowDetails({ workflowId, loading: true })\n fetchWorkflowDetails(workflowId)\n } else {\n setWorkflowDetails(null)\n }\n }, [workflowId])\n\n const fetchWorkflowDetails = async (wfId: string) => {\n try {\n const params = new URLSearchParams({ workflowId: wfId, limit: '1' })\n const response = await apiFetch(`/api/workflows/definitions?${params.toString()}`)\n\n if (response.ok) {\n const result = await response.json()\n const workflow = result.data?.[0] as WorkflowDefinition | undefined\n\n setWorkflowDetails({\n workflowId: wfId,\n workflowName: workflow?.workflowName,\n version: workflow?.version,\n enabled: workflow?.enabled,\n description: workflow?.description,\n loading: false,\n error: !workflow,\n })\n } else {\n setWorkflowDetails({\n workflowId: wfId,\n loading: false,\n error: true,\n })\n }\n } catch (err) {\n logger.error('Failed to fetch workflow details', { workflowId: wfId, err })\n setWorkflowDetails({\n workflowId: wfId,\n loading: false,\n error: true,\n })\n }\n }\n\n const handleSelect = (selectedWorkflowId: string, _workflow: WorkflowDefinition) => {\n setValue(selectedWorkflowId)\n setIsModalOpen(false)\n }\n\n const handleClear = async () => {\n const confirmed = await confirm({\n title: t('workflows.common.clear'),\n text: t('workflows.fieldEditors.workflowSelector.confirmClear'),\n variant: 'default',\n })\n if (!confirmed) return\n\n setValue('')\n setWorkflowDetails(null)\n }\n\n return (\n <div className=\"space-y-2\">\n <div>\n <Label htmlFor={id} className=\"text-sm font-medium\">\n {label}\n </Label>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {description}\n </p>\n {error && <p className=\"text-xs text-red-600 mt-1\">{error}</p>}\n </div>\n\n {!workflowId ? (\n /* No Workflow Selected */\n <div className=\"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center\">\n <Workflow className=\"size-8 text-muted-foreground mx-auto mb-2\" />\n <p className=\"text-sm text-muted-foreground mb-3\">{t('workflows.fieldEditors.workflowSelector.noWorkflowSelected')}</p>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => setIsModalOpen(true)}\n disabled={disabled}\n >\n <Search className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.workflowSelector.browseWorkflows')}\n </Button>\n </div>\n ) : (\n /* Workflow Selected */\n <div className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1 min-w-0 space-y-2\">\n {workflowDetails?.loading ? (\n <div className=\"flex items-center gap-2\">\n <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </div>\n ) : workflowDetails?.error ? (\n <>\n <div className=\"flex items-center gap-2\">\n <AlertCircle className=\"size-4 text-yellow-600\" />\n <span className=\"text-sm font-semibold text-gray-900\">{workflowId}</span>\n </div>\n <p className=\"text-xs text-yellow-600\">{t('workflows.common.workflowNotFoundOrUnavailable')}</p>\n </>\n ) : (\n <>\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-gray-900\">\n {workflowDetails?.workflowName || workflowId}\n </span>\n {workflowDetails?.version !== undefined && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n v{workflowDetails.version}\n </Badge>\n )}\n {workflowDetails?.enabled !== undefined && (\n workflowDetails.enabled ? (\n <Badge variant=\"default\" className=\"bg-emerald-500 text-xs\">\n {t('common.enabled')}\n </Badge>\n ) : (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {t('common.disabled')}\n </Badge>\n )\n )}\n </div>\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5\">{workflowId}</p>\n </div>\n {workflowDetails?.description && (\n <p className=\"text-xs text-muted-foreground\">{workflowDetails.description}</p>\n )}\n </>\n )}\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center gap-2 ml-4 flex-shrink-0\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setIsModalOpen(true)}\n disabled={disabled}\n >\n <Search className=\"size-3 mr-1\" />\n {t('workflows.common.change')}\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleClear}\n disabled={disabled}\n >\n <X className=\"size-4\" />\n </Button>\n </div>\n </div>\n </div>\n )}\n\n {/* Workflow Selector Modal */}\n <WorkflowSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={handleSelect}\n excludeWorkflowIds={workflowId ? [workflowId] : []}\n title={t('workflows.fieldEditors.workflowSelector.selectSubWorkflow')}\n description={t('workflows.fieldEditors.workflowSelector.selectSubWorkflowDescription')}\n onlyEnabled={true}\n />\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA2HM,SAoCU,UAnCR,KADF;AAzHN,SAAS,UAAU,iBAAiB;AACpC,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,QAAQ,GAAG,SAAS,aAAa,gBAAgB;AAE1D,SAAS,wBAAiD;AAC1D,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AA2BhC,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AACf,GAA+B;AAC7B,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAC3D,QAAM,QAAQ,aAAa,EAAE,+CAA+C;AAC5E,QAAM,cAAc,mBAAmB,EAAE,qDAAqD;AAC9F,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAiC,IAAI;AAEnF,QAAM,aAAa,SAAS;AAG5B,YAAU,MAAM;AACd,QAAI,YAAY;AACd,yBAAmB,EAAE,YAAY,SAA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C3C,gBAAgB;AAAA,iBACpB;AAAA,cAED,iBAAiB,YAAY,WAC5B,gBAAgB,UACd,oBAAC,SAAM,SAAQ,WAAU,WAAU,0BAChC,YAAE,gBAAgB,GACrB,IAEA,oBAAC,SAAM,SAAQ,aAAY,WAAU,WAClC,YAAE,iBAAiB,GACtB;AAAA,eAGN;AAAA,YACA,oBAAC,OAAE,WAAU,kDAAkD,sBAAW;AAAA,aAC5E;AAAA,UACC,iBAAiB,eAChB,oBAAC,OAAE,WAAU,iCAAiC,0BAAgB,aAAY;AAAA,WAE9E,GAEJ;AAAA,QAGA,qBAAC,SAAI,WAAU,8CACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS,MAAM,eAAe,IAAI;AAAA,cAClC;AAAA,cAEA;AAAA,oCAAC,UAAO,WAAU,eAAc;AAAA,gBAC/B,EAAE,yBAAyB;AAAA;AAAA;AAAA,UAC9B;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS;AAAA,cACT;AAAA,cAEA,8BAAC,KAAE,WAAU,UAAS;AAAA;AAAA,UACxB;AAAA,WACF;AAAA,SACF,GACF;AAAA;AAAA,IAIF;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC,UAAU;AAAA,QACV,oBAAoB,aAAa,CAAC,UAAU,IAAI,CAAC;AAAA,QACjD,OAAO,EAAE,2DAA2D;AAAA,QACpE,aAAa,EAAE,sEAAsE;AAAA,QACrF,aAAa;AAAA;AAAA,IACf;AAAA,IACC;AAAA,KACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,6 +20,8 @@ import Link from "next/link";
|
|
|
20
20
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
21
21
|
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
22
22
|
import { deriveCurrentStep } from "./deriveCurrentStep.js";
|
|
23
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
24
|
+
const logger = createLogger("workflows");
|
|
23
25
|
function CheckoutDemoPage() {
|
|
24
26
|
const queryClient = useQueryClient();
|
|
25
27
|
const t = useT();
|
|
@@ -90,7 +92,7 @@ function CheckoutDemoPage() {
|
|
|
90
92
|
);
|
|
91
93
|
if (!response.ok) {
|
|
92
94
|
const errorData = await response.json().catch(() => ({}));
|
|
93
|
-
|
|
95
|
+
logger.error("User tasks request failed", { component: "UserTasks", errorData });
|
|
94
96
|
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
95
97
|
}
|
|
96
98
|
const data = await response.json();
|
|
@@ -341,7 +343,7 @@ function CheckoutDemoPage() {
|
|
|
341
343
|
context: data.data.instance.context
|
|
342
344
|
});
|
|
343
345
|
} catch (err) {
|
|
344
|
-
|
|
346
|
+
logger.error("Checkout failed", { err });
|
|
345
347
|
setError(err instanceof Error ? err.message : "An error occurred during checkout");
|
|
346
348
|
} finally {
|
|
347
349
|
setLoading(false);
|
|
@@ -374,7 +376,7 @@ function CheckoutDemoPage() {
|
|
|
374
376
|
context: data.data.instance.context
|
|
375
377
|
});
|
|
376
378
|
} catch (err) {
|
|
377
|
-
|
|
379
|
+
logger.error("Advance failed", { err });
|
|
378
380
|
setError(err instanceof Error ? err.message : "Failed to advance workflow");
|
|
379
381
|
} finally {
|
|
380
382
|
setAdvancing(false);
|
|
@@ -473,8 +475,7 @@ function CheckoutDemoPage() {
|
|
|
473
475
|
errorData = JSON.parse(responseText);
|
|
474
476
|
isJson = true;
|
|
475
477
|
} catch (parseError) {
|
|
476
|
-
|
|
477
|
-
console.error("[Signal] Raw response:", responseText);
|
|
478
|
+
logger.error("Signal response is not JSON", { component: "Signal", responseLength: responseText.length, err: parseError });
|
|
478
479
|
}
|
|
479
480
|
const errorMsg = isJson && errorData.error ? errorData.error : `HTTP ${response.status}: ${responseText.substring(0, 200) || "Failed to send signal"}`;
|
|
480
481
|
throw new Error(errorMsg);
|
|
@@ -489,7 +490,7 @@ function CheckoutDemoPage() {
|
|
|
489
490
|
await queryClient.invalidateQueries({ queryKey: ["workflow-events", result?.instanceId] });
|
|
490
491
|
setSignalError(null);
|
|
491
492
|
} catch (err) {
|
|
492
|
-
|
|
493
|
+
logger.error("Signal failed", { component: "Signal", err });
|
|
493
494
|
const errorMessage = err instanceof Error ? err.message : "Failed to send payment confirmation";
|
|
494
495
|
setSignalError(errorMessage);
|
|
495
496
|
} finally {
|
|
@@ -530,7 +531,7 @@ function CheckoutDemoPage() {
|
|
|
530
531
|
await queryClient.invalidateQueries({ queryKey: ["workflow-user-tasks", result?.instanceId] });
|
|
531
532
|
await queryClient.invalidateQueries({ queryKey: ["workflow-events", result?.instanceId] });
|
|
532
533
|
} catch (err) {
|
|
533
|
-
|
|
534
|
+
logger.error("Error completing task", { err });
|
|
534
535
|
setTaskError(err instanceof Error ? err.message : "Failed to complete task");
|
|
535
536
|
} finally {
|
|
536
537
|
setSubmittingTask(false);
|