/** * PuckDataSynchronizer * * A component that syncs external data changes to Puck's internal state * without remounting the Puck component. This preserves UI state like * which sidebar tab is active. * * This component must be rendered inside the Puck component tree * (e.g., via a plugin or override) to access the usePuck hook. * It safely handles cases where Puck's context isn't available yet. */ import React from 'react'; import type { PuckData } from '@pantheon-systems/css-client'; /** * Reset the module-level sync tracking. This is only for testing purposes. * In tests, the module state persists across test cases, which can cause * unexpected behavior. Call this in beforeEach to start each test fresh. * * @internal */ export declare function _resetSyncTracking(): void; export interface PuckDataSynchronizerProps { /** * The data to sync to Puck. When this changes, Puck's internal * data will be updated via dispatch. */ data: PuckData | null; /** * A key that changes when we want to force a data sync. * This helps distinguish between prop updates that should * sync vs. ones that shouldn't (like data from Puck's onChange). */ syncKey: string | null; } /** * Syncs external data changes to Puck without remounting. * * This component renders nothing but uses an effect to dispatch * setData actions when the external data changes. * * It safely handles cases where Puck's context might not be ready yet * by deferring the sync until after the first render using setTimeout * to ensure Puck's context provider is fully initialized. * * An error boundary catches any "usePuck must be used inside " * errors for React 19 compatibility. */ export declare function PuckDataSynchronizer({ data, syncKey, }: PuckDataSynchronizerProps): React.ReactElement | null;