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