@wix/auto_sdk_stores_subscription-options 1.0.59 → 1.0.61

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 +77 -53
  2. package/build/cjs/index.js +736 -286
  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 +686 -236
  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 +77 -53
  14. package/build/es/index.mjs +726 -286
  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 +676 -236
  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 +77 -53
  26. package/build/internal/cjs/index.js +736 -286
  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 +686 -236
  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 +77 -53
  38. package/build/internal/es/index.mjs +726 -286
  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 +676 -236
  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,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
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
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // index.ts
@@ -47,76 +57,76 @@ var import_float = require("@wix/sdk-runtime/transformations/float");
47
57
  var import_float2 = require("@wix/sdk-runtime/transformations/float");
48
58
  var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
49
59
  var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
50
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
60
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
51
61
  const domainToMappings = {
52
62
  "api._api_base_domain_": [
53
63
  {
54
- srcPath: "/wix-ecommerce-plans",
64
+ srcPath: "/wix-ecommerce-plans-reader",
55
65
  destPath: ""
56
66
  }
57
67
  ],
58
- "www.wixapis.com": [
68
+ "www._base_domain_": [
59
69
  {
60
- srcPath: "/stores/v1/subscription-options",
61
- destPath: "/v1/subscription-options"
70
+ srcPath: "/_api/wix-ecommerce-plans-reader",
71
+ destPath: ""
62
72
  }
63
73
  ],
64
- "www._base_domain_": [
74
+ _: [
65
75
  {
66
- srcPath: "/_api/subscription-options-server",
76
+ srcPath: "/_api/subscription-options-reader-server",
67
77
  destPath: ""
68
78
  }
69
79
  ],
70
- "editor._base_domain_": [
80
+ "manage._base_domain_": [
71
81
  {
72
- srcPath: "/_api/subscription-options-server",
82
+ srcPath: "/_api/subscription-options-reader-server",
73
83
  destPath: ""
74
84
  }
75
- ],
76
- "blocks._base_domain_": [
85
+ ]
86
+ };
87
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
88
+ }
89
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
90
+ const domainToMappings = {
91
+ "api._api_base_domain_": [
77
92
  {
78
- srcPath: "/_api/subscription-options-server",
93
+ srcPath: "/wix-ecommerce-plans",
79
94
  destPath: ""
80
95
  }
81
96
  ],
82
- "create.editorx": [
97
+ "www.wixapis.com": [
83
98
  {
84
- srcPath: "/_api/subscription-options-server",
85
- destPath: ""
99
+ srcPath: "/stores/v1/subscription-options",
100
+ destPath: "/v1/subscription-options"
86
101
  }
87
102
  ],
88
- "manage._base_domain_": [
103
+ "www._base_domain_": [
89
104
  {
90
105
  srcPath: "/_api/subscription-options-server",
91
106
  destPath: ""
92
107
  }
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_": [
108
+ ],
109
+ "editor._base_domain_": [
100
110
  {
101
- srcPath: "/wix-ecommerce-plans-reader",
111
+ srcPath: "/_api/subscription-options-server",
102
112
  destPath: ""
103
113
  }
104
114
  ],
105
- "www._base_domain_": [
115
+ "blocks._base_domain_": [
106
116
  {
107
- srcPath: "/_api/wix-ecommerce-plans-reader",
117
+ srcPath: "/_api/subscription-options-server",
108
118
  destPath: ""
109
119
  }
110
120
  ],
111
- _: [
121
+ "create.editorx": [
112
122
  {
113
- srcPath: "/_api/subscription-options-reader-server",
123
+ srcPath: "/_api/subscription-options-server",
114
124
  destPath: ""
115
125
  }
116
126
  ],
117
127
  "manage._base_domain_": [
118
128
  {
119
- srcPath: "/_api/subscription-options-reader-server",
129
+ srcPath: "/_api/subscription-options-server",
120
130
  destPath: ""
121
131
  }
122
132
  ]
@@ -124,106 +134,6 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl
124
134
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
125
135
  }
126
136
  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
- }
227
137
  function createSubscriptionOption(payload) {
228
138
  function __createSubscriptionOption({ host }) {
229
139
  const serializedData = (0, import_transform_paths.transformPaths)(payload, [
@@ -450,6 +360,507 @@ function allowOneTimePurchases(payload) {
450
360
  }
451
361
  return __allowOneTimePurchases;
452
362
  }
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
+ });
453
864
 
454
865
  // src/stores-v1-subscription-option-subscription-options.universal.ts
455
866
  var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
@@ -466,10 +877,15 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
466
877
  DiscountType2["PERCENT"] = "PERCENT";
467
878
  return DiscountType2;
468
879
  })(DiscountType || {});
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);
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);
473
889
  sideEffects?.onSiteCall?.();
474
890
  try {
475
891
  const result = await httpClient.request(reqOpts);
@@ -480,85 +896,79 @@ async function getSubscriptionOption2(_id) {
480
896
  err,
481
897
  {
482
898
  spreadPathsToArguments: {},
483
- explicitPathsToArguments: { id: "$[0]" },
899
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
484
900
  singleArgumentUnchanged: false
485
901
  },
486
- ["_id"]
902
+ ["subscriptionOption"]
487
903
  );
488
904
  sideEffects?.onError?.(err);
489
905
  throw transformedError;
490
906
  }
491
907
  }
492
- async function getSubscriptionOptionsForProduct2(productId, options) {
493
- const { httpClient, sideEffects } = arguments[2];
908
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
909
+ const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
910
+ if (validateRequestSchema) {
911
+ UpdateSubscriptionOptionRequest.parse({ _id, subscriptionOption });
912
+ }
494
913
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
495
- productId,
496
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
914
+ subscriptionOption: { ...subscriptionOption, id: _id }
497
915
  });
498
- const reqOpts = getSubscriptionOptionsForProduct(
499
- payload
500
- );
916
+ const reqOpts = updateSubscriptionOption(payload);
501
917
  sideEffects?.onSiteCall?.();
502
918
  try {
503
919
  const result = await httpClient.request(reqOpts);
504
920
  sideEffects?.onSuccess?.(result);
505
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
921
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
506
922
  } catch (err) {
507
923
  const transformedError = (0, import_transform_error.transformError)(
508
924
  err,
509
925
  {
510
- spreadPathsToArguments: {},
511
- explicitPathsToArguments: {
512
- productId: "$[0]",
513
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
514
- },
926
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
927
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
515
928
  singleArgumentUnchanged: false
516
929
  },
517
- ["productId", "options"]
930
+ ["_id", "subscriptionOption"]
518
931
  );
519
932
  sideEffects?.onError?.(err);
520
933
  throw transformedError;
521
934
  }
522
935
  }
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
- );
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);
533
943
  sideEffects?.onSiteCall?.();
534
944
  try {
535
945
  const result = await httpClient.request(reqOpts);
536
946
  sideEffects?.onSuccess?.(result);
537
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
538
947
  } catch (err) {
539
948
  const transformedError = (0, import_transform_error.transformError)(
540
949
  err,
541
950
  {
542
951
  spreadPathsToArguments: {},
543
- explicitPathsToArguments: {
544
- id: "$[0]",
545
- includeHiddenProducts: "$[1].includeHiddenProducts",
546
- paging: "$[1].paging"
547
- },
952
+ explicitPathsToArguments: { id: "$[0]" },
548
953
  singleArgumentUnchanged: false
549
954
  },
550
- ["_id", "options"]
955
+ ["_id"]
551
956
  );
552
957
  sideEffects?.onError?.(err);
553
958
  throw transformedError;
554
959
  }
555
960
  }
556
- async function getOneTimePurchasesStatus2(productId) {
557
- const { httpClient, sideEffects } = arguments[1];
961
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
962
+ const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
963
+ if (validateRequestSchema) {
964
+ BulkCreateSubscriptionOptionsRequest.parse({ subscriptionOptions });
965
+ }
558
966
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
559
- productId
967
+ subscriptionOptions
560
968
  });
561
- const reqOpts = getOneTimePurchasesStatus(payload);
969
+ const reqOpts = bulkCreateSubscriptionOptions(
970
+ payload
971
+ );
562
972
  sideEffects?.onSiteCall?.();
563
973
  try {
564
974
  const result = await httpClient.request(reqOpts);
@@ -569,69 +979,87 @@ async function getOneTimePurchasesStatus2(productId) {
569
979
  err,
570
980
  {
571
981
  spreadPathsToArguments: {},
572
- explicitPathsToArguments: { productId: "$[0]" },
982
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
573
983
  singleArgumentUnchanged: false
574
984
  },
575
- ["productId"]
985
+ ["subscriptionOptions"]
576
986
  );
577
987
  sideEffects?.onError?.(err);
578
988
  throw transformedError;
579
989
  }
580
990
  }
581
- async function createSubscriptionOption2(subscriptionOption) {
582
- const { httpClient, sideEffects } = arguments[1];
991
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
992
+ const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
993
+ if (validateRequestSchema) {
994
+ BulkUpdateSubscriptionOptionsRequest.parse({ subscriptionOptions });
995
+ }
583
996
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
584
- subscriptionOption
997
+ subscriptionOptions
585
998
  });
586
- const reqOpts = createSubscriptionOption(payload);
999
+ const reqOpts = bulkUpdateSubscriptionOptions(
1000
+ payload
1001
+ );
587
1002
  sideEffects?.onSiteCall?.();
588
1003
  try {
589
1004
  const result = await httpClient.request(reqOpts);
590
1005
  sideEffects?.onSuccess?.(result);
591
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
1006
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
592
1007
  } catch (err) {
593
1008
  const transformedError = (0, import_transform_error.transformError)(
594
1009
  err,
595
1010
  {
596
1011
  spreadPathsToArguments: {},
597
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
1012
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
598
1013
  singleArgumentUnchanged: false
599
1014
  },
600
- ["subscriptionOption"]
1015
+ ["subscriptionOptions"]
601
1016
  );
602
1017
  sideEffects?.onError?.(err);
603
1018
  throw transformedError;
604
1019
  }
605
1020
  }
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);
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
+ );
612
1030
  sideEffects?.onSiteCall?.();
613
1031
  try {
614
1032
  const result = await httpClient.request(reqOpts);
615
1033
  sideEffects?.onSuccess?.(result);
616
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
617
1034
  } catch (err) {
618
1035
  const transformedError = (0, import_transform_error.transformError)(
619
1036
  err,
620
1037
  {
621
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
622
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
1038
+ spreadPathsToArguments: {},
1039
+ explicitPathsToArguments: { ids: "$[0]" },
623
1040
  singleArgumentUnchanged: false
624
1041
  },
625
- ["_id", "subscriptionOption"]
1042
+ ["ids"]
626
1043
  );
627
1044
  sideEffects?.onError?.(err);
628
1045
  throw transformedError;
629
1046
  }
630
1047
  }
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);
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
+ );
635
1063
  sideEffects?.onSiteCall?.();
636
1064
  try {
637
1065
  const result = await httpClient.request(reqOpts);
@@ -641,143 +1069,165 @@ async function deleteSubscriptionOption2(_id) {
641
1069
  err,
642
1070
  {
643
1071
  spreadPathsToArguments: {},
644
- explicitPathsToArguments: { id: "$[0]" },
1072
+ explicitPathsToArguments: {
1073
+ productId: "$[0]",
1074
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
1075
+ },
645
1076
  singleArgumentUnchanged: false
646
1077
  },
647
- ["_id"]
1078
+ ["productId", "options"]
648
1079
  );
649
1080
  sideEffects?.onError?.(err);
650
1081
  throw transformedError;
651
1082
  }
652
1083
  }
653
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
654
- const { httpClient, sideEffects } = arguments[1];
1084
+ async function allowOneTimePurchases2(productId, allowed) {
1085
+ const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
1086
+ if (validateRequestSchema) {
1087
+ AllowOneTimePurchasesRequest.parse({ productId, allowed });
1088
+ }
655
1089
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
656
- subscriptionOptions
1090
+ productId,
1091
+ allowed
657
1092
  });
658
- const reqOpts = bulkCreateSubscriptionOptions(
659
- payload
660
- );
1093
+ const reqOpts = allowOneTimePurchases(payload);
661
1094
  sideEffects?.onSiteCall?.();
662
1095
  try {
663
1096
  const result = await httpClient.request(reqOpts);
664
1097
  sideEffects?.onSuccess?.(result);
665
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
666
1098
  } catch (err) {
667
1099
  const transformedError = (0, import_transform_error.transformError)(
668
1100
  err,
669
1101
  {
670
1102
  spreadPathsToArguments: {},
671
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
1103
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
672
1104
  singleArgumentUnchanged: false
673
1105
  },
674
- ["subscriptionOptions"]
1106
+ ["productId", "allowed"]
675
1107
  );
676
1108
  sideEffects?.onError?.(err);
677
1109
  throw transformedError;
678
1110
  }
679
1111
  }
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
- );
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);
688
1119
  sideEffects?.onSiteCall?.();
689
1120
  try {
690
1121
  const result = await httpClient.request(reqOpts);
691
1122
  sideEffects?.onSuccess?.(result);
692
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1123
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
693
1124
  } catch (err) {
694
1125
  const transformedError = (0, import_transform_error.transformError)(
695
1126
  err,
696
1127
  {
697
1128
  spreadPathsToArguments: {},
698
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
1129
+ explicitPathsToArguments: { id: "$[0]" },
699
1130
  singleArgumentUnchanged: false
700
1131
  },
701
- ["subscriptionOptions"]
1132
+ ["_id"]
702
1133
  );
703
1134
  sideEffects?.onError?.(err);
704
1135
  throw transformedError;
705
1136
  }
706
1137
  }
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(
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(
711
1148
  payload
712
1149
  );
713
1150
  sideEffects?.onSiteCall?.();
714
1151
  try {
715
1152
  const result = await httpClient.request(reqOpts);
716
1153
  sideEffects?.onSuccess?.(result);
1154
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
717
1155
  } catch (err) {
718
1156
  const transformedError = (0, import_transform_error.transformError)(
719
1157
  err,
720
1158
  {
721
1159
  spreadPathsToArguments: {},
722
- explicitPathsToArguments: { ids: "$[0]" },
1160
+ explicitPathsToArguments: {
1161
+ productId: "$[0]",
1162
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
1163
+ },
723
1164
  singleArgumentUnchanged: false
724
1165
  },
725
- ["ids"]
1166
+ ["productId", "options"]
726
1167
  );
727
1168
  sideEffects?.onError?.(err);
728
1169
  throw transformedError;
729
1170
  }
730
1171
  }
731
- async function assignSubscriptionOptionsToProduct2(productId, options) {
732
- const { httpClient, sideEffects } = arguments[2];
1172
+ async function getProductIdsForSubscriptionOption2(_id, options) {
1173
+ const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
1174
+ if (validateRequestSchema) {
1175
+ GetProductIdsForSubscriptionOptionRequest.parse({ _id, options });
1176
+ }
733
1177
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
734
- productId,
735
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
1178
+ id: _id,
1179
+ includeHiddenProducts: options?.includeHiddenProducts,
1180
+ paging: options?.paging
736
1181
  });
737
- const reqOpts = assignSubscriptionOptionsToProduct(
1182
+ const reqOpts = getProductIdsForSubscriptionOption(
738
1183
  payload
739
1184
  );
740
1185
  sideEffects?.onSiteCall?.();
741
1186
  try {
742
1187
  const result = await httpClient.request(reqOpts);
743
1188
  sideEffects?.onSuccess?.(result);
1189
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
744
1190
  } catch (err) {
745
1191
  const transformedError = (0, import_transform_error.transformError)(
746
1192
  err,
747
1193
  {
748
1194
  spreadPathsToArguments: {},
749
1195
  explicitPathsToArguments: {
750
- productId: "$[0]",
751
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
1196
+ id: "$[0]",
1197
+ includeHiddenProducts: "$[1].includeHiddenProducts",
1198
+ paging: "$[1].paging"
752
1199
  },
753
1200
  singleArgumentUnchanged: false
754
1201
  },
755
- ["productId", "options"]
1202
+ ["_id", "options"]
756
1203
  );
757
1204
  sideEffects?.onError?.(err);
758
1205
  throw transformedError;
759
1206
  }
760
1207
  }
761
- async function allowOneTimePurchases2(productId, allowed) {
762
- const { httpClient, sideEffects } = arguments[2];
1208
+ async function getOneTimePurchasesStatus2(productId) {
1209
+ const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
1210
+ if (validateRequestSchema) {
1211
+ GetOneTimePurchasesStatusRequest.parse({ productId });
1212
+ }
763
1213
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
764
- productId,
765
- allowed
1214
+ productId
766
1215
  });
767
- const reqOpts = allowOneTimePurchases(payload);
1216
+ const reqOpts = getOneTimePurchasesStatus(payload);
768
1217
  sideEffects?.onSiteCall?.();
769
1218
  try {
770
1219
  const result = await httpClient.request(reqOpts);
771
1220
  sideEffects?.onSuccess?.(result);
1221
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
772
1222
  } catch (err) {
773
1223
  const transformedError = (0, import_transform_error.transformError)(
774
1224
  err,
775
1225
  {
776
1226
  spreadPathsToArguments: {},
777
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
1227
+ explicitPathsToArguments: { productId: "$[0]" },
778
1228
  singleArgumentUnchanged: false
779
1229
  },
780
- ["productId", "allowed"]
1230
+ ["productId"]
781
1231
  );
782
1232
  sideEffects?.onError?.(err);
783
1233
  throw transformedError;
@@ -785,102 +1235,98 @@ async function allowOneTimePurchases2(productId, allowed) {
785
1235
  }
786
1236
 
787
1237
  // src/stores-v1-subscription-option-subscription-options.public.ts
788
- function getSubscriptionOption3(httpClient) {
789
- return (_id) => getSubscriptionOption2(
790
- _id,
791
- // @ts-ignore
792
- { httpClient }
793
- );
794
- }
795
- function getSubscriptionOptionsForProduct3(httpClient) {
796
- return (productId, options) => getSubscriptionOptionsForProduct2(
797
- productId,
798
- options,
799
- // @ts-ignore
800
- { httpClient }
801
- );
802
- }
803
- function getProductIdsForSubscriptionOption3(httpClient) {
804
- return (_id, options) => getProductIdsForSubscriptionOption2(
805
- _id,
806
- options,
807
- // @ts-ignore
808
- { httpClient }
809
- );
810
- }
811
- function getOneTimePurchasesStatus3(httpClient) {
812
- return (productId) => getOneTimePurchasesStatus2(
813
- productId,
814
- // @ts-ignore
815
- { httpClient }
816
- );
817
- }
818
- function createSubscriptionOption3(httpClient) {
1238
+ function createSubscriptionOption3(httpClient, __options) {
819
1239
  return (subscriptionOption) => createSubscriptionOption2(
820
1240
  subscriptionOption,
821
1241
  // @ts-ignore
822
- { httpClient }
1242
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
823
1243
  );
824
1244
  }
825
- function updateSubscriptionOption3(httpClient) {
1245
+ function updateSubscriptionOption3(httpClient, __options) {
826
1246
  return (_id, subscriptionOption) => updateSubscriptionOption2(
827
1247
  _id,
828
1248
  subscriptionOption,
829
1249
  // @ts-ignore
830
- { httpClient }
1250
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
831
1251
  );
832
1252
  }
833
- function deleteSubscriptionOption3(httpClient) {
1253
+ function deleteSubscriptionOption3(httpClient, __options) {
834
1254
  return (_id) => deleteSubscriptionOption2(
835
1255
  _id,
836
1256
  // @ts-ignore
837
- { httpClient }
1257
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
838
1258
  );
839
1259
  }
840
- function bulkCreateSubscriptionOptions3(httpClient) {
1260
+ function bulkCreateSubscriptionOptions3(httpClient, __options) {
841
1261
  return (subscriptionOptions) => bulkCreateSubscriptionOptions2(
842
1262
  subscriptionOptions,
843
1263
  // @ts-ignore
844
- { httpClient }
1264
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
845
1265
  );
846
1266
  }
847
- function bulkUpdateSubscriptionOptions3(httpClient) {
1267
+ function bulkUpdateSubscriptionOptions3(httpClient, __options) {
848
1268
  return (subscriptionOptions) => bulkUpdateSubscriptionOptions2(
849
1269
  subscriptionOptions,
850
1270
  // @ts-ignore
851
- { httpClient }
1271
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
852
1272
  );
853
1273
  }
854
- function bulkDeleteSubscriptionOptions3(httpClient) {
1274
+ function bulkDeleteSubscriptionOptions3(httpClient, __options) {
855
1275
  return (ids) => bulkDeleteSubscriptionOptions2(
856
1276
  ids,
857
1277
  // @ts-ignore
858
- { httpClient }
1278
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
859
1279
  );
860
1280
  }
861
- function assignSubscriptionOptionsToProduct3(httpClient) {
1281
+ function assignSubscriptionOptionsToProduct3(httpClient, __options) {
862
1282
  return (productId, options) => assignSubscriptionOptionsToProduct2(
863
1283
  productId,
864
1284
  options,
865
1285
  // @ts-ignore
866
- { httpClient }
1286
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
867
1287
  );
868
1288
  }
869
- function allowOneTimePurchases3(httpClient) {
1289
+ function allowOneTimePurchases3(httpClient, __options) {
870
1290
  return (productId, allowed) => allowOneTimePurchases2(
871
1291
  productId,
872
1292
  allowed,
873
1293
  // @ts-ignore
874
- { httpClient }
1294
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
1295
+ );
1296
+ }
1297
+ function getSubscriptionOption3(httpClient, __options) {
1298
+ return (_id) => getSubscriptionOption2(
1299
+ _id,
1300
+ // @ts-ignore
1301
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
1302
+ );
1303
+ }
1304
+ function getSubscriptionOptionsForProduct3(httpClient, __options) {
1305
+ return (productId, options) => getSubscriptionOptionsForProduct2(
1306
+ productId,
1307
+ options,
1308
+ // @ts-ignore
1309
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
1310
+ );
1311
+ }
1312
+ function getProductIdsForSubscriptionOption3(httpClient, __options) {
1313
+ return (_id, options) => getProductIdsForSubscriptionOption2(
1314
+ _id,
1315
+ options,
1316
+ // @ts-ignore
1317
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
1318
+ );
1319
+ }
1320
+ function getOneTimePurchasesStatus3(httpClient, __options) {
1321
+ return (productId) => getOneTimePurchasesStatus2(
1322
+ productId,
1323
+ // @ts-ignore
1324
+ { httpClient, validateRequestSchema: __options?.validateRequestSchema }
875
1325
  );
876
1326
  }
877
1327
 
878
1328
  // src/stores-v1-subscription-option-subscription-options.context.ts
879
1329
  var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
880
- var getSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOption3);
881
- var getSubscriptionOptionsForProduct4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOptionsForProduct3);
882
- var getProductIdsForSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getProductIdsForSubscriptionOption3);
883
- var getOneTimePurchasesStatus4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getOneTimePurchasesStatus3);
884
1330
  var createSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createSubscriptionOption3);
885
1331
  var updateSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateSubscriptionOption3);
886
1332
  var deleteSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deleteSubscriptionOption3);
@@ -889,6 +1335,10 @@ var bulkUpdateSubscriptionOptions4 = /* @__PURE__ */ (0, import_rest_modules3.cr
889
1335
  var bulkDeleteSubscriptionOptions4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkDeleteSubscriptionOptions3);
890
1336
  var assignSubscriptionOptionsToProduct4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(assignSubscriptionOptionsToProduct3);
891
1337
  var allowOneTimePurchases4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(allowOneTimePurchases3);
1338
+ var getSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOption3);
1339
+ var getSubscriptionOptionsForProduct4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOptionsForProduct3);
1340
+ var getProductIdsForSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getProductIdsForSubscriptionOption3);
1341
+ var getOneTimePurchasesStatus4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getOneTimePurchasesStatus3);
892
1342
  // Annotate the CommonJS export names for ESM import in node:
893
1343
  0 && (module.exports = {
894
1344
  DiscountType,