@wix/auto_sdk_stores_subscription-options 1.0.16 → 1.0.18

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.
@@ -0,0 +1,767 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ DiscountType: () => DiscountType,
24
+ SubscriptionFrequency: () => SubscriptionFrequency,
25
+ allowOneTimePurchases: () => allowOneTimePurchases2,
26
+ assignSubscriptionOptionsToProduct: () => assignSubscriptionOptionsToProduct2,
27
+ bulkCreateSubscriptionOptions: () => bulkCreateSubscriptionOptions2,
28
+ bulkDeleteSubscriptionOptions: () => bulkDeleteSubscriptionOptions2,
29
+ bulkUpdateSubscriptionOptions: () => bulkUpdateSubscriptionOptions2,
30
+ createSubscriptionOption: () => createSubscriptionOption2,
31
+ deleteSubscriptionOption: () => deleteSubscriptionOption2,
32
+ getOneTimePurchasesStatus: () => getOneTimePurchasesStatus2,
33
+ getProductIdsForSubscriptionOption: () => getProductIdsForSubscriptionOption2,
34
+ getSubscriptionOption: () => getSubscriptionOption2,
35
+ getSubscriptionOptionsForProduct: () => getSubscriptionOptionsForProduct2,
36
+ updateSubscriptionOption: () => updateSubscriptionOption2
37
+ });
38
+ module.exports = __toCommonJS(index_typings_exports);
39
+
40
+ // src/stores-v1-subscription-option-subscription-options.universal.ts
41
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
42
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
43
+
44
+ // src/stores-v1-subscription-option-subscription-options.http.ts
45
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
46
+ var import_float = require("@wix/sdk-runtime/transformations/float");
47
+ var import_float2 = require("@wix/sdk-runtime/transformations/float");
48
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
49
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
50
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
51
+ const domainToMappings = {
52
+ "api._api_base_domain_": [
53
+ {
54
+ srcPath: "/wix-ecommerce-plans",
55
+ destPath: ""
56
+ }
57
+ ],
58
+ "www.wixapis.com": [
59
+ {
60
+ srcPath: "/stores/v1/subscription-options",
61
+ destPath: "/v1/subscription-options"
62
+ }
63
+ ],
64
+ "www._base_domain_": [
65
+ {
66
+ srcPath: "/_api/subscription-options-server",
67
+ destPath: ""
68
+ }
69
+ ],
70
+ "editor._base_domain_": [
71
+ {
72
+ srcPath: "/_api/subscription-options-server",
73
+ destPath: ""
74
+ }
75
+ ],
76
+ "blocks._base_domain_": [
77
+ {
78
+ srcPath: "/_api/subscription-options-server",
79
+ destPath: ""
80
+ }
81
+ ],
82
+ "create.editorx": [
83
+ {
84
+ srcPath: "/_api/subscription-options-server",
85
+ destPath: ""
86
+ }
87
+ ],
88
+ "manage._base_domain_": [
89
+ {
90
+ srcPath: "/_api/subscription-options-server",
91
+ destPath: ""
92
+ }
93
+ ]
94
+ };
95
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
96
+ }
97
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
98
+ const domainToMappings = {
99
+ "api._api_base_domain_": [
100
+ {
101
+ srcPath: "/wix-ecommerce-plans-reader",
102
+ destPath: ""
103
+ }
104
+ ],
105
+ "www._base_domain_": [
106
+ {
107
+ srcPath: "/_api/wix-ecommerce-plans-reader",
108
+ destPath: ""
109
+ }
110
+ ],
111
+ _: [
112
+ {
113
+ srcPath: "/_api/subscription-options-reader-server",
114
+ destPath: ""
115
+ }
116
+ ],
117
+ "manage._base_domain_": [
118
+ {
119
+ srcPath: "/_api/subscription-options-reader-server",
120
+ destPath: ""
121
+ }
122
+ ]
123
+ };
124
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
125
+ }
126
+ var PACKAGE_NAME = "@wix/auto_sdk_stores_subscription-options";
127
+ function getSubscriptionOption(payload) {
128
+ function __getSubscriptionOption({ host }) {
129
+ const metadata = {
130
+ entityFqdn: "wix.stores.v1.subscription_option",
131
+ method: "GET",
132
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
133
+ packageName: PACKAGE_NAME,
134
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
135
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
136
+ ),
137
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
138
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
139
+ {
140
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
141
+ paths: [{ path: "subscriptionOption.discount.value" }]
142
+ }
143
+ ])
144
+ };
145
+ return metadata;
146
+ }
147
+ return __getSubscriptionOption;
148
+ }
149
+ function getSubscriptionOptionsForProduct(payload) {
150
+ function __getSubscriptionOptionsForProduct({ host }) {
151
+ const metadata = {
152
+ entityFqdn: "wix.stores.v1.subscription_option",
153
+ method: "GET",
154
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
155
+ packageName: PACKAGE_NAME,
156
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
157
+ {
158
+ protoPath: "/v1/subscription-options/byProduct/{productId}",
159
+ data: payload,
160
+ host
161
+ }
162
+ ),
163
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
164
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
165
+ {
166
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
167
+ paths: [{ path: "subscriptionOptions.discount.value" }]
168
+ }
169
+ ])
170
+ };
171
+ return metadata;
172
+ }
173
+ return __getSubscriptionOptionsForProduct;
174
+ }
175
+ function getProductIdsForSubscriptionOption(payload) {
176
+ function __getProductIdsForSubscriptionOption({ host }) {
177
+ const metadata = {
178
+ entityFqdn: "wix.stores.v1.subscription_option",
179
+ method: "GET",
180
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
181
+ packageName: PACKAGE_NAME,
182
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
183
+ {
184
+ protoPath: "/v1/subscription-options/{id}/productIds",
185
+ data: payload,
186
+ host
187
+ }
188
+ ),
189
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
190
+ };
191
+ return metadata;
192
+ }
193
+ return __getProductIdsForSubscriptionOption;
194
+ }
195
+ function getOneTimePurchasesStatus(payload) {
196
+ function __getOneTimePurchasesStatus({ host }) {
197
+ const metadata = {
198
+ entityFqdn: "wix.stores.v1.subscription_option",
199
+ method: "GET",
200
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
201
+ packageName: PACKAGE_NAME,
202
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
203
+ {
204
+ protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
205
+ data: payload,
206
+ host
207
+ }
208
+ ),
209
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
210
+ };
211
+ return metadata;
212
+ }
213
+ return __getOneTimePurchasesStatus;
214
+ }
215
+ function createSubscriptionOption(payload) {
216
+ function __createSubscriptionOption({ host }) {
217
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
218
+ {
219
+ transformFn: import_float.transformSDKFloatToRESTFloat,
220
+ paths: [{ path: "subscriptionOption.discount.value" }]
221
+ }
222
+ ]);
223
+ const metadata = {
224
+ entityFqdn: "wix.stores.v1.subscription_option",
225
+ method: "POST",
226
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.CreateSubscriptionOption",
227
+ packageName: PACKAGE_NAME,
228
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
229
+ { protoPath: "/v1/subscription-options", data: serializedData, host }
230
+ ),
231
+ data: serializedData,
232
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
233
+ {
234
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
235
+ paths: [{ path: "subscriptionOption.discount.value" }]
236
+ }
237
+ ])
238
+ };
239
+ return metadata;
240
+ }
241
+ return __createSubscriptionOption;
242
+ }
243
+ function updateSubscriptionOption(payload) {
244
+ function __updateSubscriptionOption({ host }) {
245
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
246
+ {
247
+ transformFn: import_float.transformSDKFloatToRESTFloat,
248
+ paths: [{ path: "subscriptionOption.discount.value" }]
249
+ }
250
+ ]);
251
+ const metadata = {
252
+ entityFqdn: "wix.stores.v1.subscription_option",
253
+ method: "PATCH",
254
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.UpdateSubscriptionOption",
255
+ packageName: PACKAGE_NAME,
256
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
257
+ {
258
+ protoPath: "/v1/subscription-options/{subscriptionOption.id}",
259
+ data: serializedData,
260
+ host
261
+ }
262
+ ),
263
+ data: serializedData,
264
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
265
+ {
266
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
267
+ paths: [{ path: "subscriptionOption.discount.value" }]
268
+ }
269
+ ])
270
+ };
271
+ return metadata;
272
+ }
273
+ return __updateSubscriptionOption;
274
+ }
275
+ function deleteSubscriptionOption(payload) {
276
+ function __deleteSubscriptionOption({ host }) {
277
+ const metadata = {
278
+ entityFqdn: "wix.stores.v1.subscription_option",
279
+ method: "DELETE",
280
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.DeleteSubscriptionOption",
281
+ packageName: PACKAGE_NAME,
282
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
283
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
284
+ ),
285
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
286
+ };
287
+ return metadata;
288
+ }
289
+ return __deleteSubscriptionOption;
290
+ }
291
+ function bulkCreateSubscriptionOptions(payload) {
292
+ function __bulkCreateSubscriptionOptions({ host }) {
293
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
294
+ {
295
+ transformFn: import_float.transformSDKFloatToRESTFloat,
296
+ paths: [{ path: "subscriptionOptions.discount.value" }]
297
+ }
298
+ ]);
299
+ const metadata = {
300
+ entityFqdn: "wix.stores.v1.subscription_option",
301
+ method: "POST",
302
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.BulkCreateSubscriptionOptions",
303
+ packageName: PACKAGE_NAME,
304
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
305
+ {
306
+ protoPath: "/v1/subscription-options/createBulk",
307
+ data: serializedData,
308
+ host
309
+ }
310
+ ),
311
+ data: serializedData,
312
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
313
+ {
314
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
315
+ paths: [{ path: "subscriptionOptions.discount.value" }]
316
+ }
317
+ ])
318
+ };
319
+ return metadata;
320
+ }
321
+ return __bulkCreateSubscriptionOptions;
322
+ }
323
+ function bulkUpdateSubscriptionOptions(payload) {
324
+ function __bulkUpdateSubscriptionOptions({ host }) {
325
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
326
+ {
327
+ transformFn: import_float.transformSDKFloatToRESTFloat,
328
+ paths: [{ path: "subscriptionOptions.discount.value" }]
329
+ }
330
+ ]);
331
+ const metadata = {
332
+ entityFqdn: "wix.stores.v1.subscription_option",
333
+ method: "PATCH",
334
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.BulkUpdateSubscriptionOptions",
335
+ packageName: PACKAGE_NAME,
336
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
337
+ { protoPath: "/v1/subscription-options", data: serializedData, host }
338
+ ),
339
+ data: serializedData,
340
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
341
+ {
342
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
343
+ paths: [{ path: "subscriptionOptions.discount.value" }]
344
+ }
345
+ ])
346
+ };
347
+ return metadata;
348
+ }
349
+ return __bulkUpdateSubscriptionOptions;
350
+ }
351
+ function bulkDeleteSubscriptionOptions(payload) {
352
+ function __bulkDeleteSubscriptionOptions({ host }) {
353
+ const metadata = {
354
+ entityFqdn: "wix.stores.v1.subscription_option",
355
+ method: "POST",
356
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.BulkDeleteSubscriptionOptions",
357
+ packageName: PACKAGE_NAME,
358
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
359
+ {
360
+ protoPath: "/v1/subscription-options/deleteBulk",
361
+ data: payload,
362
+ host
363
+ }
364
+ ),
365
+ data: payload
366
+ };
367
+ return metadata;
368
+ }
369
+ return __bulkDeleteSubscriptionOptions;
370
+ }
371
+ function assignSubscriptionOptionsToProduct(payload) {
372
+ function __assignSubscriptionOptionsToProduct({ host }) {
373
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
374
+ {
375
+ transformFn: import_float.transformSDKFloatToRESTFloat,
376
+ paths: [{ path: "assignedSubscriptionOptions.discount.value" }]
377
+ }
378
+ ]);
379
+ const metadata = {
380
+ entityFqdn: "wix.stores.v1.subscription_option",
381
+ method: "POST",
382
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.AssignSubscriptionOptionsToProduct",
383
+ packageName: PACKAGE_NAME,
384
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
385
+ {
386
+ protoPath: "/v1/subscription-options/product/{productId}/assign",
387
+ data: serializedData,
388
+ host
389
+ }
390
+ ),
391
+ data: serializedData
392
+ };
393
+ return metadata;
394
+ }
395
+ return __assignSubscriptionOptionsToProduct;
396
+ }
397
+ function allowOneTimePurchases(payload) {
398
+ function __allowOneTimePurchases({ host }) {
399
+ const metadata = {
400
+ entityFqdn: "wix.stores.v1.subscription_option",
401
+ method: "PATCH",
402
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.AllowOneTimePurchases",
403
+ packageName: PACKAGE_NAME,
404
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
405
+ {
406
+ protoPath: "/v1/subscription-options/product/{productId}/allowOneTimePurchase",
407
+ data: payload,
408
+ host
409
+ }
410
+ ),
411
+ data: payload
412
+ };
413
+ return metadata;
414
+ }
415
+ return __allowOneTimePurchases;
416
+ }
417
+
418
+ // src/stores-v1-subscription-option-subscription-options.universal.ts
419
+ var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
420
+ SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
421
+ SubscriptionFrequency2["DAY"] = "DAY";
422
+ SubscriptionFrequency2["WEEK"] = "WEEK";
423
+ SubscriptionFrequency2["MONTH"] = "MONTH";
424
+ SubscriptionFrequency2["YEAR"] = "YEAR";
425
+ return SubscriptionFrequency2;
426
+ })(SubscriptionFrequency || {});
427
+ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
428
+ DiscountType2["UNDEFINED"] = "UNDEFINED";
429
+ DiscountType2["AMOUNT"] = "AMOUNT";
430
+ DiscountType2["PERCENT"] = "PERCENT";
431
+ return DiscountType2;
432
+ })(DiscountType || {});
433
+ async function getSubscriptionOption2(_id) {
434
+ const { httpClient, sideEffects } = arguments[1];
435
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
436
+ const reqOpts = getSubscriptionOption(payload);
437
+ sideEffects?.onSiteCall?.();
438
+ try {
439
+ const result = await httpClient.request(reqOpts);
440
+ sideEffects?.onSuccess?.(result);
441
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
442
+ } catch (err) {
443
+ const transformedError = (0, import_transform_error.transformError)(
444
+ err,
445
+ {
446
+ spreadPathsToArguments: {},
447
+ explicitPathsToArguments: { id: "$[0]" },
448
+ singleArgumentUnchanged: false
449
+ },
450
+ ["_id"]
451
+ );
452
+ sideEffects?.onError?.(err);
453
+ throw transformedError;
454
+ }
455
+ }
456
+ async function getSubscriptionOptionsForProduct2(productId, options) {
457
+ const { httpClient, sideEffects } = arguments[2];
458
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
459
+ productId,
460
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
461
+ });
462
+ const reqOpts = getSubscriptionOptionsForProduct(
463
+ payload
464
+ );
465
+ sideEffects?.onSiteCall?.();
466
+ try {
467
+ const result = await httpClient.request(reqOpts);
468
+ sideEffects?.onSuccess?.(result);
469
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
470
+ } catch (err) {
471
+ const transformedError = (0, import_transform_error.transformError)(
472
+ err,
473
+ {
474
+ spreadPathsToArguments: {},
475
+ explicitPathsToArguments: {
476
+ productId: "$[0]",
477
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
478
+ },
479
+ singleArgumentUnchanged: false
480
+ },
481
+ ["productId", "options"]
482
+ );
483
+ sideEffects?.onError?.(err);
484
+ throw transformedError;
485
+ }
486
+ }
487
+ async function getProductIdsForSubscriptionOption2(_id, options) {
488
+ const { httpClient, sideEffects } = arguments[2];
489
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
490
+ id: _id,
491
+ includeHiddenProducts: options?.includeHiddenProducts,
492
+ paging: options?.paging
493
+ });
494
+ const reqOpts = getProductIdsForSubscriptionOption(
495
+ payload
496
+ );
497
+ sideEffects?.onSiteCall?.();
498
+ try {
499
+ const result = await httpClient.request(reqOpts);
500
+ sideEffects?.onSuccess?.(result);
501
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
502
+ } catch (err) {
503
+ const transformedError = (0, import_transform_error.transformError)(
504
+ err,
505
+ {
506
+ spreadPathsToArguments: {},
507
+ explicitPathsToArguments: {
508
+ id: "$[0]",
509
+ includeHiddenProducts: "$[1].includeHiddenProducts",
510
+ paging: "$[1].paging"
511
+ },
512
+ singleArgumentUnchanged: false
513
+ },
514
+ ["_id", "options"]
515
+ );
516
+ sideEffects?.onError?.(err);
517
+ throw transformedError;
518
+ }
519
+ }
520
+ async function getOneTimePurchasesStatus2(productId) {
521
+ const { httpClient, sideEffects } = arguments[1];
522
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
523
+ productId
524
+ });
525
+ const reqOpts = getOneTimePurchasesStatus(payload);
526
+ sideEffects?.onSiteCall?.();
527
+ try {
528
+ const result = await httpClient.request(reqOpts);
529
+ sideEffects?.onSuccess?.(result);
530
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
531
+ } catch (err) {
532
+ const transformedError = (0, import_transform_error.transformError)(
533
+ err,
534
+ {
535
+ spreadPathsToArguments: {},
536
+ explicitPathsToArguments: { productId: "$[0]" },
537
+ singleArgumentUnchanged: false
538
+ },
539
+ ["productId"]
540
+ );
541
+ sideEffects?.onError?.(err);
542
+ throw transformedError;
543
+ }
544
+ }
545
+ async function createSubscriptionOption2(subscriptionOption) {
546
+ const { httpClient, sideEffects } = arguments[1];
547
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
548
+ subscriptionOption
549
+ });
550
+ const reqOpts = createSubscriptionOption(payload);
551
+ sideEffects?.onSiteCall?.();
552
+ try {
553
+ const result = await httpClient.request(reqOpts);
554
+ sideEffects?.onSuccess?.(result);
555
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
556
+ } catch (err) {
557
+ const transformedError = (0, import_transform_error.transformError)(
558
+ err,
559
+ {
560
+ spreadPathsToArguments: {},
561
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
562
+ singleArgumentUnchanged: false
563
+ },
564
+ ["subscriptionOption"]
565
+ );
566
+ sideEffects?.onError?.(err);
567
+ throw transformedError;
568
+ }
569
+ }
570
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
571
+ const { httpClient, sideEffects } = arguments[2];
572
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
573
+ subscriptionOption: { ...subscriptionOption, id: _id }
574
+ });
575
+ const reqOpts = updateSubscriptionOption(payload);
576
+ sideEffects?.onSiteCall?.();
577
+ try {
578
+ const result = await httpClient.request(reqOpts);
579
+ sideEffects?.onSuccess?.(result);
580
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
581
+ } catch (err) {
582
+ const transformedError = (0, import_transform_error.transformError)(
583
+ err,
584
+ {
585
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
586
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
587
+ singleArgumentUnchanged: false
588
+ },
589
+ ["_id", "subscriptionOption"]
590
+ );
591
+ sideEffects?.onError?.(err);
592
+ throw transformedError;
593
+ }
594
+ }
595
+ async function deleteSubscriptionOption2(_id) {
596
+ const { httpClient, sideEffects } = arguments[1];
597
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
598
+ const reqOpts = deleteSubscriptionOption(payload);
599
+ sideEffects?.onSiteCall?.();
600
+ try {
601
+ const result = await httpClient.request(reqOpts);
602
+ sideEffects?.onSuccess?.(result);
603
+ } catch (err) {
604
+ const transformedError = (0, import_transform_error.transformError)(
605
+ err,
606
+ {
607
+ spreadPathsToArguments: {},
608
+ explicitPathsToArguments: { id: "$[0]" },
609
+ singleArgumentUnchanged: false
610
+ },
611
+ ["_id"]
612
+ );
613
+ sideEffects?.onError?.(err);
614
+ throw transformedError;
615
+ }
616
+ }
617
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
618
+ const { httpClient, sideEffects } = arguments[1];
619
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
620
+ subscriptionOptions
621
+ });
622
+ const reqOpts = bulkCreateSubscriptionOptions(
623
+ payload
624
+ );
625
+ sideEffects?.onSiteCall?.();
626
+ try {
627
+ const result = await httpClient.request(reqOpts);
628
+ sideEffects?.onSuccess?.(result);
629
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
630
+ } catch (err) {
631
+ const transformedError = (0, import_transform_error.transformError)(
632
+ err,
633
+ {
634
+ spreadPathsToArguments: {},
635
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
636
+ singleArgumentUnchanged: false
637
+ },
638
+ ["subscriptionOptions"]
639
+ );
640
+ sideEffects?.onError?.(err);
641
+ throw transformedError;
642
+ }
643
+ }
644
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
645
+ const { httpClient, sideEffects } = arguments[1];
646
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
647
+ subscriptionOptions
648
+ });
649
+ const reqOpts = bulkUpdateSubscriptionOptions(
650
+ payload
651
+ );
652
+ sideEffects?.onSiteCall?.();
653
+ try {
654
+ const result = await httpClient.request(reqOpts);
655
+ sideEffects?.onSuccess?.(result);
656
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
657
+ } catch (err) {
658
+ const transformedError = (0, import_transform_error.transformError)(
659
+ err,
660
+ {
661
+ spreadPathsToArguments: {},
662
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
663
+ singleArgumentUnchanged: false
664
+ },
665
+ ["subscriptionOptions"]
666
+ );
667
+ sideEffects?.onError?.(err);
668
+ throw transformedError;
669
+ }
670
+ }
671
+ async function bulkDeleteSubscriptionOptions2(ids) {
672
+ const { httpClient, sideEffects } = arguments[1];
673
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
674
+ const reqOpts = bulkDeleteSubscriptionOptions(
675
+ payload
676
+ );
677
+ sideEffects?.onSiteCall?.();
678
+ try {
679
+ const result = await httpClient.request(reqOpts);
680
+ sideEffects?.onSuccess?.(result);
681
+ } catch (err) {
682
+ const transformedError = (0, import_transform_error.transformError)(
683
+ err,
684
+ {
685
+ spreadPathsToArguments: {},
686
+ explicitPathsToArguments: { ids: "$[0]" },
687
+ singleArgumentUnchanged: false
688
+ },
689
+ ["ids"]
690
+ );
691
+ sideEffects?.onError?.(err);
692
+ throw transformedError;
693
+ }
694
+ }
695
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
696
+ const { httpClient, sideEffects } = arguments[2];
697
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
698
+ productId,
699
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
700
+ });
701
+ const reqOpts = assignSubscriptionOptionsToProduct(
702
+ payload
703
+ );
704
+ sideEffects?.onSiteCall?.();
705
+ try {
706
+ const result = await httpClient.request(reqOpts);
707
+ sideEffects?.onSuccess?.(result);
708
+ } catch (err) {
709
+ const transformedError = (0, import_transform_error.transformError)(
710
+ err,
711
+ {
712
+ spreadPathsToArguments: {},
713
+ explicitPathsToArguments: {
714
+ productId: "$[0]",
715
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
716
+ },
717
+ singleArgumentUnchanged: false
718
+ },
719
+ ["productId", "options"]
720
+ );
721
+ sideEffects?.onError?.(err);
722
+ throw transformedError;
723
+ }
724
+ }
725
+ async function allowOneTimePurchases2(productId, allowed) {
726
+ const { httpClient, sideEffects } = arguments[2];
727
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
728
+ productId,
729
+ allowed
730
+ });
731
+ const reqOpts = allowOneTimePurchases(payload);
732
+ sideEffects?.onSiteCall?.();
733
+ try {
734
+ const result = await httpClient.request(reqOpts);
735
+ sideEffects?.onSuccess?.(result);
736
+ } catch (err) {
737
+ const transformedError = (0, import_transform_error.transformError)(
738
+ err,
739
+ {
740
+ spreadPathsToArguments: {},
741
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
742
+ singleArgumentUnchanged: false
743
+ },
744
+ ["productId", "allowed"]
745
+ );
746
+ sideEffects?.onError?.(err);
747
+ throw transformedError;
748
+ }
749
+ }
750
+ // Annotate the CommonJS export names for ESM import in node:
751
+ 0 && (module.exports = {
752
+ DiscountType,
753
+ SubscriptionFrequency,
754
+ allowOneTimePurchases,
755
+ assignSubscriptionOptionsToProduct,
756
+ bulkCreateSubscriptionOptions,
757
+ bulkDeleteSubscriptionOptions,
758
+ bulkUpdateSubscriptionOptions,
759
+ createSubscriptionOption,
760
+ deleteSubscriptionOption,
761
+ getOneTimePurchasesStatus,
762
+ getProductIdsForSubscriptionOption,
763
+ getSubscriptionOption,
764
+ getSubscriptionOptionsForProduct,
765
+ updateSubscriptionOption
766
+ });
767
+ //# sourceMappingURL=index.typings.js.map