@wix/auto_sdk_stores_subscription-options 1.0.49 → 1.0.51

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 +274 -274
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +157 -157
  5. package/build/cjs/index.typings.js +230 -230
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +108 -108
  8. package/build/cjs/meta.js +204 -204
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +45 -45
  11. package/build/es/index.mjs +274 -274
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +157 -157
  14. package/build/es/index.typings.mjs +230 -230
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +108 -108
  17. package/build/es/meta.mjs +204 -204
  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 +274 -274
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +157 -157
  23. package/build/internal/cjs/index.typings.js +230 -230
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +108 -108
  26. package/build/internal/cjs/meta.js +204 -204
  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 +274 -274
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +157 -157
  32. package/build/internal/es/index.typings.mjs +230 -230
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +108 -108
  35. package/build/internal/es/meta.mjs +204 -204
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +4 -4
@@ -11,35 +11,6 @@ import { transformSDKFloatToRESTFloat } from "@wix/sdk-runtime/transformations/f
11
11
  import { transformRESTFloatToSDKFloat } from "@wix/sdk-runtime/transformations/float";
12
12
  import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
13
13
  import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
14
- function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
15
- const domainToMappings = {
16
- "api._api_base_domain_": [
17
- {
18
- srcPath: "/wix-ecommerce-plans-reader",
19
- destPath: ""
20
- }
21
- ],
22
- "www._base_domain_": [
23
- {
24
- srcPath: "/_api/wix-ecommerce-plans-reader",
25
- destPath: ""
26
- }
27
- ],
28
- _: [
29
- {
30
- srcPath: "/_api/subscription-options-reader-server",
31
- destPath: ""
32
- }
33
- ],
34
- "manage._base_domain_": [
35
- {
36
- srcPath: "/_api/subscription-options-reader-server",
37
- destPath: ""
38
- }
39
- ]
40
- };
41
- return resolveUrl(Object.assign(opts, { domainToMappings }));
42
- }
43
14
  function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUrl(opts) {
44
15
  const domainToMappings = {
45
16
  "api._api_base_domain_": [
@@ -87,7 +58,136 @@ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsWriteApiUr
87
58
  };
88
59
  return resolveUrl(Object.assign(opts, { domainToMappings }));
89
60
  }
61
+ function resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(opts) {
62
+ const domainToMappings = {
63
+ "api._api_base_domain_": [
64
+ {
65
+ srcPath: "/wix-ecommerce-plans-reader",
66
+ destPath: ""
67
+ }
68
+ ],
69
+ "www._base_domain_": [
70
+ {
71
+ srcPath: "/_api/wix-ecommerce-plans-reader",
72
+ destPath: ""
73
+ }
74
+ ],
75
+ _: [
76
+ {
77
+ srcPath: "/_api/subscription-options-reader-server",
78
+ destPath: ""
79
+ }
80
+ ],
81
+ "manage._base_domain_": [
82
+ {
83
+ srcPath: "/_api/subscription-options-reader-server",
84
+ destPath: ""
85
+ }
86
+ ]
87
+ };
88
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
89
+ }
90
90
  var PACKAGE_NAME = "@wix/auto_sdk_stores_subscription-options";
91
+ function getSubscriptionOption(payload) {
92
+ function __getSubscriptionOption({ host }) {
93
+ const metadata = {
94
+ entityFqdn: "wix.stores.v1.subscription_option",
95
+ method: "GET",
96
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
97
+ packageName: PACKAGE_NAME,
98
+ migrationOptions: {
99
+ optInTransformResponse: true
100
+ },
101
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
102
+ { protoPath: "/v1/subscription-options/{id}", data: payload, host }
103
+ ),
104
+ params: toURLSearchParams(payload),
105
+ transformResponse: (payload2) => transformPaths(payload2, [
106
+ {
107
+ transformFn: transformRESTFloatToSDKFloat,
108
+ paths: [{ path: "subscriptionOption.discount.value" }]
109
+ }
110
+ ])
111
+ };
112
+ return metadata;
113
+ }
114
+ return __getSubscriptionOption;
115
+ }
116
+ function getSubscriptionOptionsForProduct(payload) {
117
+ function __getSubscriptionOptionsForProduct({ host }) {
118
+ const metadata = {
119
+ entityFqdn: "wix.stores.v1.subscription_option",
120
+ method: "GET",
121
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
122
+ packageName: PACKAGE_NAME,
123
+ migrationOptions: {
124
+ optInTransformResponse: true
125
+ },
126
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
127
+ {
128
+ protoPath: "/v1/subscription-options/byProduct/{productId}",
129
+ data: payload,
130
+ host
131
+ }
132
+ ),
133
+ params: toURLSearchParams(payload),
134
+ transformResponse: (payload2) => transformPaths(payload2, [
135
+ {
136
+ transformFn: transformRESTFloatToSDKFloat,
137
+ paths: [{ path: "subscriptionOptions.discount.value" }]
138
+ }
139
+ ])
140
+ };
141
+ return metadata;
142
+ }
143
+ return __getSubscriptionOptionsForProduct;
144
+ }
145
+ function getProductIdsForSubscriptionOption(payload) {
146
+ function __getProductIdsForSubscriptionOption({ host }) {
147
+ const metadata = {
148
+ entityFqdn: "wix.stores.v1.subscription_option",
149
+ method: "GET",
150
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
151
+ packageName: PACKAGE_NAME,
152
+ migrationOptions: {
153
+ optInTransformResponse: true
154
+ },
155
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
156
+ {
157
+ protoPath: "/v1/subscription-options/{id}/productIds",
158
+ data: payload,
159
+ host
160
+ }
161
+ ),
162
+ params: toURLSearchParams(payload)
163
+ };
164
+ return metadata;
165
+ }
166
+ return __getProductIdsForSubscriptionOption;
167
+ }
168
+ function getOneTimePurchasesStatus(payload) {
169
+ function __getOneTimePurchasesStatus({ host }) {
170
+ const metadata = {
171
+ entityFqdn: "wix.stores.v1.subscription_option",
172
+ method: "GET",
173
+ methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
174
+ packageName: PACKAGE_NAME,
175
+ migrationOptions: {
176
+ optInTransformResponse: true
177
+ },
178
+ url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
179
+ {
180
+ protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
181
+ data: payload,
182
+ host
183
+ }
184
+ ),
185
+ params: toURLSearchParams(payload)
186
+ };
187
+ return metadata;
188
+ }
189
+ return __getOneTimePurchasesStatus;
190
+ }
91
191
  function createSubscriptionOption(payload) {
92
192
  function __createSubscriptionOption({ host }) {
93
193
  const serializedData = transformPaths(payload, [
@@ -314,106 +414,6 @@ function allowOneTimePurchases(payload) {
314
414
  }
315
415
  return __allowOneTimePurchases;
316
416
  }
317
- function getSubscriptionOption(payload) {
318
- function __getSubscriptionOption({ host }) {
319
- const metadata = {
320
- entityFqdn: "wix.stores.v1.subscription_option",
321
- method: "GET",
322
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOption",
323
- packageName: PACKAGE_NAME,
324
- migrationOptions: {
325
- optInTransformResponse: true
326
- },
327
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
328
- { protoPath: "/v1/subscription-options/{id}", data: payload, host }
329
- ),
330
- params: toURLSearchParams(payload),
331
- transformResponse: (payload2) => transformPaths(payload2, [
332
- {
333
- transformFn: transformRESTFloatToSDKFloat,
334
- paths: [{ path: "subscriptionOption.discount.value" }]
335
- }
336
- ])
337
- };
338
- return metadata;
339
- }
340
- return __getSubscriptionOption;
341
- }
342
- function getSubscriptionOptionsForProduct(payload) {
343
- function __getSubscriptionOptionsForProduct({ host }) {
344
- const metadata = {
345
- entityFqdn: "wix.stores.v1.subscription_option",
346
- method: "GET",
347
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetSubscriptionOptionsForProduct",
348
- packageName: PACKAGE_NAME,
349
- migrationOptions: {
350
- optInTransformResponse: true
351
- },
352
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
353
- {
354
- protoPath: "/v1/subscription-options/byProduct/{productId}",
355
- data: payload,
356
- host
357
- }
358
- ),
359
- params: toURLSearchParams(payload),
360
- transformResponse: (payload2) => transformPaths(payload2, [
361
- {
362
- transformFn: transformRESTFloatToSDKFloat,
363
- paths: [{ path: "subscriptionOptions.discount.value" }]
364
- }
365
- ])
366
- };
367
- return metadata;
368
- }
369
- return __getSubscriptionOptionsForProduct;
370
- }
371
- function getProductIdsForSubscriptionOption(payload) {
372
- function __getProductIdsForSubscriptionOption({ host }) {
373
- const metadata = {
374
- entityFqdn: "wix.stores.v1.subscription_option",
375
- method: "GET",
376
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetProductIdsForSubscriptionOption",
377
- packageName: PACKAGE_NAME,
378
- migrationOptions: {
379
- optInTransformResponse: true
380
- },
381
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
382
- {
383
- protoPath: "/v1/subscription-options/{id}/productIds",
384
- data: payload,
385
- host
386
- }
387
- ),
388
- params: toURLSearchParams(payload)
389
- };
390
- return metadata;
391
- }
392
- return __getProductIdsForSubscriptionOption;
393
- }
394
- function getOneTimePurchasesStatus(payload) {
395
- function __getOneTimePurchasesStatus({ host }) {
396
- const metadata = {
397
- entityFqdn: "wix.stores.v1.subscription_option",
398
- method: "GET",
399
- methodFqn: "wix.ecommerce.subscription.option.api.v1.SubscriptionOptionsReadApi.GetOneTimePurchasesStatus",
400
- packageName: PACKAGE_NAME,
401
- migrationOptions: {
402
- optInTransformResponse: true
403
- },
404
- url: resolveWixEcommerceSubscriptionOptionApiV1SubscriptionOptionsReadApiUrl(
405
- {
406
- protoPath: "/v1/subscription-options/product/{productId}/oneTimePurchasesStatus",
407
- data: payload,
408
- host
409
- }
410
- ),
411
- params: toURLSearchParams(payload)
412
- };
413
- return metadata;
414
- }
415
- return __getOneTimePurchasesStatus;
416
- }
417
417
 
418
418
  // src/stores-v1-subscription-option-subscription-options.universal.ts
419
419
  var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
@@ -430,12 +430,10 @@ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
430
430
  DiscountType2["PERCENT"] = "PERCENT";
431
431
  return DiscountType2;
432
432
  })(DiscountType || {});
433
- async function createSubscriptionOption2(subscriptionOption) {
433
+ async function getSubscriptionOption2(_id) {
434
434
  const { httpClient, sideEffects } = arguments[1];
435
- const payload = renameKeysFromSDKRequestToRESTRequest({
436
- subscriptionOption
437
- });
438
- const reqOpts = createSubscriptionOption(payload);
435
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
436
+ const reqOpts = getSubscriptionOption(payload);
439
437
  sideEffects?.onSiteCall?.();
440
438
  try {
441
439
  const result = await httpClient.request(reqOpts);
@@ -446,70 +444,85 @@ async function createSubscriptionOption2(subscriptionOption) {
446
444
  err,
447
445
  {
448
446
  spreadPathsToArguments: {},
449
- explicitPathsToArguments: { subscriptionOption: "$[0]" },
447
+ explicitPathsToArguments: { id: "$[0]" },
450
448
  singleArgumentUnchanged: false
451
449
  },
452
- ["subscriptionOption"]
450
+ ["_id"]
453
451
  );
454
452
  sideEffects?.onError?.(err);
455
453
  throw transformedError;
456
454
  }
457
455
  }
458
- async function updateSubscriptionOption2(_id, subscriptionOption) {
456
+ async function getSubscriptionOptionsForProduct2(productId, options) {
459
457
  const { httpClient, sideEffects } = arguments[2];
460
458
  const payload = renameKeysFromSDKRequestToRESTRequest({
461
- subscriptionOption: { ...subscriptionOption, id: _id }
459
+ productId,
460
+ includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
462
461
  });
463
- const reqOpts = updateSubscriptionOption(payload);
462
+ const reqOpts = getSubscriptionOptionsForProduct(
463
+ payload
464
+ );
464
465
  sideEffects?.onSiteCall?.();
465
466
  try {
466
467
  const result = await httpClient.request(reqOpts);
467
468
  sideEffects?.onSuccess?.(result);
468
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
469
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
469
470
  } catch (err) {
470
471
  const transformedError = sdkTransformError(
471
472
  err,
472
473
  {
473
- spreadPathsToArguments: { subscriptionOption: "$[1]" },
474
- explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
474
+ spreadPathsToArguments: {},
475
+ explicitPathsToArguments: {
476
+ productId: "$[0]",
477
+ includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
478
+ },
475
479
  singleArgumentUnchanged: false
476
480
  },
477
- ["_id", "subscriptionOption"]
481
+ ["productId", "options"]
478
482
  );
479
483
  sideEffects?.onError?.(err);
480
484
  throw transformedError;
481
485
  }
482
486
  }
483
- async function deleteSubscriptionOption2(_id) {
484
- const { httpClient, sideEffects } = arguments[1];
485
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
486
- const reqOpts = deleteSubscriptionOption(payload);
487
+ async function getProductIdsForSubscriptionOption2(_id, options) {
488
+ const { httpClient, sideEffects } = arguments[2];
489
+ const payload = renameKeysFromSDKRequestToRESTRequest({
490
+ id: _id,
491
+ includeHiddenProducts: options?.includeHiddenProducts,
492
+ paging: options?.paging
493
+ });
494
+ const reqOpts = getProductIdsForSubscriptionOption(
495
+ payload
496
+ );
487
497
  sideEffects?.onSiteCall?.();
488
498
  try {
489
499
  const result = await httpClient.request(reqOpts);
490
500
  sideEffects?.onSuccess?.(result);
501
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
491
502
  } catch (err) {
492
503
  const transformedError = sdkTransformError(
493
504
  err,
494
505
  {
495
506
  spreadPathsToArguments: {},
496
- explicitPathsToArguments: { id: "$[0]" },
507
+ explicitPathsToArguments: {
508
+ id: "$[0]",
509
+ includeHiddenProducts: "$[1].includeHiddenProducts",
510
+ paging: "$[1].paging"
511
+ },
497
512
  singleArgumentUnchanged: false
498
513
  },
499
- ["_id"]
514
+ ["_id", "options"]
500
515
  );
501
516
  sideEffects?.onError?.(err);
502
517
  throw transformedError;
503
518
  }
504
519
  }
505
- async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
520
+ async function getOneTimePurchasesStatus2(productId) {
506
521
  const { httpClient, sideEffects } = arguments[1];
507
522
  const payload = renameKeysFromSDKRequestToRESTRequest({
508
- subscriptionOptions
523
+ productId
509
524
  });
510
- const reqOpts = bulkCreateSubscriptionOptions(
511
- payload
512
- );
525
+ const reqOpts = getOneTimePurchasesStatus(payload);
513
526
  sideEffects?.onSiteCall?.();
514
527
  try {
515
528
  const result = await httpClient.request(reqOpts);
@@ -520,75 +533,69 @@ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
520
533
  err,
521
534
  {
522
535
  spreadPathsToArguments: {},
523
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
536
+ explicitPathsToArguments: { productId: "$[0]" },
524
537
  singleArgumentUnchanged: false
525
538
  },
526
- ["subscriptionOptions"]
539
+ ["productId"]
527
540
  );
528
541
  sideEffects?.onError?.(err);
529
542
  throw transformedError;
530
543
  }
531
544
  }
532
- async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
545
+ async function createSubscriptionOption2(subscriptionOption) {
533
546
  const { httpClient, sideEffects } = arguments[1];
534
547
  const payload = renameKeysFromSDKRequestToRESTRequest({
535
- subscriptionOptions
548
+ subscriptionOption
536
549
  });
537
- const reqOpts = bulkUpdateSubscriptionOptions(
538
- payload
539
- );
550
+ const reqOpts = createSubscriptionOption(payload);
540
551
  sideEffects?.onSiteCall?.();
541
552
  try {
542
553
  const result = await httpClient.request(reqOpts);
543
554
  sideEffects?.onSuccess?.(result);
544
- return renameKeysFromRESTResponseToSDKResponse(result.data);
555
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
545
556
  } catch (err) {
546
557
  const transformedError = sdkTransformError(
547
558
  err,
548
559
  {
549
560
  spreadPathsToArguments: {},
550
- explicitPathsToArguments: { subscriptionOptions: "$[0]" },
561
+ explicitPathsToArguments: { subscriptionOption: "$[0]" },
551
562
  singleArgumentUnchanged: false
552
563
  },
553
- ["subscriptionOptions"]
564
+ ["subscriptionOption"]
554
565
  );
555
566
  sideEffects?.onError?.(err);
556
567
  throw transformedError;
557
568
  }
558
569
  }
559
- async function bulkDeleteSubscriptionOptions2(ids) {
560
- const { httpClient, sideEffects } = arguments[1];
561
- const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
562
- const reqOpts = bulkDeleteSubscriptionOptions(
563
- payload
564
- );
570
+ async function updateSubscriptionOption2(_id, subscriptionOption) {
571
+ const { httpClient, sideEffects } = arguments[2];
572
+ const payload = renameKeysFromSDKRequestToRESTRequest({
573
+ subscriptionOption: { ...subscriptionOption, id: _id }
574
+ });
575
+ const reqOpts = updateSubscriptionOption(payload);
565
576
  sideEffects?.onSiteCall?.();
566
577
  try {
567
578
  const result = await httpClient.request(reqOpts);
568
579
  sideEffects?.onSuccess?.(result);
580
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
569
581
  } catch (err) {
570
582
  const transformedError = sdkTransformError(
571
583
  err,
572
584
  {
573
- spreadPathsToArguments: {},
574
- explicitPathsToArguments: { ids: "$[0]" },
585
+ spreadPathsToArguments: { subscriptionOption: "$[1]" },
586
+ explicitPathsToArguments: { "subscriptionOption.id": "$[0]" },
575
587
  singleArgumentUnchanged: false
576
588
  },
577
- ["ids"]
589
+ ["_id", "subscriptionOption"]
578
590
  );
579
591
  sideEffects?.onError?.(err);
580
592
  throw transformedError;
581
593
  }
582
594
  }
583
- async function assignSubscriptionOptionsToProduct2(productId, options) {
584
- const { httpClient, sideEffects } = arguments[2];
585
- const payload = renameKeysFromSDKRequestToRESTRequest({
586
- productId,
587
- assignedSubscriptionOptions: options?.assignedSubscriptionOptions
588
- });
589
- const reqOpts = assignSubscriptionOptionsToProduct(
590
- payload
591
- );
595
+ async function deleteSubscriptionOption2(_id) {
596
+ const { httpClient, sideEffects } = arguments[1];
597
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
598
+ const reqOpts = deleteSubscriptionOption(payload);
592
599
  sideEffects?.onSiteCall?.();
593
600
  try {
594
601
  const result = await httpClient.request(reqOpts);
@@ -598,150 +605,143 @@ async function assignSubscriptionOptionsToProduct2(productId, options) {
598
605
  err,
599
606
  {
600
607
  spreadPathsToArguments: {},
601
- explicitPathsToArguments: {
602
- productId: "$[0]",
603
- assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
604
- },
608
+ explicitPathsToArguments: { id: "$[0]" },
605
609
  singleArgumentUnchanged: false
606
610
  },
607
- ["productId", "options"]
611
+ ["_id"]
608
612
  );
609
613
  sideEffects?.onError?.(err);
610
614
  throw transformedError;
611
615
  }
612
616
  }
613
- async function allowOneTimePurchases2(productId, allowed) {
614
- const { httpClient, sideEffects } = arguments[2];
617
+ async function bulkCreateSubscriptionOptions2(subscriptionOptions) {
618
+ const { httpClient, sideEffects } = arguments[1];
615
619
  const payload = renameKeysFromSDKRequestToRESTRequest({
616
- productId,
617
- allowed
620
+ subscriptionOptions
618
621
  });
619
- const reqOpts = allowOneTimePurchases(payload);
622
+ const reqOpts = bulkCreateSubscriptionOptions(
623
+ payload
624
+ );
620
625
  sideEffects?.onSiteCall?.();
621
626
  try {
622
627
  const result = await httpClient.request(reqOpts);
623
628
  sideEffects?.onSuccess?.(result);
629
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
624
630
  } catch (err) {
625
631
  const transformedError = sdkTransformError(
626
632
  err,
627
633
  {
628
634
  spreadPathsToArguments: {},
629
- explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
635
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
630
636
  singleArgumentUnchanged: false
631
637
  },
632
- ["productId", "allowed"]
638
+ ["subscriptionOptions"]
633
639
  );
634
640
  sideEffects?.onError?.(err);
635
641
  throw transformedError;
636
642
  }
637
643
  }
638
- async function getSubscriptionOption2(_id) {
644
+ async function bulkUpdateSubscriptionOptions2(subscriptionOptions) {
639
645
  const { httpClient, sideEffects } = arguments[1];
640
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
641
- const reqOpts = getSubscriptionOption(payload);
646
+ const payload = renameKeysFromSDKRequestToRESTRequest({
647
+ subscriptionOptions
648
+ });
649
+ const reqOpts = bulkUpdateSubscriptionOptions(
650
+ payload
651
+ );
642
652
  sideEffects?.onSiteCall?.();
643
653
  try {
644
654
  const result = await httpClient.request(reqOpts);
645
655
  sideEffects?.onSuccess?.(result);
646
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.subscriptionOption;
656
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
647
657
  } catch (err) {
648
658
  const transformedError = sdkTransformError(
649
659
  err,
650
660
  {
651
661
  spreadPathsToArguments: {},
652
- explicitPathsToArguments: { id: "$[0]" },
662
+ explicitPathsToArguments: { subscriptionOptions: "$[0]" },
653
663
  singleArgumentUnchanged: false
654
664
  },
655
- ["_id"]
665
+ ["subscriptionOptions"]
656
666
  );
657
667
  sideEffects?.onError?.(err);
658
668
  throw transformedError;
659
669
  }
660
670
  }
661
- async function getSubscriptionOptionsForProduct2(productId, options) {
662
- const { httpClient, sideEffects } = arguments[2];
663
- const payload = renameKeysFromSDKRequestToRESTRequest({
664
- productId,
665
- includeHiddenSubscriptionOptions: options?.includeHiddenSubscriptionOptions
666
- });
667
- const reqOpts = getSubscriptionOptionsForProduct(
671
+ async function bulkDeleteSubscriptionOptions2(ids) {
672
+ const { httpClient, sideEffects } = arguments[1];
673
+ const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
674
+ const reqOpts = bulkDeleteSubscriptionOptions(
668
675
  payload
669
676
  );
670
677
  sideEffects?.onSiteCall?.();
671
678
  try {
672
679
  const result = await httpClient.request(reqOpts);
673
680
  sideEffects?.onSuccess?.(result);
674
- return renameKeysFromRESTResponseToSDKResponse(result.data);
675
681
  } catch (err) {
676
682
  const transformedError = sdkTransformError(
677
683
  err,
678
684
  {
679
685
  spreadPathsToArguments: {},
680
- explicitPathsToArguments: {
681
- productId: "$[0]",
682
- includeHiddenSubscriptionOptions: "$[1].includeHiddenSubscriptionOptions"
683
- },
686
+ explicitPathsToArguments: { ids: "$[0]" },
684
687
  singleArgumentUnchanged: false
685
688
  },
686
- ["productId", "options"]
689
+ ["ids"]
687
690
  );
688
691
  sideEffects?.onError?.(err);
689
692
  throw transformedError;
690
693
  }
691
694
  }
692
- async function getProductIdsForSubscriptionOption2(_id, options) {
695
+ async function assignSubscriptionOptionsToProduct2(productId, options) {
693
696
  const { httpClient, sideEffects } = arguments[2];
694
697
  const payload = renameKeysFromSDKRequestToRESTRequest({
695
- id: _id,
696
- includeHiddenProducts: options?.includeHiddenProducts,
697
- paging: options?.paging
698
+ productId,
699
+ assignedSubscriptionOptions: options?.assignedSubscriptionOptions
698
700
  });
699
- const reqOpts = getProductIdsForSubscriptionOption(
701
+ const reqOpts = assignSubscriptionOptionsToProduct(
700
702
  payload
701
703
  );
702
704
  sideEffects?.onSiteCall?.();
703
705
  try {
704
706
  const result = await httpClient.request(reqOpts);
705
707
  sideEffects?.onSuccess?.(result);
706
- return renameKeysFromRESTResponseToSDKResponse(result.data);
707
708
  } catch (err) {
708
709
  const transformedError = sdkTransformError(
709
710
  err,
710
711
  {
711
712
  spreadPathsToArguments: {},
712
713
  explicitPathsToArguments: {
713
- id: "$[0]",
714
- includeHiddenProducts: "$[1].includeHiddenProducts",
715
- paging: "$[1].paging"
714
+ productId: "$[0]",
715
+ assignedSubscriptionOptions: "$[1].assignedSubscriptionOptions"
716
716
  },
717
717
  singleArgumentUnchanged: false
718
718
  },
719
- ["_id", "options"]
719
+ ["productId", "options"]
720
720
  );
721
721
  sideEffects?.onError?.(err);
722
722
  throw transformedError;
723
723
  }
724
724
  }
725
- async function getOneTimePurchasesStatus2(productId) {
726
- const { httpClient, sideEffects } = arguments[1];
725
+ async function allowOneTimePurchases2(productId, allowed) {
726
+ const { httpClient, sideEffects } = arguments[2];
727
727
  const payload = renameKeysFromSDKRequestToRESTRequest({
728
- productId
728
+ productId,
729
+ allowed
729
730
  });
730
- const reqOpts = getOneTimePurchasesStatus(payload);
731
+ const reqOpts = allowOneTimePurchases(payload);
731
732
  sideEffects?.onSiteCall?.();
732
733
  try {
733
734
  const result = await httpClient.request(reqOpts);
734
735
  sideEffects?.onSuccess?.(result);
735
- return renameKeysFromRESTResponseToSDKResponse(result.data);
736
736
  } catch (err) {
737
737
  const transformedError = sdkTransformError(
738
738
  err,
739
739
  {
740
740
  spreadPathsToArguments: {},
741
- explicitPathsToArguments: { productId: "$[0]" },
741
+ explicitPathsToArguments: { productId: "$[0]", allowed: "$[1]" },
742
742
  singleArgumentUnchanged: false
743
743
  },
744
- ["productId"]
744
+ ["productId", "allowed"]
745
745
  );
746
746
  sideEffects?.onError?.(err);
747
747
  throw transformedError;