import { type MarketplaceListing, type MarketplaceListingThresholds, type SaleType } from './marketplace-listing.js'; export type { SaleType } from './marketplace-listing.js'; /** * The criterion the judgement answers, in one place. * * Exported so the daemon's judge and this module's documentation cannot drift * into asking two different questions. It deliberately describes a PROFILE and * gives the owner's anchoring examples rather than enumerating anybody. */ export declare const MERCHANT_RECOURSE_CRITERION: string; /** How a marketplace carries recourse, when the domain is one. */ export type MarketplaceKind = /** Not a marketplace. */ 'none' /** The platform's own buyer protection covers the purchase, the owner's Etsy case. */ | 'buyer-protection' /** Recourse depends on the individual seller, the owner's eBay case. */ | 'per-seller'; /** * The judgement's input. **Exactly one field, on purpose.** * * Adding anything the merchant can influence re-opens the injection surface * this whole design closes. If a future change needs more context, that is a * signal to stop, not to widen this type. */ export interface MerchantJudgeInput { readonly registrableDomain: string; } export interface MerchantJudgement { readonly qualifies: boolean; /** * Whether the judge is confident. Anything less resolves to not-major, so an * unsure judgement and a negative one have the same effect on spending. */ readonly confident: boolean; /** * Why, in the judge's own words, a phrase like "buyer protection applies" or * "established electronics retailer with a returns process". Rendered to the * owner so the notification names the recourse rather than a verdict. */ readonly recourse: string; readonly marketplace?: MarketplaceKind | undefined; } /** Supplied by the daemon. The SDK owns the criterion and the policy; not the model call. */ export interface MerchantJudgePort { judge(input: MerchantJudgeInput): Promise; } export type MarketplacePolicy = 'major' | 'requires-approval' | 'first-party-only'; export interface MerchantPolicy { /** Owner additions, authoritative, and theirs alone. */ readonly additional?: string | undefined; /** Owner removals, authoritative. */ readonly excluded?: string | undefined; readonly marketplaces?: MarketplacePolicy | undefined; readonly listingThresholds?: MarketplaceListingThresholds | undefined; } export interface MerchantIdentity { /** The host that TAKES THE CARD. Recourse attaches to this. */ readonly checkoutHost: string; /** * Where the item was browsed, when the flow handed off to pay elsewhere. * * A different registrable domain here breaks the qualification: the * protection belonged to the storefront and may not follow the card. */ readonly storefrontHost?: string | undefined; readonly saleType?: SaleType | undefined; readonly listing?: MarketplaceListing | undefined; } export interface MerchantVerdict { readonly isMajor: boolean; /** Set when the listing itself is refused outright, an auction, say. */ readonly refused?: boolean | undefined; readonly registrable: string | null; /** Where the verdict came from, for the audit record. */ readonly basis: 'owner-override' | 'judgement' | 'unconfident' | 'structural'; readonly reason: string; } /** Parse a comma-separated config value into normalized registrable domains. */ export declare function parseDomainList(raw: string | undefined): readonly string[]; /** * Decide whether this merchant carries recourse. * * Precedence, strictest first: * 1. checkout left the storefront's domain → not major (structural) * 2. owner exclusion → not major (authoritative) * 3. owner addition → major (authoritative) * 4. marketplace policy → may block * 5. judgement against the profile → major only if confident AND qualifying * 6. anything else → not major */ export declare function classifyMerchant(merchant: MerchantIdentity, judge: MerchantJudgePort, policy?: MerchantPolicy): Promise; /** * Which window a purchase gets, composing the budget rule with the recourse * rule. * * They compose in the strict direction: **either condition escalates, and * nothing downgrades an approval to a veto.** An established retailer buys no * leniency on an over-budget purchase. */ export declare function windowForPurchase(input: { readonly aboveBudget: boolean; readonly merchantIsMajor: boolean; }): 'approval' | 'veto'; /** Build the policy from daemon config. Overrides stay owner-authored. */ export declare function merchantPolicyFromConfig(config: { readonly majorRetailersAdditional: string; readonly majorRetailersExcluded: string; readonly ebayMinSellerFeedbackCount: number; readonly ebayMinSellerPositivePercent: number; }): MerchantPolicy; //# sourceMappingURL=merchant-recourse.d.ts.map