Contracts

Prev Next

Feedback Manager Contracts

This page is the contract reference for feedback payloads and provider integration boundaries.

Core Interface

export interface FeedbackProvider {
  write(data: FeedbackContext): Promise<FeedbackResponse>;
}

All providers must satisfy this interface. The write contract is the extension seam for adding destinations.

Payload Contracts

FeedbackClientContext

Sent from client to route.

Field Type Notes
category FeedbackCategory Required
message string Required
email string or null or undefined Optional
allowContactThroughEmail boolean Required
module PathId Required module origin

FeedbackServerContext

Injected by route at runtime.

Field Type Notes
timestamp string ISO timestamp
siteId string From cookie
siteName string From cookie
userId string From cookie

FeedbackContext

FeedbackContext = FeedbackClientContext & FeedbackServerContext

This is the provider input contract.

FeedbackResponse

Field Type Notes
success boolean Required
message string Optional success detail
error string Optional failure detail

Enums and Allowed Values

FeedbackCategory

Allowed values:

  • feature_request
  • workflow_experience
  • general

SupportedFeedbackProviderEnum

Current value:

  • google-sheets

Validation Boundary Notes

  • Client-side schema enforces category and minimum message length
  • Optional email is accepted as empty, but invalid non-empty email is rejected
  • If contact-through-email is selected, email must be present

Provider Extension Checklist

When adding a provider:

  1. Implement FeedbackProvider.write
  2. Keep provider-specific env vars local to provider config
  3. Validate provider config at initialization and fail fast with clear error
  4. Register provider in factory selection switch
  5. Add provider documentation file under providers/
  6. Add unit tests for success path and failure paths

Related Sources

  • src/lib/external/FeedbackManager/core/types.ts
  • src/lib/external/FeedbackManager/provider/factory.ts
  • src/modules/share-feedback/schema.ts