@wix/auto_sdk_bookings_services 1.0.53 → 1.0.55

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