import {SuccessResponse} from "../common"; export interface Scope { id: number; name: string; selected: boolean; /** The market's own domain, when the store sends shoppers to it. */ url?: string | null; } export interface ProductAvailability { name: string; selected: boolean; availability: Availability; } export interface Availability { label: string; key: string; color: string; } export namespace ScopeApiResponse { export interface scopeList extends SuccessResponse { data: Scope[]; } export interface scopeAddition extends SuccessResponse { data: Scope } export interface availability extends SuccessResponse { data: ProductAvailability[]; } } export default interface ScopeApi { get: () => Promise change: (payload: Object) => Promise getProductAvailability: (product_id: number) => Promise /** Where a switch to this market should go: its own domain when `url` is set, else the current page with `?scope=`. */ urlFor: (scope: Pick, current?: string) => string }