You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deliver the Territories and Ownership capability in the CRM application repository as an independently owned, testable module. The domain specification remains authoritative for business behavior; API, Filament 5, and Livewire 4 are one-to-one presentation packages and must not move business rules into presentation code.
The Territories and Ownership module owns Territories, books of business, teams, queues, assignment rules, round-robin/capacity routing, temporary coverage, and ownership history. It is the authoritative boundary for this capability and must remain independently installable, testable, versioned, enabled, and reusable across compatible Liberu applications.
2. Full feature scope
Territories: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Books of business: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Teams: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Queues: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Assignment rules: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Round-robin/capacity routing: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Temporary coverage: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
Ownership history: implement the complete lifecycle, validation, permissions, failure handling, audit evidence, and operator/user feedback required by this capability.
3. Ownership and boundaries
Own the capability's domain rules, policies, actions, queries, events, persistence, migrations, configuration, audit semantics, and failure recovery.
Expose stable contracts, immutable DTOs/read models, commands, queries, and past-tense domain events where other modules have a legitimate integration need.
Consume identity, organizations/teams, authorization, settings, files, notifications, queues, localization, currency, and observability from the shared foundation rather than duplicating them.
Never depend on an application's App\ classes, another module's private tables/models, a provider SDK in provider-neutral code, or an optional presentation framework.
Keep Filament, Livewire, and HTTP API logic in matching one-to-one presentation packages when those surfaces are required.
4. Implementation strategy
Domain model
Define aggregates, entities, value objects, enums, invariants, lifecycle states, and transition rules using the terminology in this specification.
Make invalid states unrepresentable where practical and enforce remaining invariants at every mutation boundary.
Use opaque stable identifiers and explicit actor, tenant, locale, timezone, and currency context where relevant.
Application layer
API contract
CRM: Territories and Ownership API
Canonical one-to-one API module specification
API package:module-crm-territories-and-ownership-api Matching domain module:crm-territories-and-ownership Application: CRM Source feature:Territories and Ownership Architecture:API.md · MODULES.md · TESTING.md
1. Purpose and ownership
This optional API presentation package exposes approved HTTP operations for the Territories and Ownership domain module. It presents exactly one independent module, delegates all authoritative behavior to that module's public actions/queries/policies, and contains no other module's API logic.
The domain capability includes:
Territories
books of business
teams
queues
assignment rules
round-robin/capacity routing
temporary coverage
ownership history
Installation does not expose every capability automatically. The host application selects this package, API version, audiences, route groups, and operations in its API manifest.
2. Contract design
Publish an OpenAPI 3.1 fragment with stable operation IDs, schemas, examples, scopes, errors, pagination, rate limits, idempotency, and deprecation metadata.
This optional Filament 5 presentation package presents exactly one independent domain module. It contributes reusable resources, pages, widgets, schemas, tables, infolists, and actions to application-owned panels while delegating authorization, validation, tenancy, persistence, and business rules to the crm-territories-and-ownership public boundary. It must not contain another module's UI or depend on application App\ classes.
2. Module-specific surfaces
Territories: resource/table/form/action or page behavior for this module's authorized workflow.
Books of business: resource/table/form/action or page behavior for this module's authorized workflow.
Teams: resource/table/form/action or page behavior for this module's authorized workflow.
Queues: resource/table/form/action or page behavior for this module's authorized workflow.
Assignment rules: resource/table/form/action or page behavior for this module's authorized workflow.
Round-robin/capacity routing: resource/table/form/action or page behavior for this module's authorized workflow.
Temporary coverage: resource/table/form/action or page behavior for this module's authorized workflow.
Ownership history: resource/table/form/action or page behavior for this module's authorized workflow.
3. Filament 5 implementation
Register a stable module-crm-territories-and-ownership-filament plugin and discover only classes in this package's namespace; applications attach it explicitly to each eligible panel.
Keep resources under src/Resources, resource pages and relation managers beneath their resource, and shared module-local widgets/pages under src/Widgets and src/Pages.
Use Filament 5 schemas, tables, infolists, actions, notifications, authorization hooks, and panel configuration as adapters over domain queries/actions; never duplicate domain invariants in form validation.
This optional Livewire 4 presentation package provides interactive server-driven components for exactly one independent domain module. Components coordinate public queries/actions and presentation state; they do not own persistence, authorization decisions, tenancy, business rules, or theme identity. The package has no dependency on application App\ classes or another module's internals.
2. Module-specific interactions
Territories: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Books of business: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Teams: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Queues: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Assignment rules: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Round-robin/capacity routing: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Temporary coverage: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
Ownership history: interactive component state, validation feedback, loading, and failure recovery for this domain capability.
3. Livewire 4 implementation
Register a stable module-crm-territories-and-ownership-livewire component namespace and service provider; use explicit aliases such as <livewire:module-crm-territories-and-ownership::component-name /> according to LIVEWIRE.md.
Keep reusable components under src/Components, full-page components under src/Pages, and package views under resources/views.
Treat public properties, URL state, events, uploads, and action parameters as untrusted input; validate and authorize at the Livewire boundary, then invoke the authoritative domain action/query.
Acceptance criteria
Domain ownership, boundaries, data lifecycle, permissions, tenancy, events, failure recovery, telemetry, and migrations match the domain specification.
API routes/operations/events, versioning, authentication, authorization scopes, validation, idempotency, errors, pagination, rate limits, and observability match the API specification.
Filament package identity, panel/resource/page/widget inventory, authorization, tenancy, navigation, theme integration, accessibility, and cache/discovery behavior match the Filament specification.
Livewire package identity, aliases, component inventory, state/actions/events, loading/failure states, authorization, tenancy, accessibility, and lifecycle behavior match the Livewire specification.
Unit, feature, contract, architecture, security, compatibility, migration/upgrade, and presentation tests cover allowed, denied, invalid, duplicate, concurrent, wrong-tenant, partial-failure, and recovery paths as applicable.
README, changelog, runbook, API/presentation documentation, release notes, and adoption/upgrade guidance are complete.
Explicit exclusions
Do not implement unrelated independent modules, application App namespace coupling inside reusable packages, private cross-module table/model access, provider SDK leakage into provider-neutral code, or business authorization solely in UI/API presentation layers.
Implementation epic
Deliver the Territories and Ownership capability in the CRM application repository as an independently owned, testable module. The domain specification remains authoritative for business behavior; API, Filament 5, and Livewire 4 are one-to-one presentation packages and must not move business rules into presentation code.
Source specifications
Specification details
Domain
CRM: Territories and Ownership
Canonical independent module specification
Domain module:
crm-territories-and-ownershipApplication: CRM
Capability group: Customer data and platform modules
Source scope: CRM.md
Architecture: MODULES.md · TESTING.md · API.md · FILAMENT.md · LIVEWIRE.md
1. Purpose
The Territories and Ownership module owns Territories, books of business, teams, queues, assignment rules, round-robin/capacity routing, temporary coverage, and ownership history. It is the authoritative boundary for this capability and must remain independently installable, testable, versioned, enabled, and reusable across compatible Liberu applications.
2. Full feature scope
3. Ownership and boundaries
App\classes, another module's private tables/models, a provider SDK in provider-neutral code, or an optional presentation framework.4. Implementation strategy
Domain model
Application layer
API contract
CRM: Territories and Ownership API
Canonical one-to-one API module specification
API package:
module-crm-territories-and-ownership-apiMatching domain module:
crm-territories-and-ownershipApplication: CRM
Source feature: Territories and Ownership
Architecture: API.md · MODULES.md · TESTING.md
1. Purpose and ownership
This optional API presentation package exposes approved HTTP operations for the Territories and Ownership domain module. It presents exactly one independent module, delegates all authoritative behavior to that module's public actions/queries/policies, and contains no other module's API logic.
The domain capability includes:
Installation does not expose every capability automatically. The host application selects this package, API version, audiences, route groups, and operations in its API manifest.
2. Contract design
Filament surface
CRM: Territories and Ownership Filament
Canonical one-to-one Filament 5 implementation
Filament package:
module-crm-territories-and-ownership-filamentMatching domain module:
crm-territories-and-ownershipApplication: CRM
Source feature: Territories and Ownership
Architecture: FILAMENT.md · MODULES.md · TESTING.md
1. Purpose and ownership
This optional Filament 5 presentation package presents exactly one independent domain module. It contributes reusable resources, pages, widgets, schemas, tables, infolists, and actions to application-owned panels while delegating authorization, validation, tenancy, persistence, and business rules to the
crm-territories-and-ownershippublic boundary. It must not contain another module's UI or depend on applicationApp\classes.2. Module-specific surfaces
3. Filament 5 implementation
module-crm-territories-and-ownership-filamentplugin and discover only classes in this package's namespace; applications attach it explicitly to each eligible panel.src/Resources, resource pages and relation managers beneath their resource, and shared module-local widgets/pages undersrc/Widgetsandsrc/Pages.Livewire surface
CRM: Territories and Ownership Livewire
Canonical one-to-one Livewire 4 implementation
Livewire package:
module-crm-territories-and-ownership-livewireMatching domain module:
crm-territories-and-ownershipApplication: CRM
Source feature: Territories and Ownership
Architecture: LIVEWIRE.md · MODULES.md · TESTING.md
1. Purpose and ownership
This optional Livewire 4 presentation package provides interactive server-driven components for exactly one independent domain module. Components coordinate public queries/actions and presentation state; they do not own persistence, authorization decisions, tenancy, business rules, or theme identity. The package has no dependency on application
App\classes or another module's internals.2. Module-specific interactions
3. Livewire 4 implementation
module-crm-territories-and-ownership-livewirecomponent namespace and service provider; use explicit aliases such as<livewire:module-crm-territories-and-ownership::component-name />according to LIVEWIRE.md.src/Components, full-page components undersrc/Pages, and package views underresources/views.Acceptance criteria
Explicit exclusions
Do not implement unrelated independent modules, application App namespace coupling inside reusable packages, private cross-module table/model access, provider SDK leakage into provider-neutral code, or business authorization solely in UI/API presentation layers.