import React from 'react'; import { type FulfillmentDetailsServiceConfig } from '../../services/fulfillment-details-service.js'; import { DispatchType, FulfillmentTypeEnum, TimeSlot } from '../../types/fulfillments-types.js'; import { StreetAddress } from '../../types/operation.js'; export interface RootProps { children: React.ReactNode; fulfillmentDetailsServiceConfig?: FulfillmentDetailsServiceConfig; } /** * Root component for FulfillmentDetails * Provides context for all fulfillment detail sub-components * Adds FulfillmentDetailsService to the services map after FulfillmentsService is loaded */ export declare const Root: React.FC; export interface AddressNameProps { children: (props: { addressName: string | null; fullAddress: string | null; hasAddress: boolean; dispatchType: DispatchType | null; }) => React.ReactNode; } /** * Component that provides the address name for the selected fulfillment * For pickup: shows the restaurant/pickup location name * For delivery: shows the delivery address */ export declare const AddressName: React.FC; export interface FulfillmentDateProps { children: (props: { selectedDate: Date | null; onDateChange: (date: Date) => void; availableDates: Array<{ date: Date; hasAvailableSlots: boolean; }>; isValidDate: (date: Date) => boolean; }) => React.ReactNode; } /** * Component that provides date picker functionality for fulfillment scheduling * Allows users to select when they want to receive their order */ export declare const FulfillmentDate: React.FC; export interface TimeSlotOption { id: string; label: string; startTime: Date; endTime: Date; dispatchType: DispatchType; isAsap: boolean; } export interface AvailableTimeSlotsProps { children: (props: { timeSlots: TimeSlotOption[]; selectedTimeSlotId: string | null; onTimeSlotChange: (timeSlotId: string) => void; hasTimeSlots: boolean; }) => React.ReactNode; } /** * Component that provides available time slots for the selected date * Shows time ranges when the order can be fulfilled */ export declare const AvailableTimeSlots: React.FC; export interface FulfillmentTypeProps { children: (props: { selectedType: FulfillmentTypeEnum | undefined; selectedTimeSlot: TimeSlot | null; onTypeChange: (type: FulfillmentTypeEnum) => void; hasAsapOption: boolean; hasPreorderOption: boolean; hasAsapAndFutureOption: boolean; asapTime: number | undefined; asapTimeRange: { minDuration?: number; maxDuration?: number; } | undefined; }) => React.ReactNode; } /** * Component that provides fulfillment type selection (ASAP or Pre-order) * ASAP: Order will be fulfilled as soon as possible * Pre-order: Order will be fulfilled at a scheduled time */ export declare const FulfillmentType: React.FC; /** * Address fields that can be updated */ export interface DeliveryAddressFields { /** Street address line 1 */ addressLine?: string; /** Street address line 2 (apartment, suite, etc.) */ addressLine2?: string; /** City */ city?: string; /** State/Province/Subdivision */ subdivision?: string; /** Postal/ZIP code */ postalCode?: string; /** Country */ country?: string; /** Formatted full address string */ formattedAddress?: string; /** Street address */ streetAddress?: StreetAddress; } export interface DeliveryAddressProps { children: (props: { /** Current address fields */ address: DeliveryAddressFields | null; /** Whether there is a current address */ hasAddress: boolean; /** Current dispatch type */ dispatchType: DispatchType | null; /** Whether delivery is selected */ isDelivery: boolean; /** Update the delivery address */ onAddressChange: (address: DeliveryAddressFields) => void; /** Clear the delivery address */ onAddressClear: () => void; }) => React.ReactNode; } /** * Component that provides delivery address editing functionality * Only renders content when dispatch type is DELIVERY * * @example * ```tsx * * {({ address, hasAddress, isDelivery, onAddressChange, onAddressClear }) => ( * isDelivery && ( *
* onAddressChange({ ...address, addressLine: e.target.value })} * placeholder="Street Address" * /> * onAddressChange({ ...address, city: e.target.value })} * placeholder="City" * /> * *
* ) * )} *
* ``` */ export declare const DeliveryAddress: React.FC; export interface AddressPrediction { /** The human-readable name of the prediction */ description?: string; /** The id of the prediction that can be used in place API */ searchId?: string; /** Contains the main text of a prediction, usually the name of the place */ mainText?: string; /** Contains the secondary text of a prediction, usually the location of the place */ secondaryText?: string; } export interface AddressPickerProps { children: (props: { /** Current input value */ inputValue: string; /** Update the input value */ onInputChange: (value: string) => void; /** List of address predictions */ predictions: AddressPrediction[]; /** Whether predictions are being loaded */ isLoading: boolean; /** Select a prediction and fetch place details */ onPredictionSelect: (prediction: AddressPrediction) => Promise; /** Whether delivery is selected */ isDelivery: boolean; /** Current dispatch type */ dispatchType: DispatchType | null; /** Error message from the service */ error: string | null; }) => React.ReactNode; } /** * Component that provides address autocomplete functionality * Uses Atlas Autocomplete to predict addresses and Atlas Places to get place details * Only provides functionality when dispatch type is DELIVERY * * @example * ```tsx * * {({ inputValue, onInputChange, predictions, onPredictionSelect, isDelivery }) => ( * isDelivery && ( *
* onInputChange(e.target.value)} * placeholder="Enter address" * /> * {predictions.length > 0 && ( *
    * {predictions.map((prediction, index) => ( *
  • onPredictionSelect(prediction)} * > * {prediction.description} *
  • * ))} *
* )} *
* ) * )} *
* ``` */ export declare const AddressPicker: React.FC; export interface SaveButtonProps { children: (props: { /** Save the current fulfillment details to the fulfillments service */ onSave: () => void; /** Whether save operation is in progress */ isSaving: boolean; /** Whether there are valid details to save */ canSave: boolean; /** Whether the details have been modified */ hasChanges: boolean; /** The currently selected time slot */ selectedTimeSlot: TimeSlot | null; /** The currently selected dispatch type */ dispatchType: DispatchType | null; }) => React.ReactNode; } /** * Component that provides save functionality for fulfillment details * Saves the selected time slot from FulfillmentDetailsService to FulfillmentsService * * @example * ```tsx * * {({ onSave, isSaving, canSave }) => ( * * )} * * ``` */ export declare const SaveButton: React.FC; export interface DispatchTypeSelectorProps { children: (props: { availableTypes: Array<{ type: DispatchType; isSelected: boolean; }>; selectedType: DispatchType | null; selectDispatchType: (type: DispatchType) => void; hasTypes: boolean; }) => React.ReactNode; } /** * Component that provides dispatch type selection (pickup or delivery) * Uses FulfillmentDetailsService to manage dispatch type state * * @example * ```tsx * * {({ availableTypes, selectedType, selectDispatchType }) => ( *
* {availableTypes.map(({ type, isSelected }) => ( * * ))} *
* )} *
* ``` */ export declare const DispatchTypeSelector: React.FC;