/** * Core Location Component - Parses service location data * Handles business, custom, and customer location types * Converts location data to Address component format * * @module Core/Location */ import React from 'react'; import { LocationTypeEnumLocationType as LocationType } from '@wix/auto_sdk_bookings_services'; import type { AddressData as AddressDataType } from '@wix/headless-components/react'; import type { Location } from '../../../services/location-list/location-list.def.js'; /** * Re-export AddressData type from Address component for convenience */ export type AddressData = AddressDataType; export type { Location } from '../../../services/location-list/location-list.def.js'; /** * Location render props passed to children */ export interface LocationRenderProps { /** Location type */ locationType: LocationType; /** Parsed address data compatible with Address.Root, null if not available */ address: AddressData | null; /** Computed display name (business.name, custom.addressLine, or label fallback) */ name: string | undefined; /** Location ID */ locationId: string | undefined; /** Whether this is a customer location */ isCustomerLocation: boolean; /** Whether this is a custom location */ isCustomLocation: boolean; /** Whether this location lacks real data (no business/custom/calculatedAddress) */ isSynthetic: boolean; /** Phone number (only for BUSINESS locations) */ phone: string | undefined; /** Email address (only for BUSINESS locations) */ email: string | undefined; /** Raw location object */ rawLocation: Location | null; } /** * Props for the Core Location Root component */ export interface RootProps { /** Location data */ location?: Location; /** Children */ children: React.ReactNode; } /** * Props for the Core Location Data component */ export interface DataProps { /** Children render prop that receives location data */ children: (props: LocationRenderProps) => React.ReactNode; } /** * Hook to access location context from CoreLocation.Root * @throws Error if used outside of CoreLocation.Root */ export declare function useLocationContext(): LocationRenderProps; /** * Core Location Root component that provides location context. * Parses location data and makes it available to all child components via context. * Tries to access LocationListService for label configuration. * * @component * @example * ```tsx * * * * * ``` */ export declare function Root(props: RootProps): React.ReactNode; /** * Core Location Data component that exposes location data via render props. * Must be used within a CoreLocation.Root component. * * @component * @example * ```tsx * * * {({ displayName, address }) => ( *
* {displayName} * {address && } *
* )} *
*
* ``` */ export declare function Data(props: DataProps): React.ReactNode; /** * Props for Actions render prop component */ export interface ActionsProps { children: (actions: { select: () => void; rawLocation: Location | null; selected: boolean; }) => React.ReactNode; } /** * Core component that provides location selection actions via render props. * Sets the location in BookingService when select is called. * * @component * @example * ```tsx * * * {({ select, selected, rawLocation }) => ( * * )} * * * ``` */ export declare function Actions(props: ActionsProps): React.ReactNode;