@wix/auto_sdk_bookings_services 1.0.54 → 1.0.55
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/{es/src/bookings-services-v2-service-services.types.d.ts → bookings-services-v2-service-services.universal-B8YoV8-Q.d.mts} +893 -374
- package/build/{cjs/src/bookings-services-v2-service-services.types.d.ts → bookings-services-v2-service-services.universal-B8YoV8-Q.d.ts} +893 -374
- package/build/{internal/cjs/src/bookings-services-v2-service-services.public.d.ts → index.d.mts} +66 -31
- package/build/{internal/es/src/bookings-services-v2-service-services.public.d.ts → index.d.ts} +66 -31
- package/build/index.js +3306 -0
- package/build/index.js.map +1 -0
- package/build/index.mjs +3232 -0
- package/build/index.mjs.map +1 -0
- package/build/internal/{cjs/src/bookings-services-v2-service-services.types.d.ts → bookings-services-v2-service-services.universal-B8YoV8-Q.d.mts} +893 -374
- package/build/internal/{es/src/bookings-services-v2-service-services.types.d.ts → bookings-services-v2-service-services.universal-B8YoV8-Q.d.ts} +893 -374
- package/build/{cjs/src/bookings-services-v2-service-services.public.d.ts → internal/index.d.mts} +66 -31
- package/build/{es/src/bookings-services-v2-service-services.public.d.ts → internal/index.d.ts} +66 -31
- package/build/internal/index.js +3306 -0
- package/build/internal/index.js.map +1 -0
- package/build/internal/index.mjs +3232 -0
- package/build/internal/index.mjs.map +1 -0
- package/build/internal/meta.d.mts +2350 -0
- package/build/internal/meta.d.ts +2350 -0
- package/build/internal/meta.js +1879 -0
- package/build/internal/meta.js.map +1 -0
- package/build/internal/meta.mjs +1831 -0
- package/build/internal/meta.mjs.map +1 -0
- package/build/meta.d.mts +2350 -0
- package/build/meta.d.ts +2350 -0
- package/build/meta.js +1879 -0
- package/build/meta.js.map +1 -0
- package/build/meta.mjs +1831 -0
- package/build/meta.mjs.map +1 -0
- package/package.json +12 -11
- package/build/cjs/index.d.ts +0 -1
- package/build/cjs/index.js +0 -18
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/index.typings.d.ts +0 -56
- package/build/cjs/index.typings.js +0 -18
- package/build/cjs/index.typings.js.map +0 -1
- package/build/cjs/meta.d.ts +0 -1
- package/build/cjs/meta.js +0 -18
- package/build/cjs/meta.js.map +0 -1
- package/build/cjs/src/bookings-services-v2-service-services.context.d.ts +0 -42
- package/build/cjs/src/bookings-services-v2-service-services.context.js +0 -72
- package/build/cjs/src/bookings-services-v2-service-services.context.js.map +0 -1
- package/build/cjs/src/bookings-services-v2-service-services.http.d.ts +0 -498
- package/build/cjs/src/bookings-services-v2-service-services.http.js +0 -1904
- package/build/cjs/src/bookings-services-v2-service-services.http.js.map +0 -1
- package/build/cjs/src/bookings-services-v2-service-services.meta.d.ts +0 -48
- package/build/cjs/src/bookings-services-v2-service-services.meta.js +0 -446
- package/build/cjs/src/bookings-services-v2-service-services.meta.js.map +0 -1
- package/build/cjs/src/bookings-services-v2-service-services.public.js +0 -299
- package/build/cjs/src/bookings-services-v2-service-services.public.js.map +0 -1
- package/build/cjs/src/bookings-services-v2-service-services.types.js +0 -235
- package/build/cjs/src/bookings-services-v2-service-services.types.js.map +0 -1
- package/build/cjs/src/bookings-services-v2-service-services.universal.d.ts +0 -4835
- package/build/cjs/src/bookings-services-v2-service-services.universal.js +0 -2257
- package/build/cjs/src/bookings-services-v2-service-services.universal.js.map +0 -1
- package/build/es/index.d.ts +0 -1
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -56
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/meta.d.ts +0 -1
- package/build/es/meta.js +0 -2
- package/build/es/meta.js.map +0 -1
- package/build/es/src/bookings-services-v2-service-services.context.d.ts +0 -42
- package/build/es/src/bookings-services-v2-service-services.context.js +0 -42
- package/build/es/src/bookings-services-v2-service-services.context.js.map +0 -1
- package/build/es/src/bookings-services-v2-service-services.http.d.ts +0 -498
- package/build/es/src/bookings-services-v2-service-services.http.js +0 -1879
- package/build/es/src/bookings-services-v2-service-services.http.js.map +0 -1
- package/build/es/src/bookings-services-v2-service-services.meta.d.ts +0 -48
- package/build/es/src/bookings-services-v2-service-services.meta.js +0 -398
- package/build/es/src/bookings-services-v2-service-services.meta.js.map +0 -1
- package/build/es/src/bookings-services-v2-service-services.public.js +0 -247
- package/build/es/src/bookings-services-v2-service-services.public.js.map +0 -1
- package/build/es/src/bookings-services-v2-service-services.types.js +0 -232
- package/build/es/src/bookings-services-v2-service-services.types.js.map +0 -1
- package/build/es/src/bookings-services-v2-service-services.universal.d.ts +0 -4835
- package/build/es/src/bookings-services-v2-service-services.universal.js +0 -2209
- package/build/es/src/bookings-services-v2-service-services.universal.js.map +0 -1
- package/build/internal/cjs/index.d.ts +0 -1
- package/build/internal/cjs/index.js +0 -18
- package/build/internal/cjs/index.js.map +0 -1
- package/build/internal/cjs/index.typings.d.ts +0 -56
- package/build/internal/cjs/index.typings.js +0 -18
- package/build/internal/cjs/index.typings.js.map +0 -1
- package/build/internal/cjs/meta.d.ts +0 -1
- package/build/internal/cjs/meta.js +0 -18
- package/build/internal/cjs/meta.js.map +0 -1
- package/build/internal/cjs/src/bookings-services-v2-service-services.context.d.ts +0 -42
- package/build/internal/cjs/src/bookings-services-v2-service-services.context.js +0 -72
- package/build/internal/cjs/src/bookings-services-v2-service-services.context.js.map +0 -1
- package/build/internal/cjs/src/bookings-services-v2-service-services.http.d.ts +0 -498
- package/build/internal/cjs/src/bookings-services-v2-service-services.http.js +0 -1904
- package/build/internal/cjs/src/bookings-services-v2-service-services.http.js.map +0 -1
- package/build/internal/cjs/src/bookings-services-v2-service-services.meta.d.ts +0 -48
- package/build/internal/cjs/src/bookings-services-v2-service-services.meta.js +0 -446
- package/build/internal/cjs/src/bookings-services-v2-service-services.meta.js.map +0 -1
- package/build/internal/cjs/src/bookings-services-v2-service-services.public.js +0 -299
- package/build/internal/cjs/src/bookings-services-v2-service-services.public.js.map +0 -1
- package/build/internal/cjs/src/bookings-services-v2-service-services.types.js +0 -235
- package/build/internal/cjs/src/bookings-services-v2-service-services.types.js.map +0 -1
- package/build/internal/cjs/src/bookings-services-v2-service-services.universal.d.ts +0 -4835
- package/build/internal/cjs/src/bookings-services-v2-service-services.universal.js +0 -2257
- package/build/internal/cjs/src/bookings-services-v2-service-services.universal.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -1
- package/build/internal/es/index.js +0 -2
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -56
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/meta.d.ts +0 -1
- package/build/internal/es/meta.js +0 -2
- package/build/internal/es/meta.js.map +0 -1
- package/build/internal/es/src/bookings-services-v2-service-services.context.d.ts +0 -42
- package/build/internal/es/src/bookings-services-v2-service-services.context.js +0 -42
- package/build/internal/es/src/bookings-services-v2-service-services.context.js.map +0 -1
- package/build/internal/es/src/bookings-services-v2-service-services.http.d.ts +0 -498
- package/build/internal/es/src/bookings-services-v2-service-services.http.js +0 -1879
- package/build/internal/es/src/bookings-services-v2-service-services.http.js.map +0 -1
- package/build/internal/es/src/bookings-services-v2-service-services.meta.d.ts +0 -48
- package/build/internal/es/src/bookings-services-v2-service-services.meta.js +0 -398
- package/build/internal/es/src/bookings-services-v2-service-services.meta.js.map +0 -1
- package/build/internal/es/src/bookings-services-v2-service-services.public.js +0 -247
- package/build/internal/es/src/bookings-services-v2-service-services.public.js.map +0 -1
- package/build/internal/es/src/bookings-services-v2-service-services.types.js +0 -232
- package/build/internal/es/src/bookings-services-v2-service-services.types.js.map +0 -1
- package/build/internal/es/src/bookings-services-v2-service-services.universal.d.ts +0 -4835
- package/build/internal/es/src/bookings-services-v2-service-services.universal.js +0 -2209
- package/build/internal/es/src/bookings-services-v2-service-services.universal.js.map +0 -1
|
@@ -1,2209 +0,0 @@
|
|
|
1
|
-
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
-
import { queryBuilder } from '@wix/sdk-runtime/query-builder';
|
|
3
|
-
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
4
|
-
import * as ambassadorWixBookingsServicesV2Service from './bookings-services-v2-service-services.http.js';
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
|
|
7
|
-
import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
|
|
8
|
-
import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
|
|
9
|
-
import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
|
|
10
|
-
import { transformSDKPageURLV2ToRESTPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
|
|
11
|
-
import { transformRESTPageURLV2ToSDKPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
|
|
12
|
-
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
|
|
13
|
-
export var ServiceType;
|
|
14
|
-
(function (ServiceType) {
|
|
15
|
-
/** Appointment-based service. */
|
|
16
|
-
ServiceType["APPOINTMENT"] = "APPOINTMENT";
|
|
17
|
-
/** Class service. */
|
|
18
|
-
ServiceType["CLASS"] = "CLASS";
|
|
19
|
-
/** Course service. */
|
|
20
|
-
ServiceType["COURSE"] = "COURSE";
|
|
21
|
-
})(ServiceType || (ServiceType = {}));
|
|
22
|
-
export var RateType;
|
|
23
|
-
(function (RateType) {
|
|
24
|
-
/** Unknown rate type. */
|
|
25
|
-
RateType["UNKNOWN_RATE_TYPE"] = "UNKNOWN_RATE_TYPE";
|
|
26
|
-
/** The service has a fixed price. */
|
|
27
|
-
RateType["FIXED"] = "FIXED";
|
|
28
|
-
/** The service has a custom price, expressed as a price description. */
|
|
29
|
-
RateType["CUSTOM"] = "CUSTOM";
|
|
30
|
-
/** This service is offered with a set of different prices based on different terms. */
|
|
31
|
-
RateType["VARIED"] = "VARIED";
|
|
32
|
-
/** This service is offered free of charge. */
|
|
33
|
-
RateType["NO_FEE"] = "NO_FEE";
|
|
34
|
-
})(RateType || (RateType = {}));
|
|
35
|
-
export var LocationType;
|
|
36
|
-
(function (LocationType) {
|
|
37
|
-
LocationType["UNKNOWN_LOCATION_TYPE"] = "UNKNOWN_LOCATION_TYPE";
|
|
38
|
-
/**
|
|
39
|
-
* Location set by the business that is not a standard business *location*
|
|
40
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction)).
|
|
41
|
-
*/
|
|
42
|
-
LocationType["CUSTOM"] = "CUSTOM";
|
|
43
|
-
/**
|
|
44
|
-
* Business *location*
|
|
45
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction)).
|
|
46
|
-
*/
|
|
47
|
-
LocationType["BUSINESS"] = "BUSINESS";
|
|
48
|
-
/**
|
|
49
|
-
* The customer specifies any address when booking. Available only for
|
|
50
|
-
* appointment-based services.
|
|
51
|
-
*/
|
|
52
|
-
LocationType["CUSTOMER"] = "CUSTOMER";
|
|
53
|
-
})(LocationType || (LocationType = {}));
|
|
54
|
-
export var WebhookIdentityType;
|
|
55
|
-
(function (WebhookIdentityType) {
|
|
56
|
-
WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
|
|
57
|
-
WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
58
|
-
WebhookIdentityType["MEMBER"] = "MEMBER";
|
|
59
|
-
WebhookIdentityType["WIX_USER"] = "WIX_USER";
|
|
60
|
-
WebhookIdentityType["APP"] = "APP";
|
|
61
|
-
})(WebhookIdentityType || (WebhookIdentityType = {}));
|
|
62
|
-
export var V2RequestedFields;
|
|
63
|
-
(function (V2RequestedFields) {
|
|
64
|
-
/** Unknown requested field. */
|
|
65
|
-
V2RequestedFields["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
|
|
66
|
-
/** When passed, `service.staff_members` is returned. */
|
|
67
|
-
V2RequestedFields["STAFF_MEMBER_DETAILS"] = "STAFF_MEMBER_DETAILS";
|
|
68
|
-
/** When passed, `service.service_resources.resource_type.name` is returned. */
|
|
69
|
-
V2RequestedFields["RESOURCE_TYPE_DETAILS"] = "RESOURCE_TYPE_DETAILS";
|
|
70
|
-
})(V2RequestedFields || (V2RequestedFields = {}));
|
|
71
|
-
export var SortOrder;
|
|
72
|
-
(function (SortOrder) {
|
|
73
|
-
SortOrder["ASC"] = "ASC";
|
|
74
|
-
SortOrder["DESC"] = "DESC";
|
|
75
|
-
})(SortOrder || (SortOrder = {}));
|
|
76
|
-
export var SortType;
|
|
77
|
-
(function (SortType) {
|
|
78
|
-
SortType["COUNT"] = "COUNT";
|
|
79
|
-
SortType["VALUE"] = "VALUE";
|
|
80
|
-
})(SortType || (SortType = {}));
|
|
81
|
-
export var SortDirection;
|
|
82
|
-
(function (SortDirection) {
|
|
83
|
-
SortDirection["DESC"] = "DESC";
|
|
84
|
-
SortDirection["ASC"] = "ASC";
|
|
85
|
-
})(SortDirection || (SortDirection = {}));
|
|
86
|
-
export var MissingValues;
|
|
87
|
-
(function (MissingValues) {
|
|
88
|
-
MissingValues["EXCLUDE"] = "EXCLUDE";
|
|
89
|
-
MissingValues["INCLUDE"] = "INCLUDE";
|
|
90
|
-
})(MissingValues || (MissingValues = {}));
|
|
91
|
-
export var ScalarType;
|
|
92
|
-
(function (ScalarType) {
|
|
93
|
-
ScalarType["UNKNOWN_SCALAR_TYPE"] = "UNKNOWN_SCALAR_TYPE";
|
|
94
|
-
ScalarType["COUNT_DISTINCT"] = "COUNT_DISTINCT";
|
|
95
|
-
ScalarType["MIN"] = "MIN";
|
|
96
|
-
ScalarType["MAX"] = "MAX";
|
|
97
|
-
})(ScalarType || (ScalarType = {}));
|
|
98
|
-
export var NestedAggregationType;
|
|
99
|
-
(function (NestedAggregationType) {
|
|
100
|
-
NestedAggregationType["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
|
|
101
|
-
NestedAggregationType["VALUE"] = "VALUE";
|
|
102
|
-
NestedAggregationType["RANGE"] = "RANGE";
|
|
103
|
-
NestedAggregationType["SCALAR"] = "SCALAR";
|
|
104
|
-
NestedAggregationType["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
|
|
105
|
-
})(NestedAggregationType || (NestedAggregationType = {}));
|
|
106
|
-
export var Interval;
|
|
107
|
-
(function (Interval) {
|
|
108
|
-
/** Unknown interval. */
|
|
109
|
-
Interval["UNKNOWN_INTERVAL"] = "UNKNOWN_INTERVAL";
|
|
110
|
-
/** Yearly interval. */
|
|
111
|
-
Interval["YEAR"] = "YEAR";
|
|
112
|
-
/** Monthly interval. */
|
|
113
|
-
Interval["MONTH"] = "MONTH";
|
|
114
|
-
/** Weekly interval. */
|
|
115
|
-
Interval["WEEK"] = "WEEK";
|
|
116
|
-
/** Daily interval. */
|
|
117
|
-
Interval["DAY"] = "DAY";
|
|
118
|
-
/** Hourly interval. */
|
|
119
|
-
Interval["HOUR"] = "HOUR";
|
|
120
|
-
/** Minute interval. */
|
|
121
|
-
Interval["MINUTE"] = "MINUTE";
|
|
122
|
-
/** Second interval. */
|
|
123
|
-
Interval["SECOND"] = "SECOND";
|
|
124
|
-
})(Interval || (Interval = {}));
|
|
125
|
-
export var AggregationType;
|
|
126
|
-
(function (AggregationType) {
|
|
127
|
-
AggregationType["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
|
|
128
|
-
AggregationType["VALUE"] = "VALUE";
|
|
129
|
-
AggregationType["RANGE"] = "RANGE";
|
|
130
|
-
AggregationType["SCALAR"] = "SCALAR";
|
|
131
|
-
AggregationType["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
|
|
132
|
-
AggregationType["NESTED"] = "NESTED";
|
|
133
|
-
})(AggregationType || (AggregationType = {}));
|
|
134
|
-
export var Mode;
|
|
135
|
-
(function (Mode) {
|
|
136
|
-
/** Any */
|
|
137
|
-
Mode["OR"] = "OR";
|
|
138
|
-
/** All */
|
|
139
|
-
Mode["AND"] = "AND";
|
|
140
|
-
})(Mode || (Mode = {}));
|
|
141
|
-
export var RequestedFields;
|
|
142
|
-
(function (RequestedFields) {
|
|
143
|
-
/** Unknown requested conditional field. */
|
|
144
|
-
RequestedFields["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
|
|
145
|
-
/** Whether to return the site's default booking form. */
|
|
146
|
-
RequestedFields["DEFAULT_BOOKING_FORM"] = "DEFAULT_BOOKING_FORM";
|
|
147
|
-
})(RequestedFields || (RequestedFields = {}));
|
|
148
|
-
export var Action;
|
|
149
|
-
(function (Action) {
|
|
150
|
-
Action["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
|
|
151
|
-
/** Retain all future sessions at their current location. This is the default. */
|
|
152
|
-
Action["KEEP_AT_CURRENT_LOCATION"] = "KEEP_AT_CURRENT_LOCATION";
|
|
153
|
-
/** Move future events to a new location. */
|
|
154
|
-
Action["MOVE_TO_LOCATION"] = "MOVE_TO_LOCATION";
|
|
155
|
-
/**
|
|
156
|
-
* Cancel all future events at the removed location.
|
|
157
|
-
* Currently not supported.
|
|
158
|
-
*/
|
|
159
|
-
Action["DELETE"] = "DELETE";
|
|
160
|
-
})(Action || (Action = {}));
|
|
161
|
-
export var InvalidSlugError;
|
|
162
|
-
(function (InvalidSlugError) {
|
|
163
|
-
/** Unknown slug error. */
|
|
164
|
-
InvalidSlugError["UNKNOWN_SLUG_ERROR"] = "UNKNOWN_SLUG_ERROR";
|
|
165
|
-
/** Slug contains illegal characters. */
|
|
166
|
-
InvalidSlugError["SLUG_CONTAINS_ILLEGAL_CHARACTERS"] = "SLUG_CONTAINS_ILLEGAL_CHARACTERS";
|
|
167
|
-
/** Slug is already associated with another service. */
|
|
168
|
-
InvalidSlugError["SLUG_ALREADY_EXISTS"] = "SLUG_ALREADY_EXISTS";
|
|
169
|
-
})(InvalidSlugError || (InvalidSlugError = {}));
|
|
170
|
-
export var CloneErrors;
|
|
171
|
-
(function (CloneErrors) {
|
|
172
|
-
/**
|
|
173
|
-
* Failed to clone the original service's *options and variants*
|
|
174
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
|
|
175
|
-
*/
|
|
176
|
-
CloneErrors["OPTIONS_AND_VARIANTS"] = "OPTIONS_AND_VARIANTS";
|
|
177
|
-
/** Failed to clone the original service's *booking form*. */
|
|
178
|
-
CloneErrors["FORM"] = "FORM";
|
|
179
|
-
})(CloneErrors || (CloneErrors = {}));
|
|
180
|
-
export var Status;
|
|
181
|
-
(function (Status) {
|
|
182
|
-
/** The category was created. */
|
|
183
|
-
Status["CREATED"] = "CREATED";
|
|
184
|
-
/** The category was deleted. */
|
|
185
|
-
Status["DELETED"] = "DELETED";
|
|
186
|
-
})(Status || (Status = {}));
|
|
187
|
-
export var CategoryNotificationEvent;
|
|
188
|
-
(function (CategoryNotificationEvent) {
|
|
189
|
-
/** Category was updated. */
|
|
190
|
-
CategoryNotificationEvent["Updated"] = "Updated";
|
|
191
|
-
/** Category was deleted. */
|
|
192
|
-
CategoryNotificationEvent["Deleted"] = "Deleted";
|
|
193
|
-
/** Category was created. */
|
|
194
|
-
CategoryNotificationEvent["Created"] = "Created";
|
|
195
|
-
})(CategoryNotificationEvent || (CategoryNotificationEvent = {}));
|
|
196
|
-
export var BenefitType;
|
|
197
|
-
(function (BenefitType) {
|
|
198
|
-
/** Should never be used */
|
|
199
|
-
BenefitType["UNDEFINED"] = "UNDEFINED";
|
|
200
|
-
/** Limited benefit type */
|
|
201
|
-
BenefitType["LIMITED"] = "LIMITED";
|
|
202
|
-
/** Unlimited benefit type */
|
|
203
|
-
BenefitType["UNLIMITED"] = "UNLIMITED";
|
|
204
|
-
})(BenefitType || (BenefitType = {}));
|
|
205
|
-
export var Event;
|
|
206
|
-
(function (Event) {
|
|
207
|
-
Event["Updated"] = "Updated";
|
|
208
|
-
Event["Deleted"] = "Deleted";
|
|
209
|
-
Event["Created"] = "Created";
|
|
210
|
-
})(Event || (Event = {}));
|
|
211
|
-
export var CrudType;
|
|
212
|
-
(function (CrudType) {
|
|
213
|
-
CrudType["INVALID_CRUD_TYPE"] = "INVALID_CRUD_TYPE";
|
|
214
|
-
CrudType["CREATE"] = "CREATE";
|
|
215
|
-
CrudType["UPDATE"] = "UPDATE";
|
|
216
|
-
CrudType["DELETE"] = "DELETE";
|
|
217
|
-
/** Unfortunately this action is used by hibernate save in wix-war */
|
|
218
|
-
CrudType["CREATE_OR_UPDATE"] = "CREATE_OR_UPDATE";
|
|
219
|
-
})(CrudType || (CrudType = {}));
|
|
220
|
-
/** Where the extra text should be displayed: before, after or instead of the actual address. */
|
|
221
|
-
export var PlacementType;
|
|
222
|
-
(function (PlacementType) {
|
|
223
|
-
PlacementType["BEFORE"] = "BEFORE";
|
|
224
|
-
PlacementType["AFTER"] = "AFTER";
|
|
225
|
-
PlacementType["REPLACE"] = "REPLACE";
|
|
226
|
-
})(PlacementType || (PlacementType = {}));
|
|
227
|
-
/** Enumerates the days of the week. */
|
|
228
|
-
export var DayOfWeek;
|
|
229
|
-
(function (DayOfWeek) {
|
|
230
|
-
DayOfWeek["MONDAY"] = "MONDAY";
|
|
231
|
-
DayOfWeek["TUESDAY"] = "TUESDAY";
|
|
232
|
-
DayOfWeek["WEDNESDAY"] = "WEDNESDAY";
|
|
233
|
-
DayOfWeek["THURSDAY"] = "THURSDAY";
|
|
234
|
-
DayOfWeek["FRIDAY"] = "FRIDAY";
|
|
235
|
-
DayOfWeek["SATURDAY"] = "SATURDAY";
|
|
236
|
-
DayOfWeek["SUNDAY"] = "SUNDAY";
|
|
237
|
-
})(DayOfWeek || (DayOfWeek = {}));
|
|
238
|
-
export var ResolutionMethod;
|
|
239
|
-
(function (ResolutionMethod) {
|
|
240
|
-
ResolutionMethod["QUERY_PARAM"] = "QUERY_PARAM";
|
|
241
|
-
ResolutionMethod["SUBDOMAIN"] = "SUBDOMAIN";
|
|
242
|
-
ResolutionMethod["SUBDIRECTORY"] = "SUBDIRECTORY";
|
|
243
|
-
})(ResolutionMethod || (ResolutionMethod = {}));
|
|
244
|
-
/**
|
|
245
|
-
* Creates a service.
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* ## Required fields
|
|
249
|
-
*
|
|
250
|
-
* When creating a service you must specify the following fields:
|
|
251
|
-
* - `type`
|
|
252
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/about-service-types) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-types)):
|
|
253
|
-
* Whether it's an appointment-based service, class, or course.
|
|
254
|
-
* - `name`: Service name that's displayed to customers.
|
|
255
|
-
* - `onlineBooking`:
|
|
256
|
-
* Settings determining whether customers can book online, whether the business
|
|
257
|
-
* must manually confirm bookings, and whether customers can request to book an
|
|
258
|
-
* appointment time slot that already has a booking request awaiting business
|
|
259
|
-
* confirmation.
|
|
260
|
-
* - `payment`
|
|
261
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/about-service-payments) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-payments)):
|
|
262
|
-
* How customers can pay when signing up for the service.
|
|
263
|
-
*
|
|
264
|
-
* ### Session durations
|
|
265
|
-
*
|
|
266
|
-
* Depending on which type of service you're creating, you may also need to specify
|
|
267
|
-
* supported session durations.
|
|
268
|
-
*
|
|
269
|
-
* __Classes and courses__
|
|
270
|
-
*
|
|
271
|
-
* Don't specify `schedule.availabilityConstraints.sessionDurations`.
|
|
272
|
-
*
|
|
273
|
-
* __Appointment-based services without varied pricing based on session length__
|
|
274
|
-
*
|
|
275
|
-
* Specify the single supported session duration in the
|
|
276
|
-
* `schedule.availabilityConstraints.sessionDurations` array.
|
|
277
|
-
*
|
|
278
|
-
* __Appointment-based services with varied pricing based on session length__
|
|
279
|
-
*
|
|
280
|
-
* - Specify all supported session durations in `schedule.availabilityConstraints.sessionDurations`.
|
|
281
|
-
* - Note that Wix Bookings doesn't display these values to customers and
|
|
282
|
-
* ignores them in pricing and availability calculations. Instead session
|
|
283
|
-
* durations are retrieved from the relevant service *variants*
|
|
284
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
|
|
285
|
-
* - It is mandatory to specify `schedule.availabilityConstraints.sessionDurations`,
|
|
286
|
-
* even though these values are ignored.
|
|
287
|
-
* @param service - Service to create.
|
|
288
|
-
* @public
|
|
289
|
-
* @requiredField service
|
|
290
|
-
* @permissionId BOOKINGS.SERVICES_CREATE
|
|
291
|
-
* @permissionScope Manage Bookings
|
|
292
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
293
|
-
* @permissionScope Manage Bookings - all permissions
|
|
294
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
295
|
-
* @applicableIdentity APP
|
|
296
|
-
* @returns Created service.
|
|
297
|
-
* @fqn wix.bookings.services.v2.ServicesService.CreateService
|
|
298
|
-
*/
|
|
299
|
-
export async function createService(service) {
|
|
300
|
-
// @ts-ignore
|
|
301
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
302
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({ service: service }), [
|
|
303
|
-
{
|
|
304
|
-
transformFn: transformSDKImageToRESTImage,
|
|
305
|
-
paths: [
|
|
306
|
-
{ path: 'service.media.items.image' },
|
|
307
|
-
{ path: 'service.media.mainMedia.image' },
|
|
308
|
-
{ path: 'service.media.coverMedia.image' },
|
|
309
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
310
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
311
|
-
],
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
315
|
-
paths: [
|
|
316
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
317
|
-
{ path: 'service.locations.business.address' },
|
|
318
|
-
{ path: 'service.locations.custom.address' },
|
|
319
|
-
],
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
323
|
-
paths: [
|
|
324
|
-
{ path: 'service.urls.servicePage' },
|
|
325
|
-
{ path: 'service.urls.bookingPage' },
|
|
326
|
-
{ path: 'service.urls.calendarPage' },
|
|
327
|
-
],
|
|
328
|
-
},
|
|
329
|
-
]);
|
|
330
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.createService(payload);
|
|
331
|
-
sideEffects?.onSiteCall?.();
|
|
332
|
-
try {
|
|
333
|
-
const result = await httpClient.request(reqOpts);
|
|
334
|
-
sideEffects?.onSuccess?.(result);
|
|
335
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
336
|
-
{
|
|
337
|
-
transformFn: transformRESTImageToSDKImage,
|
|
338
|
-
paths: [
|
|
339
|
-
{ path: 'service.media.items.image' },
|
|
340
|
-
{ path: 'service.media.mainMedia.image' },
|
|
341
|
-
{ path: 'service.media.coverMedia.image' },
|
|
342
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
343
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
344
|
-
],
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
348
|
-
paths: [
|
|
349
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
350
|
-
{ path: 'service.locations.business.address' },
|
|
351
|
-
{ path: 'service.locations.custom.address' },
|
|
352
|
-
],
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
356
|
-
paths: [
|
|
357
|
-
{ path: 'service.urls.servicePage' },
|
|
358
|
-
{ path: 'service.urls.bookingPage' },
|
|
359
|
-
{ path: 'service.urls.calendarPage' },
|
|
360
|
-
],
|
|
361
|
-
},
|
|
362
|
-
]))?.service;
|
|
363
|
-
}
|
|
364
|
-
catch (err) {
|
|
365
|
-
const transformedError = sdkTransformError(err, {
|
|
366
|
-
spreadPathsToArguments: {},
|
|
367
|
-
explicitPathsToArguments: { service: '$[0]' },
|
|
368
|
-
singleArgumentUnchanged: false,
|
|
369
|
-
}, ['service']);
|
|
370
|
-
sideEffects?.onError?.(err);
|
|
371
|
-
throw transformedError;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Creates multiple services.
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* See *Create Service*
|
|
379
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/create-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/create-service))
|
|
380
|
-
* for more details.
|
|
381
|
-
* @param services - Services to create.
|
|
382
|
-
* @public
|
|
383
|
-
* @requiredField services
|
|
384
|
-
* @permissionId BOOKINGS.SERVICES_CREATE
|
|
385
|
-
* @permissionScope Manage Bookings
|
|
386
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
387
|
-
* @permissionScope Manage Bookings - all permissions
|
|
388
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
389
|
-
* @applicableIdentity APP
|
|
390
|
-
* @fqn wix.bookings.services.v2.ServicesService.BulkCreateServices
|
|
391
|
-
*/
|
|
392
|
-
export async function bulkCreateServices(services, options) {
|
|
393
|
-
// @ts-ignore
|
|
394
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
395
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
396
|
-
services: services,
|
|
397
|
-
returnEntity: options?.returnEntity,
|
|
398
|
-
}), [
|
|
399
|
-
{
|
|
400
|
-
transformFn: transformSDKImageToRESTImage,
|
|
401
|
-
paths: [
|
|
402
|
-
{ path: 'services.media.items.image' },
|
|
403
|
-
{ path: 'services.media.mainMedia.image' },
|
|
404
|
-
{ path: 'services.media.coverMedia.image' },
|
|
405
|
-
{ path: 'services.staffMembers.mainMedia.image' },
|
|
406
|
-
{ path: 'services.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
407
|
-
],
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
411
|
-
paths: [
|
|
412
|
-
{ path: 'services.locations.calculatedAddress' },
|
|
413
|
-
{ path: 'services.locations.business.address' },
|
|
414
|
-
{ path: 'services.locations.custom.address' },
|
|
415
|
-
],
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
419
|
-
paths: [
|
|
420
|
-
{ path: 'services.urls.servicePage' },
|
|
421
|
-
{ path: 'services.urls.bookingPage' },
|
|
422
|
-
{ path: 'services.urls.calendarPage' },
|
|
423
|
-
],
|
|
424
|
-
},
|
|
425
|
-
]);
|
|
426
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.bulkCreateServices(payload);
|
|
427
|
-
sideEffects?.onSiteCall?.();
|
|
428
|
-
try {
|
|
429
|
-
const result = await httpClient.request(reqOpts);
|
|
430
|
-
sideEffects?.onSuccess?.(result);
|
|
431
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
432
|
-
{
|
|
433
|
-
transformFn: transformRESTImageToSDKImage,
|
|
434
|
-
paths: [
|
|
435
|
-
{ path: 'results.item.media.items.image' },
|
|
436
|
-
{ path: 'results.item.media.mainMedia.image' },
|
|
437
|
-
{ path: 'results.item.media.coverMedia.image' },
|
|
438
|
-
{ path: 'results.item.staffMembers.mainMedia.image' },
|
|
439
|
-
{
|
|
440
|
-
path: 'results.item.staffMemberDetails.staffMembers.mainMedia.image',
|
|
441
|
-
},
|
|
442
|
-
],
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
446
|
-
paths: [
|
|
447
|
-
{ path: 'results.item.locations.calculatedAddress' },
|
|
448
|
-
{ path: 'results.item.locations.business.address' },
|
|
449
|
-
{ path: 'results.item.locations.custom.address' },
|
|
450
|
-
],
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
454
|
-
paths: [
|
|
455
|
-
{ path: 'results.item.urls.servicePage' },
|
|
456
|
-
{ path: 'results.item.urls.bookingPage' },
|
|
457
|
-
{ path: 'results.item.urls.calendarPage' },
|
|
458
|
-
],
|
|
459
|
-
},
|
|
460
|
-
]));
|
|
461
|
-
}
|
|
462
|
-
catch (err) {
|
|
463
|
-
const transformedError = sdkTransformError(err, {
|
|
464
|
-
spreadPathsToArguments: {},
|
|
465
|
-
explicitPathsToArguments: {
|
|
466
|
-
services: '$[0]',
|
|
467
|
-
returnEntity: '$[1].returnEntity',
|
|
468
|
-
},
|
|
469
|
-
singleArgumentUnchanged: false,
|
|
470
|
-
}, ['services', 'options']);
|
|
471
|
-
sideEffects?.onError?.(err);
|
|
472
|
-
throw transformedError;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Retrieves a service.
|
|
477
|
-
* @param serviceId - ID of the service to retrieve.
|
|
478
|
-
* @public
|
|
479
|
-
* @requiredField serviceId
|
|
480
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
481
|
-
* @permissionScope Manage Stores
|
|
482
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
483
|
-
* @permissionScope Read Bookings - Public Data
|
|
484
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
485
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
486
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
487
|
-
* @permissionScope Manage Bookings
|
|
488
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
489
|
-
* @permissionScope Read Bookings - Including Participants
|
|
490
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
491
|
-
* @permissionScope Read Bookings - all read permissions
|
|
492
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
493
|
-
* @permissionScope Manage Bookings - all permissions
|
|
494
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
495
|
-
* @applicableIdentity APP
|
|
496
|
-
* @applicableIdentity VISITOR
|
|
497
|
-
* @returns Retrieved service.
|
|
498
|
-
* @fqn wix.bookings.services.v2.ServicesService.GetService
|
|
499
|
-
*/
|
|
500
|
-
export async function getService(serviceId) {
|
|
501
|
-
// @ts-ignore
|
|
502
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
503
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
504
|
-
serviceId: serviceId,
|
|
505
|
-
});
|
|
506
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.getService(payload);
|
|
507
|
-
sideEffects?.onSiteCall?.();
|
|
508
|
-
try {
|
|
509
|
-
const result = await httpClient.request(reqOpts);
|
|
510
|
-
sideEffects?.onSuccess?.(result);
|
|
511
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
512
|
-
{
|
|
513
|
-
transformFn: transformRESTImageToSDKImage,
|
|
514
|
-
paths: [
|
|
515
|
-
{ path: 'service.media.items.image' },
|
|
516
|
-
{ path: 'service.media.mainMedia.image' },
|
|
517
|
-
{ path: 'service.media.coverMedia.image' },
|
|
518
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
519
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
520
|
-
],
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
524
|
-
paths: [
|
|
525
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
526
|
-
{ path: 'service.locations.business.address' },
|
|
527
|
-
{ path: 'service.locations.custom.address' },
|
|
528
|
-
],
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
532
|
-
paths: [
|
|
533
|
-
{ path: 'service.urls.servicePage' },
|
|
534
|
-
{ path: 'service.urls.bookingPage' },
|
|
535
|
-
{ path: 'service.urls.calendarPage' },
|
|
536
|
-
],
|
|
537
|
-
},
|
|
538
|
-
]))?.service;
|
|
539
|
-
}
|
|
540
|
-
catch (err) {
|
|
541
|
-
const transformedError = sdkTransformError(err, {
|
|
542
|
-
spreadPathsToArguments: {},
|
|
543
|
-
explicitPathsToArguments: { serviceId: '$[0]' },
|
|
544
|
-
singleArgumentUnchanged: false,
|
|
545
|
-
}, ['serviceId']);
|
|
546
|
-
sideEffects?.onError?.(err);
|
|
547
|
-
throw transformedError;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Updates a service.
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* Each time the service is updated, `revision` increments by 1. You must
|
|
555
|
-
* include the number of the existing revision when updating the service.
|
|
556
|
-
* This ensures you're working with the latest service information and
|
|
557
|
-
* prevents unintended overwrites.
|
|
558
|
-
*
|
|
559
|
-
* ## Session durations
|
|
560
|
-
*
|
|
561
|
-
* Specify `schedule.availabilityConstraints.sessionDurations`
|
|
562
|
-
* only if you want to update it for appointment-based services without varied
|
|
563
|
-
* pricing based on session length. Don't specify `schedule.availabilityConstraints.sessionDurations`
|
|
564
|
-
* for all other appointment-based services, classes, or courses. See *Create Service*
|
|
565
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/create-service#session-durations) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/create-service#session-durations))
|
|
566
|
-
* for more details.
|
|
567
|
-
* @param _id - Service ID.
|
|
568
|
-
* @public
|
|
569
|
-
* @requiredField _id
|
|
570
|
-
* @requiredField service
|
|
571
|
-
* @requiredField service.revision
|
|
572
|
-
* @permissionId BOOKINGS.SERVICES_UPDATE
|
|
573
|
-
* @permissionScope Manage Bookings
|
|
574
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
575
|
-
* @permissionScope Manage Bookings - all permissions
|
|
576
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
577
|
-
* @applicableIdentity APP
|
|
578
|
-
* @returns Updated service.
|
|
579
|
-
* @fqn wix.bookings.services.v2.ServicesService.UpdateService
|
|
580
|
-
*/
|
|
581
|
-
export async function updateService(_id, service) {
|
|
582
|
-
// @ts-ignore
|
|
583
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
584
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({ service: { ...service, id: _id } }), [
|
|
585
|
-
{
|
|
586
|
-
transformFn: transformSDKImageToRESTImage,
|
|
587
|
-
paths: [
|
|
588
|
-
{ path: 'service.media.items.image' },
|
|
589
|
-
{ path: 'service.media.mainMedia.image' },
|
|
590
|
-
{ path: 'service.media.coverMedia.image' },
|
|
591
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
592
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
593
|
-
],
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
597
|
-
paths: [
|
|
598
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
599
|
-
{ path: 'service.locations.business.address' },
|
|
600
|
-
{ path: 'service.locations.custom.address' },
|
|
601
|
-
],
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
605
|
-
paths: [
|
|
606
|
-
{ path: 'service.urls.servicePage' },
|
|
607
|
-
{ path: 'service.urls.bookingPage' },
|
|
608
|
-
{ path: 'service.urls.calendarPage' },
|
|
609
|
-
],
|
|
610
|
-
},
|
|
611
|
-
]);
|
|
612
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.updateService(payload);
|
|
613
|
-
sideEffects?.onSiteCall?.();
|
|
614
|
-
try {
|
|
615
|
-
const result = await httpClient.request(reqOpts);
|
|
616
|
-
sideEffects?.onSuccess?.(result);
|
|
617
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
618
|
-
{
|
|
619
|
-
transformFn: transformRESTImageToSDKImage,
|
|
620
|
-
paths: [
|
|
621
|
-
{ path: 'service.media.items.image' },
|
|
622
|
-
{ path: 'service.media.mainMedia.image' },
|
|
623
|
-
{ path: 'service.media.coverMedia.image' },
|
|
624
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
625
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
626
|
-
],
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
630
|
-
paths: [
|
|
631
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
632
|
-
{ path: 'service.locations.business.address' },
|
|
633
|
-
{ path: 'service.locations.custom.address' },
|
|
634
|
-
],
|
|
635
|
-
},
|
|
636
|
-
{
|
|
637
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
638
|
-
paths: [
|
|
639
|
-
{ path: 'service.urls.servicePage' },
|
|
640
|
-
{ path: 'service.urls.bookingPage' },
|
|
641
|
-
{ path: 'service.urls.calendarPage' },
|
|
642
|
-
],
|
|
643
|
-
},
|
|
644
|
-
]))?.service;
|
|
645
|
-
}
|
|
646
|
-
catch (err) {
|
|
647
|
-
const transformedError = sdkTransformError(err, {
|
|
648
|
-
spreadPathsToArguments: { service: '$[1]' },
|
|
649
|
-
explicitPathsToArguments: { 'service.id': '$[0]' },
|
|
650
|
-
singleArgumentUnchanged: false,
|
|
651
|
-
}, ['_id', 'service']);
|
|
652
|
-
sideEffects?.onError?.(err);
|
|
653
|
-
throw transformedError;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Updates up to 100 services.
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
* See *Update Service*
|
|
661
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/update-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/update-service))
|
|
662
|
-
* for more details.
|
|
663
|
-
*
|
|
664
|
-
* The call succeeds even if one or more individual services can't be updated.
|
|
665
|
-
* Information about failures is returned in `bulkActionMetadata`.
|
|
666
|
-
* @public
|
|
667
|
-
* @requiredField options.services.service
|
|
668
|
-
* @requiredField options.services.service._id
|
|
669
|
-
* @requiredField options.services.service.revision
|
|
670
|
-
* @permissionId BOOKINGS.SERVICES_UPDATE
|
|
671
|
-
* @permissionScope Manage Bookings
|
|
672
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
673
|
-
* @permissionScope Manage Bookings - all permissions
|
|
674
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
675
|
-
* @applicableIdentity APP
|
|
676
|
-
* @fqn wix.bookings.services.v2.ServicesService.BulkUpdateServices
|
|
677
|
-
*/
|
|
678
|
-
export async function bulkUpdateServices(options) {
|
|
679
|
-
// @ts-ignore
|
|
680
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
681
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
682
|
-
services: options?.services,
|
|
683
|
-
returnEntity: options?.returnEntity,
|
|
684
|
-
}), [
|
|
685
|
-
{
|
|
686
|
-
transformFn: transformSDKImageToRESTImage,
|
|
687
|
-
paths: [
|
|
688
|
-
{ path: 'services.service.media.items.image' },
|
|
689
|
-
{ path: 'services.service.media.mainMedia.image' },
|
|
690
|
-
{ path: 'services.service.media.coverMedia.image' },
|
|
691
|
-
{ path: 'services.service.staffMembers.mainMedia.image' },
|
|
692
|
-
{
|
|
693
|
-
path: 'services.service.staffMemberDetails.staffMembers.mainMedia.image',
|
|
694
|
-
},
|
|
695
|
-
],
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
699
|
-
paths: [
|
|
700
|
-
{ path: 'services.service.locations.calculatedAddress' },
|
|
701
|
-
{ path: 'services.service.locations.business.address' },
|
|
702
|
-
{ path: 'services.service.locations.custom.address' },
|
|
703
|
-
],
|
|
704
|
-
},
|
|
705
|
-
{
|
|
706
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
707
|
-
paths: [
|
|
708
|
-
{ path: 'services.service.urls.servicePage' },
|
|
709
|
-
{ path: 'services.service.urls.bookingPage' },
|
|
710
|
-
{ path: 'services.service.urls.calendarPage' },
|
|
711
|
-
],
|
|
712
|
-
},
|
|
713
|
-
]);
|
|
714
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.bulkUpdateServices(payload);
|
|
715
|
-
sideEffects?.onSiteCall?.();
|
|
716
|
-
try {
|
|
717
|
-
const result = await httpClient.request(reqOpts);
|
|
718
|
-
sideEffects?.onSuccess?.(result);
|
|
719
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
720
|
-
{
|
|
721
|
-
transformFn: transformRESTImageToSDKImage,
|
|
722
|
-
paths: [
|
|
723
|
-
{ path: 'results.item.media.items.image' },
|
|
724
|
-
{ path: 'results.item.media.mainMedia.image' },
|
|
725
|
-
{ path: 'results.item.media.coverMedia.image' },
|
|
726
|
-
{ path: 'results.item.staffMembers.mainMedia.image' },
|
|
727
|
-
{
|
|
728
|
-
path: 'results.item.staffMemberDetails.staffMembers.mainMedia.image',
|
|
729
|
-
},
|
|
730
|
-
],
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
734
|
-
paths: [
|
|
735
|
-
{ path: 'results.item.locations.calculatedAddress' },
|
|
736
|
-
{ path: 'results.item.locations.business.address' },
|
|
737
|
-
{ path: 'results.item.locations.custom.address' },
|
|
738
|
-
],
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
742
|
-
paths: [
|
|
743
|
-
{ path: 'results.item.urls.servicePage' },
|
|
744
|
-
{ path: 'results.item.urls.bookingPage' },
|
|
745
|
-
{ path: 'results.item.urls.calendarPage' },
|
|
746
|
-
],
|
|
747
|
-
},
|
|
748
|
-
]));
|
|
749
|
-
}
|
|
750
|
-
catch (err) {
|
|
751
|
-
const transformedError = sdkTransformError(err, {
|
|
752
|
-
spreadPathsToArguments: {},
|
|
753
|
-
explicitPathsToArguments: {
|
|
754
|
-
services: '$[0].services',
|
|
755
|
-
returnEntity: '$[0].returnEntity',
|
|
756
|
-
},
|
|
757
|
-
singleArgumentUnchanged: false,
|
|
758
|
-
}, ['options']);
|
|
759
|
-
sideEffects?.onError?.(err);
|
|
760
|
-
throw transformedError;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Updates multiple services by filter.
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* Refer to the supported filters article
|
|
768
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering))
|
|
769
|
-
* for more details.
|
|
770
|
-
*
|
|
771
|
-
* See *Update Service*
|
|
772
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/update-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/update-service))
|
|
773
|
-
* for more details about updating a service.
|
|
774
|
-
*
|
|
775
|
-
* The call succeeds even if one or more individual services can't be updated.
|
|
776
|
-
* Information about failures is returned in `bulkActionMetadata`.
|
|
777
|
-
* @param filter - Filter to identify the services to update.
|
|
778
|
-
* @public
|
|
779
|
-
* @requiredField filter
|
|
780
|
-
* @requiredField options
|
|
781
|
-
* @requiredField options.service
|
|
782
|
-
* @permissionId BOOKINGS.SERVICES_UPDATE
|
|
783
|
-
* @permissionScope Manage Bookings
|
|
784
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
785
|
-
* @permissionScope Manage Bookings - all permissions
|
|
786
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
787
|
-
* @applicableIdentity APP
|
|
788
|
-
* @fqn wix.bookings.services.v2.ServicesService.BulkUpdateServicesByFilter
|
|
789
|
-
*/
|
|
790
|
-
export async function bulkUpdateServicesByFilter(filter, options) {
|
|
791
|
-
// @ts-ignore
|
|
792
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
793
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
794
|
-
filter: filter,
|
|
795
|
-
service: options?.service,
|
|
796
|
-
}), [
|
|
797
|
-
{
|
|
798
|
-
transformFn: transformSDKImageToRESTImage,
|
|
799
|
-
paths: [
|
|
800
|
-
{ path: 'service.media.items.image' },
|
|
801
|
-
{ path: 'service.media.mainMedia.image' },
|
|
802
|
-
{ path: 'service.media.coverMedia.image' },
|
|
803
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
804
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
805
|
-
],
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
809
|
-
paths: [
|
|
810
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
811
|
-
{ path: 'service.locations.business.address' },
|
|
812
|
-
{ path: 'service.locations.custom.address' },
|
|
813
|
-
],
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
817
|
-
paths: [
|
|
818
|
-
{ path: 'service.urls.servicePage' },
|
|
819
|
-
{ path: 'service.urls.bookingPage' },
|
|
820
|
-
{ path: 'service.urls.calendarPage' },
|
|
821
|
-
],
|
|
822
|
-
},
|
|
823
|
-
]);
|
|
824
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.bulkUpdateServicesByFilter(payload);
|
|
825
|
-
sideEffects?.onSiteCall?.();
|
|
826
|
-
try {
|
|
827
|
-
const result = await httpClient.request(reqOpts);
|
|
828
|
-
sideEffects?.onSuccess?.(result);
|
|
829
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
830
|
-
}
|
|
831
|
-
catch (err) {
|
|
832
|
-
const transformedError = sdkTransformError(err, {
|
|
833
|
-
spreadPathsToArguments: {},
|
|
834
|
-
explicitPathsToArguments: { filter: '$[0]', service: '$[1].service' },
|
|
835
|
-
singleArgumentUnchanged: false,
|
|
836
|
-
}, ['filter', 'options']);
|
|
837
|
-
sideEffects?.onError?.(err);
|
|
838
|
-
throw transformedError;
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Deletes a service.
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
* Specify `{"preserveFutureSessionsWithParticipants": true}` to retain all
|
|
846
|
-
* future sessions for the service. By default, all future sessions are canceled.
|
|
847
|
-
* @param serviceId - ID of the service to delete.
|
|
848
|
-
* @public
|
|
849
|
-
* @requiredField serviceId
|
|
850
|
-
* @param options - Allows you to configure how to handle the deleted service's future sessions and how to notify the sessions participants.
|
|
851
|
-
* @permissionId BOOKINGS.SERVICES_DELETE
|
|
852
|
-
* @permissionScope Manage Bookings
|
|
853
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
854
|
-
* @permissionScope Manage Bookings - all permissions
|
|
855
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
856
|
-
* @applicableIdentity APP
|
|
857
|
-
* @fqn wix.bookings.services.v2.ServicesService.DeleteService
|
|
858
|
-
*/
|
|
859
|
-
export async function deleteService(serviceId, options) {
|
|
860
|
-
// @ts-ignore
|
|
861
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
862
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
863
|
-
serviceId: serviceId,
|
|
864
|
-
preserveFutureSessionsWithParticipants: options?.preserveFutureSessionsWithParticipants,
|
|
865
|
-
participantNotification: options?.participantNotification,
|
|
866
|
-
});
|
|
867
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.deleteService(payload);
|
|
868
|
-
sideEffects?.onSiteCall?.();
|
|
869
|
-
try {
|
|
870
|
-
const result = await httpClient.request(reqOpts);
|
|
871
|
-
sideEffects?.onSuccess?.(result);
|
|
872
|
-
}
|
|
873
|
-
catch (err) {
|
|
874
|
-
const transformedError = sdkTransformError(err, {
|
|
875
|
-
spreadPathsToArguments: {},
|
|
876
|
-
explicitPathsToArguments: {
|
|
877
|
-
serviceId: '$[0]',
|
|
878
|
-
preserveFutureSessionsWithParticipants: '$[1].preserveFutureSessionsWithParticipants',
|
|
879
|
-
participantNotification: '$[1].participantNotification',
|
|
880
|
-
},
|
|
881
|
-
singleArgumentUnchanged: false,
|
|
882
|
-
}, ['serviceId', 'options']);
|
|
883
|
-
sideEffects?.onError?.(err);
|
|
884
|
-
throw transformedError;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Deletes multiple services.
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
* See *Delete Service*
|
|
892
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/delete-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/delete-service))
|
|
893
|
-
* for more details about deleting a service.
|
|
894
|
-
*
|
|
895
|
-
* The call succeeds even if one or more individual services can't be deleted.
|
|
896
|
-
* Information about failures is returned in `bulkActionMetadata`.
|
|
897
|
-
* @param ids - IDs of the services to delete.
|
|
898
|
-
* @public
|
|
899
|
-
* @requiredField ids
|
|
900
|
-
* @permissionId BOOKINGS.SERVICES_DELETE
|
|
901
|
-
* @permissionScope Manage Bookings
|
|
902
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
903
|
-
* @permissionScope Manage Bookings - all permissions
|
|
904
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
905
|
-
* @applicableIdentity APP
|
|
906
|
-
* @fqn wix.bookings.services.v2.ServicesService.BulkDeleteServices
|
|
907
|
-
*/
|
|
908
|
-
export async function bulkDeleteServices(ids, options) {
|
|
909
|
-
// @ts-ignore
|
|
910
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
911
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
912
|
-
ids: ids,
|
|
913
|
-
preserveFutureSessionsWithParticipants: options?.preserveFutureSessionsWithParticipants,
|
|
914
|
-
participantNotification: options?.participantNotification,
|
|
915
|
-
});
|
|
916
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.bulkDeleteServices(payload);
|
|
917
|
-
sideEffects?.onSiteCall?.();
|
|
918
|
-
try {
|
|
919
|
-
const result = await httpClient.request(reqOpts);
|
|
920
|
-
sideEffects?.onSuccess?.(result);
|
|
921
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
922
|
-
{
|
|
923
|
-
transformFn: transformRESTImageToSDKImage,
|
|
924
|
-
paths: [
|
|
925
|
-
{ path: 'results.item.media.items.image' },
|
|
926
|
-
{ path: 'results.item.media.mainMedia.image' },
|
|
927
|
-
{ path: 'results.item.media.coverMedia.image' },
|
|
928
|
-
{ path: 'results.item.staffMembers.mainMedia.image' },
|
|
929
|
-
{
|
|
930
|
-
path: 'results.item.staffMemberDetails.staffMembers.mainMedia.image',
|
|
931
|
-
},
|
|
932
|
-
],
|
|
933
|
-
},
|
|
934
|
-
{
|
|
935
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
936
|
-
paths: [
|
|
937
|
-
{ path: 'results.item.locations.calculatedAddress' },
|
|
938
|
-
{ path: 'results.item.locations.business.address' },
|
|
939
|
-
{ path: 'results.item.locations.custom.address' },
|
|
940
|
-
],
|
|
941
|
-
},
|
|
942
|
-
{
|
|
943
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
944
|
-
paths: [
|
|
945
|
-
{ path: 'results.item.urls.servicePage' },
|
|
946
|
-
{ path: 'results.item.urls.bookingPage' },
|
|
947
|
-
{ path: 'results.item.urls.calendarPage' },
|
|
948
|
-
],
|
|
949
|
-
},
|
|
950
|
-
]));
|
|
951
|
-
}
|
|
952
|
-
catch (err) {
|
|
953
|
-
const transformedError = sdkTransformError(err, {
|
|
954
|
-
spreadPathsToArguments: {},
|
|
955
|
-
explicitPathsToArguments: {
|
|
956
|
-
ids: '$[0]',
|
|
957
|
-
preserveFutureSessionsWithParticipants: '$[1].preserveFutureSessionsWithParticipants',
|
|
958
|
-
participantNotification: '$[1].participantNotification',
|
|
959
|
-
},
|
|
960
|
-
singleArgumentUnchanged: false,
|
|
961
|
-
}, ['ids', 'options']);
|
|
962
|
-
sideEffects?.onError?.(err);
|
|
963
|
-
throw transformedError;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
/**
|
|
967
|
-
* Deletes multiple services by filter.
|
|
968
|
-
*
|
|
969
|
-
*
|
|
970
|
-
* See *Delete Service*
|
|
971
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/delete-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/delete-service))
|
|
972
|
-
* for more details about deleting a service.
|
|
973
|
-
*
|
|
974
|
-
* The call succeeds even if one or more individual services can't be deleted.
|
|
975
|
-
* Information about failures is returned in `bulkActionMetadata`.
|
|
976
|
-
*
|
|
977
|
-
* Refer to the supported filters article
|
|
978
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering))
|
|
979
|
-
* for more details.
|
|
980
|
-
*
|
|
981
|
-
* To learn about working with filters in general, see
|
|
982
|
-
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
|
|
983
|
-
* @param filter - Filter to identify the services that need to be deleted.
|
|
984
|
-
* @public
|
|
985
|
-
* @requiredField filter
|
|
986
|
-
* @permissionId BOOKINGS.SERVICES_DELETE
|
|
987
|
-
* @permissionScope Manage Bookings
|
|
988
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
989
|
-
* @permissionScope Manage Bookings - all permissions
|
|
990
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
991
|
-
* @applicableIdentity APP
|
|
992
|
-
* @fqn wix.bookings.services.v2.ServicesService.BulkDeleteServicesByFilter
|
|
993
|
-
*/
|
|
994
|
-
export async function bulkDeleteServicesByFilter(filter, options) {
|
|
995
|
-
// @ts-ignore
|
|
996
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
997
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
998
|
-
filter: filter,
|
|
999
|
-
preserveFutureSessionsWithParticipants: options?.preserveFutureSessionsWithParticipants,
|
|
1000
|
-
participantNotification: options?.participantNotification,
|
|
1001
|
-
});
|
|
1002
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.bulkDeleteServicesByFilter(payload);
|
|
1003
|
-
sideEffects?.onSiteCall?.();
|
|
1004
|
-
try {
|
|
1005
|
-
const result = await httpClient.request(reqOpts);
|
|
1006
|
-
sideEffects?.onSuccess?.(result);
|
|
1007
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1008
|
-
}
|
|
1009
|
-
catch (err) {
|
|
1010
|
-
const transformedError = sdkTransformError(err, {
|
|
1011
|
-
spreadPathsToArguments: {},
|
|
1012
|
-
explicitPathsToArguments: {
|
|
1013
|
-
filter: '$[0]',
|
|
1014
|
-
preserveFutureSessionsWithParticipants: '$[1].preserveFutureSessionsWithParticipants',
|
|
1015
|
-
participantNotification: '$[1].participantNotification',
|
|
1016
|
-
},
|
|
1017
|
-
singleArgumentUnchanged: false,
|
|
1018
|
-
}, ['filter', 'options']);
|
|
1019
|
-
sideEffects?.onError?.(err);
|
|
1020
|
-
throw transformedError;
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Creates a query to retrieve a list of `service` objects.
|
|
1025
|
-
*
|
|
1026
|
-
* The `queryServices()` function builds a query to retrieve a list of `service` objects and returns a `ServicesQueryBuilder` object.
|
|
1027
|
-
*
|
|
1028
|
-
* The returned object contains the query definition, which is typically used to run the query using the [find()](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/services-query-builder/find) function.
|
|
1029
|
-
*
|
|
1030
|
-
* You can refine the query by chaining `ServicesQueryBuilder` functions onto the query. `ServicesQueryBuilder` functions enable you to sort, filter, and control the results that `queryServices()` returns.
|
|
1031
|
-
*
|
|
1032
|
-
* `queryServices()` runs with the following `ServicesQueryBuilder` defaults that you can override:
|
|
1033
|
-
*
|
|
1034
|
-
* + `limit` is `100`.
|
|
1035
|
-
* + Sorted by `createdDate` in ascending order.
|
|
1036
|
-
*
|
|
1037
|
-
* The functions that are chained to `queryServices()` are applied in the order they are called. For example, if you apply `ascending("category.name")` and then `ascending("name")`, the results are sorted first by `category.name`, and then, if there are multiple results with the same `category.name`, the items are sorted by `name`.
|
|
1038
|
-
*
|
|
1039
|
-
* The following `ServicesQueryBuilder` functions are supported for the `queryServices()` function. For a full description of the `service` object, see the object returned for the [items](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/services-query-result/items) property in `ServicesQueryResult`.
|
|
1040
|
-
* @public
|
|
1041
|
-
* @permissionScope Manage Stores
|
|
1042
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1043
|
-
* @permissionScope Read Bookings - Public Data
|
|
1044
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1045
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1046
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1047
|
-
* @permissionScope Manage Bookings
|
|
1048
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1049
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1050
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1051
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1052
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1053
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1054
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1055
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
1056
|
-
* @applicableIdentity APP
|
|
1057
|
-
* @applicableIdentity VISITOR
|
|
1058
|
-
* @fqn wix.bookings.services.v2.ServicesService.QueryServices
|
|
1059
|
-
*/
|
|
1060
|
-
export function queryServices(options) {
|
|
1061
|
-
// @ts-ignore
|
|
1062
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1063
|
-
return queryBuilder({
|
|
1064
|
-
func: async (payload) => {
|
|
1065
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.queryServices({
|
|
1066
|
-
...payload,
|
|
1067
|
-
...(options ?? {}),
|
|
1068
|
-
});
|
|
1069
|
-
sideEffects?.onSiteCall?.();
|
|
1070
|
-
try {
|
|
1071
|
-
const result = await httpClient.request(reqOpts);
|
|
1072
|
-
sideEffects?.onSuccess?.(result);
|
|
1073
|
-
return result;
|
|
1074
|
-
}
|
|
1075
|
-
catch (err) {
|
|
1076
|
-
sideEffects?.onError?.(err);
|
|
1077
|
-
throw err;
|
|
1078
|
-
}
|
|
1079
|
-
},
|
|
1080
|
-
requestTransformer: (query) => {
|
|
1081
|
-
const args = [query, options];
|
|
1082
|
-
return renameKeysFromSDKRequestToRESTRequest({
|
|
1083
|
-
...args?.[1],
|
|
1084
|
-
query: args?.[0],
|
|
1085
|
-
});
|
|
1086
|
-
},
|
|
1087
|
-
responseTransformer: ({ data }) => {
|
|
1088
|
-
const transformedData = renameKeysFromRESTResponseToSDKResponse(transformPaths(data, [
|
|
1089
|
-
{
|
|
1090
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1091
|
-
paths: [
|
|
1092
|
-
{ path: 'services.media.items.image' },
|
|
1093
|
-
{ path: 'services.media.mainMedia.image' },
|
|
1094
|
-
{ path: 'services.media.coverMedia.image' },
|
|
1095
|
-
{ path: 'services.staffMembers.mainMedia.image' },
|
|
1096
|
-
{
|
|
1097
|
-
path: 'services.staffMemberDetails.staffMembers.mainMedia.image',
|
|
1098
|
-
},
|
|
1099
|
-
],
|
|
1100
|
-
},
|
|
1101
|
-
{
|
|
1102
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1103
|
-
paths: [
|
|
1104
|
-
{ path: 'services.locations.calculatedAddress' },
|
|
1105
|
-
{ path: 'services.locations.business.address' },
|
|
1106
|
-
{ path: 'services.locations.custom.address' },
|
|
1107
|
-
],
|
|
1108
|
-
},
|
|
1109
|
-
{
|
|
1110
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1111
|
-
paths: [
|
|
1112
|
-
{ path: 'services.urls.servicePage' },
|
|
1113
|
-
{ path: 'services.urls.bookingPage' },
|
|
1114
|
-
{ path: 'services.urls.calendarPage' },
|
|
1115
|
-
],
|
|
1116
|
-
},
|
|
1117
|
-
]));
|
|
1118
|
-
return {
|
|
1119
|
-
items: transformedData?.services,
|
|
1120
|
-
pagingMetadata: transformedData?.pagingMetadata,
|
|
1121
|
-
};
|
|
1122
|
-
},
|
|
1123
|
-
errorTransformer: (err) => {
|
|
1124
|
-
const transformedError = sdkTransformError(err, {
|
|
1125
|
-
spreadPathsToArguments: {},
|
|
1126
|
-
explicitPathsToArguments: { query: '$[0]' },
|
|
1127
|
-
singleArgumentUnchanged: false,
|
|
1128
|
-
});
|
|
1129
|
-
throw transformedError;
|
|
1130
|
-
},
|
|
1131
|
-
pagingMethod: 'OFFSET',
|
|
1132
|
-
transformationPaths: {},
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Retrieves a list of up to 100 services, given the provided filtering, paging,
|
|
1137
|
-
* and sorting.
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
* ## Defaults
|
|
1141
|
-
*
|
|
1142
|
-
* Search Services has the following default settings, which you can override:
|
|
1143
|
-
* + Sorted by `createdDate` in ascending order.
|
|
1144
|
-
* + `paging.limit` set to `100`.
|
|
1145
|
-
* + `paging.offset` set to `0`.
|
|
1146
|
-
*
|
|
1147
|
-
* ## Filters
|
|
1148
|
-
*
|
|
1149
|
-
* When using filters for dates, you must use
|
|
1150
|
-
* [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
|
|
1151
|
-
*
|
|
1152
|
-
* Refer to the supported filters article
|
|
1153
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting))
|
|
1154
|
-
* for a complete list of supported filters and sorting options.
|
|
1155
|
-
*
|
|
1156
|
-
* ## See also
|
|
1157
|
-
*
|
|
1158
|
-
* To learn about working with *Search* methods, see
|
|
1159
|
-
* _API Query Language_
|
|
1160
|
-
* ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language))
|
|
1161
|
-
* and *Sorting and Paging*
|
|
1162
|
-
* ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#the-sort-array) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging)).
|
|
1163
|
-
* @param search - WQL, search or aggregation expression.
|
|
1164
|
-
* @public
|
|
1165
|
-
* @documentationMaturity preview
|
|
1166
|
-
* @requiredField search
|
|
1167
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
1168
|
-
* @permissionScope Manage Stores
|
|
1169
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1170
|
-
* @permissionScope Read Bookings - Public Data
|
|
1171
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1172
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1173
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1174
|
-
* @permissionScope Manage Bookings
|
|
1175
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1176
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1177
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1178
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1179
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1180
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1181
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1182
|
-
* @applicableIdentity APP
|
|
1183
|
-
* @applicableIdentity VISITOR
|
|
1184
|
-
* @fqn wix.bookings.services.v2.ServicesService.SearchServices
|
|
1185
|
-
*/
|
|
1186
|
-
export async function searchServices(search) {
|
|
1187
|
-
// @ts-ignore
|
|
1188
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1189
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ search: search });
|
|
1190
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.searchServices(payload);
|
|
1191
|
-
sideEffects?.onSiteCall?.();
|
|
1192
|
-
try {
|
|
1193
|
-
const result = await httpClient.request(reqOpts);
|
|
1194
|
-
sideEffects?.onSuccess?.(result);
|
|
1195
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1196
|
-
{
|
|
1197
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1198
|
-
paths: [
|
|
1199
|
-
{ path: 'services.media.items.image' },
|
|
1200
|
-
{ path: 'services.media.mainMedia.image' },
|
|
1201
|
-
{ path: 'services.media.coverMedia.image' },
|
|
1202
|
-
{ path: 'services.staffMembers.mainMedia.image' },
|
|
1203
|
-
{
|
|
1204
|
-
path: 'services.staffMemberDetails.staffMembers.mainMedia.image',
|
|
1205
|
-
},
|
|
1206
|
-
],
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1210
|
-
paths: [
|
|
1211
|
-
{ path: 'services.locations.calculatedAddress' },
|
|
1212
|
-
{ path: 'services.locations.business.address' },
|
|
1213
|
-
{ path: 'services.locations.custom.address' },
|
|
1214
|
-
],
|
|
1215
|
-
},
|
|
1216
|
-
{
|
|
1217
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1218
|
-
paths: [
|
|
1219
|
-
{ path: 'services.urls.servicePage' },
|
|
1220
|
-
{ path: 'services.urls.bookingPage' },
|
|
1221
|
-
{ path: 'services.urls.calendarPage' },
|
|
1222
|
-
],
|
|
1223
|
-
},
|
|
1224
|
-
]));
|
|
1225
|
-
}
|
|
1226
|
-
catch (err) {
|
|
1227
|
-
const transformedError = sdkTransformError(err, {
|
|
1228
|
-
spreadPathsToArguments: {},
|
|
1229
|
-
explicitPathsToArguments: { search: '$[0]' },
|
|
1230
|
-
singleArgumentUnchanged: false,
|
|
1231
|
-
}, ['search']);
|
|
1232
|
-
sideEffects?.onError?.(err);
|
|
1233
|
-
throw transformedError;
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Retrieves a list of up to 100 *booking policies*
|
|
1238
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-policies/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policies/introduction)),
|
|
1239
|
-
* and information about the services that are connected to them,
|
|
1240
|
-
* given the provided filtering, paging, and sorting.
|
|
1241
|
-
*
|
|
1242
|
-
* ## Defaults
|
|
1243
|
-
*
|
|
1244
|
-
* Query Policies has the following default settings, which you can override:
|
|
1245
|
-
*
|
|
1246
|
-
* + Sorted by `id` in ascending order.
|
|
1247
|
-
* + `cursorPaging.limit` set to `100`.
|
|
1248
|
-
*
|
|
1249
|
-
* ## Filters
|
|
1250
|
-
*
|
|
1251
|
-
* For a complete list of supported filters, refer to **Booking Policies API: Supported Filters**
|
|
1252
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policies/supported-filters)).
|
|
1253
|
-
*
|
|
1254
|
-
* When using date filters, you must use
|
|
1255
|
-
* [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
|
|
1256
|
-
*
|
|
1257
|
-
* ## Returned services
|
|
1258
|
-
*
|
|
1259
|
-
* If a booking policy is connected to more than 5 services, only a subset of
|
|
1260
|
-
* those services is returned. The `bookingPolicies.totalServiceCount` values
|
|
1261
|
-
* indicate the total number of services linked to each policy. You can call *Search Services*
|
|
1262
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/search-services) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/search-services))
|
|
1263
|
-
* and specify the relevant policy ID in the filter to retrieve all services
|
|
1264
|
-
* connected to the booking policy.
|
|
1265
|
-
*
|
|
1266
|
-
* ## See also
|
|
1267
|
-
*
|
|
1268
|
-
* To learn about working with *Query* endpoints, see
|
|
1269
|
-
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
|
|
1270
|
-
* and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
|
|
1271
|
-
* @param query - Information about filters, paging, and sorting. See the article about
|
|
1272
|
-
* booking policy filters
|
|
1273
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policies/supported-filters))
|
|
1274
|
-
* for all supported filters and sorting options.
|
|
1275
|
-
* @public
|
|
1276
|
-
* @documentationMaturity preview
|
|
1277
|
-
* @requiredField query
|
|
1278
|
-
* @permissionId BOOKINGS.BOOKING_POLICY_READ
|
|
1279
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
1280
|
-
* @permissionScope Manage Stores
|
|
1281
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1282
|
-
* @permissionScope Read Bookings - Public Data
|
|
1283
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1284
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1285
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1286
|
-
* @permissionScope Manage Bookings
|
|
1287
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1288
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1289
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1290
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1291
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1292
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1293
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1294
|
-
* @permissionScope Manage Stores
|
|
1295
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1296
|
-
* @permissionScope Read Bookings - Public Data
|
|
1297
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1298
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1299
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1300
|
-
* @permissionScope Manage Bookings
|
|
1301
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1302
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1303
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1304
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1305
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1306
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1307
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1308
|
-
* @applicableIdentity APP
|
|
1309
|
-
* @applicableIdentity VISITOR
|
|
1310
|
-
* @fqn wix.bookings.services.v2.ServicesService.QueryPolicies
|
|
1311
|
-
*/
|
|
1312
|
-
export async function queryPolicies(query) {
|
|
1313
|
-
// @ts-ignore
|
|
1314
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1315
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ query: query });
|
|
1316
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.queryPolicies(payload);
|
|
1317
|
-
sideEffects?.onSiteCall?.();
|
|
1318
|
-
try {
|
|
1319
|
-
const result = await httpClient.request(reqOpts);
|
|
1320
|
-
sideEffects?.onSuccess?.(result);
|
|
1321
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1322
|
-
{
|
|
1323
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1324
|
-
paths: [
|
|
1325
|
-
{ path: 'bookingPolicies.services.media.items.image' },
|
|
1326
|
-
{ path: 'bookingPolicies.services.media.mainMedia.image' },
|
|
1327
|
-
{ path: 'bookingPolicies.services.media.coverMedia.image' },
|
|
1328
|
-
{ path: 'bookingPolicies.services.staffMembers.mainMedia.image' },
|
|
1329
|
-
{
|
|
1330
|
-
path: 'bookingPolicies.services.staffMemberDetails.staffMembers.mainMedia.image',
|
|
1331
|
-
},
|
|
1332
|
-
{ path: 'bookingPolicies.connectedServices.media.items.image' },
|
|
1333
|
-
{ path: 'bookingPolicies.connectedServices.media.mainMedia.image' },
|
|
1334
|
-
{
|
|
1335
|
-
path: 'bookingPolicies.connectedServices.media.coverMedia.image',
|
|
1336
|
-
},
|
|
1337
|
-
{
|
|
1338
|
-
path: 'bookingPolicies.connectedServices.staffMembers.mainMedia.image',
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
path: 'bookingPolicies.connectedServices.staffMemberDetails.staffMembers.mainMedia.image',
|
|
1342
|
-
},
|
|
1343
|
-
],
|
|
1344
|
-
},
|
|
1345
|
-
{
|
|
1346
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1347
|
-
paths: [
|
|
1348
|
-
{ path: 'bookingPolicies.services.locations.calculatedAddress' },
|
|
1349
|
-
{ path: 'bookingPolicies.services.locations.business.address' },
|
|
1350
|
-
{ path: 'bookingPolicies.services.locations.custom.address' },
|
|
1351
|
-
{
|
|
1352
|
-
path: 'bookingPolicies.connectedServices.locations.calculatedAddress',
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
path: 'bookingPolicies.connectedServices.locations.business.address',
|
|
1356
|
-
},
|
|
1357
|
-
{
|
|
1358
|
-
path: 'bookingPolicies.connectedServices.locations.custom.address',
|
|
1359
|
-
},
|
|
1360
|
-
],
|
|
1361
|
-
},
|
|
1362
|
-
{
|
|
1363
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1364
|
-
paths: [
|
|
1365
|
-
{ path: 'bookingPolicies.services.urls.servicePage' },
|
|
1366
|
-
{ path: 'bookingPolicies.services.urls.bookingPage' },
|
|
1367
|
-
{ path: 'bookingPolicies.services.urls.calendarPage' },
|
|
1368
|
-
{ path: 'bookingPolicies.connectedServices.urls.servicePage' },
|
|
1369
|
-
{ path: 'bookingPolicies.connectedServices.urls.bookingPage' },
|
|
1370
|
-
{ path: 'bookingPolicies.connectedServices.urls.calendarPage' },
|
|
1371
|
-
],
|
|
1372
|
-
},
|
|
1373
|
-
]));
|
|
1374
|
-
}
|
|
1375
|
-
catch (err) {
|
|
1376
|
-
const transformedError = sdkTransformError(err, {
|
|
1377
|
-
spreadPathsToArguments: {},
|
|
1378
|
-
explicitPathsToArguments: { query: '$[0]' },
|
|
1379
|
-
singleArgumentUnchanged: false,
|
|
1380
|
-
}, ['query']);
|
|
1381
|
-
sideEffects?.onError?.(err);
|
|
1382
|
-
throw transformedError;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
/**
|
|
1386
|
-
* Retrieves a list of up to 100 *booking forms*
|
|
1387
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/forms/introduction) | [REST](https://dev.wix.com/docs/rest/crm/forms/form-schemas/form-object)),
|
|
1388
|
-
* and information about the services that are connected to them,
|
|
1389
|
-
* given the provided filtering, paging, and sorting.
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
* ## Defaults
|
|
1393
|
-
*
|
|
1394
|
-
* Query Booking Forms has the following default settings, which you can override:
|
|
1395
|
-
*
|
|
1396
|
-
* + Sorted by `id` in ascending order.
|
|
1397
|
-
* + `cursorPaging.limit` set to `100`.
|
|
1398
|
-
*
|
|
1399
|
-
* ## Filters
|
|
1400
|
-
*
|
|
1401
|
-
* For a complete list of supported filters, refer to **Forms API: Supported Filters**
|
|
1402
|
-
* ([REST](https://dev.wix.com/docs/rest/crm/forms/form-schemas/form-object)).
|
|
1403
|
-
*
|
|
1404
|
-
* When using date filters, you must use
|
|
1405
|
-
* [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
|
|
1406
|
-
*
|
|
1407
|
-
* ## Returned services
|
|
1408
|
-
*
|
|
1409
|
-
* If a booking policy is connected to more than 5 services, only a subset of
|
|
1410
|
-
* these service IDs and names is returned. The `bookingForms.totalServiceCount`
|
|
1411
|
-
* values indicate the total number of services linked to each form. You can call *Query Services*
|
|
1412
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/query-services) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/query-services))
|
|
1413
|
-
* and specify the relevant form ID in the filter to retrieve all services
|
|
1414
|
-
* connected to the booking form.
|
|
1415
|
-
*
|
|
1416
|
-
* ## Default booking forms
|
|
1417
|
-
*
|
|
1418
|
-
* By default, all Wix Bookings services use a standard booking form. To retrieve
|
|
1419
|
-
* a site's default booking form with Query Booking Forms, specify
|
|
1420
|
-
* `{"conditionalFields": ["DEFAULT_BOOKING_FORM"]}`.
|
|
1421
|
-
*
|
|
1422
|
-
* ## See also
|
|
1423
|
-
*
|
|
1424
|
-
* To learn about working with *Query* endpoints, see
|
|
1425
|
-
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
|
|
1426
|
-
* and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
|
|
1427
|
-
* @param query - Information about filters, paging, and sorting. See the article about
|
|
1428
|
-
* form filters ([REST](https://dev.wix.com/docs/rest/crm/forms/form-schemas/form-object))
|
|
1429
|
-
* for all supported filters and sorting options.
|
|
1430
|
-
* @public
|
|
1431
|
-
* @requiredField query
|
|
1432
|
-
* @permissionId BOOKINGS.SERVICE_BOOKING_FORMS_READ
|
|
1433
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
1434
|
-
* @permissionScope Manage Bookings
|
|
1435
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1436
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1437
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1438
|
-
* @permissionScope Manage Stores
|
|
1439
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1440
|
-
* @permissionScope Read Bookings - Public Data
|
|
1441
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1442
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1443
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1444
|
-
* @permissionScope Manage Bookings
|
|
1445
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1446
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1447
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1448
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1449
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1450
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1451
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1452
|
-
* @applicableIdentity APP
|
|
1453
|
-
* @applicableIdentity VISITOR
|
|
1454
|
-
* @fqn wix.bookings.services.v2.ServicesService.QueryBookingForms
|
|
1455
|
-
*/
|
|
1456
|
-
export async function queryBookingForms(query, options) {
|
|
1457
|
-
// @ts-ignore
|
|
1458
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1459
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1460
|
-
query: query,
|
|
1461
|
-
conditionalFields: options?.conditionalFields,
|
|
1462
|
-
});
|
|
1463
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.queryBookingForms(payload);
|
|
1464
|
-
sideEffects?.onSiteCall?.();
|
|
1465
|
-
try {
|
|
1466
|
-
const result = await httpClient.request(reqOpts);
|
|
1467
|
-
sideEffects?.onSuccess?.(result);
|
|
1468
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1469
|
-
}
|
|
1470
|
-
catch (err) {
|
|
1471
|
-
const transformedError = sdkTransformError(err, {
|
|
1472
|
-
spreadPathsToArguments: {},
|
|
1473
|
-
explicitPathsToArguments: {
|
|
1474
|
-
query: '$[0]',
|
|
1475
|
-
conditionalFields: '$[1].conditionalFields',
|
|
1476
|
-
},
|
|
1477
|
-
singleArgumentUnchanged: false,
|
|
1478
|
-
}, ['query', 'options']);
|
|
1479
|
-
sideEffects?.onError?.(err);
|
|
1480
|
-
throw transformedError;
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
/**
|
|
1484
|
-
* Counts how many services match the given filter.
|
|
1485
|
-
*
|
|
1486
|
-
*
|
|
1487
|
-
* Refer to the supported filters article
|
|
1488
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering))
|
|
1489
|
-
* for more details.
|
|
1490
|
-
*
|
|
1491
|
-
* To learn about working with filters in general, see
|
|
1492
|
-
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters)
|
|
1493
|
-
* @public
|
|
1494
|
-
* @permissionId BOOKINGS.SERVICES_COUNT
|
|
1495
|
-
* @permissionScope Manage Stores
|
|
1496
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1497
|
-
* @permissionScope Read Bookings - Public Data
|
|
1498
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1499
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1500
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1501
|
-
* @permissionScope Manage Bookings
|
|
1502
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1503
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1504
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1505
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1506
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1507
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1508
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1509
|
-
* @applicableIdentity APP
|
|
1510
|
-
* @applicableIdentity VISITOR
|
|
1511
|
-
* @fqn wix.bookings.services.v2.ServicesService.CountServices
|
|
1512
|
-
*/
|
|
1513
|
-
export async function countServices(options) {
|
|
1514
|
-
// @ts-ignore
|
|
1515
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1516
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1517
|
-
filter: options?.filter,
|
|
1518
|
-
});
|
|
1519
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.countServices(payload);
|
|
1520
|
-
sideEffects?.onSiteCall?.();
|
|
1521
|
-
try {
|
|
1522
|
-
const result = await httpClient.request(reqOpts);
|
|
1523
|
-
sideEffects?.onSuccess?.(result);
|
|
1524
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1525
|
-
}
|
|
1526
|
-
catch (err) {
|
|
1527
|
-
const transformedError = sdkTransformError(err, {
|
|
1528
|
-
spreadPathsToArguments: {},
|
|
1529
|
-
explicitPathsToArguments: { filter: '$[0].filter' },
|
|
1530
|
-
singleArgumentUnchanged: false,
|
|
1531
|
-
}, ['options']);
|
|
1532
|
-
sideEffects?.onError?.(err);
|
|
1533
|
-
throw transformedError;
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
/**
|
|
1537
|
-
* Retrieves 3 separate lists of business, custom, and customer *locations*
|
|
1538
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction)),
|
|
1539
|
-
* given the provided filtering, and whether each location is connected to at
|
|
1540
|
-
* least one of the site's services.
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
* ## Defaults
|
|
1544
|
-
*
|
|
1545
|
-
* Query Locations has the following default setting, which you can't override:
|
|
1546
|
-
* Sorted by `id` in ascending order.
|
|
1547
|
-
*
|
|
1548
|
-
* ## Filters
|
|
1549
|
-
*
|
|
1550
|
-
* For a complete list of supported filters, refer to the `location` object
|
|
1551
|
-
* ([REST](https://dev.wix.com/docs/rest/business-management/locations/location-object)).
|
|
1552
|
-
*
|
|
1553
|
-
* When using date filters, you must use
|
|
1554
|
-
* [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
|
|
1555
|
-
*
|
|
1556
|
-
* ## See also
|
|
1557
|
-
*
|
|
1558
|
-
* To learn about working with *Query* endpoints, see
|
|
1559
|
-
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
|
|
1560
|
-
* and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
|
|
1561
|
-
* @public
|
|
1562
|
-
* @documentationMaturity preview
|
|
1563
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
1564
|
-
* @permissionScope Manage Stores
|
|
1565
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1566
|
-
* @permissionScope Read Bookings - Public Data
|
|
1567
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1568
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1569
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1570
|
-
* @permissionScope Manage Bookings
|
|
1571
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1572
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1573
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1574
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1575
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1576
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1577
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1578
|
-
* @applicableIdentity APP
|
|
1579
|
-
* @applicableIdentity VISITOR
|
|
1580
|
-
* @fqn wix.bookings.services.v2.ServicesService.QueryLocations
|
|
1581
|
-
*/
|
|
1582
|
-
export async function queryLocations(options) {
|
|
1583
|
-
// @ts-ignore
|
|
1584
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1585
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1586
|
-
filter: options?.filter,
|
|
1587
|
-
});
|
|
1588
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.queryLocations(payload);
|
|
1589
|
-
sideEffects?.onSiteCall?.();
|
|
1590
|
-
try {
|
|
1591
|
-
const result = await httpClient.request(reqOpts);
|
|
1592
|
-
sideEffects?.onSuccess?.(result);
|
|
1593
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1594
|
-
{
|
|
1595
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1596
|
-
paths: [
|
|
1597
|
-
{ path: 'businessLocations.locations.calculatedAddress' },
|
|
1598
|
-
{ path: 'businessLocations.locations.business.address' },
|
|
1599
|
-
{ path: 'businessLocations.locations.custom.address' },
|
|
1600
|
-
],
|
|
1601
|
-
},
|
|
1602
|
-
]));
|
|
1603
|
-
}
|
|
1604
|
-
catch (err) {
|
|
1605
|
-
const transformedError = sdkTransformError(err, {
|
|
1606
|
-
spreadPathsToArguments: {},
|
|
1607
|
-
explicitPathsToArguments: { filter: '$[0].filter' },
|
|
1608
|
-
singleArgumentUnchanged: false,
|
|
1609
|
-
}, ['options']);
|
|
1610
|
-
sideEffects?.onError?.(err);
|
|
1611
|
-
throw transformedError;
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
/**
|
|
1615
|
-
* Retrieves a list of service *categories*
|
|
1616
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/categories/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/categories-v2/introduction)),
|
|
1617
|
-
* given the provided filtering.
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1620
|
-
* ## Defaults
|
|
1621
|
-
*
|
|
1622
|
-
* Query Categories has the following default setting, which you can't override:
|
|
1623
|
-
* Sorted by `id` in ascending order.
|
|
1624
|
-
*
|
|
1625
|
-
* ## Filters
|
|
1626
|
-
*
|
|
1627
|
-
* For a complete list of supported filters, refer to the supported filters article
|
|
1628
|
-
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering)).
|
|
1629
|
-
*
|
|
1630
|
-
* When using date filters, you must use
|
|
1631
|
-
* [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
|
|
1632
|
-
*
|
|
1633
|
-
* ## See also
|
|
1634
|
-
*
|
|
1635
|
-
* To learn about working with *Query* endpoints, see
|
|
1636
|
-
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
|
|
1637
|
-
* and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
|
|
1638
|
-
* @public
|
|
1639
|
-
* @documentationMaturity preview
|
|
1640
|
-
* @permissionId BOOKINGS.SERVICES_READ
|
|
1641
|
-
* @permissionScope Manage Stores
|
|
1642
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1643
|
-
* @permissionScope Read Bookings - Public Data
|
|
1644
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1645
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
1646
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1647
|
-
* @permissionScope Manage Bookings
|
|
1648
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1649
|
-
* @permissionScope Read Bookings - Including Participants
|
|
1650
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1651
|
-
* @permissionScope Read Bookings - all read permissions
|
|
1652
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1653
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1654
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1655
|
-
* @applicableIdentity APP
|
|
1656
|
-
* @applicableIdentity VISITOR
|
|
1657
|
-
* @fqn wix.bookings.services.v2.ServicesService.QueryCategories
|
|
1658
|
-
*/
|
|
1659
|
-
export async function queryCategories(options) {
|
|
1660
|
-
// @ts-ignore
|
|
1661
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1662
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1663
|
-
filter: options?.filter,
|
|
1664
|
-
});
|
|
1665
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.queryCategories(payload);
|
|
1666
|
-
sideEffects?.onSiteCall?.();
|
|
1667
|
-
try {
|
|
1668
|
-
const result = await httpClient.request(reqOpts);
|
|
1669
|
-
sideEffects?.onSuccess?.(result);
|
|
1670
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1671
|
-
}
|
|
1672
|
-
catch (err) {
|
|
1673
|
-
const transformedError = sdkTransformError(err, {
|
|
1674
|
-
spreadPathsToArguments: {},
|
|
1675
|
-
explicitPathsToArguments: { filter: '$[0].filter' },
|
|
1676
|
-
singleArgumentUnchanged: false,
|
|
1677
|
-
}, ['options']);
|
|
1678
|
-
sideEffects?.onError?.(err);
|
|
1679
|
-
throw transformedError;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* Replaces the list of the *locations*
|
|
1684
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction))
|
|
1685
|
-
* where the business offers the service.
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
1688
|
-
* ## Consequences for customers
|
|
1689
|
-
*
|
|
1690
|
-
* Removing a service location may impact existing sessions and their
|
|
1691
|
-
* participants. If you remove at least one service location, you must
|
|
1692
|
-
* specify `removedLocationSessionsAction` to indicate what happens to all
|
|
1693
|
-
* future sessions scheduled at this location.
|
|
1694
|
-
*
|
|
1695
|
-
* - **Keep existing location**: If you want to retain future sessions at their
|
|
1696
|
-
* originally scheduled location, specify
|
|
1697
|
-
* `{"removedLocationSessionsAction.action": "KEEP_AT_CURRENT_LOCATION"}`.
|
|
1698
|
-
* This ensures nothing changes for the customer, but the business must be
|
|
1699
|
-
* able to provide access to the removed location in the future.
|
|
1700
|
-
* - **Update location**: If you want to update the location for future sessions
|
|
1701
|
-
* scheduled at the removed location, specify
|
|
1702
|
-
* `{"removedLocationSessionsAction.action": "MOVE_TO_LOCATION"}` and
|
|
1703
|
-
* `moveToLocationOptions.newLocation`.
|
|
1704
|
-
*
|
|
1705
|
-
* You can't mix and match to keep some sessions at the previous location while
|
|
1706
|
-
* moving other sessions to an updated location.
|
|
1707
|
-
*
|
|
1708
|
-
* Past session details aren't changed, no matter which option you choose for
|
|
1709
|
-
* future sessions.
|
|
1710
|
-
*
|
|
1711
|
-
* Future sessions scheduled for a location defined by the customer are also not
|
|
1712
|
-
* updated.
|
|
1713
|
-
*
|
|
1714
|
-
* ## Specify location details
|
|
1715
|
-
*
|
|
1716
|
-
* Depending on whether the new or updated location is a business or custom location,
|
|
1717
|
-
* you need to specify different fields.
|
|
1718
|
-
*
|
|
1719
|
-
* - **Business location**: Specify the relevant *location ID*
|
|
1720
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction))
|
|
1721
|
-
* in `locations.business.id`.
|
|
1722
|
-
* - **Custom location**: Specify the complete address object as
|
|
1723
|
-
* `locations.custom.address`.
|
|
1724
|
-
*
|
|
1725
|
-
* ## Participant notifications
|
|
1726
|
-
*
|
|
1727
|
-
* You can specify a `participantNotification.message` that's immediately send
|
|
1728
|
-
* to all customers who had booked at a changed location. Ensure
|
|
1729
|
-
* `participantNotification.notifyParticipants` is set to `true` to send the
|
|
1730
|
-
* message.
|
|
1731
|
-
* @param serviceId - ID of the service.
|
|
1732
|
-
* @param locations - List of locations replacing existing service locations. Omitting an existing location removes it from the service. Specify `removedLocationSessionsAction` to determine the handling of future sessions scheduled at that location.
|
|
1733
|
-
* @public
|
|
1734
|
-
* @documentationMaturity preview
|
|
1735
|
-
* @requiredField locations
|
|
1736
|
-
* @requiredField serviceId
|
|
1737
|
-
* @permissionId BOOKINGS.SERVICES_LOCATIONS_SET
|
|
1738
|
-
* @permissionScope Manage Bookings
|
|
1739
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1740
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1741
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1742
|
-
* @applicableIdentity APP
|
|
1743
|
-
* @fqn wix.bookings.services.v2.ServicesService.SetServiceLocations
|
|
1744
|
-
*/
|
|
1745
|
-
export async function setServiceLocations(serviceId, locations, options) {
|
|
1746
|
-
// @ts-ignore
|
|
1747
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
1748
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1749
|
-
serviceId: serviceId,
|
|
1750
|
-
locations: locations,
|
|
1751
|
-
removedLocationSessionsAction: options?.removedLocationSessionsAction,
|
|
1752
|
-
participantNotification: options?.participantNotification,
|
|
1753
|
-
}), [
|
|
1754
|
-
{
|
|
1755
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
1756
|
-
paths: [
|
|
1757
|
-
{ path: 'locations.calculatedAddress' },
|
|
1758
|
-
{ path: 'locations.business.address' },
|
|
1759
|
-
{ path: 'locations.custom.address' },
|
|
1760
|
-
{
|
|
1761
|
-
path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.calculatedAddress',
|
|
1762
|
-
},
|
|
1763
|
-
{
|
|
1764
|
-
path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.business.address',
|
|
1765
|
-
},
|
|
1766
|
-
{
|
|
1767
|
-
path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.custom.address',
|
|
1768
|
-
},
|
|
1769
|
-
],
|
|
1770
|
-
},
|
|
1771
|
-
]);
|
|
1772
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.setServiceLocations(payload);
|
|
1773
|
-
sideEffects?.onSiteCall?.();
|
|
1774
|
-
try {
|
|
1775
|
-
const result = await httpClient.request(reqOpts);
|
|
1776
|
-
sideEffects?.onSuccess?.(result);
|
|
1777
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1778
|
-
{
|
|
1779
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1780
|
-
paths: [
|
|
1781
|
-
{ path: 'service.media.items.image' },
|
|
1782
|
-
{ path: 'service.media.mainMedia.image' },
|
|
1783
|
-
{ path: 'service.media.coverMedia.image' },
|
|
1784
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
1785
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
1786
|
-
],
|
|
1787
|
-
},
|
|
1788
|
-
{
|
|
1789
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1790
|
-
paths: [
|
|
1791
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
1792
|
-
{ path: 'service.locations.business.address' },
|
|
1793
|
-
{ path: 'service.locations.custom.address' },
|
|
1794
|
-
],
|
|
1795
|
-
},
|
|
1796
|
-
{
|
|
1797
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1798
|
-
paths: [
|
|
1799
|
-
{ path: 'service.urls.servicePage' },
|
|
1800
|
-
{ path: 'service.urls.bookingPage' },
|
|
1801
|
-
{ path: 'service.urls.calendarPage' },
|
|
1802
|
-
],
|
|
1803
|
-
},
|
|
1804
|
-
]));
|
|
1805
|
-
}
|
|
1806
|
-
catch (err) {
|
|
1807
|
-
const transformedError = sdkTransformError(err, {
|
|
1808
|
-
spreadPathsToArguments: {},
|
|
1809
|
-
explicitPathsToArguments: {
|
|
1810
|
-
serviceId: '$[0]',
|
|
1811
|
-
locations: '$[1]',
|
|
1812
|
-
removedLocationSessionsAction: '$[2].removedLocationSessionsAction',
|
|
1813
|
-
participantNotification: '$[2].participantNotification',
|
|
1814
|
-
},
|
|
1815
|
-
singleArgumentUnchanged: false,
|
|
1816
|
-
}, ['serviceId', 'locations', 'options']);
|
|
1817
|
-
sideEffects?.onError?.(err);
|
|
1818
|
-
throw transformedError;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
/**
|
|
1822
|
-
* Adds a list of *pricing plan IDs*
|
|
1823
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans/plan-object))
|
|
1824
|
-
* to a service's `payment.pricingPlanIds` array.
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
1827
|
-
* The call doesn't validate whether the service's `payment.options.pricingPlan`
|
|
1828
|
-
* is set to `true`. If it's set to `false`, customers aren't able to pay
|
|
1829
|
-
* for their bookings using pricing plans. You can call *Update Service*
|
|
1830
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/update-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/update-service))
|
|
1831
|
-
* to change a service's supported payment methods.
|
|
1832
|
-
* @param serviceId - ID of the service to update.
|
|
1833
|
-
* @param pricingPlanIds - IDs of the *pricing plans*
|
|
1834
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans/plan-object))
|
|
1835
|
-
* to add to the service's `payment.pricingPlanIds` array.
|
|
1836
|
-
* @public
|
|
1837
|
-
* @requiredField pricingPlanIds
|
|
1838
|
-
* @requiredField serviceId
|
|
1839
|
-
* @permissionId BOOKINGS.SERVICES_PRICING_PLANS_ADD
|
|
1840
|
-
* @permissionScope Manage Bookings
|
|
1841
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1842
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1843
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1844
|
-
* @applicableIdentity APP
|
|
1845
|
-
* @fqn wix.bookings.services.v2.ServicesService.EnablePricingPlansForService
|
|
1846
|
-
*/
|
|
1847
|
-
export async function enablePricingPlansForService(serviceId, pricingPlanIds) {
|
|
1848
|
-
// @ts-ignore
|
|
1849
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1850
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1851
|
-
serviceId: serviceId,
|
|
1852
|
-
pricingPlanIds: pricingPlanIds,
|
|
1853
|
-
});
|
|
1854
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.enablePricingPlansForService(payload);
|
|
1855
|
-
sideEffects?.onSiteCall?.();
|
|
1856
|
-
try {
|
|
1857
|
-
const result = await httpClient.request(reqOpts);
|
|
1858
|
-
sideEffects?.onSuccess?.(result);
|
|
1859
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1860
|
-
{
|
|
1861
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1862
|
-
paths: [
|
|
1863
|
-
{ path: 'service.media.items.image' },
|
|
1864
|
-
{ path: 'service.media.mainMedia.image' },
|
|
1865
|
-
{ path: 'service.media.coverMedia.image' },
|
|
1866
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
1867
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
1868
|
-
],
|
|
1869
|
-
},
|
|
1870
|
-
{
|
|
1871
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1872
|
-
paths: [
|
|
1873
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
1874
|
-
{ path: 'service.locations.business.address' },
|
|
1875
|
-
{ path: 'service.locations.custom.address' },
|
|
1876
|
-
],
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1880
|
-
paths: [
|
|
1881
|
-
{ path: 'service.urls.servicePage' },
|
|
1882
|
-
{ path: 'service.urls.bookingPage' },
|
|
1883
|
-
{ path: 'service.urls.calendarPage' },
|
|
1884
|
-
],
|
|
1885
|
-
},
|
|
1886
|
-
]));
|
|
1887
|
-
}
|
|
1888
|
-
catch (err) {
|
|
1889
|
-
const transformedError = sdkTransformError(err, {
|
|
1890
|
-
spreadPathsToArguments: {},
|
|
1891
|
-
explicitPathsToArguments: { serviceId: '$[0]', pricingPlanIds: '$[1]' },
|
|
1892
|
-
singleArgumentUnchanged: false,
|
|
1893
|
-
}, ['serviceId', 'pricingPlanIds']);
|
|
1894
|
-
sideEffects?.onError?.(err);
|
|
1895
|
-
throw transformedError;
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
/**
|
|
1899
|
-
* Removes a list of *pricing plan IDs*
|
|
1900
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans/plan-object))
|
|
1901
|
-
* from a service's `payment.pricingPlanIds` array.
|
|
1902
|
-
*
|
|
1903
|
-
*
|
|
1904
|
-
* If you remove all pricing plan IDs from `payment.pricingPlanIds` and the
|
|
1905
|
-
* service supports only payments by pricing plan, customers will no longer be
|
|
1906
|
-
* able to book the service, as they will have no payment options available.
|
|
1907
|
-
* @param serviceId - ID of the service to update.
|
|
1908
|
-
* @public
|
|
1909
|
-
* @requiredField serviceId
|
|
1910
|
-
* @permissionId BOOKINGS.SERVICES_PRICING_PLANS_REMOVE
|
|
1911
|
-
* @permissionScope Manage Bookings
|
|
1912
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1913
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1914
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1915
|
-
* @applicableIdentity APP
|
|
1916
|
-
* @fqn wix.bookings.services.v2.ServicesService.DisablePricingPlansForService
|
|
1917
|
-
*/
|
|
1918
|
-
export async function disablePricingPlansForService(serviceId, options) {
|
|
1919
|
-
// @ts-ignore
|
|
1920
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1921
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1922
|
-
serviceId: serviceId,
|
|
1923
|
-
pricingPlanIds: options?.pricingPlanIds,
|
|
1924
|
-
});
|
|
1925
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.disablePricingPlansForService(payload);
|
|
1926
|
-
sideEffects?.onSiteCall?.();
|
|
1927
|
-
try {
|
|
1928
|
-
const result = await httpClient.request(reqOpts);
|
|
1929
|
-
sideEffects?.onSuccess?.(result);
|
|
1930
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1931
|
-
{
|
|
1932
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1933
|
-
paths: [
|
|
1934
|
-
{ path: 'service.media.items.image' },
|
|
1935
|
-
{ path: 'service.media.mainMedia.image' },
|
|
1936
|
-
{ path: 'service.media.coverMedia.image' },
|
|
1937
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
1938
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
1939
|
-
],
|
|
1940
|
-
},
|
|
1941
|
-
{
|
|
1942
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1943
|
-
paths: [
|
|
1944
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
1945
|
-
{ path: 'service.locations.business.address' },
|
|
1946
|
-
{ path: 'service.locations.custom.address' },
|
|
1947
|
-
],
|
|
1948
|
-
},
|
|
1949
|
-
{
|
|
1950
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1951
|
-
paths: [
|
|
1952
|
-
{ path: 'service.urls.servicePage' },
|
|
1953
|
-
{ path: 'service.urls.bookingPage' },
|
|
1954
|
-
{ path: 'service.urls.calendarPage' },
|
|
1955
|
-
],
|
|
1956
|
-
},
|
|
1957
|
-
]));
|
|
1958
|
-
}
|
|
1959
|
-
catch (err) {
|
|
1960
|
-
const transformedError = sdkTransformError(err, {
|
|
1961
|
-
spreadPathsToArguments: {},
|
|
1962
|
-
explicitPathsToArguments: {
|
|
1963
|
-
serviceId: '$[0]',
|
|
1964
|
-
pricingPlanIds: '$[1].pricingPlanIds',
|
|
1965
|
-
},
|
|
1966
|
-
singleArgumentUnchanged: false,
|
|
1967
|
-
}, ['serviceId', 'options']);
|
|
1968
|
-
sideEffects?.onError?.(err);
|
|
1969
|
-
throw transformedError;
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
/**
|
|
1973
|
-
* Sets a new active slug for the service.
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
* The call fails if at least one of these conditions is met:
|
|
1977
|
-
* - The slug doesn't adheres to the supported format.
|
|
1978
|
-
* - Another service is currently using the slug.
|
|
1979
|
-
* - Another service has used the slug in the past.
|
|
1980
|
-
* @param serviceId - ID of the service for which to update the active slug.
|
|
1981
|
-
* @public
|
|
1982
|
-
* @requiredField serviceId
|
|
1983
|
-
* @permissionId BOOKINGS.SERVICES_CUSTOM_SLUGS_SET
|
|
1984
|
-
* @permissionScope Manage Bookings
|
|
1985
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1986
|
-
* @permissionScope Manage Bookings - all permissions
|
|
1987
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1988
|
-
* @applicableIdentity APP
|
|
1989
|
-
* @fqn wix.bookings.services.v2.ServicesService.SetCustomSlug
|
|
1990
|
-
*/
|
|
1991
|
-
export async function setCustomSlug(serviceId, options) {
|
|
1992
|
-
// @ts-ignore
|
|
1993
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1994
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1995
|
-
serviceId: serviceId,
|
|
1996
|
-
slug: options?.slug,
|
|
1997
|
-
});
|
|
1998
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.setCustomSlug(payload);
|
|
1999
|
-
sideEffects?.onSiteCall?.();
|
|
2000
|
-
try {
|
|
2001
|
-
const result = await httpClient.request(reqOpts);
|
|
2002
|
-
sideEffects?.onSuccess?.(result);
|
|
2003
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
2004
|
-
{
|
|
2005
|
-
transformFn: transformRESTImageToSDKImage,
|
|
2006
|
-
paths: [
|
|
2007
|
-
{ path: 'service.media.items.image' },
|
|
2008
|
-
{ path: 'service.media.mainMedia.image' },
|
|
2009
|
-
{ path: 'service.media.coverMedia.image' },
|
|
2010
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
2011
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
2012
|
-
],
|
|
2013
|
-
},
|
|
2014
|
-
{
|
|
2015
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
2016
|
-
paths: [
|
|
2017
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
2018
|
-
{ path: 'service.locations.business.address' },
|
|
2019
|
-
{ path: 'service.locations.custom.address' },
|
|
2020
|
-
],
|
|
2021
|
-
},
|
|
2022
|
-
{
|
|
2023
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
2024
|
-
paths: [
|
|
2025
|
-
{ path: 'service.urls.servicePage' },
|
|
2026
|
-
{ path: 'service.urls.bookingPage' },
|
|
2027
|
-
{ path: 'service.urls.calendarPage' },
|
|
2028
|
-
],
|
|
2029
|
-
},
|
|
2030
|
-
]));
|
|
2031
|
-
}
|
|
2032
|
-
catch (err) {
|
|
2033
|
-
const transformedError = sdkTransformError(err, {
|
|
2034
|
-
spreadPathsToArguments: {},
|
|
2035
|
-
explicitPathsToArguments: { serviceId: '$[0]', slug: '$[1].slug' },
|
|
2036
|
-
singleArgumentUnchanged: false,
|
|
2037
|
-
}, ['serviceId', 'options']);
|
|
2038
|
-
sideEffects?.onError?.(err);
|
|
2039
|
-
throw transformedError;
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
/**
|
|
2043
|
-
* Checks whether a custom slug is validate for the service.
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
* The checks include:
|
|
2047
|
-
* - The slug adheres to the supported format.
|
|
2048
|
-
* - No other service is currently using the slug.
|
|
2049
|
-
* - No other service has used the slug in the past.
|
|
2050
|
-
*
|
|
2051
|
-
* The call fails if at least one of the checks fails.
|
|
2052
|
-
* @param serviceId - IO of the service to check custom slug validity for.
|
|
2053
|
-
* @public
|
|
2054
|
-
* @requiredField serviceId
|
|
2055
|
-
* @permissionId BOOKINGS.SERVICES_CUSTOM_SLUGS_SET
|
|
2056
|
-
* @permissionScope Manage Bookings
|
|
2057
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
2058
|
-
* @permissionScope Manage Bookings - all permissions
|
|
2059
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
2060
|
-
* @applicableIdentity APP
|
|
2061
|
-
* @fqn wix.bookings.services.v2.ServicesService.ValidateSlug
|
|
2062
|
-
*/
|
|
2063
|
-
export async function validateSlug(serviceId, options) {
|
|
2064
|
-
// @ts-ignore
|
|
2065
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
2066
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2067
|
-
serviceId: serviceId,
|
|
2068
|
-
slug: options?.slug,
|
|
2069
|
-
});
|
|
2070
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.validateSlug(payload);
|
|
2071
|
-
sideEffects?.onSiteCall?.();
|
|
2072
|
-
try {
|
|
2073
|
-
const result = await httpClient.request(reqOpts);
|
|
2074
|
-
sideEffects?.onSuccess?.(result);
|
|
2075
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
2076
|
-
}
|
|
2077
|
-
catch (err) {
|
|
2078
|
-
const transformedError = sdkTransformError(err, {
|
|
2079
|
-
spreadPathsToArguments: {},
|
|
2080
|
-
explicitPathsToArguments: { serviceId: '$[0]', slug: '$[1].slug' },
|
|
2081
|
-
singleArgumentUnchanged: false,
|
|
2082
|
-
}, ['serviceId', 'options']);
|
|
2083
|
-
sideEffects?.onError?.(err);
|
|
2084
|
-
throw transformedError;
|
|
2085
|
-
}
|
|
2086
|
-
}
|
|
2087
|
-
/**
|
|
2088
|
-
* Clones a service.
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2091
|
-
* ## Connected entities
|
|
2092
|
-
*
|
|
2093
|
-
* By default, not all entities connected to the service are cloned.
|
|
2094
|
-
*
|
|
2095
|
-
* ### Schedule
|
|
2096
|
-
*
|
|
2097
|
-
* Wix Bookings automatically creates a new active *schedule*
|
|
2098
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/schedules/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction))
|
|
2099
|
-
* for the cloned service. If Wix Bookings can't create this schedule, the
|
|
2100
|
-
* Clone Service* call fails.
|
|
2101
|
-
*
|
|
2102
|
-
* - __For appointment-based services__: Future appointments aren't added to the
|
|
2103
|
-
* cloned service's schedule. Use the *Events API*
|
|
2104
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
|
|
2105
|
-
* to add them as needed.
|
|
2106
|
-
* - __For classes and courses__: Future one-time events aren't added to the
|
|
2107
|
-
* cloned service's schedule, while future recurring events are added
|
|
2108
|
-
* asynchronously. The *Clone Service* call always succeeds, whether or not
|
|
2109
|
-
* recurring events are added.
|
|
2110
|
-
* If the response includes `RECURRING_EVENTS` in the `errors` array, it means the
|
|
2111
|
-
* cloned service doesn't have future recurring events, even though the original
|
|
2112
|
-
* service does. You can either delete the cloned service and try again or use
|
|
2113
|
-
* the *Events API*
|
|
2114
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
|
|
2115
|
-
* to add missing events to the schedule.
|
|
2116
|
-
*
|
|
2117
|
-
* Wix Bookings never adds past events to the cloned service's schedule.
|
|
2118
|
-
*
|
|
2119
|
-
* ### Service options and variants
|
|
2120
|
-
*
|
|
2121
|
-
* If the original service has *variants*
|
|
2122
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)),
|
|
2123
|
-
* they're cloned asynchronously. The *Clone Service* call always succeeds,
|
|
2124
|
-
* regardless of whether variants were cloned.
|
|
2125
|
-
*
|
|
2126
|
-
* If the response includes `OPTIONS_AND_VARIANTS` in the `errors` array, the cloned
|
|
2127
|
-
* service doesn't have variants, even though the original service does. You can
|
|
2128
|
-
* delete the cloned service and call *Clone Service* again, or use the
|
|
2129
|
-
* _Service Options And Variants API_
|
|
2130
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction))
|
|
2131
|
-
* to add variants.
|
|
2132
|
-
*
|
|
2133
|
-
* ### Booking form
|
|
2134
|
-
*
|
|
2135
|
-
* The original service's booking form isn't cloned, whether it's
|
|
2136
|
-
* the default or a custom booking form.
|
|
2137
|
-
*
|
|
2138
|
-
* ### Pricing plans
|
|
2139
|
-
*
|
|
2140
|
-
* If the original service's accepts payments via *pricing plans*
|
|
2141
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/pricing-plans/pricing-plans/plans/introduction)),
|
|
2142
|
-
* the cloned service's `payment.options.pricingPlan` is also set to `true`. To
|
|
2143
|
-
* accept specific pricing plans, call *Enable Pricing Plans For Service*
|
|
2144
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/enable-pricing-plans-for-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/enable-pricing-plans-for-service)),
|
|
2145
|
-
* after cloning the service. If the original service accepts only
|
|
2146
|
-
* pricing plan payments and you don't call *Enable Pricing Plans For Service*
|
|
2147
|
-
* after cloning the service, customers will be unable to book the service.
|
|
2148
|
-
* @param sourceServiceId - ID of the service to clone.
|
|
2149
|
-
* @public
|
|
2150
|
-
* @requiredField sourceServiceId
|
|
2151
|
-
* @permissionId BOOKINGS.SERVICES_CREATE
|
|
2152
|
-
* @permissionScope Manage Bookings
|
|
2153
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
2154
|
-
* @permissionScope Manage Bookings - all permissions
|
|
2155
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
2156
|
-
* @applicableIdentity APP
|
|
2157
|
-
* @fqn wix.bookings.services.v2.ServicesService.CloneService
|
|
2158
|
-
*/
|
|
2159
|
-
export async function cloneService(sourceServiceId) {
|
|
2160
|
-
// @ts-ignore
|
|
2161
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
2162
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2163
|
-
sourceServiceId: sourceServiceId,
|
|
2164
|
-
});
|
|
2165
|
-
const reqOpts = ambassadorWixBookingsServicesV2Service.cloneService(payload);
|
|
2166
|
-
sideEffects?.onSiteCall?.();
|
|
2167
|
-
try {
|
|
2168
|
-
const result = await httpClient.request(reqOpts);
|
|
2169
|
-
sideEffects?.onSuccess?.(result);
|
|
2170
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
2171
|
-
{
|
|
2172
|
-
transformFn: transformRESTImageToSDKImage,
|
|
2173
|
-
paths: [
|
|
2174
|
-
{ path: 'service.media.items.image' },
|
|
2175
|
-
{ path: 'service.media.mainMedia.image' },
|
|
2176
|
-
{ path: 'service.media.coverMedia.image' },
|
|
2177
|
-
{ path: 'service.staffMembers.mainMedia.image' },
|
|
2178
|
-
{ path: 'service.staffMemberDetails.staffMembers.mainMedia.image' },
|
|
2179
|
-
],
|
|
2180
|
-
},
|
|
2181
|
-
{
|
|
2182
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
2183
|
-
paths: [
|
|
2184
|
-
{ path: 'service.locations.calculatedAddress' },
|
|
2185
|
-
{ path: 'service.locations.business.address' },
|
|
2186
|
-
{ path: 'service.locations.custom.address' },
|
|
2187
|
-
],
|
|
2188
|
-
},
|
|
2189
|
-
{
|
|
2190
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
2191
|
-
paths: [
|
|
2192
|
-
{ path: 'service.urls.servicePage' },
|
|
2193
|
-
{ path: 'service.urls.bookingPage' },
|
|
2194
|
-
{ path: 'service.urls.calendarPage' },
|
|
2195
|
-
],
|
|
2196
|
-
},
|
|
2197
|
-
]));
|
|
2198
|
-
}
|
|
2199
|
-
catch (err) {
|
|
2200
|
-
const transformedError = sdkTransformError(err, {
|
|
2201
|
-
spreadPathsToArguments: {},
|
|
2202
|
-
explicitPathsToArguments: { sourceServiceId: '$[0]' },
|
|
2203
|
-
singleArgumentUnchanged: false,
|
|
2204
|
-
}, ['sourceServiceId']);
|
|
2205
|
-
sideEffects?.onError?.(err);
|
|
2206
|
-
throw transformedError;
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
//# sourceMappingURL=bookings-services-v2-service-services.universal.js.map
|