Multi-stage approvals
Route calendar mutations through ordered approval stages before they are ready to commit. Exact approvers, role selectors, and lifecycle hooks allow the host application to coordinate its own review process.
Loading interactive demo…
What you configure
- approvalFlows
- Define ordered stages with approverIds or approverRoles.
- stage mode
- Use any for one matching approval, or all for every configured selector.
- approval hooks
- Connect stage entry, approval, rejection, leave, and flow completion behavior.
Essential integration
This assumes the shared Quick start already provides premiumLicense and, for UI views, premiumCalendarOptions. Only the feature-specific setup is shown.
import { EnterpriseCalendarWorkflow } from '@wts-calendar/core/enterprise-workflow';
import type { EnterpriseWorkflowActor } from '@wts-calendar/core/enterprise-workflow';
const workflow = new EnterpriseCalendarWorkflow({
license: premiumLicense,
actor: { id: 'editor-1', roles: ['editor'] },
online: false,
autoFlush: false,
events: [
{
id: 'release',
title: 'Release window',
start: '2026-09-07T09:00:00Z',
end: '2026-09-07T10:00:00Z',
},
],
defaultPermission: 'deny',
permissionPolicies: [
{ id: 'propose', effect: 'allow', actions: ['update', 'flush'], roles: ['editor'] },
{
id: 'review',
effect: 'allow',
actions: ['approve', 'reject'],
roles: ['manager', 'director'],
},
],
approvalFlows: [
{
id: 'release-review',
stages: [
{ id: 'manager-review', approverRoles: ['manager'] },
{ id: 'director-review', approverRoles: ['director'] },
],
},
],
});
export const pending = await workflow.submit({
type: 'update',
eventId: 'release',
changes: { title: 'Reviewed release' },
approvalFlowId: 'release-review',
});
// Invoke each approval from the appropriate authenticated review action.
export async function approveAs(actor: EnterpriseWorkflowActor) {
return workflow.approve(pending.id, actor);
}
// After all stages complete, explicitly deliver the queued mutation.
export async function deliver() {
workflow.setOnline(true);
return workflow.flush();
}Behavior and lifecycle
- Mutations remain pending-approval until their required stages complete.
- A failing or denying hook prevents progression; failure paths record audit and rollback actions.
Limits and responsibilities
- No email, notification, or reviewer directory service is operated by WTS.
- Hook side effects should be idempotent, and a shared backend must authenticate approvers.
Premium
Enable this capability
- Optional module
- @wts-calendar/core/enterprise-workflow
- Local capability ID
- enterprise-workflow · enabled by package-wide Premium
Use the request form to describe your project and deployment origins. Pricing and terms are confirmed privately. A WTS license is separate from provider credentials; do not send passwords or production access tokens.
The live example uses a browser-visible deployment key restricted to this package and approved origins. It does not collect license keys or visitor credentials.