@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,6 +314,129 @@ function allowOneTimePurchases(payload) {
414
314
  }
415
315
  return __allowOneTimePurchases;
416
316
  }
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
326
+ },
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;
337
+ }
338
+ return __enableCustomerCancellation;
339
+ }
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
349
+ },
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;
362
+ }
363
+ return __getSubscriptionOption;
364
+ }
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
374
+ },
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;
391
+ }
392
+ return __getSubscriptionOptionsForProduct;
393
+ }
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
403
+ },
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;
437
+ }
438
+ return __getOneTimePurchasesStatus;
439
+ }
417
440
 
418
441
  // src/stores-v1-subscription-option-subscription-options.universal.ts
419
442
  var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
@@ -430,10 +453,12 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
430
453
  DiscountType2["PERCENT"] = "PERCENT";
431
454
  return DiscountType2;
432
455
  })(DiscountType || {});
433
- async function getSubscriptionOption2(_id) {
456
+ async function createSubscriptionOption2(subscriptionOption) {
434
457
  const { httpClient, sideEffects } = arguments[1];
435
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
436
- const reqOpts = getSubscriptionOption(payload);
458
+ const payload = renameKeysFromSDKRequestToRESTRequest({
459
+ subscriptionOption
460
+ });
461
+ const reqOpts = createSubscriptionOption(payload);
437
462
  sideEffects?.onSiteCall?.();
438
463
  try {
439
464
  const result = await httpClient.request(reqOpts);
@@ -444,54 +469,68 @@ async function getSubscriptionOption2(_id) {
444
469
  err,
445
470
  {
446
471
  spreadPathsToArguments: {},
447
- explicitPathsToArguments: { id: "$[0]" },
472
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
448
473
  singleArgumentUnchanged: false
449
474
  },
450
- ["_id"]
475
+ ["subscriptionOption"]
451
476
  );
452
477
  sideEffects?.onError?.(err);
453
478
  throw transformedError;
454
479
  }
455
480
  }
456
- async function getSubscriptionOptionsForProduct2(productId, options) {
481
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
457
482
  const { httpClient, sideEffects } = arguments[2];
458
483
  const payload = renameKeysFromSDKRequestToRESTRequest({
459
- productId,
460
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
484
+ subscriptionOption: { ...subscriptionOption, id: _id }
461
485
  });
462
- const reqOpts = getSubscriptionOptionsForProduct(
463
- payload
464
- );
486
+ const reqOpts = updateSubscriptionOption(payload);
487
+ sideEffects?.onSiteCall?.();
488
+ try {
489
+ const result = await httpClient.request(reqOpts);
490
+ sideEffects?.onSuccess?.(result);
491
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
492
+ } catch (err) {
493
+ const transformedError = sdkTransformError(
494
+ err,
495
+ {
496
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
497
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
498
+ singleArgumentUnchanged: false
499
+ },
500
+ ["_id", "subscriptionOption"]
501
+ );
502
+ sideEffects?.onError?.(err);
503
+ throw transformedError;
504
+ }
505
+ }
506
+ async function deleteSubscriptionOption2(_id) {
507
+ const { httpClient, sideEffects } = arguments[1];
508
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
509
+ const reqOpts = deleteSubscriptionOption(payload);
465
510
  sideEffects?.onSiteCall?.();
466
511
  try {
467
512
  const result = await httpClient.request(reqOpts);
468
513
  sideEffects?.onSuccess?.(result);
469
- return renameKeysFromRESTResponseToSDKResponse(result.data);
470
514
  } catch (err) {
471
515
  const transformedError = sdkTransformError(
472
516
  err,
473
517
  {
474
518
  spreadPathsToArguments: {},
475
- explicitPathsToArguments: {
476
- productId: "$[0]",
477
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
478
- },
519
+ explicitPathsToArguments: { id: "$[0]" },
479
520
  singleArgumentUnchanged: false
480
521
  },
481
- ["productId", "options"]
522
+ ["_id"]
482
523
  );
483
524
  sideEffects?.onError?.(err);
484
525
  throw transformedError;
485
526
  }
486
527
  }
487
- async function getProductIdsForSubscriptionOption2(_id, options) {
488
- const { httpClient, sideEffects } = arguments[2];
528
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
529
+ const { httpClient, sideEffects } = arguments[1];
489
530
  const payload = renameKeysFromSDKRequestToRESTRequest({
490
- id: _id,
491
- includeHiddenProducts: options?.includeHiddenProducts,
492
- paging: options?.paging
531
+ subscriptionOptions
493
532
  });
494
- const reqOpts = getProductIdsForSubscriptionOption(
533
+ const reqOpts = bulkCreateSubscriptionOptions(
495
534
  payload
496
535
  );
497
536
  sideEffects?.onSiteCall?.();
@@ -504,25 +543,23 @@ async function getProductIdsForSubscriptionOption2(_id, options) {
504
543
  err,
505
544
  {
506
545
  spreadPathsToArguments: {},
507
- explicitPathsToArguments: {
508
- id: "$[0]",
509
- includeHiddenProducts: "$[1].includeHiddenProducts",
510
- paging: "$[1].paging"
511
- },
546
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
512
547
  singleArgumentUnchanged: false
513
548
  },
514
- ["_id", "options"]
549
+ ["subscriptionOptions"]
515
550
  );
516
551
  sideEffects?.onError?.(err);
517
552
  throw transformedError;
518
553
  }
519
554
  }
520
- async function getOneTimePurchasesStatus2(productId) {
555
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
521
556
  const { httpClient, sideEffects } = arguments[1];
522
557
  const payload = renameKeysFromSDKRequestToRESTRequest({
523
- productId
558
+ subscriptionOptions
524
559
  });
525
- const reqOpts = getOneTimePurchasesStatus(payload);
560
+ const reqOpts = bulkUpdateSubscriptionOptions(
561
+ payload
562
+ );
526
563
  sideEffects?.onSiteCall?.();
527
564
  try {
528
565
  const result = await httpClient.request(reqOpts);
@@ -533,69 +570,76 @@ async function getOneTimePurchasesStatus2(productId) {
533
570
  err,
534
571
  {
535
572
  spreadPathsToArguments: {},
536
- explicitPathsToArguments: { productId: "$[0]" },
573
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
537
574
  singleArgumentUnchanged: false
538
575
  },
539
- ["productId"]
576
+ ["subscriptionOptions"]
540
577
  );
541
578
  sideEffects?.onError?.(err);
542
579
  throw transformedError;
543
580
  }
544
581
  }
545
- async function createSubscriptionOption2(subscriptionOption) {
582
+ async function bulkDeleteSubscriptionOptions2(ids) {
546
583
  const { httpClient, sideEffects } = arguments[1];
547
- const payload = renameKeysFromSDKRequestToRESTRequest({
548
- subscriptionOption
549
- });
550
- const reqOpts = createSubscriptionOption(payload);
584
+ const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
585
+ const reqOpts = bulkDeleteSubscriptionOptions(
586
+ payload
587
+ );
551
588
  sideEffects?.onSiteCall?.();
552
589
  try {
553
590
  const result = await httpClient.request(reqOpts);
554
591
  sideEffects?.onSuccess?.(result);
555
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
556
592
  } catch (err) {
557
593
  const transformedError = sdkTransformError(
558
594
  err,
559
595
  {
560
596
  spreadPathsToArguments: {},
561
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
597
+ explicitPathsToArguments: { ids: "$[0]" },
562
598
  singleArgumentUnchanged: false
563
599
  },
564
- ["subscriptionOption"]
600
+ ["ids"]
565
601
  );
566
602
  sideEffects?.onError?.(err);
567
603
  throw transformedError;
568
604
  }
569
605
  }
570
- async function updateSubscriptionOption2(_id, subscriptionOption) {
606
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
571
607
  const { httpClient, sideEffects } = arguments[2];
572
608
  const payload = renameKeysFromSDKRequestToRESTRequest({
573
- subscriptionOption: { ...subscriptionOption, id: _id }
609
+ productId,
610
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
574
611
  });
575
- const reqOpts = updateSubscriptionOption(payload);
612
+ const reqOpts = assignSubscriptionOptionsToProduct(
613
+ payload
614
+ );
576
615
  sideEffects?.onSiteCall?.();
577
616
  try {
578
617
  const result = await httpClient.request(reqOpts);
579
618
  sideEffects?.onSuccess?.(result);
580
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
581
619
  } catch (err) {
582
620
  const transformedError = sdkTransformError(
583
621
  err,
584
622
  {
585
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
586
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
623
+ spreadPathsToArguments: {},
624
+ explicitPathsToArguments: {
625
+ productId: "$[0]",
626
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
627
+ },
587
628
  singleArgumentUnchanged: false
588
629
  },
589
- ["_id", "subscriptionOption"]
630
+ ["productId", "options"]
590
631
  );
591
632
  sideEffects?.onError?.(err);
592
633
  throw transformedError;
593
634
  }
594
635
  }
595
- async function deleteSubscriptionOption2(_id) {
596
- const { httpClient, sideEffects } = arguments[1];
597
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
598
- const reqOpts = deleteSubscriptionOption(payload);
636
+ async function allowOneTimePurchases2(productId, allowed) {
637
+ const { httpClient, sideEffects } = arguments[2];
638
+ const payload = renameKeysFromSDKRequestToRESTRequest({
639
+ productId,
640
+ allowed
641
+ });
642
+ const reqOpts = allowOneTimePurchases(payload);
599
643
  sideEffects?.onSiteCall?.();
600
644
  try {
601
645
  const result = await httpClient.request(reqOpts);
@@ -605,143 +649,147 @@ async function deleteSubscriptionOption2(_id) {
605
649
  err,
606
650
  {
607
651
  spreadPathsToArguments: {},
608
- explicitPathsToArguments: { id: "$[0]" },
652
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
609
653
  singleArgumentUnchanged: false
610
654
  },
611
- ["_id"]
655
+ ["productId", "allowed"]
612
656
  );
613
657
  sideEffects?.onError?.(err);
614
658
  throw transformedError;
615
659
  }
616
660
  }
617
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
618
- const { httpClient, sideEffects } = arguments[1];
661
+ async function enableCustomerCancellation2(productId, allowed) {
662
+ const { httpClient, sideEffects } = arguments[2];
619
663
  const payload = renameKeysFromSDKRequestToRESTRequest({
620
- subscriptionOptions
664
+ productId,
665
+ allowed
621
666
  });
622
- const reqOpts = bulkCreateSubscriptionOptions(
623
- payload
624
- );
667
+ const reqOpts = enableCustomerCancellation(payload);
625
668
  sideEffects?.onSiteCall?.();
626
669
  try {
627
670
  const result = await httpClient.request(reqOpts);
628
671
  sideEffects?.onSuccess?.(result);
629
- return renameKeysFromRESTResponseToSDKResponse(result.data);
630
672
  } catch (err) {
631
673
  const transformedError = sdkTransformError(
632
674
  err,
633
675
  {
634
676
  spreadPathsToArguments: {},
635
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
677
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
636
678
  singleArgumentUnchanged: false
637
679
  },
638
- ["subscriptionOptions"]
680
+ ["productId", "allowed"]
639
681
  );
640
682
  sideEffects?.onError?.(err);
641
683
  throw transformedError;
642
684
  }
643
685
  }
644
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
686
+ async function getSubscriptionOption2(_id) {
645
687
  const { httpClient, sideEffects } = arguments[1];
646
- const payload = renameKeysFromSDKRequestToRESTRequest({
647
- subscriptionOptions
648
- });
649
- const reqOpts = bulkUpdateSubscriptionOptions(
650
- payload
651
- );
688
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
689
+ const reqOpts = getSubscriptionOption(payload);
652
690
  sideEffects?.onSiteCall?.();
653
691
  try {
654
692
  const result = await httpClient.request(reqOpts);
655
693
  sideEffects?.onSuccess?.(result);
656
- return renameKeysFromRESTResponseToSDKResponse(result.data);
694
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
657
695
  } catch (err) {
658
696
  const transformedError = sdkTransformError(
659
697
  err,
660
698
  {
661
699
  spreadPathsToArguments: {},
662
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
700
+ explicitPathsToArguments: { id: "$[0]" },
663
701
  singleArgumentUnchanged: false
664
702
  },
665
- ["subscriptionOptions"]
703
+ ["_id"]
666
704
  );
667
705
  sideEffects?.onError?.(err);
668
706
  throw transformedError;
669
707
  }
670
708
  }
671
- async function bulkDeleteSubscriptionOptions2(ids) {
672
- const { httpClient, sideEffects } = arguments[1];
673
- const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
674
- const reqOpts = bulkDeleteSubscriptionOptions(
709
+ async function getSubscriptionOptionsForProduct2(productId, options) {
710
+ const { httpClient, sideEffects } = arguments[2];
711
+ const payload = renameKeysFromSDKRequestToRESTRequest({
712
+ productId,
713
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
714
+ });
715
+ const reqOpts = getSubscriptionOptionsForProduct(
675
716
  payload
676
717
  );
677
718
  sideEffects?.onSiteCall?.();
678
719
  try {
679
720
  const result = await httpClient.request(reqOpts);
680
721
  sideEffects?.onSuccess?.(result);
722
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
681
723
  } catch (err) {
682
724
  const transformedError = sdkTransformError(
683
725
  err,
684
726
  {
685
727
  spreadPathsToArguments: {},
686
- explicitPathsToArguments: { ids: "$[0]" },
728
+ explicitPathsToArguments: {
729
+ productId: "$[0]",
730
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
731
+ },
687
732
  singleArgumentUnchanged: false
688
733
  },
689
- ["ids"]
734
+ ["productId", "options"]
690
735
  );
691
736
  sideEffects?.onError?.(err);
692
737
  throw transformedError;
693
738
  }
694
739
  }
695
- async function assignSubscriptionOptionsToProduct2(productId, options) {
740
+ async function getProductIdsForSubscriptionOption2(_id, options) {
696
741
  const { httpClient, sideEffects } = arguments[2];
697
742
  const payload = renameKeysFromSDKRequestToRESTRequest({
698
- productId,
699
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
743
+ id: _id,
744
+ includeHiddenProducts: options?.includeHiddenProducts,
745
+ paging: options?.paging
700
746
  });
701
- const reqOpts = assignSubscriptionOptionsToProduct(
747
+ const reqOpts = getProductIdsForSubscriptionOption(
702
748
  payload
703
749
  );
704
750
  sideEffects?.onSiteCall?.();
705
751
  try {
706
752
  const result = await httpClient.request(reqOpts);
707
753
  sideEffects?.onSuccess?.(result);
754
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
708
755
  } catch (err) {
709
756
  const transformedError = sdkTransformError(
710
757
  err,
711
758
  {
712
759
  spreadPathsToArguments: {},
713
760
  explicitPathsToArguments: {
714
- productId: "$[0]",
715
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
761
+ id: "$[0]",
762
+ includeHiddenProducts: "$[1].includeHiddenProducts",
763
+ paging: "$[1].paging"
716
764
  },
717
765
  singleArgumentUnchanged: false
718
766
  },
719
- ["productId", "options"]
767
+ ["_id", "options"]
720
768
  );
721
769
  sideEffects?.onError?.(err);
722
770
  throw transformedError;
723
771
  }
724
772
  }
725
- async function allowOneTimePurchases2(productId, allowed) {
726
- const { httpClient, sideEffects } = arguments[2];
773
+ async function getOneTimePurchasesStatus2(productId) {
774
+ const { httpClient, sideEffects } = arguments[1];
727
775
  const payload = renameKeysFromSDKRequestToRESTRequest({
728
- productId,
729
- allowed
776
+ productId
730
777
  });
731
- const reqOpts = allowOneTimePurchases(payload);
778
+ const reqOpts = getOneTimePurchasesStatus(payload);
732
779
  sideEffects?.onSiteCall?.();
733
780
  try {
734
781
  const result = await httpClient.request(reqOpts);
735
782
  sideEffects?.onSuccess?.(result);
783
+ 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]", allowed: "$[1]" },
789
+ explicitPathsToArguments: { productId: "$[0]" },
742
790
  singleArgumentUnchanged: false
743
791
  },
744
- ["productId", "allowed"]
792
+ ["productId"]
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,