@habit.analytics/habit-smartlink-reactcomponent
Version:
A React component for Habit SmartLink integration.
21 lines • 1.05 kB
TypeScript
import { SmartlinkParentAPI, UseSmartlinkParentMessagingOptions } from "./types";
/**
* @file useSmartlinkParentMessaging.ts
* @description Parent-side hook for smartlink iframes.
*
* Responsibilities this hook owns:
* - Deriving and enforcing pluginOrigin on all sends and receives
* - Origin check on every incoming message (no route registry — origin only)
* - Applying SMARTLINK_RESIZE to the iframe element (with optional onResize override)
* - Emitting all messages to subscribers with an isValid flag
* - Exposing named senders as conveniences
*
* Responsibilities this hook does NOT own:
* - Deciding what to send when SMARTLINK_READY fires
* - Handling step completion or cancellation
* - Error handling beyond passing SMARTLINK_ERROR to subscribers
*
* All of the above are consumer responsibilities.
*/
export declare const useSmartlinkParentMessaging: ({ pluginUrl, iframeRef, onResize, }: UseSmartlinkParentMessagingOptions) => SmartlinkParentAPI;
//# sourceMappingURL=useSmartlinkParentMessaging.d.ts.map