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