@preprio/prepr-nextjs
Version:
Next.js package for Prepr CMS preview functionality with advanced debugging and visual editing capabilities
36 lines (34 loc) • 1.58 kB
TypeScript
interface PreprSegment {
readonly _id: string;
readonly name: string;
}
interface PreprToolbarOptions {
debug?: boolean;
locale?: string;
}
interface PreprToolbarProps {
readonly activeSegment: string | null;
readonly activeVariant: string | null;
readonly data: readonly PreprSegment[];
}
type PreprHeaderName = 'prepr-customer-id' | 'Prepr-Segments' | 'Prepr-ABtesting';
type PreprVariant = 'A' | 'B';
type PreprEnvironment = 'preview' | 'production';
type PreprEventType = 'segment_changed' | 'variant_changed' | 'edit_mode_toggled' | 'preview_mode_toggled' | 'personalization_reset' | 'getScrollPosition' | 'loaded';
interface PreprHeaders {
readonly 'prepr-customer-id'?: string;
readonly 'Prepr-Segments'?: string;
readonly 'Prepr-ABtesting'?: PreprVariant;
readonly 'Prepr-Preview-Bar'?: 'true';
readonly 'Prepr-Context-utm_source'?: string;
readonly 'Prepr-Context-utm_medium'?: string;
readonly 'Prepr-Context-utm_term'?: string;
readonly 'Prepr-Context-utm_content'?: string;
readonly 'Prepr-Context-utm_campaign'?: string;
readonly 'Prepr-Context-initial_referral'?: string;
readonly 'Prepr-Visitor-IP'?: string;
readonly 'Prepr-Hubspot-Id'?: string;
readonly 'Prepr-Customer-Id-Created'?: 'true';
}
type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR';
export type { PreprEnvironment, PreprErrorCode, PreprEventType, PreprHeaderName, PreprHeaders, PreprSegment, PreprToolbarOptions, PreprToolbarProps, PreprVariant };