@wix/auto_sdk_stores_subscription-options 1.0.39 → 1.0.41

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 (37) hide show
  1. package/build/cjs/index.d.ts +47 -58
  2. package/build/cjs/index.js +277 -336
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +158 -183
  5. package/build/cjs/index.typings.js +223 -273
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +109 -123
  8. package/build/cjs/meta.js +203 -246
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +47 -58
  11. package/build/es/index.mjs +277 -335
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +158 -183
  14. package/build/es/index.typings.mjs +223 -272
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +109 -123
  17. package/build/es/meta.mjs +203 -245
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +47 -58
  20. package/build/internal/cjs/index.js +277 -336
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +158 -183
  23. package/build/internal/cjs/index.typings.js +223 -273
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +109 -123
  26. package/build/internal/cjs/meta.js +203 -246
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +47 -58
  29. package/build/internal/es/index.mjs +277 -335
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +158 -183
  32. package/build/internal/es/index.typings.mjs +223 -272
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +109 -123
  35. package/build/internal/es/meta.mjs +203 -245
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -29,7 +29,6 @@ __export(index_typings_exports, {
29
29
  bulkUpdateSubscriptionOptions: () => bulkUpdateSubscriptionOptions2,
30
30
  createSubscriptionOption: () => createSubscriptionOption2,
31
31
  deleteSubscriptionOption: () => deleteSubscriptionOption2,
32
- enableCustomerCancellation: () => enableCustomerCancellation2,
33
32
  getOneTimePurchasesStatus: () => getOneTimePurchasesStatus2,
34
33
  getProductIdsForSubscriptionOption: () => getProductIdsForSubscriptionOption2,
35
34
  getSubscriptionOption: () => getSubscriptionOption2,
@@ -48,35 +47,6 @@ var import_float = require("@wix/sdk-runtime/transformations/float");
48
47
  var import_float2 = require("@wix/sdk-runtime/transformations/float");
49
48
  var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
50
49
  var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
51
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
52
- const domainToMappings = {
53
- "api._api_base_domain_": [
54
- {
55
- srcPath: "/wix-ecommerce-plans-reader",
56
- destPath: ""
57
- }
58
- ],
59
- "www._base_domain_": [
60
- {
61
- srcPath: "/_api/wix-ecommerce-plans-reader",
62
- destPath: ""
63
- }
64
- ],
65
- _: [
66
- {
67
- srcPath: "/_api/subscription-options-reader-server",
68
- destPath: ""
69
- }
70
- ],
71
- "manage._base_domain_": [
72
- {
73
- srcPath: "/_api/subscription-options-reader-server",
74
- destPath: ""
75
- }
76
- ]
77
- };
78
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
79
- }
80
50
  function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
81
51
  const domainToMappings = {
82
52
  "api._api_base_domain_": [
@@ -124,7 +94,136 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUr
124
94
  };
125
95
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
126
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
+ }
127
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
+ }
128
227
  function createSubscriptionOption(payload) {
129
228
  function __createSubscriptionOption({ host }) {
130
229
  const serializedData = (0, import_transform_paths.transformPaths)(payload, [
@@ -351,129 +450,6 @@ function allowOneTimePurchases(payload) {
351
450
  }
352
451
  return __allowOneTimePurchases;
353
452
  }
354
- function enableCustomerCancellation(payload) {
355
- function __enableCustomerCancellation({ host }) {
356
- const metadata = {
357
- entityFqdn: "wix.stores.v1.subscription_option",
358
- method: "PATCH",
359
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.EnableCustomerCancellation",
360
- packageName: PACKAGE_NAME,
361
- migrationOptions: {
362
- optInTransformResponse: true
363
- },
364
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
365
- {
366
- protoPath: "/v1/subscription-options/product/{productId}/enableCustomerCancellation",
367
- data: payload,
368
- host
369
- }
370
- ),
371
- data: payload
372
- };
373
- return metadata;
374
- }
375
- return __enableCustomerCancellation;
376
- }
377
- function getSubscriptionOption(payload) {
378
- function __getSubscriptionOption({ host }) {
379
- const metadata = {
380
- entityFqdn: "wix.stores.v1.subscription_option",
381
- method: "GET",
382
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
383
- packageName: PACKAGE_NAME,
384
- migrationOptions: {
385
- optInTransformResponse: true
386
- },
387
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
388
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
389
- ),
390
- params: (0, import_rest_modules.toURLSearchParams)(payload),
391
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
392
- {
393
- transformFn: import_float2.transformRESTFloatToSDKFloat,
394
- paths: [{ path: "subscriptionOption.discount.value" }]
395
- }
396
- ])
397
- };
398
- return metadata;
399
- }
400
- return __getSubscriptionOption;
401
- }
402
- function getSubscriptionOptionsForProduct(payload) {
403
- function __getSubscriptionOptionsForProduct({ host }) {
404
- const metadata = {
405
- entityFqdn: "wix.stores.v1.subscription_option",
406
- method: "GET",
407
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
408
- packageName: PACKAGE_NAME,
409
- migrationOptions: {
410
- optInTransformResponse: true
411
- },
412
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
413
- {
414
- protoPath: "/v1/subscription-options/byProduct/{productId}",
415
- data: payload,
416
- host
417
- }
418
- ),
419
- params: (0, import_rest_modules.toURLSearchParams)(payload),
420
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
421
- {
422
- transformFn: import_float2.transformRESTFloatToSDKFloat,
423
- paths: [{ path: "subscriptionOptions.discount.value" }]
424
- }
425
- ])
426
- };
427
- return metadata;
428
- }
429
- return __getSubscriptionOptionsForProduct;
430
- }
431
- function getProductIdsForSubscriptionOption(payload) {
432
- function __getProductIdsForSubscriptionOption({ host }) {
433
- const metadata = {
434
- entityFqdn: "wix.stores.v1.subscription_option",
435
- method: "GET",
436
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
437
- packageName: PACKAGE_NAME,
438
- migrationOptions: {
439
- optInTransformResponse: true
440
- },
441
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
442
- {
443
- protoPath: "/v1/subscription-options/{id}/productIds",
444
- data: payload,
445
- host
446
- }
447
- ),
448
- params: (0, import_rest_modules.toURLSearchParams)(payload)
449
- };
450
- return metadata;
451
- }
452
- return __getProductIdsForSubscriptionOption;
453
- }
454
- function getOneTimePurchasesStatus(payload) {
455
- function __getOneTimePurchasesStatus({ host }) {
456
- const metadata = {
457
- entityFqdn: "wix.stores.v1.subscription_option",
458
- method: "GET",
459
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
460
- packageName: PACKAGE_NAME,
461
- migrationOptions: {
462
- optInTransformResponse: true
463
- },
464
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
465
- {
466
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
467
- data: payload,
468
- host
469
- }
470
- ),
471
- params: (0, import_rest_modules.toURLSearchParams)(payload)
472
- };
473
- return metadata;
474
- }
475
- return __getOneTimePurchasesStatus;
476
- }
477
453
 
478
454
  // src/stores-v1-subscription-option-subscription-options.universal.ts
479
455
  var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
@@ -490,12 +466,10 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
490
466
  DiscountType2["PERCENT"] = "PERCENT";
491
467
  return DiscountType2;
492
468
  })(DiscountType || {});
493
- async function createSubscriptionOption2(subscriptionOption) {
469
+ async function getSubscriptionOption2(_id) {
494
470
  const { httpClient, sideEffects } = arguments[1];
495
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
496
- subscriptionOption
497
- });
498
- const reqOpts = createSubscriptionOption(payload);
471
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
472
+ const reqOpts = getSubscriptionOption(payload);
499
473
  sideEffects?.onSiteCall?.();
500
474
  try {
501
475
  const result = await httpClient.request(reqOpts);
@@ -506,68 +480,54 @@ async function createSubscriptionOption2(subscriptionOption) {
506
480
  err,
507
481
  {
508
482
  spreadPathsToArguments: {},
509
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
483
+ explicitPathsToArguments: { id: "$[0]" },
510
484
  singleArgumentUnchanged: false
511
485
  },
512
- ["subscriptionOption"]
486
+ ["_id"]
513
487
  );
514
488
  sideEffects?.onError?.(err);
515
489
  throw transformedError;
516
490
  }
517
491
  }
518
- async function updateSubscriptionOption2(_id, subscriptionOption) {
492
+ async function getSubscriptionOptionsForProduct2(productId, options) {
519
493
  const { httpClient, sideEffects } = arguments[2];
520
494
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
521
- subscriptionOption: { ...subscriptionOption, id: _id }
495
+ productId,
496
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
522
497
  });
523
- const reqOpts = updateSubscriptionOption(payload);
524
- sideEffects?.onSiteCall?.();
525
- try {
526
- const result = await httpClient.request(reqOpts);
527
- sideEffects?.onSuccess?.(result);
528
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
529
- } catch (err) {
530
- const transformedError = (0, import_transform_error.transformError)(
531
- err,
532
- {
533
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
534
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
535
- singleArgumentUnchanged: false
536
- },
537
- ["_id", "subscriptionOption"]
538
- );
539
- sideEffects?.onError?.(err);
540
- throw transformedError;
541
- }
542
- }
543
- async function deleteSubscriptionOption2(_id) {
544
- const { httpClient, sideEffects } = arguments[1];
545
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
546
- const reqOpts = deleteSubscriptionOption(payload);
498
+ const reqOpts = getSubscriptionOptionsForProduct(
499
+ payload
500
+ );
547
501
  sideEffects?.onSiteCall?.();
548
502
  try {
549
503
  const result = await httpClient.request(reqOpts);
550
504
  sideEffects?.onSuccess?.(result);
505
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
551
506
  } catch (err) {
552
507
  const transformedError = (0, import_transform_error.transformError)(
553
508
  err,
554
509
  {
555
510
  spreadPathsToArguments: {},
556
- explicitPathsToArguments: { id: "$[0]" },
511
+ explicitPathsToArguments: {
512
+ productId: "$[0]",
513
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
514
+ },
557
515
  singleArgumentUnchanged: false
558
516
  },
559
- ["_id"]
517
+ ["productId", "options"]
560
518
  );
561
519
  sideEffects?.onError?.(err);
562
520
  throw transformedError;
563
521
  }
564
522
  }
565
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
566
- const { httpClient, sideEffects } = arguments[1];
523
+ async function getProductIdsForSubscriptionOption2(_id, options) {
524
+ const { httpClient, sideEffects } = arguments[2];
567
525
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
568
- subscriptionOptions
526
+ id: _id,
527
+ includeHiddenProducts: options?.includeHiddenProducts,
528
+ paging: options?.paging
569
529
  });
570
- const reqOpts = bulkCreateSubscriptionOptions(
530
+ const reqOpts = getProductIdsForSubscriptionOption(
571
531
  payload
572
532
  );
573
533
  sideEffects?.onSiteCall?.();
@@ -580,23 +540,25 @@ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
580
540
  err,
581
541
  {
582
542
  spreadPathsToArguments: {},
583
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
543
+ explicitPathsToArguments: {
544
+ id: "$[0]",
545
+ includeHiddenProducts: "$[1].includeHiddenProducts",
546
+ paging: "$[1].paging"
547
+ },
584
548
  singleArgumentUnchanged: false
585
549
  },
586
- ["subscriptionOptions"]
550
+ ["_id", "options"]
587
551
  );
588
552
  sideEffects?.onError?.(err);
589
553
  throw transformedError;
590
554
  }
591
555
  }
592
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
556
+ async function getOneTimePurchasesStatus2(productId) {
593
557
  const { httpClient, sideEffects } = arguments[1];
594
558
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
595
- subscriptionOptions
559
+ productId
596
560
  });
597
- const reqOpts = bulkUpdateSubscriptionOptions(
598
- payload
599
- );
561
+ const reqOpts = getOneTimePurchasesStatus(payload);
600
562
  sideEffects?.onSiteCall?.();
601
563
  try {
602
564
  const result = await httpClient.request(reqOpts);
@@ -607,76 +569,69 @@ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
607
569
  err,
608
570
  {
609
571
  spreadPathsToArguments: {},
610
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
572
+ explicitPathsToArguments: { productId: "$[0]" },
611
573
  singleArgumentUnchanged: false
612
574
  },
613
- ["subscriptionOptions"]
575
+ ["productId"]
614
576
  );
615
577
  sideEffects?.onError?.(err);
616
578
  throw transformedError;
617
579
  }
618
580
  }
619
- async function bulkDeleteSubscriptionOptions2(ids) {
581
+ async function createSubscriptionOption2(subscriptionOption) {
620
582
  const { httpClient, sideEffects } = arguments[1];
621
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
622
- const reqOpts = bulkDeleteSubscriptionOptions(
623
- payload
624
- );
583
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
584
+ subscriptionOption
585
+ });
586
+ const reqOpts = createSubscriptionOption(payload);
625
587
  sideEffects?.onSiteCall?.();
626
588
  try {
627
589
  const result = await httpClient.request(reqOpts);
628
590
  sideEffects?.onSuccess?.(result);
591
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
629
592
  } catch (err) {
630
593
  const transformedError = (0, import_transform_error.transformError)(
631
594
  err,
632
595
  {
633
596
  spreadPathsToArguments: {},
634
- explicitPathsToArguments: { ids: "$[0]" },
597
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
635
598
  singleArgumentUnchanged: false
636
599
  },
637
- ["ids"]
600
+ ["subscriptionOption"]
638
601
  );
639
602
  sideEffects?.onError?.(err);
640
603
  throw transformedError;
641
604
  }
642
605
  }
643
- async function assignSubscriptionOptionsToProduct2(productId, options) {
606
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
644
607
  const { httpClient, sideEffects } = arguments[2];
645
608
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
646
- productId,
647
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
609
+ subscriptionOption: { ...subscriptionOption, id: _id }
648
610
  });
649
- const reqOpts = assignSubscriptionOptionsToProduct(
650
- payload
651
- );
611
+ const reqOpts = updateSubscriptionOption(payload);
652
612
  sideEffects?.onSiteCall?.();
653
613
  try {
654
614
  const result = await httpClient.request(reqOpts);
655
615
  sideEffects?.onSuccess?.(result);
616
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
656
617
  } catch (err) {
657
618
  const transformedError = (0, import_transform_error.transformError)(
658
619
  err,
659
620
  {
660
- spreadPathsToArguments: {},
661
- explicitPathsToArguments: {
662
- productId: "$[0]",
663
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
664
- },
621
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
622
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
665
623
  singleArgumentUnchanged: false
666
624
  },
667
- ["productId", "options"]
625
+ ["_id", "subscriptionOption"]
668
626
  );
669
627
  sideEffects?.onError?.(err);
670
628
  throw transformedError;
671
629
  }
672
630
  }
673
- async function allowOneTimePurchases2(productId, allowed) {
674
- const { httpClient, sideEffects } = arguments[2];
675
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
676
- productId,
677
- allowed
678
- });
679
- const reqOpts = allowOneTimePurchases(payload);
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);
680
635
  sideEffects?.onSiteCall?.();
681
636
  try {
682
637
  const result = await httpClient.request(reqOpts);
@@ -686,147 +641,143 @@ async function allowOneTimePurchases2(productId, allowed) {
686
641
  err,
687
642
  {
688
643
  spreadPathsToArguments: {},
689
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
644
+ explicitPathsToArguments: { id: "$[0]" },
690
645
  singleArgumentUnchanged: false
691
646
  },
692
- ["productId", "allowed"]
647
+ ["_id"]
693
648
  );
694
649
  sideEffects?.onError?.(err);
695
650
  throw transformedError;
696
651
  }
697
652
  }
698
- async function enableCustomerCancellation2(productId, allowed) {
699
- const { httpClient, sideEffects } = arguments[2];
653
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
654
+ const { httpClient, sideEffects } = arguments[1];
700
655
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
701
- productId,
702
- allowed
656
+ subscriptionOptions
703
657
  });
704
- const reqOpts = enableCustomerCancellation(payload);
658
+ const reqOpts = bulkCreateSubscriptionOptions(
659
+ payload
660
+ );
705
661
  sideEffects?.onSiteCall?.();
706
662
  try {
707
663
  const result = await httpClient.request(reqOpts);
708
664
  sideEffects?.onSuccess?.(result);
665
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
709
666
  } catch (err) {
710
667
  const transformedError = (0, import_transform_error.transformError)(
711
668
  err,
712
669
  {
713
670
  spreadPathsToArguments: {},
714
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
671
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
715
672
  singleArgumentUnchanged: false
716
673
  },
717
- ["productId", "allowed"]
674
+ ["subscriptionOptions"]
718
675
  );
719
676
  sideEffects?.onError?.(err);
720
677
  throw transformedError;
721
678
  }
722
679
  }
723
- async function getSubscriptionOption2(_id) {
680
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
724
681
  const { httpClient, sideEffects } = arguments[1];
725
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
726
- const reqOpts = getSubscriptionOption(payload);
682
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
683
+ subscriptionOptions
684
+ });
685
+ const reqOpts = bulkUpdateSubscriptionOptions(
686
+ payload
687
+ );
727
688
  sideEffects?.onSiteCall?.();
728
689
  try {
729
690
  const result = await httpClient.request(reqOpts);
730
691
  sideEffects?.onSuccess?.(result);
731
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
692
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
732
693
  } catch (err) {
733
694
  const transformedError = (0, import_transform_error.transformError)(
734
695
  err,
735
696
  {
736
697
  spreadPathsToArguments: {},
737
- explicitPathsToArguments: { id: "$[0]" },
698
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
738
699
  singleArgumentUnchanged: false
739
700
  },
740
- ["_id"]
701
+ ["subscriptionOptions"]
741
702
  );
742
703
  sideEffects?.onError?.(err);
743
704
  throw transformedError;
744
705
  }
745
706
  }
746
- async function getSubscriptionOptionsForProduct2(productId, options) {
747
- const { httpClient, sideEffects } = arguments[2];
748
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
749
- productId,
750
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
751
- });
752
- 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(
753
711
  payload
754
712
  );
755
713
  sideEffects?.onSiteCall?.();
756
714
  try {
757
715
  const result = await httpClient.request(reqOpts);
758
716
  sideEffects?.onSuccess?.(result);
759
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
760
717
  } catch (err) {
761
718
  const transformedError = (0, import_transform_error.transformError)(
762
719
  err,
763
720
  {
764
721
  spreadPathsToArguments: {},
765
- explicitPathsToArguments: {
766
- productId: "$[0]",
767
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
768
- },
722
+ explicitPathsToArguments: { ids: "$[0]" },
769
723
  singleArgumentUnchanged: false
770
724
  },
771
- ["productId", "options"]
725
+ ["ids"]
772
726
  );
773
727
  sideEffects?.onError?.(err);
774
728
  throw transformedError;
775
729
  }
776
730
  }
777
- async function getProductIdsForSubscriptionOption2(_id, options) {
731
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
778
732
  const { httpClient, sideEffects } = arguments[2];
779
733
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
780
- id: _id,
781
- includeHiddenProducts: options?.includeHiddenProducts,
782
- paging: options?.paging
734
+ productId,
735
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
783
736
  });
784
- const reqOpts = getProductIdsForSubscriptionOption(
737
+ const reqOpts = assignSubscriptionOptionsToProduct(
785
738
  payload
786
739
  );
787
740
  sideEffects?.onSiteCall?.();
788
741
  try {
789
742
  const result = await httpClient.request(reqOpts);
790
743
  sideEffects?.onSuccess?.(result);
791
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
792
744
  } catch (err) {
793
745
  const transformedError = (0, import_transform_error.transformError)(
794
746
  err,
795
747
  {
796
748
  spreadPathsToArguments: {},
797
749
  explicitPathsToArguments: {
798
- id: "$[0]",
799
- includeHiddenProducts: "$[1].includeHiddenProducts",
800
- paging: "$[1].paging"
750
+ productId: "$[0]",
751
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
801
752
  },
802
753
  singleArgumentUnchanged: false
803
754
  },
804
- ["_id", "options"]
755
+ ["productId", "options"]
805
756
  );
806
757
  sideEffects?.onError?.(err);
807
758
  throw transformedError;
808
759
  }
809
760
  }
810
- async function getOneTimePurchasesStatus2(productId) {
811
- const { httpClient, sideEffects } = arguments[1];
761
+ async function allowOneTimePurchases2(productId, allowed) {
762
+ const { httpClient, sideEffects } = arguments[2];
812
763
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
813
- productId
764
+ productId,
765
+ allowed
814
766
  });
815
- const reqOpts = getOneTimePurchasesStatus(payload);
767
+ const reqOpts = allowOneTimePurchases(payload);
816
768
  sideEffects?.onSiteCall?.();
817
769
  try {
818
770
  const result = await httpClient.request(reqOpts);
819
771
  sideEffects?.onSuccess?.(result);
820
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
821
772
  } catch (err) {
822
773
  const transformedError = (0, import_transform_error.transformError)(
823
774
  err,
824
775
  {
825
776
  spreadPathsToArguments: {},
826
- explicitPathsToArguments: { productId: "$[0]" },
777
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
827
778
  singleArgumentUnchanged: false
828
779
  },
829
- ["productId"]
780
+ ["productId", "allowed"]
830
781
  );
831
782
  sideEffects?.onError?.(err);
832
783
  throw transformedError;
@@ -843,7 +794,6 @@ async function getOneTimePurchasesStatus2(productId) {
843
794
  bulkUpdateSubscriptionOptions,
844
795
  createSubscriptionOption,
845
796
  deleteSubscriptionOption,
846
- enableCustomerCancellation,
847
797
  getOneTimePurchasesStatus,
848
798
  getProductIdsForSubscriptionOption,
849
799
  getSubscriptionOption,