@wix/auto_sdk_ecom_cart 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/ecom-v1-cart-cart.context.d.ts +30 -0
  11. package/build/cjs/src/ecom-v1-cart-cart.context.js +58 -0
  12. package/build/cjs/src/ecom-v1-cart-cart.context.js.map +1 -0
  13. package/build/cjs/src/ecom-v1-cart-cart.http.d.ts +92 -0
  14. package/build/cjs/src/ecom-v1-cart-cart.http.js +844 -0
  15. package/build/cjs/src/ecom-v1-cart-cart.http.js.map +1 -0
  16. package/build/cjs/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  17. package/build/cjs/src/ecom-v1-cart-cart.meta.js +256 -0
  18. package/build/cjs/src/ecom-v1-cart-cart.meta.js.map +1 -0
  19. package/build/cjs/src/ecom-v1-cart-cart.public.d.ts +152 -0
  20. package/build/cjs/src/ecom-v1-cart-cart.public.js +228 -0
  21. package/build/cjs/src/ecom-v1-cart-cart.public.js.map +1 -0
  22. package/build/cjs/src/ecom-v1-cart-cart.types.d.ts +2506 -0
  23. package/build/cjs/src/ecom-v1-cart-cart.types.js +255 -0
  24. package/build/cjs/src/ecom-v1-cart-cart.types.js.map +1 -0
  25. package/build/cjs/src/ecom-v1-cart-cart.universal.d.ts +2996 -0
  26. package/build/cjs/src/ecom-v1-cart-cart.universal.js +1169 -0
  27. package/build/cjs/src/ecom-v1-cart-cart.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/ecom-v1-cart-cart.context.d.ts +30 -0
  39. package/build/es/src/ecom-v1-cart-cart.context.js +30 -0
  40. package/build/es/src/ecom-v1-cart-cart.context.js.map +1 -0
  41. package/build/es/src/ecom-v1-cart-cart.http.d.ts +92 -0
  42. package/build/es/src/ecom-v1-cart-cart.http.js +829 -0
  43. package/build/es/src/ecom-v1-cart-cart.http.js.map +1 -0
  44. package/build/es/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  45. package/build/es/src/ecom-v1-cart-cart.meta.js +218 -0
  46. package/build/es/src/ecom-v1-cart-cart.meta.js.map +1 -0
  47. package/build/es/src/ecom-v1-cart-cart.public.d.ts +152 -0
  48. package/build/es/src/ecom-v1-cart-cart.public.js +188 -0
  49. package/build/es/src/ecom-v1-cart-cart.public.js.map +1 -0
  50. package/build/es/src/ecom-v1-cart-cart.types.d.ts +2506 -0
  51. package/build/es/src/ecom-v1-cart-cart.types.js +252 -0
  52. package/build/es/src/ecom-v1-cart-cart.types.js.map +1 -0
  53. package/build/es/src/ecom-v1-cart-cart.universal.d.ts +2996 -0
  54. package/build/es/src/ecom-v1-cart-cart.universal.js +1131 -0
  55. package/build/es/src/ecom-v1-cart-cart.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/ecom-v1-cart-cart.context.d.ts +30 -0
  66. package/build/internal/cjs/src/ecom-v1-cart-cart.context.js +58 -0
  67. package/build/internal/cjs/src/ecom-v1-cart-cart.context.js.map +1 -0
  68. package/build/internal/cjs/src/ecom-v1-cart-cart.http.d.ts +92 -0
  69. package/build/internal/cjs/src/ecom-v1-cart-cart.http.js +844 -0
  70. package/build/internal/cjs/src/ecom-v1-cart-cart.http.js.map +1 -0
  71. package/build/internal/cjs/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  72. package/build/internal/cjs/src/ecom-v1-cart-cart.meta.js +256 -0
  73. package/build/internal/cjs/src/ecom-v1-cart-cart.meta.js.map +1 -0
  74. package/build/internal/cjs/src/ecom-v1-cart-cart.public.d.ts +170 -0
  75. package/build/internal/cjs/src/ecom-v1-cart-cart.public.js +228 -0
  76. package/build/internal/cjs/src/ecom-v1-cart-cart.public.js.map +1 -0
  77. package/build/internal/cjs/src/ecom-v1-cart-cart.types.d.ts +2565 -0
  78. package/build/internal/cjs/src/ecom-v1-cart-cart.types.js +255 -0
  79. package/build/internal/cjs/src/ecom-v1-cart-cart.types.js.map +1 -0
  80. package/build/internal/cjs/src/ecom-v1-cart-cart.universal.d.ts +3261 -0
  81. package/build/internal/cjs/src/ecom-v1-cart-cart.universal.js +1169 -0
  82. package/build/internal/cjs/src/ecom-v1-cart-cart.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/ecom-v1-cart-cart.context.d.ts +30 -0
  93. package/build/internal/es/src/ecom-v1-cart-cart.context.js +30 -0
  94. package/build/internal/es/src/ecom-v1-cart-cart.context.js.map +1 -0
  95. package/build/internal/es/src/ecom-v1-cart-cart.http.d.ts +92 -0
  96. package/build/internal/es/src/ecom-v1-cart-cart.http.js +829 -0
  97. package/build/internal/es/src/ecom-v1-cart-cart.http.js.map +1 -0
  98. package/build/internal/es/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  99. package/build/internal/es/src/ecom-v1-cart-cart.meta.js +218 -0
  100. package/build/internal/es/src/ecom-v1-cart-cart.meta.js.map +1 -0
  101. package/build/internal/es/src/ecom-v1-cart-cart.public.d.ts +170 -0
  102. package/build/internal/es/src/ecom-v1-cart-cart.public.js +188 -0
  103. package/build/internal/es/src/ecom-v1-cart-cart.public.js.map +1 -0
  104. package/build/internal/es/src/ecom-v1-cart-cart.types.d.ts +2565 -0
  105. package/build/internal/es/src/ecom-v1-cart-cart.types.js +252 -0
  106. package/build/internal/es/src/ecom-v1-cart-cart.types.js.map +1 -0
  107. package/build/internal/es/src/ecom-v1-cart-cart.universal.d.ts +3261 -0
  108. package/build/internal/es/src/ecom-v1-cart-cart.universal.js +1131 -0
  109. package/build/internal/es/src/ecom-v1-cart-cart.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,844 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeBusinessLocation = exports.deleteCart = exports.estimateTotals = exports.updateLineItemsQuantity = exports.removeCoupon = exports.createCheckout = exports.removeLineItems = exports.addToCart = exports.getCartByCheckoutId = exports.getCart = exports.updateCart = exports.createCart = void 0;
4
+ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
5
+ const float_1 = require("@wix/sdk-runtime/transformations/float");
6
+ const float_2 = require("@wix/sdk-runtime/transformations/float");
7
+ const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
8
+ const timestamp_2 = require("@wix/sdk-runtime/transformations/timestamp");
9
+ const field_mask_1 = require("@wix/sdk-runtime/transformations/field-mask");
10
+ const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
11
+ const rest_modules_2 = require("@wix/sdk-runtime/rest-modules");
12
+ function resolveComWixEcomCartApiV1CartServiceUrl(opts) {
13
+ const domainToMappings = {
14
+ 'api._api_base_domain_': [
15
+ {
16
+ srcPath: '/cart',
17
+ destPath: '',
18
+ },
19
+ ],
20
+ 'www.wixapis.com': [
21
+ {
22
+ srcPath: '/ecom/v1/carts',
23
+ destPath: '/v1/carts',
24
+ },
25
+ ],
26
+ 'www.wixgateway.com': [
27
+ {
28
+ srcPath: '/ecom/v1/carts',
29
+ destPath: '/v1/carts',
30
+ },
31
+ ],
32
+ _: [
33
+ {
34
+ srcPath: '/_api/ecom-cart',
35
+ destPath: '',
36
+ },
37
+ {
38
+ srcPath: '/_api/cart',
39
+ destPath: '',
40
+ },
41
+ {
42
+ srcPath: '/ecom/v1/carts',
43
+ destPath: '/v1/carts',
44
+ },
45
+ ],
46
+ 'manage._base_domain_': [
47
+ {
48
+ srcPath: '/ecom/v1/carts',
49
+ destPath: '/v1/carts',
50
+ },
51
+ ],
52
+ 'editor._base_domain_': [
53
+ {
54
+ srcPath: '/_api/ecom-cart',
55
+ destPath: '',
56
+ },
57
+ ],
58
+ 'blocks._base_domain_': [
59
+ {
60
+ srcPath: '/_api/ecom-cart',
61
+ destPath: '',
62
+ },
63
+ ],
64
+ 'create.editorx': [
65
+ {
66
+ srcPath: '/_api/ecom-cart',
67
+ destPath: '',
68
+ },
69
+ ],
70
+ '*.dev.wix-code.com': [
71
+ {
72
+ srcPath: '/_api/ecom-cart',
73
+ destPath: '',
74
+ },
75
+ ],
76
+ 'www._base_domain_': [
77
+ {
78
+ srcPath: '/_api/ecom-cart',
79
+ destPath: '',
80
+ },
81
+ ],
82
+ 'bo._base_domain_': [
83
+ {
84
+ srcPath: '/ecom/v1/carts',
85
+ destPath: '/v1/carts',
86
+ },
87
+ ],
88
+ 'wixbo.ai': [
89
+ {
90
+ srcPath: '/ecom/v1/carts',
91
+ destPath: '/v1/carts',
92
+ },
93
+ ],
94
+ 'wix-bo.com': [
95
+ {
96
+ srcPath: '/ecom/v1/carts',
97
+ destPath: '/v1/carts',
98
+ },
99
+ ],
100
+ };
101
+ return (0, rest_modules_2.resolveUrl)(Object.assign(opts, { domainToMappings }));
102
+ }
103
+ const PACKAGE_NAME = '@wix/auto_sdk_ecom_cart';
104
+ /**
105
+ * Creates a new cart.
106
+ *
107
+ *
108
+ * The `createCart()` function returns a Promise that resolves to the new cart when it's created.
109
+ *
110
+ * > **Note:** When adding catalog items, `options.lineItems.catalogReference` is required.
111
+ */
112
+ function createCart(payload) {
113
+ function __createCart({ host }) {
114
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
115
+ {
116
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
117
+ paths: [
118
+ { path: 'cartInfo.createdDate' },
119
+ { path: 'cartInfo.updatedDate' },
120
+ { path: 'cartInfo.lineItems.image.urlExpirationDate' },
121
+ {
122
+ path: 'cartInfo.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
123
+ },
124
+ { path: 'cartInfo.lineItems.serviceProperties.scheduledDate' },
125
+ { path: 'lineItems.image.urlExpirationDate' },
126
+ {
127
+ path: 'lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
128
+ },
129
+ { path: 'lineItems.serviceProperties.scheduledDate' },
130
+ {
131
+ path: 'customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
132
+ },
133
+ { path: 'customLineItems.serviceProperties.scheduledDate' },
134
+ ],
135
+ },
136
+ {
137
+ transformFn: float_1.transformSDKFloatToRESTFloat,
138
+ paths: [
139
+ { path: 'cartInfo.lineItems.image.focalPoint.x' },
140
+ { path: 'cartInfo.lineItems.image.focalPoint.y' },
141
+ { path: 'lineItems.image.focalPoint.x' },
142
+ { path: 'lineItems.image.focalPoint.y' },
143
+ { path: 'cartInfo.lineItems.physicalProperties.weight' },
144
+ {
145
+ path: 'cartInfo.lineItems.catalogOverrideFields.physicalProperties.weight',
146
+ },
147
+ { path: 'cartInfo.contactInfo.address.geocode.latitude' },
148
+ { path: 'cartInfo.contactInfo.address.geocode.longitude' },
149
+ { path: 'lineItems.physicalProperties.weight' },
150
+ { path: 'lineItems.catalogOverrideFields.physicalProperties.weight' },
151
+ { path: 'customLineItems.physicalProperties.weight' },
152
+ ],
153
+ },
154
+ ]);
155
+ const metadata = {
156
+ entityFqdn: 'wix.ecom.v1.cart',
157
+ method: 'POST',
158
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.CreateCart',
159
+ packageName: PACKAGE_NAME,
160
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
161
+ protoPath: '/v1/carts',
162
+ data: serializedData,
163
+ host,
164
+ }),
165
+ data: serializedData,
166
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
167
+ {
168
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
169
+ paths: [
170
+ { path: 'cart.createdDate' },
171
+ { path: 'cart.updatedDate' },
172
+ { path: 'cart.lineItems.image.urlExpirationDate' },
173
+ {
174
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
175
+ },
176
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
177
+ ],
178
+ },
179
+ {
180
+ transformFn: float_2.transformRESTFloatToSDKFloat,
181
+ paths: [
182
+ { path: 'cart.lineItems.image.focalPoint.x' },
183
+ { path: 'cart.lineItems.image.focalPoint.y' },
184
+ { path: 'cart.lineItems.physicalProperties.weight' },
185
+ {
186
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
187
+ },
188
+ { path: 'cart.contactInfo.address.geocode.latitude' },
189
+ { path: 'cart.contactInfo.address.geocode.longitude' },
190
+ ],
191
+ },
192
+ ]),
193
+ };
194
+ return metadata;
195
+ }
196
+ return __createCart;
197
+ }
198
+ exports.createCart = createCart;
199
+ /**
200
+ * Updates a specified cart's properties.
201
+ *
202
+ *
203
+ * The `updateCart()` function returns a Promise that resolves when the specified cart's properties are updated.
204
+ *
205
+ * > **Note:** When updating catalog items, `options.lineItems.catalogReference` is required.
206
+ */
207
+ function updateCart(payload) {
208
+ function __updateCart({ host }) {
209
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
210
+ {
211
+ transformFn: field_mask_1.transformSDKFieldMaskToRESTFieldMask,
212
+ paths: [{ path: 'cartFieldmask' }],
213
+ },
214
+ {
215
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
216
+ paths: [
217
+ { path: 'cartInfo.createdDate' },
218
+ { path: 'cartInfo.updatedDate' },
219
+ { path: 'cartInfo.lineItems.image.urlExpirationDate' },
220
+ {
221
+ path: 'cartInfo.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
222
+ },
223
+ { path: 'cartInfo.lineItems.serviceProperties.scheduledDate' },
224
+ { path: 'lineItems.image.urlExpirationDate' },
225
+ {
226
+ path: 'lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
227
+ },
228
+ { path: 'lineItems.serviceProperties.scheduledDate' },
229
+ {
230
+ path: 'customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
231
+ },
232
+ { path: 'customLineItems.serviceProperties.scheduledDate' },
233
+ ],
234
+ },
235
+ {
236
+ transformFn: float_1.transformSDKFloatToRESTFloat,
237
+ paths: [
238
+ { path: 'cartInfo.lineItems.image.focalPoint.x' },
239
+ { path: 'cartInfo.lineItems.image.focalPoint.y' },
240
+ { path: 'lineItems.image.focalPoint.x' },
241
+ { path: 'lineItems.image.focalPoint.y' },
242
+ { path: 'cartInfo.lineItems.physicalProperties.weight' },
243
+ {
244
+ path: 'cartInfo.lineItems.catalogOverrideFields.physicalProperties.weight',
245
+ },
246
+ { path: 'cartInfo.contactInfo.address.geocode.latitude' },
247
+ { path: 'cartInfo.contactInfo.address.geocode.longitude' },
248
+ { path: 'lineItems.physicalProperties.weight' },
249
+ { path: 'lineItems.catalogOverrideFields.physicalProperties.weight' },
250
+ { path: 'customLineItems.physicalProperties.weight' },
251
+ ],
252
+ },
253
+ ]);
254
+ const metadata = {
255
+ entityFqdn: 'wix.ecom.v1.cart',
256
+ method: 'PATCH',
257
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.UpdateCart',
258
+ packageName: PACKAGE_NAME,
259
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
260
+ protoPath: '/v1/carts/{cartInfo.id}',
261
+ data: serializedData,
262
+ host,
263
+ }),
264
+ data: serializedData,
265
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
266
+ {
267
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
268
+ paths: [
269
+ { path: 'cart.createdDate' },
270
+ { path: 'cart.updatedDate' },
271
+ { path: 'cart.lineItems.image.urlExpirationDate' },
272
+ {
273
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
274
+ },
275
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
276
+ ],
277
+ },
278
+ {
279
+ transformFn: float_2.transformRESTFloatToSDKFloat,
280
+ paths: [
281
+ { path: 'cart.lineItems.image.focalPoint.x' },
282
+ { path: 'cart.lineItems.image.focalPoint.y' },
283
+ { path: 'cart.lineItems.physicalProperties.weight' },
284
+ {
285
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
286
+ },
287
+ { path: 'cart.contactInfo.address.geocode.latitude' },
288
+ { path: 'cart.contactInfo.address.geocode.longitude' },
289
+ ],
290
+ },
291
+ ]),
292
+ };
293
+ return metadata;
294
+ }
295
+ return __updateCart;
296
+ }
297
+ exports.updateCart = updateCart;
298
+ /**
299
+ * Retrieves a cart.
300
+ *
301
+ *
302
+ * The `getCart()` function returns a Promise that resolves when the specified cart is retrieved.
303
+ */
304
+ function getCart(payload) {
305
+ function __getCart({ host }) {
306
+ const metadata = {
307
+ entityFqdn: 'wix.ecom.v1.cart',
308
+ method: 'GET',
309
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.GetCart',
310
+ packageName: PACKAGE_NAME,
311
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
312
+ protoPath: '/v1/carts/{id}',
313
+ data: payload,
314
+ host,
315
+ }),
316
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
317
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
318
+ {
319
+ transformFn: timestamp_2.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
+ ],
329
+ },
330
+ {
331
+ transformFn: float_2.transformRESTFloatToSDKFloat,
332
+ paths: [
333
+ { path: 'cart.lineItems.image.focalPoint.x' },
334
+ { path: 'cart.lineItems.image.focalPoint.y' },
335
+ { path: 'cart.lineItems.physicalProperties.weight' },
336
+ {
337
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
338
+ },
339
+ { path: 'cart.contactInfo.address.geocode.latitude' },
340
+ { path: 'cart.contactInfo.address.geocode.longitude' },
341
+ ],
342
+ },
343
+ ]),
344
+ };
345
+ return metadata;
346
+ }
347
+ return __getCart;
348
+ }
349
+ exports.getCart = getCart;
350
+ /** Retrieves the cart associated with a specified checkout. */
351
+ function getCartByCheckoutId(payload) {
352
+ function __getCartByCheckoutId({ host }) {
353
+ const metadata = {
354
+ entityFqdn: 'wix.ecom.v1.cart',
355
+ method: 'GET',
356
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.GetCartByCheckoutId',
357
+ packageName: PACKAGE_NAME,
358
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
359
+ protoPath: '/v1/carts/by-checkout-id/{id}',
360
+ data: payload,
361
+ host,
362
+ }),
363
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
364
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
365
+ {
366
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
367
+ paths: [
368
+ { path: 'cart.createdDate' },
369
+ { path: 'cart.updatedDate' },
370
+ { path: 'cart.lineItems.image.urlExpirationDate' },
371
+ {
372
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
373
+ },
374
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
375
+ ],
376
+ },
377
+ {
378
+ transformFn: float_2.transformRESTFloatToSDKFloat,
379
+ paths: [
380
+ { path: 'cart.lineItems.image.focalPoint.x' },
381
+ { path: 'cart.lineItems.image.focalPoint.y' },
382
+ { path: 'cart.lineItems.physicalProperties.weight' },
383
+ {
384
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
385
+ },
386
+ { path: 'cart.contactInfo.address.geocode.latitude' },
387
+ { path: 'cart.contactInfo.address.geocode.longitude' },
388
+ ],
389
+ },
390
+ ]),
391
+ };
392
+ return metadata;
393
+ }
394
+ return __getCartByCheckoutId;
395
+ }
396
+ exports.getCartByCheckoutId = getCartByCheckoutId;
397
+ /**
398
+ * Adds catalog line items to a cart.
399
+ *
400
+ *
401
+ * The `addToCart()` function returns a Promise that resolves to the updated cart when the specified items have been added.
402
+ *
403
+ * > **Note:** When adding catalog items, `options.lineItems.catalogReference` is required.
404
+ */
405
+ function addToCart(payload) {
406
+ function __addToCart({ host }) {
407
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
408
+ {
409
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
410
+ paths: [
411
+ { path: 'lineItems.image.urlExpirationDate' },
412
+ {
413
+ path: 'lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
414
+ },
415
+ { path: 'lineItems.serviceProperties.scheduledDate' },
416
+ {
417
+ path: 'customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
418
+ },
419
+ { path: 'customLineItems.serviceProperties.scheduledDate' },
420
+ ],
421
+ },
422
+ {
423
+ transformFn: float_1.transformSDKFloatToRESTFloat,
424
+ paths: [
425
+ { path: 'lineItems.image.focalPoint.x' },
426
+ { path: 'lineItems.image.focalPoint.y' },
427
+ { path: 'lineItems.physicalProperties.weight' },
428
+ { path: 'lineItems.catalogOverrideFields.physicalProperties.weight' },
429
+ { path: 'customLineItems.physicalProperties.weight' },
430
+ ],
431
+ },
432
+ ]);
433
+ const metadata = {
434
+ entityFqdn: 'wix.ecom.v1.cart',
435
+ method: 'POST',
436
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.AddToCart',
437
+ packageName: PACKAGE_NAME,
438
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
439
+ protoPath: '/v1/carts/{id}/add-to-cart',
440
+ data: serializedData,
441
+ host,
442
+ }),
443
+ data: serializedData,
444
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
445
+ {
446
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
447
+ paths: [
448
+ { path: 'cart.createdDate' },
449
+ { path: 'cart.updatedDate' },
450
+ { path: 'cart.lineItems.image.urlExpirationDate' },
451
+ {
452
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
453
+ },
454
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
455
+ ],
456
+ },
457
+ {
458
+ transformFn: float_2.transformRESTFloatToSDKFloat,
459
+ paths: [
460
+ { path: 'cart.lineItems.image.focalPoint.x' },
461
+ { path: 'cart.lineItems.image.focalPoint.y' },
462
+ { path: 'cart.lineItems.physicalProperties.weight' },
463
+ {
464
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
465
+ },
466
+ { path: 'cart.contactInfo.address.geocode.latitude' },
467
+ { path: 'cart.contactInfo.address.geocode.longitude' },
468
+ ],
469
+ },
470
+ ]),
471
+ };
472
+ return metadata;
473
+ }
474
+ return __addToCart;
475
+ }
476
+ exports.addToCart = addToCart;
477
+ /**
478
+ * Removes line items from the specified cart.
479
+ *
480
+ *
481
+ * The `removeLineItems()` function returns a Promise that resolves to the updated cart when the line items are removed from the specified cart.
482
+ */
483
+ function removeLineItems(payload) {
484
+ function __removeLineItems({ host }) {
485
+ const metadata = {
486
+ entityFqdn: 'wix.ecom.v1.cart',
487
+ method: 'POST',
488
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.RemoveLineItems',
489
+ packageName: PACKAGE_NAME,
490
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
491
+ protoPath: '/v1/carts/{id}/remove-line-items',
492
+ data: payload,
493
+ host,
494
+ }),
495
+ data: payload,
496
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
497
+ {
498
+ transformFn: timestamp_2.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
+ ],
508
+ },
509
+ {
510
+ transformFn: float_2.transformRESTFloatToSDKFloat,
511
+ paths: [
512
+ { path: 'cart.lineItems.image.focalPoint.x' },
513
+ { path: 'cart.lineItems.image.focalPoint.y' },
514
+ { path: 'cart.lineItems.physicalProperties.weight' },
515
+ {
516
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
517
+ },
518
+ { path: 'cart.contactInfo.address.geocode.latitude' },
519
+ { path: 'cart.contactInfo.address.geocode.longitude' },
520
+ ],
521
+ },
522
+ ]),
523
+ };
524
+ return metadata;
525
+ }
526
+ return __removeLineItems;
527
+ }
528
+ exports.removeLineItems = removeLineItems;
529
+ /**
530
+ * Creates a checkout from a cart.
531
+ *
532
+ *
533
+ * The `createCheckout()` function returns a Promise that resolves to the new checkout's ID when it's created.
534
+ *
535
+ * If a checkout was already created from the specified cart, that checkout will be
536
+ * updated with any new information from the cart.
537
+ *
538
+ * > **Note:** `options.channelType` is a required field.
539
+ */
540
+ function createCheckout(payload) {
541
+ function __createCheckout({ host }) {
542
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
543
+ {
544
+ transformFn: float_1.transformSDKFloatToRESTFloat,
545
+ paths: [
546
+ { path: 'shippingAddress.geocode.latitude' },
547
+ { path: 'shippingAddress.geocode.longitude' },
548
+ { path: 'billingAddress.geocode.latitude' },
549
+ { path: 'billingAddress.geocode.longitude' },
550
+ ],
551
+ },
552
+ ]);
553
+ const metadata = {
554
+ entityFqdn: 'wix.ecom.v1.cart',
555
+ method: 'POST',
556
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.CreateCheckout',
557
+ packageName: PACKAGE_NAME,
558
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
559
+ protoPath: '/v1/carts/{id}/create-checkout',
560
+ data: serializedData,
561
+ host,
562
+ }),
563
+ data: serializedData,
564
+ };
565
+ return metadata;
566
+ }
567
+ return __createCheckout;
568
+ }
569
+ exports.createCheckout = createCheckout;
570
+ /**
571
+ * Removes the coupon from a specified cart.
572
+ *
573
+ *
574
+ * The `removeCoupon()` function returns a Promise that resolves to the updated cart when the coupon is removed from the specified cart.
575
+ */
576
+ function removeCoupon(payload) {
577
+ function __removeCoupon({ host }) {
578
+ const metadata = {
579
+ entityFqdn: 'wix.ecom.v1.cart',
580
+ method: 'POST',
581
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.RemoveCoupon',
582
+ packageName: PACKAGE_NAME,
583
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
584
+ protoPath: '/v1/carts/{id}/remove-coupon',
585
+ data: payload,
586
+ host,
587
+ }),
588
+ data: payload,
589
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
590
+ {
591
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
592
+ paths: [
593
+ { path: 'cart.createdDate' },
594
+ { path: 'cart.updatedDate' },
595
+ { path: 'cart.lineItems.image.urlExpirationDate' },
596
+ {
597
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
598
+ },
599
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
600
+ ],
601
+ },
602
+ {
603
+ transformFn: float_2.transformRESTFloatToSDKFloat,
604
+ paths: [
605
+ { path: 'cart.lineItems.image.focalPoint.x' },
606
+ { path: 'cart.lineItems.image.focalPoint.y' },
607
+ { path: 'cart.lineItems.physicalProperties.weight' },
608
+ {
609
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
610
+ },
611
+ { path: 'cart.contactInfo.address.geocode.latitude' },
612
+ { path: 'cart.contactInfo.address.geocode.longitude' },
613
+ ],
614
+ },
615
+ ]),
616
+ };
617
+ return metadata;
618
+ }
619
+ return __removeCoupon;
620
+ }
621
+ exports.removeCoupon = removeCoupon;
622
+ /**
623
+ * Updates the quantity of one or more line items in a specified cart.
624
+ *
625
+ *
626
+ * The `updateLineItemsQuantity()` function returns a Promise that resolves when the quantities of the specified cart's line items are updated.
627
+ *
628
+ * This endpoint is only for updating the quantity of line items. To entirely remove a line item from the cart, use [`removeLineItems()`](#removelineitems). To add a new line item to the cart, use [`addToCart()`](#addtocart).
629
+ *
630
+ * This endpoint checks the amount of stock remaining for this line item. If the specified `quantity` is greater than the remaining stock, then the `quantity` returned in the response is the total amount of remaining stock.
631
+ */
632
+ function updateLineItemsQuantity(payload) {
633
+ function __updateLineItemsQuantity({ host }) {
634
+ const metadata = {
635
+ entityFqdn: 'wix.ecom.v1.cart',
636
+ method: 'POST',
637
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.UpdateLineItemsQuantity',
638
+ packageName: PACKAGE_NAME,
639
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
640
+ protoPath: '/v1/carts/{id}/update-line-items-quantity',
641
+ data: payload,
642
+ host,
643
+ }),
644
+ data: payload,
645
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
646
+ {
647
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
648
+ paths: [
649
+ { path: 'cart.createdDate' },
650
+ { path: 'cart.updatedDate' },
651
+ { path: 'cart.lineItems.image.urlExpirationDate' },
652
+ {
653
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
654
+ },
655
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
656
+ ],
657
+ },
658
+ {
659
+ transformFn: float_2.transformRESTFloatToSDKFloat,
660
+ paths: [
661
+ { path: 'cart.lineItems.image.focalPoint.x' },
662
+ { path: 'cart.lineItems.image.focalPoint.y' },
663
+ { path: 'cart.lineItems.physicalProperties.weight' },
664
+ {
665
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
666
+ },
667
+ { path: 'cart.contactInfo.address.geocode.latitude' },
668
+ { path: 'cart.contactInfo.address.geocode.longitude' },
669
+ ],
670
+ },
671
+ ]),
672
+ };
673
+ return metadata;
674
+ }
675
+ return __updateLineItemsQuantity;
676
+ }
677
+ exports.updateLineItemsQuantity = updateLineItemsQuantity;
678
+ /**
679
+ * Estimates the subtotal and total for current site visitor’s cart. Totals include tax and are based on the selected carrier service, shipping address, and billing information.
680
+ *
681
+ *
682
+ * The `estimateTotals()` function returns a Promise that resolves when the estimated totals are generated.
683
+ *
684
+ * > **Note:** Not passing any `options` properties will only estimate the cart items price totals.
685
+ */
686
+ function estimateTotals(payload) {
687
+ function __estimateTotals({ host }) {
688
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
689
+ {
690
+ transformFn: float_1.transformSDKFloatToRESTFloat,
691
+ paths: [
692
+ { path: 'shippingAddress.geocode.latitude' },
693
+ { path: 'shippingAddress.geocode.longitude' },
694
+ { path: 'billingAddress.geocode.latitude' },
695
+ { path: 'billingAddress.geocode.longitude' },
696
+ ],
697
+ },
698
+ ]);
699
+ const metadata = {
700
+ entityFqdn: 'wix.ecom.v1.cart',
701
+ method: 'POST',
702
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.EstimateTotals',
703
+ packageName: PACKAGE_NAME,
704
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
705
+ protoPath: '/v1/carts/{id}/estimate-totals',
706
+ data: serializedData,
707
+ host,
708
+ }),
709
+ data: serializedData,
710
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
711
+ {
712
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
713
+ paths: [
714
+ { path: 'cart.createdDate' },
715
+ { path: 'cart.updatedDate' },
716
+ { path: 'cart.lineItems.image.urlExpirationDate' },
717
+ {
718
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
719
+ },
720
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
721
+ {
722
+ path: 'shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
723
+ },
724
+ {
725
+ path: 'shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
726
+ },
727
+ {
728
+ path: 'shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
729
+ },
730
+ {
731
+ path: 'shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
732
+ },
733
+ { path: 'membershipOptions.eligibleMemberships.expirationDate' },
734
+ {
735
+ path: 'membershipOptions.invalidMemberships.membership.expirationDate',
736
+ },
737
+ ],
738
+ },
739
+ {
740
+ transformFn: float_2.transformRESTFloatToSDKFloat,
741
+ paths: [
742
+ { path: 'cart.lineItems.image.focalPoint.x' },
743
+ { path: 'cart.lineItems.image.focalPoint.y' },
744
+ { path: 'cart.lineItems.physicalProperties.weight' },
745
+ {
746
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
747
+ },
748
+ { path: 'cart.contactInfo.address.geocode.latitude' },
749
+ { path: 'cart.contactInfo.address.geocode.longitude' },
750
+ {
751
+ path: 'shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
752
+ },
753
+ {
754
+ path: 'shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
755
+ },
756
+ {
757
+ path: 'shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
758
+ },
759
+ {
760
+ path: 'shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
761
+ },
762
+ { path: 'appliedDiscounts.merchantDiscount.percentage' },
763
+ ],
764
+ },
765
+ ]),
766
+ };
767
+ return metadata;
768
+ }
769
+ return __estimateTotals;
770
+ }
771
+ exports.estimateTotals = estimateTotals;
772
+ /**
773
+ * Deletes a cart.
774
+ *
775
+ *
776
+ * The `deleteCart()` function returns a Promise that resolves when the specified cart is deleted.
777
+ */
778
+ function deleteCart(payload) {
779
+ function __deleteCart({ host }) {
780
+ const metadata = {
781
+ entityFqdn: 'wix.ecom.v1.cart',
782
+ method: 'DELETE',
783
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.DeleteCart',
784
+ packageName: PACKAGE_NAME,
785
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
786
+ protoPath: '/v1/carts/{id}',
787
+ data: payload,
788
+ host,
789
+ }),
790
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
791
+ };
792
+ return metadata;
793
+ }
794
+ return __deleteCart;
795
+ }
796
+ exports.deleteCart = deleteCart;
797
+ /** Removes the location associated with a cart. */
798
+ function removeBusinessLocation(payload) {
799
+ function __removeBusinessLocation({ host }) {
800
+ const metadata = {
801
+ entityFqdn: 'wix.ecom.v1.cart',
802
+ method: 'POST',
803
+ methodFqn: 'com.wix.ecom.cart.api.v1.CartService.RemoveBusinessLocation',
804
+ packageName: PACKAGE_NAME,
805
+ url: resolveComWixEcomCartApiV1CartServiceUrl({
806
+ protoPath: '/v1/carts/{id}/remove-business-location',
807
+ data: payload,
808
+ host,
809
+ }),
810
+ data: payload,
811
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
812
+ {
813
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
814
+ paths: [
815
+ { path: 'cart.createdDate' },
816
+ { path: 'cart.updatedDate' },
817
+ { path: 'cart.lineItems.image.urlExpirationDate' },
818
+ {
819
+ path: 'cart.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
820
+ },
821
+ { path: 'cart.lineItems.serviceProperties.scheduledDate' },
822
+ ],
823
+ },
824
+ {
825
+ transformFn: float_2.transformRESTFloatToSDKFloat,
826
+ paths: [
827
+ { path: 'cart.lineItems.image.focalPoint.x' },
828
+ { path: 'cart.lineItems.image.focalPoint.y' },
829
+ { path: 'cart.lineItems.physicalProperties.weight' },
830
+ {
831
+ path: 'cart.lineItems.catalogOverrideFields.physicalProperties.weight',
832
+ },
833
+ { path: 'cart.contactInfo.address.geocode.latitude' },
834
+ { path: 'cart.contactInfo.address.geocode.longitude' },
835
+ ],
836
+ },
837
+ ]),
838
+ };
839
+ return metadata;
840
+ }
841
+ return __removeBusinessLocation;
842
+ }
843
+ exports.removeBusinessLocation = removeBusinessLocation;
844
+ //# sourceMappingURL=ecom-v1-cart-cart.http.js.map