@wix/auto_sdk_packages_packages 1.0.3 → 1.0.5

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 (123) hide show
  1. package/build/cjs/index.d.ts +273 -1
  2. package/build/cjs/index.js +953 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +1867 -1
  5. package/build/cjs/index.typings.js +864 -15
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +543 -1
  8. package/build/cjs/meta.js +574 -15
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/{internal/cjs/src/premium-reseller-v1-packages-packages.public.d.ts → es/index.d.mts} +27 -16
  11. package/build/es/index.mjs +906 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/{internal/cjs/src/premium-reseller-v1-packages-packages.universal.d.ts → es/index.typings.d.mts} +192 -149
  14. package/build/es/index.typings.mjs +817 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/meta.d.mts +543 -0
  17. package/build/es/meta.mjs +541 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/internal/cjs/index.d.ts +273 -1
  20. package/build/internal/cjs/index.js +953 -15
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +1867 -1
  23. package/build/internal/cjs/index.typings.js +864 -15
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +543 -1
  26. package/build/internal/cjs/meta.js +574 -15
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/{cjs/src/premium-reseller-v1-packages-packages.public.d.ts → internal/es/index.d.mts} +27 -16
  29. package/build/internal/es/index.mjs +906 -0
  30. package/build/internal/es/index.mjs.map +1 -0
  31. package/build/{cjs/src/premium-reseller-v1-packages-packages.universal.d.ts → internal/es/index.typings.d.mts} +192 -149
  32. package/build/internal/es/index.typings.mjs +817 -0
  33. package/build/internal/es/index.typings.mjs.map +1 -0
  34. package/build/internal/es/meta.d.mts +543 -0
  35. package/build/internal/es/meta.mjs +541 -0
  36. package/build/internal/es/meta.mjs.map +1 -0
  37. package/package.json +11 -10
  38. package/build/cjs/src/premium-reseller-v1-packages-packages.context.d.ts +0 -14
  39. package/build/cjs/src/premium-reseller-v1-packages-packages.context.js +0 -34
  40. package/build/cjs/src/premium-reseller-v1-packages-packages.context.js.map +0 -1
  41. package/build/cjs/src/premium-reseller-v1-packages-packages.http.d.ts +0 -219
  42. package/build/cjs/src/premium-reseller-v1-packages-packages.http.js +0 -563
  43. package/build/cjs/src/premium-reseller-v1-packages-packages.http.js.map +0 -1
  44. package/build/cjs/src/premium-reseller-v1-packages-packages.meta.d.ts +0 -38
  45. package/build/cjs/src/premium-reseller-v1-packages-packages.meta.js +0 -218
  46. package/build/cjs/src/premium-reseller-v1-packages-packages.meta.js.map +0 -1
  47. package/build/cjs/src/premium-reseller-v1-packages-packages.public.js +0 -84
  48. package/build/cjs/src/premium-reseller-v1-packages-packages.public.js.map +0 -1
  49. package/build/cjs/src/premium-reseller-v1-packages-packages.types.d.ts +0 -1377
  50. package/build/cjs/src/premium-reseller-v1-packages-packages.types.js +0 -155
  51. package/build/cjs/src/premium-reseller-v1-packages-packages.types.js.map +0 -1
  52. package/build/cjs/src/premium-reseller-v1-packages-packages.universal.js +0 -756
  53. package/build/cjs/src/premium-reseller-v1-packages-packages.universal.js.map +0 -1
  54. package/build/es/index.d.ts +0 -1
  55. package/build/es/index.js +0 -2
  56. package/build/es/index.js.map +0 -1
  57. package/build/es/index.typings.d.ts +0 -1
  58. package/build/es/index.typings.js +0 -2
  59. package/build/es/index.typings.js.map +0 -1
  60. package/build/es/meta.d.ts +0 -1
  61. package/build/es/meta.js +0 -2
  62. package/build/es/meta.js.map +0 -1
  63. package/build/es/src/premium-reseller-v1-packages-packages.context.d.ts +0 -14
  64. package/build/es/src/premium-reseller-v1-packages-packages.context.js +0 -14
  65. package/build/es/src/premium-reseller-v1-packages-packages.context.js.map +0 -1
  66. package/build/es/src/premium-reseller-v1-packages-packages.http.d.ts +0 -219
  67. package/build/es/src/premium-reseller-v1-packages-packages.http.js +0 -550
  68. package/build/es/src/premium-reseller-v1-packages-packages.http.js.map +0 -1
  69. package/build/es/src/premium-reseller-v1-packages-packages.meta.d.ts +0 -38
  70. package/build/es/src/premium-reseller-v1-packages-packages.meta.js +0 -182
  71. package/build/es/src/premium-reseller-v1-packages-packages.meta.js.map +0 -1
  72. package/build/es/src/premium-reseller-v1-packages-packages.public.d.ts +0 -262
  73. package/build/es/src/premium-reseller-v1-packages-packages.public.js +0 -54
  74. package/build/es/src/premium-reseller-v1-packages-packages.public.js.map +0 -1
  75. package/build/es/src/premium-reseller-v1-packages-packages.types.d.ts +0 -1377
  76. package/build/es/src/premium-reseller-v1-packages-packages.types.js +0 -152
  77. package/build/es/src/premium-reseller-v1-packages-packages.types.js.map +0 -1
  78. package/build/es/src/premium-reseller-v1-packages-packages.universal.d.ts +0 -1824
  79. package/build/es/src/premium-reseller-v1-packages-packages.universal.js +0 -720
  80. package/build/es/src/premium-reseller-v1-packages-packages.universal.js.map +0 -1
  81. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.context.d.ts +0 -14
  82. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.context.js +0 -34
  83. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.context.js.map +0 -1
  84. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.http.d.ts +0 -219
  85. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.http.js +0 -563
  86. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.http.js.map +0 -1
  87. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.meta.d.ts +0 -38
  88. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.meta.js +0 -218
  89. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.meta.js.map +0 -1
  90. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.public.js +0 -84
  91. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.public.js.map +0 -1
  92. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.types.d.ts +0 -1377
  93. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.types.js +0 -155
  94. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.types.js.map +0 -1
  95. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.universal.js +0 -756
  96. package/build/internal/cjs/src/premium-reseller-v1-packages-packages.universal.js.map +0 -1
  97. package/build/internal/es/index.d.ts +0 -1
  98. package/build/internal/es/index.js +0 -2
  99. package/build/internal/es/index.js.map +0 -1
  100. package/build/internal/es/index.typings.d.ts +0 -1
  101. package/build/internal/es/index.typings.js +0 -2
  102. package/build/internal/es/index.typings.js.map +0 -1
  103. package/build/internal/es/meta.d.ts +0 -1
  104. package/build/internal/es/meta.js +0 -2
  105. package/build/internal/es/meta.js.map +0 -1
  106. package/build/internal/es/src/premium-reseller-v1-packages-packages.context.d.ts +0 -14
  107. package/build/internal/es/src/premium-reseller-v1-packages-packages.context.js +0 -14
  108. package/build/internal/es/src/premium-reseller-v1-packages-packages.context.js.map +0 -1
  109. package/build/internal/es/src/premium-reseller-v1-packages-packages.http.d.ts +0 -219
  110. package/build/internal/es/src/premium-reseller-v1-packages-packages.http.js +0 -550
  111. package/build/internal/es/src/premium-reseller-v1-packages-packages.http.js.map +0 -1
  112. package/build/internal/es/src/premium-reseller-v1-packages-packages.meta.d.ts +0 -38
  113. package/build/internal/es/src/premium-reseller-v1-packages-packages.meta.js +0 -182
  114. package/build/internal/es/src/premium-reseller-v1-packages-packages.meta.js.map +0 -1
  115. package/build/internal/es/src/premium-reseller-v1-packages-packages.public.d.ts +0 -262
  116. package/build/internal/es/src/premium-reseller-v1-packages-packages.public.js +0 -54
  117. package/build/internal/es/src/premium-reseller-v1-packages-packages.public.js.map +0 -1
  118. package/build/internal/es/src/premium-reseller-v1-packages-packages.types.d.ts +0 -1377
  119. package/build/internal/es/src/premium-reseller-v1-packages-packages.types.js +0 -152
  120. package/build/internal/es/src/premium-reseller-v1-packages-packages.types.js.map +0 -1
  121. package/build/internal/es/src/premium-reseller-v1-packages-packages.universal.d.ts +0 -1824
  122. package/build/internal/es/src/premium-reseller-v1-packages-packages.universal.js +0 -720
  123. package/build/internal/es/src/premium-reseller-v1-packages-packages.universal.js.map +0 -1
@@ -1,720 +0,0 @@
1
- import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
- import { queryBuilder } from '@wix/sdk-runtime/query-builder';
3
- import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
4
- import * as ambassadorWixPremiumResellerV1Packages from './premium-reseller-v1-packages-packages.http.js';
5
- export var FailureReasonFailureReason;
6
- (function (FailureReasonFailureReason) {
7
- FailureReasonFailureReason["UNKNOWN"] = "UNKNOWN";
8
- /** The product instance couldn't be created because the Resellers API timed out. */
9
- FailureReasonFailureReason["DELIVERY_TIMEOUT"] = "DELIVERY_TIMEOUT";
10
- /** The product instance couldn't be created because an external process failed. */
11
- FailureReasonFailureReason["EXTERNAL_FAILURE"] = "EXTERNAL_FAILURE";
12
- })(FailureReasonFailureReason || (FailureReasonFailureReason = {}));
13
- export var IntervalIntervalUnit;
14
- (function (IntervalIntervalUnit) {
15
- /** unknown interval unit */
16
- IntervalIntervalUnit["UNKNOWN"] = "UNKNOWN";
17
- /** Day */
18
- IntervalIntervalUnit["DAY"] = "DAY";
19
- /** Week */
20
- IntervalIntervalUnit["WEEK"] = "WEEK";
21
- /** Month */
22
- IntervalIntervalUnit["MONTH"] = "MONTH";
23
- /** Year */
24
- IntervalIntervalUnit["YEAR"] = "YEAR";
25
- })(IntervalIntervalUnit || (IntervalIntervalUnit = {}));
26
- export var CycleDescriptorType;
27
- (function (CycleDescriptorType) {
28
- /** The payment type hasn't been set. */
29
- CycleDescriptorType["UNKNOWN"] = "UNKNOWN";
30
- /** The reseller pays Wix in a single payment. */
31
- CycleDescriptorType["ONE_TIME"] = "ONE_TIME";
32
- /** The reseller pays Wix on a recurring schedule. */
33
- CycleDescriptorType["RECURRING"] = "RECURRING";
34
- })(CycleDescriptorType || (CycleDescriptorType = {}));
35
- export var Status;
36
- (function (Status) {
37
- /** The product instance isn't yet available to the customer. */
38
- Status["PENDING"] = "PENDING";
39
- /** The customer can use the product instance. */
40
- Status["ENABLED"] = "ENABLED";
41
- /** The product instance isn't any longer available to the customer. */
42
- Status["CANCELED"] = "CANCELED";
43
- /** The product instance couldn't be delivered successfully and has never been available to the customer. */
44
- Status["FAILED"] = "FAILED";
45
- /** The product instance isn't yet available to the customer, because an external provider or the customer must take an action. */
46
- Status["AWAITING_ACTION"] = "AWAITING_ACTION";
47
- })(Status || (Status = {}));
48
- export var SortOrder;
49
- (function (SortOrder) {
50
- SortOrder["ASC"] = "ASC";
51
- SortOrder["DESC"] = "DESC";
52
- })(SortOrder || (SortOrder = {}));
53
- export var ProviderName;
54
- (function (ProviderName) {
55
- ProviderName["UNKNOWN"] = "UNKNOWN";
56
- ProviderName["SBS"] = "SBS";
57
- ProviderName["LICENSER"] = "LICENSER";
58
- ProviderName["BASS"] = "BASS";
59
- ProviderName["RESELLER"] = "RESELLER";
60
- ProviderName["RECURRING_INVOICES"] = "RECURRING_INVOICES";
61
- })(ProviderName || (ProviderName = {}));
62
- export var IntervalUnit;
63
- (function (IntervalUnit) {
64
- /** unknown interval unit */
65
- IntervalUnit["UNKNOWN"] = "UNKNOWN";
66
- /** day */
67
- IntervalUnit["DAY"] = "DAY";
68
- /** week */
69
- IntervalUnit["WEEK"] = "WEEK";
70
- /** month */
71
- IntervalUnit["MONTH"] = "MONTH";
72
- /** year */
73
- IntervalUnit["YEAR"] = "YEAR";
74
- })(IntervalUnit || (IntervalUnit = {}));
75
- export var SubscriptionStatus;
76
- (function (SubscriptionStatus) {
77
- SubscriptionStatus["UNKNOWN"] = "UNKNOWN";
78
- SubscriptionStatus["AUTO_RENEW_ON"] = "AUTO_RENEW_ON";
79
- SubscriptionStatus["AUTO_RENEW_OFF"] = "AUTO_RENEW_OFF";
80
- SubscriptionStatus["MANUAL_RECURRING"] = "MANUAL_RECURRING";
81
- SubscriptionStatus["CANCELLED"] = "CANCELLED";
82
- SubscriptionStatus["TRANSFERRED"] = "TRANSFERRED";
83
- })(SubscriptionStatus || (SubscriptionStatus = {}));
84
- /** Reason for subscription reactivation */
85
- export var ReactivationReasonEnum;
86
- (function (ReactivationReasonEnum) {
87
- ReactivationReasonEnum["UNKNOWN"] = "UNKNOWN";
88
- /**
89
- * Subscription was reactivated due to billing status change from CANCELED to ACTIVE, for example if it was incorrectly
90
- * canceled because of suspicion of fraud
91
- */
92
- ReactivationReasonEnum["BILLING_STATUS_CHANGE"] = "BILLING_STATUS_CHANGE";
93
- /** Subscription was reactivated after a chargeback dispute */
94
- ReactivationReasonEnum["REACTIVATED_AFTER_CHARGEBACK"] = "REACTIVATED_AFTER_CHARGEBACK";
95
- })(ReactivationReasonEnum || (ReactivationReasonEnum = {}));
96
- export var Initiator;
97
- (function (Initiator) {
98
- Initiator["UNKNOWN"] = "UNKNOWN";
99
- Initiator["USER_REQUESTED"] = "USER_REQUESTED";
100
- Initiator["APP_MANAGED"] = "APP_MANAGED";
101
- Initiator["PASSIVE"] = "PASSIVE";
102
- })(Initiator || (Initiator = {}));
103
- export var UnassignReason;
104
- (function (UnassignReason) {
105
- UnassignReason["UNKNOWN"] = "UNKNOWN";
106
- UnassignReason["USER_REQUESTED"] = "USER_REQUESTED";
107
- UnassignReason["REPLACED_BY_ANOTHER_SUBSCRIPTION"] = "REPLACED_BY_ANOTHER_SUBSCRIPTION";
108
- })(UnassignReason || (UnassignReason = {}));
109
- /** Copied from SBS */
110
- export var ContractSwitchType;
111
- (function (ContractSwitchType) {
112
- ContractSwitchType["NOT_APPLICABLE"] = "NOT_APPLICABLE";
113
- ContractSwitchType["ADDITIONAL_QUANTITY"] = "ADDITIONAL_QUANTITY";
114
- ContractSwitchType["CREDIT_UNUSED_PERIOD"] = "CREDIT_UNUSED_PERIOD";
115
- ContractSwitchType["REFUND_PRICE_DIFF"] = "REFUND_PRICE_DIFF";
116
- ContractSwitchType["ADJUST_PERIOD_END"] = "ADJUST_PERIOD_END";
117
- ContractSwitchType["DOWNGRADE_GRACE_PERIOD"] = "DOWNGRADE_GRACE_PERIOD";
118
- ContractSwitchType["FULL_AMOUNT_PERIOD"] = "FULL_AMOUNT_PERIOD";
119
- ContractSwitchType["END_OF_PERIOD"] = "END_OF_PERIOD";
120
- ContractSwitchType["PENDING_CHANGES"] = "PENDING_CHANGES";
121
- ContractSwitchType["DOWNGRADE_RENEWAL"] = "DOWNGRADE_RENEWAL";
122
- })(ContractSwitchType || (ContractSwitchType = {}));
123
- export var ContractSwitchReason;
124
- (function (ContractSwitchReason) {
125
- ContractSwitchReason["EXTERNAL_PROVIDER_TRIGGER"] = "EXTERNAL_PROVIDER_TRIGGER";
126
- ContractSwitchReason["PRICE_INCREASE"] = "PRICE_INCREASE";
127
- })(ContractSwitchReason || (ContractSwitchReason = {}));
128
- /** Reason for Price Increase Trigger */
129
- export var PriceIncreaseTrigger;
130
- (function (PriceIncreaseTrigger) {
131
- PriceIncreaseTrigger["NEAR_RENEWAL"] = "NEAR_RENEWAL";
132
- PriceIncreaseTrigger["RECURRING_SUCCESS"] = "RECURRING_SUCCESS";
133
- PriceIncreaseTrigger["MANUAL"] = "MANUAL";
134
- })(PriceIncreaseTrigger || (PriceIncreaseTrigger = {}));
135
- /** Triggered when a subscription's product is adusted. */
136
- export var ProductAdjustment;
137
- (function (ProductAdjustment) {
138
- /** flag to show that the ContractSwitchedEvent is not applicable / needed */
139
- ProductAdjustment["NOT_APPLICABLE"] = "NOT_APPLICABLE";
140
- /** flag to show that the ContractSwitchedEvent is a Downgrade */
141
- ProductAdjustment["DOWNGRADE"] = "DOWNGRADE";
142
- })(ProductAdjustment || (ProductAdjustment = {}));
143
- export var FieldToUpdate;
144
- (function (FieldToUpdate) {
145
- FieldToUpdate["STATUS"] = "STATUS";
146
- FieldToUpdate["COUNTRY_CODE"] = "COUNTRY_CODE";
147
- })(FieldToUpdate || (FieldToUpdate = {}));
148
- export var WebhookIdentityType;
149
- (function (WebhookIdentityType) {
150
- WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
151
- WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
152
- WebhookIdentityType["MEMBER"] = "MEMBER";
153
- WebhookIdentityType["WIX_USER"] = "WIX_USER";
154
- WebhookIdentityType["APP"] = "APP";
155
- })(WebhookIdentityType || (WebhookIdentityType = {}));
156
- /**
157
- * Creates a new package.
158
- *
159
- * Deprecated: This method is deprecated and will be removed by 2024-12-31.
160
- * Use com.wixpress.premium.reseller.packages.v1.Packages.CreatePackageV2 instead.
161
- *
162
- * HTTP Request:
163
- * POST /v1/packages
164
- *
165
- * Permissions:
166
- * Requires the "premium.reseller-package.manage" permission with MANUAL type.
167
- *
168
- * Event:
169
- * A PRIVATE callback will be triggered when the package is successfully created.
170
- *
171
- * Required Fields:
172
- * - CreatePackageRequest.products
173
- *
174
- * Maturity: BETA
175
- * Exposure: PUBLIC
176
- * @public
177
- * @documentationMaturity preview
178
- * @requiredField options.products
179
- * @permissionId premium.reseller-package.manage
180
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.CreatePackage
181
- * @deprecated
182
- * @replacedBy com.wixpress.premium.reseller.packages.v1.Packages.CreatePackageV2
183
- * @targetRemovalDate 2024-12-31
184
- */
185
- export async function createPackage(options) {
186
- // @ts-ignore
187
- const { httpClient, sideEffects } = arguments[1];
188
- const payload = renameKeysFromSDKRequestToRESTRequest({
189
- idempotencyKey: options?.idempotencyKey,
190
- externalId: options?.externalId,
191
- products: options?.products,
192
- });
193
- const reqOpts = ambassadorWixPremiumResellerV1Packages.createPackage(payload);
194
- sideEffects?.onSiteCall?.();
195
- try {
196
- const result = await httpClient.request(reqOpts);
197
- sideEffects?.onSuccess?.(result);
198
- return renameKeysFromRESTResponseToSDKResponse(result.data);
199
- }
200
- catch (err) {
201
- const transformedError = sdkTransformError(err, {
202
- spreadPathsToArguments: {},
203
- explicitPathsToArguments: {
204
- idempotencyKey: '$[0].idempotencyKey',
205
- externalId: '$[0].externalId',
206
- products: '$[0].products',
207
- },
208
- singleArgumentUnchanged: false,
209
- }, ['options']);
210
- sideEffects?.onError?.(err);
211
- throw transformedError;
212
- }
213
- }
214
- /**
215
- * Creates a package of product instances.
216
- *
217
- *
218
- * You must pass the relevant Wix account ID in the header of the call. In
219
- * the DIY flow, we recommend to pass the customer's sub-account ID instead
220
- * of your main reseller account ID.
221
- *
222
- * You may also pass a Wix site ID for each product in the body of the call.
223
- * If you omit the site ID, a floating product instance is created.
224
- *
225
- * When Wix customers purchase a specific paid service or product, Wix may offer
226
- * them time-limited free access to a different product. For example, customers
227
- * get a voucher for a free 1-year domain registration when purchasing any Wix
228
- * Premium plan. If you want to offer your customers the same benefit, create a
229
- * package containing the original product first. Then, create a second package
230
- * with the additional product. In the second Create Package call, pass the
231
- * instance ID of the original product as `referenceProductInstanceId`. This way,
232
- * Wix doesn't charge you for the additional product. Make sure that the status
233
- * of the referenced product is either `"PENDING"` or `"ACTIVE"`. Note that you
234
- * can use each product instance only a single time as reference instance.
235
- *
236
- * You need to pass a `countryCode` to specify where customers can claim
237
- * vouchers that may come with a product. Contact the
238
- * [Wix B2B sales team](mailto:bizdev@wix.com) to get information about
239
- * vouchers and supported locations.
240
- *
241
- * > **Important**: This call requires an account level API key and cannot be
242
- * > authenticated with the standard authorization header.
243
- * @public
244
- * @documentationMaturity preview
245
- * @requiredField options.products
246
- * @requiredField options.products.countryCode
247
- * @permissionId premium.reseller-package.manage
248
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.CreatePackageV2
249
- */
250
- export async function createPackageV2(options) {
251
- // @ts-ignore
252
- const { httpClient, sideEffects } = arguments[1];
253
- const payload = renameKeysFromSDKRequestToRESTRequest({
254
- idempotencyKey: options?.idempotencyKey,
255
- externalId: options?.externalId,
256
- products: options?.products,
257
- });
258
- const reqOpts = ambassadorWixPremiumResellerV1Packages.createPackageV2(payload);
259
- sideEffects?.onSiteCall?.();
260
- try {
261
- const result = await httpClient.request(reqOpts);
262
- sideEffects?.onSuccess?.(result);
263
- return renameKeysFromRESTResponseToSDKResponse(result.data);
264
- }
265
- catch (err) {
266
- const transformedError = sdkTransformError(err, {
267
- spreadPathsToArguments: {},
268
- explicitPathsToArguments: {
269
- idempotencyKey: '$[0].idempotencyKey',
270
- externalId: '$[0].externalId',
271
- products: '$[0].products',
272
- },
273
- singleArgumentUnchanged: false,
274
- }, ['options']);
275
- sideEffects?.onError?.(err);
276
- throw transformedError;
277
- }
278
- }
279
- /**
280
- * Cancels all product instances included in the package and the customer
281
- * immediately loses access to the canceled functionality.
282
- *
283
- *
284
- * You must pass the ID of the Wix account that the package belongs to in the
285
- * header of the call. The call fails, if the package and Wix account don't
286
- * match.
287
- *
288
- * If a canceled product instance is a requirement for another Wix service, that
289
- * functionality is also no longer available to the customer. For example, if
290
- * you cancel a Premium plan, a previously connected domain is automatically
291
- * disconnected from the site.
292
- *
293
- * > **Important**: This call requires an account level API key and cannot be
294
- * > authenticated with the standard authorization header.
295
- * @param _id - ID of the package to cancel.
296
- * @public
297
- * @documentationMaturity preview
298
- * @requiredField _id
299
- * @permissionId premium.reseller-package.manage
300
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.CancelPackage
301
- */
302
- export async function cancelPackage(_id, options) {
303
- // @ts-ignore
304
- const { httpClient, sideEffects } = arguments[2];
305
- const payload = renameKeysFromSDKRequestToRESTRequest({
306
- id: _id,
307
- idempotencyKey: options?.idempotencyKey,
308
- });
309
- const reqOpts = ambassadorWixPremiumResellerV1Packages.cancelPackage(payload);
310
- sideEffects?.onSiteCall?.();
311
- try {
312
- const result = await httpClient.request(reqOpts);
313
- sideEffects?.onSuccess?.(result);
314
- return renameKeysFromRESTResponseToSDKResponse(result.data);
315
- }
316
- catch (err) {
317
- const transformedError = sdkTransformError(err, {
318
- spreadPathsToArguments: {},
319
- explicitPathsToArguments: {
320
- id: '$[0]',
321
- idempotencyKey: '$[1].idempotencyKey',
322
- },
323
- singleArgumentUnchanged: false,
324
- }, ['_id', 'options']);
325
- sideEffects?.onError?.(err);
326
- throw transformedError;
327
- }
328
- }
329
- /**
330
- * Retrieves a package.
331
- *
332
- *
333
- * You must pass the ID of the Wix account that the package belongs to in the
334
- * header of the call. The call fails, if the package and Wix account don't
335
- * match.
336
- *
337
- * > **Important**: This call requires an account level API key and cannot be
338
- * > authenticated with the standard authorization header.
339
- * @param _id - Package ID.
340
- * @public
341
- * @documentationMaturity preview
342
- * @requiredField _id
343
- * @permissionId premium.reseller-package.read
344
- * @returns Retrieved package.
345
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.GetPackage
346
- */
347
- export async function getPackage(_id) {
348
- // @ts-ignore
349
- const { httpClient, sideEffects } = arguments[1];
350
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
351
- const reqOpts = ambassadorWixPremiumResellerV1Packages.getPackage(payload);
352
- sideEffects?.onSiteCall?.();
353
- try {
354
- const result = await httpClient.request(reqOpts);
355
- sideEffects?.onSuccess?.(result);
356
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.package;
357
- }
358
- catch (err) {
359
- const transformedError = sdkTransformError(err, {
360
- spreadPathsToArguments: {},
361
- explicitPathsToArguments: { id: '$[0]' },
362
- singleArgumentUnchanged: false,
363
- }, ['_id']);
364
- sideEffects?.onError?.(err);
365
- throw transformedError;
366
- }
367
- }
368
- /**
369
- * Retrieves a list of packages, given the provided paging, filtering, and sorting.
370
- *
371
- *
372
- * You must pass the ID of the Wix account that the packages belong to in the
373
- * header of the call. The call returns packages that belong to the parent
374
- * account, regardless if you pass the ID of a parent or sub-account. In case
375
- * you want to retrieve only packages that belong to a sub-account, you must
376
- * pass the sub-account ID as `filter` in the `query` object like this:
377
- *
378
- * ```json
379
- * {
380
- * "query": {
381
- * "filter": {
382
- * "accountId": {
383
- * "$eq": "<SUB_ACCOUNT_ID>"
384
- * }
385
- * }
386
- * }
387
- * }
388
- * ```
389
- *
390
- * Query Packages runs with these defaults, which you can override:
391
- *
392
- * - `createdDate` is sorted in `DESC` order
393
- * - `cursorPaging.limit` is `100`
394
- *
395
- * By default `pagingMetadata.cursors` are returned, unless you specifically pass
396
- * `query.paging`.
397
- *
398
- * The maximum for `cursorPaging.limit` is `100`.
399
- *
400
- * If you pass a cursor token that you have received in a previous Query Package response,
401
- * passing additional sort or filter information results in an invalid cursor
402
- * error. Since the received cursor token already holds all the needed information
403
- * for sort and filter. Changing the sort and filter properties during the span of
404
- * a cursor query isn't supported. But you can provide a different limit.
405
- *
406
- * For field support for filters and sorting,
407
- * see [Query Packages: Supported Filters and Sorting](https://dev.wix.com/api/rest/account-level-apis/resellers/supported-filters).
408
- *
409
- * To learn about working with _Query_ endpoints, see
410
- * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
411
- * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
412
- * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
413
- *
414
- * > **Important**: This call requires an account level API key and cannot be
415
- * > authenticated with the standard authorization header.
416
- * @public
417
- * @documentationMaturity preview
418
- * @permissionId premium.reseller-package.read
419
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.QueryPackages
420
- */
421
- export function queryPackages() {
422
- // @ts-ignore
423
- const { httpClient, sideEffects } = arguments[0];
424
- return queryBuilder({
425
- func: async (payload) => {
426
- const reqOpts = ambassadorWixPremiumResellerV1Packages.queryPackages(payload);
427
- sideEffects?.onSiteCall?.();
428
- try {
429
- const result = await httpClient.request(reqOpts);
430
- sideEffects?.onSuccess?.(result);
431
- return result;
432
- }
433
- catch (err) {
434
- sideEffects?.onError?.(err);
435
- throw err;
436
- }
437
- },
438
- requestTransformer: (query) => {
439
- const args = [query, {}];
440
- return renameKeysFromSDKRequestToRESTRequest({
441
- ...args?.[1],
442
- query: args?.[0],
443
- });
444
- },
445
- responseTransformer: ({ data }) => {
446
- const transformedData = renameKeysFromRESTResponseToSDKResponse(data);
447
- return {
448
- items: transformedData?.packages,
449
- pagingMetadata: transformedData?.metadata,
450
- };
451
- },
452
- errorTransformer: (err) => {
453
- const transformedError = sdkTransformError(err, {
454
- spreadPathsToArguments: {},
455
- explicitPathsToArguments: { query: '$[0]' },
456
- singleArgumentUnchanged: false,
457
- });
458
- throw transformedError;
459
- },
460
- pagingMethod: 'CURSOR',
461
- transformationPaths: {},
462
- });
463
- }
464
- /**
465
- * Assigns a product instance to a site.
466
- *
467
- * You must pass the ID of the Wix account that the product instance belongs to in the header of the call.
468
- *
469
- * The customer immediately gains access to features included in the assigned service. It's up to the reseller to decide whether assigning a product instance affects the customer’s payment.
470
- *
471
- * It's possible to assign a product instance that's already assigned to a site, to a different site without [unassigning](/packages/unassign-product-instance-from-site) it first. But if the call fails in such a situation, the product instance may either remain assigned to the original site or become unassigned. You can confirm the instance's status by [retrieving the relevant package](/packages/get-package).
472
- *
473
- * > **Important:** This call requires an account level API key and cannot be authenticated with the standard authorization header.
474
- * @public
475
- * @documentationMaturity preview
476
- * @requiredField identifiers
477
- * @requiredField identifiers.instanceId
478
- * @requiredField identifiers.siteId
479
- * @permissionId premium.reseller-package.manage
480
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.AssignProductInstanceToSite
481
- */
482
- export async function assignProductInstanceToSite(identifiers, options) {
483
- // @ts-ignore
484
- const { httpClient, sideEffects } = arguments[2];
485
- const payload = renameKeysFromSDKRequestToRESTRequest({
486
- instanceId: identifiers?.instanceId,
487
- siteId: identifiers?.siteId,
488
- idempotencyKey: options?.idempotencyKey,
489
- });
490
- const reqOpts = ambassadorWixPremiumResellerV1Packages.assignProductInstanceToSite(payload);
491
- sideEffects?.onSiteCall?.();
492
- try {
493
- const result = await httpClient.request(reqOpts);
494
- sideEffects?.onSuccess?.(result);
495
- return renameKeysFromRESTResponseToSDKResponse(result.data);
496
- }
497
- catch (err) {
498
- const transformedError = sdkTransformError(err, {
499
- spreadPathsToArguments: {},
500
- explicitPathsToArguments: {
501
- instanceId: '$[0].instanceId',
502
- siteId: '$[0].siteId',
503
- idempotencyKey: '$[1].idempotencyKey',
504
- },
505
- singleArgumentUnchanged: false,
506
- }, ['identifiers', 'options']);
507
- sideEffects?.onError?.(err);
508
- throw transformedError;
509
- }
510
- }
511
- /**
512
- * Unassigns a product instance from a site.
513
- *
514
- * You must pass the ID of the Wix account that the product instance belongs to in the header of the call.
515
- *
516
- * The product instance becomes floating and the customer immediately looses access to features included in the unassigned service. It's up to the reseller to decide whether unassigning a product instance affects the customer’s payment.
517
- *
518
- * If an unassigned product instance is a requirement for another service, that service may not be available to the customer any longer. For example, if you unassign a `Combo Plan` plan from a site, a previously connected domain is disconnected.
519
- *
520
- * You can assign floating product instances to sites using the [Assign Product Instance to Site](/packages/assign-product-instance-to-site) method.
521
- *
522
- * > **Important:** This call requires an account level API key and cannot be authenticated with the standard authorization header.
523
- * @param instanceId - ID of the product instance to unassign from a site.
524
- * @public
525
- * @documentationMaturity preview
526
- * @requiredField instanceId
527
- * @permissionId premium.reseller-package.manage
528
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.UnassignProductInstanceFromSite
529
- */
530
- export async function unassignProductInstanceFromSite(instanceId, options) {
531
- // @ts-ignore
532
- const { httpClient, sideEffects } = arguments[2];
533
- const payload = renameKeysFromSDKRequestToRESTRequest({
534
- instanceId: instanceId,
535
- idempotencyKey: options?.idempotencyKey,
536
- });
537
- const reqOpts = ambassadorWixPremiumResellerV1Packages.unassignProductInstanceFromSite(payload);
538
- sideEffects?.onSiteCall?.();
539
- try {
540
- const result = await httpClient.request(reqOpts);
541
- sideEffects?.onSuccess?.(result);
542
- return renameKeysFromRESTResponseToSDKResponse(result.data);
543
- }
544
- catch (err) {
545
- const transformedError = sdkTransformError(err, {
546
- spreadPathsToArguments: {},
547
- explicitPathsToArguments: {
548
- instanceId: '$[0]',
549
- idempotencyKey: '$[1].idempotencyKey',
550
- },
551
- singleArgumentUnchanged: false,
552
- }, ['instanceId', 'options']);
553
- sideEffects?.onError?.(err);
554
- throw transformedError;
555
- }
556
- }
557
- /**
558
- * Cancels a product instance.
559
- *
560
- *
561
- * You must pass the ID of the Wix account that the product instance belongs
562
- * to in the header of the call. The call fails, if the product instance and
563
- * Wix account don't match.
564
- *
565
- * The customer immediately loses access to features included in the
566
- * canceled service. It's up to the reseller to decide whether the adjustment
567
- * affects the customer’s payment.
568
- *
569
- * If a canceled service is a requirement for another service, that service
570
- * may not be available to the customer any longer. For example, if you cancel
571
- * a `Combo Plan` plan, a previously connected domain is disconnected
572
- * from the site.
573
- *
574
- *
575
- * > **Important**: This call requires an account level API key and cannot be
576
- * > authenticated with the standard authorization header.
577
- * @param instanceId - ID of the product instance to cancel.
578
- * @public
579
- * @documentationMaturity preview
580
- * @requiredField instanceId
581
- * @permissionId premium.reseller-package.manage
582
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.CancelProductInstance
583
- */
584
- export async function cancelProductInstance(instanceId, options) {
585
- // @ts-ignore
586
- const { httpClient, sideEffects } = arguments[2];
587
- const payload = renameKeysFromSDKRequestToRESTRequest({
588
- instanceId: instanceId,
589
- idempotencyKey: options?.idempotencyKey,
590
- });
591
- const reqOpts = ambassadorWixPremiumResellerV1Packages.cancelProductInstance(payload);
592
- sideEffects?.onSiteCall?.();
593
- try {
594
- const result = await httpClient.request(reqOpts);
595
- sideEffects?.onSuccess?.(result);
596
- return renameKeysFromRESTResponseToSDKResponse(result.data);
597
- }
598
- catch (err) {
599
- const transformedError = sdkTransformError(err, {
600
- spreadPathsToArguments: {},
601
- explicitPathsToArguments: {
602
- instanceId: '$[0]',
603
- idempotencyKey: '$[1].idempotencyKey',
604
- },
605
- singleArgumentUnchanged: false,
606
- }, ['instanceId', 'options']);
607
- sideEffects?.onError?.(err);
608
- throw transformedError;
609
- }
610
- }
611
- /**
612
- * Upgrades or downgrades a product instance. For example, you can upgrade a
613
- * customer's `Business Unlimited Premium` plan to `Business VIP` using this
614
- * endpoint.
615
- *
616
- *
617
- * You must pass the ID of the Wix account that the product instance belongs
618
- * to in the header of the call. The call fails, if the product instance and
619
- * Wix account don't match.
620
- *
621
- * The customer has immediate access to new features, while losing access to
622
- * features not included in the new service. It's up to the reseller to
623
- * decide whether the adjustment affects the customer’s payment.
624
- *
625
- * You can only exchange a product instance with a service of the same type.
626
- * Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for details about
627
- * which services belong to the same type.
628
- *
629
- * You must provide either a new `catalogProductId` or a new `billingInfo`
630
- * object. The new billing cycle must be supported for the product. Contact the
631
- * [Wix B2B sales team](mailto:bizdev@wix.com) for information
632
- * about which billing cycles are supported for each product. If you adjust the
633
- * billing cycle for a product instance with `RECURRING` payments, you must
634
- * also provide `billingInfo.cycleDuration.unit`.
635
- *
636
- * If a removed feature is a requirement for another service, that service
637
- * may not be available to the customer any longer. For example, if you downgrade a
638
- * `Business Unlimited` plan to `Business Basic`, the site owners won’t be
639
- * able to use `Pro eCommerce Features` any longer.
640
- *
641
- * > **Important**: This call requires an account level API key and cannot be
642
- * > authenticated with the standard authorization header.
643
- * @param instanceId - ID of the product instance to adjust.
644
- * @public
645
- * @documentationMaturity preview
646
- * @requiredField instanceId
647
- * @permissionId premium.reseller-package.manage
648
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.AdjustProductInstanceSpecifications
649
- */
650
- export async function adjustProductInstanceSpecifications(instanceId, options) {
651
- // @ts-ignore
652
- const { httpClient, sideEffects } = arguments[2];
653
- const payload = renameKeysFromSDKRequestToRESTRequest({
654
- instanceId: instanceId,
655
- idempotencyKey: options?.idempotencyKey,
656
- catalogProductId: options?.catalogProductId,
657
- billingInfo: options?.billingInfo,
658
- discountCode: options?.discountCode,
659
- });
660
- const reqOpts = ambassadorWixPremiumResellerV1Packages.adjustProductInstanceSpecifications(payload);
661
- sideEffects?.onSiteCall?.();
662
- try {
663
- const result = await httpClient.request(reqOpts);
664
- sideEffects?.onSuccess?.(result);
665
- return renameKeysFromRESTResponseToSDKResponse(result.data);
666
- }
667
- catch (err) {
668
- const transformedError = sdkTransformError(err, {
669
- spreadPathsToArguments: {},
670
- explicitPathsToArguments: {
671
- instanceId: '$[0]',
672
- idempotencyKey: '$[1].idempotencyKey',
673
- catalogProductId: '$[1].catalogProductId',
674
- billingInfo: '$[1].billingInfo',
675
- discountCode: '$[1].discountCode',
676
- },
677
- singleArgumentUnchanged: false,
678
- }, ['instanceId', 'options']);
679
- sideEffects?.onError?.(err);
680
- throw transformedError;
681
- }
682
- }
683
- /**
684
- * Updates a package's external ID field.
685
- * @public
686
- * @documentationMaturity preview
687
- * @requiredField identifiers
688
- * @requiredField identifiers.externalId
689
- * @requiredField identifiers.packageId
690
- * @permissionId PREMIUM.PACKAGE_UPDATE_EXTERNAL_ID
691
- * @fqn com.wixpress.premium.reseller.packages.v1.Packages.UpdatePackageExternalId
692
- */
693
- export async function updatePackageExternalId(identifiers) {
694
- // @ts-ignore
695
- const { httpClient, sideEffects } = arguments[1];
696
- const payload = renameKeysFromSDKRequestToRESTRequest({
697
- packageId: identifiers?.packageId,
698
- externalId: identifiers?.externalId,
699
- });
700
- const reqOpts = ambassadorWixPremiumResellerV1Packages.updatePackageExternalId(payload);
701
- sideEffects?.onSiteCall?.();
702
- try {
703
- const result = await httpClient.request(reqOpts);
704
- sideEffects?.onSuccess?.(result);
705
- return renameKeysFromRESTResponseToSDKResponse(result.data);
706
- }
707
- catch (err) {
708
- const transformedError = sdkTransformError(err, {
709
- spreadPathsToArguments: {},
710
- explicitPathsToArguments: {
711
- packageId: '$[0].packageId',
712
- externalId: '$[0].externalId',
713
- },
714
- singleArgumentUnchanged: false,
715
- }, ['identifiers']);
716
- sideEffects?.onError?.(err);
717
- throw transformedError;
718
- }
719
- }
720
- //# sourceMappingURL=premium-reseller-v1-packages-packages.universal.js.map