@wix/headless-bookings 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/dist/api/index.d.ts +1 -0
- package/cjs/dist/api/index.js +1 -0
- package/cjs/dist/api/query-services/index.d.ts +6 -7
- package/cjs/dist/api/query-services/index.js +4 -4
- package/cjs/dist/api/time-slot-list/index.d.ts +53 -0
- package/cjs/dist/api/time-slot-list/index.js +133 -0
- package/cjs/dist/react/core/booking/Booking.d.ts +2 -2
- package/cjs/dist/react/core/location/Location.d.ts +3 -3
- package/cjs/dist/react/core/location/Location.js +2 -2
- package/cjs/dist/react/core/service/Service.d.ts +8 -8
- package/cjs/dist/react/core/service-list/ServiceList.d.ts +2 -2
- package/cjs/dist/react/core/time-slot-list/TimeSlot.d.ts +368 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlot.js +357 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.d.ts +84 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +68 -0
- package/cjs/dist/react/index.d.ts +1 -0
- package/cjs/dist/react/index.js +1 -0
- package/cjs/dist/react/location/Location.d.ts +3 -3
- package/cjs/dist/react/service/Service.d.ts +9 -9
- package/cjs/dist/react/service/Service.js +5 -5
- package/cjs/dist/react/service-list/ServiceList.d.ts +3 -3
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +438 -0
- package/cjs/dist/react/time-slot-list/TimeSlot.js +427 -0
- package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +209 -0
- package/cjs/dist/react/time-slot-list/TimeSlotList.js +199 -0
- package/cjs/dist/services/booking/booking.d.ts +12 -11
- package/cjs/dist/services/booking/booking.js +5 -3
- package/cjs/dist/services/index.d.ts +1 -0
- package/cjs/dist/services/index.js +1 -0
- package/cjs/dist/services/service/service.d.ts +5 -5
- package/cjs/dist/services/service/service.js +8 -8
- package/cjs/dist/services/service-list/service-list.d.ts +3 -3
- package/cjs/dist/services/time-slot-list/index.d.ts +6 -0
- package/cjs/dist/services/time-slot-list/index.js +6 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.d.ts +58 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.def.d.ts +84 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.def.js +17 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.js +349 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/query-services/index.d.ts +6 -7
- package/dist/api/query-services/index.js +4 -4
- package/dist/api/time-slot-list/index.d.ts +53 -0
- package/dist/api/time-slot-list/index.js +133 -0
- package/dist/react/core/booking/Booking.d.ts +2 -2
- package/dist/react/core/location/Location.d.ts +3 -3
- package/dist/react/core/location/Location.js +2 -2
- package/dist/react/core/service/Service.d.ts +8 -8
- package/dist/react/core/service-list/ServiceList.d.ts +2 -2
- package/dist/react/core/time-slot-list/TimeSlot.d.ts +368 -0
- package/dist/react/core/time-slot-list/TimeSlot.js +357 -0
- package/dist/react/core/time-slot-list/TimeSlotList.d.ts +84 -0
- package/dist/react/core/time-slot-list/TimeSlotList.js +68 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/location/Location.d.ts +3 -3
- package/dist/react/service/Service.d.ts +9 -9
- package/dist/react/service/Service.js +5 -5
- package/dist/react/service-list/ServiceList.d.ts +3 -3
- package/dist/react/time-slot-list/TimeSlot.d.ts +438 -0
- package/dist/react/time-slot-list/TimeSlot.js +427 -0
- package/dist/react/time-slot-list/TimeSlotList.d.ts +209 -0
- package/dist/react/time-slot-list/TimeSlotList.js +199 -0
- package/dist/services/booking/booking.d.ts +12 -11
- package/dist/services/booking/booking.js +5 -3
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/service/service.d.ts +5 -5
- package/dist/services/service/service.js +8 -8
- package/dist/services/service-list/service-list.d.ts +3 -3
- package/dist/services/time-slot-list/index.d.ts +6 -0
- package/dist/services/time-slot-list/index.js +6 -0
- package/dist/services/time-slot-list/time-slot-list.d.ts +58 -0
- package/dist/services/time-slot-list/time-slot-list.def.d.ts +84 -0
- package/dist/services/time-slot-list/time-slot-list.def.js +17 -0
- package/dist/services/time-slot-list/time-slot-list.js +349 -0
- package/package.json +2 -2
package/cjs/dist/api/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @module API
|
|
6
6
|
*/
|
|
7
7
|
export { getServiceById, getServiceBySlug, queryServices, type PagingMetadata, type ServiceListFilters, type QueryServicesRequest, } from './query-services/index.js';
|
|
8
|
+
export { fetchAvailability } from './time-slot-list/index.js';
|
|
8
9
|
/**
|
|
9
10
|
* PagingMetadata includes:
|
|
10
11
|
* - limit: Number of items per page
|
package/cjs/dist/api/index.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* Query Services API
|
|
3
3
|
* Fetches single or multiple services with pagination and sorting
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import type { services as servicesTypes } from '@wix/bookings';
|
|
5
|
+
import { type Service, type Paging, type Sorting } from '@wix/auto_sdk_bookings_services';
|
|
7
6
|
/**
|
|
8
7
|
* Paging metadata from query services response.
|
|
9
8
|
* Extends the SDK's Paging type with hasNext flag to indicate if more services are available.
|
|
10
9
|
*/
|
|
11
|
-
export type PagingMetadata =
|
|
10
|
+
export type PagingMetadata = Paging & {
|
|
12
11
|
/** Number of items returned in the current page */
|
|
13
12
|
count?: number;
|
|
14
13
|
/** Whether there are more services available to load */
|
|
@@ -31,7 +30,7 @@ export interface QueryServicesRequest {
|
|
|
31
30
|
appId: string;
|
|
32
31
|
filters?: ServiceListFilters;
|
|
33
32
|
pagingMetadata?: PagingMetadata;
|
|
34
|
-
sort?:
|
|
33
|
+
sort?: Sorting[];
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
36
|
* Fetches a service by its ID
|
|
@@ -40,7 +39,7 @@ export interface QueryServicesRequest {
|
|
|
40
39
|
* @returns Object containing the service or null if not found
|
|
41
40
|
*/
|
|
42
41
|
export declare const getServiceById: (id: string, appId?: string) => Promise<{
|
|
43
|
-
service:
|
|
42
|
+
service: Service | null;
|
|
44
43
|
}>;
|
|
45
44
|
/**
|
|
46
45
|
* Fetches a service by its slug
|
|
@@ -49,7 +48,7 @@ export declare const getServiceById: (id: string, appId?: string) => Promise<{
|
|
|
49
48
|
* @returns Object containing the service or null if not found
|
|
50
49
|
*/
|
|
51
50
|
export declare const getServiceBySlug: (slug: string, appId?: string) => Promise<{
|
|
52
|
-
service:
|
|
51
|
+
service: Service | null;
|
|
53
52
|
}>;
|
|
54
53
|
/**
|
|
55
54
|
* Query services with pagination and sorting.
|
|
@@ -73,6 +72,6 @@ export declare const getServiceBySlug: (slug: string, appId?: string) => Promise
|
|
|
73
72
|
* ```
|
|
74
73
|
*/
|
|
75
74
|
export declare function queryServices({ appId, filters, pagingMetadata, sort, }: QueryServicesRequest): Promise<{
|
|
76
|
-
services:
|
|
75
|
+
services: Service[];
|
|
77
76
|
pagingMetadata: PagingMetadata;
|
|
78
77
|
}>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Query Services API
|
|
3
3
|
* Fetches single or multiple services with pagination and sorting
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { queryServices as queryServicesApi, } from '@wix/auto_sdk_bookings_services';
|
|
6
6
|
/**
|
|
7
7
|
* Booking app ID constant
|
|
8
8
|
*/
|
|
@@ -17,7 +17,7 @@ export const getServiceById = async (id, appId) => {
|
|
|
17
17
|
try {
|
|
18
18
|
const finalAppId = appId ?? BOOKING_APP_ID;
|
|
19
19
|
// Query services where _id equals the provided id and appId matches
|
|
20
|
-
const query =
|
|
20
|
+
const query = queryServicesApi({
|
|
21
21
|
conditionalFields: ['STAFF_MEMBER_DETAILS'],
|
|
22
22
|
});
|
|
23
23
|
const result = await query
|
|
@@ -44,7 +44,7 @@ export const getServiceBySlug = async (slug, appId) => {
|
|
|
44
44
|
try {
|
|
45
45
|
const finalAppId = appId ?? BOOKING_APP_ID;
|
|
46
46
|
// Query services where mainSlug.name equals the provided slug and appId matches
|
|
47
|
-
const query =
|
|
47
|
+
const query = queryServicesApi({
|
|
48
48
|
conditionalFields: ['STAFF_MEMBER_DETAILS'],
|
|
49
49
|
});
|
|
50
50
|
const result = await query
|
|
@@ -115,7 +115,7 @@ export async function queryServices({ appId, filters, pagingMetadata, sort, }) {
|
|
|
115
115
|
sort,
|
|
116
116
|
});
|
|
117
117
|
// Call queryServices with QueryServicesRequest and execute the query
|
|
118
|
-
const result = await
|
|
118
|
+
const result = await queryServicesApi(queryRequest).find();
|
|
119
119
|
// Construct PagingMetadata from result properties
|
|
120
120
|
// Includes count (number of items returned) and hasNext (whether more items are available)
|
|
121
121
|
const resultPagingMetadata = {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time Slot List API
|
|
3
|
+
* Fetches available time slots for booking services from Wix Bookings
|
|
4
|
+
*/
|
|
5
|
+
import { type Location, type CursorPaging, type CursorPagingMetadata } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
6
|
+
import { type Service } from '@wix/auto_sdk_bookings_services';
|
|
7
|
+
import { ViewMode, type TimeSlot } from '../../services/time-slot-list/time-slot-list.def.js';
|
|
8
|
+
export interface FetchAvailabilityOptions {
|
|
9
|
+
services: Service[];
|
|
10
|
+
fromLocalDate?: string | null;
|
|
11
|
+
toLocalDate?: string | null;
|
|
12
|
+
timeZone?: string | null;
|
|
13
|
+
locations?: Location[];
|
|
14
|
+
cursorPaging?: CursorPaging;
|
|
15
|
+
viewMode?: ViewMode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Response from fetchAvailability with grouped time slots
|
|
19
|
+
*/
|
|
20
|
+
export interface FetchAvailabilityResponse {
|
|
21
|
+
/** Grouped time slots (one per unique time) */
|
|
22
|
+
timeSlots: TimeSlot[];
|
|
23
|
+
/** Cursor pagination metadata for loading more results */
|
|
24
|
+
cursorPagingMetadata?: CursorPagingMetadata;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Main entry point for fetching availability
|
|
28
|
+
* Detects flow type, calls appropriate API, and groups slots by time
|
|
29
|
+
*
|
|
30
|
+
* @param options - Fetch options including services, date range, timezone, and view mode
|
|
31
|
+
* @returns Promise with grouped time slots
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const response = await fetchAvailability({
|
|
36
|
+
* services: [service],
|
|
37
|
+
* fromLocalDate: '2024-01-15T00:00:00',
|
|
38
|
+
* toLocalDate: '2024-01-22T00:00:00',
|
|
39
|
+
* timeZone: 'America/New_York',
|
|
40
|
+
* viewMode: ViewMode.CLASSIC,
|
|
41
|
+
* });
|
|
42
|
+
* // response.timeSlots are grouped by time
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function fetchAvailability({ services: selectedServices, viewMode, fromLocalDate, toLocalDate, timeZone, locations, cursorPaging, }: {
|
|
46
|
+
services: Service[];
|
|
47
|
+
fromLocalDate: string;
|
|
48
|
+
toLocalDate: string;
|
|
49
|
+
timeZone?: string;
|
|
50
|
+
locations?: Location[];
|
|
51
|
+
cursorPaging?: CursorPaging;
|
|
52
|
+
viewMode?: ViewMode;
|
|
53
|
+
}): Promise<FetchAvailabilityResponse>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time Slot List API
|
|
3
|
+
* Fetches available time slots for booking services from Wix Bookings
|
|
4
|
+
*/
|
|
5
|
+
import { listAvailabilityTimeSlots, } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
6
|
+
import { ServiceType } from '@wix/auto_sdk_bookings_services';
|
|
7
|
+
import { ViewMode, } from '../../services/time-slot-list/time-slot-list.def.js';
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Internal Types
|
|
10
|
+
// ============================================================================
|
|
11
|
+
var FlowType;
|
|
12
|
+
(function (FlowType) {
|
|
13
|
+
FlowType["SINGLE_SERVICE"] = "single_service";
|
|
14
|
+
FlowType["MULTI_SERVICE"] = "multi_service";
|
|
15
|
+
FlowType["CLASS"] = "class";
|
|
16
|
+
})(FlowType || (FlowType = {}));
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Grouping Functions
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Groups API time slots by their start time
|
|
22
|
+
* Multiple slots for the same time (different locations) are merged into one
|
|
23
|
+
*/
|
|
24
|
+
function groupTimeSlotsByTime(apiSlots) {
|
|
25
|
+
const groupedMap = new Map();
|
|
26
|
+
for (const apiSlot of apiSlots) {
|
|
27
|
+
const key = apiSlot.localStartDate;
|
|
28
|
+
if (!groupedMap.has(key)) {
|
|
29
|
+
// Create new grouped slot - omit location and availableResources
|
|
30
|
+
const { location: _location, availableResources: _availableResources, ...rest } = apiSlot;
|
|
31
|
+
groupedMap.set(key, {
|
|
32
|
+
...rest,
|
|
33
|
+
staffByLocation: [],
|
|
34
|
+
originalSlots: [],
|
|
35
|
+
id: apiSlot.localStartDate,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const groupedSlot = groupedMap.get(key);
|
|
39
|
+
// Extract staff members with IDs and names from availableResources
|
|
40
|
+
const staffMembers = (apiSlot.availableResources || [])
|
|
41
|
+
.flatMap((resourceGroup) => resourceGroup.resources || [])
|
|
42
|
+
.filter((resource) => resource._id && resource.name)
|
|
43
|
+
.map((resource) => ({
|
|
44
|
+
id: resource._id,
|
|
45
|
+
name: resource.name,
|
|
46
|
+
}));
|
|
47
|
+
// Add this slot's location/staff info
|
|
48
|
+
const staffByLocation = {
|
|
49
|
+
location: {
|
|
50
|
+
id: apiSlot.location?._id,
|
|
51
|
+
name: apiSlot.location?.name,
|
|
52
|
+
},
|
|
53
|
+
staffMembers,
|
|
54
|
+
};
|
|
55
|
+
groupedSlot.staffByLocation.push(staffByLocation);
|
|
56
|
+
// Store original slot for booking service
|
|
57
|
+
groupedSlot.originalSlots.push(apiSlot);
|
|
58
|
+
}
|
|
59
|
+
return Array.from(groupedMap.values());
|
|
60
|
+
}
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// Internal Flow Detection
|
|
63
|
+
// ============================================================================
|
|
64
|
+
/**
|
|
65
|
+
* Detects the booking flow type based on services and view mode
|
|
66
|
+
*/
|
|
67
|
+
function detectFlow(bookingServices, viewMode) {
|
|
68
|
+
if (bookingServices.length === 0) {
|
|
69
|
+
if (viewMode === ViewMode.AGENDA) {
|
|
70
|
+
return FlowType.CLASS; // AGENDA can fetch all classes without specifying services
|
|
71
|
+
}
|
|
72
|
+
throw new Error('Services required for classic view mode');
|
|
73
|
+
}
|
|
74
|
+
const allAppointments = bookingServices.every((s) => s.type === ServiceType.APPOINTMENT);
|
|
75
|
+
const allClasses = bookingServices.every((s) => s.type === ServiceType.CLASS);
|
|
76
|
+
if (!allAppointments && !allClasses) {
|
|
77
|
+
throw new Error('All services must be either appointments or classes');
|
|
78
|
+
}
|
|
79
|
+
if (allClasses)
|
|
80
|
+
return FlowType.CLASS;
|
|
81
|
+
if (bookingServices.length === 1)
|
|
82
|
+
return FlowType.SINGLE_SERVICE;
|
|
83
|
+
return FlowType.MULTI_SERVICE;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Main entry point for fetching availability
|
|
87
|
+
* Detects flow type, calls appropriate API, and groups slots by time
|
|
88
|
+
*
|
|
89
|
+
* @param options - Fetch options including services, date range, timezone, and view mode
|
|
90
|
+
* @returns Promise with grouped time slots
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const response = await fetchAvailability({
|
|
95
|
+
* services: [service],
|
|
96
|
+
* fromLocalDate: '2024-01-15T00:00:00',
|
|
97
|
+
* toLocalDate: '2024-01-22T00:00:00',
|
|
98
|
+
* timeZone: 'America/New_York',
|
|
99
|
+
* viewMode: ViewMode.CLASSIC,
|
|
100
|
+
* });
|
|
101
|
+
* // response.timeSlots are grouped by time
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export async function fetchAvailability({ services: selectedServices, viewMode = ViewMode.CLASSIC, fromLocalDate, toLocalDate, timeZone, locations, cursorPaging, }) {
|
|
105
|
+
const flow = detectFlow(selectedServices, viewMode);
|
|
106
|
+
if (flow === FlowType.SINGLE_SERVICE) {
|
|
107
|
+
const serviceId = selectedServices[0]?._id;
|
|
108
|
+
if (!serviceId) {
|
|
109
|
+
throw new Error('Service ID is required');
|
|
110
|
+
}
|
|
111
|
+
const response = await listAvailabilityTimeSlots({
|
|
112
|
+
serviceId,
|
|
113
|
+
fromLocalDate,
|
|
114
|
+
toLocalDate,
|
|
115
|
+
timeZone,
|
|
116
|
+
locations,
|
|
117
|
+
cursorPaging,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
timeSlots: groupTimeSlotsByTime(response.timeSlots || []),
|
|
121
|
+
cursorPagingMetadata: response.cursorPagingMetadata,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (flow === FlowType.MULTI_SERVICE) {
|
|
125
|
+
// Phase 2: Multi-service support
|
|
126
|
+
throw new Error('Multi-service appointments not yet supported');
|
|
127
|
+
}
|
|
128
|
+
if (flow === FlowType.CLASS) {
|
|
129
|
+
// Phase 2: Class support
|
|
130
|
+
throw new Error('Class bookings not yet supported');
|
|
131
|
+
}
|
|
132
|
+
throw new Error(`Unknown flow type: ${flow}`);
|
|
133
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type BookingServiceConfig, type BookingSelection } from '../../../services/booking/booking.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { TimeSlot } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
8
8
|
/**
|
|
9
9
|
* Props for Booking.Root component
|
|
10
10
|
*/
|
|
@@ -34,7 +34,7 @@ export declare function Root(props: RootProps): React.ReactNode;
|
|
|
34
34
|
export interface DataProps {
|
|
35
35
|
children: (data: {
|
|
36
36
|
bookingSelections: BookingSelection[];
|
|
37
|
-
selectedTimeSlot:
|
|
37
|
+
selectedTimeSlot: TimeSlot | null;
|
|
38
38
|
}) => React.ReactNode;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Converts location data to Address component format
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { LocationType, type Service } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { AddressData as AddressDataType } from '@wix/headless-components/react';
|
|
9
9
|
/**
|
|
10
10
|
* Re-export AddressData type from Address component for convenience
|
|
@@ -14,14 +14,14 @@ export type AddressData = AddressDataType;
|
|
|
14
14
|
* Location render props passed to children
|
|
15
15
|
*/
|
|
16
16
|
export interface LocationRenderProps {
|
|
17
|
-
locationType:
|
|
17
|
+
locationType: LocationType;
|
|
18
18
|
address: AddressData | null;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Props for the core Location component
|
|
22
22
|
*/
|
|
23
23
|
export interface LocationProps {
|
|
24
|
-
location: NonNullable<
|
|
24
|
+
location: NonNullable<Service['locations']>[number];
|
|
25
25
|
children: (props: LocationRenderProps) => React.ReactNode;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Handles business, custom, and customer location types
|
|
4
4
|
* Converts location data to Address component format
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { LocationType } from '@wix/auto_sdk_bookings_services';
|
|
7
7
|
/**
|
|
8
8
|
* Parses location data into Address component format
|
|
9
9
|
*/
|
|
10
10
|
function parseLocationAddress(location, locationType) {
|
|
11
11
|
// Handle customer location specially
|
|
12
|
-
if (locationType ===
|
|
12
|
+
if (locationType === LocationType.CUSTOMER) {
|
|
13
13
|
// For customer location, return an AddressData object with Customer's Place
|
|
14
14
|
return {
|
|
15
15
|
address: {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type ServiceServiceConfig } from '../../../services/service/service.js';
|
|
7
|
-
import {
|
|
7
|
+
import type { Service, Payment, BookingPolicy, Schedule } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { MoneyData } from '@wix/headless-components/react';
|
|
9
9
|
/**
|
|
10
10
|
* Props for Service.Root component
|
|
@@ -22,7 +22,7 @@ export declare function Root(props: RootProps): React.ReactNode;
|
|
|
22
22
|
*/
|
|
23
23
|
export interface ServiceProps {
|
|
24
24
|
children: (data: {
|
|
25
|
-
service:
|
|
25
|
+
service: Service;
|
|
26
26
|
isLoading: boolean;
|
|
27
27
|
error: string | null;
|
|
28
28
|
}) => React.ReactNode;
|
|
@@ -55,7 +55,7 @@ export interface InfoProps {
|
|
|
55
55
|
name?: string;
|
|
56
56
|
_id?: string;
|
|
57
57
|
};
|
|
58
|
-
locations?: Array<NonNullable<
|
|
58
|
+
locations?: Array<NonNullable<Service['locations']>[number]>;
|
|
59
59
|
staff?: Array<{
|
|
60
60
|
name?: string;
|
|
61
61
|
_id?: string;
|
|
@@ -110,8 +110,8 @@ export declare function Info(props: InfoProps): React.ReactNode;
|
|
|
110
110
|
*/
|
|
111
111
|
export interface PriceProps {
|
|
112
112
|
children: (data: {
|
|
113
|
-
servicePayment:
|
|
114
|
-
rateType:
|
|
113
|
+
servicePayment: Payment | undefined;
|
|
114
|
+
rateType: Payment['rateType'] | undefined;
|
|
115
115
|
money: MoneyData | null;
|
|
116
116
|
minPrice: MoneyData | null;
|
|
117
117
|
maxPrice: MoneyData | null;
|
|
@@ -151,7 +151,7 @@ export interface ActionsProps {
|
|
|
151
151
|
select: () => void;
|
|
152
152
|
add: () => void;
|
|
153
153
|
remove: () => void;
|
|
154
|
-
rawService:
|
|
154
|
+
rawService: Service;
|
|
155
155
|
bookable: boolean;
|
|
156
156
|
selected: boolean;
|
|
157
157
|
requiresAvailability: boolean;
|
|
@@ -180,7 +180,7 @@ export declare function Actions(props: ActionsProps): React.ReactNode;
|
|
|
180
180
|
*/
|
|
181
181
|
export interface PolicyProps {
|
|
182
182
|
children: (data: {
|
|
183
|
-
bookingPolicy:
|
|
183
|
+
bookingPolicy: BookingPolicy | null;
|
|
184
184
|
cancellationPolicyEnabled: boolean;
|
|
185
185
|
limitLatestCancellationEnabled: boolean;
|
|
186
186
|
latestCancellationInMinutes: number | undefined;
|
|
@@ -219,7 +219,7 @@ export declare function Policy(props: PolicyProps): React.ReactNode;
|
|
|
219
219
|
*/
|
|
220
220
|
export interface ScheduleProps {
|
|
221
221
|
children: (data: {
|
|
222
|
-
schedule:
|
|
222
|
+
schedule: Schedule | null;
|
|
223
223
|
isClassOrCourse: boolean;
|
|
224
224
|
}) => React.ReactNode;
|
|
225
225
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type ServiceListServiceConfig, type QueryOptions } from '../../../services/service-list/service-list.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { PagingMetadata } from '../../../api/query-services/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Props for ServiceList.Root component
|
|
@@ -37,7 +37,7 @@ export interface ServicesProps {
|
|
|
37
37
|
*/
|
|
38
38
|
export interface ServicesRenderProps {
|
|
39
39
|
/** Array of services */
|
|
40
|
-
services:
|
|
40
|
+
services: Service[];
|
|
41
41
|
/** Whether services are currently loading */
|
|
42
42
|
isLoading: boolean;
|
|
43
43
|
/** Error message, or null if no error */
|