@open-mercato/core 0.4.2-canary-15c0b23a3a → 0.4.2-canary-da2b080494
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/generated/entities.ids.generated.js +1 -5
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +0 -2
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/api_docs/frontend/docs/api/page.js +2 -3
- package/dist/modules/api_docs/frontend/docs/api/page.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/page.js +1 -1
- package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js +0 -4
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js +0 -2
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
- package/dist/modules/auth/api/admin/nav.js +3 -4
- package/dist/modules/auth/api/admin/nav.js.map +2 -2
- package/dist/modules/auth/api/reset/confirm.js +2 -25
- package/dist/modules/auth/api/reset/confirm.js.map +2 -2
- package/dist/modules/auth/api/reset.js +0 -23
- package/dist/modules/auth/api/reset.js.map +2 -2
- package/dist/modules/auth/api/sidebar/preferences/route.js +9 -14
- package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +2 -4
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/roles/[id]/edit/page.js +1 -4
- package/dist/modules/auth/backend/roles/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +3 -3
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.js +3 -18
- package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/users/create/page.js +2 -15
- package/dist/modules/auth/backend/users/create/page.js.map +2 -2
- package/dist/modules/auth/backend/users/page.js +3 -3
- package/dist/modules/auth/backend/users/page.js.map +2 -2
- package/dist/modules/auth/cli.js +11 -25
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/users.js +2 -59
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/data/validators.js +2 -4
- package/dist/modules/auth/data/validators.js.map +2 -2
- package/dist/modules/auth/frontend/reset/[token]/page.js +10 -20
- package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +0 -1
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/services/authService.js +3 -3
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/business_rules/api/execute/route.js +1 -7
- package/dist/modules/business_rules/api/execute/route.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/page.js +0 -4
- package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/page.js +0 -3
- package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-engine.js +3 -33
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +0 -2
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js +0 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
- package/dist/modules/configs/cli.js +0 -6
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/configs/components/CachePanel.js +4 -4
- package/dist/modules/configs/components/CachePanel.js.map +2 -2
- package/dist/modules/configs/lib/system-status.js +1 -48
- package/dist/modules/configs/lib/system-status.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +0 -18
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/page.js +0 -3
- package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js +0 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +0 -3
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +0 -3
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +0 -3
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +0 -31
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
- package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
- package/dist/modules/dashboards/cli.js +5 -44
- package/dist/modules/dashboards/cli.js.map +2 -2
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +11 -16
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +3 -3
- package/dist/modules/dashboards/services/widgetDataService.js +3 -132
- package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryTable.js +0 -2
- package/dist/modules/dictionaries/components/DictionaryTable.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
- package/dist/modules/entities/components/SystemEntitiesTable.js +1 -1
- package/dist/modules/entities/components/SystemEntitiesTable.js.map +2 -2
- package/dist/modules/entities/components/UserEntitiesTable.js +2 -2
- package/dist/modules/entities/components/UserEntitiesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +3 -3
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/OverridesTable.js +1 -1
- package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/query_index/components/QueryIndexesTable.js +1 -7
- package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +0 -2
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +0 -53
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +0 -26
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/components/AdjustmentKindSettings.js +2 -2
- package/dist/modules/sales/components/AdjustmentKindSettings.js.map +2 -2
- package/dist/modules/sales/components/PaymentMethodsSettings.js +2 -2
- package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/ShippingMethodsSettings.js +2 -2
- package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/TaxRatesSettings.js +2 -2
- package/dist/modules/sales/components/TaxRatesSettings.js.map +2 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js +0 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +1 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +0 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/page.js +1 -1
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +2 -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 +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/dist/modules/staff/commands/leave-requests.js +0 -79
- package/dist/modules/staff/commands/leave-requests.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/page.js +0 -5
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +0 -3
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +0 -3
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +6 -14
- package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
- package/generated/entities.ids.generated.ts +1 -5
- package/generated/entity-fields-registry.ts +0 -2
- package/package.json +2 -2
- package/src/modules/api_docs/frontend/docs/api/page.tsx +2 -3
- package/src/modules/api_keys/backend/api-keys/page.tsx +1 -1
- package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -4
- package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +0 -2
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/__tests__/cli-setup-acl.test.ts +1 -1
- package/src/modules/auth/api/admin/nav.ts +6 -10
- package/src/modules/auth/api/reset/confirm.ts +2 -25
- package/src/modules/auth/api/reset.ts +0 -23
- package/src/modules/auth/api/sidebar/preferences/route.ts +12 -21
- package/src/modules/auth/api/users/route.ts +2 -5
- package/src/modules/auth/backend/roles/[id]/edit/page.tsx +1 -4
- package/src/modules/auth/backend/roles/page.tsx +3 -3
- package/src/modules/auth/backend/users/[id]/edit/page.tsx +3 -22
- package/src/modules/auth/backend/users/create/page.tsx +2 -19
- package/src/modules/auth/backend/users/page.tsx +3 -3
- package/src/modules/auth/cli.ts +11 -38
- package/src/modules/auth/commands/users.ts +2 -73
- package/src/modules/auth/data/validators.ts +2 -5
- package/src/modules/auth/frontend/reset/[token]/page.tsx +11 -24
- package/src/modules/auth/i18n/de.json +1 -43
- package/src/modules/auth/i18n/en.json +1 -43
- package/src/modules/auth/i18n/es.json +1 -43
- package/src/modules/auth/i18n/pl.json +1 -43
- package/src/modules/auth/lib/setup-app.ts +0 -1
- package/src/modules/auth/services/authService.ts +4 -4
- package/src/modules/business_rules/api/execute/route.ts +1 -8
- package/src/modules/business_rules/backend/rules/page.tsx +0 -4
- package/src/modules/business_rules/backend/sets/page.tsx +0 -3
- package/src/modules/business_rules/i18n/en.json +1 -3
- package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +0 -51
- package/src/modules/business_rules/lib/rule-engine.ts +3 -57
- package/src/modules/catalog/components/PriceKindSettings.tsx +0 -2
- package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +2 -2
- package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -2
- package/src/modules/catalog/i18n/en.json +1 -3
- package/src/modules/configs/cli.ts +0 -6
- package/src/modules/configs/components/CachePanel.tsx +4 -4
- package/src/modules/configs/i18n/en.json +2 -12
- package/src/modules/configs/i18n/pl.json +2 -12
- package/src/modules/configs/lib/system-status.ts +1 -48
- package/src/modules/configs/lib/system-status.types.ts +0 -1
- package/src/modules/configs/lib/upgrade-actions.ts +0 -18
- package/src/modules/currencies/backend/currencies/page.tsx +0 -3
- package/src/modules/currencies/backend/exchange-rates/page.tsx +0 -2
- package/src/modules/customers/backend/customers/companies/page.tsx +0 -3
- package/src/modules/customers/backend/customers/deals/page.tsx +0 -3
- package/src/modules/customers/backend/customers/people/page.tsx +0 -3
- package/src/modules/customers/commands/deals.ts +0 -39
- package/src/modules/customers/components/CustomerTodosTable.tsx +0 -1
- package/src/modules/customers/i18n/en.json +1 -5
- package/src/modules/dashboards/cli.ts +5 -55
- package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +11 -22
- package/src/modules/dashboards/services/widgetDataService.ts +4 -157
- package/src/modules/dictionaries/components/DictionaryTable.tsx +0 -2
- package/src/modules/directory/backend/directory/organizations/page.tsx +2 -2
- package/src/modules/directory/backend/directory/tenants/page.tsx +2 -2
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +2 -2
- package/src/modules/entities/components/SystemEntitiesTable.tsx +1 -1
- package/src/modules/entities/components/UserEntitiesTable.tsx +2 -2
- package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +4 -3
- package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -1
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +2 -2
- package/src/modules/query_index/components/QueryIndexesTable.tsx +2 -8
- package/src/modules/resources/backend/resources/resource-types/page.tsx +2 -2
- package/src/modules/resources/backend/resources/resources/page.tsx +2 -2
- package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -2
- package/src/modules/sales/backend/sales/channels/page.tsx +0 -2
- package/src/modules/sales/commands/documents.ts +0 -65
- package/src/modules/sales/commands/payments.ts +0 -33
- package/src/modules/sales/components/AdjustmentKindSettings.tsx +2 -2
- package/src/modules/sales/components/PaymentMethodsSettings.tsx +2 -2
- package/src/modules/sales/components/ShippingMethodsSettings.tsx +2 -2
- package/src/modules/sales/components/TaxRatesSettings.tsx +2 -2
- package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -2
- package/src/modules/sales/components/documents/AdjustmentsSection.tsx +0 -2
- package/src/modules/sales/components/documents/PaymentsSection.tsx +1 -2
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +0 -2
- package/src/modules/sales/i18n/de.json +0 -20
- package/src/modules/sales/i18n/en.json +1 -25
- package/src/modules/sales/i18n/es.json +0 -20
- package/src/modules/sales/i18n/pl.json +0 -20
- package/src/modules/staff/backend/staff/team-members/page.tsx +1 -1
- package/src/modules/staff/backend/staff/team-roles/page.tsx +2 -2
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +2 -2
- package/src/modules/staff/backend/staff/teams/page.tsx +2 -2
- package/src/modules/staff/commands/leave-requests.ts +0 -94
- package/src/modules/staff/i18n/de.json +0 -4
- package/src/modules/staff/i18n/en.json +1 -9
- package/src/modules/staff/i18n/es.json +0 -4
- package/src/modules/staff/i18n/pl.json +0 -4
- package/src/modules/workflows/backend/definitions/page.tsx +0 -5
- package/src/modules/workflows/backend/instances/page.tsx +1 -4
- package/src/modules/workflows/backend/tasks/page.tsx +1 -4
- package/src/modules/workflows/i18n/en.json +1 -3
- package/src/modules/workflows/lib/transition-handler.ts +6 -18
- package/dist/generated/entities/notification/index.js +0 -57
- package/dist/generated/entities/notification/index.js.map +0 -7
- package/dist/modules/auth/api/profile/route.js +0 -157
- package/dist/modules/auth/api/profile/route.js.map +0 -7
- package/dist/modules/auth/backend/auth/profile/page.js +0 -141
- package/dist/modules/auth/backend/auth/profile/page.js.map +0 -7
- package/dist/modules/auth/backend/auth/profile/page.meta.js +0 -13
- package/dist/modules/auth/backend/auth/profile/page.meta.js.map +0 -7
- package/dist/modules/auth/notifications.js +0 -112
- package/dist/modules/auth/notifications.js.map +0 -7
- package/dist/modules/business_rules/notifications.js +0 -28
- package/dist/modules/business_rules/notifications.js.map +0 -7
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +0 -37
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +0 -7
- package/dist/modules/catalog/notifications.js +0 -28
- package/dist/modules/catalog/notifications.js.map +0 -7
- package/dist/modules/catalog/subscribers/low-stock-notification.js +0 -38
- package/dist/modules/catalog/subscribers/low-stock-notification.js.map +0 -7
- package/dist/modules/customers/notifications.js +0 -48
- package/dist/modules/customers/notifications.js.map +0 -7
- package/dist/modules/dashboards/lib/role-widgets.js +0 -58
- package/dist/modules/dashboards/lib/role-widgets.js.map +0 -7
- package/dist/modules/notifications/acl.js +0 -11
- package/dist/modules/notifications/acl.js.map +0 -7
- package/dist/modules/notifications/api/[id]/action/route.js +0 -74
- package/dist/modules/notifications/api/[id]/action/route.js.map +0 -7
- package/dist/modules/notifications/api/[id]/dismiss/route.js +0 -15
- package/dist/modules/notifications/api/[id]/dismiss/route.js.map +0 -7
- package/dist/modules/notifications/api/[id]/read/route.js +0 -15
- package/dist/modules/notifications/api/[id]/read/route.js.map +0 -7
- package/dist/modules/notifications/api/[id]/restore/route.js +0 -53
- package/dist/modules/notifications/api/[id]/restore/route.js.map +0 -7
- package/dist/modules/notifications/api/batch/route.js +0 -17
- package/dist/modules/notifications/api/batch/route.js.map +0 -7
- package/dist/modules/notifications/api/feature/route.js +0 -17
- package/dist/modules/notifications/api/feature/route.js.map +0 -7
- package/dist/modules/notifications/api/mark-all-read/route.js +0 -35
- package/dist/modules/notifications/api/mark-all-read/route.js.map +0 -7
- package/dist/modules/notifications/api/openapi.js +0 -76
- package/dist/modules/notifications/api/openapi.js.map +0 -7
- package/dist/modules/notifications/api/role/route.js +0 -17
- package/dist/modules/notifications/api/role/route.js.map +0 -7
- package/dist/modules/notifications/api/route.js +0 -85
- package/dist/modules/notifications/api/route.js.map +0 -7
- package/dist/modules/notifications/api/settings/route.js +0 -155
- package/dist/modules/notifications/api/settings/route.js.map +0 -7
- package/dist/modules/notifications/api/unread-count/route.js +0 -38
- package/dist/modules/notifications/api/unread-count/route.js.map +0 -7
- package/dist/modules/notifications/backend/config/notifications/page.js +0 -10
- package/dist/modules/notifications/backend/config/notifications/page.js.map +0 -7
- package/dist/modules/notifications/backend/config/notifications/page.meta.js +0 -24
- package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +0 -7
- package/dist/modules/notifications/cli.js +0 -16
- package/dist/modules/notifications/cli.js.map +0 -7
- package/dist/modules/notifications/data/entities.js +0 -112
- package/dist/modules/notifications/data/entities.js.map +0 -7
- package/dist/modules/notifications/data/validators.js +0 -98
- package/dist/modules/notifications/data/validators.js.map +0 -7
- package/dist/modules/notifications/di.js +0 -13
- package/dist/modules/notifications/di.js.map +0 -7
- package/dist/modules/notifications/emails/NotificationEmail.js +0 -58
- package/dist/modules/notifications/emails/NotificationEmail.js.map +0 -7
- package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +0 -44
- package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +0 -7
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +0 -220
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +0 -7
- package/dist/modules/notifications/index.js +0 -14
- package/dist/modules/notifications/index.js.map +0 -7
- package/dist/modules/notifications/lib/deliveryConfig.js +0 -107
- package/dist/modules/notifications/lib/deliveryConfig.js.map +0 -7
- package/dist/modules/notifications/lib/deliveryStrategies.js +0 -14
- package/dist/modules/notifications/lib/deliveryStrategies.js.map +0 -7
- package/dist/modules/notifications/lib/events.js +0 -12
- package/dist/modules/notifications/lib/events.js.map +0 -7
- package/dist/modules/notifications/lib/notificationBuilder.js +0 -66
- package/dist/modules/notifications/lib/notificationBuilder.js.map +0 -7
- package/dist/modules/notifications/lib/notificationFactory.js +0 -54
- package/dist/modules/notifications/lib/notificationFactory.js.map +0 -7
- package/dist/modules/notifications/lib/notificationMapper.js +0 -34
- package/dist/modules/notifications/lib/notificationMapper.js.map +0 -7
- package/dist/modules/notifications/lib/notificationRecipients.js +0 -35
- package/dist/modules/notifications/lib/notificationRecipients.js.map +0 -7
- package/dist/modules/notifications/lib/notificationService.js +0 -279
- package/dist/modules/notifications/lib/notificationService.js.map +0 -7
- package/dist/modules/notifications/lib/routeHelpers.js +0 -101
- package/dist/modules/notifications/lib/routeHelpers.js.map +0 -7
- package/dist/modules/notifications/lib/safeHref.js +0 -24
- package/dist/modules/notifications/lib/safeHref.js.map +0 -7
- package/dist/modules/notifications/migrations/Migration20260123000001.js +0 -70
- package/dist/modules/notifications/migrations/Migration20260123000001.js.map +0 -7
- package/dist/modules/notifications/migrations/Migration20260126150000.js +0 -37
- package/dist/modules/notifications/migrations/Migration20260126150000.js.map +0 -7
- package/dist/modules/notifications/subscribers/deliver-notification.js +0 -165
- package/dist/modules/notifications/subscribers/deliver-notification.js.map +0 -7
- package/dist/modules/notifications/workers/create-notification.worker.js +0 -70
- package/dist/modules/notifications/workers/create-notification.worker.js.map +0 -7
- package/dist/modules/sales/notifications.client.js +0 -51
- package/dist/modules/sales/notifications.client.js.map +0 -7
- package/dist/modules/sales/notifications.js +0 -88
- package/dist/modules/sales/notifications.js.map +0 -7
- package/dist/modules/sales/subscribers/quote-expiring-notification.js +0 -38
- package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +0 -137
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +0 -137
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/index.js +0 -7
- package/dist/modules/sales/widgets/notifications/index.js.map +0 -7
- package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +0 -60
- package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +0 -7
- package/dist/modules/staff/notifications.js +0 -75
- package/dist/modules/staff/notifications.js.map +0 -7
- package/dist/modules/workflows/notifications.js +0 -28
- package/dist/modules/workflows/notifications.js.map +0 -7
- package/dist/modules/workflows/subscribers/task-assigned-notification.js +0 -38
- package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +0 -7
- package/generated/entities/notification/index.ts +0 -27
- package/src/modules/auth/api/profile/route.ts +0 -163
- package/src/modules/auth/backend/auth/profile/page.meta.ts +0 -9
- package/src/modules/auth/backend/auth/profile/page.tsx +0 -174
- package/src/modules/auth/notifications.ts +0 -109
- package/src/modules/business_rules/notifications.ts +0 -25
- package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +0 -50
- package/src/modules/catalog/notifications.ts +0 -25
- package/src/modules/catalog/subscribers/low-stock-notification.ts +0 -52
- package/src/modules/customers/notifications.ts +0 -44
- package/src/modules/dashboards/lib/role-widgets.ts +0 -80
- package/src/modules/notifications/__tests__/deliver-notification.test.ts +0 -195
- package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +0 -19
- package/src/modules/notifications/__tests__/notificationService.test.ts +0 -208
- package/src/modules/notifications/acl.ts +0 -7
- package/src/modules/notifications/api/[id]/action/route.ts +0 -75
- package/src/modules/notifications/api/[id]/dismiss/route.ts +0 -12
- package/src/modules/notifications/api/[id]/read/route.ts +0 -12
- package/src/modules/notifications/api/[id]/restore/route.ts +0 -53
- package/src/modules/notifications/api/batch/route.ts +0 -14
- package/src/modules/notifications/api/feature/route.ts +0 -14
- package/src/modules/notifications/api/mark-all-read/route.ts +0 -34
- package/src/modules/notifications/api/openapi.ts +0 -76
- package/src/modules/notifications/api/role/route.ts +0 -14
- package/src/modules/notifications/api/route.ts +0 -92
- package/src/modules/notifications/api/settings/route.ts +0 -157
- package/src/modules/notifications/api/unread-count/route.ts +0 -38
- package/src/modules/notifications/backend/config/notifications/page.meta.ts +0 -22
- package/src/modules/notifications/backend/config/notifications/page.tsx +0 -12
- package/src/modules/notifications/cli.ts +0 -18
- package/src/modules/notifications/data/entities.ts +0 -99
- package/src/modules/notifications/data/validators.ts +0 -115
- package/src/modules/notifications/di.ts +0 -11
- package/src/modules/notifications/emails/NotificationEmail.tsx +0 -98
- package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +0 -42
- package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +0 -233
- package/src/modules/notifications/i18n/de.json +0 -50
- package/src/modules/notifications/i18n/en.json +0 -50
- package/src/modules/notifications/i18n/es.json +0 -50
- package/src/modules/notifications/i18n/pl.json +0 -50
- package/src/modules/notifications/index.ts +0 -12
- package/src/modules/notifications/lib/deliveryConfig.ts +0 -153
- package/src/modules/notifications/lib/deliveryStrategies.ts +0 -50
- package/src/modules/notifications/lib/events.ts +0 -48
- package/src/modules/notifications/lib/notificationBuilder.ts +0 -121
- package/src/modules/notifications/lib/notificationFactory.ts +0 -76
- package/src/modules/notifications/lib/notificationMapper.ts +0 -33
- package/src/modules/notifications/lib/notificationRecipients.ts +0 -83
- package/src/modules/notifications/lib/notificationService.ts +0 -414
- package/src/modules/notifications/lib/routeHelpers.ts +0 -151
- package/src/modules/notifications/lib/safeHref.ts +0 -29
- package/src/modules/notifications/migrations/.snapshot-open-mercato.json +0 -300
- package/src/modules/notifications/migrations/Migration20260123000001.ts +0 -73
- package/src/modules/notifications/migrations/Migration20260126150000.ts +0 -39
- package/src/modules/notifications/subscribers/deliver-notification.ts +0 -204
- package/src/modules/notifications/workers/create-notification.worker.ts +0 -122
- package/src/modules/sales/notifications.client.ts +0 -65
- package/src/modules/sales/notifications.ts +0 -82
- package/src/modules/sales/subscribers/quote-expiring-notification.ts +0 -53
- package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +0 -156
- package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +0 -156
- package/src/modules/sales/widgets/notifications/index.ts +0 -2
- package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +0 -81
- package/src/modules/staff/notifications.ts +0 -71
- package/src/modules/workflows/notifications.ts +0 -25
- package/src/modules/workflows/subscribers/task-assigned-notification.ts +0 -53
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from "next/server";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
|
|
4
|
-
import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
|
|
5
|
-
import { signJwt } from "@open-mercato/shared/lib/auth/jwt";
|
|
6
|
-
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
7
|
-
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
8
|
-
import { User } from "@open-mercato/core/modules/auth/data/entities";
|
|
9
|
-
import { findOneWithDecryption } from "@open-mercato/shared/lib/encryption/find";
|
|
10
|
-
import { buildPasswordSchema } from "@open-mercato/shared/lib/auth/passwordPolicy";
|
|
11
|
-
const profileResponseSchema = z.object({
|
|
12
|
-
email: z.string().email()
|
|
13
|
-
});
|
|
14
|
-
const passwordSchema = buildPasswordSchema();
|
|
15
|
-
const updateSchema = z.object({
|
|
16
|
-
email: z.string().email().optional(),
|
|
17
|
-
password: passwordSchema.optional()
|
|
18
|
-
}).refine((data) => Boolean(data.email || data.password), {
|
|
19
|
-
message: "Provide an email or password.",
|
|
20
|
-
path: ["email"]
|
|
21
|
-
});
|
|
22
|
-
const profileUpdateResponseSchema = z.object({
|
|
23
|
-
ok: z.literal(true),
|
|
24
|
-
email: z.string().email()
|
|
25
|
-
});
|
|
26
|
-
const metadata = {
|
|
27
|
-
GET: { requireAuth: true },
|
|
28
|
-
PUT: { requireAuth: true }
|
|
29
|
-
};
|
|
30
|
-
function buildCommandContext(container, auth, req) {
|
|
31
|
-
return {
|
|
32
|
-
container,
|
|
33
|
-
auth,
|
|
34
|
-
organizationScope: null,
|
|
35
|
-
selectedOrganizationId: auth.orgId ?? null,
|
|
36
|
-
organizationIds: auth.orgId ? [auth.orgId] : null,
|
|
37
|
-
request: req
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
async function GET(req) {
|
|
41
|
-
const { translate } = await resolveTranslations();
|
|
42
|
-
const auth = await getAuthFromRequest(req);
|
|
43
|
-
if (!auth?.sub) {
|
|
44
|
-
return NextResponse.json({ error: translate("api.errors.unauthorized", "Unauthorized") }, { status: 401 });
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const container = await createRequestContainer();
|
|
48
|
-
const em = container.resolve("em");
|
|
49
|
-
const user = await findOneWithDecryption(
|
|
50
|
-
em,
|
|
51
|
-
User,
|
|
52
|
-
{ id: auth.sub, deletedAt: null },
|
|
53
|
-
void 0,
|
|
54
|
-
{ tenantId: auth.tenantId ?? null, organizationId: auth.orgId ?? null }
|
|
55
|
-
);
|
|
56
|
-
if (!user) {
|
|
57
|
-
return NextResponse.json({ error: translate("auth.users.form.errors.notFound", "User not found") }, { status: 404 });
|
|
58
|
-
}
|
|
59
|
-
return NextResponse.json({ email: String(user.email) });
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error("auth.profile.load failed", err);
|
|
62
|
-
return NextResponse.json({ error: translate("auth.profile.form.errors.load", "Failed to load profile.") }, { status: 400 });
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async function PUT(req) {
|
|
66
|
-
const { translate } = await resolveTranslations();
|
|
67
|
-
const auth = await getAuthFromRequest(req);
|
|
68
|
-
if (!auth?.sub) {
|
|
69
|
-
return NextResponse.json({ error: translate("api.errors.unauthorized", "Unauthorized") }, { status: 401 });
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
const body = await req.json().catch(() => ({}));
|
|
73
|
-
const parsed = updateSchema.safeParse(body);
|
|
74
|
-
if (!parsed.success) {
|
|
75
|
-
return NextResponse.json(
|
|
76
|
-
{
|
|
77
|
-
error: translate("auth.profile.form.errors.invalid", "Invalid profile update."),
|
|
78
|
-
issues: parsed.error.issues
|
|
79
|
-
},
|
|
80
|
-
{ status: 400 }
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
const container = await createRequestContainer();
|
|
84
|
-
const commandBus = container.resolve("commandBus");
|
|
85
|
-
const ctx = buildCommandContext(container, auth, req);
|
|
86
|
-
const { result } = await commandBus.execute(
|
|
87
|
-
"auth.users.update",
|
|
88
|
-
{
|
|
89
|
-
input: {
|
|
90
|
-
id: auth.sub,
|
|
91
|
-
email: parsed.data.email,
|
|
92
|
-
password: parsed.data.password
|
|
93
|
-
},
|
|
94
|
-
ctx
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
const authService = container.resolve("authService");
|
|
98
|
-
const roles = await authService.getUserRoles(result, result.tenantId ? String(result.tenantId) : null);
|
|
99
|
-
const jwt = signJwt({
|
|
100
|
-
sub: String(result.id),
|
|
101
|
-
tenantId: result.tenantId ? String(result.tenantId) : null,
|
|
102
|
-
orgId: result.organizationId ? String(result.organizationId) : null,
|
|
103
|
-
email: result.email,
|
|
104
|
-
roles
|
|
105
|
-
});
|
|
106
|
-
const res = NextResponse.json({ ok: true, email: String(result.email) });
|
|
107
|
-
res.cookies.set("auth_token", jwt, {
|
|
108
|
-
httpOnly: true,
|
|
109
|
-
path: "/",
|
|
110
|
-
sameSite: "lax",
|
|
111
|
-
secure: process.env.NODE_ENV === "production",
|
|
112
|
-
maxAge: 60 * 60 * 8
|
|
113
|
-
});
|
|
114
|
-
return res;
|
|
115
|
-
} catch (err) {
|
|
116
|
-
if (err instanceof CrudHttpError) {
|
|
117
|
-
return NextResponse.json(err.body, { status: err.status });
|
|
118
|
-
}
|
|
119
|
-
console.error("auth.profile.update failed", err);
|
|
120
|
-
return NextResponse.json({ error: translate("auth.profile.form.errors.save", "Failed to update profile.") }, { status: 400 });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const openApi = {
|
|
124
|
-
tag: "Authentication & Accounts",
|
|
125
|
-
summary: "Profile settings",
|
|
126
|
-
methods: {
|
|
127
|
-
GET: {
|
|
128
|
-
summary: "Get current profile",
|
|
129
|
-
description: "Returns the email address for the signed-in user.",
|
|
130
|
-
responses: [
|
|
131
|
-
{ status: 200, description: "Profile payload", schema: profileResponseSchema },
|
|
132
|
-
{ status: 401, description: "Unauthorized", schema: z.object({ error: z.string() }) },
|
|
133
|
-
{ status: 404, description: "User not found", schema: z.object({ error: z.string() }) }
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
PUT: {
|
|
137
|
-
summary: "Update current profile",
|
|
138
|
-
description: "Updates the email address or password for the signed-in user.",
|
|
139
|
-
requestBody: {
|
|
140
|
-
contentType: "application/json",
|
|
141
|
-
schema: updateSchema
|
|
142
|
-
},
|
|
143
|
-
responses: [
|
|
144
|
-
{ status: 200, description: "Profile updated", schema: profileUpdateResponseSchema },
|
|
145
|
-
{ status: 400, description: "Invalid payload", schema: z.object({ error: z.string() }) },
|
|
146
|
-
{ status: 401, description: "Unauthorized", schema: z.object({ error: z.string() }) }
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
export {
|
|
152
|
-
GET,
|
|
153
|
-
PUT,
|
|
154
|
-
metadata,
|
|
155
|
-
openApi
|
|
156
|
-
};
|
|
157
|
-
//# sourceMappingURL=route.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/auth/api/profile/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { signJwt } from '@open-mercato/shared/lib/auth/jwt'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { AuthService } from '@open-mercato/core/modules/auth/services/authService'\nimport { User } from '@open-mercato/core/modules/auth/data/entities'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { buildPasswordSchema } from '@open-mercato/shared/lib/auth/passwordPolicy'\n\nconst profileResponseSchema = z.object({\n email: z.string().email(),\n})\n\nconst passwordSchema = buildPasswordSchema()\n\nconst updateSchema = z.object({\n email: z.string().email().optional(),\n password: passwordSchema.optional(),\n}).refine((data) => Boolean(data.email || data.password), {\n message: 'Provide an email or password.',\n path: ['email'],\n})\n\nconst profileUpdateResponseSchema = z.object({\n ok: z.literal(true),\n email: z.string().email(),\n})\n\nexport const metadata = {\n GET: { requireAuth: true },\n PUT: { requireAuth: true },\n}\n\nfunction buildCommandContext(container: Awaited<ReturnType<typeof createRequestContainer>>, auth: NonNullable<Awaited<ReturnType<typeof getAuthFromRequest>>>, req: Request): CommandRuntimeContext {\n return {\n container,\n auth,\n organizationScope: null,\n selectedOrganizationId: auth.orgId ?? null,\n organizationIds: auth.orgId ? [auth.orgId] : null,\n request: req,\n }\n}\n\nexport async function GET(req: Request) {\n const { translate } = await resolveTranslations()\n const auth = await getAuthFromRequest(req)\n if (!auth?.sub) {\n return NextResponse.json({ error: translate('api.errors.unauthorized', 'Unauthorized') }, { status: 401 })\n }\n try {\n const container = await createRequestContainer()\n const em = (container.resolve('em') as EntityManager)\n const user = await findOneWithDecryption(\n em,\n User,\n { id: auth.sub, deletedAt: null },\n undefined,\n { tenantId: auth.tenantId ?? null, organizationId: auth.orgId ?? null },\n )\n if (!user) {\n return NextResponse.json({ error: translate('auth.users.form.errors.notFound', 'User not found') }, { status: 404 })\n }\n return NextResponse.json({ email: String(user.email) })\n } catch (err) {\n console.error('auth.profile.load failed', err)\n return NextResponse.json({ error: translate('auth.profile.form.errors.load', 'Failed to load profile.') }, { status: 400 })\n }\n}\n\nexport async function PUT(req: Request) {\n const { translate } = await resolveTranslations()\n const auth = await getAuthFromRequest(req)\n if (!auth?.sub) {\n return NextResponse.json({ error: translate('api.errors.unauthorized', 'Unauthorized') }, { status: 401 })\n }\n try {\n const body = await req.json().catch(() => ({}))\n const parsed = updateSchema.safeParse(body)\n if (!parsed.success) {\n return NextResponse.json(\n {\n error: translate('auth.profile.form.errors.invalid', 'Invalid profile update.'),\n issues: parsed.error.issues,\n },\n { status: 400 },\n )\n }\n const container = await createRequestContainer()\n const commandBus = (container.resolve('commandBus') as CommandBus)\n const ctx = buildCommandContext(container, auth, req)\n const { result } = await commandBus.execute<{ id: string; email?: string; password?: string }, User>(\n 'auth.users.update',\n {\n input: {\n id: auth.sub,\n email: parsed.data.email,\n password: parsed.data.password,\n },\n ctx,\n },\n )\n const authService = container.resolve('authService') as AuthService\n const roles = await authService.getUserRoles(result, result.tenantId ? String(result.tenantId) : null)\n const jwt = signJwt({\n sub: String(result.id),\n tenantId: result.tenantId ? String(result.tenantId) : null,\n orgId: result.organizationId ? String(result.organizationId) : null,\n email: result.email,\n roles,\n })\n const res = NextResponse.json({ ok: true, email: String(result.email) })\n res.cookies.set('auth_token', jwt, {\n httpOnly: true,\n path: '/',\n sameSite: 'lax',\n secure: process.env.NODE_ENV === 'production',\n maxAge: 60 * 60 * 8,\n })\n return res\n } catch (err) {\n if (err instanceof CrudHttpError) {\n return NextResponse.json(err.body, { status: err.status })\n }\n console.error('auth.profile.update failed', err)\n return NextResponse.json({ error: translate('auth.profile.form.errors.save', 'Failed to update profile.') }, { status: 400 })\n }\n}\n\nexport const openApi: OpenApiRouteDoc = {\n tag: 'Authentication & Accounts',\n summary: 'Profile settings',\n methods: {\n GET: {\n summary: 'Get current profile',\n description: 'Returns the email address for the signed-in user.',\n responses: [\n { status: 200, description: 'Profile payload', schema: profileResponseSchema },\n { status: 401, description: 'Unauthorized', schema: z.object({ error: z.string() }) },\n { status: 404, description: 'User not found', schema: z.object({ error: z.string() }) },\n ],\n },\n PUT: {\n summary: 'Update current profile',\n description: 'Updates the email address or password for the signed-in user.',\n requestBody: {\n contentType: 'application/json',\n schema: updateSchema,\n },\n responses: [\n { status: 200, description: 'Profile updated', schema: profileUpdateResponseSchema },\n { status: 400, description: 'Invalid payload', schema: z.object({ error: z.string() }) },\n { status: 401, description: 'Unauthorized', schema: z.object({ error: z.string() }) },\n ],\n },\n },\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SA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,EACL,SAAS;AAAA,EACT,SAAS;AAAA,IACP,KAAK;AAAA,MACH,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,QACT,EAAE,QAAQ,KAAK,aAAa,mBAAmB,QAAQ,sBAAsB;AAAA,QAC7E,EAAE,QAAQ,KAAK,aAAa,gBAAgB,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAAA,QACpF,EAAE,QAAQ,KAAK,aAAa,kBAAkB,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAAA,MACxF;AAAA,IACF;AAAA,IACA,KAAK;AAAA,MACH,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACX,aAAa;AAAA,QACb,QAAQ;AAAA,MACV;AAAA,MACA,WAAW;AAAA,QACT,EAAE,QAAQ,KAAK,aAAa,mBAAmB,QAAQ,4BAA4B;AAAA,QACnF,EAAE,QAAQ,KAAK,aAAa,mBAAmB,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAAA,QACvF,EAAE,QAAQ,KAAK,aAAa,gBAAgB,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAAA,MACtF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { useRouter } from "next/navigation";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
import { Save } from "lucide-react";
|
|
7
|
-
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
8
|
-
import { CrudForm } from "@open-mercato/ui/backend/CrudForm";
|
|
9
|
-
import { apiCall, readApiResultOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
|
|
10
|
-
import { createCrudFormError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
11
|
-
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
12
|
-
import { LoadingMessage, ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
13
|
-
import { Button } from "@open-mercato/ui/primitives/button";
|
|
14
|
-
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
15
|
-
import { buildPasswordSchema, formatPasswordRequirements, getPasswordPolicy } from "@open-mercato/shared/lib/auth/passwordPolicy";
|
|
16
|
-
function AuthProfilePage() {
|
|
17
|
-
const t = useT();
|
|
18
|
-
const router = useRouter();
|
|
19
|
-
const [loading, setLoading] = React.useState(true);
|
|
20
|
-
const [error, setError] = React.useState(null);
|
|
21
|
-
const [email, setEmail] = React.useState("");
|
|
22
|
-
const [formKey, setFormKey] = React.useState(0);
|
|
23
|
-
const formId = React.useId();
|
|
24
|
-
const passwordPolicy = React.useMemo(() => getPasswordPolicy(), []);
|
|
25
|
-
const passwordRequirements = React.useMemo(
|
|
26
|
-
() => formatPasswordRequirements(passwordPolicy, t),
|
|
27
|
-
[passwordPolicy, t]
|
|
28
|
-
);
|
|
29
|
-
const passwordDescription = React.useMemo(() => passwordRequirements ? t("auth.password.requirements.help", "Password requirements: {requirements}", { requirements: passwordRequirements }) : void 0, [passwordRequirements, t]);
|
|
30
|
-
React.useEffect(() => {
|
|
31
|
-
let cancelled = false;
|
|
32
|
-
async function load() {
|
|
33
|
-
setLoading(true);
|
|
34
|
-
setError(null);
|
|
35
|
-
try {
|
|
36
|
-
const { ok, result } = await apiCall("/api/auth/profile");
|
|
37
|
-
if (!ok) throw new Error("load_failed");
|
|
38
|
-
const resolvedEmail = typeof result?.email === "string" ? result.email : "";
|
|
39
|
-
if (!cancelled) setEmail(resolvedEmail);
|
|
40
|
-
} catch (err) {
|
|
41
|
-
console.error("Failed to load auth profile", err);
|
|
42
|
-
if (!cancelled) setError(t("auth.profile.form.errors.load", "Failed to load profile."));
|
|
43
|
-
} finally {
|
|
44
|
-
if (!cancelled) setLoading(false);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
load();
|
|
48
|
-
return () => {
|
|
49
|
-
cancelled = true;
|
|
50
|
-
};
|
|
51
|
-
}, [t]);
|
|
52
|
-
const fields = React.useMemo(() => [
|
|
53
|
-
{ id: "email", label: t("auth.profile.form.email", "Email"), type: "text", required: true },
|
|
54
|
-
{
|
|
55
|
-
id: "password",
|
|
56
|
-
label: t("auth.profile.form.password", "New password"),
|
|
57
|
-
type: "text",
|
|
58
|
-
description: passwordDescription
|
|
59
|
-
},
|
|
60
|
-
{ id: "confirmPassword", label: t("auth.profile.form.confirmPassword", "Confirm new password"), type: "text" }
|
|
61
|
-
], [passwordDescription, t]);
|
|
62
|
-
const schema = React.useMemo(() => {
|
|
63
|
-
const passwordSchema = buildPasswordSchema({
|
|
64
|
-
policy: passwordPolicy,
|
|
65
|
-
message: t("auth.profile.form.errors.passwordRequirements", "Password must meet the requirements.")
|
|
66
|
-
});
|
|
67
|
-
const optionalPasswordSchema = z.union([z.literal(""), passwordSchema]).optional();
|
|
68
|
-
return z.object({
|
|
69
|
-
email: z.string().trim().min(1, t("auth.profile.form.errors.emailRequired", "Email is required.")),
|
|
70
|
-
password: optionalPasswordSchema,
|
|
71
|
-
confirmPassword: z.string().optional()
|
|
72
|
-
}).superRefine((values, ctx) => {
|
|
73
|
-
const password = values.password?.trim() ?? "";
|
|
74
|
-
const confirmPassword = values.confirmPassword?.trim() ?? "";
|
|
75
|
-
if ((password || confirmPassword) && password !== confirmPassword) {
|
|
76
|
-
ctx.addIssue({
|
|
77
|
-
code: z.ZodIssueCode.custom,
|
|
78
|
-
message: t("auth.profile.form.errors.passwordMismatch", "Passwords do not match."),
|
|
79
|
-
path: ["confirmPassword"]
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}, [passwordPolicy, t]);
|
|
84
|
-
const handleSubmit = React.useCallback(async (values) => {
|
|
85
|
-
const nextEmail = values.email?.trim() ?? "";
|
|
86
|
-
const password = values.password?.trim() ?? "";
|
|
87
|
-
if (!password && nextEmail === email) {
|
|
88
|
-
throw createCrudFormError(t("auth.profile.form.errors.noChanges", "No changes to save."));
|
|
89
|
-
}
|
|
90
|
-
const payload = { email: nextEmail };
|
|
91
|
-
if (password) payload.password = password;
|
|
92
|
-
const result = await readApiResultOrThrow(
|
|
93
|
-
"/api/auth/profile",
|
|
94
|
-
{
|
|
95
|
-
method: "PUT",
|
|
96
|
-
headers: { "content-type": "application/json" },
|
|
97
|
-
body: JSON.stringify(payload)
|
|
98
|
-
},
|
|
99
|
-
{ errorMessage: t("auth.profile.form.errors.save", "Failed to update profile.") }
|
|
100
|
-
);
|
|
101
|
-
const resolvedEmail = typeof result?.email === "string" ? result.email : nextEmail;
|
|
102
|
-
setEmail(resolvedEmail);
|
|
103
|
-
setFormKey((prev) => prev + 1);
|
|
104
|
-
flash(t("auth.profile.form.success", "Profile updated."), "success");
|
|
105
|
-
router.refresh();
|
|
106
|
-
}, [email, router, t]);
|
|
107
|
-
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: loading ? /* @__PURE__ */ jsx(LoadingMessage, { label: t("auth.profile.form.loading", "Loading profile...") }) : error ? /* @__PURE__ */ jsx(ErrorMessage, { label: error }) : /* @__PURE__ */ jsxs("section", { className: "space-y-6 rounded-lg border bg-background p-6", children: [
|
|
108
|
-
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
109
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
110
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("auth.profile.title", "Profile") }),
|
|
111
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.profile.subtitle", "Change password") })
|
|
112
|
-
] }),
|
|
113
|
-
/* @__PURE__ */ jsxs(Button, { type: "submit", form: formId, children: [
|
|
114
|
-
/* @__PURE__ */ jsx(Save, { className: "size-4 mr-2" }),
|
|
115
|
-
t("auth.profile.form.save", "Save changes")
|
|
116
|
-
] })
|
|
117
|
-
] }),
|
|
118
|
-
/* @__PURE__ */ jsx(
|
|
119
|
-
CrudForm,
|
|
120
|
-
{
|
|
121
|
-
formId,
|
|
122
|
-
schema,
|
|
123
|
-
fields,
|
|
124
|
-
initialValues: {
|
|
125
|
-
email,
|
|
126
|
-
password: "",
|
|
127
|
-
confirmPassword: ""
|
|
128
|
-
},
|
|
129
|
-
submitLabel: t("auth.profile.form.save", "Save changes"),
|
|
130
|
-
onSubmit: handleSubmit,
|
|
131
|
-
embedded: true,
|
|
132
|
-
hideFooterActions: true
|
|
133
|
-
},
|
|
134
|
-
formKey
|
|
135
|
-
)
|
|
136
|
-
] }) }) });
|
|
137
|
-
}
|
|
138
|
-
export {
|
|
139
|
-
AuthProfilePage as default
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=page.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/auth/backend/auth/profile/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useRouter } from 'next/navigation'\nimport { z } from 'zod'\nimport { Save } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { buildPasswordSchema, formatPasswordRequirements, getPasswordPolicy } from '@open-mercato/shared/lib/auth/passwordPolicy'\n\ntype ProfileResponse = {\n email?: string | null\n}\n\ntype ProfileUpdateResponse = {\n ok?: boolean\n email?: string | null\n}\n\ntype ProfileFormValues = {\n email: string\n password?: string\n confirmPassword?: string\n}\n\nexport default function AuthProfilePage() {\n const t = useT()\n const router = useRouter()\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [email, setEmail] = React.useState('')\n const [formKey, setFormKey] = React.useState(0)\n const formId = React.useId()\n const passwordPolicy = React.useMemo(() => getPasswordPolicy(), [])\n const passwordRequirements = React.useMemo(\n () => formatPasswordRequirements(passwordPolicy, t),\n [passwordPolicy, t],\n )\n const passwordDescription = React.useMemo(() => (\n passwordRequirements\n ? t('auth.password.requirements.help', 'Password requirements: {requirements}', { requirements: passwordRequirements })\n : undefined\n ), [passwordRequirements, t])\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n setLoading(true)\n setError(null)\n try {\n const { ok, result } = await apiCall<ProfileResponse>('/api/auth/profile')\n if (!ok) throw new Error('load_failed')\n const resolvedEmail = typeof result?.email === 'string' ? result.email : ''\n if (!cancelled) setEmail(resolvedEmail)\n } catch (err) {\n console.error('Failed to load auth profile', err)\n if (!cancelled) setError(t('auth.profile.form.errors.load', 'Failed to load profile.'))\n } finally {\n if (!cancelled) setLoading(false)\n }\n }\n load()\n return () => { cancelled = true }\n }, [t])\n\n const fields = React.useMemo<CrudField[]>(() => [\n { id: 'email', label: t('auth.profile.form.email', 'Email'), type: 'text', required: true },\n {\n id: 'password',\n label: t('auth.profile.form.password', 'New password'),\n type: 'text',\n description: passwordDescription,\n },\n { id: 'confirmPassword', label: t('auth.profile.form.confirmPassword', 'Confirm new password'), type: 'text' },\n ], [passwordDescription, t])\n\n const schema = React.useMemo(() => {\n const passwordSchema = buildPasswordSchema({\n policy: passwordPolicy,\n message: t('auth.profile.form.errors.passwordRequirements', 'Password must meet the requirements.'),\n })\n const optionalPasswordSchema = z.union([z.literal(''), passwordSchema]).optional()\n return z.object({\n email: z.string().trim().min(1, t('auth.profile.form.errors.emailRequired', 'Email is required.')),\n password: optionalPasswordSchema,\n confirmPassword: z.string().optional(),\n }).superRefine((values, ctx) => {\n const password = values.password?.trim() ?? ''\n const confirmPassword = values.confirmPassword?.trim() ?? ''\n if ((password || confirmPassword) && password !== confirmPassword) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: t('auth.profile.form.errors.passwordMismatch', 'Passwords do not match.'),\n path: ['confirmPassword'],\n })\n }\n })\n }, [passwordPolicy, t])\n\n const handleSubmit = React.useCallback(async (values: ProfileFormValues) => {\n const nextEmail = values.email?.trim() ?? ''\n const password = values.password?.trim() ?? ''\n\n if (!password && nextEmail === email) {\n throw createCrudFormError(t('auth.profile.form.errors.noChanges', 'No changes to save.'))\n }\n\n const payload: { email: string; password?: string } = { email: nextEmail }\n if (password) payload.password = password\n\n const result = await readApiResultOrThrow<ProfileUpdateResponse>(\n '/api/auth/profile',\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n { errorMessage: t('auth.profile.form.errors.save', 'Failed to update profile.') },\n )\n\n const resolvedEmail = typeof result?.email === 'string' ? result.email : nextEmail\n setEmail(resolvedEmail)\n setFormKey((prev) => prev + 1)\n flash(t('auth.profile.form.success', 'Profile updated.'), 'success')\n router.refresh()\n }, [email, router, t])\n\n return (\n <Page>\n <PageBody>\n {loading ? (\n <LoadingMessage label={t('auth.profile.form.loading', 'Loading profile...')} />\n ) : error ? (\n <ErrorMessage label={error} />\n ) : (\n <section className=\"space-y-6 rounded-lg border bg-background p-6\">\n <header className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"space-y-1\">\n <h2 className=\"text-lg font-semibold\">{t('auth.profile.title', 'Profile')}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('auth.profile.subtitle', 'Change password')}\n </p>\n </div>\n <Button type=\"submit\" form={formId}>\n <Save className=\"size-4 mr-2\" />\n {t('auth.profile.form.save', 'Save changes')}\n </Button>\n </header>\n <CrudForm<ProfileFormValues>\n key={formKey}\n formId={formId}\n schema={schema}\n fields={fields}\n initialValues={{\n email,\n password: '',\n confirmPassword: '',\n }}\n submitLabel={t('auth.profile.form.save', 'Save changes')}\n onSubmit={handleSubmit}\n embedded\n hideFooterActions\n />\n </section>\n )}\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AAwIU,cAMI,YANJ;AAvIV,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAClB,SAAS,YAAY;AACrB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAgC;AACzC,SAAS,SAAS,4BAA4B;AAC9C,SAAS,2BAA2B;AACpC,SAAS,aAAa;AACtB,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,qBAAqB,4BAA4B,yBAAyB;AAiBpE,SAAR,kBAAmC;AACxC,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAwB,IAAI;AAC5D,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,EAAE;AAC3C,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,CAAC;AAC9C,QAAM,SAAS,MAAM,MAAM;AAC3B,QAAM,iBAAiB,MAAM,QAAQ,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAClE,QAAM,uBAAuB,MAAM;AAAA,IACjC,MAAM,2BAA2B,gBAAgB,CAAC;AAAA,IAClD,CAAC,gBAAgB,CAAC;AAAA,EACpB;AACA,QAAM,sBAAsB,MAAM,QAAQ,MACxC,uBACI,EAAE,mCAAmC,yCAAyC,EAAE,cAAc,qBAAqB,CAAC,IACpH,QACH,CAAC,sBAAsB,CAAC,CAAC;AAE5B,QAAM,UAAU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AO,QAAQ,CAAC,CAAC;AAErB,SACE,oBAAC,QACC,8BAAC,YACE,oBACC,oBAAC,kBAAe,OAAO,EAAE,6BAA6B,oBAAoB,GAAG,IAC3E,QACF,oBAAC,gBAAa,OAAO,OAAO,IAE5B,qBAAC,aAAQ,WAAU,iDACjB;AAAA,yBAAC,YAAO,WAAU,qEAChB;AAAA,2BAAC,SAAI,WAAU,aACb;AAAA,4BAAC,QAAG,WAAU,yBAAyB,YAAE,sBAAsB,SAAS,GAAE;AAAA,QAC1E,oBAAC,OAAE,WAAU,iCACV,YAAE,yBAAyB,iBAAiB,GAC/C;AAAA,SACF;AAAA,MACA,qBAAC,UAAO,MAAK,UAAS,MAAM,QAC1B;AAAA,4BAAC,QAAK,WAAU,eAAc;AAAA,QAC7B,EAAE,0BAA0B,cAAc;AAAA,SAC7C;AAAA,OACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QAEC;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAe;AAAA,UACb;AAAA,UACA,UAAU;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,QACA,aAAa,EAAE,0BAA0B,cAAc;AAAA,QACvD,UAAU;AAAA,QACV,UAAQ;AAAA,QACR,mBAAiB;AAAA;AAAA,MAZZ;AAAA,IAaP;AAAA,KACF,GAEJ,GACF;AAEJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const metadata = {
|
|
2
|
-
requireAuth: true,
|
|
3
|
-
navHidden: true,
|
|
4
|
-
pageTitle: "Profile",
|
|
5
|
-
pageTitleKey: "auth.profile.title",
|
|
6
|
-
breadcrumb: [
|
|
7
|
-
{ label: "Profile", labelKey: "auth.profile.title" }
|
|
8
|
-
]
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
metadata
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=page.meta.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/modules/auth/backend/auth/profile/page.meta.ts"],
|
|
4
|
-
"sourcesContent": ["export const metadata = {\n requireAuth: true,\n navHidden: true,\n pageTitle: 'Profile',\n pageTitleKey: 'auth.profile.title',\n breadcrumb: [\n { label: 'Profile', labelKey: 'auth.profile.title' },\n ],\n}\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AAAA,IACV,EAAE,OAAO,WAAW,UAAU,qBAAqB;AAAA,EACrD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "auth.password_reset.requested",
|
|
4
|
-
module: "auth",
|
|
5
|
-
titleKey: "auth.notifications.passwordReset.requested.title",
|
|
6
|
-
bodyKey: "auth.notifications.passwordReset.requested.body",
|
|
7
|
-
icon: "key",
|
|
8
|
-
severity: "info",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/auth/profile",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/auth/profile",
|
|
19
|
-
expiresAfterHours: 24
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: "auth.password_reset.completed",
|
|
23
|
-
module: "auth",
|
|
24
|
-
titleKey: "auth.notifications.passwordReset.completed.title",
|
|
25
|
-
bodyKey: "auth.notifications.passwordReset.completed.body",
|
|
26
|
-
icon: "check-circle",
|
|
27
|
-
severity: "success",
|
|
28
|
-
actions: [],
|
|
29
|
-
expiresAfterHours: 72
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: "auth.account.locked",
|
|
33
|
-
module: "auth",
|
|
34
|
-
titleKey: "auth.notifications.account.locked.title",
|
|
35
|
-
bodyKey: "auth.notifications.account.locked.body",
|
|
36
|
-
icon: "lock",
|
|
37
|
-
severity: "warning",
|
|
38
|
-
actions: [
|
|
39
|
-
{
|
|
40
|
-
id: "contact_support",
|
|
41
|
-
labelKey: "auth.actions.contactSupport",
|
|
42
|
-
variant: "default",
|
|
43
|
-
href: "/backend/support",
|
|
44
|
-
icon: "mail"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
linkHref: "/backend/support"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "auth.login.new_device",
|
|
51
|
-
module: "auth",
|
|
52
|
-
titleKey: "auth.notifications.login.newDevice.title",
|
|
53
|
-
bodyKey: "auth.notifications.login.newDevice.body",
|
|
54
|
-
icon: "smartphone",
|
|
55
|
-
severity: "info",
|
|
56
|
-
actions: [
|
|
57
|
-
{
|
|
58
|
-
id: "view_sessions",
|
|
59
|
-
labelKey: "auth.actions.viewSessions",
|
|
60
|
-
variant: "outline",
|
|
61
|
-
href: "/backend/auth/sessions",
|
|
62
|
-
icon: "list"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
linkHref: "/backend/auth/sessions",
|
|
66
|
-
expiresAfterHours: 168
|
|
67
|
-
// 7 days
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "auth.role.assigned",
|
|
71
|
-
module: "auth",
|
|
72
|
-
titleKey: "auth.notifications.role.assigned.title",
|
|
73
|
-
bodyKey: "auth.notifications.role.assigned.body",
|
|
74
|
-
icon: "user-plus",
|
|
75
|
-
severity: "success",
|
|
76
|
-
actions: [
|
|
77
|
-
{
|
|
78
|
-
id: "view_permissions",
|
|
79
|
-
labelKey: "auth.actions.viewPermissions",
|
|
80
|
-
variant: "outline",
|
|
81
|
-
href: "/backend/auth/profile",
|
|
82
|
-
icon: "shield"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
linkHref: "/backend/auth/profile",
|
|
86
|
-
expiresAfterHours: 168
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: "auth.role.revoked",
|
|
90
|
-
module: "auth",
|
|
91
|
-
titleKey: "auth.notifications.role.revoked.title",
|
|
92
|
-
bodyKey: "auth.notifications.role.revoked.body",
|
|
93
|
-
icon: "user-minus",
|
|
94
|
-
severity: "warning",
|
|
95
|
-
actions: [
|
|
96
|
-
{
|
|
97
|
-
id: "view_profile",
|
|
98
|
-
labelKey: "common.view",
|
|
99
|
-
variant: "outline",
|
|
100
|
-
href: "/backend/auth/profile"
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
linkHref: "/backend/auth/profile",
|
|
104
|
-
expiresAfterHours: 168
|
|
105
|
-
}
|
|
106
|
-
];
|
|
107
|
-
var notifications_default = notificationTypes;
|
|
108
|
-
export {
|
|
109
|
-
notifications_default as default,
|
|
110
|
-
notificationTypes
|
|
111
|
-
};
|
|
112
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/auth/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'auth.password_reset.requested',\n module: 'auth',\n titleKey: 'auth.notifications.passwordReset.requested.title',\n bodyKey: 'auth.notifications.passwordReset.requested.body',\n icon: 'key',\n severity: 'info',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/auth/profile',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/auth/profile',\n expiresAfterHours: 24,\n },\n {\n type: 'auth.password_reset.completed',\n module: 'auth',\n titleKey: 'auth.notifications.passwordReset.completed.title',\n bodyKey: 'auth.notifications.passwordReset.completed.body',\n icon: 'check-circle',\n severity: 'success',\n actions: [],\n expiresAfterHours: 72,\n },\n {\n type: 'auth.account.locked',\n module: 'auth',\n titleKey: 'auth.notifications.account.locked.title',\n bodyKey: 'auth.notifications.account.locked.body',\n icon: 'lock',\n severity: 'warning',\n actions: [\n {\n id: 'contact_support',\n labelKey: 'auth.actions.contactSupport',\n variant: 'default',\n href: '/backend/support',\n icon: 'mail',\n },\n ],\n linkHref: '/backend/support',\n },\n {\n type: 'auth.login.new_device',\n module: 'auth',\n titleKey: 'auth.notifications.login.newDevice.title',\n bodyKey: 'auth.notifications.login.newDevice.body',\n icon: 'smartphone',\n severity: 'info',\n actions: [\n {\n id: 'view_sessions',\n labelKey: 'auth.actions.viewSessions',\n variant: 'outline',\n href: '/backend/auth/sessions',\n icon: 'list',\n },\n ],\n linkHref: '/backend/auth/sessions',\n expiresAfterHours: 168, // 7 days\n },\n {\n type: 'auth.role.assigned',\n module: 'auth',\n titleKey: 'auth.notifications.role.assigned.title',\n bodyKey: 'auth.notifications.role.assigned.body',\n icon: 'user-plus',\n severity: 'success',\n actions: [\n {\n id: 'view_permissions',\n labelKey: 'auth.actions.viewPermissions',\n variant: 'outline',\n href: '/backend/auth/profile',\n icon: 'shield',\n },\n ],\n linkHref: '/backend/auth/profile',\n expiresAfterHours: 168,\n },\n {\n type: 'auth.role.revoked',\n module: 'auth',\n titleKey: 'auth.notifications.role.revoked.title',\n bodyKey: 'auth.notifications.role.revoked.body',\n icon: 'user-minus',\n severity: 'warning',\n actions: [\n {\n id: 'view_profile',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/auth/profile',\n },\n ],\n linkHref: '/backend/auth/profile',\n expiresAfterHours: 168,\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE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;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "business_rules.rule.execution_failed",
|
|
4
|
-
module: "business_rules",
|
|
5
|
-
titleKey: "businessRules.notifications.rule.executionFailed.title",
|
|
6
|
-
bodyKey: "businessRules.notifications.rule.executionFailed.body",
|
|
7
|
-
icon: "alert-triangle",
|
|
8
|
-
severity: "error",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/business-rules/{sourceEntityId}",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/business-rules/{sourceEntityId}",
|
|
19
|
-
expiresAfterHours: 168
|
|
20
|
-
// 7 days
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
var notifications_default = notificationTypes;
|
|
24
|
-
export {
|
|
25
|
-
notifications_default as default,
|
|
26
|
-
notificationTypes
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/business_rules/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'business_rules.rule.execution_failed',\n module: 'business_rules',\n titleKey: 'businessRules.notifications.rule.executionFailed.title',\n bodyKey: 'businessRules.notifications.rule.executionFailed.body',\n icon: 'alert-triangle',\n severity: 'error',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/business-rules/{sourceEntityId}',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/business-rules/{sourceEntityId}',\n expiresAfterHours: 168, // 7 days\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { resolveNotificationService } from "../../notifications/lib/notificationService.js";
|
|
2
|
-
import { buildFeatureNotificationFromType } from "../../notifications/lib/notificationBuilder.js";
|
|
3
|
-
import { notificationTypes } from "../notifications.js";
|
|
4
|
-
const metadata = {
|
|
5
|
-
event: "business_rules.rule.execution_failed",
|
|
6
|
-
persistent: true,
|
|
7
|
-
id: "business_rules:rule-execution-failed-notification"
|
|
8
|
-
};
|
|
9
|
-
async function handle(payload, ctx) {
|
|
10
|
-
try {
|
|
11
|
-
const notificationService = resolveNotificationService(ctx);
|
|
12
|
-
const typeDef = notificationTypes.find((type) => type.type === "business_rules.rule.execution_failed");
|
|
13
|
-
if (!typeDef) return;
|
|
14
|
-
const notificationInput = buildFeatureNotificationFromType(typeDef, {
|
|
15
|
-
requiredFeature: "business_rules.manage",
|
|
16
|
-
bodyVariables: {
|
|
17
|
-
ruleName: payload.ruleName,
|
|
18
|
-
entityType: payload.entityType ?? "",
|
|
19
|
-
errorMessage: payload.errorMessage ?? "Unknown error"
|
|
20
|
-
},
|
|
21
|
-
sourceEntityType: "business_rules:rule",
|
|
22
|
-
sourceEntityId: payload.ruleId,
|
|
23
|
-
linkHref: `/backend/business-rules/${payload.ruleId}`
|
|
24
|
-
});
|
|
25
|
-
await notificationService.createForFeature(notificationInput, {
|
|
26
|
-
tenantId: payload.tenantId,
|
|
27
|
-
organizationId: payload.organizationId ?? null
|
|
28
|
-
});
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error("[business_rules:rule-execution-failed-notification] Failed to create notification:", err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
handle as default,
|
|
35
|
-
metadata
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=rule-execution-failed-notification.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/modules/business_rules/subscribers/rule-execution-failed-notification.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport { resolveNotificationService } from '../../notifications/lib/notificationService'\nimport { buildFeatureNotificationFromType } from '../../notifications/lib/notificationBuilder'\nimport { notificationTypes } from '../notifications'\n\nexport const metadata = {\n event: 'business_rules.rule.execution_failed',\n persistent: true,\n id: 'business_rules:rule-execution-failed-notification',\n}\n\ntype RuleExecutionFailedPayload = {\n ruleId: string\n ruleName: string\n entityType?: string | null\n errorMessage?: string | null\n tenantId: string\n organizationId?: string | null\n}\n\ntype ResolverContext = {\n resolve: <T = unknown>(name: string) => T\n}\n\nexport default async function handle(payload: RuleExecutionFailedPayload, ctx: ResolverContext) {\n try {\n const notificationService = resolveNotificationService(ctx)\n const typeDef = notificationTypes.find((type) => type.type === 'business_rules.rule.execution_failed')\n if (!typeDef) return\n\n const notificationInput = buildFeatureNotificationFromType(typeDef, {\n requiredFeature: 'business_rules.manage',\n bodyVariables: {\n ruleName: payload.ruleName,\n entityType: payload.entityType ?? '',\n errorMessage: payload.errorMessage ?? 'Unknown error',\n },\n sourceEntityType: 'business_rules:rule',\n sourceEntityId: payload.ruleId,\n linkHref: `/backend/business-rules/${payload.ruleId}`,\n })\n\n await notificationService.createForFeature(notificationInput, {\n tenantId: payload.tenantId,\n organizationId: payload.organizationId ?? null,\n })\n } catch (err) {\n console.error('[business_rules:rule-execution-failed-notification] Failed to create notification:', err)\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,kCAAkC;AAC3C,SAAS,wCAAwC;AACjD,SAAS,yBAAyB;AAE3B,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAeA,eAAO,OAA8B,SAAqC,KAAsB;AAC9F,MAAI;AACF,UAAM,sBAAsB,2BAA2B,GAAG;AAC1D,UAAM,UAAU,kBAAkB,KAAK,CAAC,SAAS,KAAK,SAAS,sCAAsC;AACrG,QAAI,CAAC,QAAS;AAEd,UAAM,oBAAoB,iCAAiC,SAAS;AAAA,MAClE,iBAAiB;AAAA,MACjB,eAAe;AAAA,QACb,UAAU,QAAQ;AAAA,QAClB,YAAY,QAAQ,cAAc;AAAA,QAClC,cAAc,QAAQ,gBAAgB;AAAA,MACxC;AAAA,MACA,kBAAkB;AAAA,MAClB,gBAAgB,QAAQ;AAAA,MACxB,UAAU,2BAA2B,QAAQ,MAAM;AAAA,IACrD,CAAC;AAED,UAAM,oBAAoB,iBAAiB,mBAAmB;AAAA,MAC5D,UAAU,QAAQ;AAAA,MAClB,gBAAgB,QAAQ,kBAAkB;AAAA,IAC5C,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,YAAQ,MAAM,sFAAsF,GAAG;AAAA,EACzG;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const notificationTypes = [
|
|
2
|
-
{
|
|
3
|
-
type: "catalog.product.low_stock",
|
|
4
|
-
module: "catalog",
|
|
5
|
-
titleKey: "catalog.notifications.product.lowStock.title",
|
|
6
|
-
bodyKey: "catalog.notifications.product.lowStock.body",
|
|
7
|
-
icon: "package-x",
|
|
8
|
-
severity: "warning",
|
|
9
|
-
actions: [
|
|
10
|
-
{
|
|
11
|
-
id: "view",
|
|
12
|
-
labelKey: "common.view",
|
|
13
|
-
variant: "outline",
|
|
14
|
-
href: "/backend/catalog/products/{sourceEntityId}",
|
|
15
|
-
icon: "external-link"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
linkHref: "/backend/catalog/products/{sourceEntityId}",
|
|
19
|
-
expiresAfterHours: 72
|
|
20
|
-
// 3 days
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
var notifications_default = notificationTypes;
|
|
24
|
-
export {
|
|
25
|
-
notifications_default as default,
|
|
26
|
-
notificationTypes
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=notifications.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/modules/catalog/notifications.ts"],
|
|
4
|
-
"sourcesContent": ["import type { NotificationTypeDefinition } from '@open-mercato/shared/modules/notifications/types'\n\nexport const notificationTypes: NotificationTypeDefinition[] = [\n {\n type: 'catalog.product.low_stock',\n module: 'catalog',\n titleKey: 'catalog.notifications.product.lowStock.title',\n bodyKey: 'catalog.notifications.product.lowStock.body',\n icon: 'package-x',\n severity: 'warning',\n actions: [\n {\n id: 'view',\n labelKey: 'common.view',\n variant: 'outline',\n href: '/backend/catalog/products/{sourceEntityId}',\n icon: 'external-link',\n },\n ],\n linkHref: '/backend/catalog/products/{sourceEntityId}',\n expiresAfterHours: 72, // 3 days\n },\n]\n\nexport default notificationTypes\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAkD;AAAA,EAC7D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,MACP;AAAA,QACE,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,EACrB;AACF;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|