@wix/headless-bookings 0.0.113 → 0.0.115
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/__mocks__/booking/booking-mocks.d.ts +1 -1
- package/cjs/dist/api/create-booking/index.d.ts +1 -1
- package/cjs/dist/react/booking-form/BookingForm.d.ts +1 -1
- package/cjs/dist/react/booking-form/BookingForm.js +3 -3
- package/cjs/dist/react/core/booking/Booking.d.ts +1 -1
- package/cjs/dist/react/core/booking-form/BookingForm.d.ts +3 -3
- package/cjs/dist/react/core/booking-form/BookingForm.js +4 -4
- package/cjs/dist/services/booking/book-action/canBook.d.ts +1 -1
- package/cjs/dist/services/booking/book-action/types.d.ts +1 -1
- package/cjs/dist/services/booking/booking.d.ts +1 -1
- package/cjs/dist/services/booking-form/booking-form.d.ts +1 -1
- package/dist/__mocks__/booking/booking-mocks.d.ts +1 -1
- package/dist/api/create-booking/index.d.ts +1 -1
- package/dist/react/booking-form/BookingForm.d.ts +1 -1
- package/dist/react/booking-form/BookingForm.js +1 -1
- package/dist/react/core/booking/Booking.d.ts +1 -1
- package/dist/react/core/booking-form/BookingForm.d.ts +3 -3
- package/dist/react/core/booking-form/BookingForm.js +3 -3
- package/dist/services/booking/book-action/canBook.d.ts +1 -1
- package/dist/services/booking/book-action/types.d.ts +1 -1
- package/dist/services/booking/booking.d.ts +1 -1
- package/dist/services/booking-form/booking-form.d.ts +1 -1
- package/package.json +6 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormValues } from '@wix/
|
|
1
|
+
import type { FormValues } from '@wix/forms/components';
|
|
2
2
|
import type { Location } from '@wix/auto_sdk_bookings_services';
|
|
3
3
|
import type { ServiceSelection, ServiceSelectionTimeSlot, ExtendedResource } from '../../services/booking/booking.js';
|
|
4
4
|
export declare function createMockResource(overrides?: Partial<ExtendedResource>): ExtendedResource;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Wrapper for the Wix Bookings createBooking SDK function
|
|
4
4
|
*/
|
|
5
5
|
import { type Booking, type CreateBookingResponse, type ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
6
|
-
import type { FormValues } from '@wix/
|
|
6
|
+
import type { FormValues } from '@wix/forms/components';
|
|
7
7
|
/**
|
|
8
8
|
* Options for creating a booking
|
|
9
9
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides components for displaying and managing booking form fields
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { Form } from '@wix/
|
|
6
|
+
import { Form } from '@wix/forms/components';
|
|
7
7
|
import type { BookingFormRenderProps } from '../core/booking-form/BookingForm.js';
|
|
8
8
|
type FieldMap = Parameters<typeof Form.Fields>[0]['fieldMap'];
|
|
9
9
|
export declare const TestIds: {
|
|
@@ -44,7 +44,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
44
44
|
*/
|
|
45
45
|
const react_1 = __importDefault(require("react"));
|
|
46
46
|
const react_2 = require("@wix/headless-utils/react");
|
|
47
|
-
const
|
|
47
|
+
const components_1 = require("@wix/forms/components");
|
|
48
48
|
const CoreBookingForm = __importStar(require("../core/booking-form/BookingForm.js"));
|
|
49
49
|
const booking_form_js_1 = require("../../services/booking-form/booking-form.js");
|
|
50
50
|
/**
|
|
@@ -162,7 +162,7 @@ exports.Root = react_1.default.forwardRef((props, ref) => {
|
|
|
162
162
|
fields: renderProps.fields,
|
|
163
163
|
rowGapClassname,
|
|
164
164
|
columnGapClassname,
|
|
165
|
-
}, children: (0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": exports.TestIds.bookingFormRoot, ...otherProps, children: (0, jsx_runtime_1.jsx)("div", { children: children ?? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
165
|
+
}, children: (0, jsx_runtime_1.jsx)(react_2.AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": exports.TestIds.bookingFormRoot, ...otherProps, children: (0, jsx_runtime_1.jsx)("div", { children: children ?? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Form.Loading, { className: "flex justify-center p-4 text-foreground" }), (0, jsx_runtime_1.jsx)(components_1.Form.LoadingError, { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-lg mb-4" }), (0, jsx_runtime_1.jsx)(components_1.Form.Fields, { fieldMap: renderProps.fields, rowGapClassname: rowGapClassname, columnGapClassname: columnGapClassname }), (0, jsx_runtime_1.jsx)(components_1.Form.Error, { className: "mt-4 bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-lg" }), (0, jsx_runtime_1.jsx)(components_1.Form.Submitted, { className: "mt-4 bg-green-500/10 border border-green-500/20 text-green-500 px-4 py-3 rounded-lg" })] })) }) }) }));
|
|
166
166
|
} }) }));
|
|
167
167
|
});
|
|
168
168
|
exports.Root.displayName = 'BookingForm.Root';
|
|
@@ -195,7 +195,7 @@ function useBookingFormContext() {
|
|
|
195
195
|
exports.Fields = react_1.default.forwardRef((props, ref) => {
|
|
196
196
|
const context = useBookingFormContext();
|
|
197
197
|
const { rowGapClassname = context.rowGapClassname, columnGapClassname = context.columnGapClassname, className, ...otherProps } = props;
|
|
198
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: className, "data-testid": exports.TestIds.bookingFormFields, ...otherProps, children: (0, jsx_runtime_1.jsx)(
|
|
198
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: className, "data-testid": exports.TestIds.bookingFormFields, ...otherProps, children: (0, jsx_runtime_1.jsx)(components_1.Form.Fields, { fieldMap: context.fields, rowGapClassname: rowGapClassname, columnGapClassname: columnGapClassname }) }));
|
|
199
199
|
});
|
|
200
200
|
exports.Fields.displayName = 'BookingForm.Fields';
|
|
201
201
|
// ============================================================================
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type BookingServiceConfig, type ServiceSelection, type BookingServiceActions } from '../../../services/booking/booking.js';
|
|
7
|
-
import type { FormValues } from '@wix/
|
|
7
|
+
import type { FormValues } from '@wix/forms/components';
|
|
8
8
|
import type { TimeSlot, Resource } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
9
9
|
import { type Service, type Location as ServiceLocationType } from '@wix/auto_sdk_bookings_services';
|
|
10
10
|
import type { PricingServiceSelection } from '../../../services/payment/payment.js';
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* 2. SSR/SSG: Provide a pre-loaded form object for server-side rendering
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
|
-
import { type FormValues } from '@wix/
|
|
12
|
+
import { type FormValues } from '@wix/forms/components';
|
|
13
13
|
import { forms, submissions } from '@wix/forms';
|
|
14
14
|
import { BookingFormConfigurationError } from '../../../services/booking-form/booking-form.js';
|
|
15
|
-
import { Form } from '@wix/
|
|
15
|
+
import { Form } from '@wix/forms/components';
|
|
16
16
|
type FieldMap = Parameters<typeof Form.Fields>[0]['fieldMap'];
|
|
17
17
|
export type Submit = () => Promise<submissions.GetSubmissionResponse['submission'] | undefined>;
|
|
18
18
|
export type ValidateStep = (stepId: string) => Promise<boolean>;
|
|
@@ -95,7 +95,7 @@ export type BookingFormProps = BookingFormWithFormIdProps | BookingFormWithFormP
|
|
|
95
95
|
* ```tsx
|
|
96
96
|
* // Pattern 1: Client-side loading
|
|
97
97
|
* import * as CoreBookingForm from '@wix/headless-bookings/react/core/booking-form';
|
|
98
|
-
* import { Form } from '@wix/
|
|
98
|
+
* import { Form } from '@wix/forms/components';
|
|
99
99
|
*
|
|
100
100
|
* <CoreBookingForm.Root formId="form-123">
|
|
101
101
|
* {({ formId, setFormSubmission, fields }) => (
|
|
@@ -54,8 +54,8 @@ const services_manager_1 = require("@wix/services-manager");
|
|
|
54
54
|
const booking_form_js_1 = require("../../../services/booking-form/booking-form.js");
|
|
55
55
|
Object.defineProperty(exports, "BookingFormConfigurationError", { enumerable: true, get: function () { return booking_form_js_1.BookingFormConfigurationError; } });
|
|
56
56
|
const booking_js_1 = require("../../../services/booking/booking.js");
|
|
57
|
-
const
|
|
58
|
-
const services_1 = require("@wix/
|
|
57
|
+
const components_1 = require("@wix/forms/components");
|
|
58
|
+
const services_1 = require("@wix/forms/services");
|
|
59
59
|
const signals_1 = require("@wix/services-definitions/core-services/signals");
|
|
60
60
|
// ============================================================================
|
|
61
61
|
// Component
|
|
@@ -80,7 +80,7 @@ const signals_1 = require("@wix/services-definitions/core-services/signals");
|
|
|
80
80
|
* ```tsx
|
|
81
81
|
* // Pattern 1: Client-side loading
|
|
82
82
|
* import * as CoreBookingForm from '@wix/headless-bookings/react/core/booking-form';
|
|
83
|
-
* import { Form } from '@wix/
|
|
83
|
+
* import { Form } from '@wix/forms/components';
|
|
84
84
|
*
|
|
85
85
|
* <CoreBookingForm.Root formId="form-123">
|
|
86
86
|
* {({ formId, setFormSubmission, fields }) => (
|
|
@@ -147,7 +147,7 @@ function FormWrapper({ children, formRef, }) {
|
|
|
147
147
|
if (!formServiceConfig) {
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
150
|
+
return ((0, jsx_runtime_1.jsx)(components_1.Form.Root, { formServiceConfig: formServiceConfig, formRef: formRef, children: children }));
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* Internal component that consumes BookingFormService and provides render props.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Types for the Book action
|
|
3
3
|
*/
|
|
4
4
|
import type { ServiceSelection } from '../booking.js';
|
|
5
|
-
import type { FormValues } from '@wix/
|
|
5
|
+
import type { FormValues } from '@wix/forms/components';
|
|
6
6
|
import type { Location as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
7
7
|
/**
|
|
8
8
|
* Enum for book result types
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { type Signal } from '@wix/services-definitions/core-services/signals';
|
|
7
7
|
import type { Service, Location as ServiceLocationType } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { Resource, EventInfo, Location as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
9
|
-
import type { FormValues } from '@wix/
|
|
9
|
+
import type { FormValues } from '@wix/forms/components';
|
|
10
10
|
import type { BookResult } from './book-action/types.js';
|
|
11
11
|
/**
|
|
12
12
|
* Extended Resource type with a type field for categorization
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
|
|
11
11
|
import { forms } from '@wix/forms';
|
|
12
|
-
import { FormServiceConfig } from '@wix/
|
|
12
|
+
import { FormServiceConfig } from '@wix/forms/services';
|
|
13
13
|
/**
|
|
14
14
|
* The required namespace for booking forms.
|
|
15
15
|
* All booking forms must belong to this namespace.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormValues } from '@wix/
|
|
1
|
+
import type { FormValues } from '@wix/forms/components';
|
|
2
2
|
import type { Location } from '@wix/auto_sdk_bookings_services';
|
|
3
3
|
import type { ServiceSelection, ServiceSelectionTimeSlot, ExtendedResource } from '../../services/booking/booking.js';
|
|
4
4
|
export declare function createMockResource(overrides?: Partial<ExtendedResource>): ExtendedResource;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Wrapper for the Wix Bookings createBooking SDK function
|
|
4
4
|
*/
|
|
5
5
|
import { type Booking, type CreateBookingResponse, type ParticipantNotification } from '@wix/auto_sdk_bookings_bookings';
|
|
6
|
-
import type { FormValues } from '@wix/
|
|
6
|
+
import type { FormValues } from '@wix/forms/components';
|
|
7
7
|
/**
|
|
8
8
|
* Options for creating a booking
|
|
9
9
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides components for displaying and managing booking form fields
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { Form } from '@wix/
|
|
6
|
+
import { Form } from '@wix/forms/components';
|
|
7
7
|
import type { BookingFormRenderProps } from '../core/booking-form/BookingForm.js';
|
|
8
8
|
type FieldMap = Parameters<typeof Form.Fields>[0]['fieldMap'];
|
|
9
9
|
export declare const TestIds: {
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
8
|
-
import { Form } from '@wix/
|
|
8
|
+
import { Form } from '@wix/forms/components';
|
|
9
9
|
import * as CoreBookingForm from '../core/booking-form/BookingForm.js';
|
|
10
10
|
import { BookingFormConfigurationError } from '../../services/booking-form/booking-form.js';
|
|
11
11
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type BookingServiceConfig, type ServiceSelection, type BookingServiceActions } from '../../../services/booking/booking.js';
|
|
7
|
-
import type { FormValues } from '@wix/
|
|
7
|
+
import type { FormValues } from '@wix/forms/components';
|
|
8
8
|
import type { TimeSlot, Resource } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
9
9
|
import { type Service, type Location as ServiceLocationType } from '@wix/auto_sdk_bookings_services';
|
|
10
10
|
import type { PricingServiceSelection } from '../../../services/payment/payment.js';
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* 2. SSR/SSG: Provide a pre-loaded form object for server-side rendering
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
|
-
import { type FormValues } from '@wix/
|
|
12
|
+
import { type FormValues } from '@wix/forms/components';
|
|
13
13
|
import { forms, submissions } from '@wix/forms';
|
|
14
14
|
import { BookingFormConfigurationError } from '../../../services/booking-form/booking-form.js';
|
|
15
|
-
import { Form } from '@wix/
|
|
15
|
+
import { Form } from '@wix/forms/components';
|
|
16
16
|
type FieldMap = Parameters<typeof Form.Fields>[0]['fieldMap'];
|
|
17
17
|
export type Submit = () => Promise<submissions.GetSubmissionResponse['submission'] | undefined>;
|
|
18
18
|
export type ValidateStep = (stepId: string) => Promise<boolean>;
|
|
@@ -95,7 +95,7 @@ export type BookingFormProps = BookingFormWithFormIdProps | BookingFormWithFormP
|
|
|
95
95
|
* ```tsx
|
|
96
96
|
* // Pattern 1: Client-side loading
|
|
97
97
|
* import * as CoreBookingForm from '@wix/headless-bookings/react/core/booking-form';
|
|
98
|
-
* import { Form } from '@wix/
|
|
98
|
+
* import { Form } from '@wix/forms/components';
|
|
99
99
|
*
|
|
100
100
|
* <CoreBookingForm.Root formId="form-123">
|
|
101
101
|
* {({ formId, setFormSubmission, fields }) => (
|
|
@@ -15,8 +15,8 @@ import { WixServices, useService } from '@wix/services-manager-react';
|
|
|
15
15
|
import { createServicesMap } from '@wix/services-manager';
|
|
16
16
|
import { BookingFormServiceDefinition, BookingFormService, BookingFormConfigurationError, } from '../../../services/booking-form/booking-form.js';
|
|
17
17
|
import { BookingServiceDefinition } from '../../../services/booking/booking.js';
|
|
18
|
-
import { Form } from '@wix/
|
|
19
|
-
import { FormServiceDefinition } from '@wix/
|
|
18
|
+
import { Form } from '@wix/forms/components';
|
|
19
|
+
import { FormServiceDefinition } from '@wix/forms/services';
|
|
20
20
|
import { SignalsServiceDefinition } from '@wix/services-definitions/core-services/signals';
|
|
21
21
|
// ============================================================================
|
|
22
22
|
// Component
|
|
@@ -41,7 +41,7 @@ import { SignalsServiceDefinition } from '@wix/services-definitions/core-service
|
|
|
41
41
|
* ```tsx
|
|
42
42
|
* // Pattern 1: Client-side loading
|
|
43
43
|
* import * as CoreBookingForm from '@wix/headless-bookings/react/core/booking-form';
|
|
44
|
-
* import { Form } from '@wix/
|
|
44
|
+
* import { Form } from '@wix/forms/components';
|
|
45
45
|
*
|
|
46
46
|
* <CoreBookingForm.Root formId="form-123">
|
|
47
47
|
* {({ formId, setFormSubmission, fields }) => (
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Types for the Book action
|
|
3
3
|
*/
|
|
4
4
|
import type { ServiceSelection } from '../booking.js';
|
|
5
|
-
import type { FormValues } from '@wix/
|
|
5
|
+
import type { FormValues } from '@wix/forms/components';
|
|
6
6
|
import type { Location as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
7
7
|
/**
|
|
8
8
|
* Enum for book result types
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { type Signal } from '@wix/services-definitions/core-services/signals';
|
|
7
7
|
import type { Service, Location as ServiceLocationType } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { Resource, EventInfo, Location as TimeSlotLocationType } from '@wix/auto_sdk_bookings_availability-time-slots';
|
|
9
|
-
import type { FormValues } from '@wix/
|
|
9
|
+
import type { FormValues } from '@wix/forms/components';
|
|
10
10
|
import type { BookResult } from './book-action/types.js';
|
|
11
11
|
/**
|
|
12
12
|
* Extended Resource type with a type field for categorization
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
|
|
11
11
|
import { forms } from '@wix/forms';
|
|
12
|
-
import { FormServiceConfig } from '@wix/
|
|
12
|
+
import { FormServiceConfig } from '@wix/forms/services';
|
|
13
13
|
/**
|
|
14
14
|
* The required namespace for booking forms.
|
|
15
15
|
* All booking forms must belong to this namespace.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-bookings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"test": "vitest",
|
|
12
12
|
"lint:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
13
13
|
"lint:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
14
|
-
"test:cjs-esm": "cjs-esm-build-verifier"
|
|
14
|
+
"test:cjs-esm": "cjs-esm-build-verifier --subpath react services"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
@@ -37,10 +37,9 @@
|
|
|
37
37
|
"@wix/auto_sdk_bookings_bookings": "^1.0.103",
|
|
38
38
|
"@wix/auto_sdk_bookings_event-time-slots": "^1.0.64",
|
|
39
39
|
"@wix/auto_sdk_ecom_checkout": "^1.0.104",
|
|
40
|
-
"@wix/
|
|
41
|
-
"@wix/headless-
|
|
42
|
-
"@wix/headless-
|
|
43
|
-
"@wix/headless-utils": "0.0.11",
|
|
40
|
+
"@wix/forms": "^1.0.384",
|
|
41
|
+
"@wix/headless-media": "0.0.25",
|
|
42
|
+
"@wix/headless-utils": "0.0.12",
|
|
44
43
|
"@wix/services-definitions": "^1.0.1",
|
|
45
44
|
"@wix/services-manager-react": "^1.0.3",
|
|
46
45
|
"date-fns": "^4.1.0"
|
|
@@ -74,5 +73,5 @@
|
|
|
74
73
|
"groupId": "com.wixpress.headless-components"
|
|
75
74
|
}
|
|
76
75
|
},
|
|
77
|
-
"falconPackageHash": "
|
|
76
|
+
"falconPackageHash": "e8e4b37ce6a7b9bfac6a0fe142561b5a359c37b6b3252e90c6bfb752"
|
|
78
77
|
}
|