@wix/auto_sdk_ecom_current-cart 1.0.184 → 1.0.186

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.
@@ -1,1435 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // index.typings.ts
21
- var index_typings_exports = {};
22
- __export(index_typings_exports, {
23
- AdditionalFeeSource: () => AdditionalFeeSource,
24
- AppliedDiscountDiscountType: () => AppliedDiscountDiscountType,
25
- BalanceType: () => BalanceType,
26
- ChannelType: () => ChannelType,
27
- ChargeType: () => ChargeType,
28
- DescriptionLineType: () => DescriptionLineType,
29
- DimensionsUnit: () => DimensionsUnit,
30
- DiscountType: () => DiscountType,
31
- FallbackReason: () => FallbackReason,
32
- FileType: () => FileType,
33
- ItemAvailabilityStatus: () => ItemAvailabilityStatus,
34
- ItemTypePreset: () => ItemTypePreset,
35
- JurisdictionType: () => JurisdictionType,
36
- LimitedQuotaType: () => LimitedQuotaType,
37
- ManualCalculationReason: () => ManualCalculationReason,
38
- NameInLineItem: () => NameInLineItem,
39
- NameInOther: () => NameInOther,
40
- PaymentOptionType: () => PaymentOptionType,
41
- PickupMethod: () => PickupMethod,
42
- PlatformFeeChargeType: () => PlatformFeeChargeType,
43
- ProductPeriodAlignment: () => ProductPeriodAlignment,
44
- QuotaType: () => QuotaType,
45
- RateType: () => RateType,
46
- RuleType: () => RuleType,
47
- Severity: () => Severity,
48
- SubscriptionFrequency: () => SubscriptionFrequency,
49
- SuggestedFix: () => SuggestedFix,
50
- TaxableAddressType: () => TaxableAddressType,
51
- VatType: () => VatType,
52
- WebhookIdentityType: () => WebhookIdentityType,
53
- WeightUnit: () => WeightUnit,
54
- addToCurrentCart: () => addToCurrentCart2,
55
- createCheckoutFromCurrentCart: () => createCheckoutFromCurrentCart2,
56
- deleteCurrentCart: () => deleteCurrentCart2,
57
- estimateCurrentCartTotals: () => estimateCurrentCartTotals2,
58
- getCurrentCart: () => getCurrentCart,
59
- removeCouponFromCurrentCart: () => removeCouponFromCurrentCart2,
60
- removeLineItemsFromCurrentCart: () => removeLineItemsFromCurrentCart2,
61
- updateCurrentCart: () => updateCurrentCart2,
62
- updateCurrentCartLineItemQuantity: () => updateCurrentCartLineItemQuantity2
63
- });
64
- module.exports = __toCommonJS(index_typings_exports);
65
-
66
- // src/ecom-v1-cart-current-cart.universal.ts
67
- var import_transform_error = require("@wix/sdk-runtime/transform-error");
68
- var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
69
-
70
- // src/ecom-v1-cart-current-cart.http.ts
71
- var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
72
- var import_float = require("@wix/sdk-runtime/transformations/float");
73
- var import_float2 = require("@wix/sdk-runtime/transformations/float");
74
- var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
75
- var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
76
- var import_field_mask = require("@wix/sdk-runtime/transformations/field-mask");
77
- var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
78
- var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
79
- function resolveComWixEcomCartApiV1CurrentCartServiceUrl(opts) {
80
- const domainToMappings = {
81
- "www.wixapis.com": [
82
- {
83
- srcPath: "/ecom/v1/carts",
84
- destPath: "/v1/carts"
85
- }
86
- ],
87
- "www.wixgateway.com": [
88
- {
89
- srcPath: "/ecom/v1/carts",
90
- destPath: "/v1/carts"
91
- }
92
- ],
93
- _: [
94
- {
95
- srcPath: "/_api/ecom-cart",
96
- destPath: ""
97
- },
98
- {
99
- srcPath: "/_api/cart",
100
- destPath: ""
101
- },
102
- {
103
- srcPath: "/ecom/v1/carts",
104
- destPath: "/v1/carts"
105
- }
106
- ],
107
- "manage._base_domain_": [
108
- {
109
- srcPath: "/ecom/v1/carts",
110
- destPath: "/v1/carts"
111
- }
112
- ],
113
- "editor._base_domain_": [
114
- {
115
- srcPath: "/_api/ecom-cart",
116
- destPath: ""
117
- }
118
- ],
119
- "blocks._base_domain_": [
120
- {
121
- srcPath: "/_api/ecom-cart",
122
- destPath: ""
123
- }
124
- ],
125
- "create.editorx": [
126
- {
127
- srcPath: "/_api/ecom-cart",
128
- destPath: ""
129
- }
130
- ],
131
- "*.dev.wix-code.com": [
132
- {
133
- srcPath: "/_api/ecom-cart",
134
- destPath: ""
135
- }
136
- ],
137
- "www._base_domain_": [
138
- {
139
- srcPath: "/_api/ecom-cart",
140
- destPath: ""
141
- }
142
- ],
143
- "bo._base_domain_": [
144
- {
145
- srcPath: "/ecom/v1/carts",
146
- destPath: "/v1/carts"
147
- }
148
- ],
149
- "wixbo.ai": [
150
- {
151
- srcPath: "/ecom/v1/carts",
152
- destPath: "/v1/carts"
153
- }
154
- ],
155
- "wix-bo.com": [
156
- {
157
- srcPath: "/ecom/v1/carts",
158
- destPath: "/v1/carts"
159
- }
160
- ],
161
- "editor.wixapps.net": [
162
- {
163
- srcPath: "/_api/ecom-cart",
164
- destPath: ""
165
- }
166
- ],
167
- "apps._base_domain_": [
168
- {
169
- srcPath: "/ecom/v1/carts",
170
- destPath: "/v1/carts"
171
- }
172
- ],
173
- "api._api_base_domain_": [
174
- {
175
- srcPath: "/cart-v1-proxy",
176
- destPath: ""
177
- }
178
- ],
179
- "ecom.wixapps.net": [
180
- {
181
- srcPath: "/_api/ecom-cart",
182
- destPath: ""
183
- }
184
- ]
185
- };
186
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
187
- }
188
- var PACKAGE_NAME = "@wix/auto_sdk_ecom_current-cart";
189
- function currentCartGetCurrentCart(payload) {
190
- function __currentCartGetCurrentCart({ host }) {
191
- const metadata = {
192
- entityFqdn: "wix.ecom.v1.cart",
193
- method: "GET",
194
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.GetCurrentCart",
195
- packageName: PACKAGE_NAME,
196
- migrationOptions: {
197
- optInTransformResponse: true
198
- },
199
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
200
- protoPath: "/v1/carts/current",
201
- data: payload,
202
- host
203
- }),
204
- params: (0, import_rest_modules.toURLSearchParams)(payload),
205
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
206
- {
207
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
208
- paths: [
209
- { path: "cart.createdDate" },
210
- { path: "cart.updatedDate" },
211
- { path: "cart.lineItems.image.urlExpirationDate" },
212
- {
213
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
214
- },
215
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
216
- { path: "cart.lineItems.serviceProperties.endDate" }
217
- ]
218
- },
219
- {
220
- transformFn: import_float2.transformRESTFloatToSDKFloat,
221
- paths: [
222
- { path: "cart.lineItems.image.focalPoint.x" },
223
- { path: "cart.lineItems.image.focalPoint.y" },
224
- { path: "cart.lineItems.physicalProperties.weight" },
225
- {
226
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
227
- },
228
- { path: "cart.contactInfo.address.geocode.latitude" },
229
- { path: "cart.contactInfo.address.geocode.longitude" }
230
- ]
231
- }
232
- ])
233
- };
234
- return metadata;
235
- }
236
- return __currentCartGetCurrentCart;
237
- }
238
- function updateCurrentCart(payload) {
239
- function __updateCurrentCart({ host }) {
240
- const serializedData = (0, import_transform_paths.transformPaths)(payload, [
241
- {
242
- transformFn: import_field_mask.transformSDKFieldMaskToRESTFieldMask,
243
- paths: [{ path: "cartFieldmask" }]
244
- },
245
- {
246
- transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
247
- paths: [
248
- { path: "cartInfo.createdDate" },
249
- { path: "cartInfo.updatedDate" },
250
- { path: "cartInfo.lineItems.image.urlExpirationDate" },
251
- {
252
- path: "cartInfo.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
253
- },
254
- { path: "cartInfo.lineItems.serviceProperties.scheduledDate" },
255
- { path: "cartInfo.lineItems.serviceProperties.endDate" },
256
- { path: "lineItems.image.urlExpirationDate" },
257
- {
258
- path: "lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
259
- },
260
- { path: "lineItems.serviceProperties.scheduledDate" },
261
- { path: "lineItems.serviceProperties.endDate" },
262
- {
263
- path: "customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
264
- },
265
- { path: "customLineItems.serviceProperties.scheduledDate" },
266
- { path: "customLineItems.serviceProperties.endDate" }
267
- ]
268
- },
269
- {
270
- transformFn: import_float.transformSDKFloatToRESTFloat,
271
- paths: [
272
- { path: "cartInfo.lineItems.image.focalPoint.x" },
273
- { path: "cartInfo.lineItems.image.focalPoint.y" },
274
- { path: "lineItems.image.focalPoint.x" },
275
- { path: "lineItems.image.focalPoint.y" },
276
- { path: "cartInfo.lineItems.physicalProperties.weight" },
277
- {
278
- path: "cartInfo.lineItems.catalogOverrideFields.physicalProperties.weight"
279
- },
280
- { path: "cartInfo.contactInfo.address.geocode.latitude" },
281
- { path: "cartInfo.contactInfo.address.geocode.longitude" },
282
- { path: "lineItems.physicalProperties.weight" },
283
- { path: "lineItems.catalogOverrideFields.physicalProperties.weight" },
284
- { path: "customLineItems.physicalProperties.weight" }
285
- ]
286
- }
287
- ]);
288
- const metadata = {
289
- entityFqdn: "wix.ecom.v1.cart",
290
- method: "PATCH",
291
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.UpdateCurrentCart",
292
- packageName: PACKAGE_NAME,
293
- migrationOptions: {
294
- optInTransformResponse: true
295
- },
296
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
297
- protoPath: "/v1/carts/current",
298
- data: serializedData,
299
- host
300
- }),
301
- data: serializedData,
302
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
303
- {
304
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
305
- paths: [
306
- { path: "cart.createdDate" },
307
- { path: "cart.updatedDate" },
308
- { path: "cart.lineItems.image.urlExpirationDate" },
309
- {
310
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
311
- },
312
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
313
- { path: "cart.lineItems.serviceProperties.endDate" }
314
- ]
315
- },
316
- {
317
- transformFn: import_float2.transformRESTFloatToSDKFloat,
318
- paths: [
319
- { path: "cart.lineItems.image.focalPoint.x" },
320
- { path: "cart.lineItems.image.focalPoint.y" },
321
- { path: "cart.lineItems.physicalProperties.weight" },
322
- {
323
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
324
- },
325
- { path: "cart.contactInfo.address.geocode.latitude" },
326
- { path: "cart.contactInfo.address.geocode.longitude" }
327
- ]
328
- }
329
- ])
330
- };
331
- return metadata;
332
- }
333
- return __updateCurrentCart;
334
- }
335
- function addToCurrentCart(payload) {
336
- function __addToCurrentCart({ host }) {
337
- const serializedData = (0, import_transform_paths.transformPaths)(payload, [
338
- {
339
- transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
340
- paths: [
341
- { path: "lineItems.image.urlExpirationDate" },
342
- {
343
- path: "lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
344
- },
345
- { path: "lineItems.serviceProperties.scheduledDate" },
346
- { path: "lineItems.serviceProperties.endDate" },
347
- {
348
- path: "customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
349
- },
350
- { path: "customLineItems.serviceProperties.scheduledDate" },
351
- { path: "customLineItems.serviceProperties.endDate" }
352
- ]
353
- },
354
- {
355
- transformFn: import_float.transformSDKFloatToRESTFloat,
356
- paths: [
357
- { path: "lineItems.image.focalPoint.x" },
358
- { path: "lineItems.image.focalPoint.y" },
359
- { path: "lineItems.physicalProperties.weight" },
360
- { path: "lineItems.catalogOverrideFields.physicalProperties.weight" },
361
- { path: "customLineItems.physicalProperties.weight" }
362
- ]
363
- }
364
- ]);
365
- const metadata = {
366
- entityFqdn: "wix.ecom.v1.cart",
367
- method: "POST",
368
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.AddToCurrentCart",
369
- packageName: PACKAGE_NAME,
370
- migrationOptions: {
371
- optInTransformResponse: true
372
- },
373
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
374
- protoPath: "/v1/carts/current/add-to-cart",
375
- data: serializedData,
376
- host
377
- }),
378
- data: serializedData,
379
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
380
- {
381
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
382
- paths: [
383
- { path: "cart.createdDate" },
384
- { path: "cart.updatedDate" },
385
- { path: "cart.lineItems.image.urlExpirationDate" },
386
- {
387
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
388
- },
389
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
390
- { path: "cart.lineItems.serviceProperties.endDate" }
391
- ]
392
- },
393
- {
394
- transformFn: import_float2.transformRESTFloatToSDKFloat,
395
- paths: [
396
- { path: "cart.lineItems.image.focalPoint.x" },
397
- { path: "cart.lineItems.image.focalPoint.y" },
398
- { path: "cart.lineItems.physicalProperties.weight" },
399
- {
400
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
401
- },
402
- { path: "cart.contactInfo.address.geocode.latitude" },
403
- { path: "cart.contactInfo.address.geocode.longitude" }
404
- ]
405
- }
406
- ])
407
- };
408
- return metadata;
409
- }
410
- return __addToCurrentCart;
411
- }
412
- function removeLineItemsFromCurrentCart(payload) {
413
- function __removeLineItemsFromCurrentCart({ host }) {
414
- const metadata = {
415
- entityFqdn: "wix.ecom.v1.cart",
416
- method: "POST",
417
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.RemoveLineItemsFromCurrentCart",
418
- packageName: PACKAGE_NAME,
419
- migrationOptions: {
420
- optInTransformResponse: true
421
- },
422
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
423
- protoPath: "/v1/carts/current/remove-line-items",
424
- data: payload,
425
- host
426
- }),
427
- data: payload,
428
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
429
- {
430
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
431
- paths: [
432
- { path: "cart.createdDate" },
433
- { path: "cart.updatedDate" },
434
- { path: "cart.lineItems.image.urlExpirationDate" },
435
- {
436
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
437
- },
438
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
439
- { path: "cart.lineItems.serviceProperties.endDate" }
440
- ]
441
- },
442
- {
443
- transformFn: import_float2.transformRESTFloatToSDKFloat,
444
- paths: [
445
- { path: "cart.lineItems.image.focalPoint.x" },
446
- { path: "cart.lineItems.image.focalPoint.y" },
447
- { path: "cart.lineItems.physicalProperties.weight" },
448
- {
449
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
450
- },
451
- { path: "cart.contactInfo.address.geocode.latitude" },
452
- { path: "cart.contactInfo.address.geocode.longitude" }
453
- ]
454
- }
455
- ])
456
- };
457
- return metadata;
458
- }
459
- return __removeLineItemsFromCurrentCart;
460
- }
461
- function createCheckoutFromCurrentCart(payload) {
462
- function __createCheckoutFromCurrentCart({ host }) {
463
- const serializedData = (0, import_transform_paths.transformPaths)(payload, [
464
- {
465
- transformFn: import_float.transformSDKFloatToRESTFloat,
466
- paths: [
467
- { path: "shippingAddress.geocode.latitude" },
468
- { path: "shippingAddress.geocode.longitude" },
469
- { path: "billingAddress.geocode.latitude" },
470
- { path: "billingAddress.geocode.longitude" }
471
- ]
472
- }
473
- ]);
474
- const metadata = {
475
- entityFqdn: "wix.ecom.v1.cart",
476
- method: "POST",
477
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.CreateCheckoutFromCurrentCart",
478
- packageName: PACKAGE_NAME,
479
- migrationOptions: {
480
- optInTransformResponse: true
481
- },
482
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
483
- protoPath: "/v1/carts/current/create-checkout",
484
- data: serializedData,
485
- host
486
- }),
487
- data: serializedData
488
- };
489
- return metadata;
490
- }
491
- return __createCheckoutFromCurrentCart;
492
- }
493
- function removeCouponFromCurrentCart(payload) {
494
- function __removeCouponFromCurrentCart({ host }) {
495
- const metadata = {
496
- entityFqdn: "wix.ecom.v1.cart",
497
- method: "POST",
498
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.RemoveCouponFromCurrentCart",
499
- packageName: PACKAGE_NAME,
500
- migrationOptions: {
501
- optInTransformResponse: true
502
- },
503
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
504
- protoPath: "/v1/carts/current/remove-coupon",
505
- data: payload,
506
- host
507
- }),
508
- data: payload,
509
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
510
- {
511
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
512
- paths: [
513
- { path: "cart.createdDate" },
514
- { path: "cart.updatedDate" },
515
- { path: "cart.lineItems.image.urlExpirationDate" },
516
- {
517
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
518
- },
519
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
520
- { path: "cart.lineItems.serviceProperties.endDate" }
521
- ]
522
- },
523
- {
524
- transformFn: import_float2.transformRESTFloatToSDKFloat,
525
- paths: [
526
- { path: "cart.lineItems.image.focalPoint.x" },
527
- { path: "cart.lineItems.image.focalPoint.y" },
528
- { path: "cart.lineItems.physicalProperties.weight" },
529
- {
530
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
531
- },
532
- { path: "cart.contactInfo.address.geocode.latitude" },
533
- { path: "cart.contactInfo.address.geocode.longitude" }
534
- ]
535
- }
536
- ])
537
- };
538
- return metadata;
539
- }
540
- return __removeCouponFromCurrentCart;
541
- }
542
- function updateCurrentCartLineItemQuantity(payload) {
543
- function __updateCurrentCartLineItemQuantity({ host }) {
544
- const metadata = {
545
- entityFqdn: "wix.ecom.v1.cart",
546
- method: "POST",
547
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.UpdateCurrentCartLineItemQuantity",
548
- packageName: PACKAGE_NAME,
549
- migrationOptions: {
550
- optInTransformResponse: true
551
- },
552
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
553
- protoPath: "/v1/carts/current/update-line-items-quantity",
554
- data: payload,
555
- host
556
- }),
557
- data: payload,
558
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
559
- {
560
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
561
- paths: [
562
- { path: "cart.createdDate" },
563
- { path: "cart.updatedDate" },
564
- { path: "cart.lineItems.image.urlExpirationDate" },
565
- {
566
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
567
- },
568
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
569
- { path: "cart.lineItems.serviceProperties.endDate" }
570
- ]
571
- },
572
- {
573
- transformFn: import_float2.transformRESTFloatToSDKFloat,
574
- paths: [
575
- { path: "cart.lineItems.image.focalPoint.x" },
576
- { path: "cart.lineItems.image.focalPoint.y" },
577
- { path: "cart.lineItems.physicalProperties.weight" },
578
- {
579
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
580
- },
581
- { path: "cart.contactInfo.address.geocode.latitude" },
582
- { path: "cart.contactInfo.address.geocode.longitude" }
583
- ]
584
- }
585
- ])
586
- };
587
- return metadata;
588
- }
589
- return __updateCurrentCartLineItemQuantity;
590
- }
591
- function estimateCurrentCartTotals(payload) {
592
- function __estimateCurrentCartTotals({ host }) {
593
- const serializedData = (0, import_transform_paths.transformPaths)(payload, [
594
- {
595
- transformFn: import_float.transformSDKFloatToRESTFloat,
596
- paths: [
597
- { path: "shippingAddress.geocode.latitude" },
598
- { path: "shippingAddress.geocode.longitude" },
599
- { path: "billingAddress.geocode.latitude" },
600
- { path: "billingAddress.geocode.longitude" }
601
- ]
602
- }
603
- ]);
604
- const metadata = {
605
- entityFqdn: "wix.ecom.v1.cart",
606
- method: "POST",
607
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.EstimateCurrentCartTotals",
608
- packageName: PACKAGE_NAME,
609
- migrationOptions: {
610
- optInTransformResponse: true
611
- },
612
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
613
- protoPath: "/v1/carts/current/estimate-totals",
614
- data: serializedData,
615
- host
616
- }),
617
- data: serializedData,
618
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
619
- {
620
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
621
- paths: [
622
- { path: "cart.createdDate" },
623
- { path: "cart.updatedDate" },
624
- { path: "cart.lineItems.image.urlExpirationDate" },
625
- {
626
- path: "cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate"
627
- },
628
- { path: "cart.lineItems.serviceProperties.scheduledDate" },
629
- { path: "cart.lineItems.serviceProperties.endDate" },
630
- {
631
- path: "shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from"
632
- },
633
- {
634
- path: "shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to"
635
- },
636
- {
637
- path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from"
638
- },
639
- {
640
- path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to"
641
- },
642
- { path: "membershipOptions.eligibleMemberships.expirationDate" },
643
- {
644
- path: "membershipOptions.invalidMemberships.membership.expirationDate"
645
- },
646
- {
647
- path: "membershipOptions.validatedExistingMemberships.memberships.membership.expirationDate"
648
- }
649
- ]
650
- },
651
- {
652
- transformFn: import_float2.transformRESTFloatToSDKFloat,
653
- paths: [
654
- { path: "cart.lineItems.image.focalPoint.x" },
655
- { path: "cart.lineItems.image.focalPoint.y" },
656
- { path: "cart.lineItems.physicalProperties.weight" },
657
- {
658
- path: "cart.lineItems.catalogOverrideFields.physicalProperties.weight"
659
- },
660
- { path: "cart.contactInfo.address.geocode.latitude" },
661
- { path: "cart.contactInfo.address.geocode.longitude" },
662
- {
663
- path: "shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude"
664
- },
665
- {
666
- path: "shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude"
667
- },
668
- {
669
- path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude"
670
- },
671
- {
672
- path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude"
673
- },
674
- { path: "appliedDiscounts.merchantDiscount.percentage" }
675
- ]
676
- }
677
- ])
678
- };
679
- return metadata;
680
- }
681
- return __estimateCurrentCartTotals;
682
- }
683
- function deleteCurrentCart(payload) {
684
- function __deleteCurrentCart({ host }) {
685
- const metadata = {
686
- entityFqdn: "wix.ecom.v1.cart",
687
- method: "DELETE",
688
- methodFqn: "com.wix.ecom.cart.api.v1.CurrentCartService.DeleteCurrentCart",
689
- packageName: PACKAGE_NAME,
690
- migrationOptions: {
691
- optInTransformResponse: true
692
- },
693
- url: resolveComWixEcomCartApiV1CurrentCartServiceUrl({
694
- protoPath: "/v1/carts/current",
695
- data: payload,
696
- host
697
- }),
698
- params: (0, import_rest_modules.toURLSearchParams)(payload)
699
- };
700
- return metadata;
701
- }
702
- return __deleteCurrentCart;
703
- }
704
-
705
- // src/ecom-v1-cart-current-cart.universal.ts
706
- var import_address = require("@wix/sdk-runtime/transformations/address");
707
- var import_address2 = require("@wix/sdk-runtime/transformations/address");
708
- var import_image = require("@wix/sdk-runtime/transformations/image");
709
- var import_image2 = require("@wix/sdk-runtime/transformations/image");
710
- var import_page_url_v2 = require("@wix/sdk-runtime/transformations/page-url-v2");
711
- var import_page_url_v22 = require("@wix/sdk-runtime/transformations/page-url-v2");
712
- var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
713
- var DescriptionLineType = /* @__PURE__ */ ((DescriptionLineType2) => {
714
- DescriptionLineType2["UNRECOGNISED"] = "UNRECOGNISED";
715
- DescriptionLineType2["PLAIN_TEXT"] = "PLAIN_TEXT";
716
- DescriptionLineType2["COLOR"] = "COLOR";
717
- return DescriptionLineType2;
718
- })(DescriptionLineType || {});
719
- var ItemAvailabilityStatus = /* @__PURE__ */ ((ItemAvailabilityStatus2) => {
720
- ItemAvailabilityStatus2["AVAILABLE"] = "AVAILABLE";
721
- ItemAvailabilityStatus2["NOT_FOUND"] = "NOT_FOUND";
722
- ItemAvailabilityStatus2["NOT_AVAILABLE"] = "NOT_AVAILABLE";
723
- ItemAvailabilityStatus2["PARTIALLY_AVAILABLE"] = "PARTIALLY_AVAILABLE";
724
- return ItemAvailabilityStatus2;
725
- })(ItemAvailabilityStatus || {});
726
- var DimensionsUnit = /* @__PURE__ */ ((DimensionsUnit2) => {
727
- DimensionsUnit2["UNKNOWN_DIMENSIONS_UNIT"] = "UNKNOWN_DIMENSIONS_UNIT";
728
- DimensionsUnit2["MM"] = "MM";
729
- DimensionsUnit2["CM"] = "CM";
730
- DimensionsUnit2["M"] = "M";
731
- DimensionsUnit2["IN"] = "IN";
732
- DimensionsUnit2["FT"] = "FT";
733
- DimensionsUnit2["YD"] = "YD";
734
- return DimensionsUnit2;
735
- })(DimensionsUnit || {});
736
- var ItemTypePreset = /* @__PURE__ */ ((ItemTypePreset2) => {
737
- ItemTypePreset2["UNRECOGNISED"] = "UNRECOGNISED";
738
- ItemTypePreset2["PHYSICAL"] = "PHYSICAL";
739
- ItemTypePreset2["DIGITAL"] = "DIGITAL";
740
- ItemTypePreset2["GIFT_CARD"] = "GIFT_CARD";
741
- ItemTypePreset2["SERVICE"] = "SERVICE";
742
- return ItemTypePreset2;
743
- })(ItemTypePreset || {});
744
- var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
745
- SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
746
- SubscriptionFrequency2["DAY"] = "DAY";
747
- SubscriptionFrequency2["WEEK"] = "WEEK";
748
- SubscriptionFrequency2["MONTH"] = "MONTH";
749
- SubscriptionFrequency2["YEAR"] = "YEAR";
750
- return SubscriptionFrequency2;
751
- })(SubscriptionFrequency || {});
752
- var ProductPeriodAlignment = /* @__PURE__ */ ((ProductPeriodAlignment2) => {
753
- ProductPeriodAlignment2["ALIGNED_WITH_BILLING_PERIOD"] = "ALIGNED_WITH_BILLING_PERIOD";
754
- ProductPeriodAlignment2["NOT_ALIGNED_WITH_BILLING_PERIOD"] = "NOT_ALIGNED_WITH_BILLING_PERIOD";
755
- return ProductPeriodAlignment2;
756
- })(ProductPeriodAlignment || {});
757
- var FileType = /* @__PURE__ */ ((FileType2) => {
758
- FileType2["UNSPECIFIED"] = "UNSPECIFIED";
759
- FileType2["SECURE_PICTURE"] = "SECURE_PICTURE";
760
- FileType2["SECURE_VIDEO"] = "SECURE_VIDEO";
761
- FileType2["SECURE_DOCUMENT"] = "SECURE_DOCUMENT";
762
- FileType2["SECURE_MUSIC"] = "SECURE_MUSIC";
763
- FileType2["SECURE_ARCHIVE"] = "SECURE_ARCHIVE";
764
- FileType2["SECURE_RAW"] = "SECURE_RAW";
765
- return FileType2;
766
- })(FileType || {});
767
- var PaymentOptionType = /* @__PURE__ */ ((PaymentOptionType2) => {
768
- PaymentOptionType2["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
769
- PaymentOptionType2["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
770
- PaymentOptionType2["MEMBERSHIP"] = "MEMBERSHIP";
771
- PaymentOptionType2["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
772
- PaymentOptionType2["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
773
- PaymentOptionType2["MEMBERSHIP_ONLINE_WITH_OFFLINE_REMAINDER"] = "MEMBERSHIP_ONLINE_WITH_OFFLINE_REMAINDER";
774
- return PaymentOptionType2;
775
- })(PaymentOptionType || {});
776
- var TaxableAddressType = /* @__PURE__ */ ((TaxableAddressType2) => {
777
- TaxableAddressType2["BUSINESS"] = "BUSINESS";
778
- TaxableAddressType2["BILLING"] = "BILLING";
779
- TaxableAddressType2["SHIPPING"] = "SHIPPING";
780
- return TaxableAddressType2;
781
- })(TaxableAddressType || {});
782
- var PlatformFeeChargeType = /* @__PURE__ */ ((PlatformFeeChargeType2) => {
783
- PlatformFeeChargeType2["PASS_ON"] = "PASS_ON";
784
- PlatformFeeChargeType2["ABSORBED"] = "ABSORBED";
785
- return PlatformFeeChargeType2;
786
- })(PlatformFeeChargeType || {});
787
- var WeightUnit = /* @__PURE__ */ ((WeightUnit2) => {
788
- WeightUnit2["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
789
- WeightUnit2["KG"] = "KG";
790
- WeightUnit2["LB"] = "LB";
791
- return WeightUnit2;
792
- })(WeightUnit || {});
793
- var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
794
- DiscountType2["GLOBAL"] = "GLOBAL";
795
- DiscountType2["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
796
- DiscountType2["SHIPPING"] = "SHIPPING";
797
- return DiscountType2;
798
- })(DiscountType || {});
799
- var VatType = /* @__PURE__ */ ((VatType2) => {
800
- VatType2["UNSPECIFIED"] = "UNSPECIFIED";
801
- VatType2["CPF"] = "CPF";
802
- VatType2["CNPJ"] = "CNPJ";
803
- return VatType2;
804
- })(VatType || {});
805
- var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
806
- JurisdictionType2["UNDEFINED"] = "UNDEFINED";
807
- JurisdictionType2["COUNTRY"] = "COUNTRY";
808
- JurisdictionType2["STATE"] = "STATE";
809
- JurisdictionType2["COUNTY"] = "COUNTY";
810
- JurisdictionType2["CITY"] = "CITY";
811
- JurisdictionType2["SPECIAL"] = "SPECIAL";
812
- return JurisdictionType2;
813
- })(JurisdictionType || {});
814
- var RateType = /* @__PURE__ */ ((RateType2) => {
815
- RateType2["NO_TAX_COLLECTED"] = "NO_TAX_COLLECTED";
816
- RateType2["MANUAL_RATE"] = "MANUAL_RATE";
817
- RateType2["AUTO_RATE"] = "AUTO_RATE";
818
- RateType2["FALLBACK_RATE"] = "FALLBACK_RATE";
819
- return RateType2;
820
- })(RateType || {});
821
- var ManualCalculationReason = /* @__PURE__ */ ((ManualCalculationReason2) => {
822
- ManualCalculationReason2["GLOBAL_SETTING_TO_MANUAL"] = "GLOBAL_SETTING_TO_MANUAL";
823
- ManualCalculationReason2["REGION_SETTING_TO_MANUAL"] = "REGION_SETTING_TO_MANUAL";
824
- return ManualCalculationReason2;
825
- })(ManualCalculationReason || {});
826
- var FallbackReason = /* @__PURE__ */ ((FallbackReason2) => {
827
- FallbackReason2["AUTO_TAX_FAILED"] = "AUTO_TAX_FAILED";
828
- FallbackReason2["AUTO_TAX_DEACTIVATED"] = "AUTO_TAX_DEACTIVATED";
829
- return FallbackReason2;
830
- })(FallbackReason || {});
831
- var PickupMethod = /* @__PURE__ */ ((PickupMethod2) => {
832
- PickupMethod2["STORE_PICKUP"] = "STORE_PICKUP";
833
- PickupMethod2["PICKUP_POINT"] = "PICKUP_POINT";
834
- return PickupMethod2;
835
- })(PickupMethod || {});
836
- var ChargeType = /* @__PURE__ */ ((ChargeType2) => {
837
- ChargeType2["HANDLING_FEE"] = "HANDLING_FEE";
838
- ChargeType2["INSURANCE"] = "INSURANCE";
839
- return ChargeType2;
840
- })(ChargeType || {});
841
- var AppliedDiscountDiscountType = /* @__PURE__ */ ((AppliedDiscountDiscountType2) => {
842
- AppliedDiscountDiscountType2["GLOBAL"] = "GLOBAL";
843
- AppliedDiscountDiscountType2["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
844
- AppliedDiscountDiscountType2["SHIPPING"] = "SHIPPING";
845
- return AppliedDiscountDiscountType2;
846
- })(AppliedDiscountDiscountType || {});
847
- var RuleType = /* @__PURE__ */ ((RuleType2) => {
848
- RuleType2["VALIDATION"] = "VALIDATION";
849
- RuleType2["OTHER"] = "OTHER";
850
- RuleType2["MAX"] = "MAX";
851
- RuleType2["MIN"] = "MIN";
852
- RuleType2["MAX_LENGTH"] = "MAX_LENGTH";
853
- RuleType2["MIN_LENGTH"] = "MIN_LENGTH";
854
- RuleType2["MAX_SIZE"] = "MAX_SIZE";
855
- RuleType2["MIN_SIZE"] = "MIN_SIZE";
856
- RuleType2["FORMAT"] = "FORMAT";
857
- RuleType2["DECIMAL_LTE"] = "DECIMAL_LTE";
858
- RuleType2["DECIMAL_GTE"] = "DECIMAL_GTE";
859
- RuleType2["DECIMAL_LT"] = "DECIMAL_LT";
860
- RuleType2["DECIMAL_GT"] = "DECIMAL_GT";
861
- RuleType2["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
862
- RuleType2["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
863
- RuleType2["REQUIRED_FIELD"] = "REQUIRED_FIELD";
864
- RuleType2["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
865
- RuleType2["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
866
- RuleType2["EXACT_LENGTH"] = "EXACT_LENGTH";
867
- RuleType2["EXACT_SIZE"] = "EXACT_SIZE";
868
- RuleType2["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
869
- return RuleType2;
870
- })(RuleType || {});
871
- var BalanceType = /* @__PURE__ */ ((BalanceType2) => {
872
- BalanceType2["PUNCH_CARD"] = "PUNCH_CARD";
873
- BalanceType2["CREDIT"] = "CREDIT";
874
- return BalanceType2;
875
- })(BalanceType || {});
876
- var QuotaType = /* @__PURE__ */ ((QuotaType2) => {
877
- QuotaType2["LIMITED"] = "LIMITED";
878
- QuotaType2["UNLIMITED"] = "UNLIMITED";
879
- return QuotaType2;
880
- })(QuotaType || {});
881
- var LimitedQuotaType = /* @__PURE__ */ ((LimitedQuotaType2) => {
882
- LimitedQuotaType2["PUNCH_CARD"] = "PUNCH_CARD";
883
- LimitedQuotaType2["CREDIT"] = "CREDIT";
884
- return LimitedQuotaType2;
885
- })(LimitedQuotaType || {});
886
- var AdditionalFeeSource = /* @__PURE__ */ ((AdditionalFeeSource2) => {
887
- AdditionalFeeSource2["UNKNOWN_ADDITIONAL_FEE_SOURCE"] = "UNKNOWN_ADDITIONAL_FEE_SOURCE";
888
- AdditionalFeeSource2["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
889
- AdditionalFeeSource2["ITEM"] = "ITEM";
890
- AdditionalFeeSource2["MANUAL"] = "MANUAL";
891
- AdditionalFeeSource2["SHIPPING"] = "SHIPPING";
892
- AdditionalFeeSource2["PLATFORM"] = "PLATFORM";
893
- return AdditionalFeeSource2;
894
- })(AdditionalFeeSource || {});
895
- var Severity = /* @__PURE__ */ ((Severity2) => {
896
- Severity2["WARNING"] = "WARNING";
897
- Severity2["ERROR"] = "ERROR";
898
- return Severity2;
899
- })(Severity || {});
900
- var NameInOther = /* @__PURE__ */ ((NameInOther2) => {
901
- NameInOther2["OTHER_DEFAULT"] = "OTHER_DEFAULT";
902
- return NameInOther2;
903
- })(NameInOther || {});
904
- var NameInLineItem = /* @__PURE__ */ ((NameInLineItem2) => {
905
- NameInLineItem2["LINE_ITEM_DEFAULT"] = "LINE_ITEM_DEFAULT";
906
- return NameInLineItem2;
907
- })(NameInLineItem || {});
908
- var SuggestedFix = /* @__PURE__ */ ((SuggestedFix2) => {
909
- SuggestedFix2["UNKNOWN_SUGGESTED_FIX"] = "UNKNOWN_SUGGESTED_FIX";
910
- SuggestedFix2["REMOVE_LINE_ITEM"] = "REMOVE_LINE_ITEM";
911
- return SuggestedFix2;
912
- })(SuggestedFix || {});
913
- var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
914
- ChannelType2["UNSPECIFIED"] = "UNSPECIFIED";
915
- ChannelType2["WEB"] = "WEB";
916
- ChannelType2["POS"] = "POS";
917
- ChannelType2["EBAY"] = "EBAY";
918
- ChannelType2["AMAZON"] = "AMAZON";
919
- ChannelType2["OTHER_PLATFORM"] = "OTHER_PLATFORM";
920
- ChannelType2["WIX_APP_STORE"] = "WIX_APP_STORE";
921
- ChannelType2["WIX_INVOICES"] = "WIX_INVOICES";
922
- ChannelType2["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
923
- ChannelType2["WISH"] = "WISH";
924
- ChannelType2["CLASS_PASS"] = "CLASS_PASS";
925
- ChannelType2["GLOBAL_E"] = "GLOBAL_E";
926
- ChannelType2["FACEBOOK"] = "FACEBOOK";
927
- ChannelType2["ETSY"] = "ETSY";
928
- ChannelType2["TIKTOK"] = "TIKTOK";
929
- ChannelType2["FAIRE_COM"] = "FAIRE_COM";
930
- ChannelType2["PAYPAL_AGENTIC_CHECKOUT"] = "PAYPAL_AGENTIC_CHECKOUT";
931
- ChannelType2["STRIPE_AGENTIC_CHECKOUT"] = "STRIPE_AGENTIC_CHECKOUT";
932
- ChannelType2["WIX_INVOICES_PLATFORM"] = "WIX_INVOICES_PLATFORM";
933
- ChannelType2["UCP_AGENTIC_CHECKOUT"] = "UCP_AGENTIC_CHECKOUT";
934
- return ChannelType2;
935
- })(ChannelType || {});
936
- var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
937
- WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
938
- WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
939
- WebhookIdentityType2["MEMBER"] = "MEMBER";
940
- WebhookIdentityType2["WIX_USER"] = "WIX_USER";
941
- WebhookIdentityType2["APP"] = "APP";
942
- return WebhookIdentityType2;
943
- })(WebhookIdentityType || {});
944
- async function getCurrentCart() {
945
- const { httpClient, sideEffects } = arguments[0];
946
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
947
- const reqOpts = currentCartGetCurrentCart(payload);
948
- sideEffects?.onSiteCall?.();
949
- try {
950
- const result = await httpClient.request(reqOpts);
951
- sideEffects?.onSuccess?.(result);
952
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
953
- (0, import_transform_paths2.transformPaths)(result.data, [
954
- {
955
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
956
- paths: [{ path: "cart.lineItems.url" }]
957
- },
958
- {
959
- transformFn: import_image2.transformRESTImageToSDKImage,
960
- paths: [
961
- { path: "cart.lineItems.image" },
962
- { path: "cart.lineItems.catalogOverrideFields.image" }
963
- ]
964
- },
965
- {
966
- transformFn: import_address2.transformRESTAddressToSDKAddress,
967
- paths: [{ path: "cart.contactInfo.address" }]
968
- }
969
- ])
970
- )?.cart;
971
- } catch (err) {
972
- const transformedError = (0, import_transform_error.transformError)(
973
- err,
974
- {
975
- spreadPathsToArguments: {},
976
- explicitPathsToArguments: {},
977
- singleArgumentUnchanged: false
978
- },
979
- []
980
- );
981
- sideEffects?.onError?.(err);
982
- throw transformedError;
983
- }
984
- }
985
- async function updateCurrentCart2(options) {
986
- const { httpClient, sideEffects } = arguments[1];
987
- const payload = (0, import_transform_paths2.transformPaths)(
988
- (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
989
- cartInfo: options?.cartInfo,
990
- couponCode: options?.couponCode,
991
- lineItems: options?.lineItems,
992
- customLineItems: options?.customLineItems
993
- }),
994
- [
995
- {
996
- transformFn: import_page_url_v2.transformSDKPageURLV2ToRESTPageURLV2,
997
- paths: [
998
- { path: "cartInfo.lineItems.url" },
999
- { path: "lineItems.url" },
1000
- { path: "customLineItems.url" }
1001
- ]
1002
- },
1003
- {
1004
- transformFn: import_image.transformSDKImageToRESTImage,
1005
- paths: [
1006
- { path: "cartInfo.lineItems.image" },
1007
- { path: "cartInfo.lineItems.catalogOverrideFields.image" },
1008
- { path: "lineItems.image" },
1009
- { path: "lineItems.catalogOverrideFields.image" },
1010
- { path: "customLineItems.media" }
1011
- ]
1012
- },
1013
- {
1014
- transformFn: import_address.transformSDKAddressToRESTAddress,
1015
- paths: [{ path: "cartInfo.contactInfo.address" }]
1016
- }
1017
- ]
1018
- );
1019
- const reqOpts = updateCurrentCart(payload);
1020
- sideEffects?.onSiteCall?.();
1021
- try {
1022
- const result = await httpClient.request(reqOpts);
1023
- sideEffects?.onSuccess?.(result);
1024
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1025
- (0, import_transform_paths2.transformPaths)(result.data, [
1026
- {
1027
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
1028
- paths: [{ path: "cart.lineItems.url" }]
1029
- },
1030
- {
1031
- transformFn: import_image2.transformRESTImageToSDKImage,
1032
- paths: [
1033
- { path: "cart.lineItems.image" },
1034
- { path: "cart.lineItems.catalogOverrideFields.image" }
1035
- ]
1036
- },
1037
- {
1038
- transformFn: import_address2.transformRESTAddressToSDKAddress,
1039
- paths: [{ path: "cart.contactInfo.address" }]
1040
- }
1041
- ])
1042
- )?.cart;
1043
- } catch (err) {
1044
- const transformedError = (0, import_transform_error.transformError)(
1045
- err,
1046
- {
1047
- spreadPathsToArguments: {},
1048
- explicitPathsToArguments: {
1049
- cartInfo: "$[0].cartInfo",
1050
- couponCode: "$[0].couponCode",
1051
- lineItems: "$[0].lineItems",
1052
- customLineItems: "$[0].customLineItems"
1053
- },
1054
- singleArgumentUnchanged: false
1055
- },
1056
- ["options"]
1057
- );
1058
- sideEffects?.onError?.(err);
1059
- throw transformedError;
1060
- }
1061
- }
1062
- async function addToCurrentCart2(options) {
1063
- const { httpClient, sideEffects } = arguments[1];
1064
- const payload = (0, import_transform_paths2.transformPaths)(
1065
- (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1066
- lineItems: options?.lineItems,
1067
- customLineItems: options?.customLineItems,
1068
- businessLocationId: options?.businessLocationId
1069
- }),
1070
- [
1071
- {
1072
- transformFn: import_page_url_v2.transformSDKPageURLV2ToRESTPageURLV2,
1073
- paths: [{ path: "lineItems.url" }, { path: "customLineItems.url" }]
1074
- },
1075
- {
1076
- transformFn: import_image.transformSDKImageToRESTImage,
1077
- paths: [
1078
- { path: "lineItems.image" },
1079
- { path: "lineItems.catalogOverrideFields.image" },
1080
- { path: "customLineItems.media" }
1081
- ]
1082
- }
1083
- ]
1084
- );
1085
- const reqOpts = addToCurrentCart(payload);
1086
- sideEffects?.onSiteCall?.();
1087
- try {
1088
- const result = await httpClient.request(reqOpts);
1089
- sideEffects?.onSuccess?.(result);
1090
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1091
- (0, import_transform_paths2.transformPaths)(result.data, [
1092
- {
1093
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
1094
- paths: [{ path: "cart.lineItems.url" }]
1095
- },
1096
- {
1097
- transformFn: import_image2.transformRESTImageToSDKImage,
1098
- paths: [
1099
- { path: "cart.lineItems.image" },
1100
- { path: "cart.lineItems.catalogOverrideFields.image" }
1101
- ]
1102
- },
1103
- {
1104
- transformFn: import_address2.transformRESTAddressToSDKAddress,
1105
- paths: [{ path: "cart.contactInfo.address" }]
1106
- }
1107
- ])
1108
- );
1109
- } catch (err) {
1110
- const transformedError = (0, import_transform_error.transformError)(
1111
- err,
1112
- {
1113
- spreadPathsToArguments: {},
1114
- explicitPathsToArguments: {
1115
- lineItems: "$[0].lineItems",
1116
- customLineItems: "$[0].customLineItems",
1117
- businessLocationId: "$[0].businessLocationId"
1118
- },
1119
- singleArgumentUnchanged: false
1120
- },
1121
- ["options"]
1122
- );
1123
- sideEffects?.onError?.(err);
1124
- throw transformedError;
1125
- }
1126
- }
1127
- async function removeLineItemsFromCurrentCart2(lineItemIds) {
1128
- const { httpClient, sideEffects } = arguments[1];
1129
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1130
- lineItemIds
1131
- });
1132
- const reqOpts = removeLineItemsFromCurrentCart(payload);
1133
- sideEffects?.onSiteCall?.();
1134
- try {
1135
- const result = await httpClient.request(reqOpts);
1136
- sideEffects?.onSuccess?.(result);
1137
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1138
- (0, import_transform_paths2.transformPaths)(result.data, [
1139
- {
1140
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
1141
- paths: [{ path: "cart.lineItems.url" }]
1142
- },
1143
- {
1144
- transformFn: import_image2.transformRESTImageToSDKImage,
1145
- paths: [
1146
- { path: "cart.lineItems.image" },
1147
- { path: "cart.lineItems.catalogOverrideFields.image" }
1148
- ]
1149
- },
1150
- {
1151
- transformFn: import_address2.transformRESTAddressToSDKAddress,
1152
- paths: [{ path: "cart.contactInfo.address" }]
1153
- }
1154
- ])
1155
- );
1156
- } catch (err) {
1157
- const transformedError = (0, import_transform_error.transformError)(
1158
- err,
1159
- {
1160
- spreadPathsToArguments: {},
1161
- explicitPathsToArguments: { lineItemIds: "$[0]" },
1162
- singleArgumentUnchanged: false
1163
- },
1164
- ["lineItemIds"]
1165
- );
1166
- sideEffects?.onError?.(err);
1167
- throw transformedError;
1168
- }
1169
- }
1170
- async function createCheckoutFromCurrentCart2(options) {
1171
- const { httpClient, sideEffects } = arguments[1];
1172
- const payload = (0, import_transform_paths2.transformPaths)(
1173
- (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1174
- channelType: options?.channelType,
1175
- shippingAddress: options?.shippingAddress,
1176
- billingAddress: options?.billingAddress,
1177
- selectedShippingOption: options?.selectedShippingOption,
1178
- email: options?.email
1179
- }),
1180
- [
1181
- {
1182
- transformFn: import_address.transformSDKAddressToRESTAddress,
1183
- paths: [{ path: "shippingAddress" }, { path: "billingAddress" }]
1184
- }
1185
- ]
1186
- );
1187
- const reqOpts = createCheckoutFromCurrentCart(payload);
1188
- sideEffects?.onSiteCall?.();
1189
- try {
1190
- const result = await httpClient.request(reqOpts);
1191
- sideEffects?.onSuccess?.(result);
1192
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1193
- } catch (err) {
1194
- const transformedError = (0, import_transform_error.transformError)(
1195
- err,
1196
- {
1197
- spreadPathsToArguments: {},
1198
- explicitPathsToArguments: {
1199
- channelType: "$[0].channelType",
1200
- shippingAddress: "$[0].shippingAddress",
1201
- billingAddress: "$[0].billingAddress",
1202
- selectedShippingOption: "$[0].selectedShippingOption",
1203
- email: "$[0].email"
1204
- },
1205
- singleArgumentUnchanged: false
1206
- },
1207
- ["options"]
1208
- );
1209
- sideEffects?.onError?.(err);
1210
- throw transformedError;
1211
- }
1212
- }
1213
- async function removeCouponFromCurrentCart2() {
1214
- const { httpClient, sideEffects } = arguments[0];
1215
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
1216
- const reqOpts = removeCouponFromCurrentCart(payload);
1217
- sideEffects?.onSiteCall?.();
1218
- try {
1219
- const result = await httpClient.request(reqOpts);
1220
- sideEffects?.onSuccess?.(result);
1221
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1222
- (0, import_transform_paths2.transformPaths)(result.data, [
1223
- {
1224
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
1225
- paths: [{ path: "cart.lineItems.url" }]
1226
- },
1227
- {
1228
- transformFn: import_image2.transformRESTImageToSDKImage,
1229
- paths: [
1230
- { path: "cart.lineItems.image" },
1231
- { path: "cart.lineItems.catalogOverrideFields.image" }
1232
- ]
1233
- },
1234
- {
1235
- transformFn: import_address2.transformRESTAddressToSDKAddress,
1236
- paths: [{ path: "cart.contactInfo.address" }]
1237
- }
1238
- ])
1239
- );
1240
- } catch (err) {
1241
- const transformedError = (0, import_transform_error.transformError)(
1242
- err,
1243
- {
1244
- spreadPathsToArguments: {},
1245
- explicitPathsToArguments: {},
1246
- singleArgumentUnchanged: false
1247
- },
1248
- []
1249
- );
1250
- sideEffects?.onError?.(err);
1251
- throw transformedError;
1252
- }
1253
- }
1254
- async function updateCurrentCartLineItemQuantity2(lineItems) {
1255
- const { httpClient, sideEffects } = arguments[1];
1256
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1257
- lineItems
1258
- });
1259
- const reqOpts = updateCurrentCartLineItemQuantity(payload);
1260
- sideEffects?.onSiteCall?.();
1261
- try {
1262
- const result = await httpClient.request(reqOpts);
1263
- sideEffects?.onSuccess?.(result);
1264
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1265
- (0, import_transform_paths2.transformPaths)(result.data, [
1266
- {
1267
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
1268
- paths: [{ path: "cart.lineItems.url" }]
1269
- },
1270
- {
1271
- transformFn: import_image2.transformRESTImageToSDKImage,
1272
- paths: [
1273
- { path: "cart.lineItems.image" },
1274
- { path: "cart.lineItems.catalogOverrideFields.image" }
1275
- ]
1276
- },
1277
- {
1278
- transformFn: import_address2.transformRESTAddressToSDKAddress,
1279
- paths: [{ path: "cart.contactInfo.address" }]
1280
- }
1281
- ])
1282
- );
1283
- } catch (err) {
1284
- const transformedError = (0, import_transform_error.transformError)(
1285
- err,
1286
- {
1287
- spreadPathsToArguments: {},
1288
- explicitPathsToArguments: { lineItems: "$[0]" },
1289
- singleArgumentUnchanged: false
1290
- },
1291
- ["lineItems"]
1292
- );
1293
- sideEffects?.onError?.(err);
1294
- throw transformedError;
1295
- }
1296
- }
1297
- async function estimateCurrentCartTotals2(options) {
1298
- const { httpClient, sideEffects } = arguments[1];
1299
- const payload = (0, import_transform_paths2.transformPaths)(
1300
- (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1301
- selectedShippingOption: options?.selectedShippingOption,
1302
- shippingAddress: options?.shippingAddress,
1303
- billingAddress: options?.billingAddress,
1304
- selectedMemberships: options?.selectedMemberships,
1305
- calculateTax: options?.calculateTax,
1306
- calculateShipping: options?.calculateShipping,
1307
- calculateAdditionalFees: options?.calculateAdditionalFees
1308
- }),
1309
- [
1310
- {
1311
- transformFn: import_address.transformSDKAddressToRESTAddress,
1312
- paths: [{ path: "shippingAddress" }, { path: "billingAddress" }]
1313
- }
1314
- ]
1315
- );
1316
- const reqOpts = estimateCurrentCartTotals(payload);
1317
- sideEffects?.onSiteCall?.();
1318
- try {
1319
- const result = await httpClient.request(reqOpts);
1320
- sideEffects?.onSuccess?.(result);
1321
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1322
- (0, import_transform_paths2.transformPaths)(result.data, [
1323
- {
1324
- transformFn: import_page_url_v22.transformRESTPageURLV2ToSDKPageURLV2,
1325
- paths: [{ path: "cart.lineItems.url" }]
1326
- },
1327
- {
1328
- transformFn: import_image2.transformRESTImageToSDKImage,
1329
- paths: [
1330
- { path: "cart.lineItems.image" },
1331
- { path: "cart.lineItems.catalogOverrideFields.image" }
1332
- ]
1333
- },
1334
- {
1335
- transformFn: import_address2.transformRESTAddressToSDKAddress,
1336
- paths: [
1337
- { path: "cart.contactInfo.address" },
1338
- {
1339
- path: "shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address"
1340
- },
1341
- {
1342
- path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address"
1343
- }
1344
- ]
1345
- }
1346
- ])
1347
- );
1348
- } catch (err) {
1349
- const transformedError = (0, import_transform_error.transformError)(
1350
- err,
1351
- {
1352
- spreadPathsToArguments: {},
1353
- explicitPathsToArguments: {
1354
- selectedShippingOption: "$[0].selectedShippingOption",
1355
- shippingAddress: "$[0].shippingAddress",
1356
- billingAddress: "$[0].billingAddress",
1357
- selectedMemberships: "$[0].selectedMemberships",
1358
- calculateTax: "$[0].calculateTax",
1359
- calculateShipping: "$[0].calculateShipping",
1360
- calculateAdditionalFees: "$[0].calculateAdditionalFees"
1361
- },
1362
- singleArgumentUnchanged: false
1363
- },
1364
- ["options"]
1365
- );
1366
- sideEffects?.onError?.(err);
1367
- throw transformedError;
1368
- }
1369
- }
1370
- async function deleteCurrentCart2() {
1371
- const { httpClient, sideEffects } = arguments[0];
1372
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
1373
- const reqOpts = deleteCurrentCart(payload);
1374
- sideEffects?.onSiteCall?.();
1375
- try {
1376
- const result = await httpClient.request(reqOpts);
1377
- sideEffects?.onSuccess?.(result);
1378
- } catch (err) {
1379
- const transformedError = (0, import_transform_error.transformError)(
1380
- err,
1381
- {
1382
- spreadPathsToArguments: {},
1383
- explicitPathsToArguments: {},
1384
- singleArgumentUnchanged: false
1385
- },
1386
- []
1387
- );
1388
- sideEffects?.onError?.(err);
1389
- throw transformedError;
1390
- }
1391
- }
1392
- // Annotate the CommonJS export names for ESM import in node:
1393
- 0 && (module.exports = {
1394
- AdditionalFeeSource,
1395
- AppliedDiscountDiscountType,
1396
- BalanceType,
1397
- ChannelType,
1398
- ChargeType,
1399
- DescriptionLineType,
1400
- DimensionsUnit,
1401
- DiscountType,
1402
- FallbackReason,
1403
- FileType,
1404
- ItemAvailabilityStatus,
1405
- ItemTypePreset,
1406
- JurisdictionType,
1407
- LimitedQuotaType,
1408
- ManualCalculationReason,
1409
- NameInLineItem,
1410
- NameInOther,
1411
- PaymentOptionType,
1412
- PickupMethod,
1413
- PlatformFeeChargeType,
1414
- ProductPeriodAlignment,
1415
- QuotaType,
1416
- RateType,
1417
- RuleType,
1418
- Severity,
1419
- SubscriptionFrequency,
1420
- SuggestedFix,
1421
- TaxableAddressType,
1422
- VatType,
1423
- WebhookIdentityType,
1424
- WeightUnit,
1425
- addToCurrentCart,
1426
- createCheckoutFromCurrentCart,
1427
- deleteCurrentCart,
1428
- estimateCurrentCartTotals,
1429
- getCurrentCart,
1430
- removeCouponFromCurrentCart,
1431
- removeLineItemsFromCurrentCart,
1432
- updateCurrentCart,
1433
- updateCurrentCartLineItemQuantity
1434
- });
1435
- //# sourceMappingURL=index.typings.js.map