@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.
|
|
@@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.deleteResource = exports.updateSchedule = exports.updateResource = exports.createResource = exports.
|
|
31
|
+
exports.deleteResource = exports.updateSchedule = exports.updateResource = exports.createResource = exports.Event = exports.SortOrder = exports.ResourceStatus = exports.ConferenceType = exports.ScheduleStatus = exports.ApprovalStatus = exports.DayOfWeek = exports.LocationsLocationType = exports.LocationStatus = exports.LocationType = exports.RecurringIntervalType = exports.Transparency = exports.Day = exports.__debug = void 0;
|
|
32
32
|
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
33
|
const ambassadorWixBookingsCatalogV1Resource = __importStar(require("./bookings-catalog-v1-resource.http"));
|
|
34
34
|
let __verbose = false;
|
|
@@ -187,8 +187,6 @@ const _deleteResourceRequest = {};
|
|
|
187
187
|
const _deleteResourceResponse = {};
|
|
188
188
|
const _location = { businessLocation: '_locationsLocation' };
|
|
189
189
|
const _locationsLocation = { address: 'wix.common.Address' };
|
|
190
|
-
const _queryResourcesRequest = {};
|
|
191
|
-
const _queryResourcesResponse = { resources: '_resource' };
|
|
192
190
|
const _resource = {
|
|
193
191
|
images: 'wix.common.Image',
|
|
194
192
|
schedules: '_schedule',
|
|
@@ -206,97 +204,18 @@ const _updateResourceResponse = {
|
|
|
206
204
|
};
|
|
207
205
|
const _updateScheduleRequest = { schedule: '_schedule' };
|
|
208
206
|
const _updateScheduleResponse = { schedule: '_schedule' };
|
|
209
|
-
/**
|
|
210
|
-
* Creates a query to retrieve extended resource information.
|
|
211
|
-
*
|
|
212
|
-
* 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.
|
|
213
|
-
*
|
|
214
|
-
* The `ResourceQueryBuilder` functions enable you to run, filter, and control which results a query returns.
|
|
215
|
-
*
|
|
216
|
-
* 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.
|
|
217
|
-
*
|
|
218
|
-
* The query runs with the following defaults that you can override:
|
|
219
|
-
* - [`skip`](#): `0`
|
|
220
|
-
* - [`limit`](#): `50`
|
|
221
|
-
*
|
|
222
|
-
* 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`](#).
|
|
223
|
-
* @public
|
|
224
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
225
|
-
* @permissionScope Read Bookings - Public Data
|
|
226
|
-
* @permissionScope Read bookings calendar - including participants
|
|
227
|
-
* @permissionScope Read Bookings Calendar
|
|
228
|
-
* @applicableIdentity APP
|
|
229
|
-
* @applicableIdentity MEMBER
|
|
230
|
-
* @applicableIdentity VISITOR
|
|
231
|
-
*/
|
|
232
|
-
function queryResources(options) {
|
|
233
|
-
var _a, _b, _c;
|
|
234
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
235
|
-
const requestTransformation = { query: '$[0].query' };
|
|
236
|
-
const responseTransformation = '$';
|
|
237
|
-
// @ts-ignore
|
|
238
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
239
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
240
|
-
rootSchema: _queryResourcesRequest,
|
|
241
|
-
depSchemas: {},
|
|
242
|
-
fqdnTransformation: {
|
|
243
|
-
paths: [],
|
|
244
|
-
transformation: _fromVeloEntity,
|
|
245
|
-
},
|
|
246
|
-
customTransformation: requestTransformation,
|
|
247
|
-
});
|
|
248
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
249
|
-
rootSchema: _queryResourcesResponse,
|
|
250
|
-
depSchemas: {
|
|
251
|
-
_availability,
|
|
252
|
-
_location,
|
|
253
|
-
_locationsLocation,
|
|
254
|
-
_resource,
|
|
255
|
-
_schedule,
|
|
256
|
-
},
|
|
257
|
-
fqdnTransformation: {
|
|
258
|
-
paths: [...['Array#resources']],
|
|
259
|
-
transformation: _toVeloEntity,
|
|
260
|
-
},
|
|
261
|
-
customTransformation: responseTransformation,
|
|
262
|
-
});
|
|
263
|
-
const payload = toAmbassadorRequest([options]);
|
|
264
|
-
const reqOpts = ambassadorWixBookingsCatalogV1Resource.query(payload);
|
|
265
|
-
__log(`"Query" sending request with: ${__inspect(reqOpts)}`);
|
|
266
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
267
|
-
try {
|
|
268
|
-
const result = yield httpClient.request(reqOpts);
|
|
269
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
270
|
-
return fromJSON(result.data);
|
|
271
|
-
}
|
|
272
|
-
catch (err) {
|
|
273
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
274
|
-
'options',
|
|
275
|
-
]);
|
|
276
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
277
|
-
throw transformedError;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
exports.queryResources = queryResources;
|
|
282
207
|
/**
|
|
283
208
|
* Creates a resource.
|
|
284
209
|
*
|
|
285
210
|
*
|
|
286
211
|
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
287
|
-
* Bookings resources are created with a schedule. The schedule
|
|
212
|
+
* Bookings resources are created with a schedule. The schedule determines the resource's availability by the business's default working hours.
|
|
288
213
|
*
|
|
289
|
-
*
|
|
290
|
-
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
291
|
-
* - 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.
|
|
292
|
-
* - 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.
|
|
293
|
-
* - You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
214
|
+
* 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.
|
|
294
215
|
*
|
|
295
216
|
*
|
|
296
217
|
* > **Notes:**
|
|
297
|
-
* >- The Wix Bookings app
|
|
298
|
-
* >- The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
299
|
-
* >- You can only add the business resource's schedule as a linked schedule for a resource.
|
|
218
|
+
* >- The Wix Bookings app shows default business hours on the **Staff** page in the dashboard.
|
|
300
219
|
* >- A resource can have one schedule only.
|
|
301
220
|
* >- You can have up to 135 active resources and an additional 135 deleted resources.
|
|
302
221
|
* @param resource - Resource details.
|
|
@@ -305,6 +224,7 @@ exports.queryResources = queryResources;
|
|
|
305
224
|
* @requiredField options.schedules.intervals.start
|
|
306
225
|
* @requiredField resource
|
|
307
226
|
* @requiredField resource.name
|
|
227
|
+
* @param options - Options for assigning a schedule to a resource.
|
|
308
228
|
* @permissionScope Manage Bookings
|
|
309
229
|
* @applicableIdentity APP
|
|
310
230
|
*/
|
|
@@ -380,19 +300,20 @@ exports.createResource = createResource;
|
|
|
380
300
|
* @param _id - Resource ID.
|
|
381
301
|
* @public
|
|
382
302
|
* @requiredField _id
|
|
303
|
+
* @requiredField resource
|
|
383
304
|
* @permissionScope Manage Bookings
|
|
384
305
|
* @applicableIdentity APP
|
|
385
306
|
*/
|
|
386
|
-
function updateResource(_id, options) {
|
|
307
|
+
function updateResource(_id, resource, options) {
|
|
387
308
|
var _a, _b, _c;
|
|
388
309
|
return __awaiter(this, arguments, void 0, function* () {
|
|
389
310
|
const requestTransformation = {
|
|
390
|
-
resource: { '*': '$[1]
|
|
391
|
-
fieldMask: '$[
|
|
311
|
+
resource: { '*': '$[1]', id: '$[0]' },
|
|
312
|
+
fieldMask: '$[2].fieldMask',
|
|
392
313
|
};
|
|
393
314
|
const responseTransformation = '$';
|
|
394
315
|
// @ts-ignore
|
|
395
|
-
const { httpClient, sideEffects } = arguments[
|
|
316
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
396
317
|
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
397
318
|
rootSchema: _updateResourceRequest,
|
|
398
319
|
depSchemas: {
|
|
@@ -427,7 +348,7 @@ function updateResource(_id, options) {
|
|
|
427
348
|
},
|
|
428
349
|
customTransformation: responseTransformation,
|
|
429
350
|
});
|
|
430
|
-
const payload = toAmbassadorRequest([_id, options]);
|
|
351
|
+
const payload = toAmbassadorRequest([_id, resource, options]);
|
|
431
352
|
const reqOpts = ambassadorWixBookingsCatalogV1Resource.update(payload);
|
|
432
353
|
__log(`"Update" sending request with: ${__inspect(reqOpts)}`);
|
|
433
354
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -439,6 +360,7 @@ function updateResource(_id, options) {
|
|
|
439
360
|
catch (err) {
|
|
440
361
|
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
441
362
|
'_id',
|
|
363
|
+
'resource',
|
|
442
364
|
'options',
|
|
443
365
|
]);
|
|
444
366
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -453,46 +375,29 @@ exports.updateResource = updateResource;
|
|
|
453
375
|
*
|
|
454
376
|
* 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).
|
|
455
377
|
*
|
|
456
|
-
* The following schedule properties can be updated:
|
|
457
|
-
*
|
|
458
|
-
* - `availability.start`
|
|
459
|
-
*
|
|
460
|
-
* - `availability.linkedSchedules`
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
* To update a resource's schedule to remove business hours and add custom hours:
|
|
464
|
-
* - Use [`updateSchedule()`](#updateschedule) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
465
|
-
* - Use [`createSession()`](#createsession) to create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
469
|
-
*
|
|
470
|
-
* - Use [`updateSchedule()`](#updateschedule) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
378
|
* > **Notes:**
|
|
474
|
-
* >- 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.
|
|
475
379
|
* >- A resource can have one schedule only.
|
|
476
|
-
* >- A resource can have both default business hours and custom hours in its schedule.
|
|
477
380
|
* >- 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"`.
|
|
478
381
|
* @param resourceId - Resource id to update.
|
|
382
|
+
* @param schedule - The schedule to update
|
|
479
383
|
* @public
|
|
480
|
-
* @requiredField options.schedule._id
|
|
481
384
|
* @requiredField resourceId
|
|
385
|
+
* @requiredField schedule
|
|
386
|
+
* @requiredField schedule._id
|
|
482
387
|
* @permissionScope Manage Bookings
|
|
483
388
|
* @applicableIdentity APP
|
|
484
389
|
*/
|
|
485
|
-
function updateSchedule(resourceId, options) {
|
|
390
|
+
function updateSchedule(resourceId, schedule, options) {
|
|
486
391
|
var _a, _b, _c;
|
|
487
392
|
return __awaiter(this, arguments, void 0, function* () {
|
|
488
393
|
const requestTransformation = {
|
|
489
394
|
resourceId: '$[0]',
|
|
490
|
-
|
|
491
|
-
|
|
395
|
+
schedule: '$[1]',
|
|
396
|
+
fieldmask: '$[2].fieldmask',
|
|
492
397
|
};
|
|
493
398
|
const responseTransformation = '$';
|
|
494
399
|
// @ts-ignore
|
|
495
|
-
const { httpClient, sideEffects } = arguments[
|
|
400
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
496
401
|
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
497
402
|
rootSchema: _resourceUpdateScheduleRequest,
|
|
498
403
|
depSchemas: { _availability, _location, _locationsLocation, _schedule },
|
|
@@ -511,7 +416,7 @@ function updateSchedule(resourceId, options) {
|
|
|
511
416
|
},
|
|
512
417
|
customTransformation: responseTransformation,
|
|
513
418
|
});
|
|
514
|
-
const payload = toAmbassadorRequest([resourceId, options]);
|
|
419
|
+
const payload = toAmbassadorRequest([resourceId, schedule, options]);
|
|
515
420
|
const reqOpts = ambassadorWixBookingsCatalogV1Resource.updateSchedule(payload);
|
|
516
421
|
__log(`"UpdateSchedule" sending request with: ${__inspect(reqOpts)}`);
|
|
517
422
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -523,6 +428,7 @@ function updateSchedule(resourceId, options) {
|
|
|
523
428
|
catch (err) {
|
|
524
429
|
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
525
430
|
'resourceId',
|
|
431
|
+
'schedule',
|
|
526
432
|
'options',
|
|
527
433
|
]);
|
|
528
434
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|