/** Stable react-query key for an addon's per-org settings (per branch when given). */ export declare function addonSettingsKey(addonKey: string, branchId?: string | null): readonly ["addon-settings", string, string] | readonly ["addon-settings", string]; /** * Settings URL. With a branch, the host answers the settings the addon runs * with there: org values with each `scope: branch` key replaced by the branch's * override (POS-1). Without one, the org values (legacy behaviour). */ export declare function addonSettingsUrl(addonKey: string, branchId?: string | null): 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; /** * Read the settings as one branch sees them (manifest `scope: branch` keys * resolve to the branch override, else the org value). Omit for org values. * A terminal passes its active branch here. */ branchId?: string | null; } 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, /** Write branch overrides (only `scope: branch` keys; `null` clears one) instead of org values. */ branchId?: string | null): import("@tanstack/react-query").UseMutationResult, Error, Partial, unknown>; //# sourceMappingURL=use-addon-settings.d.ts.map