@scayle/storefront-core 7.67.1 → 7.69.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/CHANGELOG.md +18 -0
- package/dist/index.cjs +1 -43
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -7
- package/dist/rpc/methods/basket/basket.cjs +8 -8
- package/dist/rpc/methods/basket/basket.mjs +8 -8
- package/dist/rpc/methods/brands.cjs +4 -4
- package/dist/rpc/methods/brands.d.ts +2 -2
- package/dist/rpc/methods/brands.mjs +4 -4
- package/dist/rpc/methods/categories.cjs +9 -9
- package/dist/rpc/methods/categories.d.ts +1 -1
- package/dist/rpc/methods/categories.mjs +9 -9
- package/dist/rpc/methods/checkout/checkout.cjs +1 -1
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/rpc/methods/navigationTrees.cjs +3 -3
- package/dist/rpc/methods/navigationTrees.d.ts +3 -3
- package/dist/rpc/methods/navigationTrees.mjs +3 -3
- package/dist/rpc/methods/products.cjs +19 -19
- package/dist/rpc/methods/products.d.ts +4 -4
- package/dist/rpc/methods/products.mjs +19 -19
- package/dist/rpc/methods/promotion.cjs +6 -6
- package/dist/rpc/methods/promotion.mjs +6 -6
- package/dist/rpc/methods/search.cjs +9 -9
- package/dist/rpc/methods/search.d.ts +3 -3
- package/dist/rpc/methods/search.mjs +9 -9
- package/dist/rpc/methods/shopConfiguration.cjs +2 -2
- package/dist/rpc/methods/shopConfiguration.d.ts +1 -1
- package/dist/rpc/methods/shopConfiguration.mjs +2 -2
- package/dist/rpc/methods/variants.cjs +2 -2
- package/dist/rpc/methods/variants.d.ts +1 -1
- package/dist/rpc/methods/variants.mjs +2 -2
- package/dist/rpc/methods/wishlist.cjs +6 -6
- package/dist/rpc/methods/wishlist.mjs +6 -6
- package/dist/test/factories/index.cjs +16 -0
- package/dist/test/factories/index.d.ts +1 -0
- package/dist/test/factories/index.mjs +1 -0
- package/dist/types/api/context.d.ts +1 -1
- package/dist/utils/user.cjs +8 -8
- package/dist/utils/user.d.ts +3 -3
- package/dist/utils/user.mjs +8 -8
- package/package.json +14 -2
package/dist/utils/user.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExistingItemHandling } from "../constants/index.mjs";
|
|
2
2
|
export const mergeBaskets = async (fromBasketKey, toBasketKey, withOptions, context) => {
|
|
3
|
-
const {
|
|
4
|
-
const fromOriginBasket = await
|
|
3
|
+
const { sapiClient, campaignKey } = context;
|
|
4
|
+
const fromOriginBasket = await sapiClient.basket.get(fromBasketKey, {
|
|
5
5
|
with: withOptions,
|
|
6
6
|
campaignKey,
|
|
7
7
|
orderCustomData: withOptions.orderCustomData
|
|
@@ -23,7 +23,7 @@ export const mergeBaskets = async (fromBasketKey, toBasketKey, withOptions, cont
|
|
|
23
23
|
pricePromotionKey: withOptions.pricePromotionKey
|
|
24
24
|
}
|
|
25
25
|
}));
|
|
26
|
-
const mergedBasket = await
|
|
26
|
+
const mergedBasket = await sapiClient.basket.addOrUpdateItems(
|
|
27
27
|
toBasketKey,
|
|
28
28
|
itemsToAddOrUpdate,
|
|
29
29
|
{
|
|
@@ -37,14 +37,14 @@ export const mergeBaskets = async (fromBasketKey, toBasketKey, withOptions, cont
|
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
fromBasket.items.map(async (item) => {
|
|
40
|
-
return await
|
|
40
|
+
return await sapiClient.basket.deleteItem(fromBasketKey, item.key);
|
|
41
41
|
});
|
|
42
42
|
return mergedBasket;
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
export const mergeWishlists = async (fromWishlistKey, toWishlistKey, withOptions, context) => {
|
|
46
|
-
const {
|
|
47
|
-
const oldWishlist = await
|
|
46
|
+
const { sapiClient, campaignKey } = context;
|
|
47
|
+
const oldWishlist = await sapiClient.wishlist.get(fromWishlistKey, {
|
|
48
48
|
with: withOptions,
|
|
49
49
|
campaignKey
|
|
50
50
|
});
|
|
@@ -53,7 +53,7 @@ export const mergeWishlists = async (fromWishlistKey, toWishlistKey, withOptions
|
|
|
53
53
|
for (const item of oldWishlist.items) {
|
|
54
54
|
const { productId, variantId } = item;
|
|
55
55
|
if (productId || variantId) {
|
|
56
|
-
await
|
|
56
|
+
await sapiClient.wishlist.addItem(
|
|
57
57
|
toWishlistKey,
|
|
58
58
|
{
|
|
59
59
|
...variantId ? { variantId } : { productId }
|
|
@@ -64,7 +64,7 @@ export const mergeWishlists = async (fromWishlistKey, toWishlistKey, withOptions
|
|
|
64
64
|
...item.customData && Object.keys(item.customData).length ? { customData: item.customData } : void 0
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
|
-
|
|
67
|
+
sapiClient.wishlist.deleteItem(fromWishlistKey, item?.key);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.69.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,6 +24,18 @@
|
|
|
24
24
|
"require": "./dist/server.cjs",
|
|
25
25
|
"default": "./dist/server.cjs"
|
|
26
26
|
},
|
|
27
|
+
"./dist/test/factories": {
|
|
28
|
+
"types": "./dist/test/factories/index.d.ts",
|
|
29
|
+
"import": "./dist/test/factories/index.mjs",
|
|
30
|
+
"require": "./dist/test/factories/index.cjs",
|
|
31
|
+
"default": "./dist/test/factories/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./test/factories": {
|
|
34
|
+
"types": "./dist/test/factories/index.d.ts",
|
|
35
|
+
"import": "./dist/test/factories/index.mjs",
|
|
36
|
+
"require": "./dist/test/factories/index.cjs",
|
|
37
|
+
"default": "./dist/test/factories/index.cjs"
|
|
38
|
+
},
|
|
27
39
|
"./dist/*": {
|
|
28
40
|
"types": "./dist/*.d.ts",
|
|
29
41
|
"import": "./dist/*.mjs",
|
|
@@ -59,7 +71,7 @@
|
|
|
59
71
|
"test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit --outputFile=./junit.xml"
|
|
60
72
|
},
|
|
61
73
|
"dependencies": {
|
|
62
|
-
"@scayle/storefront-api": "17.
|
|
74
|
+
"@scayle/storefront-api": "17.11.0",
|
|
63
75
|
"crypto-js": "^4.2.0",
|
|
64
76
|
"hookable": "^5.5.3",
|
|
65
77
|
"jose": "^5.6.3",
|