@wix/auto_sdk_ecom_subscription-contracts 1.0.37 → 1.0.38

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.
@@ -0,0 +1,450 @@
1
+ // src/ecom-subscription-contracts-v1-subscription-contract-subscription-contracts.universal.ts
2
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
3
+ import { queryBuilder } from "@wix/sdk-runtime/query-builder";
4
+ import {
5
+ renameKeysFromSDKRequestToRESTRequest,
6
+ renameKeysFromRESTResponseToSDKResponse
7
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
8
+
9
+ // src/ecom-subscription-contracts-v1-subscription-contract-subscription-contracts.http.ts
10
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
11
+ import { transformRESTFloatToSDKFloat } from "@wix/sdk-runtime/transformations/float";
12
+ import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
13
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
14
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
15
+ function resolveWixEcomSubscriptionContractsV1SubscriptionContractsUrl(opts) {
16
+ const domainToMappings = {};
17
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
18
+ }
19
+ var PACKAGE_NAME = "@wix/auto_sdk_ecom_subscription-contracts";
20
+ function getSubscriptionContract(payload) {
21
+ function __getSubscriptionContract({ host }) {
22
+ const metadata = {
23
+ entityFqdn: "wix.ecom.subscription_contracts.v1.subscription_contract",
24
+ method: "GET",
25
+ methodFqn: "wix.ecom.subscription_contracts.v1.SubscriptionContracts.GetSubscriptionContract",
26
+ packageName: PACKAGE_NAME,
27
+ url: resolveWixEcomSubscriptionContractsV1SubscriptionContractsUrl({
28
+ protoPath: "/v1/subscription-contracts/{subscriptionContractId}",
29
+ data: payload,
30
+ host
31
+ }),
32
+ params: toURLSearchParams(payload),
33
+ transformResponse: (payload2) => transformPaths(payload2, [
34
+ {
35
+ transformFn: transformRESTTimestampToSDKTimestamp,
36
+ paths: [
37
+ { path: "subscriptionContract.createdDate" },
38
+ { path: "subscriptionContract.updatedDate" },
39
+ { path: "subscriptionContract.subscriptionSettings.startDate" },
40
+ {
41
+ path: "subscriptionContract.lineItems.image.urlExpirationDate"
42
+ },
43
+ {
44
+ path: "subscriptionContract.lineItems.digitalFile.expirationDate"
45
+ },
46
+ {
47
+ path: "subscriptionContract.lineItems.subscriptionInfo.subscriptionSettings.startDate"
48
+ },
49
+ {
50
+ path: "subscriptionContract.shippingInfo.logistics.deliverByDate"
51
+ },
52
+ {
53
+ path: "subscriptionContract.shippingInfo.logistics.deliveryTimeSlot.from"
54
+ },
55
+ {
56
+ path: "subscriptionContract.shippingInfo.logistics.deliveryTimeSlot.to"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ transformFn: transformRESTFloatToSDKFloat,
62
+ paths: [
63
+ { path: "subscriptionContract.lineItems.image.focalPoint.x" },
64
+ { path: "subscriptionContract.lineItems.image.focalPoint.y" },
65
+ {
66
+ path: "subscriptionContract.lineItems.physicalProperties.weight"
67
+ },
68
+ {
69
+ path: "subscriptionContract.billingInfo.address.geocode.latitude"
70
+ },
71
+ {
72
+ path: "subscriptionContract.billingInfo.address.geocode.longitude"
73
+ },
74
+ {
75
+ path: "subscriptionContract.shippingInfo.logistics.shippingDestination.address.geocode.latitude"
76
+ },
77
+ {
78
+ path: "subscriptionContract.shippingInfo.logistics.shippingDestination.address.geocode.longitude"
79
+ },
80
+ {
81
+ path: "subscriptionContract.shippingInfo.logistics.pickupDetails.address.geocode.latitude"
82
+ },
83
+ {
84
+ path: "subscriptionContract.shippingInfo.logistics.pickupDetails.address.geocode.longitude"
85
+ },
86
+ {
87
+ path: "subscriptionContract.recipientInfo.address.geocode.latitude"
88
+ },
89
+ {
90
+ path: "subscriptionContract.recipientInfo.address.geocode.longitude"
91
+ }
92
+ ]
93
+ }
94
+ ])
95
+ };
96
+ return metadata;
97
+ }
98
+ return __getSubscriptionContract;
99
+ }
100
+ function querySubscriptionContracts(payload) {
101
+ function __querySubscriptionContracts({ host }) {
102
+ const metadata = {
103
+ entityFqdn: "wix.ecom.subscription_contracts.v1.subscription_contract",
104
+ method: "POST",
105
+ methodFqn: "wix.ecom.subscription_contracts.v1.SubscriptionContracts.QuerySubscriptionContracts",
106
+ packageName: PACKAGE_NAME,
107
+ url: resolveWixEcomSubscriptionContractsV1SubscriptionContractsUrl({
108
+ protoPath: "/v1/subscription-contracts/query",
109
+ data: payload,
110
+ host
111
+ }),
112
+ data: payload,
113
+ transformResponse: (payload2) => transformPaths(payload2, [
114
+ {
115
+ transformFn: transformRESTTimestampToSDKTimestamp,
116
+ paths: [
117
+ { path: "subscriptionContracts.createdDate" },
118
+ { path: "subscriptionContracts.updatedDate" },
119
+ { path: "subscriptionContracts.subscriptionSettings.startDate" },
120
+ {
121
+ path: "subscriptionContracts.lineItems.image.urlExpirationDate"
122
+ },
123
+ {
124
+ path: "subscriptionContracts.lineItems.digitalFile.expirationDate"
125
+ },
126
+ {
127
+ path: "subscriptionContracts.lineItems.subscriptionInfo.subscriptionSettings.startDate"
128
+ },
129
+ {
130
+ path: "subscriptionContracts.shippingInfo.logistics.deliverByDate"
131
+ },
132
+ {
133
+ path: "subscriptionContracts.shippingInfo.logistics.deliveryTimeSlot.from"
134
+ },
135
+ {
136
+ path: "subscriptionContracts.shippingInfo.logistics.deliveryTimeSlot.to"
137
+ }
138
+ ]
139
+ },
140
+ {
141
+ transformFn: transformRESTFloatToSDKFloat,
142
+ paths: [
143
+ { path: "subscriptionContracts.lineItems.image.focalPoint.x" },
144
+ { path: "subscriptionContracts.lineItems.image.focalPoint.y" },
145
+ {
146
+ path: "subscriptionContracts.lineItems.physicalProperties.weight"
147
+ },
148
+ {
149
+ path: "subscriptionContracts.billingInfo.address.geocode.latitude"
150
+ },
151
+ {
152
+ path: "subscriptionContracts.billingInfo.address.geocode.longitude"
153
+ },
154
+ {
155
+ path: "subscriptionContracts.shippingInfo.logistics.shippingDestination.address.geocode.latitude"
156
+ },
157
+ {
158
+ path: "subscriptionContracts.shippingInfo.logistics.shippingDestination.address.geocode.longitude"
159
+ },
160
+ {
161
+ path: "subscriptionContracts.shippingInfo.logistics.pickupDetails.address.geocode.latitude"
162
+ },
163
+ {
164
+ path: "subscriptionContracts.shippingInfo.logistics.pickupDetails.address.geocode.longitude"
165
+ },
166
+ {
167
+ path: "subscriptionContracts.recipientInfo.address.geocode.latitude"
168
+ },
169
+ {
170
+ path: "subscriptionContracts.recipientInfo.address.geocode.longitude"
171
+ }
172
+ ]
173
+ }
174
+ ]),
175
+ fallback: [
176
+ {
177
+ method: "POST",
178
+ url: resolveWixEcomSubscriptionContractsV1SubscriptionContractsUrl({
179
+ protoPath: "/v1/subscription-contracts/query",
180
+ data: payload,
181
+ host
182
+ }),
183
+ data: payload
184
+ }
185
+ ]
186
+ };
187
+ return metadata;
188
+ }
189
+ return __querySubscriptionContracts;
190
+ }
191
+
192
+ // src/ecom-subscription-contracts-v1-subscription-contract-subscription-contracts.universal.ts
193
+ import { transformRESTAddressToSDKAddress } from "@wix/sdk-runtime/transformations/address";
194
+ import { transformRESTImageToSDKImage } from "@wix/sdk-runtime/transformations/image";
195
+ import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
196
+ var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
197
+ SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
198
+ SubscriptionFrequency2["DAY"] = "DAY";
199
+ SubscriptionFrequency2["WEEK"] = "WEEK";
200
+ SubscriptionFrequency2["MONTH"] = "MONTH";
201
+ SubscriptionFrequency2["YEAR"] = "YEAR";
202
+ return SubscriptionFrequency2;
203
+ })(SubscriptionFrequency || {});
204
+ var DescriptionLineType = /* @__PURE__ */ ((DescriptionLineType2) => {
205
+ DescriptionLineType2["UNRECOGNISED"] = "UNRECOGNISED";
206
+ DescriptionLineType2["PLAIN_TEXT"] = "PLAIN_TEXT";
207
+ DescriptionLineType2["COLOR"] = "COLOR";
208
+ return DescriptionLineType2;
209
+ })(DescriptionLineType || {});
210
+ var ItemTypeItemType = /* @__PURE__ */ ((ItemTypeItemType2) => {
211
+ ItemTypeItemType2["UNRECOGNISED"] = "UNRECOGNISED";
212
+ ItemTypeItemType2["PHYSICAL"] = "PHYSICAL";
213
+ ItemTypeItemType2["DIGITAL"] = "DIGITAL";
214
+ ItemTypeItemType2["GIFT_CARD"] = "GIFT_CARD";
215
+ ItemTypeItemType2["SERVICE"] = "SERVICE";
216
+ return ItemTypeItemType2;
217
+ })(ItemTypeItemType || {});
218
+ var PaymentOptionType = /* @__PURE__ */ ((PaymentOptionType2) => {
219
+ PaymentOptionType2["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
220
+ PaymentOptionType2["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
221
+ PaymentOptionType2["MEMBERSHIP"] = "MEMBERSHIP";
222
+ PaymentOptionType2["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
223
+ PaymentOptionType2["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
224
+ return PaymentOptionType2;
225
+ })(PaymentOptionType || {});
226
+ var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
227
+ JurisdictionType2["UNDEFINED"] = "UNDEFINED";
228
+ JurisdictionType2["COUNTRY"] = "COUNTRY";
229
+ JurisdictionType2["STATE"] = "STATE";
230
+ JurisdictionType2["COUNTY"] = "COUNTY";
231
+ JurisdictionType2["CITY"] = "CITY";
232
+ JurisdictionType2["SPECIAL"] = "SPECIAL";
233
+ return JurisdictionType2;
234
+ })(JurisdictionType || {});
235
+ var V2SubscriptionFrequency = /* @__PURE__ */ ((V2SubscriptionFrequency2) => {
236
+ V2SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
237
+ V2SubscriptionFrequency2["DAY"] = "DAY";
238
+ V2SubscriptionFrequency2["WEEK"] = "WEEK";
239
+ V2SubscriptionFrequency2["MONTH"] = "MONTH";
240
+ V2SubscriptionFrequency2["YEAR"] = "YEAR";
241
+ return V2SubscriptionFrequency2;
242
+ })(V2SubscriptionFrequency || {});
243
+ var AdjustmentType = /* @__PURE__ */ ((AdjustmentType2) => {
244
+ AdjustmentType2["UNKNOWN_ADJUSTMENT_TYPE"] = "UNKNOWN_ADJUSTMENT_TYPE";
245
+ AdjustmentType2["EXTRA_CHARGE"] = "EXTRA_CHARGE";
246
+ AdjustmentType2["CREDIT"] = "CREDIT";
247
+ return AdjustmentType2;
248
+ })(AdjustmentType || {});
249
+ var TaxableAddressType = /* @__PURE__ */ ((TaxableAddressType2) => {
250
+ TaxableAddressType2["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
251
+ TaxableAddressType2["BUSINESS"] = "BUSINESS";
252
+ TaxableAddressType2["BILLING"] = "BILLING";
253
+ TaxableAddressType2["SHIPPING"] = "SHIPPING";
254
+ return TaxableAddressType2;
255
+ })(TaxableAddressType || {});
256
+ var WeightUnit = /* @__PURE__ */ ((WeightUnit2) => {
257
+ WeightUnit2["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
258
+ WeightUnit2["KG"] = "KG";
259
+ WeightUnit2["LB"] = "LB";
260
+ return WeightUnit2;
261
+ })(WeightUnit || {});
262
+ var VatType = /* @__PURE__ */ ((VatType2) => {
263
+ VatType2["UNSPECIFIED"] = "UNSPECIFIED";
264
+ VatType2["CPF"] = "CPF";
265
+ VatType2["CNPJ"] = "CNPJ";
266
+ return VatType2;
267
+ })(VatType || {});
268
+ var PickupMethod = /* @__PURE__ */ ((PickupMethod2) => {
269
+ PickupMethod2["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
270
+ PickupMethod2["STORE_PICKUP"] = "STORE_PICKUP";
271
+ PickupMethod2["PICKUP_POINT"] = "PICKUP_POINT";
272
+ return PickupMethod2;
273
+ })(PickupMethod || {});
274
+ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
275
+ DiscountType2["GLOBAL"] = "GLOBAL";
276
+ DiscountType2["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
277
+ DiscountType2["SHIPPING"] = "SHIPPING";
278
+ return DiscountType2;
279
+ })(DiscountType || {});
280
+ var DiscountReason = /* @__PURE__ */ ((DiscountReason2) => {
281
+ DiscountReason2["UNSPECIFIED"] = "UNSPECIFIED";
282
+ DiscountReason2["EXCHANGED_ITEMS"] = "EXCHANGED_ITEMS";
283
+ DiscountReason2["BILLING_ADJUSTMENT"] = "BILLING_ADJUSTMENT";
284
+ return DiscountReason2;
285
+ })(DiscountReason || {});
286
+ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
287
+ ChannelType2["UNSPECIFIED"] = "UNSPECIFIED";
288
+ ChannelType2["WEB"] = "WEB";
289
+ ChannelType2["POS"] = "POS";
290
+ ChannelType2["EBAY"] = "EBAY";
291
+ ChannelType2["AMAZON"] = "AMAZON";
292
+ ChannelType2["OTHER_PLATFORM"] = "OTHER_PLATFORM";
293
+ ChannelType2["WIX_APP_STORE"] = "WIX_APP_STORE";
294
+ ChannelType2["WIX_INVOICES"] = "WIX_INVOICES";
295
+ ChannelType2["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
296
+ ChannelType2["WISH"] = "WISH";
297
+ ChannelType2["CLASS_PASS"] = "CLASS_PASS";
298
+ ChannelType2["GLOBAL_E"] = "GLOBAL_E";
299
+ ChannelType2["FACEBOOK"] = "FACEBOOK";
300
+ ChannelType2["ETSY"] = "ETSY";
301
+ ChannelType2["TIKTOK"] = "TIKTOK";
302
+ ChannelType2["FAIRE_COM"] = "FAIRE_COM";
303
+ return ChannelType2;
304
+ })(ChannelType || {});
305
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
306
+ SortOrder2["ASC"] = "ASC";
307
+ SortOrder2["DESC"] = "DESC";
308
+ return SortOrder2;
309
+ })(SortOrder || {});
310
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
311
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
312
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
313
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
314
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
315
+ WebhookIdentityType2["APP"] = "APP";
316
+ return WebhookIdentityType2;
317
+ })(WebhookIdentityType || {});
318
+ async function getSubscriptionContract2(subscriptionContractId) {
319
+ const { httpClient, sideEffects } = arguments[1];
320
+ const payload = renameKeysFromSDKRequestToRESTRequest({
321
+ subscriptionContractId
322
+ });
323
+ const reqOpts = getSubscriptionContract(
324
+ payload
325
+ );
326
+ sideEffects?.onSiteCall?.();
327
+ try {
328
+ const result = await httpClient.request(reqOpts);
329
+ sideEffects?.onSuccess?.(result);
330
+ return renameKeysFromRESTResponseToSDKResponse(
331
+ transformPaths2(result.data, [
332
+ {
333
+ transformFn: transformRESTImageToSDKImage,
334
+ paths: [{ path: "subscriptionContract.lineItems.image" }]
335
+ },
336
+ {
337
+ transformFn: transformRESTAddressToSDKAddress,
338
+ paths: [
339
+ { path: "subscriptionContract.billingInfo.address" },
340
+ {
341
+ path: "subscriptionContract.shippingInfo.logistics.shippingDestination.address"
342
+ },
343
+ {
344
+ path: "subscriptionContract.shippingInfo.logistics.pickupDetails.address"
345
+ },
346
+ { path: "subscriptionContract.recipientInfo.address" }
347
+ ]
348
+ }
349
+ ])
350
+ )?.subscriptionContract;
351
+ } catch (err) {
352
+ const transformedError = sdkTransformError(
353
+ err,
354
+ {
355
+ spreadPathsToArguments: {},
356
+ explicitPathsToArguments: { subscriptionContractId: "$[0]" },
357
+ singleArgumentUnchanged: false
358
+ },
359
+ ["subscriptionContractId"]
360
+ );
361
+ sideEffects?.onError?.(err);
362
+ throw transformedError;
363
+ }
364
+ }
365
+ function querySubscriptionContracts2() {
366
+ const { httpClient, sideEffects } = arguments[0];
367
+ return queryBuilder({
368
+ func: async (payload) => {
369
+ const reqOpts = querySubscriptionContracts(
370
+ payload
371
+ );
372
+ sideEffects?.onSiteCall?.();
373
+ try {
374
+ const result = await httpClient.request(reqOpts);
375
+ sideEffects?.onSuccess?.(result);
376
+ return result;
377
+ } catch (err) {
378
+ sideEffects?.onError?.(err);
379
+ throw err;
380
+ }
381
+ },
382
+ requestTransformer: (query) => {
383
+ const args = [query, {}];
384
+ return renameKeysFromSDKRequestToRESTRequest({
385
+ ...args?.[1],
386
+ query: args?.[0]
387
+ });
388
+ },
389
+ responseTransformer: ({
390
+ data
391
+ }) => {
392
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(
393
+ transformPaths2(data, [
394
+ {
395
+ transformFn: transformRESTImageToSDKImage,
396
+ paths: [{ path: "subscriptionContracts.lineItems.image" }]
397
+ },
398
+ {
399
+ transformFn: transformRESTAddressToSDKAddress,
400
+ paths: [
401
+ { path: "subscriptionContracts.billingInfo.address" },
402
+ {
403
+ path: "subscriptionContracts.shippingInfo.logistics.shippingDestination.address"
404
+ },
405
+ {
406
+ path: "subscriptionContracts.shippingInfo.logistics.pickupDetails.address"
407
+ },
408
+ { path: "subscriptionContracts.recipientInfo.address" }
409
+ ]
410
+ }
411
+ ])
412
+ );
413
+ return {
414
+ items: transformedData?.subscriptionContracts,
415
+ pagingMetadata: transformedData?.pagingMetadata
416
+ };
417
+ },
418
+ errorTransformer: (err) => {
419
+ const transformedError = sdkTransformError(err, {
420
+ spreadPathsToArguments: {},
421
+ explicitPathsToArguments: { query: "$[0]" },
422
+ singleArgumentUnchanged: false
423
+ });
424
+ throw transformedError;
425
+ },
426
+ pagingMethod: "CURSOR",
427
+ transformationPaths: {}
428
+ });
429
+ }
430
+ export {
431
+ AdjustmentType,
432
+ ChannelType,
433
+ DescriptionLineType,
434
+ DiscountReason,
435
+ DiscountType,
436
+ ItemTypeItemType,
437
+ JurisdictionType,
438
+ PaymentOptionType,
439
+ PickupMethod,
440
+ SortOrder,
441
+ SubscriptionFrequency,
442
+ TaxableAddressType,
443
+ V2SubscriptionFrequency,
444
+ VatType,
445
+ WebhookIdentityType,
446
+ WeightUnit,
447
+ getSubscriptionContract2 as getSubscriptionContract,
448
+ querySubscriptionContracts2 as querySubscriptionContracts
449
+ };
450
+ //# sourceMappingURL=index.typings.mjs.map