@wix/auto_sdk_bookings_services 1.0.34 → 1.0.35

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