@wix/auto_sdk_stores_subscription-options 1.0.29 → 1.0.31

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 +58 -47
  2. package/build/cjs/index.js +333 -274
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +183 -158
  5. package/build/cjs/index.typings.js +273 -223
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +123 -109
  8. package/build/cjs/meta.js +246 -203
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +58 -47
  11. package/build/es/index.mjs +332 -274
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +183 -158
  14. package/build/es/index.typings.mjs +272 -223
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +123 -109
  17. package/build/es/meta.mjs +245 -203
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +58 -47
  20. package/build/internal/cjs/index.js +333 -274
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +183 -158
  23. package/build/internal/cjs/index.typings.js +273 -223
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +123 -109
  26. package/build/internal/cjs/meta.js +246 -203
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +58 -47
  29. package/build/internal/es/index.mjs +332 -274
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +183 -158
  32. package/build/internal/es/index.typings.mjs +272 -223
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +123 -109
  35. package/build/internal/es/meta.mjs +245 -203
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -11,76 +11,76 @@ import { transformSDKFloatToRESTFloat } from "@wix/sdk-runtime/transformations/f
11
11
  import { transformRESTFloatToSDKFloat } from "@wix/sdk-runtime/transformations/float";
12
12
  import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
13
13
  import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
14
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
14
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
15
15
  const domainToMappings = {
16
16
  "api._api_base_domain_": [
17
17
  {
18
- srcPath: "/wix-ecommerce-plans",
18
+ srcPath: "/wix-ecommerce-plans-reader",
19
19
  destPath: ""
20
20
  }
21
21
  ],
22
- "www.wixapis.com": [
22
+ "www._base_domain_": [
23
23
  {
24
- srcPath: "/stores/v1/subscription-options",
25
- destPath: "/v1/subscription-options"
24
+ srcPath: "/_api/wix-ecommerce-plans-reader",
25
+ destPath: ""
26
26
  }
27
27
  ],
28
- "www._base_domain_": [
28
+ _: [
29
29
  {
30
- srcPath: "/_api/subscription-options-server",
30
+ srcPath: "/_api/subscription-options-reader-server",
31
31
  destPath: ""
32
32
  }
33
33
  ],
34
- "editor._base_domain_": [
34
+ "manage._base_domain_": [
35
35
  {
36
- srcPath: "/_api/subscription-options-server",
36
+ srcPath: "/_api/subscription-options-reader-server",
37
37
  destPath: ""
38
38
  }
39
- ],
40
- "blocks._base_domain_": [
39
+ ]
40
+ };
41
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
42
+ }
43
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
44
+ const domainToMappings = {
45
+ "api._api_base_domain_": [
41
46
  {
42
- srcPath: "/_api/subscription-options-server",
47
+ srcPath: "/wix-ecommerce-plans",
43
48
  destPath: ""
44
49
  }
45
50
  ],
46
- "create.editorx": [
51
+ "www.wixapis.com": [
47
52
  {
48
- srcPath: "/_api/subscription-options-server",
49
- destPath: ""
53
+ srcPath: "/stores/v1/subscription-options",
54
+ destPath: "/v1/subscription-options"
50
55
  }
51
56
  ],
52
- "manage._base_domain_": [
57
+ "www._base_domain_": [
53
58
  {
54
59
  srcPath: "/_api/subscription-options-server",
55
60
  destPath: ""
56
61
  }
57
- ]
58
- };
59
- return resolveUrl(Object.assign(opts, { domainToMappings }));
60
- }
61
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
62
- const domainToMappings = {
63
- "api._api_base_domain_": [
62
+ ],
63
+ "editor._base_domain_": [
64
64
  {
65
- srcPath: "/wix-ecommerce-plans-reader",
65
+ srcPath: "/_api/subscription-options-server",
66
66
  destPath: ""
67
67
  }
68
68
  ],
69
- "www._base_domain_": [
69
+ "blocks._base_domain_": [
70
70
  {
71
- srcPath: "/_api/wix-ecommerce-plans-reader",
71
+ srcPath: "/_api/subscription-options-server",
72
72
  destPath: ""
73
73
  }
74
74
  ],
75
- _: [
75
+ "create.editorx": [
76
76
  {
77
- srcPath: "/_api/subscription-options-reader-server",
77
+ srcPath: "/_api/subscription-options-server",
78
78
  destPath: ""
79
79
  }
80
80
  ],
81
81
  "manage._base_domain_": [
82
82
  {
83
- srcPath: "/_api/subscription-options-reader-server",
83
+ srcPath: "/_api/subscription-options-server",
84
84
  destPath: ""
85
85
  }
86
86
  ]
@@ -88,106 +88,6 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl
88
88
  return resolveUrl(Object.assign(opts, { domainToMappings }));
89
89
  }
90
90
  var PACKAGE_NAME = "@wix/auto_sdk_stores_subscription-options";
91
- function getSubscriptionOption(payload) {
92
- function __getSubscriptionOption({ host }) {
93
- const metadata = {
94
- entityFqdn: "wix.stores.v1.subscription_option",
95
- method: "GET",
96
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
97
- packageName: PACKAGE_NAME,
98
- migrationOptions: {
99
- optInTransformResponse: true
100
- },
101
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
102
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
103
- ),
104
- params: toURLSearchParams(payload),
105
- transformResponse: (payload2) => transformPaths(payload2, [
106
- {
107
- transformFn: transformRESTFloatToSDKFloat,
108
- paths: [{ path: "subscriptionOption.discount.value" }]
109
- }
110
- ])
111
- };
112
- return metadata;
113
- }
114
- return __getSubscriptionOption;
115
- }
116
- function getSubscriptionOptionsForProduct(payload) {
117
- function __getSubscriptionOptionsForProduct({ host }) {
118
- const metadata = {
119
- entityFqdn: "wix.stores.v1.subscription_option",
120
- method: "GET",
121
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
122
- packageName: PACKAGE_NAME,
123
- migrationOptions: {
124
- optInTransformResponse: true
125
- },
126
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
127
- {
128
- protoPath: "/v1/subscription-options/byProduct/{productId}",
129
- data: payload,
130
- host
131
- }
132
- ),
133
- params: toURLSearchParams(payload),
134
- transformResponse: (payload2) => transformPaths(payload2, [
135
- {
136
- transformFn: transformRESTFloatToSDKFloat,
137
- paths: [{ path: "subscriptionOptions.discount.value" }]
138
- }
139
- ])
140
- };
141
- return metadata;
142
- }
143
- return __getSubscriptionOptionsForProduct;
144
- }
145
- function getProductIdsForSubscriptionOption(payload) {
146
- function __getProductIdsForSubscriptionOption({ host }) {
147
- const metadata = {
148
- entityFqdn: "wix.stores.v1.subscription_option",
149
- method: "GET",
150
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
151
- packageName: PACKAGE_NAME,
152
- migrationOptions: {
153
- optInTransformResponse: true
154
- },
155
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
156
- {
157
- protoPath: "/v1/subscription-options/{id}/productIds",
158
- data: payload,
159
- host
160
- }
161
- ),
162
- params: toURLSearchParams(payload)
163
- };
164
- return metadata;
165
- }
166
- return __getProductIdsForSubscriptionOption;
167
- }
168
- function getOneTimePurchasesStatus(payload) {
169
- function __getOneTimePurchasesStatus({ host }) {
170
- const metadata = {
171
- entityFqdn: "wix.stores.v1.subscription_option",
172
- method: "GET",
173
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
174
- packageName: PACKAGE_NAME,
175
- migrationOptions: {
176
- optInTransformResponse: true
177
- },
178
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
179
- {
180
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
181
- data: payload,
182
- host
183
- }
184
- ),
185
- params: toURLSearchParams(payload)
186
- };
187
- return metadata;
188
- }
189
- return __getOneTimePurchasesStatus;
190
- }
191
91
  function createSubscriptionOption(payload) {
192
92
  function __createSubscriptionOption({ host }) {
193
93
  const serializedData = transformPaths(payload, [
@@ -414,134 +314,145 @@ function allowOneTimePurchases(payload) {
414
314
  }
415
315
  return __allowOneTimePurchases;
416
316
  }
417
-
418
- // src/stores-v1-subscription-option-subscription-options.universal.ts
419
- var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
420
- SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
421
- SubscriptionFrequency2["DAY"] = "DAY";
422
- SubscriptionFrequency2["WEEK"] = "WEEK";
423
- SubscriptionFrequency2["MONTH"] = "MONTH";
424
- SubscriptionFrequency2["YEAR"] = "YEAR";
425
- return SubscriptionFrequency2;
426
- })(SubscriptionFrequency || {});
427
- var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
428
- DiscountType2["UNDEFINED"] = "UNDEFINED";
429
- DiscountType2["AMOUNT"] = "AMOUNT";
430
- DiscountType2["PERCENT"] = "PERCENT";
431
- return DiscountType2;
432
- })(DiscountType || {});
433
- async function getSubscriptionOption2(_id) {
434
- const { httpClient, sideEffects } = arguments[1];
435
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
436
- const reqOpts = getSubscriptionOption(payload);
437
- sideEffects?.onSiteCall?.();
438
- try {
439
- const result = await httpClient.request(reqOpts);
440
- sideEffects?.onSuccess?.(result);
441
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
442
- } catch (err) {
443
- const transformedError = sdkTransformError(
444
- err,
445
- {
446
- spreadPathsToArguments: {},
447
- explicitPathsToArguments: { id: "$[0]" },
448
- singleArgumentUnchanged: false
317
+ function enableCustomerCancellation(payload) {
318
+ function __enableCustomerCancellation({ host }) {
319
+ const metadata = {
320
+ entityFqdn: "wix.stores.v1.subscription_option",
321
+ method: "PATCH",
322
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.EnableCustomerCancellation",
323
+ packageName: PACKAGE_NAME,
324
+ migrationOptions: {
325
+ optInTransformResponse: true
449
326
  },
450
- ["_id"]
451
- );
452
- sideEffects?.onError?.(err);
453
- throw transformedError;
327
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
328
+ {
329
+ protoPath: "/v1/subscription-options/product/{productId}/enableCustomerCancellation",
330
+ data: payload,
331
+ host
332
+ }
333
+ ),
334
+ data: payload
335
+ };
336
+ return metadata;
454
337
  }
338
+ return __enableCustomerCancellation;
455
339
  }
456
- async function getSubscriptionOptionsForProduct2(productId, options) {
457
- const { httpClient, sideEffects } = arguments[2];
458
- const payload = renameKeysFromSDKRequestToRESTRequest({
459
- productId,
460
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
461
- });
462
- const reqOpts = getSubscriptionOptionsForProduct(
463
- payload
464
- );
465
- sideEffects?.onSiteCall?.();
466
- try {
467
- const result = await httpClient.request(reqOpts);
468
- sideEffects?.onSuccess?.(result);
469
- return renameKeysFromRESTResponseToSDKResponse(result.data);
470
- } catch (err) {
471
- const transformedError = sdkTransformError(
472
- err,
473
- {
474
- spreadPathsToArguments: {},
475
- explicitPathsToArguments: {
476
- productId: "$[0]",
477
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
478
- },
479
- singleArgumentUnchanged: false
340
+ function getSubscriptionOption(payload) {
341
+ function __getSubscriptionOption({ host }) {
342
+ const metadata = {
343
+ entityFqdn: "wix.stores.v1.subscription_option",
344
+ method: "GET",
345
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
346
+ packageName: PACKAGE_NAME,
347
+ migrationOptions: {
348
+ optInTransformResponse: true
480
349
  },
481
- ["productId", "options"]
482
- );
483
- sideEffects?.onError?.(err);
484
- throw transformedError;
350
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
351
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
352
+ ),
353
+ params: toURLSearchParams(payload),
354
+ transformResponse: (payload2) => transformPaths(payload2, [
355
+ {
356
+ transformFn: transformRESTFloatToSDKFloat,
357
+ paths: [{ path: "subscriptionOption.discount.value" }]
358
+ }
359
+ ])
360
+ };
361
+ return metadata;
485
362
  }
363
+ return __getSubscriptionOption;
486
364
  }
487
- async function getProductIdsForSubscriptionOption2(_id, options) {
488
- const { httpClient, sideEffects } = arguments[2];
489
- const payload = renameKeysFromSDKRequestToRESTRequest({
490
- id: _id,
491
- includeHiddenProducts: options?.includeHiddenProducts,
492
- paging: options?.paging
493
- });
494
- const reqOpts = getProductIdsForSubscriptionOption(
495
- payload
496
- );
497
- sideEffects?.onSiteCall?.();
498
- try {
499
- const result = await httpClient.request(reqOpts);
500
- sideEffects?.onSuccess?.(result);
501
- return renameKeysFromRESTResponseToSDKResponse(result.data);
502
- } catch (err) {
503
- const transformedError = sdkTransformError(
504
- err,
505
- {
506
- spreadPathsToArguments: {},
507
- explicitPathsToArguments: {
508
- id: "$[0]",
509
- includeHiddenProducts: "$[1].includeHiddenProducts",
510
- paging: "$[1].paging"
511
- },
512
- singleArgumentUnchanged: false
365
+ function getSubscriptionOptionsForProduct(payload) {
366
+ function __getSubscriptionOptionsForProduct({ host }) {
367
+ const metadata = {
368
+ entityFqdn: "wix.stores.v1.subscription_option",
369
+ method: "GET",
370
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
371
+ packageName: PACKAGE_NAME,
372
+ migrationOptions: {
373
+ optInTransformResponse: true
513
374
  },
514
- ["_id", "options"]
515
- );
516
- sideEffects?.onError?.(err);
517
- throw transformedError;
375
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
376
+ {
377
+ protoPath: "/v1/subscription-options/byProduct/{productId}",
378
+ data: payload,
379
+ host
380
+ }
381
+ ),
382
+ params: toURLSearchParams(payload),
383
+ transformResponse: (payload2) => transformPaths(payload2, [
384
+ {
385
+ transformFn: transformRESTFloatToSDKFloat,
386
+ paths: [{ path: "subscriptionOptions.discount.value" }]
387
+ }
388
+ ])
389
+ };
390
+ return metadata;
518
391
  }
392
+ return __getSubscriptionOptionsForProduct;
519
393
  }
520
- async function getOneTimePurchasesStatus2(productId) {
521
- const { httpClient, sideEffects } = arguments[1];
522
- const payload = renameKeysFromSDKRequestToRESTRequest({
523
- productId
524
- });
525
- const reqOpts = getOneTimePurchasesStatus(payload);
526
- sideEffects?.onSiteCall?.();
527
- try {
528
- const result = await httpClient.request(reqOpts);
529
- sideEffects?.onSuccess?.(result);
530
- return renameKeysFromRESTResponseToSDKResponse(result.data);
531
- } catch (err) {
532
- const transformedError = sdkTransformError(
533
- err,
534
- {
535
- spreadPathsToArguments: {},
536
- explicitPathsToArguments: { productId: "$[0]" },
537
- singleArgumentUnchanged: false
394
+ function getProductIdsForSubscriptionOption(payload) {
395
+ function __getProductIdsForSubscriptionOption({ host }) {
396
+ const metadata = {
397
+ entityFqdn: "wix.stores.v1.subscription_option",
398
+ method: "GET",
399
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
400
+ packageName: PACKAGE_NAME,
401
+ migrationOptions: {
402
+ optInTransformResponse: true
538
403
  },
539
- ["productId"]
540
- );
541
- sideEffects?.onError?.(err);
542
- throw transformedError;
404
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
405
+ {
406
+ protoPath: "/v1/subscription-options/{id}/productIds",
407
+ data: payload,
408
+ host
409
+ }
410
+ ),
411
+ params: toURLSearchParams(payload)
412
+ };
413
+ return metadata;
414
+ }
415
+ return __getProductIdsForSubscriptionOption;
416
+ }
417
+ function getOneTimePurchasesStatus(payload) {
418
+ function __getOneTimePurchasesStatus({ host }) {
419
+ const metadata = {
420
+ entityFqdn: "wix.stores.v1.subscription_option",
421
+ method: "GET",
422
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
423
+ packageName: PACKAGE_NAME,
424
+ migrationOptions: {
425
+ optInTransformResponse: true
426
+ },
427
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
428
+ {
429
+ protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
430
+ data: payload,
431
+ host
432
+ }
433
+ ),
434
+ params: toURLSearchParams(payload)
435
+ };
436
+ return metadata;
543
437
  }
438
+ return __getOneTimePurchasesStatus;
544
439
  }
440
+
441
+ // src/stores-v1-subscription-option-subscription-options.universal.ts
442
+ var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
443
+ SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
444
+ SubscriptionFrequency2["DAY"] = "DAY";
445
+ SubscriptionFrequency2["WEEK"] = "WEEK";
446
+ SubscriptionFrequency2["MONTH"] = "MONTH";
447
+ SubscriptionFrequency2["YEAR"] = "YEAR";
448
+ return SubscriptionFrequency2;
449
+ })(SubscriptionFrequency || {});
450
+ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
451
+ DiscountType2["UNDEFINED"] = "UNDEFINED";
452
+ DiscountType2["AMOUNT"] = "AMOUNT";
453
+ DiscountType2["PERCENT"] = "PERCENT";
454
+ return DiscountType2;
455
+ })(DiscountType || {});
545
456
  async function createSubscriptionOption2(subscriptionOption) {
546
457
  const { httpClient, sideEffects } = arguments[1];
547
458
  const payload = renameKeysFromSDKRequestToRESTRequest({
@@ -747,38 +658,145 @@ async function allowOneTimePurchases2(productId, allowed) {
747
658
  throw transformedError;
748
659
  }
749
660
  }
750
-
751
- // src/stores-v1-subscription-option-subscription-options.public.ts
752
- function getSubscriptionOption3(httpClient) {
753
- return (_id) => getSubscriptionOption2(
754
- _id,
755
- // @ts-ignore
756
- { httpClient }
757
- );
661
+ async function enableCustomerCancellation2(productId, allowed) {
662
+ const { httpClient, sideEffects } = arguments[2];
663
+ const payload = renameKeysFromSDKRequestToRESTRequest({
664
+ productId,
665
+ allowed
666
+ });
667
+ const reqOpts = enableCustomerCancellation(payload);
668
+ sideEffects?.onSiteCall?.();
669
+ try {
670
+ const result = await httpClient.request(reqOpts);
671
+ sideEffects?.onSuccess?.(result);
672
+ } catch (err) {
673
+ const transformedError = sdkTransformError(
674
+ err,
675
+ {
676
+ spreadPathsToArguments: {},
677
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
678
+ singleArgumentUnchanged: false
679
+ },
680
+ ["productId", "allowed"]
681
+ );
682
+ sideEffects?.onError?.(err);
683
+ throw transformedError;
684
+ }
758
685
  }
759
- function getSubscriptionOptionsForProduct3(httpClient) {
760
- return (productId, options) => getSubscriptionOptionsForProduct2(
686
+ async function getSubscriptionOption2(_id) {
687
+ const { httpClient, sideEffects } = arguments[1];
688
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
689
+ const reqOpts = getSubscriptionOption(payload);
690
+ sideEffects?.onSiteCall?.();
691
+ try {
692
+ const result = await httpClient.request(reqOpts);
693
+ sideEffects?.onSuccess?.(result);
694
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
695
+ } catch (err) {
696
+ const transformedError = sdkTransformError(
697
+ err,
698
+ {
699
+ spreadPathsToArguments: {},
700
+ explicitPathsToArguments: { id: "$[0]" },
701
+ singleArgumentUnchanged: false
702
+ },
703
+ ["_id"]
704
+ );
705
+ sideEffects?.onError?.(err);
706
+ throw transformedError;
707
+ }
708
+ }
709
+ async function getSubscriptionOptionsForProduct2(productId, options) {
710
+ const { httpClient, sideEffects } = arguments[2];
711
+ const payload = renameKeysFromSDKRequestToRESTRequest({
761
712
  productId,
762
- options,
763
- // @ts-ignore
764
- { httpClient }
713
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
714
+ });
715
+ const reqOpts = getSubscriptionOptionsForProduct(
716
+ payload
765
717
  );
718
+ sideEffects?.onSiteCall?.();
719
+ try {
720
+ const result = await httpClient.request(reqOpts);
721
+ sideEffects?.onSuccess?.(result);
722
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
723
+ } catch (err) {
724
+ const transformedError = sdkTransformError(
725
+ err,
726
+ {
727
+ spreadPathsToArguments: {},
728
+ explicitPathsToArguments: {
729
+ productId: "$[0]",
730
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
731
+ },
732
+ singleArgumentUnchanged: false
733
+ },
734
+ ["productId", "options"]
735
+ );
736
+ sideEffects?.onError?.(err);
737
+ throw transformedError;
738
+ }
766
739
  }
767
- function getProductIdsForSubscriptionOption3(httpClient) {
768
- return (_id, options) => getProductIdsForSubscriptionOption2(
769
- _id,
770
- options,
771
- // @ts-ignore
772
- { httpClient }
740
+ async function getProductIdsForSubscriptionOption2(_id, options) {
741
+ const { httpClient, sideEffects } = arguments[2];
742
+ const payload = renameKeysFromSDKRequestToRESTRequest({
743
+ id: _id,
744
+ includeHiddenProducts: options?.includeHiddenProducts,
745
+ paging: options?.paging
746
+ });
747
+ const reqOpts = getProductIdsForSubscriptionOption(
748
+ payload
773
749
  );
750
+ sideEffects?.onSiteCall?.();
751
+ try {
752
+ const result = await httpClient.request(reqOpts);
753
+ sideEffects?.onSuccess?.(result);
754
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
755
+ } catch (err) {
756
+ const transformedError = sdkTransformError(
757
+ err,
758
+ {
759
+ spreadPathsToArguments: {},
760
+ explicitPathsToArguments: {
761
+ id: "$[0]",
762
+ includeHiddenProducts: "$[1].includeHiddenProducts",
763
+ paging: "$[1].paging"
764
+ },
765
+ singleArgumentUnchanged: false
766
+ },
767
+ ["_id", "options"]
768
+ );
769
+ sideEffects?.onError?.(err);
770
+ throw transformedError;
771
+ }
774
772
  }
775
- function getOneTimePurchasesStatus3(httpClient) {
776
- return (productId) => getOneTimePurchasesStatus2(
777
- productId,
778
- // @ts-ignore
779
- { httpClient }
780
- );
773
+ async function getOneTimePurchasesStatus2(productId) {
774
+ const { httpClient, sideEffects } = arguments[1];
775
+ const payload = renameKeysFromSDKRequestToRESTRequest({
776
+ productId
777
+ });
778
+ const reqOpts = getOneTimePurchasesStatus(payload);
779
+ sideEffects?.onSiteCall?.();
780
+ try {
781
+ const result = await httpClient.request(reqOpts);
782
+ sideEffects?.onSuccess?.(result);
783
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
784
+ } catch (err) {
785
+ const transformedError = sdkTransformError(
786
+ err,
787
+ {
788
+ spreadPathsToArguments: {},
789
+ explicitPathsToArguments: { productId: "$[0]" },
790
+ singleArgumentUnchanged: false
791
+ },
792
+ ["productId"]
793
+ );
794
+ sideEffects?.onError?.(err);
795
+ throw transformedError;
796
+ }
781
797
  }
798
+
799
+ // src/stores-v1-subscription-option-subscription-options.public.ts
782
800
  function createSubscriptionOption3(httpClient) {
783
801
  return (subscriptionOption) => createSubscriptionOption2(
784
802
  subscriptionOption,
@@ -838,13 +856,47 @@ function allowOneTimePurchases3(httpClient) {
838
856
  { httpClient }
839
857
  );
840
858
  }
859
+ function enableCustomerCancellation3(httpClient) {
860
+ return (productId, allowed) => enableCustomerCancellation2(
861
+ productId,
862
+ allowed,
863
+ // @ts-ignore
864
+ { httpClient }
865
+ );
866
+ }
867
+ function getSubscriptionOption3(httpClient) {
868
+ return (_id) => getSubscriptionOption2(
869
+ _id,
870
+ // @ts-ignore
871
+ { httpClient }
872
+ );
873
+ }
874
+ function getSubscriptionOptionsForProduct3(httpClient) {
875
+ return (productId, options) => getSubscriptionOptionsForProduct2(
876
+ productId,
877
+ options,
878
+ // @ts-ignore
879
+ { httpClient }
880
+ );
881
+ }
882
+ function getProductIdsForSubscriptionOption3(httpClient) {
883
+ return (_id, options) => getProductIdsForSubscriptionOption2(
884
+ _id,
885
+ options,
886
+ // @ts-ignore
887
+ { httpClient }
888
+ );
889
+ }
890
+ function getOneTimePurchasesStatus3(httpClient) {
891
+ return (productId) => getOneTimePurchasesStatus2(
892
+ productId,
893
+ // @ts-ignore
894
+ { httpClient }
895
+ );
896
+ }
841
897
 
842
898
  // src/stores-v1-subscription-option-subscription-options.context.ts
843
899
  import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
844
- var getSubscriptionOption4 = /* @__PURE__ */ createRESTModule(getSubscriptionOption3);
845
- var getSubscriptionOptionsForProduct4 = /* @__PURE__ */ createRESTModule(getSubscriptionOptionsForProduct3);
846
- var getProductIdsForSubscriptionOption4 = /* @__PURE__ */ createRESTModule(getProductIdsForSubscriptionOption3);
847
- var getOneTimePurchasesStatus4 = /* @__PURE__ */ createRESTModule(getOneTimePurchasesStatus3);
848
900
  var createSubscriptionOption4 = /* @__PURE__ */ createRESTModule(createSubscriptionOption3);
849
901
  var updateSubscriptionOption4 = /* @__PURE__ */ createRESTModule(updateSubscriptionOption3);
850
902
  var deleteSubscriptionOption4 = /* @__PURE__ */ createRESTModule(deleteSubscriptionOption3);
@@ -853,6 +905,11 @@ var bulkUpdateSubscriptionOptions4 = /* @__PURE__ */ createRESTModule(bulkUpdate
853
905
  var bulkDeleteSubscriptionOptions4 = /* @__PURE__ */ createRESTModule(bulkDeleteSubscriptionOptions3);
854
906
  var assignSubscriptionOptionsToProduct4 = /* @__PURE__ */ createRESTModule(assignSubscriptionOptionsToProduct3);
855
907
  var allowOneTimePurchases4 = /* @__PURE__ */ createRESTModule(allowOneTimePurchases3);
908
+ var enableCustomerCancellation4 = /* @__PURE__ */ createRESTModule(enableCustomerCancellation3);
909
+ var getSubscriptionOption4 = /* @__PURE__ */ createRESTModule(getSubscriptionOption3);
910
+ var getSubscriptionOptionsForProduct4 = /* @__PURE__ */ createRESTModule(getSubscriptionOptionsForProduct3);
911
+ var getProductIdsForSubscriptionOption4 = /* @__PURE__ */ createRESTModule(getProductIdsForSubscriptionOption3);
912
+ var getOneTimePurchasesStatus4 = /* @__PURE__ */ createRESTModule(getOneTimePurchasesStatus3);
856
913
  export {
857
914
  DiscountType,
858
915
  SubscriptionFrequency,
@@ -863,6 +920,7 @@ export {
863
920
  bulkUpdateSubscriptionOptions4 as bulkUpdateSubscriptionOptions,
864
921
  createSubscriptionOption4 as createSubscriptionOption,
865
922
  deleteSubscriptionOption4 as deleteSubscriptionOption,
923
+ enableCustomerCancellation4 as enableCustomerCancellation,
866
924
  getOneTimePurchasesStatus4 as getOneTimePurchasesStatus,
867
925
  getProductIdsForSubscriptionOption4 as getProductIdsForSubscriptionOption,
868
926
  getSubscriptionOption4 as getSubscriptionOption,