@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
@@ -29,6 +29,7 @@ __export(index_typings_exports, {
29
29
  bulkUpdateSubscriptionOptions: () => bulkUpdateSubscriptionOptions2,
30
30
  createSubscriptionOption: () => createSubscriptionOption2,
31
31
  deleteSubscriptionOption: () => deleteSubscriptionOption2,
32
+ enableCustomerCancellation: () => enableCustomerCancellation2,
32
33
  getOneTimePurchasesStatus: () => getOneTimePurchasesStatus2,
33
34
  getProductIdsForSubscriptionOption: () => getProductIdsForSubscriptionOption2,
34
35
  getSubscriptionOption: () => getSubscriptionOption2,
@@ -47,76 +48,76 @@ 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 resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
51
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
51
52
  const domainToMappings = {
52
53
  "api._api_base_domain_": [
53
54
  {
54
- srcPath: "/wix-ecommerce-plans",
55
+ srcPath: "/wix-ecommerce-plans-reader",
55
56
  destPath: ""
56
57
  }
57
58
  ],
58
- "www.wixapis.com": [
59
+ "www._base_domain_": [
59
60
  {
60
- srcPath: "/stores/v1/subscription-options",
61
- destPath: "/v1/subscription-options"
61
+ srcPath: "/_api/wix-ecommerce-plans-reader",
62
+ destPath: ""
62
63
  }
63
64
  ],
64
- "www._base_domain_": [
65
+ _: [
65
66
  {
66
- srcPath: "/_api/subscription-options-server",
67
+ srcPath: "/_api/subscription-options-reader-server",
67
68
  destPath: ""
68
69
  }
69
70
  ],
70
- "editor._base_domain_": [
71
+ "manage._base_domain_": [
71
72
  {
72
- srcPath: "/_api/subscription-options-server",
73
+ srcPath: "/_api/subscription-options-reader-server",
73
74
  destPath: ""
74
75
  }
75
- ],
76
- "blocks._base_domain_": [
76
+ ]
77
+ };
78
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
79
+ }
80
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
81
+ const domainToMappings = {
82
+ "api._api_base_domain_": [
77
83
  {
78
- srcPath: "/_api/subscription-options-server",
84
+ srcPath: "/wix-ecommerce-plans",
79
85
  destPath: ""
80
86
  }
81
87
  ],
82
- "create.editorx": [
88
+ "www.wixapis.com": [
83
89
  {
84
- srcPath: "/_api/subscription-options-server",
85
- destPath: ""
90
+ srcPath: "/stores/v1/subscription-options",
91
+ destPath: "/v1/subscription-options"
86
92
  }
87
93
  ],
88
- "manage._base_domain_": [
94
+ "www._base_domain_": [
89
95
  {
90
96
  srcPath: "/_api/subscription-options-server",
91
97
  destPath: ""
92
98
  }
93
- ]
94
- };
95
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
96
- }
97
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
98
- const domainToMappings = {
99
- "api._api_base_domain_": [
99
+ ],
100
+ "editor._base_domain_": [
100
101
  {
101
- srcPath: "/wix-ecommerce-plans-reader",
102
+ srcPath: "/_api/subscription-options-server",
102
103
  destPath: ""
103
104
  }
104
105
  ],
105
- "www._base_domain_": [
106
+ "blocks._base_domain_": [
106
107
  {
107
- srcPath: "/_api/wix-ecommerce-plans-reader",
108
+ srcPath: "/_api/subscription-options-server",
108
109
  destPath: ""
109
110
  }
110
111
  ],
111
- _: [
112
+ "create.editorx": [
112
113
  {
113
- srcPath: "/_api/subscription-options-reader-server",
114
+ srcPath: "/_api/subscription-options-server",
114
115
  destPath: ""
115
116
  }
116
117
  ],
117
118
  "manage._base_domain_": [
118
119
  {
119
- srcPath: "/_api/subscription-options-reader-server",
120
+ srcPath: "/_api/subscription-options-server",
120
121
  destPath: ""
121
122
  }
122
123
  ]
@@ -124,106 +125,6 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl
124
125
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
125
126
  }
126
127
  var PACKAGE_NAME = "@wix/auto_sdk_stores_subscription-options";
127
- function getSubscriptionOption(payload) {
128
- function __getSubscriptionOption({ host }) {
129
- const metadata = {
130
- entityFqdn: "wix.stores.v1.subscription_option",
131
- method: "GET",
132
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
133
- packageName: PACKAGE_NAME,
134
- migrationOptions: {
135
- optInTransformResponse: true
136
- },
137
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
138
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
139
- ),
140
- params: (0, import_rest_modules.toURLSearchParams)(payload),
141
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
142
- {
143
- transformFn: import_float2.transformRESTFloatToSDKFloat,
144
- paths: [{ path: "subscriptionOption.discount.value" }]
145
- }
146
- ])
147
- };
148
- return metadata;
149
- }
150
- return __getSubscriptionOption;
151
- }
152
- function getSubscriptionOptionsForProduct(payload) {
153
- function __getSubscriptionOptionsForProduct({ host }) {
154
- const metadata = {
155
- entityFqdn: "wix.stores.v1.subscription_option",
156
- method: "GET",
157
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
158
- packageName: PACKAGE_NAME,
159
- migrationOptions: {
160
- optInTransformResponse: true
161
- },
162
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
163
- {
164
- protoPath: "/v1/subscription-options/byProduct/{productId}",
165
- data: payload,
166
- host
167
- }
168
- ),
169
- params: (0, import_rest_modules.toURLSearchParams)(payload),
170
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
171
- {
172
- transformFn: import_float2.transformRESTFloatToSDKFloat,
173
- paths: [{ path: "subscriptionOptions.discount.value" }]
174
- }
175
- ])
176
- };
177
- return metadata;
178
- }
179
- return __getSubscriptionOptionsForProduct;
180
- }
181
- function getProductIdsForSubscriptionOption(payload) {
182
- function __getProductIdsForSubscriptionOption({ host }) {
183
- const metadata = {
184
- entityFqdn: "wix.stores.v1.subscription_option",
185
- method: "GET",
186
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
187
- packageName: PACKAGE_NAME,
188
- migrationOptions: {
189
- optInTransformResponse: true
190
- },
191
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
192
- {
193
- protoPath: "/v1/subscription-options/{id}/productIds",
194
- data: payload,
195
- host
196
- }
197
- ),
198
- params: (0, import_rest_modules.toURLSearchParams)(payload)
199
- };
200
- return metadata;
201
- }
202
- return __getProductIdsForSubscriptionOption;
203
- }
204
- function getOneTimePurchasesStatus(payload) {
205
- function __getOneTimePurchasesStatus({ host }) {
206
- const metadata = {
207
- entityFqdn: "wix.stores.v1.subscription_option",
208
- method: "GET",
209
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
210
- packageName: PACKAGE_NAME,
211
- migrationOptions: {
212
- optInTransformResponse: true
213
- },
214
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
215
- {
216
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
217
- data: payload,
218
- host
219
- }
220
- ),
221
- params: (0, import_rest_modules.toURLSearchParams)(payload)
222
- };
223
- return metadata;
224
- }
225
- return __getOneTimePurchasesStatus;
226
- }
227
128
  function createSubscriptionOption(payload) {
228
129
  function __createSubscriptionOption({ host }) {
229
130
  const serializedData = (0, import_transform_paths.transformPaths)(payload, [
@@ -450,6 +351,129 @@ function allowOneTimePurchases(payload) {
450
351
  }
451
352
  return __allowOneTimePurchases;
452
353
  }
354
+ function enableCustomerCancellation(payload) {
355
+ function __enableCustomerCancellation({ host }) {
356
+ const metadata = {
357
+ entityFqdn: "wix.stores.v1.subscription_option",
358
+ method: "PATCH",
359
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsWriteApi.EnableCustomerCancellation",
360
+ packageName: PACKAGE_NAME,
361
+ migrationOptions: {
362
+ optInTransformResponse: true
363
+ },
364
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(
365
+ {
366
+ protoPath: "/v1/subscription-options/product/{productId}/enableCustomerCancellation",
367
+ data: payload,
368
+ host
369
+ }
370
+ ),
371
+ data: payload
372
+ };
373
+ return metadata;
374
+ }
375
+ return __enableCustomerCancellation;
376
+ }
377
+ function getSubscriptionOption(payload) {
378
+ function __getSubscriptionOption({ host }) {
379
+ const metadata = {
380
+ entityFqdn: "wix.stores.v1.subscription_option",
381
+ method: "GET",
382
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
383
+ packageName: PACKAGE_NAME,
384
+ migrationOptions: {
385
+ optInTransformResponse: true
386
+ },
387
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
388
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
389
+ ),
390
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
391
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
392
+ {
393
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
394
+ paths: [{ path: "subscriptionOption.discount.value" }]
395
+ }
396
+ ])
397
+ };
398
+ return metadata;
399
+ }
400
+ return __getSubscriptionOption;
401
+ }
402
+ function getSubscriptionOptionsForProduct(payload) {
403
+ function __getSubscriptionOptionsForProduct({ host }) {
404
+ const metadata = {
405
+ entityFqdn: "wix.stores.v1.subscription_option",
406
+ method: "GET",
407
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
408
+ packageName: PACKAGE_NAME,
409
+ migrationOptions: {
410
+ optInTransformResponse: true
411
+ },
412
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
413
+ {
414
+ protoPath: "/v1/subscription-options/byProduct/{productId}",
415
+ data: payload,
416
+ host
417
+ }
418
+ ),
419
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
420
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
421
+ {
422
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
423
+ paths: [{ path: "subscriptionOptions.discount.value" }]
424
+ }
425
+ ])
426
+ };
427
+ return metadata;
428
+ }
429
+ return __getSubscriptionOptionsForProduct;
430
+ }
431
+ function getProductIdsForSubscriptionOption(payload) {
432
+ function __getProductIdsForSubscriptionOption({ host }) {
433
+ const metadata = {
434
+ entityFqdn: "wix.stores.v1.subscription_option",
435
+ method: "GET",
436
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
437
+ packageName: PACKAGE_NAME,
438
+ migrationOptions: {
439
+ optInTransformResponse: true
440
+ },
441
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
442
+ {
443
+ protoPath: "/v1/subscription-options/{id}/productIds",
444
+ data: payload,
445
+ host
446
+ }
447
+ ),
448
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
449
+ };
450
+ return metadata;
451
+ }
452
+ return __getProductIdsForSubscriptionOption;
453
+ }
454
+ function getOneTimePurchasesStatus(payload) {
455
+ function __getOneTimePurchasesStatus({ host }) {
456
+ const metadata = {
457
+ entityFqdn: "wix.stores.v1.subscription_option",
458
+ method: "GET",
459
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
460
+ packageName: PACKAGE_NAME,
461
+ migrationOptions: {
462
+ optInTransformResponse: true
463
+ },
464
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
465
+ {
466
+ protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
467
+ data: payload,
468
+ host
469
+ }
470
+ ),
471
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
472
+ };
473
+ return metadata;
474
+ }
475
+ return __getOneTimePurchasesStatus;
476
+ }
453
477
 
454
478
  // src/stores-v1-subscription-option-subscription-options.universal.ts
455
479
  var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
@@ -466,10 +490,12 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
466
490
  DiscountType2["PERCENT"] = "PERCENT";
467
491
  return DiscountType2;
468
492
  })(DiscountType || {});
469
- async function getSubscriptionOption2(_id) {
493
+ async function createSubscriptionOption2(subscriptionOption) {
470
494
  const { httpClient, sideEffects } = arguments[1];
471
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
472
- const reqOpts = getSubscriptionOption(payload);
495
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
496
+ subscriptionOption
497
+ });
498
+ const reqOpts = createSubscriptionOption(payload);
473
499
  sideEffects?.onSiteCall?.();
474
500
  try {
475
501
  const result = await httpClient.request(reqOpts);
@@ -480,54 +506,68 @@ async function getSubscriptionOption2(_id) {
480
506
  err,
481
507
  {
482
508
  spreadPathsToArguments: {},
483
- explicitPathsToArguments: { id: "$[0]" },
509
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
484
510
  singleArgumentUnchanged: false
485
511
  },
486
- ["_id"]
512
+ ["subscriptionOption"]
487
513
  );
488
514
  sideEffects?.onError?.(err);
489
515
  throw transformedError;
490
516
  }
491
517
  }
492
- async function getSubscriptionOptionsForProduct2(productId, options) {
518
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
493
519
  const { httpClient, sideEffects } = arguments[2];
494
520
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
495
- productId,
496
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
521
+ subscriptionOption: { ...subscriptionOption, id: _id }
497
522
  });
498
- const reqOpts = getSubscriptionOptionsForProduct(
499
- payload
500
- );
523
+ const reqOpts = updateSubscriptionOption(payload);
524
+ sideEffects?.onSiteCall?.();
525
+ try {
526
+ const result = await httpClient.request(reqOpts);
527
+ sideEffects?.onSuccess?.(result);
528
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
529
+ } catch (err) {
530
+ const transformedError = (0, import_transform_error.transformError)(
531
+ err,
532
+ {
533
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
534
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
535
+ singleArgumentUnchanged: false
536
+ },
537
+ ["_id", "subscriptionOption"]
538
+ );
539
+ sideEffects?.onError?.(err);
540
+ throw transformedError;
541
+ }
542
+ }
543
+ async function deleteSubscriptionOption2(_id) {
544
+ const { httpClient, sideEffects } = arguments[1];
545
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
546
+ const reqOpts = deleteSubscriptionOption(payload);
501
547
  sideEffects?.onSiteCall?.();
502
548
  try {
503
549
  const result = await httpClient.request(reqOpts);
504
550
  sideEffects?.onSuccess?.(result);
505
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
506
551
  } catch (err) {
507
552
  const transformedError = (0, import_transform_error.transformError)(
508
553
  err,
509
554
  {
510
555
  spreadPathsToArguments: {},
511
- explicitPathsToArguments: {
512
- productId: "$[0]",
513
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
514
- },
556
+ explicitPathsToArguments: { id: "$[0]" },
515
557
  singleArgumentUnchanged: false
516
558
  },
517
- ["productId", "options"]
559
+ ["_id"]
518
560
  );
519
561
  sideEffects?.onError?.(err);
520
562
  throw transformedError;
521
563
  }
522
564
  }
523
- async function getProductIdsForSubscriptionOption2(_id, options) {
524
- const { httpClient, sideEffects } = arguments[2];
565
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
566
+ const { httpClient, sideEffects } = arguments[1];
525
567
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
526
- id: _id,
527
- includeHiddenProducts: options?.includeHiddenProducts,
528
- paging: options?.paging
568
+ subscriptionOptions
529
569
  });
530
- const reqOpts = getProductIdsForSubscriptionOption(
570
+ const reqOpts = bulkCreateSubscriptionOptions(
531
571
  payload
532
572
  );
533
573
  sideEffects?.onSiteCall?.();
@@ -540,25 +580,23 @@ async function getProductIdsForSubscriptionOption2(_id, options) {
540
580
  err,
541
581
  {
542
582
  spreadPathsToArguments: {},
543
- explicitPathsToArguments: {
544
- id: "$[0]",
545
- includeHiddenProducts: "$[1].includeHiddenProducts",
546
- paging: "$[1].paging"
547
- },
583
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
548
584
  singleArgumentUnchanged: false
549
585
  },
550
- ["_id", "options"]
586
+ ["subscriptionOptions"]
551
587
  );
552
588
  sideEffects?.onError?.(err);
553
589
  throw transformedError;
554
590
  }
555
591
  }
556
- async function getOneTimePurchasesStatus2(productId) {
592
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
557
593
  const { httpClient, sideEffects } = arguments[1];
558
594
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
559
- productId
595
+ subscriptionOptions
560
596
  });
561
- const reqOpts = getOneTimePurchasesStatus(payload);
597
+ const reqOpts = bulkUpdateSubscriptionOptions(
598
+ payload
599
+ );
562
600
  sideEffects?.onSiteCall?.();
563
601
  try {
564
602
  const result = await httpClient.request(reqOpts);
@@ -569,69 +607,76 @@ async function getOneTimePurchasesStatus2(productId) {
569
607
  err,
570
608
  {
571
609
  spreadPathsToArguments: {},
572
- explicitPathsToArguments: { productId: "$[0]" },
610
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
573
611
  singleArgumentUnchanged: false
574
612
  },
575
- ["productId"]
613
+ ["subscriptionOptions"]
576
614
  );
577
615
  sideEffects?.onError?.(err);
578
616
  throw transformedError;
579
617
  }
580
618
  }
581
- async function createSubscriptionOption2(subscriptionOption) {
619
+ async function bulkDeleteSubscriptionOptions2(ids) {
582
620
  const { httpClient, sideEffects } = arguments[1];
583
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
584
- subscriptionOption
585
- });
586
- const reqOpts = createSubscriptionOption(payload);
621
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
622
+ const reqOpts = bulkDeleteSubscriptionOptions(
623
+ payload
624
+ );
587
625
  sideEffects?.onSiteCall?.();
588
626
  try {
589
627
  const result = await httpClient.request(reqOpts);
590
628
  sideEffects?.onSuccess?.(result);
591
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
592
629
  } catch (err) {
593
630
  const transformedError = (0, import_transform_error.transformError)(
594
631
  err,
595
632
  {
596
633
  spreadPathsToArguments: {},
597
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
634
+ explicitPathsToArguments: { ids: "$[0]" },
598
635
  singleArgumentUnchanged: false
599
636
  },
600
- ["subscriptionOption"]
637
+ ["ids"]
601
638
  );
602
639
  sideEffects?.onError?.(err);
603
640
  throw transformedError;
604
641
  }
605
642
  }
606
- async function updateSubscriptionOption2(_id, subscriptionOption) {
643
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
607
644
  const { httpClient, sideEffects } = arguments[2];
608
645
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
609
- subscriptionOption: { ...subscriptionOption, id: _id }
646
+ productId,
647
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
610
648
  });
611
- const reqOpts = updateSubscriptionOption(payload);
649
+ const reqOpts = assignSubscriptionOptionsToProduct(
650
+ payload
651
+ );
612
652
  sideEffects?.onSiteCall?.();
613
653
  try {
614
654
  const result = await httpClient.request(reqOpts);
615
655
  sideEffects?.onSuccess?.(result);
616
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
617
656
  } catch (err) {
618
657
  const transformedError = (0, import_transform_error.transformError)(
619
658
  err,
620
659
  {
621
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
622
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
660
+ spreadPathsToArguments: {},
661
+ explicitPathsToArguments: {
662
+ productId: "$[0]",
663
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
664
+ },
623
665
  singleArgumentUnchanged: false
624
666
  },
625
- ["_id", "subscriptionOption"]
667
+ ["productId", "options"]
626
668
  );
627
669
  sideEffects?.onError?.(err);
628
670
  throw transformedError;
629
671
  }
630
672
  }
631
- async function deleteSubscriptionOption2(_id) {
632
- const { httpClient, sideEffects } = arguments[1];
633
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
634
- const reqOpts = deleteSubscriptionOption(payload);
673
+ async function allowOneTimePurchases2(productId, allowed) {
674
+ const { httpClient, sideEffects } = arguments[2];
675
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
676
+ productId,
677
+ allowed
678
+ });
679
+ const reqOpts = allowOneTimePurchases(payload);
635
680
  sideEffects?.onSiteCall?.();
636
681
  try {
637
682
  const result = await httpClient.request(reqOpts);
@@ -641,143 +686,147 @@ async function deleteSubscriptionOption2(_id) {
641
686
  err,
642
687
  {
643
688
  spreadPathsToArguments: {},
644
- explicitPathsToArguments: { id: "$[0]" },
689
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
645
690
  singleArgumentUnchanged: false
646
691
  },
647
- ["_id"]
692
+ ["productId", "allowed"]
648
693
  );
649
694
  sideEffects?.onError?.(err);
650
695
  throw transformedError;
651
696
  }
652
697
  }
653
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
654
- const { httpClient, sideEffects } = arguments[1];
698
+ async function enableCustomerCancellation2(productId, allowed) {
699
+ const { httpClient, sideEffects } = arguments[2];
655
700
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
656
- subscriptionOptions
701
+ productId,
702
+ allowed
657
703
  });
658
- const reqOpts = bulkCreateSubscriptionOptions(
659
- payload
660
- );
704
+ const reqOpts = enableCustomerCancellation(payload);
661
705
  sideEffects?.onSiteCall?.();
662
706
  try {
663
707
  const result = await httpClient.request(reqOpts);
664
708
  sideEffects?.onSuccess?.(result);
665
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
666
709
  } catch (err) {
667
710
  const transformedError = (0, import_transform_error.transformError)(
668
711
  err,
669
712
  {
670
713
  spreadPathsToArguments: {},
671
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
714
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
672
715
  singleArgumentUnchanged: false
673
716
  },
674
- ["subscriptionOptions"]
717
+ ["productId", "allowed"]
675
718
  );
676
719
  sideEffects?.onError?.(err);
677
720
  throw transformedError;
678
721
  }
679
722
  }
680
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
723
+ async function getSubscriptionOption2(_id) {
681
724
  const { httpClient, sideEffects } = arguments[1];
682
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
683
- subscriptionOptions
684
- });
685
- const reqOpts = bulkUpdateSubscriptionOptions(
686
- payload
687
- );
725
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
726
+ const reqOpts = getSubscriptionOption(payload);
688
727
  sideEffects?.onSiteCall?.();
689
728
  try {
690
729
  const result = await httpClient.request(reqOpts);
691
730
  sideEffects?.onSuccess?.(result);
692
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
731
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.subscriptionOption;
693
732
  } catch (err) {
694
733
  const transformedError = (0, import_transform_error.transformError)(
695
734
  err,
696
735
  {
697
736
  spreadPathsToArguments: {},
698
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
737
+ explicitPathsToArguments: { id: "$[0]" },
699
738
  singleArgumentUnchanged: false
700
739
  },
701
- ["subscriptionOptions"]
740
+ ["_id"]
702
741
  );
703
742
  sideEffects?.onError?.(err);
704
743
  throw transformedError;
705
744
  }
706
745
  }
707
- async function bulkDeleteSubscriptionOptions2(ids) {
708
- const { httpClient, sideEffects } = arguments[1];
709
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ ids });
710
- const reqOpts = bulkDeleteSubscriptionOptions(
746
+ async function getSubscriptionOptionsForProduct2(productId, options) {
747
+ const { httpClient, sideEffects } = arguments[2];
748
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
749
+ productId,
750
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
751
+ });
752
+ const reqOpts = getSubscriptionOptionsForProduct(
711
753
  payload
712
754
  );
713
755
  sideEffects?.onSiteCall?.();
714
756
  try {
715
757
  const result = await httpClient.request(reqOpts);
716
758
  sideEffects?.onSuccess?.(result);
759
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
717
760
  } catch (err) {
718
761
  const transformedError = (0, import_transform_error.transformError)(
719
762
  err,
720
763
  {
721
764
  spreadPathsToArguments: {},
722
- explicitPathsToArguments: { ids: "$[0]" },
765
+ explicitPathsToArguments: {
766
+ productId: "$[0]",
767
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
768
+ },
723
769
  singleArgumentUnchanged: false
724
770
  },
725
- ["ids"]
771
+ ["productId", "options"]
726
772
  );
727
773
  sideEffects?.onError?.(err);
728
774
  throw transformedError;
729
775
  }
730
776
  }
731
- async function assignSubscriptionOptionsToProduct2(productId, options) {
777
+ async function getProductIdsForSubscriptionOption2(_id, options) {
732
778
  const { httpClient, sideEffects } = arguments[2];
733
779
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
734
- productId,
735
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
780
+ id: _id,
781
+ includeHiddenProducts: options?.includeHiddenProducts,
782
+ paging: options?.paging
736
783
  });
737
- const reqOpts = assignSubscriptionOptionsToProduct(
784
+ const reqOpts = getProductIdsForSubscriptionOption(
738
785
  payload
739
786
  );
740
787
  sideEffects?.onSiteCall?.();
741
788
  try {
742
789
  const result = await httpClient.request(reqOpts);
743
790
  sideEffects?.onSuccess?.(result);
791
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
744
792
  } catch (err) {
745
793
  const transformedError = (0, import_transform_error.transformError)(
746
794
  err,
747
795
  {
748
796
  spreadPathsToArguments: {},
749
797
  explicitPathsToArguments: {
750
- productId: "$[0]",
751
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
798
+ id: "$[0]",
799
+ includeHiddenProducts: "$[1].includeHiddenProducts",
800
+ paging: "$[1].paging"
752
801
  },
753
802
  singleArgumentUnchanged: false
754
803
  },
755
- ["productId", "options"]
804
+ ["_id", "options"]
756
805
  );
757
806
  sideEffects?.onError?.(err);
758
807
  throw transformedError;
759
808
  }
760
809
  }
761
- async function allowOneTimePurchases2(productId, allowed) {
762
- const { httpClient, sideEffects } = arguments[2];
810
+ async function getOneTimePurchasesStatus2(productId) {
811
+ const { httpClient, sideEffects } = arguments[1];
763
812
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
764
- productId,
765
- allowed
813
+ productId
766
814
  });
767
- const reqOpts = allowOneTimePurchases(payload);
815
+ const reqOpts = getOneTimePurchasesStatus(payload);
768
816
  sideEffects?.onSiteCall?.();
769
817
  try {
770
818
  const result = await httpClient.request(reqOpts);
771
819
  sideEffects?.onSuccess?.(result);
820
+ 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]", allowed: "$[1]" },
826
+ explicitPathsToArguments: { productId: "$[0]" },
778
827
  singleArgumentUnchanged: false
779
828
  },
780
- ["productId", "allowed"]
829
+ ["productId"]
781
830
  );
782
831
  sideEffects?.onError?.(err);
783
832
  throw transformedError;
@@ -794,6 +843,7 @@ async function allowOneTimePurchases2(productId, allowed) {
794
843
  bulkUpdateSubscriptionOptions,
795
844
  createSubscriptionOption,
796
845
  deleteSubscriptionOption,
846
+ enableCustomerCancellation,
797
847
  getOneTimePurchasesStatus,
798
848
  getProductIdsForSubscriptionOption,
799
849
  getSubscriptionOption,