@wix/auto_sdk_stores_subscription-options 1.0.34 → 1.0.35

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