Setting the file. One moment.
Subchapter 1.39
references/context-provider/vertical-contexts/bookings/locations.mdMarkdown2 KBView on GitHub
@wix/bookings/context/locationsRead Importing a Context in Code first. Import only the hook, from @wix/bookings/context/locations.
Loads the business locations that host bookable services, checks for services at other locations, and tracks the selected location in the page URL.
import { LocationsContextProvider } from '@wix/bookings/context/locations';__0: LocationsContextProviderPropsElementReads the locations state; throws when no LocationsContextProvider is above.
import { useLocationsContext } from '@wix/bookings/context/locations';LocationsContextValue| Property | Type | Description |
|---|---|---|
initialLocationId | string | undefined | Selected on load when the page URL names no location. |
children | ReactNode |
| Property | Type | Description |
|---|---|---|
locations | V2Location[] | |
locationItems | LocationItem[] | |
selectedLocationId | string | null | |
selectedLocationIndex | number | |
selectedLocation | V2Location | null | |
selectedLocationName | string | null | |
hasOtherLocations | boolean | |
hasMultipleLocations | boolean | |
isLoading | boolean | |
hasError | boolean | |
refetch | () => void | |
selectLocation | (locationId: string | null) => void |
| Property | Type | Description |
|---|---|---|
business | BusinessLocationOptions | undefined | Information about business locations. Required when type is BUSINESS. |
custom | CustomLocationOptions | undefined | Information about custom locations. Required when type is CUSTOM. |
_id | string | undefined | Location ID. |
type | LocationTypeEnumLocationTypeWithLiterals | undefined | Location type. Default: CUSTOM |
calculatedAddress | CommonAddress | undefined | Location address. Empty for {"type": "CUSTOMER"}. |
| Property | Type | Description |
|---|---|---|
locationId | string | null | |
locationName | string | null | |
isSelected | boolean |