@wix/auto_sdk_stores_subscription-options 1.0.30 → 1.0.32

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 +53 -42
  2. package/build/cjs/index.js +293 -234
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +175 -150
  5. package/build/cjs/index.typings.js +255 -205
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +122 -108
  8. package/build/cjs/meta.js +219 -176
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +53 -42
  11. package/build/es/index.mjs +292 -234
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +175 -150
  14. package/build/es/index.typings.mjs +254 -205
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +122 -108
  17. package/build/es/meta.mjs +218 -176
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +53 -42
  20. package/build/internal/cjs/index.js +293 -234
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +175 -150
  23. package/build/internal/cjs/index.typings.js +255 -205
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +122 -108
  26. package/build/internal/cjs/meta.js +219 -176
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +53 -42
  29. package/build/internal/es/index.mjs +292 -234
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +175 -150
  32. package/build/internal/es/index.typings.mjs +254 -205
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +122 -108
  35. package/build/internal/es/meta.mjs +218 -176
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -29,6 +29,7 @@ __export(index_exports, {
29
29
  bulkUpdateSubscriptionOptions: () => bulkUpdateSubscriptionOptions4,
30
30
  createSubscriptionOption: () => createSubscriptionOption4,
31
31
  deleteSubscriptionOption: () => deleteSubscriptionOption4,
32
+ enableCustomerCancellation: () => enableCustomerCancellation4,
32
33
  getOneTimePurchasesStatus: () => getOneTimePurchasesStatus4,
33
34
  getProductIdsForSubscriptionOption: () => getProductIdsForSubscriptionOption4,
34
35
  getSubscriptionOption: () => getSubscriptionOption4,
@@ -47,35 +48,6 @@ var import_float = require("@wix/sdk-runtime/transformations/float");
47
48
  var import_float2 = require("@wix/sdk-runtime/transformations/float");
48
49
  var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
49
50
  var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
50
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
51
- const domainToMappings = {
52
- "api._api_base_domain_": [
53
- {
54
- srcPath: "/wix-ecommerce-plans-reader",
55
- destPath: ""
56
- }
57
- ],
58
- "www._base_domain_": [
59
- {
60
- srcPath: "/_api/wix-ecommerce-plans-reader",
61
- destPath: ""
62
- }
63
- ],
64
- _: [
65
- {
66
- srcPath: "/_api/subscription-options-reader-server",
67
- destPath: ""
68
- }
69
- ],
70
- "manage._base_domain_": [
71
- {
72
- srcPath: "/_api/subscription-options-reader-server",
73
- destPath: ""
74
- }
75
- ]
76
- };
77
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
78
- }
79
51
  function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
80
52
  const domainToMappings = {
81
53
  "api._api_base_domain_": [
@@ -123,7 +95,136 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUr
123
95
  };
124
96
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
125
97
  }
98
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
99
+ const domainToMappings = {
100
+ "api._api_base_domain_": [
101
+ {
102
+ srcPath: "/wix-ecommerce-plans-reader",
103
+ destPath: ""
104
+ }
105
+ ],
106
+ "www._base_domain_": [
107
+ {
108
+ srcPath: "/_api/wix-ecommerce-plans-reader",
109
+ destPath: ""
110
+ }
111
+ ],
112
+ _: [
113
+ {
114
+ srcPath: "/_api/subscription-options-reader-server",
115
+ destPath: ""
116
+ }
117
+ ],
118
+ "manage._base_domain_": [
119
+ {
120
+ srcPath: "/_api/subscription-options-reader-server",
121
+ destPath: ""
122
+ }
123
+ ]
124
+ };
125
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
126
+ }
126
127
  var PACKAGE_NAME = "@wix/auto_sdk_stores_subscription-options";
128
+ function getSubscriptionOption(payload) {
129
+ function __getSubscriptionOption({ host }) {
130
+ const metadata = {
131
+ entityFqdn: "wix.stores.v1.subscription_option",
132
+ method: "GET",
133
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
134
+ packageName: PACKAGE_NAME,
135
+ migrationOptions: {
136
+ optInTransformResponse: true
137
+ },
138
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
139
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
140
+ ),
141
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
142
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
143
+ {
144
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
145
+ paths: [{ path: "subscriptionOption.discount.value" }]
146
+ }
147
+ ])
148
+ };
149
+ return metadata;
150
+ }
151
+ return __getSubscriptionOption;
152
+ }
153
+ function getSubscriptionOptionsForProduct(payload) {
154
+ function __getSubscriptionOptionsForProduct({ host }) {
155
+ const metadata = {
156
+ entityFqdn: "wix.stores.v1.subscription_option",
157
+ method: "GET",
158
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
159
+ packageName: PACKAGE_NAME,
160
+ migrationOptions: {
161
+ optInTransformResponse: true
162
+ },
163
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
164
+ {
165
+ protoPath: "/v1/subscription-options/byProduct/{productId}",
166
+ data: payload,
167
+ host
168
+ }
169
+ ),
170
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
171
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
172
+ {
173
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
174
+ paths: [{ path: "subscriptionOptions.discount.value" }]
175
+ }
176
+ ])
177
+ };
178
+ return metadata;
179
+ }
180
+ return __getSubscriptionOptionsForProduct;
181
+ }
182
+ function getProductIdsForSubscriptionOption(payload) {
183
+ function __getProductIdsForSubscriptionOption({ host }) {
184
+ const metadata = {
185
+ entityFqdn: "wix.stores.v1.subscription_option",
186
+ method: "GET",
187
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
188
+ packageName: PACKAGE_NAME,
189
+ migrationOptions: {
190
+ optInTransformResponse: true
191
+ },
192
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
193
+ {
194
+ protoPath: "/v1/subscription-options/{id}/productIds",
195
+ data: payload,
196
+ host
197
+ }
198
+ ),
199
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
200
+ };
201
+ return metadata;
202
+ }
203
+ return __getProductIdsForSubscriptionOption;
204
+ }
205
+ function getOneTimePurchasesStatus(payload) {
206
+ function __getOneTimePurchasesStatus({ host }) {
207
+ const metadata = {
208
+ entityFqdn: "wix.stores.v1.subscription_option",
209
+ method: "GET",
210
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
211
+ packageName: PACKAGE_NAME,
212
+ migrationOptions: {
213
+ optInTransformResponse: true
214
+ },
215
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
216
+ {
217
+ protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
218
+ data: payload,
219
+ host
220
+ }
221
+ ),
222
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
223
+ };
224
+ return metadata;
225
+ }
226
+ return __getOneTimePurchasesStatus;
227
+ }
127
228
  function createSubscriptionOption(payload) {
128
229
  function __createSubscriptionOption({ host }) {
129
230
  const serializedData = (0, import_transform_paths.transformPaths)(payload, [
@@ -350,105 +451,28 @@ function allowOneTimePurchases(payload) {
350
451
  }
351
452
  return __allowOneTimePurchases;
352
453
  }
353
- function getSubscriptionOption(payload) {
354
- function __getSubscriptionOption({ host }) {
355
- const metadata = {
356
- entityFqdn: "wix.stores.v1.subscription_option",
357
- method: "GET",
358
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
359
- packageName: PACKAGE_NAME,
360
- migrationOptions: {
361
- optInTransformResponse: true
362
- },
363
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
364
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
365
- ),
366
- params: (0, import_rest_modules.toURLSearchParams)(payload),
367
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
368
- {
369
- transformFn: import_float2.transformRESTFloatToSDKFloat,
370
- paths: [{ path: "subscriptionOption.discount.value" }]
371
- }
372
- ])
373
- };
374
- return metadata;
375
- }
376
- return __getSubscriptionOption;
377
- }
378
- function getSubscriptionOptionsForProduct(payload) {
379
- function __getSubscriptionOptionsForProduct({ host }) {
380
- const metadata = {
381
- entityFqdn: "wix.stores.v1.subscription_option",
382
- method: "GET",
383
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
384
- packageName: PACKAGE_NAME,
385
- migrationOptions: {
386
- optInTransformResponse: true
387
- },
388
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
389
- {
390
- protoPath: "/v1/subscription-options/byProduct/{productId}",
391
- data: payload,
392
- host
393
- }
394
- ),
395
- params: (0, import_rest_modules.toURLSearchParams)(payload),
396
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
397
- {
398
- transformFn: import_float2.transformRESTFloatToSDKFloat,
399
- paths: [{ path: "subscriptionOptions.discount.value" }]
400
- }
401
- ])
402
- };
403
- return metadata;
404
- }
405
- return __getSubscriptionOptionsForProduct;
406
- }
407
- function getProductIdsForSubscriptionOption(payload) {
408
- function __getProductIdsForSubscriptionOption({ host }) {
409
- const metadata = {
410
- entityFqdn: "wix.stores.v1.subscription_option",
411
- method: "GET",
412
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
413
- packageName: PACKAGE_NAME,
414
- migrationOptions: {
415
- optInTransformResponse: true
416
- },
417
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
418
- {
419
- protoPath: "/v1/subscription-options/{id}/productIds",
420
- data: payload,
421
- host
422
- }
423
- ),
424
- params: (0, import_rest_modules.toURLSearchParams)(payload)
425
- };
426
- return metadata;
427
- }
428
- return __getProductIdsForSubscriptionOption;
429
- }
430
- function getOneTimePurchasesStatus(payload) {
431
- function __getOneTimePurchasesStatus({ host }) {
454
+ function enableCustomerCancellation(payload) {
455
+ function __enableCustomerCancellation({ host }) {
432
456
  const metadata = {
433
457
  entityFqdn: "wix.stores.v1.subscription_option",
434
- method: "GET",
435
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
458
+ method: "PATCH",
459
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.EnableCustomerCancellation",
436
460
  packageName: PACKAGE_NAME,
437
461
  migrationOptions: {
438
462
  optInTransformResponse: true
439
463
  },
440
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
464
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
441
465
  {
442
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
466
+ protoPath: "/v1/subscription-options/product/{productId}/enableCustomerCancellation",
443
467
  data: payload,
444
468
  host
445
469
  }
446
470
  ),
447
- params: (0, import_rest_modules.toURLSearchParams)(payload)
471
+ data: payload
448
472
  };
449
473
  return metadata;
450
474
  }
451
- return __getOneTimePurchasesStatus;
475
+ return __enableCustomerCancellation;
452
476
  }
453
477
 
454
478
  // src/stores-v1-subscription-option-subscription-options.universal.ts
@@ -466,12 +490,10 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
466
490
  DiscountType2["PERCENT"] = "PERCENT";
467
491
  return DiscountType2;
468
492
  })(DiscountType || {});
469
- async function createSubscriptionOption2(subscriptionOption) {
493
+ async function getSubscriptionOption2(_id) {
470
494
  const { httpClient, sideEffects } = arguments[1];
471
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
472
- subscriptionOption
473
- });
474
- const reqOpts = createSubscriptionOption(payload);
495
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
496
+ const reqOpts = getSubscriptionOption(payload);
475
497
  sideEffects?.onSiteCall?.();
476
498
  try {
477
499
  const result = await httpClient.request(reqOpts);
@@ -482,70 +504,85 @@ async function createSubscriptionOption2(subscriptionOption) {
482
504
  err,
483
505
  {
484
506
  spreadPathsToArguments: {},
485
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
507
+ explicitPathsToArguments: { id: "$[0]" },
486
508
  singleArgumentUnchanged: false
487
509
  },
488
- ["subscriptionOption"]
510
+ ["_id"]
489
511
  );
490
512
  sideEffects?.onError?.(err);
491
513
  throw transformedError;
492
514
  }
493
515
  }
494
- async function updateSubscriptionOption2(_id, subscriptionOption) {
516
+ async function getSubscriptionOptionsForProduct2(productId, options) {
495
517
  const { httpClient, sideEffects } = arguments[2];
496
518
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
497
- subscriptionOption: { ...subscriptionOption, id: _id }
519
+ productId,
520
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
498
521
  });
499
- const reqOpts = updateSubscriptionOption(payload);
522
+ const reqOpts = getSubscriptionOptionsForProduct(
523
+ payload
524
+ );
500
525
  sideEffects?.onSiteCall?.();
501
526
  try {
502
527
  const result = await httpClient.request(reqOpts);
503
528
  sideEffects?.onSuccess?.(result);
504
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
529
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
505
530
  } catch (err) {
506
531
  const transformedError = (0, import_transform_error.transformError)(
507
532
  err,
508
533
  {
509
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
510
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
534
+ spreadPathsToArguments: {},
535
+ explicitPathsToArguments: {
536
+ productId: "$[0]",
537
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
538
+ },
511
539
  singleArgumentUnchanged: false
512
540
  },
513
- ["_id", "subscriptionOption"]
541
+ ["productId", "options"]
514
542
  );
515
543
  sideEffects?.onError?.(err);
516
544
  throw transformedError;
517
545
  }
518
546
  }
519
- async function deleteSubscriptionOption2(_id) {
520
- const { httpClient, sideEffects } = arguments[1];
521
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
522
- const reqOpts = deleteSubscriptionOption(payload);
547
+ async function getProductIdsForSubscriptionOption2(_id, options) {
548
+ const { httpClient, sideEffects } = arguments[2];
549
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
550
+ id: _id,
551
+ includeHiddenProducts: options?.includeHiddenProducts,
552
+ paging: options?.paging
553
+ });
554
+ const reqOpts = getProductIdsForSubscriptionOption(
555
+ payload
556
+ );
523
557
  sideEffects?.onSiteCall?.();
524
558
  try {
525
559
  const result = await httpClient.request(reqOpts);
526
560
  sideEffects?.onSuccess?.(result);
561
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
527
562
  } catch (err) {
528
563
  const transformedError = (0, import_transform_error.transformError)(
529
564
  err,
530
565
  {
531
566
  spreadPathsToArguments: {},
532
- explicitPathsToArguments: { id: "$[0]" },
567
+ explicitPathsToArguments: {
568
+ id: "$[0]",
569
+ includeHiddenProducts: "$[1].includeHiddenProducts",
570
+ paging: "$[1].paging"
571
+ },
533
572
  singleArgumentUnchanged: false
534
573
  },
535
- ["_id"]
574
+ ["_id", "options"]
536
575
  );
537
576
  sideEffects?.onError?.(err);
538
577
  throw transformedError;
539
578
  }
540
579
  }
541
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
580
+ async function getOneTimePurchasesStatus2(productId) {
542
581
  const { httpClient, sideEffects } = arguments[1];
543
582
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
544
- subscriptionOptions
583
+ productId
545
584
  });
546
- const reqOpts = bulkCreateSubscriptionOptions(
547
- payload
548
- );
585
+ const reqOpts = getOneTimePurchasesStatus(payload);
549
586
  sideEffects?.onSiteCall?.();
550
587
  try {
551
588
  const result = await httpClient.request(reqOpts);
@@ -556,48 +593,69 @@ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
556
593
  err,
557
594
  {
558
595
  spreadPathsToArguments: {},
559
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
596
+ explicitPathsToArguments: { productId: "$[0]" },
560
597
  singleArgumentUnchanged: false
561
598
  },
562
- ["subscriptionOptions"]
599
+ ["productId"]
563
600
  );
564
601
  sideEffects?.onError?.(err);
565
602
  throw transformedError;
566
603
  }
567
604
  }
568
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
605
+ async function createSubscriptionOption2(subscriptionOption) {
569
606
  const { httpClient, sideEffects } = arguments[1];
570
607
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
571
- subscriptionOptions
608
+ subscriptionOption
572
609
  });
573
- const reqOpts = bulkUpdateSubscriptionOptions(
574
- payload
575
- );
610
+ const reqOpts = createSubscriptionOption(payload);
576
611
  sideEffects?.onSiteCall?.();
577
612
  try {
578
613
  const result = await httpClient.request(reqOpts);
579
614
  sideEffects?.onSuccess?.(result);
580
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
615
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
581
616
  } catch (err) {
582
617
  const transformedError = (0, import_transform_error.transformError)(
583
618
  err,
584
619
  {
585
620
  spreadPathsToArguments: {},
586
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
621
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
587
622
  singleArgumentUnchanged: false
588
623
  },
589
- ["subscriptionOptions"]
624
+ ["subscriptionOption"]
590
625
  );
591
626
  sideEffects?.onError?.(err);
592
627
  throw transformedError;
593
628
  }
594
629
  }
595
- async function bulkDeleteSubscriptionOptions2(ids) {
630
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
631
+ const { httpClient, sideEffects } = arguments[2];
632
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
633
+ subscriptionOption: { ...subscriptionOption, id: _id }
634
+ });
635
+ const reqOpts = updateSubscriptionOption(payload);
636
+ sideEffects?.onSiteCall?.();
637
+ try {
638
+ const result = await httpClient.request(reqOpts);
639
+ sideEffects?.onSuccess?.(result);
640
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
641
+ } catch (err) {
642
+ const transformedError = (0, import_transform_error.transformError)(
643
+ err,
644
+ {
645
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
646
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
647
+ singleArgumentUnchanged: false
648
+ },
649
+ ["_id", "subscriptionOption"]
650
+ );
651
+ sideEffects?.onError?.(err);
652
+ throw transformedError;
653
+ }
654
+ }
655
+ async function deleteSubscriptionOption2(_id) {
596
656
  const { httpClient, sideEffects } = arguments[1];
597
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
598
- const reqOpts = bulkDeleteSubscriptionOptions(
599
- payload
600
- );
657
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
658
+ const reqOpts = deleteSubscriptionOption(payload);
601
659
  sideEffects?.onSiteCall?.();
602
660
  try {
603
661
  const result = await httpClient.request(reqOpts);
@@ -607,107 +665,106 @@ async function bulkDeleteSubscriptionOptions2(ids) {
607
665
  err,
608
666
  {
609
667
  spreadPathsToArguments: {},
610
- explicitPathsToArguments: { ids: "$[0]" },
668
+ explicitPathsToArguments: { id: "$[0]" },
611
669
  singleArgumentUnchanged: false
612
670
  },
613
- ["ids"]
671
+ ["_id"]
614
672
  );
615
673
  sideEffects?.onError?.(err);
616
674
  throw transformedError;
617
675
  }
618
676
  }
619
- async function assignSubscriptionOptionsToProduct2(productId, options) {
620
- const { httpClient, sideEffects } = arguments[2];
677
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
678
+ const { httpClient, sideEffects } = arguments[1];
621
679
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
622
- productId,
623
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
680
+ subscriptionOptions
624
681
  });
625
- const reqOpts = assignSubscriptionOptionsToProduct(
682
+ const reqOpts = bulkCreateSubscriptionOptions(
626
683
  payload
627
684
  );
628
685
  sideEffects?.onSiteCall?.();
629
686
  try {
630
687
  const result = await httpClient.request(reqOpts);
631
688
  sideEffects?.onSuccess?.(result);
689
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
632
690
  } catch (err) {
633
691
  const transformedError = (0, import_transform_error.transformError)(
634
692
  err,
635
693
  {
636
694
  spreadPathsToArguments: {},
637
- explicitPathsToArguments: {
638
- productId: "$[0]",
639
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
640
- },
695
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
641
696
  singleArgumentUnchanged: false
642
697
  },
643
- ["productId", "options"]
698
+ ["subscriptionOptions"]
644
699
  );
645
700
  sideEffects?.onError?.(err);
646
701
  throw transformedError;
647
702
  }
648
703
  }
649
- async function allowOneTimePurchases2(productId, allowed) {
650
- const { httpClient, sideEffects } = arguments[2];
704
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
705
+ const { httpClient, sideEffects } = arguments[1];
651
706
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
652
- productId,
653
- allowed
707
+ subscriptionOptions
654
708
  });
655
- const reqOpts = allowOneTimePurchases(payload);
709
+ const reqOpts = bulkUpdateSubscriptionOptions(
710
+ payload
711
+ );
656
712
  sideEffects?.onSiteCall?.();
657
713
  try {
658
714
  const result = await httpClient.request(reqOpts);
659
715
  sideEffects?.onSuccess?.(result);
716
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
660
717
  } catch (err) {
661
718
  const transformedError = (0, import_transform_error.transformError)(
662
719
  err,
663
720
  {
664
721
  spreadPathsToArguments: {},
665
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
722
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
666
723
  singleArgumentUnchanged: false
667
724
  },
668
- ["productId", "allowed"]
725
+ ["subscriptionOptions"]
669
726
  );
670
727
  sideEffects?.onError?.(err);
671
728
  throw transformedError;
672
729
  }
673
730
  }
674
- async function getSubscriptionOption2(_id) {
731
+ async function bulkDeleteSubscriptionOptions2(ids) {
675
732
  const { httpClient, sideEffects } = arguments[1];
676
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
677
- const reqOpts = getSubscriptionOption(payload);
733
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
734
+ const reqOpts = bulkDeleteSubscriptionOptions(
735
+ payload
736
+ );
678
737
  sideEffects?.onSiteCall?.();
679
738
  try {
680
739
  const result = await httpClient.request(reqOpts);
681
740
  sideEffects?.onSuccess?.(result);
682
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
683
741
  } catch (err) {
684
742
  const transformedError = (0, import_transform_error.transformError)(
685
743
  err,
686
744
  {
687
745
  spreadPathsToArguments: {},
688
- explicitPathsToArguments: { id: "$[0]" },
746
+ explicitPathsToArguments: { ids: "$[0]" },
689
747
  singleArgumentUnchanged: false
690
748
  },
691
- ["_id"]
749
+ ["ids"]
692
750
  );
693
751
  sideEffects?.onError?.(err);
694
752
  throw transformedError;
695
753
  }
696
754
  }
697
- async function getSubscriptionOptionsForProduct2(productId, options) {
755
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
698
756
  const { httpClient, sideEffects } = arguments[2];
699
757
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
700
758
  productId,
701
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
759
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
702
760
  });
703
- const reqOpts = getSubscriptionOptionsForProduct(
761
+ const reqOpts = assignSubscriptionOptionsToProduct(
704
762
  payload
705
763
  );
706
764
  sideEffects?.onSiteCall?.();
707
765
  try {
708
766
  const result = await httpClient.request(reqOpts);
709
767
  sideEffects?.onSuccess?.(result);
710
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
711
768
  } catch (err) {
712
769
  const transformedError = (0, import_transform_error.transformError)(
713
770
  err,
@@ -715,7 +772,7 @@ async function getSubscriptionOptionsForProduct2(productId, options) {
715
772
  spreadPathsToArguments: {},
716
773
  explicitPathsToArguments: {
717
774
  productId: "$[0]",
718
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
775
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
719
776
  },
720
777
  singleArgumentUnchanged: false
721
778
  },
@@ -725,59 +782,51 @@ async function getSubscriptionOptionsForProduct2(productId, options) {
725
782
  throw transformedError;
726
783
  }
727
784
  }
728
- async function getProductIdsForSubscriptionOption2(_id, options) {
785
+ async function allowOneTimePurchases2(productId, allowed) {
729
786
  const { httpClient, sideEffects } = arguments[2];
730
787
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
731
- id: _id,
732
- includeHiddenProducts: options?.includeHiddenProducts,
733
- paging: options?.paging
788
+ productId,
789
+ allowed
734
790
  });
735
- const reqOpts = getProductIdsForSubscriptionOption(
736
- payload
737
- );
791
+ const reqOpts = allowOneTimePurchases(payload);
738
792
  sideEffects?.onSiteCall?.();
739
793
  try {
740
794
  const result = await httpClient.request(reqOpts);
741
795
  sideEffects?.onSuccess?.(result);
742
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
743
796
  } catch (err) {
744
797
  const transformedError = (0, import_transform_error.transformError)(
745
798
  err,
746
799
  {
747
800
  spreadPathsToArguments: {},
748
- explicitPathsToArguments: {
749
- id: "$[0]",
750
- includeHiddenProducts: "$[1].includeHiddenProducts",
751
- paging: "$[1].paging"
752
- },
801
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
753
802
  singleArgumentUnchanged: false
754
803
  },
755
- ["_id", "options"]
804
+ ["productId", "allowed"]
756
805
  );
757
806
  sideEffects?.onError?.(err);
758
807
  throw transformedError;
759
808
  }
760
809
  }
761
- async function getOneTimePurchasesStatus2(productId) {
762
- const { httpClient, sideEffects } = arguments[1];
810
+ async function enableCustomerCancellation2(productId, allowed) {
811
+ const { httpClient, sideEffects } = arguments[2];
763
812
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
764
- productId
813
+ productId,
814
+ allowed
765
815
  });
766
- const reqOpts = getOneTimePurchasesStatus(payload);
816
+ const reqOpts = enableCustomerCancellation(payload);
767
817
  sideEffects?.onSiteCall?.();
768
818
  try {
769
819
  const result = await httpClient.request(reqOpts);
770
820
  sideEffects?.onSuccess?.(result);
771
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
772
821
  } catch (err) {
773
822
  const transformedError = (0, import_transform_error.transformError)(
774
823
  err,
775
824
  {
776
825
  spreadPathsToArguments: {},
777
- explicitPathsToArguments: { productId: "$[0]" },
826
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
778
827
  singleArgumentUnchanged: false
779
828
  },
780
- ["productId"]
829
+ ["productId", "allowed"]
781
830
  );
782
831
  sideEffects?.onError?.(err);
783
832
  throw transformedError;
@@ -785,6 +834,36 @@ async function getOneTimePurchasesStatus2(productId) {
785
834
  }
786
835
 
787
836
  // src/stores-v1-subscription-option-subscription-options.public.ts
837
+ function getSubscriptionOption3(httpClient) {
838
+ return (_id) => getSubscriptionOption2(
839
+ _id,
840
+ // @ts-ignore
841
+ { httpClient }
842
+ );
843
+ }
844
+ function getSubscriptionOptionsForProduct3(httpClient) {
845
+ return (productId, options) => getSubscriptionOptionsForProduct2(
846
+ productId,
847
+ options,
848
+ // @ts-ignore
849
+ { httpClient }
850
+ );
851
+ }
852
+ function getProductIdsForSubscriptionOption3(httpClient) {
853
+ return (_id, options) => getProductIdsForSubscriptionOption2(
854
+ _id,
855
+ options,
856
+ // @ts-ignore
857
+ { httpClient }
858
+ );
859
+ }
860
+ function getOneTimePurchasesStatus3(httpClient) {
861
+ return (productId) => getOneTimePurchasesStatus2(
862
+ productId,
863
+ // @ts-ignore
864
+ { httpClient }
865
+ );
866
+ }
788
867
  function createSubscriptionOption3(httpClient) {
789
868
  return (subscriptionOption) => createSubscriptionOption2(
790
869
  subscriptionOption,
@@ -844,32 +923,10 @@ function allowOneTimePurchases3(httpClient) {
844
923
  { httpClient }
845
924
  );
846
925
  }
847
- function getSubscriptionOption3(httpClient) {
848
- return (_id) => getSubscriptionOption2(
849
- _id,
850
- // @ts-ignore
851
- { httpClient }
852
- );
853
- }
854
- function getSubscriptionOptionsForProduct3(httpClient) {
855
- return (productId, options) => getSubscriptionOptionsForProduct2(
856
- productId,
857
- options,
858
- // @ts-ignore
859
- { httpClient }
860
- );
861
- }
862
- function getProductIdsForSubscriptionOption3(httpClient) {
863
- return (_id, options) => getProductIdsForSubscriptionOption2(
864
- _id,
865
- options,
866
- // @ts-ignore
867
- { httpClient }
868
- );
869
- }
870
- function getOneTimePurchasesStatus3(httpClient) {
871
- return (productId) => getOneTimePurchasesStatus2(
926
+ function enableCustomerCancellation3(httpClient) {
927
+ return (productId, allowed) => enableCustomerCancellation2(
872
928
  productId,
929
+ allowed,
873
930
  // @ts-ignore
874
931
  { httpClient }
875
932
  );
@@ -877,6 +934,10 @@ function getOneTimePurchasesStatus3(httpClient) {
877
934
 
878
935
  // src/stores-v1-subscription-option-subscription-options.context.ts
879
936
  var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
937
+ var getSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOption3);
938
+ var getSubscriptionOptionsForProduct4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOptionsForProduct3);
939
+ var getProductIdsForSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getProductIdsForSubscriptionOption3);
940
+ var getOneTimePurchasesStatus4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getOneTimePurchasesStatus3);
880
941
  var createSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createSubscriptionOption3);
881
942
  var updateSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateSubscriptionOption3);
882
943
  var deleteSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deleteSubscriptionOption3);
@@ -885,10 +946,7 @@ var bulkUpdateSubscriptionOptions4 = /* @__PURE__ */ (0, import_rest_modules3.cr
885
946
  var bulkDeleteSubscriptionOptions4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkDeleteSubscriptionOptions3);
886
947
  var assignSubscriptionOptionsToProduct4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(assignSubscriptionOptionsToProduct3);
887
948
  var allowOneTimePurchases4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(allowOneTimePurchases3);
888
- var getSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOption3);
889
- var getSubscriptionOptionsForProduct4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getSubscriptionOptionsForProduct3);
890
- var getProductIdsForSubscriptionOption4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getProductIdsForSubscriptionOption3);
891
- var getOneTimePurchasesStatus4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getOneTimePurchasesStatus3);
949
+ var enableCustomerCancellation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(enableCustomerCancellation3);
892
950
  // Annotate the CommonJS export names for ESM import in node:
893
951
  0 && (module.exports = {
894
952
  DiscountType,
@@ -900,6 +958,7 @@ var getOneTimePurchasesStatus4 = /* @__PURE__ */ (0, import_rest_modules3.create
900
958
  bulkUpdateSubscriptionOptions,
901
959
  createSubscriptionOption,
902
960
  deleteSubscriptionOption,
961
+ enableCustomerCancellation,
903
962
  getOneTimePurchasesStatus,
904
963
  getProductIdsForSubscriptionOption,
905
964
  getSubscriptionOption,