@wix/bookings 1.0.238 → 1.0.239
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/build/cjs/index.d.ts +2 -2
- package/build/cjs/index.js +3 -3
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +2 -2
- package/build/cjs/index.typings.js +3 -3
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/src/bookings-catalog-v1-resource.http.d.ts +4 -45
- package/build/cjs/src/bookings-catalog-v1-resource.http.js +4 -77
- package/build/cjs/src/bookings-catalog-v1-resource.http.js.map +1 -1
- package/build/cjs/src/bookings-catalog-v1-resource.public.d.ts +4 -5
- package/build/cjs/src/bookings-catalog-v1-resource.public.js +3 -9
- package/build/cjs/src/bookings-catalog-v1-resource.public.js.map +1 -1
- package/build/cjs/src/bookings-catalog-v1-resource.types.d.ts +0 -302
- package/build/cjs/src/bookings-catalog-v1-resource.universal.d.ts +99 -203
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js +21 -115
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js.map +1 -1
- package/build/es/index.d.ts +2 -2
- package/build/es/index.js +2 -2
- package/build/es/index.js.map +1 -1
- package/build/es/index.typings.d.ts +2 -2
- package/build/es/index.typings.js +2 -2
- package/build/es/index.typings.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.http.d.ts +4 -45
- package/build/es/src/bookings-catalog-v1-resource.http.js +3 -75
- package/build/es/src/bookings-catalog-v1-resource.http.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.public.d.ts +4 -5
- package/build/es/src/bookings-catalog-v1-resource.public.js +3 -8
- package/build/es/src/bookings-catalog-v1-resource.public.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.types.d.ts +0 -302
- package/build/es/src/bookings-catalog-v1-resource.universal.d.ts +99 -203
- package/build/es/src/bookings-catalog-v1-resource.universal.js +20 -113
- package/build/es/src/bookings-catalog-v1-resource.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -18,13 +18,17 @@ export interface Resource {
|
|
|
18
18
|
phone?: string | null;
|
|
19
19
|
/** Resource description. */
|
|
20
20
|
description?: string | null;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
* @internal */
|
|
22
24
|
tag?: string | null;
|
|
23
25
|
/** Resource tags. Tags are used to identify, group, and filter the different types of resources. For example, 'staff' or 'room'. */
|
|
24
26
|
tags?: string[] | null;
|
|
25
27
|
/** Resource images. */
|
|
26
28
|
images?: string[];
|
|
27
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
* @internal */
|
|
28
32
|
schedules?: Schedule[];
|
|
29
33
|
/**
|
|
30
34
|
* List of IDs of schedules owned by this resource.
|
|
@@ -63,7 +67,9 @@ export interface Schedule {
|
|
|
63
67
|
* @readonly
|
|
64
68
|
*/
|
|
65
69
|
timeZone?: string | null;
|
|
66
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
* @internal */
|
|
67
73
|
intervals?: RecurringInterval[];
|
|
68
74
|
/** Default title for the schedule's sessions. Maximum length: 6000 characters. */
|
|
69
75
|
title?: string | null;
|
|
@@ -79,9 +85,13 @@ export interface Schedule {
|
|
|
79
85
|
* Must be at most `1` for schedule whose availability is affected by another schedule. E.g, appointment schedules of the Wix Bookings app.
|
|
80
86
|
*/
|
|
81
87
|
capacity?: number | null;
|
|
82
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
* @internal */
|
|
83
91
|
rate?: Rate;
|
|
84
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
* @internal */
|
|
85
95
|
availability?: Availability;
|
|
86
96
|
/**
|
|
87
97
|
* Number of participants registered to sessions in this schedule, calculated as the sum of the party sizes.
|
|
@@ -95,7 +105,9 @@ export interface Schedule {
|
|
|
95
105
|
* @readonly
|
|
96
106
|
*/
|
|
97
107
|
participants?: Participant[];
|
|
98
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
* @internal */
|
|
99
111
|
externalCalendarOverrides?: ExternalCalendarOverrides;
|
|
100
112
|
/**
|
|
101
113
|
* Schedule status.
|
|
@@ -122,7 +134,9 @@ export interface Schedule {
|
|
|
122
134
|
* @readonly
|
|
123
135
|
*/
|
|
124
136
|
inheritedFields?: string[];
|
|
125
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
* @internal */
|
|
126
140
|
conferenceProvider?: ConferenceProvider;
|
|
127
141
|
/**
|
|
128
142
|
* A conference created for the schedule. This is used when a participant is added to a schedule.
|
|
@@ -590,30 +604,37 @@ export interface ConferenceProvider {
|
|
|
590
604
|
providerId?: string;
|
|
591
605
|
}
|
|
592
606
|
export interface CalendarConference {
|
|
593
|
-
/**
|
|
607
|
+
/**
|
|
608
|
+
* @internal
|
|
609
|
+
* @internal */
|
|
594
610
|
_id?: string;
|
|
595
|
-
/**
|
|
611
|
+
/**
|
|
612
|
+
* @internal
|
|
613
|
+
* @internal */
|
|
596
614
|
externalId?: string;
|
|
597
|
-
/**
|
|
615
|
+
/**
|
|
616
|
+
* @internal
|
|
617
|
+
* @internal */
|
|
598
618
|
providerId?: string;
|
|
599
619
|
/** URL used by the host to start the conference. */
|
|
600
620
|
hostUrl?: string;
|
|
601
621
|
/** URL used by a guest to join the conference. */
|
|
602
622
|
guestUrl?: string;
|
|
603
|
-
/**
|
|
623
|
+
/**
|
|
624
|
+
* @internal
|
|
625
|
+
* @internal */
|
|
604
626
|
password?: string | null;
|
|
605
|
-
/**
|
|
627
|
+
/**
|
|
628
|
+
* @internal
|
|
629
|
+
* @internal */
|
|
606
630
|
description?: string | null;
|
|
607
631
|
/**
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
* One of:
|
|
611
|
-
* - `"ONLINE_MEETING_PROVIDER"` API-generated online meeting.
|
|
612
|
-
* - `"CUSTOM"` User-defined meeting.
|
|
613
|
-
* <!--END:ONLY:VELO-->
|
|
614
|
-
*/
|
|
632
|
+
* @internal
|
|
633
|
+
* @internal */
|
|
615
634
|
conferenceType?: ConferenceType;
|
|
616
|
-
/**
|
|
635
|
+
/**
|
|
636
|
+
* @internal
|
|
637
|
+
* @internal */
|
|
617
638
|
accountOwnerId?: string | null;
|
|
618
639
|
}
|
|
619
640
|
export declare enum ConferenceType {
|
|
@@ -911,81 +932,6 @@ export interface UnLinkResourceFromOwnerResponse {
|
|
|
911
932
|
/** The updated resource. */
|
|
912
933
|
resource?: Resource;
|
|
913
934
|
}
|
|
914
|
-
export interface QueryResourcesResponseNonNullableFields {
|
|
915
|
-
resources: {
|
|
916
|
-
images: string;
|
|
917
|
-
schedules: {
|
|
918
|
-
_id: string;
|
|
919
|
-
intervals: {
|
|
920
|
-
_id: string;
|
|
921
|
-
interval?: {
|
|
922
|
-
daysOfWeek: Day;
|
|
923
|
-
duration: number;
|
|
924
|
-
};
|
|
925
|
-
affectedSchedules: {
|
|
926
|
-
scheduleId: string;
|
|
927
|
-
transparency: Transparency;
|
|
928
|
-
scheduleOwnerId: string;
|
|
929
|
-
}[];
|
|
930
|
-
intervalType: RecurringIntervalType;
|
|
931
|
-
}[];
|
|
932
|
-
location?: {
|
|
933
|
-
locationType: LocationType;
|
|
934
|
-
customAddress?: {
|
|
935
|
-
streetAddress?: {
|
|
936
|
-
number: string;
|
|
937
|
-
name: string;
|
|
938
|
-
apt: string;
|
|
939
|
-
};
|
|
940
|
-
subdivisions: {
|
|
941
|
-
code: string;
|
|
942
|
-
name: string;
|
|
943
|
-
}[];
|
|
944
|
-
};
|
|
945
|
-
};
|
|
946
|
-
rate?: {
|
|
947
|
-
labeledPriceOptions?: {
|
|
948
|
-
amount: string;
|
|
949
|
-
currency: string;
|
|
950
|
-
downPayAmount: string;
|
|
951
|
-
};
|
|
952
|
-
};
|
|
953
|
-
availability?: {
|
|
954
|
-
linkedSchedules: {
|
|
955
|
-
scheduleId: string;
|
|
956
|
-
transparency: Transparency;
|
|
957
|
-
scheduleOwnerId: string;
|
|
958
|
-
}[];
|
|
959
|
-
constraints?: {
|
|
960
|
-
slotDurations: number[];
|
|
961
|
-
timeBetweenSlots: number;
|
|
962
|
-
};
|
|
963
|
-
};
|
|
964
|
-
totalNumberOfParticipants: number;
|
|
965
|
-
participants: {
|
|
966
|
-
_id: string;
|
|
967
|
-
partySize: number;
|
|
968
|
-
approvalStatus: ApprovalStatus;
|
|
969
|
-
inherited: boolean;
|
|
970
|
-
}[];
|
|
971
|
-
status: ScheduleStatus;
|
|
972
|
-
version: number;
|
|
973
|
-
inheritedFields: string[];
|
|
974
|
-
conferenceProvider?: {
|
|
975
|
-
providerId: string;
|
|
976
|
-
};
|
|
977
|
-
calendarConference?: {
|
|
978
|
-
_id: string;
|
|
979
|
-
externalId: string;
|
|
980
|
-
providerId: string;
|
|
981
|
-
hostUrl: string;
|
|
982
|
-
guestUrl: string;
|
|
983
|
-
conferenceType: ConferenceType;
|
|
984
|
-
};
|
|
985
|
-
}[];
|
|
986
|
-
status: ResourceStatus;
|
|
987
|
-
}[];
|
|
988
|
-
}
|
|
989
935
|
export interface CreateResourceResponseNonNullableFields {
|
|
990
936
|
resource?: {
|
|
991
937
|
images: string;
|
|
@@ -1419,51 +1365,18 @@ export interface UpdateScheduleResponseNonNullableFields {
|
|
|
1419
1365
|
export interface DeleteResourceResponseNonNullableFields {
|
|
1420
1366
|
_id: string;
|
|
1421
1367
|
}
|
|
1422
|
-
/**
|
|
1423
|
-
* Creates a query to retrieve extended resource information.
|
|
1424
|
-
*
|
|
1425
|
-
* The `queryResources()` function builds a query to retrieve a catalog of resources, including resources' related schedules and slugs, and returns a [`ResourceQueryBuilder`](#) object. The returned object contains the query definition, which is typically used to run the query using the [`find()`](#) function.
|
|
1426
|
-
*
|
|
1427
|
-
* The `ResourceQueryBuilder` functions enable you to run, filter, and control which results a query returns.
|
|
1428
|
-
*
|
|
1429
|
-
* Typically, you build a query using the `queryResources()` function, refine the query by chaining `ResourceQueryBuilder` functions, and then execute the query by chaining the `find()` function.
|
|
1430
|
-
*
|
|
1431
|
-
* The query runs with the following defaults that you can override:
|
|
1432
|
-
* - [`skip`](#): `0`
|
|
1433
|
-
* - [`limit`](#): `50`
|
|
1434
|
-
*
|
|
1435
|
-
* The following query builder functions are supported for `queryResources()`. For a full description of the `Resources` object, see the object returned for the [`items`](#) array in [`ResourceQueryResult`](#).
|
|
1436
|
-
* @public
|
|
1437
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1438
|
-
* @permissionScope Read Bookings - Public Data
|
|
1439
|
-
* @permissionScope Read bookings calendar - including participants
|
|
1440
|
-
* @permissionScope Read Bookings Calendar
|
|
1441
|
-
* @applicableIdentity APP
|
|
1442
|
-
* @applicableIdentity MEMBER
|
|
1443
|
-
* @applicableIdentity VISITOR
|
|
1444
|
-
*/
|
|
1445
|
-
export declare function queryResources(options?: QueryResourcesOptions): Promise<QueryResourcesResponse & QueryResourcesResponseNonNullableFields>;
|
|
1446
|
-
export interface QueryResourcesOptions {
|
|
1447
|
-
query?: QueryV2;
|
|
1448
|
-
}
|
|
1449
1368
|
/**
|
|
1450
1369
|
* Creates a resource.
|
|
1451
1370
|
*
|
|
1452
1371
|
*
|
|
1453
1372
|
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
1454
|
-
* Bookings resources are created with a schedule. The schedule
|
|
1455
|
-
*
|
|
1373
|
+
* Bookings resources are created with a schedule. The schedule determines the resource's availability by the business's default working hours.
|
|
1456
1374
|
*
|
|
1457
|
-
* When creating a resource using `createResource()`,
|
|
1458
|
-
* - If the resource uses the default business hours, get the business resource's schedule ID and include it in the `scheduleInfo.availability.linkedSchedules` array in the `scheduleInfo` parameter. The default hours can bee found in the Dashboard under **Settings** in the **Bookings** section, on the **Appointment hours** page.
|
|
1459
|
-
* - If the resource has its own custom working hours, create the resource, then create sessions of type `WORKING_HOURS` using the [`createSession()`](#createsession) function. Use the `scheduleId` returned from `createResource()` when creating the sessions. These session can be single sessions or recurring sessions.
|
|
1460
|
-
* - You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
1375
|
+
* When creating a resource using `createResource()`, get the business resource's schedule ID and include it in the `schedules` object. The default hours can bee found in the Dashboard under **Settings** in the **Bookings** section, on the **Appointment hours** page.
|
|
1461
1376
|
*
|
|
1462
1377
|
*
|
|
1463
1378
|
* > **Notes:**
|
|
1464
|
-
* >- The Wix Bookings app
|
|
1465
|
-
* >- The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
1466
|
-
* >- You can only add the business resource's schedule as a linked schedule for a resource.
|
|
1379
|
+
* >- The Wix Bookings app shows default business hours on the **Staff** page in the dashboard.
|
|
1467
1380
|
* >- A resource can have one schedule only.
|
|
1468
1381
|
* >- You can have up to 135 active resources and an additional 135 deleted resources.
|
|
1469
1382
|
* @param resource - Resource details.
|
|
@@ -1472,6 +1385,7 @@ export interface QueryResourcesOptions {
|
|
|
1472
1385
|
* @requiredField options.schedules.intervals.start
|
|
1473
1386
|
* @requiredField resource
|
|
1474
1387
|
* @requiredField resource.name
|
|
1388
|
+
* @param options - Options for assigning a schedule to a resource.
|
|
1475
1389
|
* @permissionScope Manage Bookings
|
|
1476
1390
|
* @applicableIdentity APP
|
|
1477
1391
|
*/
|
|
@@ -1495,59 +1409,60 @@ export interface CreateResourceOptions {
|
|
|
1495
1409
|
* @param _id - Resource ID.
|
|
1496
1410
|
* @public
|
|
1497
1411
|
* @requiredField _id
|
|
1412
|
+
* @requiredField resource
|
|
1498
1413
|
* @permissionScope Manage Bookings
|
|
1499
1414
|
* @applicableIdentity APP
|
|
1500
1415
|
*/
|
|
1501
|
-
export declare function updateResource(_id: string | null, options?: UpdateResourceOptions): Promise<UpdateResourceResponse & UpdateResourceResponseNonNullableFields>;
|
|
1416
|
+
export declare function updateResource(_id: string | null, resource: UpdateResource, options?: UpdateResourceOptions): Promise<UpdateResourceResponse & UpdateResourceResponseNonNullableFields>;
|
|
1417
|
+
export interface UpdateResource {
|
|
1418
|
+
/**
|
|
1419
|
+
* Resource ID.
|
|
1420
|
+
* @readonly
|
|
1421
|
+
*/
|
|
1422
|
+
_id?: string | null;
|
|
1423
|
+
/** Resource name. */
|
|
1424
|
+
name?: string | null;
|
|
1425
|
+
/** Resource email address. */
|
|
1426
|
+
email?: string | null;
|
|
1427
|
+
/** Resource phone number. */
|
|
1428
|
+
phone?: string | null;
|
|
1429
|
+
/** Resource description. */
|
|
1430
|
+
description?: string | null;
|
|
1431
|
+
/** @internal */
|
|
1432
|
+
tag?: string | null;
|
|
1433
|
+
/** Resource tags. Tags are used to identify, group, and filter the different types of resources. For example, 'staff' or 'room'. */
|
|
1434
|
+
tags?: string[] | null;
|
|
1435
|
+
/** Resource images. */
|
|
1436
|
+
images?: string[];
|
|
1437
|
+
/** @internal */
|
|
1438
|
+
schedules?: Schedule[];
|
|
1439
|
+
/**
|
|
1440
|
+
* List of IDs of schedules owned by this resource.
|
|
1441
|
+
* @readonly
|
|
1442
|
+
*/
|
|
1443
|
+
scheduleIds?: string[] | null;
|
|
1444
|
+
/**
|
|
1445
|
+
* Resource status.
|
|
1446
|
+
* <!--ONLY:VELO
|
|
1447
|
+
* One of:
|
|
1448
|
+
* - `"CREATED"` Default status.
|
|
1449
|
+
* - `"DELETED"` The resource was deleted.
|
|
1450
|
+
* - `"UPDATED"` The resource was updated.
|
|
1451
|
+
* <!--END:ONLY:VELO-->
|
|
1452
|
+
* @readonly
|
|
1453
|
+
*/
|
|
1454
|
+
status?: ResourceStatus;
|
|
1455
|
+
/**
|
|
1456
|
+
* Wix user ID, if the resource is associated with the Wix user.
|
|
1457
|
+
* A staff member resource can be associated with a Wix user via assignment of a permissions role in the business manager.
|
|
1458
|
+
* <!--ONLY:VELO
|
|
1459
|
+
* Click the **Set Permissions** button for the staff member on the Staff page on your site's dashboard.
|
|
1460
|
+
* <!--END:ONLY:VELO-->
|
|
1461
|
+
* @readonly
|
|
1462
|
+
*/
|
|
1463
|
+
wixUserId?: string | null;
|
|
1464
|
+
}
|
|
1502
1465
|
export interface UpdateResourceOptions {
|
|
1503
|
-
resource: {
|
|
1504
|
-
/**
|
|
1505
|
-
* Resource ID.
|
|
1506
|
-
* @readonly
|
|
1507
|
-
*/
|
|
1508
|
-
_id?: string | null;
|
|
1509
|
-
/** Resource name. */
|
|
1510
|
-
name?: string | null;
|
|
1511
|
-
/** Resource email address. */
|
|
1512
|
-
email?: string | null;
|
|
1513
|
-
/** Resource phone number. */
|
|
1514
|
-
phone?: string | null;
|
|
1515
|
-
/** Resource description. */
|
|
1516
|
-
description?: string | null;
|
|
1517
|
-
/** Deprecated. Please use tags. */
|
|
1518
|
-
tag?: string | null;
|
|
1519
|
-
/** Resource tags. Tags are used to identify, group, and filter the different types of resources. For example, 'staff' or 'room'. */
|
|
1520
|
-
tags?: string[] | null;
|
|
1521
|
-
/** Resource images. */
|
|
1522
|
-
images?: string[];
|
|
1523
|
-
/** Deprecated. Please use scheduleIds. List of the schedules owned by this resource. Min size 1. */
|
|
1524
|
-
schedules?: Schedule[];
|
|
1525
|
-
/**
|
|
1526
|
-
* List of IDs of schedules owned by this resource.
|
|
1527
|
-
* @readonly
|
|
1528
|
-
*/
|
|
1529
|
-
scheduleIds?: string[] | null;
|
|
1530
|
-
/**
|
|
1531
|
-
* Resource status.
|
|
1532
|
-
* <!--ONLY:VELO
|
|
1533
|
-
* One of:
|
|
1534
|
-
* - `"CREATED"` Default status.
|
|
1535
|
-
* - `"DELETED"` The resource was deleted.
|
|
1536
|
-
* - `"UPDATED"` The resource was updated.
|
|
1537
|
-
* <!--END:ONLY:VELO-->
|
|
1538
|
-
* @readonly
|
|
1539
|
-
*/
|
|
1540
|
-
status?: ResourceStatus;
|
|
1541
|
-
/**
|
|
1542
|
-
* Wix user ID, if the resource is associated with the Wix user.
|
|
1543
|
-
* A staff member resource can be associated with a Wix user via assignment of a permissions role in the business manager.
|
|
1544
|
-
* <!--ONLY:VELO
|
|
1545
|
-
* Click the **Set Permissions** button for the staff member on the Staff page on your site's dashboard.
|
|
1546
|
-
* <!--END:ONLY:VELO-->
|
|
1547
|
-
* @readonly
|
|
1548
|
-
*/
|
|
1549
|
-
wixUserId?: string | null;
|
|
1550
|
-
};
|
|
1551
1466
|
/** @internal */
|
|
1552
1467
|
fieldMask?: string[];
|
|
1553
1468
|
}
|
|
@@ -1557,41 +1472,22 @@ export interface UpdateResourceOptions {
|
|
|
1557
1472
|
*
|
|
1558
1473
|
* The `updateSchedule()` function returns a Promise that resolves when a resource's schedule has been updated. Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`](#updateresource).
|
|
1559
1474
|
*
|
|
1560
|
-
* The following schedule properties can be updated:
|
|
1561
|
-
*
|
|
1562
|
-
* - `availability.start`
|
|
1563
|
-
*
|
|
1564
|
-
* - `availability.linkedSchedules`
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
* To update a resource's schedule to remove business hours and add custom hours:
|
|
1568
|
-
* - Use [`updateSchedule()`](#updateschedule) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
1569
|
-
* - Use [`createSession()`](#createsession) to create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
1573
|
-
*
|
|
1574
|
-
* - Use [`updateSchedule()`](#updateschedule) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
1575
|
-
*
|
|
1576
|
-
*
|
|
1577
1475
|
* > **Notes:**
|
|
1578
|
-
* >- The Wix Bookings app does not show both default business hours and custom hours on the **Staff** page in the dashboard. If you've set up both custom and default business hours, only the default business hours will appear in the app, although both are working.
|
|
1579
1476
|
* >- A resource can have one schedule only.
|
|
1580
|
-
* >- A resource can have both default business hours and custom hours in its schedule.
|
|
1581
1477
|
* >- When updating a resource's schedule you cannot change the system tags used by the Wix Bookings app. Tags used by the app have the values `"INDIVIDUAL"`, `"GROUP"`, and `"COURSE"`.
|
|
1582
1478
|
* @param resourceId - Resource id to update.
|
|
1479
|
+
* @param schedule - The schedule to update
|
|
1583
1480
|
* @public
|
|
1584
|
-
* @requiredField options.schedule._id
|
|
1585
1481
|
* @requiredField resourceId
|
|
1482
|
+
* @requiredField schedule
|
|
1483
|
+
* @requiredField schedule._id
|
|
1586
1484
|
* @permissionScope Manage Bookings
|
|
1587
1485
|
* @applicableIdentity APP
|
|
1588
1486
|
*/
|
|
1589
|
-
export declare function updateSchedule(resourceId: string | null, options?: UpdateScheduleOptions): Promise<UpdateScheduleResponse & UpdateScheduleResponseNonNullableFields>;
|
|
1487
|
+
export declare function updateSchedule(resourceId: string | null, schedule: Schedule, options?: UpdateScheduleOptions): Promise<UpdateScheduleResponse & UpdateScheduleResponseNonNullableFields>;
|
|
1590
1488
|
export interface UpdateScheduleOptions {
|
|
1591
1489
|
/** Fieldmask for schedule */
|
|
1592
1490
|
fieldmask?: string[];
|
|
1593
|
-
/** The schedule to update */
|
|
1594
|
-
schedule?: Schedule;
|
|
1595
1491
|
}
|
|
1596
1492
|
/**
|
|
1597
1493
|
* Deletes a resource.
|
|
@@ -165,8 +165,6 @@ const _deleteResourceRequest = {};
|
|
|
165
165
|
const _deleteResourceResponse = {};
|
|
166
166
|
const _location = { businessLocation: '_locationsLocation' };
|
|
167
167
|
const _locationsLocation = { address: 'wix.common.Address' };
|
|
168
|
-
const _queryResourcesRequest = {};
|
|
169
|
-
const _queryResourcesResponse = { resources: '_resource' };
|
|
170
168
|
const _resource = {
|
|
171
169
|
images: 'wix.common.Image',
|
|
172
170
|
schedules: '_schedule',
|
|
@@ -184,96 +182,18 @@ const _updateResourceResponse = {
|
|
|
184
182
|
};
|
|
185
183
|
const _updateScheduleRequest = { schedule: '_schedule' };
|
|
186
184
|
const _updateScheduleResponse = { schedule: '_schedule' };
|
|
187
|
-
/**
|
|
188
|
-
* Creates a query to retrieve extended resource information.
|
|
189
|
-
*
|
|
190
|
-
* The `queryResources()` function builds a query to retrieve a catalog of resources, including resources' related schedules and slugs, and returns a [`ResourceQueryBuilder`](#) object. The returned object contains the query definition, which is typically used to run the query using the [`find()`](#) function.
|
|
191
|
-
*
|
|
192
|
-
* The `ResourceQueryBuilder` functions enable you to run, filter, and control which results a query returns.
|
|
193
|
-
*
|
|
194
|
-
* Typically, you build a query using the `queryResources()` function, refine the query by chaining `ResourceQueryBuilder` functions, and then execute the query by chaining the `find()` function.
|
|
195
|
-
*
|
|
196
|
-
* The query runs with the following defaults that you can override:
|
|
197
|
-
* - [`skip`](#): `0`
|
|
198
|
-
* - [`limit`](#): `50`
|
|
199
|
-
*
|
|
200
|
-
* The following query builder functions are supported for `queryResources()`. For a full description of the `Resources` object, see the object returned for the [`items`](#) array in [`ResourceQueryResult`](#).
|
|
201
|
-
* @public
|
|
202
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
203
|
-
* @permissionScope Read Bookings - Public Data
|
|
204
|
-
* @permissionScope Read bookings calendar - including participants
|
|
205
|
-
* @permissionScope Read Bookings Calendar
|
|
206
|
-
* @applicableIdentity APP
|
|
207
|
-
* @applicableIdentity MEMBER
|
|
208
|
-
* @applicableIdentity VISITOR
|
|
209
|
-
*/
|
|
210
|
-
export function queryResources(options) {
|
|
211
|
-
var _a, _b, _c;
|
|
212
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
213
|
-
const requestTransformation = { query: '$[0].query' };
|
|
214
|
-
const responseTransformation = '$';
|
|
215
|
-
// @ts-ignore
|
|
216
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
217
|
-
const { toAmbassadorRequest } = serializer({
|
|
218
|
-
rootSchema: _queryResourcesRequest,
|
|
219
|
-
depSchemas: {},
|
|
220
|
-
fqdnTransformation: {
|
|
221
|
-
paths: [],
|
|
222
|
-
transformation: _fromVeloEntity,
|
|
223
|
-
},
|
|
224
|
-
customTransformation: requestTransformation,
|
|
225
|
-
});
|
|
226
|
-
const { fromJSON } = serializer({
|
|
227
|
-
rootSchema: _queryResourcesResponse,
|
|
228
|
-
depSchemas: {
|
|
229
|
-
_availability,
|
|
230
|
-
_location,
|
|
231
|
-
_locationsLocation,
|
|
232
|
-
_resource,
|
|
233
|
-
_schedule,
|
|
234
|
-
},
|
|
235
|
-
fqdnTransformation: {
|
|
236
|
-
paths: [...['Array#resources']],
|
|
237
|
-
transformation: _toVeloEntity,
|
|
238
|
-
},
|
|
239
|
-
customTransformation: responseTransformation,
|
|
240
|
-
});
|
|
241
|
-
const payload = toAmbassadorRequest([options]);
|
|
242
|
-
const reqOpts = ambassadorWixBookingsCatalogV1Resource.query(payload);
|
|
243
|
-
__log(`"Query" sending request with: ${__inspect(reqOpts)}`);
|
|
244
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
245
|
-
try {
|
|
246
|
-
const result = yield httpClient.request(reqOpts);
|
|
247
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
248
|
-
return fromJSON(result.data);
|
|
249
|
-
}
|
|
250
|
-
catch (err) {
|
|
251
|
-
const transformedError = transformError(err, requestTransformation, [
|
|
252
|
-
'options',
|
|
253
|
-
]);
|
|
254
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
255
|
-
throw transformedError;
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
185
|
/**
|
|
260
186
|
* Creates a resource.
|
|
261
187
|
*
|
|
262
188
|
*
|
|
263
189
|
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
264
|
-
* Bookings resources are created with a schedule. The schedule
|
|
190
|
+
* Bookings resources are created with a schedule. The schedule determines the resource's availability by the business's default working hours.
|
|
265
191
|
*
|
|
266
|
-
*
|
|
267
|
-
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
268
|
-
* - If the resource uses the default business hours, get the business resource's schedule ID and include it in the `scheduleInfo.availability.linkedSchedules` array in the `scheduleInfo` parameter. The default hours can bee found in the Dashboard under **Settings** in the **Bookings** section, on the **Appointment hours** page.
|
|
269
|
-
* - If the resource has its own custom working hours, create the resource, then create sessions of type `WORKING_HOURS` using the [`createSession()`](#createsession) function. Use the `scheduleId` returned from `createResource()` when creating the sessions. These session can be single sessions or recurring sessions.
|
|
270
|
-
* - You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
192
|
+
* When creating a resource using `createResource()`, get the business resource's schedule ID and include it in the `schedules` object. The default hours can bee found in the Dashboard under **Settings** in the **Bookings** section, on the **Appointment hours** page.
|
|
271
193
|
*
|
|
272
194
|
*
|
|
273
195
|
* > **Notes:**
|
|
274
|
-
* >- The Wix Bookings app
|
|
275
|
-
* >- The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
276
|
-
* >- You can only add the business resource's schedule as a linked schedule for a resource.
|
|
196
|
+
* >- The Wix Bookings app shows default business hours on the **Staff** page in the dashboard.
|
|
277
197
|
* >- A resource can have one schedule only.
|
|
278
198
|
* >- You can have up to 135 active resources and an additional 135 deleted resources.
|
|
279
199
|
* @param resource - Resource details.
|
|
@@ -282,6 +202,7 @@ export function queryResources(options) {
|
|
|
282
202
|
* @requiredField options.schedules.intervals.start
|
|
283
203
|
* @requiredField resource
|
|
284
204
|
* @requiredField resource.name
|
|
205
|
+
* @param options - Options for assigning a schedule to a resource.
|
|
285
206
|
* @permissionScope Manage Bookings
|
|
286
207
|
* @applicableIdentity APP
|
|
287
208
|
*/
|
|
@@ -356,19 +277,20 @@ export function createResource(resource, options) {
|
|
|
356
277
|
* @param _id - Resource ID.
|
|
357
278
|
* @public
|
|
358
279
|
* @requiredField _id
|
|
280
|
+
* @requiredField resource
|
|
359
281
|
* @permissionScope Manage Bookings
|
|
360
282
|
* @applicableIdentity APP
|
|
361
283
|
*/
|
|
362
|
-
export function updateResource(_id, options) {
|
|
284
|
+
export function updateResource(_id, resource, options) {
|
|
363
285
|
var _a, _b, _c;
|
|
364
286
|
return __awaiter(this, arguments, void 0, function* () {
|
|
365
287
|
const requestTransformation = {
|
|
366
|
-
resource: { '*': '$[1]
|
|
367
|
-
fieldMask: '$[
|
|
288
|
+
resource: { '*': '$[1]', id: '$[0]' },
|
|
289
|
+
fieldMask: '$[2].fieldMask',
|
|
368
290
|
};
|
|
369
291
|
const responseTransformation = '$';
|
|
370
292
|
// @ts-ignore
|
|
371
|
-
const { httpClient, sideEffects } = arguments[
|
|
293
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
372
294
|
const { toAmbassadorRequest } = serializer({
|
|
373
295
|
rootSchema: _updateResourceRequest,
|
|
374
296
|
depSchemas: {
|
|
@@ -403,7 +325,7 @@ export function updateResource(_id, options) {
|
|
|
403
325
|
},
|
|
404
326
|
customTransformation: responseTransformation,
|
|
405
327
|
});
|
|
406
|
-
const payload = toAmbassadorRequest([_id, options]);
|
|
328
|
+
const payload = toAmbassadorRequest([_id, resource, options]);
|
|
407
329
|
const reqOpts = ambassadorWixBookingsCatalogV1Resource.update(payload);
|
|
408
330
|
__log(`"Update" sending request with: ${__inspect(reqOpts)}`);
|
|
409
331
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -415,6 +337,7 @@ export function updateResource(_id, options) {
|
|
|
415
337
|
catch (err) {
|
|
416
338
|
const transformedError = transformError(err, requestTransformation, [
|
|
417
339
|
'_id',
|
|
340
|
+
'resource',
|
|
418
341
|
'options',
|
|
419
342
|
]);
|
|
420
343
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -428,46 +351,29 @@ export function updateResource(_id, options) {
|
|
|
428
351
|
*
|
|
429
352
|
* The `updateSchedule()` function returns a Promise that resolves when a resource's schedule has been updated. Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`](#updateresource).
|
|
430
353
|
*
|
|
431
|
-
* The following schedule properties can be updated:
|
|
432
|
-
*
|
|
433
|
-
* - `availability.start`
|
|
434
|
-
*
|
|
435
|
-
* - `availability.linkedSchedules`
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
* To update a resource's schedule to remove business hours and add custom hours:
|
|
439
|
-
* - Use [`updateSchedule()`](#updateschedule) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
440
|
-
* - Use [`createSession()`](#createsession) to create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
444
|
-
*
|
|
445
|
-
* - Use [`updateSchedule()`](#updateschedule) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
354
|
* > **Notes:**
|
|
449
|
-
* >- The Wix Bookings app does not show both default business hours and custom hours on the **Staff** page in the dashboard. If you've set up both custom and default business hours, only the default business hours will appear in the app, although both are working.
|
|
450
355
|
* >- A resource can have one schedule only.
|
|
451
|
-
* >- A resource can have both default business hours and custom hours in its schedule.
|
|
452
356
|
* >- When updating a resource's schedule you cannot change the system tags used by the Wix Bookings app. Tags used by the app have the values `"INDIVIDUAL"`, `"GROUP"`, and `"COURSE"`.
|
|
453
357
|
* @param resourceId - Resource id to update.
|
|
358
|
+
* @param schedule - The schedule to update
|
|
454
359
|
* @public
|
|
455
|
-
* @requiredField options.schedule._id
|
|
456
360
|
* @requiredField resourceId
|
|
361
|
+
* @requiredField schedule
|
|
362
|
+
* @requiredField schedule._id
|
|
457
363
|
* @permissionScope Manage Bookings
|
|
458
364
|
* @applicableIdentity APP
|
|
459
365
|
*/
|
|
460
|
-
export function updateSchedule(resourceId, options) {
|
|
366
|
+
export function updateSchedule(resourceId, schedule, options) {
|
|
461
367
|
var _a, _b, _c;
|
|
462
368
|
return __awaiter(this, arguments, void 0, function* () {
|
|
463
369
|
const requestTransformation = {
|
|
464
370
|
resourceId: '$[0]',
|
|
465
|
-
|
|
466
|
-
|
|
371
|
+
schedule: '$[1]',
|
|
372
|
+
fieldmask: '$[2].fieldmask',
|
|
467
373
|
};
|
|
468
374
|
const responseTransformation = '$';
|
|
469
375
|
// @ts-ignore
|
|
470
|
-
const { httpClient, sideEffects } = arguments[
|
|
376
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
471
377
|
const { toAmbassadorRequest } = serializer({
|
|
472
378
|
rootSchema: _resourceUpdateScheduleRequest,
|
|
473
379
|
depSchemas: { _availability, _location, _locationsLocation, _schedule },
|
|
@@ -486,7 +392,7 @@ export function updateSchedule(resourceId, options) {
|
|
|
486
392
|
},
|
|
487
393
|
customTransformation: responseTransformation,
|
|
488
394
|
});
|
|
489
|
-
const payload = toAmbassadorRequest([resourceId, options]);
|
|
395
|
+
const payload = toAmbassadorRequest([resourceId, schedule, options]);
|
|
490
396
|
const reqOpts = ambassadorWixBookingsCatalogV1Resource.updateSchedule(payload);
|
|
491
397
|
__log(`"UpdateSchedule" sending request with: ${__inspect(reqOpts)}`);
|
|
492
398
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -498,6 +404,7 @@ export function updateSchedule(resourceId, options) {
|
|
|
498
404
|
catch (err) {
|
|
499
405
|
const transformedError = transformError(err, requestTransformation, [
|
|
500
406
|
'resourceId',
|
|
407
|
+
'schedule',
|
|
501
408
|
'options',
|
|
502
409
|
]);
|
|
503
410
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|