@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
@@ -11,35 +11,6 @@ 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 resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
15
- const domainToMappings = {
16
- "api._api_base_domain_": [
17
- {
18
- srcPath: "/wix-ecommerce-plans-reader",
19
- destPath: ""
20
- }
21
- ],
22
- "www._base_domain_": [
23
- {
24
- srcPath: "/_api/wix-ecommerce-plans-reader",
25
- destPath: ""
26
- }
27
- ],
28
- _: [
29
- {
30
- srcPath: "/_api/subscription-options-reader-server",
31
- destPath: ""
32
- }
33
- ],
34
- "manage._base_domain_": [
35
- {
36
- srcPath: "/_api/subscription-options-reader-server",
37
- destPath: ""
38
- }
39
- ]
40
- };
41
- return resolveUrl(Object.assign(opts, { domainToMappings }));
42
- }
43
14
  function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
44
15
  const domainToMappings = {
45
16
  "api._api_base_domain_": [
@@ -87,7 +58,136 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUr
87
58
  };
88
59
  return resolveUrl(Object.assign(opts, { domainToMappings }));
89
60
  }
61
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
62
+ const domainToMappings = {
63
+ "api._api_base_domain_": [
64
+ {
65
+ srcPath: "/wix-ecommerce-plans-reader",
66
+ destPath: ""
67
+ }
68
+ ],
69
+ "www._base_domain_": [
70
+ {
71
+ srcPath: "/_api/wix-ecommerce-plans-reader",
72
+ destPath: ""
73
+ }
74
+ ],
75
+ _: [
76
+ {
77
+ srcPath: "/_api/subscription-options-reader-server",
78
+ destPath: ""
79
+ }
80
+ ],
81
+ "manage._base_domain_": [
82
+ {
83
+ srcPath: "/_api/subscription-options-reader-server",
84
+ destPath: ""
85
+ }
86
+ ]
87
+ };
88
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
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
+ }
91
191
  function createSubscriptionOption(payload) {
92
192
  function __createSubscriptionOption({ host }) {
93
193
  const serializedData = transformPaths(payload, [
@@ -314,105 +414,28 @@ function allowOneTimePurchases(payload) {
314
414
  }
315
415
  return __allowOneTimePurchases;
316
416
  }
317
- function getSubscriptionOption(payload) {
318
- function __getSubscriptionOption({ host }) {
417
+ function enableCustomerCancellation(payload) {
418
+ function __enableCustomerCancellation({ host }) {
319
419
  const metadata = {
320
420
  entityFqdn: "wix.stores.v1.subscription_option",
321
- method: "GET",
322
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
323
- packageName: PACKAGE_NAME,
324
- migrationOptions: {
325
- optInTransformResponse: true
326
- },
327
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
328
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
329
- ),
330
- params: toURLSearchParams(payload),
331
- transformResponse: (payload2) => transformPaths(payload2, [
332
- {
333
- transformFn: transformRESTFloatToSDKFloat,
334
- paths: [{ path: "subscriptionOption.discount.value" }]
335
- }
336
- ])
337
- };
338
- return metadata;
339
- }
340
- return __getSubscriptionOption;
341
- }
342
- function getSubscriptionOptionsForProduct(payload) {
343
- function __getSubscriptionOptionsForProduct({ host }) {
344
- const metadata = {
345
- entityFqdn: "wix.stores.v1.subscription_option",
346
- method: "GET",
347
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
348
- packageName: PACKAGE_NAME,
349
- migrationOptions: {
350
- optInTransformResponse: true
351
- },
352
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
353
- {
354
- protoPath: "/v1/subscription-options/byProduct/{productId}",
355
- data: payload,
356
- host
357
- }
358
- ),
359
- params: toURLSearchParams(payload),
360
- transformResponse: (payload2) => transformPaths(payload2, [
361
- {
362
- transformFn: transformRESTFloatToSDKFloat,
363
- paths: [{ path: "subscriptionOptions.discount.value" }]
364
- }
365
- ])
366
- };
367
- return metadata;
368
- }
369
- return __getSubscriptionOptionsForProduct;
370
- }
371
- function getProductIdsForSubscriptionOption(payload) {
372
- function __getProductIdsForSubscriptionOption({ host }) {
373
- const metadata = {
374
- entityFqdn: "wix.stores.v1.subscription_option",
375
- method: "GET",
376
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
377
- packageName: PACKAGE_NAME,
378
- migrationOptions: {
379
- optInTransformResponse: true
380
- },
381
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
382
- {
383
- protoPath: "/v1/subscription-options/{id}/productIds",
384
- data: payload,
385
- host
386
- }
387
- ),
388
- params: toURLSearchParams(payload)
389
- };
390
- return metadata;
391
- }
392
- return __getProductIdsForSubscriptionOption;
393
- }
394
- function getOneTimePurchasesStatus(payload) {
395
- function __getOneTimePurchasesStatus({ host }) {
396
- const metadata = {
397
- entityFqdn: "wix.stores.v1.subscription_option",
398
- method: "GET",
399
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
421
+ method: "PATCH",
422
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.EnableCustomerCancellation",
400
423
  packageName: PACKAGE_NAME,
401
424
  migrationOptions: {
402
425
  optInTransformResponse: true
403
426
  },
404
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
427
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
405
428
  {
406
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
429
+ protoPath: "/v1/subscription-options/product/{productId}/enableCustomerCancellation",
407
430
  data: payload,
408
431
  host
409
432
  }
410
433
  ),
411
- params: toURLSearchParams(payload)
434
+ data: payload
412
435
  };
413
436
  return metadata;
414
437
  }
415
- return __getOneTimePurchasesStatus;
438
+ return __enableCustomerCancellation;
416
439
  }
417
440
 
418
441
  // src/stores-v1-subscription-option-subscription-options.universal.ts
@@ -430,12 +453,10 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
430
453
  DiscountType2["PERCENT"] = "PERCENT";
431
454
  return DiscountType2;
432
455
  })(DiscountType || {});
433
- async function createSubscriptionOption2(subscriptionOption) {
456
+ async function getSubscriptionOption2(_id) {
434
457
  const { httpClient, sideEffects } = arguments[1];
435
- const payload = renameKeysFromSDKRequestToRESTRequest({
436
- subscriptionOption
437
- });
438
- const reqOpts = createSubscriptionOption(payload);
458
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
459
+ const reqOpts = getSubscriptionOption(payload);
439
460
  sideEffects?.onSiteCall?.();
440
461
  try {
441
462
  const result = await httpClient.request(reqOpts);
@@ -446,70 +467,85 @@ async function createSubscriptionOption2(subscriptionOption) {
446
467
  err,
447
468
  {
448
469
  spreadPathsToArguments: {},
449
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
470
+ explicitPathsToArguments: { id: "$[0]" },
450
471
  singleArgumentUnchanged: false
451
472
  },
452
- ["subscriptionOption"]
473
+ ["_id"]
453
474
  );
454
475
  sideEffects?.onError?.(err);
455
476
  throw transformedError;
456
477
  }
457
478
  }
458
- async function updateSubscriptionOption2(_id, subscriptionOption) {
479
+ async function getSubscriptionOptionsForProduct2(productId, options) {
459
480
  const { httpClient, sideEffects } = arguments[2];
460
481
  const payload = renameKeysFromSDKRequestToRESTRequest({
461
- subscriptionOption: { ...subscriptionOption, id: _id }
482
+ productId,
483
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
462
484
  });
463
- const reqOpts = updateSubscriptionOption(payload);
485
+ const reqOpts = getSubscriptionOptionsForProduct(
486
+ payload
487
+ );
464
488
  sideEffects?.onSiteCall?.();
465
489
  try {
466
490
  const result = await httpClient.request(reqOpts);
467
491
  sideEffects?.onSuccess?.(result);
468
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
492
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
469
493
  } catch (err) {
470
494
  const transformedError = sdkTransformError(
471
495
  err,
472
496
  {
473
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
474
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
497
+ spreadPathsToArguments: {},
498
+ explicitPathsToArguments: {
499
+ productId: "$[0]",
500
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
501
+ },
475
502
  singleArgumentUnchanged: false
476
503
  },
477
- ["_id", "subscriptionOption"]
504
+ ["productId", "options"]
478
505
  );
479
506
  sideEffects?.onError?.(err);
480
507
  throw transformedError;
481
508
  }
482
509
  }
483
- async function deleteSubscriptionOption2(_id) {
484
- const { httpClient, sideEffects } = arguments[1];
485
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
486
- const reqOpts = deleteSubscriptionOption(payload);
510
+ async function getProductIdsForSubscriptionOption2(_id, options) {
511
+ const { httpClient, sideEffects } = arguments[2];
512
+ const payload = renameKeysFromSDKRequestToRESTRequest({
513
+ id: _id,
514
+ includeHiddenProducts: options?.includeHiddenProducts,
515
+ paging: options?.paging
516
+ });
517
+ const reqOpts = getProductIdsForSubscriptionOption(
518
+ payload
519
+ );
487
520
  sideEffects?.onSiteCall?.();
488
521
  try {
489
522
  const result = await httpClient.request(reqOpts);
490
523
  sideEffects?.onSuccess?.(result);
524
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
491
525
  } catch (err) {
492
526
  const transformedError = sdkTransformError(
493
527
  err,
494
528
  {
495
529
  spreadPathsToArguments: {},
496
- explicitPathsToArguments: { id: "$[0]" },
530
+ explicitPathsToArguments: {
531
+ id: "$[0]",
532
+ includeHiddenProducts: "$[1].includeHiddenProducts",
533
+ paging: "$[1].paging"
534
+ },
497
535
  singleArgumentUnchanged: false
498
536
  },
499
- ["_id"]
537
+ ["_id", "options"]
500
538
  );
501
539
  sideEffects?.onError?.(err);
502
540
  throw transformedError;
503
541
  }
504
542
  }
505
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
543
+ async function getOneTimePurchasesStatus2(productId) {
506
544
  const { httpClient, sideEffects } = arguments[1];
507
545
  const payload = renameKeysFromSDKRequestToRESTRequest({
508
- subscriptionOptions
546
+ productId
509
547
  });
510
- const reqOpts = bulkCreateSubscriptionOptions(
511
- payload
512
- );
548
+ const reqOpts = getOneTimePurchasesStatus(payload);
513
549
  sideEffects?.onSiteCall?.();
514
550
  try {
515
551
  const result = await httpClient.request(reqOpts);
@@ -520,48 +556,69 @@ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
520
556
  err,
521
557
  {
522
558
  spreadPathsToArguments: {},
523
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
559
+ explicitPathsToArguments: { productId: "$[0]" },
524
560
  singleArgumentUnchanged: false
525
561
  },
526
- ["subscriptionOptions"]
562
+ ["productId"]
527
563
  );
528
564
  sideEffects?.onError?.(err);
529
565
  throw transformedError;
530
566
  }
531
567
  }
532
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
568
+ async function createSubscriptionOption2(subscriptionOption) {
533
569
  const { httpClient, sideEffects } = arguments[1];
534
570
  const payload = renameKeysFromSDKRequestToRESTRequest({
535
- subscriptionOptions
571
+ subscriptionOption
536
572
  });
537
- const reqOpts = bulkUpdateSubscriptionOptions(
538
- payload
539
- );
573
+ const reqOpts = createSubscriptionOption(payload);
540
574
  sideEffects?.onSiteCall?.();
541
575
  try {
542
576
  const result = await httpClient.request(reqOpts);
543
577
  sideEffects?.onSuccess?.(result);
544
- return renameKeysFromRESTResponseToSDKResponse(result.data);
578
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
545
579
  } catch (err) {
546
580
  const transformedError = sdkTransformError(
547
581
  err,
548
582
  {
549
583
  spreadPathsToArguments: {},
550
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
584
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
551
585
  singleArgumentUnchanged: false
552
586
  },
553
- ["subscriptionOptions"]
587
+ ["subscriptionOption"]
554
588
  );
555
589
  sideEffects?.onError?.(err);
556
590
  throw transformedError;
557
591
  }
558
592
  }
559
- async function bulkDeleteSubscriptionOptions2(ids) {
593
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
594
+ const { httpClient, sideEffects } = arguments[2];
595
+ const payload = renameKeysFromSDKRequestToRESTRequest({
596
+ subscriptionOption: { ...subscriptionOption, id: _id }
597
+ });
598
+ const reqOpts = updateSubscriptionOption(payload);
599
+ sideEffects?.onSiteCall?.();
600
+ try {
601
+ const result = await httpClient.request(reqOpts);
602
+ sideEffects?.onSuccess?.(result);
603
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
604
+ } catch (err) {
605
+ const transformedError = sdkTransformError(
606
+ err,
607
+ {
608
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
609
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
610
+ singleArgumentUnchanged: false
611
+ },
612
+ ["_id", "subscriptionOption"]
613
+ );
614
+ sideEffects?.onError?.(err);
615
+ throw transformedError;
616
+ }
617
+ }
618
+ async function deleteSubscriptionOption2(_id) {
560
619
  const { httpClient, sideEffects } = arguments[1];
561
- const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
562
- const reqOpts = bulkDeleteSubscriptionOptions(
563
- payload
564
- );
620
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
621
+ const reqOpts = deleteSubscriptionOption(payload);
565
622
  sideEffects?.onSiteCall?.();
566
623
  try {
567
624
  const result = await httpClient.request(reqOpts);
@@ -571,107 +628,106 @@ async function bulkDeleteSubscriptionOptions2(ids) {
571
628
  err,
572
629
  {
573
630
  spreadPathsToArguments: {},
574
- explicitPathsToArguments: { ids: "$[0]" },
631
+ explicitPathsToArguments: { id: "$[0]" },
575
632
  singleArgumentUnchanged: false
576
633
  },
577
- ["ids"]
634
+ ["_id"]
578
635
  );
579
636
  sideEffects?.onError?.(err);
580
637
  throw transformedError;
581
638
  }
582
639
  }
583
- async function assignSubscriptionOptionsToProduct2(productId, options) {
584
- const { httpClient, sideEffects } = arguments[2];
640
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
641
+ const { httpClient, sideEffects } = arguments[1];
585
642
  const payload = renameKeysFromSDKRequestToRESTRequest({
586
- productId,
587
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
643
+ subscriptionOptions
588
644
  });
589
- const reqOpts = assignSubscriptionOptionsToProduct(
645
+ const reqOpts = bulkCreateSubscriptionOptions(
590
646
  payload
591
647
  );
592
648
  sideEffects?.onSiteCall?.();
593
649
  try {
594
650
  const result = await httpClient.request(reqOpts);
595
651
  sideEffects?.onSuccess?.(result);
652
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
596
653
  } catch (err) {
597
654
  const transformedError = sdkTransformError(
598
655
  err,
599
656
  {
600
657
  spreadPathsToArguments: {},
601
- explicitPathsToArguments: {
602
- productId: "$[0]",
603
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
604
- },
658
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
605
659
  singleArgumentUnchanged: false
606
660
  },
607
- ["productId", "options"]
661
+ ["subscriptionOptions"]
608
662
  );
609
663
  sideEffects?.onError?.(err);
610
664
  throw transformedError;
611
665
  }
612
666
  }
613
- async function allowOneTimePurchases2(productId, allowed) {
614
- const { httpClient, sideEffects } = arguments[2];
667
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
668
+ const { httpClient, sideEffects } = arguments[1];
615
669
  const payload = renameKeysFromSDKRequestToRESTRequest({
616
- productId,
617
- allowed
670
+ subscriptionOptions
618
671
  });
619
- const reqOpts = allowOneTimePurchases(payload);
672
+ const reqOpts = bulkUpdateSubscriptionOptions(
673
+ payload
674
+ );
620
675
  sideEffects?.onSiteCall?.();
621
676
  try {
622
677
  const result = await httpClient.request(reqOpts);
623
678
  sideEffects?.onSuccess?.(result);
679
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
624
680
  } catch (err) {
625
681
  const transformedError = sdkTransformError(
626
682
  err,
627
683
  {
628
684
  spreadPathsToArguments: {},
629
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
685
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
630
686
  singleArgumentUnchanged: false
631
687
  },
632
- ["productId", "allowed"]
688
+ ["subscriptionOptions"]
633
689
  );
634
690
  sideEffects?.onError?.(err);
635
691
  throw transformedError;
636
692
  }
637
693
  }
638
- async function getSubscriptionOption2(_id) {
694
+ async function bulkDeleteSubscriptionOptions2(ids) {
639
695
  const { httpClient, sideEffects } = arguments[1];
640
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
641
- const reqOpts = getSubscriptionOption(payload);
696
+ const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
697
+ const reqOpts = bulkDeleteSubscriptionOptions(
698
+ payload
699
+ );
642
700
  sideEffects?.onSiteCall?.();
643
701
  try {
644
702
  const result = await httpClient.request(reqOpts);
645
703
  sideEffects?.onSuccess?.(result);
646
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
647
704
  } catch (err) {
648
705
  const transformedError = sdkTransformError(
649
706
  err,
650
707
  {
651
708
  spreadPathsToArguments: {},
652
- explicitPathsToArguments: { id: "$[0]" },
709
+ explicitPathsToArguments: { ids: "$[0]" },
653
710
  singleArgumentUnchanged: false
654
711
  },
655
- ["_id"]
712
+ ["ids"]
656
713
  );
657
714
  sideEffects?.onError?.(err);
658
715
  throw transformedError;
659
716
  }
660
717
  }
661
- async function getSubscriptionOptionsForProduct2(productId, options) {
718
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
662
719
  const { httpClient, sideEffects } = arguments[2];
663
720
  const payload = renameKeysFromSDKRequestToRESTRequest({
664
721
  productId,
665
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
722
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
666
723
  });
667
- const reqOpts = getSubscriptionOptionsForProduct(
724
+ const reqOpts = assignSubscriptionOptionsToProduct(
668
725
  payload
669
726
  );
670
727
  sideEffects?.onSiteCall?.();
671
728
  try {
672
729
  const result = await httpClient.request(reqOpts);
673
730
  sideEffects?.onSuccess?.(result);
674
- return renameKeysFromRESTResponseToSDKResponse(result.data);
675
731
  } catch (err) {
676
732
  const transformedError = sdkTransformError(
677
733
  err,
@@ -679,7 +735,7 @@ async function getSubscriptionOptionsForProduct2(productId, options) {
679
735
  spreadPathsToArguments: {},
680
736
  explicitPathsToArguments: {
681
737
  productId: "$[0]",
682
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
738
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
683
739
  },
684
740
  singleArgumentUnchanged: false
685
741
  },
@@ -689,59 +745,51 @@ async function getSubscriptionOptionsForProduct2(productId, options) {
689
745
  throw transformedError;
690
746
  }
691
747
  }
692
- async function getProductIdsForSubscriptionOption2(_id, options) {
748
+ async function allowOneTimePurchases2(productId, allowed) {
693
749
  const { httpClient, sideEffects } = arguments[2];
694
750
  const payload = renameKeysFromSDKRequestToRESTRequest({
695
- id: _id,
696
- includeHiddenProducts: options?.includeHiddenProducts,
697
- paging: options?.paging
751
+ productId,
752
+ allowed
698
753
  });
699
- const reqOpts = getProductIdsForSubscriptionOption(
700
- payload
701
- );
754
+ const reqOpts = allowOneTimePurchases(payload);
702
755
  sideEffects?.onSiteCall?.();
703
756
  try {
704
757
  const result = await httpClient.request(reqOpts);
705
758
  sideEffects?.onSuccess?.(result);
706
- return renameKeysFromRESTResponseToSDKResponse(result.data);
707
759
  } catch (err) {
708
760
  const transformedError = sdkTransformError(
709
761
  err,
710
762
  {
711
763
  spreadPathsToArguments: {},
712
- explicitPathsToArguments: {
713
- id: "$[0]",
714
- includeHiddenProducts: "$[1].includeHiddenProducts",
715
- paging: "$[1].paging"
716
- },
764
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
717
765
  singleArgumentUnchanged: false
718
766
  },
719
- ["_id", "options"]
767
+ ["productId", "allowed"]
720
768
  );
721
769
  sideEffects?.onError?.(err);
722
770
  throw transformedError;
723
771
  }
724
772
  }
725
- async function getOneTimePurchasesStatus2(productId) {
726
- const { httpClient, sideEffects } = arguments[1];
773
+ async function enableCustomerCancellation2(productId, allowed) {
774
+ const { httpClient, sideEffects } = arguments[2];
727
775
  const payload = renameKeysFromSDKRequestToRESTRequest({
728
- productId
776
+ productId,
777
+ allowed
729
778
  });
730
- const reqOpts = getOneTimePurchasesStatus(payload);
779
+ const reqOpts = enableCustomerCancellation(payload);
731
780
  sideEffects?.onSiteCall?.();
732
781
  try {
733
782
  const result = await httpClient.request(reqOpts);
734
783
  sideEffects?.onSuccess?.(result);
735
- return renameKeysFromRESTResponseToSDKResponse(result.data);
736
784
  } catch (err) {
737
785
  const transformedError = sdkTransformError(
738
786
  err,
739
787
  {
740
788
  spreadPathsToArguments: {},
741
- explicitPathsToArguments: { productId: "$[0]" },
789
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
742
790
  singleArgumentUnchanged: false
743
791
  },
744
- ["productId"]
792
+ ["productId", "allowed"]
745
793
  );
746
794
  sideEffects?.onError?.(err);
747
795
  throw transformedError;
@@ -757,6 +805,7 @@ export {
757
805
  bulkUpdateSubscriptionOptions2 as bulkUpdateSubscriptionOptions,
758
806
  createSubscriptionOption2 as createSubscriptionOption,
759
807
  deleteSubscriptionOption2 as deleteSubscriptionOption,
808
+ enableCustomerCancellation2 as enableCustomerCancellation,
760
809
  getOneTimePurchasesStatus2 as getOneTimePurchasesStatus,
761
810
  getProductIdsForSubscriptionOption2 as getProductIdsForSubscriptionOption,
762
811
  getSubscriptionOption2 as getSubscriptionOption,