@faststore/api 2.1.66 → 2.1.68
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.
- package/dist/api.cjs.development.js +12 -4
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +12 -4
- package/dist/api.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/platforms/vtex/resolvers/validateCart.ts +13 -10
package/dist/api.esm.js
CHANGED
|
@@ -18,7 +18,7 @@ import { trace, context, SpanKind } from '@opentelemetry/api';
|
|
|
18
18
|
import { SeverityNumber } from '@opentelemetry/api-logs';
|
|
19
19
|
|
|
20
20
|
var name = "@faststore/api";
|
|
21
|
-
var version = "2.1.
|
|
21
|
+
var version = "2.1.66";
|
|
22
22
|
var license = "MIT";
|
|
23
23
|
var main = "dist/index.js";
|
|
24
24
|
var typings = "dist/index.d.ts";
|
|
@@ -1372,14 +1372,20 @@ async function getOrderNumberFromSession(headers = {}, commerce) {
|
|
|
1372
1372
|
return;
|
|
1373
1373
|
}
|
|
1374
1374
|
// Returns the regionalized orderForm
|
|
1375
|
-
const getOrderForm = async (id,
|
|
1375
|
+
const getOrderForm = async (id, {
|
|
1376
1376
|
clients: {
|
|
1377
1377
|
commerce
|
|
1378
1378
|
}
|
|
1379
1379
|
}) => {
|
|
1380
|
-
|
|
1380
|
+
return commerce.checkout.orderForm({
|
|
1381
1381
|
id
|
|
1382
1382
|
});
|
|
1383
|
+
};
|
|
1384
|
+
const updateOrderFormShippingData = async (orderForm, session, {
|
|
1385
|
+
clients: {
|
|
1386
|
+
commerce
|
|
1387
|
+
}
|
|
1388
|
+
}) => {
|
|
1383
1389
|
// Stores that are not yet providing the session while validating the cart
|
|
1384
1390
|
// should not be able to update the shipping data
|
|
1385
1391
|
//
|
|
@@ -1462,7 +1468,7 @@ const validateCart = async (_, {
|
|
|
1462
1468
|
const orderNumberFromSession = await getOrderNumberFromSession(headers, commerce);
|
|
1463
1469
|
const orderNumber = (_ref = orderNumberFromSession != null ? orderNumberFromSession : orderNumberFromCart) != null ? _ref : '';
|
|
1464
1470
|
// Step1: Get OrderForm from VTEX Commerce
|
|
1465
|
-
const orderForm = await getOrderForm(orderNumber,
|
|
1471
|
+
const orderForm = await getOrderForm(orderNumber, ctx);
|
|
1466
1472
|
// Step1.1: Checks if the orderForm id has changed. There are three cases for this:
|
|
1467
1473
|
// Social Selling: the vtex_session cookie contains a new orderForm id with Social Selling data
|
|
1468
1474
|
// My Orders: the customer clicks on reordering through generating a new cart and when returning to the faststore, this information needs to be returned by vtex_session cookie.
|
|
@@ -1529,6 +1535,8 @@ const validateCart = async (_, {
|
|
|
1529
1535
|
orderItems: changes,
|
|
1530
1536
|
shouldSplitItem
|
|
1531
1537
|
})
|
|
1538
|
+
// update orderForm shippingData
|
|
1539
|
+
.then(form => updateOrderFormShippingData(form, session, ctx))
|
|
1532
1540
|
// update orderForm etag so we know last time we touched this orderForm
|
|
1533
1541
|
.then(form => setOrderFormEtag(form, commerce)).then(joinItems);
|
|
1534
1542
|
// Step5: If no changes detected before/after updating orderForm, the order is validated
|