import { InjectionKey } from 'vue'; import { Contact, Customer } from '@propeller-commerce/propeller-sdk-v2'; import { ShopMode, UserMode } from '@propeller-commerce/propeller-v2-core-ui'; import { PropellerDeps } from '../plugin'; /** * Tier 2 — per-scope state. Bound by `` and replaceable * by nesting a second provider deeper in the tree (for impersonation, * multi-cart, multi-language widgets, …). Distinct from the Tier 1 deps * installed by the `propellerVue` plugin. */ export interface PropellerScope { user: Contact | Customer | null; /** * Whether a session exists, independent of whether `user` has loaded yet. * Hosts paint from a cached hint before the profile arrives, so `user` is * null for an authenticated visitor for the first frames; without this, * semi-closed surfaces flash their logged-out state. Optional — omitting it * keeps the previous behaviour. */ isAuthenticated?: boolean; companyId: number | undefined; language: string; includeTax: boolean; portalMode: string; /** * Shop mode declared in `propeller.json`. Combined with `user` to derive * `userMode` on the composite context. Defaults to `'hybrid'` when omitted * so existing call sites keep their current branching semantics. */ shopMode?: ShopMode; } /** Symbol-keyed scope injection — never collides with consumer keys. */ export declare const PropellerScopeKey: InjectionKey; /** * Composite read of Tier 1 deps + Tier 2 scope. Mirrors the previous * `PropellerInfra` shape so existing consumers (cards, useResolvedProps, * useInfraProps) keep working unchanged. * * Composables that only need services should call `useServices()` / * `usePropellerDeps()` instead — they don't depend on a scope provider. */ export interface PropellerInfra extends PropellerDeps, PropellerScope { userMode: UserMode; } /** * Non-throwing accessor: returns `null` if either tier is missing so * components stay usable standalone / in tests. */ export declare function usePropellerContext(): PropellerInfra | null; /** * Throwing accessor — call when both tiers are required and a missing * provider is an integration bug, not a render-standalone scenario. */ export declare function useRequiredPropellerContext(): PropellerInfra; /** * Read the active `userMode` directly. Returns `'anonymous'` outside the * provider so components stay usable standalone / in tests. */ export declare function useUserMode(): UserMode;