@wix/auto_sdk_stores_subscription-options 1.0.29 → 1.0.30

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