import * as operationsSDK from '@wix/auto_sdk_restaurants_operations'; import { Signal, ReadOnlySignal } from '@wix/services-definitions/core-services/signals'; import * as fulfillemtMethodsSDK from '@wix/auto_sdk_restaurants_fulfillment-methods'; import { DurationRange } from '@wix/auto_sdk_restaurants_operations'; import { Operation } from './operation.js'; export declare enum DispatchType { /** Pickup fulfillment */ PICKUP = "PICKUP", /** Delivery fulfillment */ DELIVERY = "DELIVERY" } export declare enum FulfillmentTypeEnum { /** ASAP - Order will be fulfilled as soon as possible */ ASAP = "ASAP", /** PREORDER - Order will be fulfilled at a scheduled time */ PREORDER = "PREORDER", /** ASAP_AND_FUTURE - Both ASAP and future scheduling available */ ASAP_AND_FUTURE = "ASAP_AND_FUTURE" } export type TimeSlot = { id: string; startTime: Date; endTime: Date; dispatchType: DispatchType; startsNow?: boolean; fulfillmentDetails: operationsSDK.FulfillmentDetails; }; export interface Fulfillment { id: string; name: string; type: string; isAvailable: boolean; } export type DispatchInfo = { address?: operationsSDK.CommonAddress; selectedTimeSlot?: TimeSlot; maxTimeOptions?: number; durationRangeOptions?: DurationRange; minOrder?: string; deliveryFee?: string; freeFulfillmentPriceThreshold?: string; minDate?: Date; }; export type DispatchesInfo = Record; export interface FulfillmentsServiceAPI { /** Available time slots for the operation */ firstAvailableTimeSlots: Signal; /** Available fulfillment methods (pickup, delivery, etc.) */ fulfillments: Signal; /** Currently selected fulfillment method based on dispatch type */ selectedFulfillment: Signal; /** Currently selected time slot (computed from dispatchesInfoSignal based on selectedFulfillment) */ selectedTimeSlot: ReadOnlySignal; /** Currently selected ASAP time */ asapTimeSignal: Signal; /** Currently selected ASAP time range */ asapTimeRangeSignal: Signal; /** Loading state */ isLoading: Signal; /** Error state */ error: Signal; /** Available dispatch types */ availableTypes: Signal; /** Current scheduling type (ASAP or PREORDER) based on selected time slot */ schedulingType: Signal; /** Whether ASAP option is available */ hasAsapOption: Signal; /** Whether preorder (schedule for later) option is available */ hasPreorderOption: Signal; /** Whether both ASAP and future scheduling options are available */ hasAsapAndFutureOption: Signal; /** * Dispatches info by dispatch type */ dispatchesInfoSignal: Signal; /** * Currently selected dispatch info (computed from dispatchesInfoSignal based on selectedFulfillment) */ selectedDispatchInfoSignal: ReadOnlySignal; /** * Action: Set the selected time slot and update related fulfillment data * This action automatically updates: * - selectedTimeSlot signal * - selectedFulfillment signal (based on dispatch type) * - dispatchesInfo signal (based on dispatch type) * * @param timeSlot - The time slot to select */ setSelectedTimeSlot: (timeSlot: TimeSlot) => void; /** * Action: Select a fulfillment type and update related fulfillment data * This action automatically updates the selected time slot and fulfillment data */ selectFulfillmentType: (type: DispatchType) => void; } export interface FulfillmentsServiceConfig { firstAvailableTimeSlots?: operationsSDK.TimeSlotForOperation[]; operation?: Operation; fulfillments?: fulfillemtMethodsSDK.FulfillmentMethod[]; }