@wix/auto_sdk_ecom_current-cart 1.0.184 → 1.0.185

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