@labdigital/commercetools-mock 2.21.2 → 2.22.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.
- package/dist/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/cart/actions.ts +20 -0
- package/src/repositories/helpers.ts +1 -2
- package/src/repositories/order/index.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -1925,8 +1925,6 @@ var createCustomFields = (draft, projectKey, storage) => {
|
|
|
1925
1925
|
return void 0;
|
|
1926
1926
|
if (!draft.type.typeId)
|
|
1927
1927
|
return void 0;
|
|
1928
|
-
if (!draft.fields)
|
|
1929
|
-
return void 0;
|
|
1930
1928
|
const typeResource = storage.getByResourceIdentifier(
|
|
1931
1929
|
projectKey,
|
|
1932
1930
|
draft.type
|
|
@@ -1941,7 +1939,7 @@ var createCustomFields = (draft, projectKey, storage) => {
|
|
|
1941
1939
|
typeId: draft.type.typeId,
|
|
1942
1940
|
id: typeResource.id
|
|
1943
1941
|
},
|
|
1944
|
-
fields: draft.fields
|
|
1942
|
+
fields: draft.fields ?? {}
|
|
1945
1943
|
};
|
|
1946
1944
|
};
|
|
1947
1945
|
var createPrice = (draft) => ({
|
|
@@ -2547,6 +2545,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
2547
2545
|
}
|
|
2548
2546
|
resource.totalPrice.centAmount = calculateCartTotalPrice(resource);
|
|
2549
2547
|
}
|
|
2548
|
+
setAnonymousId(_context, resource, { anonymousId }) {
|
|
2549
|
+
resource.anonymousId = anonymousId;
|
|
2550
|
+
resource.customerId = void 0;
|
|
2551
|
+
}
|
|
2550
2552
|
setBillingAddress(context, resource, { address }) {
|
|
2551
2553
|
resource.billingAddress = createAddress(
|
|
2552
2554
|
address,
|
|
@@ -2560,6 +2562,10 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
2560
2562
|
setCustomerEmail(context, resource, { email }) {
|
|
2561
2563
|
resource.customerEmail = email;
|
|
2562
2564
|
}
|
|
2565
|
+
setCustomerId(_context, resource, { customerId }) {
|
|
2566
|
+
resource.anonymousId = void 0;
|
|
2567
|
+
resource.customerId = customerId;
|
|
2568
|
+
}
|
|
2563
2569
|
setCustomField(context, resource, { name, value }) {
|
|
2564
2570
|
if (!resource.custom) {
|
|
2565
2571
|
throw new Error("Resource has no custom field");
|
|
@@ -4010,6 +4016,7 @@ var OrderRepository = class extends AbstractResourceRepository {
|
|
|
4010
4016
|
key: context.storeKey,
|
|
4011
4017
|
typeId: "store"
|
|
4012
4018
|
} : void 0,
|
|
4019
|
+
custom: cart.custom,
|
|
4013
4020
|
lastMessageSequenceNumber: 0
|
|
4014
4021
|
};
|
|
4015
4022
|
return this.saveNew(context, resource);
|