@wix/pricing-plans 1.0.54 → 1.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/build/cjs/context.d.ts +2 -2
  2. package/build/cjs/context.js +2 -2
  3. package/build/cjs/context.js.map +1 -1
  4. package/build/cjs/index.d.ts +2 -2
  5. package/build/cjs/index.js +2 -2
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/meta.d.ts +2 -2
  8. package/build/cjs/meta.js +2 -2
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/context.d.ts +2 -2
  11. package/build/es/context.js +2 -2
  12. package/build/es/context.js.map +1 -1
  13. package/build/es/index.d.ts +2 -2
  14. package/build/es/index.js +2 -2
  15. package/build/es/index.js.map +1 -1
  16. package/build/es/meta.d.ts +2 -2
  17. package/build/es/meta.js +2 -2
  18. package/build/es/meta.js.map +1 -1
  19. package/package.json +12 -9
  20. package/build/cjs/index.typings.d.ts +0 -2
  21. package/build/cjs/index.typings.js +0 -29
  22. package/build/cjs/index.typings.js.map +0 -1
  23. package/build/cjs/src/pricing-plans-v2-order.context.d.ts +0 -15
  24. package/build/cjs/src/pricing-plans-v2-order.context.js +0 -148
  25. package/build/cjs/src/pricing-plans-v2-order.context.js.map +0 -1
  26. package/build/cjs/src/pricing-plans-v2-order.http.d.ts +0 -165
  27. package/build/cjs/src/pricing-plans-v2-order.http.js +0 -818
  28. package/build/cjs/src/pricing-plans-v2-order.http.js.map +0 -1
  29. package/build/cjs/src/pricing-plans-v2-order.meta.d.ts +0 -41
  30. package/build/cjs/src/pricing-plans-v2-order.meta.js +0 -275
  31. package/build/cjs/src/pricing-plans-v2-order.meta.js.map +0 -1
  32. package/build/cjs/src/pricing-plans-v2-order.public.d.ts +0 -104
  33. package/build/cjs/src/pricing-plans-v2-order.public.js +0 -110
  34. package/build/cjs/src/pricing-plans-v2-order.public.js.map +0 -1
  35. package/build/cjs/src/pricing-plans-v2-order.types.d.ts +0 -1801
  36. package/build/cjs/src/pricing-plans-v2-order.types.js +0 -135
  37. package/build/cjs/src/pricing-plans-v2-order.types.js.map +0 -1
  38. package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +0 -2225
  39. package/build/cjs/src/pricing-plans-v2-order.universal.js +0 -1151
  40. package/build/cjs/src/pricing-plans-v2-order.universal.js.map +0 -1
  41. package/build/cjs/src/pricing-plans-v2-plan.context.d.ts +0 -14
  42. package/build/cjs/src/pricing-plans-v2-plan.context.js +0 -137
  43. package/build/cjs/src/pricing-plans-v2-plan.context.js.map +0 -1
  44. package/build/cjs/src/pricing-plans-v2-plan.http.d.ts +0 -134
  45. package/build/cjs/src/pricing-plans-v2-plan.http.js +0 -544
  46. package/build/cjs/src/pricing-plans-v2-plan.http.js.map +0 -1
  47. package/build/cjs/src/pricing-plans-v2-plan.meta.d.ts +0 -34
  48. package/build/cjs/src/pricing-plans-v2-plan.meta.js +0 -256
  49. package/build/cjs/src/pricing-plans-v2-plan.meta.js.map +0 -1
  50. package/build/cjs/src/pricing-plans-v2-plan.public.d.ts +0 -86
  51. package/build/cjs/src/pricing-plans-v2-plan.public.js +0 -89
  52. package/build/cjs/src/pricing-plans-v2-plan.public.js.map +0 -1
  53. package/build/cjs/src/pricing-plans-v2-plan.types.d.ts +0 -732
  54. package/build/cjs/src/pricing-plans-v2-plan.types.js +0 -41
  55. package/build/cjs/src/pricing-plans-v2-plan.types.js.map +0 -1
  56. package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +0 -1176
  57. package/build/cjs/src/pricing-plans-v2-plan.universal.js +0 -913
  58. package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +0 -1
  59. package/build/es/index.typings.d.ts +0 -2
  60. package/build/es/index.typings.js +0 -3
  61. package/build/es/index.typings.js.map +0 -1
  62. package/build/es/src/pricing-plans-v2-order.context.d.ts +0 -15
  63. package/build/es/src/pricing-plans-v2-order.context.js +0 -132
  64. package/build/es/src/pricing-plans-v2-order.context.js.map +0 -1
  65. package/build/es/src/pricing-plans-v2-order.http.d.ts +0 -165
  66. package/build/es/src/pricing-plans-v2-order.http.js +0 -802
  67. package/build/es/src/pricing-plans-v2-order.http.js.map +0 -1
  68. package/build/es/src/pricing-plans-v2-order.meta.d.ts +0 -41
  69. package/build/es/src/pricing-plans-v2-order.meta.js +0 -236
  70. package/build/es/src/pricing-plans-v2-order.meta.js.map +0 -1
  71. package/build/es/src/pricing-plans-v2-order.public.d.ts +0 -104
  72. package/build/es/src/pricing-plans-v2-order.public.js +0 -70
  73. package/build/es/src/pricing-plans-v2-order.public.js.map +0 -1
  74. package/build/es/src/pricing-plans-v2-order.types.d.ts +0 -1801
  75. package/build/es/src/pricing-plans-v2-order.types.js +0 -132
  76. package/build/es/src/pricing-plans-v2-order.types.js.map +0 -1
  77. package/build/es/src/pricing-plans-v2-order.universal.d.ts +0 -2225
  78. package/build/es/src/pricing-plans-v2-order.universal.js +0 -1112
  79. package/build/es/src/pricing-plans-v2-order.universal.js.map +0 -1
  80. package/build/es/src/pricing-plans-v2-plan.context.d.ts +0 -14
  81. package/build/es/src/pricing-plans-v2-plan.context.js +0 -122
  82. package/build/es/src/pricing-plans-v2-plan.context.js.map +0 -1
  83. package/build/es/src/pricing-plans-v2-plan.http.d.ts +0 -134
  84. package/build/es/src/pricing-plans-v2-plan.http.js +0 -529
  85. package/build/es/src/pricing-plans-v2-plan.http.js.map +0 -1
  86. package/build/es/src/pricing-plans-v2-plan.meta.d.ts +0 -34
  87. package/build/es/src/pricing-plans-v2-plan.meta.js +0 -218
  88. package/build/es/src/pricing-plans-v2-plan.meta.js.map +0 -1
  89. package/build/es/src/pricing-plans-v2-plan.public.d.ts +0 -86
  90. package/build/es/src/pricing-plans-v2-plan.public.js +0 -65
  91. package/build/es/src/pricing-plans-v2-plan.public.js.map +0 -1
  92. package/build/es/src/pricing-plans-v2-plan.types.d.ts +0 -732
  93. package/build/es/src/pricing-plans-v2-plan.types.js +0 -38
  94. package/build/es/src/pricing-plans-v2-plan.types.js.map +0 -1
  95. package/build/es/src/pricing-plans-v2-plan.universal.d.ts +0 -1176
  96. package/build/es/src/pricing-plans-v2-plan.universal.js +0 -875
  97. package/build/es/src/pricing-plans-v2-plan.universal.js.map +0 -1
@@ -1,913 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.arrangePlans = exports.archivePlan = exports.clearPrimary = exports.makePlanPrimary = exports.setPlanVisibility = exports.updatePlan = exports.createPlan = exports.getPlanStats = exports.listPlans = exports.getPlan = exports.queryPublicPlans = exports.listPublicPlans = exports.onPlanArchived = exports.onPlanBuyerCanCancelUpdated = exports.onPlanCreated = exports.onPlanUpdated = exports.PublicFilter = exports.ArchivedFilter = exports.SortOrder = exports.AppliedAt = exports.PeriodUnit = void 0;
36
- const velo_1 = require("@wix/metro-runtime/velo");
37
- const transform_error_1 = require("@wix/sdk-runtime/transform-error");
38
- const sdk_types_1 = require("@wix/sdk-types");
39
- const ambassadorWixPricingPlansV2Plan = __importStar(require("./pricing-plans-v2-plan.http"));
40
- // @ts-ignore
41
- const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
42
- const _toVeloEntity = '$';
43
- const _fromVeloEntity = '$';
44
- var PeriodUnit;
45
- (function (PeriodUnit) {
46
- PeriodUnit["UNDEFINED"] = "UNDEFINED";
47
- PeriodUnit["DAY"] = "DAY";
48
- PeriodUnit["WEEK"] = "WEEK";
49
- PeriodUnit["MONTH"] = "MONTH";
50
- PeriodUnit["YEAR"] = "YEAR";
51
- })(PeriodUnit || (exports.PeriodUnit = PeriodUnit = {}));
52
- var AppliedAt;
53
- (function (AppliedAt) {
54
- AppliedAt["UNKNOWN_CHARGE_EVENT"] = "UNKNOWN_CHARGE_EVENT";
55
- /** Will charge the fee on first payment. If order has a free trial meaning it will charge after the free trial. */
56
- AppliedAt["FIRST_PAYMENT"] = "FIRST_PAYMENT";
57
- })(AppliedAt || (exports.AppliedAt = AppliedAt = {}));
58
- var SortOrder;
59
- (function (SortOrder) {
60
- SortOrder["ASC"] = "ASC";
61
- SortOrder["DESC"] = "DESC";
62
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
63
- var ArchivedFilter;
64
- (function (ArchivedFilter) {
65
- /** Returns all plans that are active. */
66
- ArchivedFilter["ACTIVE"] = "ACTIVE";
67
- /** Returns all plans that are archived. */
68
- ArchivedFilter["ARCHIVED"] = "ARCHIVED";
69
- /** Returns all plans that are active and archived. */
70
- ArchivedFilter["ARCHIVED_AND_ACTIVE"] = "ARCHIVED_AND_ACTIVE";
71
- })(ArchivedFilter || (exports.ArchivedFilter = ArchivedFilter = {}));
72
- var PublicFilter;
73
- (function (PublicFilter) {
74
- /** Returns all public and hidden plans. */
75
- PublicFilter["PUBLIC_AND_HIDDEN"] = "PUBLIC_AND_HIDDEN";
76
- /** Returns only public plans. */
77
- PublicFilter["PUBLIC"] = "PUBLIC";
78
- /** Returns only hidden plans. */
79
- PublicFilter["HIDDEN"] = "HIDDEN";
80
- })(PublicFilter || (exports.PublicFilter = PublicFilter = {}));
81
- const _archivePlanRequest = {};
82
- const _archivePlanResponse = {};
83
- const _arrangePlansRequest = {};
84
- const _arrangePlansResponse = {};
85
- const _clearPrimaryRequest = {};
86
- const _clearPrimaryResponse = {};
87
- const _createPlanRequest = {};
88
- const _createPlanResponse = {};
89
- const _getPlanRequest = {};
90
- const _getPlanResponse = {};
91
- const _getPlanStatsRequest = {};
92
- const _getPlanStatsResponse = {};
93
- const _listPlansRequest = {};
94
- const _listPlansResponse = {};
95
- const _listPublicPlansRequest = {};
96
- const _listPublicPlansResponse = {};
97
- const _makePlanPrimaryRequest = {};
98
- const _makePlanPrimaryResponse = {};
99
- const _queryPublicPlansRequest = {};
100
- const _queryPublicPlansResponse = {};
101
- const _setPlanVisibilityRequest = {};
102
- const _setPlanVisibilityResponse = {};
103
- const _updatePlanRequest = {};
104
- const _updatePlanResponse = {};
105
- exports.onPlanUpdated = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.plan_updated')();
106
- exports.onPlanCreated = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.plan_created')();
107
- exports.onPlanBuyerCanCancelUpdated = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.plan_buyer_can_cancel_updated')();
108
- exports.onPlanArchived = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.plan_plan_archived')();
109
- /**
110
- * Retrieves a list of public pricing plans.
111
- *
112
- *
113
- * The `listPublicPlans()` function returns a Promise that resolves to a list of up to 100 public pricing plans. Public plans are visible plans that site visitors can see on the site and purchase.
114
- * @public
115
- * @param options - Options for filtering and paging the list of public plans.
116
- * @permissionScope Read Pricing Plans
117
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
118
- * @permissionScope Manage Orders
119
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
120
- * @permissionScope Manage Bookings Services and Settings
121
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
122
- * @permissionScope Read Orders
123
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
124
- * @permissionScope Manage Pricing Plans
125
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
126
- * @applicableIdentity APP
127
- * @applicableIdentity MEMBER
128
- * @applicableIdentity VISITOR
129
- * @returns Fulfilled - List of public pricing plans.
130
- */
131
- function listPublicPlans(options) {
132
- var _a, _b, _c;
133
- return __awaiter(this, arguments, void 0, function* () {
134
- const requestTransformation = {
135
- limit: '$[0].limit',
136
- offset: '$[0].offset',
137
- planIds: '$[0].planIds',
138
- };
139
- const responseTransformation = '$';
140
- // @ts-ignore
141
- const { httpClient, sideEffects } = arguments[1];
142
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
143
- rootSchema: _listPublicPlansRequest,
144
- depSchemas: {},
145
- fqdnTransformation: {
146
- paths: [],
147
- transformation: _fromVeloEntity,
148
- },
149
- customTransformation: requestTransformation,
150
- });
151
- const { fromJSON } = (0, velo_1.serializer)({
152
- rootSchema: _listPublicPlansResponse,
153
- depSchemas: {},
154
- fqdnTransformation: {
155
- paths: [],
156
- transformation: _toVeloEntity,
157
- },
158
- customTransformation: responseTransformation,
159
- });
160
- const payload = toAmbassadorRequest([options]);
161
- const reqOpts = ambassadorWixPricingPlansV2Plan.listPublicPlans(payload);
162
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
163
- try {
164
- const result = yield httpClient.request(reqOpts);
165
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
166
- return fromJSON(result.data);
167
- }
168
- catch (err) {
169
- const transformedError = (0, transform_error_1.transformError)(err, {
170
- spreadPathsToArguments: {},
171
- explicitPathsToArguments: {
172
- limit: '$[0].limit',
173
- offset: '$[0].offset',
174
- planIds: '$[0].planIds',
175
- },
176
- singleArgumentUnchanged: false,
177
- }, ['options']);
178
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
179
- throw transformedError;
180
- }
181
- });
182
- }
183
- exports.listPublicPlans = listPublicPlans;
184
- /**
185
- * Creates a query to retrieve a list of public pricing plans.
186
- *
187
- *
188
- * The `queryPublicPlans()` function builds a query to retrieve a list of up to 1,000 public plans and returns a [`PublicPlansQueryBuilder`](#plansquerybuilder) object.
189
- *
190
- * The returned object contains the query definition which is typically used to run the query using the [`find()`](#plansquerybuilder/find) function.
191
- *
192
- * You can refine the query by chaining `PublicPlansQueryBuilder` functions onto the query. `PublicPlansQueryBuilder` functions enable you to sort, filter, and control the results that `queryPublicPlans()` returns.
193
- *
194
- * `queryPublicPlans()` runs with the following `PublicPlansQueryBuilder` defaults that you can override:
195
- * - [`skip`](#plansquerybuilder/skip): `0`
196
- * - [`limit`](#plansquerybuilder/limit): `50`
197
- *
198
- * The functions that are chained to `queryPublicPlans()` are applied in the order they are called. For example, if you sort on the `_createdDate` property in ascending order and then on the `_id` property in ascending order, the results are sorted first by the created date of the items and then, if there are multiple results with the same date, the items are sorted by `_id` in ascending order, per created date value.
199
- *
200
- * The following `PublicPlansQueryBuilder` functions are supported for the `queryPublicPlans()` function. For a full description of the Plans object, see the object returned for the [`items`](#plansqueryresult/items) property in [`PublicPlansQueryResult`](#plansqueryresult).
201
- * @public
202
- * @permissionScope Read Pricing Plans
203
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
204
- * @permissionScope Manage Orders
205
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
206
- * @permissionScope Manage Bookings Services and Settings
207
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
208
- * @permissionScope Read Orders
209
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
210
- * @permissionScope Manage Pricing Plans
211
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
212
- * @applicableIdentity APP
213
- * @applicableIdentity MEMBER
214
- * @applicableIdentity VISITOR
215
- */
216
- function queryPublicPlans() {
217
- const requestTransformation = { '*': '$[1]', query: '$[0]' };
218
- const responseTransformation = {
219
- items: '$.plans',
220
- pagingMetadata: '$.pagingMetadata',
221
- };
222
- // @ts-ignore
223
- const { httpClient, sideEffects } = arguments[0];
224
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
225
- rootSchema: _queryPublicPlansRequest,
226
- depSchemas: {},
227
- fqdnTransformation: {
228
- paths: [],
229
- transformation: _fromVeloEntity,
230
- },
231
- customTransformation: requestTransformation,
232
- });
233
- const { fromJSON } = (0, velo_1.serializer)({
234
- rootSchema: _queryPublicPlansResponse,
235
- depSchemas: {},
236
- fqdnTransformation: {
237
- paths: [],
238
- transformation: _toVeloEntity,
239
- },
240
- customTransformation: responseTransformation,
241
- });
242
- return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({
243
- func: (payload) => __awaiter(this, void 0, void 0, function* () {
244
- var _a, _b, _c;
245
- const reqOpts = ambassadorWixPricingPlansV2Plan.queryPublicPlans(payload);
246
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
247
- try {
248
- const result = yield httpClient.request(reqOpts);
249
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
250
- return result;
251
- }
252
- catch (err) {
253
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
254
- throw err;
255
- }
256
- }),
257
- requestTransformer: (...args) => toAmbassadorRequest(args),
258
- responseTransformer: ({ data }) => fromJSON(data),
259
- errorTransformer: (err) => {
260
- const transformedError = (0, velo_1.transformError)(err, requestTransformation);
261
- throw transformedError;
262
- },
263
- pagingMethod: 'OFFSET',
264
- transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity),
265
- })({ cursorWithEmptyFilterAndSort: true });
266
- }
267
- exports.queryPublicPlans = queryPublicPlans;
268
- /**
269
- * Retrieves a pricing plan by the specified ID.
270
- *
271
- * The `getPlan()` function returns a Promise that resolves to a plan whose ID matched the specified ID.
272
- * @param _id - Plan ID.
273
- * @public
274
- * @requiredField _id
275
- * @permissionScope Read Pricing Plans
276
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
277
- * @permissionScope Manage Pricing Plans
278
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
279
- * @applicableIdentity APP
280
- * @returns Fulfilled - The retrieved plan's information.
281
- */
282
- function getPlan(_id) {
283
- var _a, _b, _c;
284
- return __awaiter(this, arguments, void 0, function* () {
285
- const requestTransformation = { id: '$[0]' };
286
- const responseTransformation = '$.plan';
287
- // @ts-ignore
288
- const { httpClient, sideEffects } = arguments[1];
289
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
290
- rootSchema: _getPlanRequest,
291
- depSchemas: {},
292
- fqdnTransformation: {
293
- paths: [],
294
- transformation: _fromVeloEntity,
295
- },
296
- customTransformation: requestTransformation,
297
- });
298
- const { fromJSON } = (0, velo_1.serializer)({
299
- rootSchema: _getPlanResponse,
300
- depSchemas: {},
301
- fqdnTransformation: {
302
- paths: [...['plan']],
303
- transformation: _toVeloEntity,
304
- },
305
- customTransformation: responseTransformation,
306
- });
307
- const payload = toAmbassadorRequest([_id]);
308
- const reqOpts = ambassadorWixPricingPlansV2Plan.getPlan(payload);
309
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
310
- try {
311
- const result = yield httpClient.request(reqOpts);
312
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
313
- return fromJSON(result.data);
314
- }
315
- catch (err) {
316
- const transformedError = (0, transform_error_1.transformError)(err, {
317
- spreadPathsToArguments: {},
318
- explicitPathsToArguments: { id: '$[0]' },
319
- singleArgumentUnchanged: false,
320
- }, ['_id']);
321
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
322
- throw transformedError;
323
- }
324
- });
325
- }
326
- exports.getPlan = getPlan;
327
- /**
328
- * Retrieves a list of pricing plans.
329
- *
330
- * The `listPlans()` function returns a Promise that resolves to a list of up to 100 pricing plans. This includes public, hidden, and archived plans.
331
- * @public
332
- * @documentationMaturity preview
333
- * @param options - Options for filtering and paging the list of plans.
334
- * @permissionScope Read Pricing Plans
335
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
336
- * @permissionScope Manage Pricing Plans
337
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
338
- * @applicableIdentity APP
339
- * @returns Fulfilled - List of plans that match the given criteria.
340
- */
341
- function listPlans(options) {
342
- var _a, _b, _c;
343
- return __awaiter(this, arguments, void 0, function* () {
344
- const requestTransformation = {
345
- archived: '$[0].archived',
346
- public: '$[0].public',
347
- limit: '$[0].limit',
348
- offset: '$[0].offset',
349
- planIds: '$[0].planIds',
350
- };
351
- const responseTransformation = '$';
352
- // @ts-ignore
353
- const { httpClient, sideEffects } = arguments[1];
354
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
355
- rootSchema: _listPlansRequest,
356
- depSchemas: {},
357
- fqdnTransformation: {
358
- paths: [],
359
- transformation: _fromVeloEntity,
360
- },
361
- customTransformation: requestTransformation,
362
- });
363
- const { fromJSON } = (0, velo_1.serializer)({
364
- rootSchema: _listPlansResponse,
365
- depSchemas: {},
366
- fqdnTransformation: {
367
- paths: [...['Array#plans']],
368
- transformation: _toVeloEntity,
369
- },
370
- customTransformation: responseTransformation,
371
- });
372
- const payload = toAmbassadorRequest([options]);
373
- const reqOpts = ambassadorWixPricingPlansV2Plan.listPlans(payload);
374
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
375
- try {
376
- const result = yield httpClient.request(reqOpts);
377
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
378
- return fromJSON(result.data);
379
- }
380
- catch (err) {
381
- const transformedError = (0, transform_error_1.transformError)(err, {
382
- spreadPathsToArguments: {},
383
- explicitPathsToArguments: {
384
- archived: '$[0].archived',
385
- public: '$[0].public',
386
- limit: '$[0].limit',
387
- offset: '$[0].offset',
388
- planIds: '$[0].planIds',
389
- },
390
- singleArgumentUnchanged: false,
391
- }, ['options']);
392
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
393
- throw transformedError;
394
- }
395
- });
396
- }
397
- exports.listPlans = listPlans;
398
- /**
399
- * Retrieves statistics about the pricing plans.
400
- *
401
- *
402
- * The `getPlanStats()` function returns a Promise that resolves to statistics about the plan on the site.
403
- *
404
- * Currently this function provides only the total number of pricing plans, including archived plans.
405
- * @public
406
- * @permissionScope Read Pricing Plans
407
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
408
- * @permissionScope Manage Pricing Plans
409
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
410
- * @applicableIdentity APP
411
- * @returns Fulfilled - Overall statistics about the pricing plans.
412
- */
413
- function getPlanStats() {
414
- var _a, _b, _c;
415
- return __awaiter(this, arguments, void 0, function* () {
416
- const requestTransformation = {};
417
- const responseTransformation = '$';
418
- // @ts-ignore
419
- const { httpClient, sideEffects } = arguments[0];
420
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
421
- rootSchema: _getPlanStatsRequest,
422
- depSchemas: {},
423
- fqdnTransformation: {
424
- paths: [],
425
- transformation: _fromVeloEntity,
426
- },
427
- customTransformation: requestTransformation,
428
- });
429
- const { fromJSON } = (0, velo_1.serializer)({
430
- rootSchema: _getPlanStatsResponse,
431
- depSchemas: {},
432
- fqdnTransformation: {
433
- paths: [],
434
- transformation: _toVeloEntity,
435
- },
436
- customTransformation: responseTransformation,
437
- });
438
- const payload = toAmbassadorRequest([]);
439
- const reqOpts = ambassadorWixPricingPlansV2Plan.getPlanStats(payload);
440
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
441
- try {
442
- const result = yield httpClient.request(reqOpts);
443
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
444
- return fromJSON(result.data);
445
- }
446
- catch (err) {
447
- const transformedError = (0, transform_error_1.transformError)(err, {
448
- spreadPathsToArguments: {},
449
- explicitPathsToArguments: {},
450
- singleArgumentUnchanged: false,
451
- }, []);
452
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
453
- throw transformedError;
454
- }
455
- });
456
- }
457
- exports.getPlanStats = getPlanStats;
458
- /**
459
- * Creates a pricing plan.
460
- *
461
- *
462
- * The `createPlan()` function returns a Promise that resolves to a newly-created pricing plan after is has successfully been created.
463
- *
464
- * The passed `plan` object must contain a [pricing model](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/pricing-models). A pricing model can be one of the following:
465
- * - **A subscription**: A subscription with recurring payment and how often the plan occurs. Subscriptions can have free trial days.
466
- * - **A plan that does not renew**: A single payment for a specific duration that doesn't renew.
467
- * - **An unlimited plan**: A single payment for an unlimited amount of time (until canceled).
468
- *
469
- * Pricing plans created by this function are available to the site owner in the Pricing Plans section in the Dashboard.
470
- * @public
471
- * @requiredField plan
472
- * @requiredField plan.name
473
- * @requiredField plan.pricing
474
- * @requiredField plan.pricing.singlePaymentForDuration.count
475
- * @requiredField plan.pricing.subscription.cycleCount
476
- * @requiredField plan.pricing.subscription.cycleDuration
477
- * @requiredField plan.pricing.subscription.cycleDuration.count
478
- * @param plan - Information for the plan being created.
479
- * @permissionScope Manage Pricing Plans
480
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
481
- * @applicableIdentity APP
482
- * @returns Fulfilled - The created plan.
483
- *
484
- * Rejected - Error message.
485
- */
486
- function createPlan(plan) {
487
- var _a, _b, _c;
488
- return __awaiter(this, arguments, void 0, function* () {
489
- const requestTransformation = { plan: '$[0]' };
490
- const responseTransformation = '$.plan';
491
- // @ts-ignore
492
- const { httpClient, sideEffects } = arguments[1];
493
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
494
- rootSchema: _createPlanRequest,
495
- depSchemas: {},
496
- fqdnTransformation: {
497
- paths: [...['plan']],
498
- transformation: _fromVeloEntity,
499
- },
500
- customTransformation: requestTransformation,
501
- });
502
- const { fromJSON } = (0, velo_1.serializer)({
503
- rootSchema: _createPlanResponse,
504
- depSchemas: {},
505
- fqdnTransformation: {
506
- paths: [...['plan']],
507
- transformation: _toVeloEntity,
508
- },
509
- customTransformation: responseTransformation,
510
- });
511
- const payload = toAmbassadorRequest([plan]);
512
- const reqOpts = ambassadorWixPricingPlansV2Plan.createPlan(payload);
513
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
514
- try {
515
- const result = yield httpClient.request(reqOpts);
516
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
517
- return fromJSON(result.data);
518
- }
519
- catch (err) {
520
- const transformedError = (0, transform_error_1.transformError)(err, {
521
- spreadPathsToArguments: {},
522
- explicitPathsToArguments: { plan: '$[0]' },
523
- singleArgumentUnchanged: false,
524
- }, ['plan']);
525
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
526
- throw transformedError;
527
- }
528
- });
529
- }
530
- exports.createPlan = createPlan;
531
- /**
532
- * Updates a pricing plan.
533
- *
534
- *
535
- * The `updatePlan()` function returns a Promise that resolves to an updated plan.
536
- *
537
- * Updating a plan does not impact existing purchases made for the plan. All purchases keep the details of the original plan that was active at the time of the purchase.
538
- * @public
539
- * @requiredField _id
540
- * @requiredField plan
541
- * @param _id - ID of the plan to update.
542
- * @param options - Options for updating the plan.
543
- * @permissionScope Manage Pricing Plans
544
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
545
- * @applicableIdentity APP
546
- * @returns Fulfilled - The updated plan.
547
- *
548
- * Rejected - Error message.
549
- */
550
- function updatePlan(_id, plan) {
551
- var _a, _b, _c;
552
- return __awaiter(this, arguments, void 0, function* () {
553
- const requestTransformation = { plan: { '*': '$[1]', id: '$[0]' } };
554
- const responseTransformation = '$.plan';
555
- // @ts-ignore
556
- const { httpClient, sideEffects } = arguments[2];
557
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
558
- rootSchema: _updatePlanRequest,
559
- depSchemas: {},
560
- fqdnTransformation: {
561
- paths: [...['plan']],
562
- transformation: _fromVeloEntity,
563
- },
564
- customTransformation: requestTransformation,
565
- });
566
- const { fromJSON } = (0, velo_1.serializer)({
567
- rootSchema: _updatePlanResponse,
568
- depSchemas: {},
569
- fqdnTransformation: {
570
- paths: [...['plan']],
571
- transformation: _toVeloEntity,
572
- },
573
- customTransformation: responseTransformation,
574
- });
575
- const payload = toAmbassadorRequest([_id, plan]);
576
- const reqOpts = ambassadorWixPricingPlansV2Plan.updatePlan(payload);
577
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
578
- try {
579
- const result = yield httpClient.request(reqOpts);
580
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
581
- return fromJSON(result.data);
582
- }
583
- catch (err) {
584
- const transformedError = (0, transform_error_1.transformError)(err, {
585
- spreadPathsToArguments: { plan: '$[1]' },
586
- explicitPathsToArguments: { 'plan.id': '$[0]' },
587
- singleArgumentUnchanged: false,
588
- }, ['_id', 'plan']);
589
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
590
- throw transformedError;
591
- }
592
- });
593
- }
594
- exports.updatePlan = updatePlan;
595
- /**
596
- * Sets visibility for non-archived pricing plans.
597
- *
598
- * The `setPlanVisibility()` functions returns a Promise that resolves to a pricing plan when its visibility has successfully been set.
599
- *
600
- * By default, pricing plans are public, meaning they are visible. [Plans can be hidden](https://support.wix.com/en/article/pricing-plans-removing-a-plan-from-your-site#hiding-plans) so that site members and visitors cannot see or choose them.
601
- *
602
- * As opposed to archiving, setting visibility can be reversed. This means that a public plan can be hidden, and a hidden plan can be made public (visible).
603
- *
604
- * >**Note:** An archived plan always remains archived and cannot be made active again. When archiving a plan, its `public` property is automatically set to `false` so that it is hidden.
605
- *
606
- * Changing a plan's visibility does not impact existing orders for the plan. All orders for hidden plans are still active and keep their terms and payment options.
607
- * @param visible - Whether to set the plan as visible.
608
- * @public
609
- * @requiredField _id
610
- * @requiredField visible
611
- * @param _id - The ID of the plan to either display or hide on the site page.
612
- * @param options - Plan visibility options.
613
- * @permissionScope Manage Pricing Plans
614
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
615
- * @applicableIdentity APP
616
- * @returns Fulfilled - The plan's information.
617
- *
618
- * Rejected - Error message.
619
- */
620
- function setPlanVisibility(_id, visible) {
621
- var _a, _b, _c;
622
- return __awaiter(this, arguments, void 0, function* () {
623
- const requestTransformation = { id: '$[0]', visible: '$[1]' };
624
- const responseTransformation = '$';
625
- // @ts-ignore
626
- const { httpClient, sideEffects } = arguments[2];
627
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
628
- rootSchema: _setPlanVisibilityRequest,
629
- depSchemas: {},
630
- fqdnTransformation: {
631
- paths: [],
632
- transformation: _fromVeloEntity,
633
- },
634
- customTransformation: requestTransformation,
635
- });
636
- const { fromJSON } = (0, velo_1.serializer)({
637
- rootSchema: _setPlanVisibilityResponse,
638
- depSchemas: {},
639
- fqdnTransformation: {
640
- paths: [...['plan']],
641
- transformation: _toVeloEntity,
642
- },
643
- customTransformation: responseTransformation,
644
- });
645
- const payload = toAmbassadorRequest([_id, visible]);
646
- const reqOpts = ambassadorWixPricingPlansV2Plan.setPlanVisibility(payload);
647
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
648
- try {
649
- const result = yield httpClient.request(reqOpts);
650
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
651
- return fromJSON(result.data);
652
- }
653
- catch (err) {
654
- const transformedError = (0, transform_error_1.transformError)(err, {
655
- spreadPathsToArguments: {},
656
- explicitPathsToArguments: { id: '$[0]', visible: '$[1]' },
657
- singleArgumentUnchanged: false,
658
- }, ['_id', 'visible']);
659
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
660
- throw transformedError;
661
- }
662
- });
663
- }
664
- exports.setPlanVisibility = setPlanVisibility;
665
- /**
666
- * Marks a pricing plan as the primary pricing plan.
667
- *
668
- *
669
- * The `makePlanPrimary()` function returns a Promise that resolves to the now primary pricing plan.
670
- *
671
- * Only a single plan can be marked as a primary plan at any given time. If there is an existing plan marked as primary, calling `makePlanPrimary()` causes the existing primary plan to lose its primary status.
672
- *
673
- * When viewing pricing plans on the site, the primary plan is highlighted with a customizable ribbon.
674
- * @public
675
- * @requiredField _id
676
- * @param _id - ID of the pricing plan to set as the primary plan.
677
- * @permissionScope Manage Pricing Plans
678
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
679
- * @applicableIdentity APP
680
- * @returns Fulfilled - The primary plan.
681
- */
682
- function makePlanPrimary(_id) {
683
- var _a, _b, _c;
684
- return __awaiter(this, arguments, void 0, function* () {
685
- const requestTransformation = { id: '$[0]' };
686
- const responseTransformation = '$';
687
- // @ts-ignore
688
- const { httpClient, sideEffects } = arguments[1];
689
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
690
- rootSchema: _makePlanPrimaryRequest,
691
- depSchemas: {},
692
- fqdnTransformation: {
693
- paths: [],
694
- transformation: _fromVeloEntity,
695
- },
696
- customTransformation: requestTransformation,
697
- });
698
- const { fromJSON } = (0, velo_1.serializer)({
699
- rootSchema: _makePlanPrimaryResponse,
700
- depSchemas: {},
701
- fqdnTransformation: {
702
- paths: [...['plan']],
703
- transformation: _toVeloEntity,
704
- },
705
- customTransformation: responseTransformation,
706
- });
707
- const payload = toAmbassadorRequest([_id]);
708
- const reqOpts = ambassadorWixPricingPlansV2Plan.makePlanPrimary(payload);
709
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
710
- try {
711
- const result = yield httpClient.request(reqOpts);
712
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
713
- return fromJSON(result.data);
714
- }
715
- catch (err) {
716
- const transformedError = (0, transform_error_1.transformError)(err, {
717
- spreadPathsToArguments: {},
718
- explicitPathsToArguments: { id: '$[0]' },
719
- singleArgumentUnchanged: false,
720
- }, ['_id']);
721
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
722
- throw transformedError;
723
- }
724
- });
725
- }
726
- exports.makePlanPrimary = makePlanPrimary;
727
- /**
728
- * Sets all pricing plans to no longer be primary.
729
- *
730
- * The `clearPrimary()` function returns a Promise that is resolved when there are no pricing plans marked as `primary`.
731
- *
732
- * After clearing the primary plan, when viewing pricing plans on the site, no plan is highlighted with a customizable ribbon.
733
- * @public
734
- * @permissionScope Manage Pricing Plans
735
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
736
- * @applicableIdentity APP
737
- */
738
- function clearPrimary() {
739
- var _a, _b, _c;
740
- return __awaiter(this, arguments, void 0, function* () {
741
- const requestTransformation = {};
742
- const responseTransformation = '$';
743
- // @ts-ignore
744
- const { httpClient, sideEffects } = arguments[0];
745
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
746
- rootSchema: _clearPrimaryRequest,
747
- depSchemas: {},
748
- fqdnTransformation: {
749
- paths: [],
750
- transformation: _fromVeloEntity,
751
- },
752
- customTransformation: requestTransformation,
753
- });
754
- const { fromJSON } = (0, velo_1.serializer)({
755
- rootSchema: _clearPrimaryResponse,
756
- depSchemas: {},
757
- fqdnTransformation: {
758
- paths: [],
759
- transformation: _toVeloEntity,
760
- },
761
- customTransformation: responseTransformation,
762
- });
763
- const payload = toAmbassadorRequest([]);
764
- const reqOpts = ambassadorWixPricingPlansV2Plan.clearPrimary(payload);
765
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
766
- try {
767
- const result = yield httpClient.request(reqOpts);
768
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
769
- }
770
- catch (err) {
771
- const transformedError = (0, transform_error_1.transformError)(err, {
772
- spreadPathsToArguments: {},
773
- explicitPathsToArguments: {},
774
- singleArgumentUnchanged: false,
775
- }, []);
776
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
777
- throw transformedError;
778
- }
779
- });
780
- }
781
- exports.clearPrimary = clearPrimary;
782
- /**
783
- * Archives a single plan.
784
- *
785
- *
786
- * The `archivePlan()` function returns a Promise that resolves to the newly-archived plan.
787
- *
788
- * When a plan is archived, the plan
789
- * - Is no longer available for display or selection by visitors. This is because the plan's `public` property is automatically set to `false`.
790
- * - Cannot be purchased.
791
- * - Cannot be "un-archived", meaning the plan cannot be made active again.
792
- *
793
- * Plan archiving does not impact existing purchases made for the plan. All purchases for the plan are still active and keep their payment options and terms.
794
- *
795
- * Site owners can see archived plans in the Dashboard under **Pricing Plans -> Archived Plans**.
796
- *
797
- * >**Note:** An attempt to archive an already-archived plan throws an error.
798
- * @public
799
- * @requiredField _id
800
- * @param _id - ID of the active plan to archive.
801
- * @permissionScope Manage Pricing Plans
802
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
803
- * @applicableIdentity APP
804
- * @returns Fulfilled - The archived plan.
805
- *
806
- * Rejected - Error message.
807
- */
808
- function archivePlan(_id) {
809
- var _a, _b, _c;
810
- return __awaiter(this, arguments, void 0, function* () {
811
- const requestTransformation = { id: '$[0]' };
812
- const responseTransformation = '$';
813
- // @ts-ignore
814
- const { httpClient, sideEffects } = arguments[1];
815
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
816
- rootSchema: _archivePlanRequest,
817
- depSchemas: {},
818
- fqdnTransformation: {
819
- paths: [],
820
- transformation: _fromVeloEntity,
821
- },
822
- customTransformation: requestTransformation,
823
- });
824
- const { fromJSON } = (0, velo_1.serializer)({
825
- rootSchema: _archivePlanResponse,
826
- depSchemas: {},
827
- fqdnTransformation: {
828
- paths: [...['plan']],
829
- transformation: _toVeloEntity,
830
- },
831
- customTransformation: responseTransformation,
832
- });
833
- const payload = toAmbassadorRequest([_id]);
834
- const reqOpts = ambassadorWixPricingPlansV2Plan.archivePlan(payload);
835
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
836
- try {
837
- const result = yield httpClient.request(reqOpts);
838
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
839
- return fromJSON(result.data);
840
- }
841
- catch (err) {
842
- const transformedError = (0, transform_error_1.transformError)(err, {
843
- spreadPathsToArguments: {},
844
- explicitPathsToArguments: { id: '$[0]' },
845
- singleArgumentUnchanged: false,
846
- }, ['_id']);
847
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
848
- throw transformedError;
849
- }
850
- });
851
- }
852
- exports.archivePlan = archivePlan;
853
- /**
854
- * Changes the display order of the pricing plans on the site page and in the Dashboard.
855
- *
856
- *
857
- * The `arrangePlans()` function returns a Promise that resolves when the plans are rearranged on the site page and in the Dashboard.
858
- *
859
- * To rearrange the order of the plans, provide a list of the IDs for all non-archived plans in the desired order, including hidden plans.
860
- *
861
- * >**Note:** Make sure to provide *all* non-archived plan IDs to avoid unpredictable results.
862
- * @param ids - IDs of all non-archived plans in the order you want them arranged.
863
- * @public
864
- * @requiredField ids
865
- * @permissionScope Manage Pricing Plans
866
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
867
- * @applicableIdentity APP
868
- */
869
- function arrangePlans(ids) {
870
- var _a, _b, _c;
871
- return __awaiter(this, arguments, void 0, function* () {
872
- const requestTransformation = { ids: '$[0]' };
873
- const responseTransformation = '$';
874
- // @ts-ignore
875
- const { httpClient, sideEffects } = arguments[1];
876
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
877
- rootSchema: _arrangePlansRequest,
878
- depSchemas: {},
879
- fqdnTransformation: {
880
- paths: [],
881
- transformation: _fromVeloEntity,
882
- },
883
- customTransformation: requestTransformation,
884
- });
885
- const { fromJSON } = (0, velo_1.serializer)({
886
- rootSchema: _arrangePlansResponse,
887
- depSchemas: {},
888
- fqdnTransformation: {
889
- paths: [],
890
- transformation: _toVeloEntity,
891
- },
892
- customTransformation: responseTransformation,
893
- });
894
- const payload = toAmbassadorRequest([ids]);
895
- const reqOpts = ambassadorWixPricingPlansV2Plan.arrangePlans(payload);
896
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
897
- try {
898
- const result = yield httpClient.request(reqOpts);
899
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
900
- }
901
- catch (err) {
902
- const transformedError = (0, transform_error_1.transformError)(err, {
903
- spreadPathsToArguments: {},
904
- explicitPathsToArguments: { ids: '$[0]' },
905
- singleArgumentUnchanged: false,
906
- }, ['ids']);
907
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
908
- throw transformedError;
909
- }
910
- });
911
- }
912
- exports.arrangePlans = arrangePlans;
913
- //# sourceMappingURL=pricing-plans-v2-plan.universal.js.map