@wix/auto_sdk_stores_subscription-options 1.0.61 → 1.0.63

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 (49) hide show
  1. package/build/cjs/index.d.ts +53 -77
  2. package/build/cjs/index.js +288 -738
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +157 -157
  5. package/build/cjs/index.typings.js +236 -686
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +108 -108
  8. package/build/cjs/meta.js +204 -204
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/schemas.d.ts +84 -84
  11. package/build/cjs/schemas.js +104 -104
  12. package/build/cjs/schemas.js.map +1 -1
  13. package/build/es/index.d.mts +53 -77
  14. package/build/es/index.mjs +288 -728
  15. package/build/es/index.mjs.map +1 -1
  16. package/build/es/index.typings.d.mts +157 -157
  17. package/build/es/index.typings.mjs +236 -676
  18. package/build/es/index.typings.mjs.map +1 -1
  19. package/build/es/meta.d.mts +108 -108
  20. package/build/es/meta.mjs +204 -204
  21. package/build/es/meta.mjs.map +1 -1
  22. package/build/es/schemas.d.mts +84 -84
  23. package/build/es/schemas.mjs +104 -104
  24. package/build/es/schemas.mjs.map +1 -1
  25. package/build/internal/cjs/index.d.ts +53 -77
  26. package/build/internal/cjs/index.js +288 -738
  27. package/build/internal/cjs/index.js.map +1 -1
  28. package/build/internal/cjs/index.typings.d.ts +157 -157
  29. package/build/internal/cjs/index.typings.js +236 -686
  30. package/build/internal/cjs/index.typings.js.map +1 -1
  31. package/build/internal/cjs/meta.d.ts +108 -108
  32. package/build/internal/cjs/meta.js +204 -204
  33. package/build/internal/cjs/meta.js.map +1 -1
  34. package/build/internal/cjs/schemas.d.ts +84 -84
  35. package/build/internal/cjs/schemas.js +104 -104
  36. package/build/internal/cjs/schemas.js.map +1 -1
  37. package/build/internal/es/index.d.mts +53 -77
  38. package/build/internal/es/index.mjs +288 -728
  39. package/build/internal/es/index.mjs.map +1 -1
  40. package/build/internal/es/index.typings.d.mts +157 -157
  41. package/build/internal/es/index.typings.mjs +236 -676
  42. package/build/internal/es/index.typings.mjs.map +1 -1
  43. package/build/internal/es/meta.d.mts +108 -108
  44. package/build/internal/es/meta.mjs +204 -204
  45. package/build/internal/es/meta.mjs.map +1 -1
  46. package/build/internal/es/schemas.d.mts +84 -84
  47. package/build/internal/es/schemas.mjs +104 -104
  48. package/build/internal/es/schemas.mjs.map +1 -1
  49. package/package.json +2 -2
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // index.typings.ts
@@ -57,35 +47,6 @@ var import_float = require("@wix/sdk-runtime/transformations/float");
57
47
  var import_float2 = require("@wix/sdk-runtime/transformations/float");
58
48
  var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
59
49
  var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
60
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
61
- const domainToMappings = {
62
- "api._api_base_domain_": [
63
- {
64
- srcPath: "/wix-ecommerce-plans-reader",
65
- destPath: ""
66
- }
67
- ],
68
- "www._base_domain_": [
69
- {
70
- srcPath: "/_api/wix-ecommerce-plans-reader",
71
- destPath: ""
72
- }
73
- ],
74
- _: [
75
- {
76
- srcPath: "/_api/subscription-options-reader-server",
77
- destPath: ""
78
- }
79
- ],
80
- "manage._base_domain_": [
81
- {
82
- srcPath: "/_api/subscription-options-reader-server",
83
- destPath: ""
84
- }
85
- ]
86
- };
87
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
88
- }
89
50
  function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
90
51
  const domainToMappings = {
91
52
  "api._api_base_domain_": [
@@ -133,7 +94,136 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUr
133
94
  };
134
95
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
135
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
+ }
136
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
+ migrationOptions: {
135
+ optInTransformResponse: true
136
+ },
137
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
138
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
139
+ ),
140
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
141
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
142
+ {
143
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
144
+ paths: [{ path: "subscriptionOption.discount.value" }]
145
+ }
146
+ ])
147
+ };
148
+ return metadata;
149
+ }
150
+ return __getSubscriptionOption;
151
+ }
152
+ function getSubscriptionOptionsForProduct(payload) {
153
+ function __getSubscriptionOptionsForProduct({ host }) {
154
+ const metadata = {
155
+ entityFqdn: "wix.stores.v1.subscription_option",
156
+ method: "GET",
157
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
158
+ packageName: PACKAGE_NAME,
159
+ migrationOptions: {
160
+ optInTransformResponse: true
161
+ },
162
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
163
+ {
164
+ protoPath: "/v1/subscription-options/byProduct/{productId}",
165
+ data: payload,
166
+ host
167
+ }
168
+ ),
169
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
170
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
171
+ {
172
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
173
+ paths: [{ path: "subscriptionOptions.discount.value" }]
174
+ }
175
+ ])
176
+ };
177
+ return metadata;
178
+ }
179
+ return __getSubscriptionOptionsForProduct;
180
+ }
181
+ function getProductIdsForSubscriptionOption(payload) {
182
+ function __getProductIdsForSubscriptionOption({ host }) {
183
+ const metadata = {
184
+ entityFqdn: "wix.stores.v1.subscription_option",
185
+ method: "GET",
186
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
187
+ packageName: PACKAGE_NAME,
188
+ migrationOptions: {
189
+ optInTransformResponse: true
190
+ },
191
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
192
+ {
193
+ protoPath: "/v1/subscription-options/{id}/productIds",
194
+ data: payload,
195
+ host
196
+ }
197
+ ),
198
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
199
+ };
200
+ return metadata;
201
+ }
202
+ return __getProductIdsForSubscriptionOption;
203
+ }
204
+ function getOneTimePurchasesStatus(payload) {
205
+ function __getOneTimePurchasesStatus({ host }) {
206
+ const metadata = {
207
+ entityFqdn: "wix.stores.v1.subscription_option",
208
+ method: "GET",
209
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
210
+ packageName: PACKAGE_NAME,
211
+ migrationOptions: {
212
+ optInTransformResponse: true
213
+ },
214
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
215
+ {
216
+ protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
217
+ data: payload,
218
+ host
219
+ }
220
+ ),
221
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
222
+ };
223
+ return metadata;
224
+ }
225
+ return __getOneTimePurchasesStatus;
226
+ }
137
227
  function createSubscriptionOption(payload) {
138
228
  function __createSubscriptionOption({ host }) {
139
229
  const serializedData = (0, import_transform_paths.transformPaths)(payload, [
@@ -360,507 +450,6 @@ function allowOneTimePurchases(payload) {
360
450
  }
361
451
  return __allowOneTimePurchases;
362
452
  }
363
- function getSubscriptionOption(payload) {
364
- function __getSubscriptionOption({ host }) {
365
- const metadata = {
366
- entityFqdn: "wix.stores.v1.subscription_option",
367
- method: "GET",
368
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
369
- packageName: PACKAGE_NAME,
370
- migrationOptions: {
371
- optInTransformResponse: true
372
- },
373
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
374
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
375
- ),
376
- params: (0, import_rest_modules.toURLSearchParams)(payload),
377
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
378
- {
379
- transformFn: import_float2.transformRESTFloatToSDKFloat,
380
- paths: [{ path: "subscriptionOption.discount.value" }]
381
- }
382
- ])
383
- };
384
- return metadata;
385
- }
386
- return __getSubscriptionOption;
387
- }
388
- function getSubscriptionOptionsForProduct(payload) {
389
- function __getSubscriptionOptionsForProduct({ host }) {
390
- const metadata = {
391
- entityFqdn: "wix.stores.v1.subscription_option",
392
- method: "GET",
393
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
394
- packageName: PACKAGE_NAME,
395
- migrationOptions: {
396
- optInTransformResponse: true
397
- },
398
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
399
- {
400
- protoPath: "/v1/subscription-options/byProduct/{productId}",
401
- data: payload,
402
- host
403
- }
404
- ),
405
- params: (0, import_rest_modules.toURLSearchParams)(payload),
406
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
407
- {
408
- transformFn: import_float2.transformRESTFloatToSDKFloat,
409
- paths: [{ path: "subscriptionOptions.discount.value" }]
410
- }
411
- ])
412
- };
413
- return metadata;
414
- }
415
- return __getSubscriptionOptionsForProduct;
416
- }
417
- function getProductIdsForSubscriptionOption(payload) {
418
- function __getProductIdsForSubscriptionOption({ host }) {
419
- const metadata = {
420
- entityFqdn: "wix.stores.v1.subscription_option",
421
- method: "GET",
422
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
423
- packageName: PACKAGE_NAME,
424
- migrationOptions: {
425
- optInTransformResponse: true
426
- },
427
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
428
- {
429
- protoPath: "/v1/subscription-options/{id}/productIds",
430
- data: payload,
431
- host
432
- }
433
- ),
434
- params: (0, import_rest_modules.toURLSearchParams)(payload)
435
- };
436
- return metadata;
437
- }
438
- return __getProductIdsForSubscriptionOption;
439
- }
440
- function getOneTimePurchasesStatus(payload) {
441
- function __getOneTimePurchasesStatus({ host }) {
442
- const metadata = {
443
- entityFqdn: "wix.stores.v1.subscription_option",
444
- method: "GET",
445
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
446
- packageName: PACKAGE_NAME,
447
- migrationOptions: {
448
- optInTransformResponse: true
449
- },
450
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
451
- {
452
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
453
- data: payload,
454
- host
455
- }
456
- ),
457
- params: (0, import_rest_modules.toURLSearchParams)(payload)
458
- };
459
- return metadata;
460
- }
461
- return __getOneTimePurchasesStatus;
462
- }
463
-
464
- // src/stores-v1-subscription-option-subscription-options.schemas.ts
465
- var z = __toESM(require("zod"));
466
- var CreateSubscriptionOptionRequest = z.object({
467
- subscriptionOption: z.object({
468
- _id: z.string().describe(
469
- "Subscription option ID (auto-generated upon subscription option creation)."
470
- ).regex(
471
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
472
- "Must be a valid GUID"
473
- ).optional().nullable(),
474
- title: z.string().describe("Subscription option title.").min(1).max(20),
475
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
476
- subscriptionSettings: z.object({
477
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
478
- autoRenewal: z.boolean().describe(
479
- "Whether subscription is renewed automatically at the end of each period."
480
- ).optional(),
481
- billingCycles: z.number().int().describe(
482
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
483
- ).min(2).max(999).optional().nullable()
484
- }).describe(
485
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
486
- ),
487
- discount: z.object({
488
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).optional(),
489
- value: z.number().describe("Discount value.").min(0).optional()
490
- }).describe(
491
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
492
- ).optional()
493
- }).describe("Subscription option info.")
494
- });
495
- var CreateSubscriptionOptionResponse = z.object({
496
- _id: z.string().describe(
497
- "Subscription option ID (auto-generated upon subscription option creation)."
498
- ).regex(
499
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
500
- "Must be a valid GUID"
501
- ).optional().nullable(),
502
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
503
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
504
- subscriptionSettings: z.object({
505
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Frequency of recurring payment.").optional(),
506
- autoRenewal: z.boolean().describe(
507
- "Whether subscription is renewed automatically at the end of each period."
508
- ).optional(),
509
- billingCycles: z.number().int().describe(
510
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
511
- ).min(2).max(999).optional().nullable()
512
- }).describe(
513
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
514
- ).optional(),
515
- discount: z.object({
516
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).describe("Discount type.").optional(),
517
- value: z.number().describe("Discount value.").min(0).optional()
518
- }).describe(
519
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
520
- ).optional()
521
- });
522
- var UpdateSubscriptionOptionRequest = z.object({
523
- _id: z.string().describe(
524
- "Subscription option ID (auto-generated upon subscription option creation)."
525
- ).regex(
526
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
527
- "Must be a valid GUID"
528
- ),
529
- subscriptionOption: z.object({
530
- _id: z.string().describe(
531
- "Subscription option ID (auto-generated upon subscription option creation)."
532
- ).regex(
533
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
534
- "Must be a valid GUID"
535
- ).optional().nullable(),
536
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
537
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
538
- subscriptionSettings: z.object({
539
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
540
- autoRenewal: z.boolean().describe(
541
- "Whether subscription is renewed automatically at the end of each period."
542
- ).optional(),
543
- billingCycles: z.number().int().describe(
544
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
545
- ).min(2).max(999).optional().nullable()
546
- }).describe(
547
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
548
- ).optional(),
549
- discount: z.object({
550
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).optional(),
551
- value: z.number().describe("Discount value.").min(0).optional()
552
- }).describe(
553
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
554
- ).optional()
555
- }).describe("Subscription option update options.")
556
- });
557
- var UpdateSubscriptionOptionResponse = z.object({
558
- _id: z.string().describe(
559
- "Subscription option ID (auto-generated upon subscription option creation)."
560
- ).regex(
561
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
562
- "Must be a valid GUID"
563
- ).optional().nullable(),
564
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
565
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
566
- subscriptionSettings: z.object({
567
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Frequency of recurring payment.").optional(),
568
- autoRenewal: z.boolean().describe(
569
- "Whether subscription is renewed automatically at the end of each period."
570
- ).optional(),
571
- billingCycles: z.number().int().describe(
572
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
573
- ).min(2).max(999).optional().nullable()
574
- }).describe(
575
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
576
- ).optional(),
577
- discount: z.object({
578
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).describe("Discount type.").optional(),
579
- value: z.number().describe("Discount value.").min(0).optional()
580
- }).describe(
581
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
582
- ).optional()
583
- });
584
- var DeleteSubscriptionOptionRequest = z.object({
585
- _id: z.string().describe("ID of the subscription option to delete.").min(1).regex(
586
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
587
- "Must be a valid GUID"
588
- )
589
- });
590
- var DeleteSubscriptionOptionResponse = z.object({});
591
- var BulkCreateSubscriptionOptionsRequest = z.object({
592
- subscriptionOptions: z.array(
593
- z.object({
594
- _id: z.string().describe(
595
- "Subscription option ID (auto-generated upon subscription option creation)."
596
- ).regex(
597
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
598
- "Must be a valid GUID"
599
- ).optional().nullable(),
600
- title: z.string().describe("Subscription option title.").min(1).max(20),
601
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
602
- subscriptionSettings: z.object({
603
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
604
- autoRenewal: z.boolean().describe(
605
- "Whether subscription is renewed automatically at the end of each period."
606
- ).optional(),
607
- billingCycles: z.number().int().describe(
608
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
609
- ).min(2).max(999).optional().nullable()
610
- }).describe(
611
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
612
- ),
613
- discount: z.object({
614
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).optional(),
615
- value: z.number().describe("Discount value.").min(0).optional()
616
- }).describe(
617
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
618
- ).optional()
619
- })
620
- ).max(100)
621
- });
622
- var BulkCreateSubscriptionOptionsResponse = z.object({
623
- subscriptionOptions: z.array(
624
- z.object({
625
- _id: z.string().describe(
626
- "Subscription option ID (auto-generated upon subscription option creation)."
627
- ).regex(
628
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
629
- "Must be a valid GUID"
630
- ).optional().nullable(),
631
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
632
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
633
- subscriptionSettings: z.object({
634
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Frequency of recurring payment.").optional(),
635
- autoRenewal: z.boolean().describe(
636
- "Whether subscription is renewed automatically at the end of each period."
637
- ).optional(),
638
- billingCycles: z.number().int().describe(
639
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
640
- ).min(2).max(999).optional().nullable()
641
- }).describe(
642
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
643
- ).optional(),
644
- discount: z.object({
645
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).describe("Discount type.").optional(),
646
- value: z.number().describe("Discount value.").min(0).optional()
647
- }).describe(
648
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
649
- ).optional()
650
- })
651
- ).optional()
652
- });
653
- var BulkUpdateSubscriptionOptionsRequest = z.object({
654
- subscriptionOptions: z.array(
655
- z.object({
656
- _id: z.string().describe(
657
- "Subscription option ID (auto-generated upon subscription option creation)."
658
- ).regex(
659
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
660
- "Must be a valid GUID"
661
- ),
662
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
663
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
664
- subscriptionSettings: z.object({
665
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
666
- autoRenewal: z.boolean().describe(
667
- "Whether subscription is renewed automatically at the end of each period."
668
- ).optional(),
669
- billingCycles: z.number().int().describe(
670
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
671
- ).min(2).max(999).optional().nullable()
672
- }).describe(
673
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
674
- ).optional(),
675
- discount: z.object({
676
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).optional(),
677
- value: z.number().describe("Discount value.").min(0).optional()
678
- }).describe(
679
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
680
- ).optional()
681
- })
682
- ).max(100)
683
- });
684
- var BulkUpdateSubscriptionOptionsResponse = z.object({
685
- subscriptionOptions: z.array(
686
- z.object({
687
- _id: z.string().describe(
688
- "Subscription option ID (auto-generated upon subscription option creation)."
689
- ).regex(
690
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
691
- "Must be a valid GUID"
692
- ).optional().nullable(),
693
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
694
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
695
- subscriptionSettings: z.object({
696
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Frequency of recurring payment.").optional(),
697
- autoRenewal: z.boolean().describe(
698
- "Whether subscription is renewed automatically at the end of each period."
699
- ).optional(),
700
- billingCycles: z.number().int().describe(
701
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
702
- ).min(2).max(999).optional().nullable()
703
- }).describe(
704
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
705
- ).optional(),
706
- discount: z.object({
707
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).describe("Discount type.").optional(),
708
- value: z.number().describe("Discount value.").min(0).optional()
709
- }).describe(
710
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
711
- ).optional()
712
- })
713
- ).optional()
714
- });
715
- var BulkDeleteSubscriptionOptionsRequest = z.object({
716
- ids: z.array(z.string()).max(100)
717
- });
718
- var BulkDeleteSubscriptionOptionsResponse = z.object({});
719
- var AssignSubscriptionOptionsToProductRequest = z.object({
720
- productId: z.string().describe("Product ID.").min(1),
721
- options: z.object({
722
- assignedSubscriptionOptions: z.array(
723
- z.object({
724
- _id: z.string().describe("Subscription option ID.").regex(
725
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
726
- "Must be a valid GUID"
727
- ).optional(),
728
- hidden: z.boolean().describe(
729
- "Whether the subscription option is hidden for the product (the default is false)."
730
- ).optional(),
731
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
732
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
733
- subscriptionSettings: z.object({
734
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
735
- autoRenewal: z.boolean().describe(
736
- "Whether subscription is renewed automatically at the end of each period."
737
- ).optional(),
738
- billingCycles: z.number().int().describe(
739
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
740
- ).min(2).max(999).optional().nullable()
741
- }).describe(
742
- "Subscription payment settings. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
743
- ).optional(),
744
- discount: z.object({
745
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).optional(),
746
- value: z.number().describe("Discount value.").min(0).optional()
747
- }).describe("Discount info (optional).").optional()
748
- })
749
- ).max(6).optional()
750
- }).describe("Subscription option assignment options.").optional()
751
- });
752
- var AssignSubscriptionOptionsToProductResponse = z.object({});
753
- var AllowOneTimePurchasesRequest = z.object({
754
- productId: z.string().describe("Product ID.").min(1),
755
- allowed: z.boolean().describe(
756
- "Pass `true` to offer product by subscription and as one-time purchase. Pass `false` to offer product as subscription only."
757
- )
758
- });
759
- var AllowOneTimePurchasesResponse = z.object({});
760
- var GetSubscriptionOptionRequest = z.object({
761
- _id: z.string().describe("Subscription option ID.").min(1).regex(
762
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
763
- "Must be a valid GUID"
764
- )
765
- });
766
- var GetSubscriptionOptionResponse = z.object({
767
- _id: z.string().describe(
768
- "Subscription option ID (auto-generated upon subscription option creation)."
769
- ).regex(
770
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
771
- "Must be a valid GUID"
772
- ).optional().nullable(),
773
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
774
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
775
- subscriptionSettings: z.object({
776
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Frequency of recurring payment.").optional(),
777
- autoRenewal: z.boolean().describe(
778
- "Whether subscription is renewed automatically at the end of each period."
779
- ).optional(),
780
- billingCycles: z.number().int().describe(
781
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
782
- ).min(2).max(999).optional().nullable()
783
- }).describe(
784
- "Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
785
- ).optional(),
786
- discount: z.object({
787
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).describe("Discount type.").optional(),
788
- value: z.number().describe("Discount value.").min(0).optional()
789
- }).describe(
790
- "Discount info (optional).\nFor example, a $20 discount would be `value: 20`, `type: AMOUNT`."
791
- ).optional()
792
- });
793
- var GetSubscriptionOptionsForProductRequest = z.object({
794
- productId: z.string().describe("Product ID.").min(1),
795
- options: z.object({
796
- includeHiddenSubscriptionOptions: z.boolean().describe(
797
- "Whether to include hidden subscription options in the results."
798
- ).optional()
799
- }).describe("Options.").optional()
800
- });
801
- var GetSubscriptionOptionsForProductResponse = z.object({
802
- subscriptionOptions: z.array(
803
- z.object({
804
- _id: z.string().describe("Subscription option ID.").regex(
805
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
806
- "Must be a valid GUID"
807
- ).optional(),
808
- hidden: z.boolean().describe(
809
- "Whether the subscription option is hidden for the product (the default is false)."
810
- ).optional(),
811
- title: z.string().describe("Subscription option title.").min(1).max(20).optional().nullable(),
812
- description: z.string().describe("Subscription option description (optional).").max(60).optional().nullable(),
813
- subscriptionSettings: z.object({
814
- frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Frequency of recurring payment.").optional(),
815
- autoRenewal: z.boolean().describe(
816
- "Whether subscription is renewed automatically at the end of each period."
817
- ).optional(),
818
- billingCycles: z.number().int().describe(
819
- "Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`."
820
- ).min(2).max(999).optional().nullable()
821
- }).describe(
822
- "Subscription payment settings. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months."
823
- ).optional(),
824
- discount: z.object({
825
- type: z.enum(["UNDEFINED", "AMOUNT", "PERCENT"]).describe("Discount type.").optional(),
826
- value: z.number().describe("Discount value.").min(0).optional()
827
- }).describe("Discount info (optional).").optional()
828
- })
829
- ).optional()
830
- });
831
- var GetProductIdsForSubscriptionOptionRequest = z.object({
832
- _id: z.string().describe("Subscription option ID.").min(1).regex(
833
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
834
- "Must be a valid GUID"
835
- ),
836
- options: z.object({
837
- includeHiddenProducts: z.boolean().describe("Whether to include hidden products in the returned results.").optional(),
838
- paging: z.object({
839
- limit: z.number().int().describe("Amount of items to load per page.").min(0).max(100).optional().nullable(),
840
- offset: z.number().int().describe(
841
- "Number of items to skip in the display (relevant for all pages after the first)."
842
- ).min(0).optional().nullable()
843
- }).describe("Optional pagination parameters").optional()
844
- }).describe("Paging and other options.").optional()
845
- });
846
- var GetProductIdsForSubscriptionOptionResponse = z.object({
847
- productIds: z.array(z.string()).optional(),
848
- metadata: z.object({
849
- items: z.number().int().describe("Amount of items to load per page.").optional(),
850
- offset: z.number().int().describe(
851
- "Number of items to skip in the display (relevant for all pages after the first)."
852
- ).optional()
853
- }).describe("Paging metadata.").optional(),
854
- totalResults: z.number().int().describe("Number of total results.").optional()
855
- });
856
- var GetOneTimePurchasesStatusRequest = z.object({
857
- productId: z.string().describe("Product ID.").min(1)
858
- });
859
- var GetOneTimePurchasesStatusResponse = z.object({
860
- allowed: z.boolean().describe(
861
- "Whether the specified product is available for one-time purchase"
862
- ).optional()
863
- });
864
453
 
865
454
  // src/stores-v1-subscription-option-subscription-options.universal.ts
866
455
  var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
@@ -877,15 +466,10 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
877
466
  DiscountType2["PERCENT"] = "PERCENT";
878
467
  return DiscountType2;
879
468
  })(DiscountType || {});
880
- async function createSubscriptionOption2(subscriptionOption) {
881
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
882
- if (validateRequestSchema) {
883
- CreateSubscriptionOptionRequest.parse({ subscriptionOption });
884
- }
885
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
886
- subscriptionOption
887
- });
888
- const reqOpts = createSubscriptionOption(payload);
469
+ async function getSubscriptionOption2(_id) {
470
+ const { httpClient, sideEffects } = arguments[1];
471
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
472
+ const reqOpts = getSubscriptionOption(payload);
889
473
  sideEffects?.onSiteCall?.();
890
474
  try {
891
475
  const result = await httpClient.request(reqOpts);
@@ -896,79 +480,85 @@ async function createSubscriptionOption2(subscriptionOption) {
896
480
  err,
897
481
  {
898
482
  spreadPathsToArguments: {},
899
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
483
+ explicitPathsToArguments: { id: "$[0]" },
900
484
  singleArgumentUnchanged: false
901
485
  },
902
- ["subscriptionOption"]
486
+ ["_id"]
903
487
  );
904
488
  sideEffects?.onError?.(err);
905
489
  throw transformedError;
906
490
  }
907
491
  }
908
- async function updateSubscriptionOption2(_id, subscriptionOption) {
909
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
910
- if (validateRequestSchema) {
911
- UpdateSubscriptionOptionRequest.parse({ _id, subscriptionOption });
912
- }
492
+ async function getSubscriptionOptionsForProduct2(productId, options) {
493
+ const { httpClient, sideEffects } = arguments[2];
913
494
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
914
- subscriptionOption: { ...subscriptionOption, id: _id }
495
+ productId,
496
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
915
497
  });
916
- const reqOpts = updateSubscriptionOption(payload);
498
+ const reqOpts = getSubscriptionOptionsForProduct(
499
+ payload
500
+ );
917
501
  sideEffects?.onSiteCall?.();
918
502
  try {
919
503
  const result = await httpClient.request(reqOpts);
920
504
  sideEffects?.onSuccess?.(result);
921
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
505
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
922
506
  } catch (err) {
923
507
  const transformedError = (0, import_transform_error.transformError)(
924
508
  err,
925
509
  {
926
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
927
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
510
+ spreadPathsToArguments: {},
511
+ explicitPathsToArguments: {
512
+ productId: "$[0]",
513
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
514
+ },
928
515
  singleArgumentUnchanged: false
929
516
  },
930
- ["_id", "subscriptionOption"]
517
+ ["productId", "options"]
931
518
  );
932
519
  sideEffects?.onError?.(err);
933
520
  throw transformedError;
934
521
  }
935
522
  }
936
- async function deleteSubscriptionOption2(_id) {
937
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
938
- if (validateRequestSchema) {
939
- DeleteSubscriptionOptionRequest.parse({ _id });
940
- }
941
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
942
- const reqOpts = deleteSubscriptionOption(payload);
523
+ async function getProductIdsForSubscriptionOption2(_id, options) {
524
+ const { httpClient, sideEffects } = arguments[2];
525
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
526
+ id: _id,
527
+ includeHiddenProducts: options?.includeHiddenProducts,
528
+ paging: options?.paging
529
+ });
530
+ const reqOpts = getProductIdsForSubscriptionOption(
531
+ payload
532
+ );
943
533
  sideEffects?.onSiteCall?.();
944
534
  try {
945
535
  const result = await httpClient.request(reqOpts);
946
536
  sideEffects?.onSuccess?.(result);
537
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
947
538
  } catch (err) {
948
539
  const transformedError = (0, import_transform_error.transformError)(
949
540
  err,
950
541
  {
951
542
  spreadPathsToArguments: {},
952
- explicitPathsToArguments: { id: "$[0]" },
543
+ explicitPathsToArguments: {
544
+ id: "$[0]",
545
+ includeHiddenProducts: "$[1].includeHiddenProducts",
546
+ paging: "$[1].paging"
547
+ },
953
548
  singleArgumentUnchanged: false
954
549
  },
955
- ["_id"]
550
+ ["_id", "options"]
956
551
  );
957
552
  sideEffects?.onError?.(err);
958
553
  throw transformedError;
959
554
  }
960
555
  }
961
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
962
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
963
- if (validateRequestSchema) {
964
- BulkCreateSubscriptionOptionsRequest.parse({ subscriptionOptions });
965
- }
556
+ async function getOneTimePurchasesStatus2(productId) {
557
+ const { httpClient, sideEffects } = arguments[1];
966
558
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
967
- subscriptionOptions
559
+ productId
968
560
  });
969
- const reqOpts = bulkCreateSubscriptionOptions(
970
- payload
971
- );
561
+ const reqOpts = getOneTimePurchasesStatus(payload);
972
562
  sideEffects?.onSiteCall?.();
973
563
  try {
974
564
  const result = await httpClient.request(reqOpts);
@@ -979,87 +569,69 @@ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
979
569
  err,
980
570
  {
981
571
  spreadPathsToArguments: {},
982
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
572
+ explicitPathsToArguments: { productId: "$[0]" },
983
573
  singleArgumentUnchanged: false
984
574
  },
985
- ["subscriptionOptions"]
575
+ ["productId"]
986
576
  );
987
577
  sideEffects?.onError?.(err);
988
578
  throw transformedError;
989
579
  }
990
580
  }
991
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
992
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
993
- if (validateRequestSchema) {
994
- BulkUpdateSubscriptionOptionsRequest.parse({ subscriptionOptions });
995
- }
581
+ async function createSubscriptionOption2(subscriptionOption) {
582
+ const { httpClient, sideEffects } = arguments[1];
996
583
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
997
- subscriptionOptions
584
+ subscriptionOption
998
585
  });
999
- const reqOpts = bulkUpdateSubscriptionOptions(
1000
- payload
1001
- );
586
+ const reqOpts = createSubscriptionOption(payload);
1002
587
  sideEffects?.onSiteCall?.();
1003
588
  try {
1004
589
  const result = await httpClient.request(reqOpts);
1005
590
  sideEffects?.onSuccess?.(result);
1006
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
591
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
1007
592
  } catch (err) {
1008
593
  const transformedError = (0, import_transform_error.transformError)(
1009
594
  err,
1010
595
  {
1011
596
  spreadPathsToArguments: {},
1012
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
597
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
1013
598
  singleArgumentUnchanged: false
1014
599
  },
1015
- ["subscriptionOptions"]
600
+ ["subscriptionOption"]
1016
601
  );
1017
602
  sideEffects?.onError?.(err);
1018
603
  throw transformedError;
1019
604
  }
1020
605
  }
1021
- async function bulkDeleteSubscriptionOptions2(ids) {
1022
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
1023
- if (validateRequestSchema) {
1024
- BulkDeleteSubscriptionOptionsRequest.parse({ ids });
1025
- }
1026
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
1027
- const reqOpts = bulkDeleteSubscriptionOptions(
1028
- payload
1029
- );
606
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
607
+ const { httpClient, sideEffects } = arguments[2];
608
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
609
+ subscriptionOption: { ...subscriptionOption, id: _id }
610
+ });
611
+ const reqOpts = updateSubscriptionOption(payload);
1030
612
  sideEffects?.onSiteCall?.();
1031
613
  try {
1032
614
  const result = await httpClient.request(reqOpts);
1033
615
  sideEffects?.onSuccess?.(result);
616
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
1034
617
  } catch (err) {
1035
618
  const transformedError = (0, import_transform_error.transformError)(
1036
619
  err,
1037
620
  {
1038
- spreadPathsToArguments: {},
1039
- explicitPathsToArguments: { ids: "$[0]" },
621
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
622
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
1040
623
  singleArgumentUnchanged: false
1041
624
  },
1042
- ["ids"]
625
+ ["_id", "subscriptionOption"]
1043
626
  );
1044
627
  sideEffects?.onError?.(err);
1045
628
  throw transformedError;
1046
629
  }
1047
630
  }
1048
- async function assignSubscriptionOptionsToProduct2(productId, options) {
1049
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
1050
- if (validateRequestSchema) {
1051
- AssignSubscriptionOptionsToProductRequest.parse({
1052
- productId,
1053
- options
1054
- });
1055
- }
1056
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1057
- productId,
1058
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
1059
- });
1060
- const reqOpts = assignSubscriptionOptionsToProduct(
1061
- payload
1062
- );
631
+ async function deleteSubscriptionOption2(_id) {
632
+ const { httpClient, sideEffects } = arguments[1];
633
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
634
+ const reqOpts = deleteSubscriptionOption(payload);
1063
635
  sideEffects?.onSiteCall?.();
1064
636
  try {
1065
637
  const result = await httpClient.request(reqOpts);
@@ -1069,165 +641,143 @@ async function assignSubscriptionOptionsToProduct2(productId, options) {
1069
641
  err,
1070
642
  {
1071
643
  spreadPathsToArguments: {},
1072
- explicitPathsToArguments: {
1073
- productId: "$[0]",
1074
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
1075
- },
644
+ explicitPathsToArguments: { id: "$[0]" },
1076
645
  singleArgumentUnchanged: false
1077
646
  },
1078
- ["productId", "options"]
647
+ ["_id"]
1079
648
  );
1080
649
  sideEffects?.onError?.(err);
1081
650
  throw transformedError;
1082
651
  }
1083
652
  }
1084
- async function allowOneTimePurchases2(productId, allowed) {
1085
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
1086
- if (validateRequestSchema) {
1087
- AllowOneTimePurchasesRequest.parse({ productId, allowed });
1088
- }
653
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
654
+ const { httpClient, sideEffects } = arguments[1];
1089
655
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1090
- productId,
1091
- allowed
656
+ subscriptionOptions
1092
657
  });
1093
- const reqOpts = allowOneTimePurchases(payload);
658
+ const reqOpts = bulkCreateSubscriptionOptions(
659
+ payload
660
+ );
1094
661
  sideEffects?.onSiteCall?.();
1095
662
  try {
1096
663
  const result = await httpClient.request(reqOpts);
1097
664
  sideEffects?.onSuccess?.(result);
665
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1098
666
  } catch (err) {
1099
667
  const transformedError = (0, import_transform_error.transformError)(
1100
668
  err,
1101
669
  {
1102
670
  spreadPathsToArguments: {},
1103
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
671
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
1104
672
  singleArgumentUnchanged: false
1105
673
  },
1106
- ["productId", "allowed"]
674
+ ["subscriptionOptions"]
1107
675
  );
1108
676
  sideEffects?.onError?.(err);
1109
677
  throw transformedError;
1110
678
  }
1111
679
  }
1112
- async function getSubscriptionOption2(_id) {
1113
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
1114
- if (validateRequestSchema) {
1115
- GetSubscriptionOptionRequest.parse({ _id });
1116
- }
1117
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
1118
- const reqOpts = getSubscriptionOption(payload);
680
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
681
+ const { httpClient, sideEffects } = arguments[1];
682
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
683
+ subscriptionOptions
684
+ });
685
+ const reqOpts = bulkUpdateSubscriptionOptions(
686
+ payload
687
+ );
1119
688
  sideEffects?.onSiteCall?.();
1120
689
  try {
1121
690
  const result = await httpClient.request(reqOpts);
1122
691
  sideEffects?.onSuccess?.(result);
1123
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
692
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1124
693
  } catch (err) {
1125
694
  const transformedError = (0, import_transform_error.transformError)(
1126
695
  err,
1127
696
  {
1128
697
  spreadPathsToArguments: {},
1129
- explicitPathsToArguments: { id: "$[0]" },
698
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
1130
699
  singleArgumentUnchanged: false
1131
700
  },
1132
- ["_id"]
701
+ ["subscriptionOptions"]
1133
702
  );
1134
703
  sideEffects?.onError?.(err);
1135
704
  throw transformedError;
1136
705
  }
1137
706
  }
1138
- async function getSubscriptionOptionsForProduct2(productId, options) {
1139
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
1140
- if (validateRequestSchema) {
1141
- GetSubscriptionOptionsForProductRequest.parse({ productId, options });
1142
- }
1143
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1144
- productId,
1145
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
1146
- });
1147
- const reqOpts = getSubscriptionOptionsForProduct(
707
+ async function bulkDeleteSubscriptionOptions2(ids) {
708
+ const { httpClient, sideEffects } = arguments[1];
709
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
710
+ const reqOpts = bulkDeleteSubscriptionOptions(
1148
711
  payload
1149
712
  );
1150
713
  sideEffects?.onSiteCall?.();
1151
714
  try {
1152
715
  const result = await httpClient.request(reqOpts);
1153
716
  sideEffects?.onSuccess?.(result);
1154
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1155
717
  } catch (err) {
1156
718
  const transformedError = (0, import_transform_error.transformError)(
1157
719
  err,
1158
720
  {
1159
721
  spreadPathsToArguments: {},
1160
- explicitPathsToArguments: {
1161
- productId: "$[0]",
1162
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
1163
- },
722
+ explicitPathsToArguments: { ids: "$[0]" },
1164
723
  singleArgumentUnchanged: false
1165
724
  },
1166
- ["productId", "options"]
725
+ ["ids"]
1167
726
  );
1168
727
  sideEffects?.onError?.(err);
1169
728
  throw transformedError;
1170
729
  }
1171
730
  }
1172
- async function getProductIdsForSubscriptionOption2(_id, options) {
1173
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
1174
- if (validateRequestSchema) {
1175
- GetProductIdsForSubscriptionOptionRequest.parse({ _id, options });
1176
- }
731
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
732
+ const { httpClient, sideEffects } = arguments[2];
1177
733
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1178
- id: _id,
1179
- includeHiddenProducts: options?.includeHiddenProducts,
1180
- paging: options?.paging
734
+ productId,
735
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
1181
736
  });
1182
- const reqOpts = getProductIdsForSubscriptionOption(
737
+ const reqOpts = assignSubscriptionOptionsToProduct(
1183
738
  payload
1184
739
  );
1185
740
  sideEffects?.onSiteCall?.();
1186
741
  try {
1187
742
  const result = await httpClient.request(reqOpts);
1188
743
  sideEffects?.onSuccess?.(result);
1189
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1190
744
  } catch (err) {
1191
745
  const transformedError = (0, import_transform_error.transformError)(
1192
746
  err,
1193
747
  {
1194
748
  spreadPathsToArguments: {},
1195
749
  explicitPathsToArguments: {
1196
- id: "$[0]",
1197
- includeHiddenProducts: "$[1].includeHiddenProducts",
1198
- paging: "$[1].paging"
750
+ productId: "$[0]",
751
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
1199
752
  },
1200
753
  singleArgumentUnchanged: false
1201
754
  },
1202
- ["_id", "options"]
755
+ ["productId", "options"]
1203
756
  );
1204
757
  sideEffects?.onError?.(err);
1205
758
  throw transformedError;
1206
759
  }
1207
760
  }
1208
- async function getOneTimePurchasesStatus2(productId) {
1209
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
1210
- if (validateRequestSchema) {
1211
- GetOneTimePurchasesStatusRequest.parse({ productId });
1212
- }
761
+ async function allowOneTimePurchases2(productId, allowed) {
762
+ const { httpClient, sideEffects } = arguments[2];
1213
763
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1214
- productId
764
+ productId,
765
+ allowed
1215
766
  });
1216
- const reqOpts = getOneTimePurchasesStatus(payload);
767
+ const reqOpts = allowOneTimePurchases(payload);
1217
768
  sideEffects?.onSiteCall?.();
1218
769
  try {
1219
770
  const result = await httpClient.request(reqOpts);
1220
771
  sideEffects?.onSuccess?.(result);
1221
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1222
772
  } catch (err) {
1223
773
  const transformedError = (0, import_transform_error.transformError)(
1224
774
  err,
1225
775
  {
1226
776
  spreadPathsToArguments: {},
1227
- explicitPathsToArguments: { productId: "$[0]" },
777
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
1228
778
  singleArgumentUnchanged: false
1229
779
  },
1230
- ["productId"]
780
+ ["productId", "allowed"]
1231
781
  );
1232
782
  sideEffects?.onError?.(err);
1233
783
  throw transformedError;