/** Stable react-query key for an addon's per-org settings. */ export declare function addonSettingsKey(addonKey: string): readonly ["addon-settings", string]; /** * Merge saved org values over the caller's defaults so a never-saved setting * falls back to its default. Pure + exported for unit testing. Only keys that * are actually present in `stored` win — an explicit `undefined` in the stored * payload is treated as "not saved" and yields the default (the host omits * unsaved keys, but this keeps a sparse payload well-behaved). */ export declare function mergeAddonSettings>(defaults: Partial | undefined, stored: Partial | null | undefined): T; export interface UseAddonSettingsOptions { /** * Fallback values (typically the addon manifest's `settings[].default`) * merged UNDER the saved org values. A setting the org hasn't saved * resolves to its default here. */ defaults?: Partial; /** Override staleTime (default 30s — org config changes rarely). */ staleTime?: number; /** Defer fetching (e.g. until the addon key is known). */ enabled?: boolean; } export interface UseAddonSettingsResult { /** Saved org values merged over `defaults`. Never null. */ settings: T; isLoading: boolean; error: unknown; refetch: () => void; } /** * Read an addon's per-organization settings. * * This is the ecosystem-standard way for a federated addon to read its own * config; prefer it over a hand-rolled fetch so every addon caches, merges * defaults, and invalidates identically. * * @example * type PosSettings = { allowNegativeStock: boolean; roundingMode: string } * const { settings, isLoading } = useAddonSettings('pos', { * defaults: { allowNegativeStock: false, roundingMode: 'nearest' }, * }) * if (!isLoading && settings.allowNegativeStock) { ... } */ export declare function useAddonSettings = Record>(addonKey: string, opts?: UseAddonSettingsOptions): UseAddonSettingsResult; /** * Optional write companion — PUTs a (partial) settings object and invalidates * the read query so `useAddonSettings` re-resolves. The host's generic config * modal does its own PUT; this exists for addons that ship a custom config * surface. Backward-compatible: purely additive. * * @example * const update = useUpdateAddonSettings('pos') * update.mutate({ allowNegativeStock: true }) */ export declare function useUpdateAddonSettings = Record>(addonKey: string): import("@tanstack/react-query").UseMutationResult, Error, Partial, unknown>; //# sourceMappingURL=use-addon-settings.d.ts.map