@wix/auto_sdk_bookings_services 1.0.31 → 1.0.33

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