@scayle/storefront-core 7.24.1 → 7.25.1
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 +12 -0
- package/dist/cache/index.cjs +0 -11
- package/dist/cache/index.d.ts +0 -1
- package/dist/cache/index.mjs +0 -1
- package/dist/cache/providers/unstorage.cjs +2 -1
- package/dist/cache/providers/unstorage.mjs +2 -1
- package/dist/constants/basket.cjs +3 -2
- package/dist/constants/cache.cjs +2 -1
- package/dist/constants/hash.cjs +3 -2
- package/dist/constants/httpStatus.cjs +5 -3
- package/dist/constants/product.cjs +3 -2
- package/dist/constants/promotion.cjs +10 -3
- package/dist/constants/promotion.d.ts +6 -0
- package/dist/constants/promotion.mjs +4 -0
- package/dist/constants/sorting.cjs +5 -3
- package/dist/constants/withParameters.cjs +13 -7
- package/dist/helpers/product.fixture.cjs +8 -4
- package/dist/index.cjs +2 -2
- package/dist/rpc/methods/basket/basket.cjs +12 -6
- package/dist/rpc/methods/brands.cjs +5 -3
- package/dist/rpc/methods/categories.cjs +7 -4
- package/dist/rpc/methods/cbd.cjs +3 -2
- package/dist/rpc/methods/checkout/order.cjs +3 -2
- package/dist/rpc/methods/checkout/shopUser.cjs +5 -3
- package/dist/rpc/methods/checkout/shopUserAddresses.cjs +3 -2
- package/dist/rpc/methods/navigationTrees.cjs +5 -3
- package/dist/rpc/methods/products.cjs +12 -6
- package/dist/rpc/methods/promotion.cjs +7 -4
- package/dist/rpc/methods/search.cjs +2 -1
- package/dist/rpc/methods/shopConfiguration.cjs +3 -2
- package/dist/rpc/methods/user.cjs +7 -4
- package/dist/rpc/methods/variants.cjs +3 -2
- package/dist/rpc/methods/wishlist.cjs +9 -5
- package/package.json +6 -6
- package/dist/cache/types.cjs +0 -10
- package/dist/cache/types.d.ts +0 -6
- package/dist/cache/types.mjs +0 -4
package/CHANGELOG.md
CHANGED
package/dist/cache/index.cjs
CHANGED
|
@@ -24,15 +24,4 @@ Object.keys(_cached).forEach(function (key) {
|
|
|
24
24
|
return _cached[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
});
|
|
28
|
-
var _types = require("./types.cjs");
|
|
29
|
-
Object.keys(_types).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _types[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
27
|
});
|
package/dist/cache/index.d.ts
CHANGED
package/dist/cache/index.mjs
CHANGED
|
@@ -33,7 +33,8 @@ class UnstorageCache {
|
|
|
33
33
|
await Promise.all(keys.map(k => this.storage.removeItem(k)));
|
|
34
34
|
}
|
|
35
35
|
async purgeAll() {
|
|
36
|
-
await this.storage.
|
|
36
|
+
const keys = await this.storage.getKeys(this.prefix);
|
|
37
|
+
await Promise.all(keys.map(k => this.storage.removeItem(k)));
|
|
37
38
|
}
|
|
38
39
|
async set(key, value, ttl, tags = []) {
|
|
39
40
|
await this.storage.setItem(this.getKey(key), value, {
|
|
@@ -27,7 +27,8 @@ export class UnstorageCache {
|
|
|
27
27
|
await Promise.all(keys.map((k) => this.storage.removeItem(k)));
|
|
28
28
|
}
|
|
29
29
|
async purgeAll() {
|
|
30
|
-
await this.storage.
|
|
30
|
+
const keys = await this.storage.getKeys(this.prefix);
|
|
31
|
+
await Promise.all(keys.map((k) => this.storage.removeItem(k)));
|
|
31
32
|
}
|
|
32
33
|
async set(key, value, ttl, tags = []) {
|
|
33
34
|
await this.storage.setItem(this.getKey(key), value, {
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ExistingItemHandling = void 0;
|
|
7
|
-
const ExistingItemHandling =
|
|
7
|
+
const ExistingItemHandling = {
|
|
8
8
|
KeepExisting: 0,
|
|
9
9
|
AddQuantityToExisting: 1,
|
|
10
10
|
ReplaceExisting: 2,
|
|
11
11
|
ReplaceExistingWithCombinedQuantity: 3
|
|
12
|
-
};
|
|
12
|
+
};
|
|
13
|
+
exports.ExistingItemHandling = ExistingItemHandling;
|
package/dist/constants/cache.cjs
CHANGED
package/dist/constants/hash.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.HttpStatusMessage = exports.HttpStatusCode = void 0;
|
|
7
|
-
const HttpStatusCode =
|
|
7
|
+
const HttpStatusCode = {
|
|
8
8
|
/**
|
|
9
9
|
* The server has received the request headers and the client should proceed to send the request body
|
|
10
10
|
* (in the case of a request for which a body needs to be sent; for example, a POST request).
|
|
@@ -318,7 +318,8 @@ const HttpStatusCode = exports.HttpStatusCode = {
|
|
|
318
318
|
*/
|
|
319
319
|
NETWORK_AUTHENTICATION_REQUIRED: 511
|
|
320
320
|
};
|
|
321
|
-
|
|
321
|
+
exports.HttpStatusCode = HttpStatusCode;
|
|
322
|
+
const HttpStatusMessage = {
|
|
322
323
|
/**
|
|
323
324
|
* The server has received the request headers and the client should proceed to send the request body
|
|
324
325
|
* (in the case of a request for which a body needs to be sent; for example, a POST request).
|
|
@@ -631,4 +632,5 @@ const HttpStatusMessage = exports.HttpStatusMessage = {
|
|
|
631
632
|
* to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
|
|
632
633
|
*/
|
|
633
634
|
NETWORK_AUTHENTICATION_REQUIRED: "NETWORK AUTHENTICATION REQUIRED"
|
|
634
|
-
};
|
|
635
|
+
};
|
|
636
|
+
exports.HttpStatusMessage = HttpStatusMessage;
|
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ProductImageType = void 0;
|
|
7
|
-
const ProductImageType =
|
|
7
|
+
const ProductImageType = {
|
|
8
8
|
MODEL: "model",
|
|
9
9
|
BUST: "bust"
|
|
10
|
-
};
|
|
10
|
+
};
|
|
11
|
+
exports.ProductImageType = ProductImageType;
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PROMOTION_PER_PAGE_DEFAULT = exports.PROMOTION_PAGE_DEFAULT = void 0;
|
|
7
|
-
const PROMOTION_PAGE_DEFAULT =
|
|
8
|
-
|
|
6
|
+
exports.PromotionEffectType = exports.PROMOTION_PER_PAGE_DEFAULT = exports.PROMOTION_PAGE_DEFAULT = void 0;
|
|
7
|
+
const PROMOTION_PAGE_DEFAULT = 1;
|
|
8
|
+
exports.PROMOTION_PAGE_DEFAULT = PROMOTION_PAGE_DEFAULT;
|
|
9
|
+
const PROMOTION_PER_PAGE_DEFAULT = 100;
|
|
10
|
+
exports.PROMOTION_PER_PAGE_DEFAULT = PROMOTION_PER_PAGE_DEFAULT;
|
|
11
|
+
const PromotionEffectType = {
|
|
12
|
+
AUTOMATIC_DISCOUNT: "automatic_discount",
|
|
13
|
+
BUY_X_GET_Y: "buy_x_get_y"
|
|
14
|
+
};
|
|
15
|
+
exports.PromotionEffectType = PromotionEffectType;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { PromotionEffect } from '../types';
|
|
1
2
|
export declare const PROMOTION_PAGE_DEFAULT = 1;
|
|
2
3
|
export declare const PROMOTION_PER_PAGE_DEFAULT = 100;
|
|
4
|
+
export declare const PromotionEffectType: {
|
|
5
|
+
readonly AUTOMATIC_DISCOUNT: "automatic_discount";
|
|
6
|
+
readonly BUY_X_GET_Y: "buy_x_get_y";
|
|
7
|
+
};
|
|
8
|
+
export type PromotionEffectType = PromotionEffect['type'];
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SortQuery = exports.SortName = void 0;
|
|
7
|
-
const SortName =
|
|
7
|
+
const SortName = {
|
|
8
8
|
TOPSELLER: "topseller",
|
|
9
9
|
DATE_NEWEST: "date_newest",
|
|
10
10
|
PRICE_DESC: "price_desc",
|
|
@@ -12,11 +12,13 @@ const SortName = exports.SortName = {
|
|
|
12
12
|
REDUCTION_DESC: "reduction_desc",
|
|
13
13
|
REDUCTION_ASC: "reduction_asc"
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
exports.SortName = SortName;
|
|
16
|
+
const SortQuery = {
|
|
16
17
|
TOPSELLER: "topseller",
|
|
17
18
|
DATE_NEWEST: "date-newest",
|
|
18
19
|
PRICE_DESC: "price-desc",
|
|
19
20
|
PRICE_ASC: "price-asc",
|
|
20
21
|
REDUCTION_DESC: "reduction-desc",
|
|
21
22
|
REDUCTION_ASC: "reduction-asc"
|
|
22
|
-
};
|
|
23
|
+
};
|
|
24
|
+
exports.SortQuery = SortQuery;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MIN_WITH_PARAMS_WISHLIST = exports.MIN_WITH_PARAMS_VARIANT = exports.MIN_WITH_PARAMS_SEARCH = exports.MIN_WITH_PARAMS_PRODUCT = exports.MIN_WITH_PARAMS_BASKET = exports.DEFAULT_WITH_LISTING = void 0;
|
|
7
|
-
const DEFAULT_WITH_LISTING =
|
|
7
|
+
const DEFAULT_WITH_LISTING = {
|
|
8
8
|
items: {
|
|
9
9
|
product: {
|
|
10
10
|
attributes: "all",
|
|
@@ -24,7 +24,8 @@ const DEFAULT_WITH_LISTING = exports.DEFAULT_WITH_LISTING = {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
exports.DEFAULT_WITH_LISTING = DEFAULT_WITH_LISTING;
|
|
28
|
+
const MIN_WITH_PARAMS_SEARCH = {
|
|
28
29
|
products: {
|
|
29
30
|
attributes: {
|
|
30
31
|
withKey: ["brand", "color", "colorDetail", "name"]
|
|
@@ -39,7 +40,8 @@ const MIN_WITH_PARAMS_SEARCH = exports.MIN_WITH_PARAMS_SEARCH = {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
exports.MIN_WITH_PARAMS_SEARCH = MIN_WITH_PARAMS_SEARCH;
|
|
44
|
+
const MIN_WITH_PARAMS_PRODUCT = {
|
|
43
45
|
attributes: {
|
|
44
46
|
withKey: ["color", "brand", "name", "material", "careSymbol"]
|
|
45
47
|
},
|
|
@@ -67,7 +69,8 @@ const MIN_WITH_PARAMS_PRODUCT = exports.MIN_WITH_PARAMS_PRODUCT = {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
|
-
|
|
72
|
+
exports.MIN_WITH_PARAMS_PRODUCT = MIN_WITH_PARAMS_PRODUCT;
|
|
73
|
+
const MIN_WITH_PARAMS_BASKET = {
|
|
71
74
|
items: {
|
|
72
75
|
product: {
|
|
73
76
|
attributes: {
|
|
@@ -96,7 +99,8 @@ const MIN_WITH_PARAMS_BASKET = exports.MIN_WITH_PARAMS_BASKET = {
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
};
|
|
99
|
-
|
|
102
|
+
exports.MIN_WITH_PARAMS_BASKET = MIN_WITH_PARAMS_BASKET;
|
|
103
|
+
const MIN_WITH_PARAMS_WISHLIST = {
|
|
100
104
|
items: {
|
|
101
105
|
product: {
|
|
102
106
|
attributes: {
|
|
@@ -125,8 +129,10 @@ const MIN_WITH_PARAMS_WISHLIST = exports.MIN_WITH_PARAMS_WISHLIST = {
|
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
131
|
};
|
|
128
|
-
|
|
132
|
+
exports.MIN_WITH_PARAMS_WISHLIST = MIN_WITH_PARAMS_WISHLIST;
|
|
133
|
+
const MIN_WITH_PARAMS_VARIANT = {
|
|
129
134
|
attributes: {
|
|
130
135
|
withKey: ["size", "shopSize", "vendorSize"]
|
|
131
136
|
}
|
|
132
|
-
};
|
|
137
|
+
};
|
|
138
|
+
exports.MIN_WITH_PARAMS_VARIANT = MIN_WITH_PARAMS_VARIANT;
|
|
@@ -7,7 +7,7 @@ exports.productFromEDT = exports.product = exports.priceFixtureWithReductions =
|
|
|
7
7
|
const BILD_HINTERGRUND_LABEL = "Bild Hintergrund";
|
|
8
8
|
const CREATED_AT = "2022-04-26T15:04:56+00:00";
|
|
9
9
|
const WOMEN_CLOTHING_CATEGORY_URL = "/women/kleidung";
|
|
10
|
-
const product =
|
|
10
|
+
const product = {
|
|
11
11
|
id: 6,
|
|
12
12
|
isActive: true,
|
|
13
13
|
isSoldOut: false,
|
|
@@ -178,7 +178,8 @@ const product = exports.product = {
|
|
|
178
178
|
categoryProperties: []
|
|
179
179
|
}]]
|
|
180
180
|
};
|
|
181
|
-
|
|
181
|
+
exports.product = product;
|
|
182
|
+
const productFromEDT = {
|
|
182
183
|
id: 5703863,
|
|
183
184
|
isActive: true,
|
|
184
185
|
isSoldOut: false,
|
|
@@ -762,5 +763,8 @@ const productFromEDT = exports.productFromEDT = {
|
|
|
762
763
|
categoryProperties: []
|
|
763
764
|
}]]
|
|
764
765
|
};
|
|
765
|
-
|
|
766
|
-
const
|
|
766
|
+
exports.productFromEDT = productFromEDT;
|
|
767
|
+
const priceFixture = product.variants[0].price;
|
|
768
|
+
exports.priceFixture = priceFixture;
|
|
769
|
+
const priceFixtureWithReductions = productFromEDT.variants[0].price;
|
|
770
|
+
exports.priceFixtureWithReductions = priceFixtureWithReductions;
|
package/dist/index.cjs
CHANGED
|
@@ -81,5 +81,5 @@ Object.keys(_types).forEach(function (key) {
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
|
-
function _getRequireWildcardCache(
|
|
85
|
-
function _interopRequireWildcard(
|
|
84
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
85
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -11,7 +11,7 @@ const BAPI_ERROR_NAME = "BAPI ERROR";
|
|
|
11
11
|
function getWithParams(params, context) {
|
|
12
12
|
return params.with ?? context.withParams?.basket ?? _constants.MIN_WITH_PARAMS_BASKET;
|
|
13
13
|
}
|
|
14
|
-
const addItemToBasket =
|
|
14
|
+
const addItemToBasket = async function addItemToBasket2({
|
|
15
15
|
variantId,
|
|
16
16
|
promotionId,
|
|
17
17
|
quantity,
|
|
@@ -61,7 +61,8 @@ const addItemToBasket = exports.addItemToBasket = async function addItemToBasket
|
|
|
61
61
|
throw new _errors.BAPIError(BAPI_ERROR_NAME, statusCode, message, "addItemToBasket:bapiClient.basket.addOrUpdateItems");
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
exports.addItemToBasket = addItemToBasket;
|
|
65
|
+
const addItemsToBasket = async function addItemsToBasket2(params, context) {
|
|
65
66
|
const {
|
|
66
67
|
campaignKey,
|
|
67
68
|
bapiClient,
|
|
@@ -103,7 +104,8 @@ const addItemsToBasket = exports.addItemsToBasket = async function addItemsToBas
|
|
|
103
104
|
throw new _errors.BAPIError(BAPI_ERROR_NAME, statusCode, message, "addItemsToBasket:bapiClient.basket.addOrUpdateItems");
|
|
104
105
|
}
|
|
105
106
|
};
|
|
106
|
-
|
|
107
|
+
exports.addItemsToBasket = addItemsToBasket;
|
|
108
|
+
const getBasket = async function getBasket2(options, context) {
|
|
107
109
|
const {
|
|
108
110
|
bapiClient,
|
|
109
111
|
campaignKey,
|
|
@@ -126,7 +128,8 @@ const getBasket = exports.getBasket = async function getBasket2(options, context
|
|
|
126
128
|
}
|
|
127
129
|
return response.basket;
|
|
128
130
|
};
|
|
129
|
-
|
|
131
|
+
exports.getBasket = getBasket;
|
|
132
|
+
const removeItemFromBasket = async function removeItemFromBasket2(options, context) {
|
|
130
133
|
const {
|
|
131
134
|
bapiClient,
|
|
132
135
|
campaignKey,
|
|
@@ -139,7 +142,8 @@ const removeItemFromBasket = exports.removeItemFromBasket = async function remov
|
|
|
139
142
|
includeItemsWithoutProductData: resolvedWith?.includeItemsWithoutProductData
|
|
140
143
|
});
|
|
141
144
|
};
|
|
142
|
-
|
|
145
|
+
exports.removeItemFromBasket = removeItemFromBasket;
|
|
146
|
+
const clearBasket = async function clearBasket2(context) {
|
|
143
147
|
const basket = await getBasket({}, context);
|
|
144
148
|
await Promise.all(basket.items.map(async item => {
|
|
145
149
|
await removeItemFromBasket({
|
|
@@ -149,7 +153,8 @@ const clearBasket = exports.clearBasket = async function clearBasket2(context) {
|
|
|
149
153
|
context.log.debug("The basket has been cleared");
|
|
150
154
|
return true;
|
|
151
155
|
};
|
|
152
|
-
|
|
156
|
+
exports.clearBasket = clearBasket;
|
|
157
|
+
const mergeBaskets = async function mergeBaskets2({
|
|
153
158
|
fromBasketKey,
|
|
154
159
|
toBasketKey,
|
|
155
160
|
with: _with
|
|
@@ -159,6 +164,7 @@ const mergeBaskets = exports.mergeBaskets = async function mergeBaskets2({
|
|
|
159
164
|
}, context);
|
|
160
165
|
return await (0, _user.mergeBaskets)(fromBasketKey, toBasketKey, resolvedWith, context);
|
|
161
166
|
};
|
|
167
|
+
exports.mergeBaskets = mergeBaskets;
|
|
162
168
|
function parseBasketError(response) {
|
|
163
169
|
if (response.type === "failure") {
|
|
164
170
|
const parsedError = {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getBrands = exports.getBrandById = void 0;
|
|
7
7
|
const MAX_PER_PAGE = 100;
|
|
8
|
-
const getBrands =
|
|
8
|
+
const getBrands = async function getBrands2({
|
|
9
9
|
pagination
|
|
10
10
|
}, {
|
|
11
11
|
bapiClient,
|
|
@@ -20,7 +20,8 @@ const getBrands = exports.getBrands = async function getBrands2({
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
exports.getBrands = getBrands;
|
|
24
|
+
const getBrandById = async function getBrandById2({
|
|
24
25
|
brandId
|
|
25
26
|
}, {
|
|
26
27
|
bapiClient,
|
|
@@ -29,4 +30,5 @@ const getBrandById = exports.getBrandById = async function getBrandById2({
|
|
|
29
30
|
return await cached(bapiClient.brands.getById, {
|
|
30
31
|
cacheKeyPrefix: `getBrandById-${brandId}`
|
|
31
32
|
})(brandId);
|
|
32
|
-
};
|
|
33
|
+
};
|
|
34
|
+
exports.getBrandById = getBrandById;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getRootCategories = exports.getCategoryById = exports.getCategoriesByPath = void 0;
|
|
7
7
|
var _helpers = require("../../helpers/index.cjs");
|
|
8
|
-
const getRootCategories =
|
|
8
|
+
const getRootCategories = async function getRootCategories2({
|
|
9
9
|
children = 1,
|
|
10
10
|
includeHidden
|
|
11
11
|
}, {
|
|
@@ -25,7 +25,8 @@ const getRootCategories = exports.getRootCategories = async function getRootCate
|
|
|
25
25
|
activeNode: void 0
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
exports.getRootCategories = getRootCategories;
|
|
29
|
+
const getCategoriesByPath = async function getCategoriesByPath2({
|
|
29
30
|
path,
|
|
30
31
|
children = 1,
|
|
31
32
|
includeHidden
|
|
@@ -78,7 +79,8 @@ const getCategoriesByPath = exports.getCategoriesByPath = async function getCate
|
|
|
78
79
|
activeNode: result
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
|
-
|
|
82
|
+
exports.getCategoriesByPath = getCategoriesByPath;
|
|
83
|
+
const getCategoryById = async function getCategoryById2({
|
|
82
84
|
id,
|
|
83
85
|
children = 1,
|
|
84
86
|
includeHidden
|
|
@@ -96,4 +98,5 @@ const getCategoryById = exports.getCategoryById = async function getCategoryById
|
|
|
96
98
|
},
|
|
97
99
|
includeHidden
|
|
98
100
|
});
|
|
99
|
-
};
|
|
101
|
+
};
|
|
102
|
+
exports.getCategoryById = getCategoryById;
|
package/dist/rpc/methods/cbd.cjs
CHANGED
|
@@ -7,7 +7,7 @@ exports.getOrderDataByCbd = void 0;
|
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
var _hash = require("../../utils/hash.cjs");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const getOrderDataByCbd =
|
|
10
|
+
const getOrderDataByCbd = async function getOrderDataByCbd2({
|
|
11
11
|
cbdToken
|
|
12
12
|
}, context) {
|
|
13
13
|
if (!cbdToken) {
|
|
@@ -41,4 +41,5 @@ const getOrderDataByCbd = exports.getOrderDataByCbd = async function getOrderDat
|
|
|
41
41
|
});
|
|
42
42
|
return orderSuccessData;
|
|
43
43
|
}
|
|
44
|
-
};
|
|
44
|
+
};
|
|
45
|
+
exports.getOrderDataByCbd = getOrderDataByCbd;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getOrderById = void 0;
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const getOrderById =
|
|
9
|
+
const getOrderById = async function getOrderById2({
|
|
10
10
|
orderId
|
|
11
11
|
}, context) {
|
|
12
12
|
const accessToken = context.accessToken;
|
|
@@ -51,4 +51,5 @@ const getOrderById = exports.getOrderById = async function getOrderById2({
|
|
|
51
51
|
});
|
|
52
52
|
throw error;
|
|
53
53
|
}
|
|
54
|
-
};
|
|
54
|
+
};
|
|
55
|
+
exports.getOrderById = getOrderById;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.updateShopUser = exports.updatePassword = void 0;
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const updateShopUser =
|
|
9
|
+
const updateShopUser = async function updateShopUser2(payload, context) {
|
|
10
10
|
const shopId = context.shopId;
|
|
11
11
|
const accessHeader = context.checkout.accessHeader;
|
|
12
12
|
const checkoutUrl = context.checkout.url;
|
|
@@ -80,7 +80,8 @@ const updateShopUser = exports.updateShopUser = async function updateShopUser2(p
|
|
|
80
80
|
user
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
exports.updateShopUser = updateShopUser;
|
|
84
|
+
const updatePassword = async function updatePassword2({
|
|
84
85
|
oldPassword,
|
|
85
86
|
newPassword
|
|
86
87
|
}, context) {
|
|
@@ -120,4 +121,5 @@ const updatePassword = exports.updatePassword = async function updatePassword2({
|
|
|
120
121
|
return {
|
|
121
122
|
user: shopUser
|
|
122
123
|
};
|
|
123
|
-
};
|
|
124
|
+
};
|
|
125
|
+
exports.updatePassword = updatePassword;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getShopUserAddresses = void 0;
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const getShopUserAddresses =
|
|
9
|
+
const getShopUserAddresses = async function getShopUserAddresses2(context) {
|
|
10
10
|
const shopId = context.shopId;
|
|
11
11
|
const accessHeader = context.checkout.accessHeader;
|
|
12
12
|
const checkoutUrl = context.checkout.url;
|
|
@@ -21,4 +21,5 @@ const getShopUserAddresses = exports.getShopUserAddresses = async function getSh
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
return response.data.entities;
|
|
24
|
-
};
|
|
24
|
+
};
|
|
25
|
+
exports.getShopUserAddresses = getShopUserAddresses;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.fetchNavigationTreeById = exports.fetchAllNavigationTrees = void 0;
|
|
7
|
-
const fetchAllNavigationTrees =
|
|
7
|
+
const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({
|
|
8
8
|
params
|
|
9
9
|
}, {
|
|
10
10
|
bapiClient: {
|
|
@@ -16,7 +16,8 @@ const fetchAllNavigationTrees = exports.fetchAllNavigationTrees = async function
|
|
|
16
16
|
cacheKeyPrefix: "getAll-navigation-trees"
|
|
17
17
|
})(params);
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
exports.fetchAllNavigationTrees = fetchAllNavigationTrees;
|
|
20
|
+
const fetchNavigationTreeById = async function fetchNavigationTreeById2({
|
|
20
21
|
treeId,
|
|
21
22
|
params
|
|
22
23
|
}, {
|
|
@@ -28,4 +29,5 @@ const fetchNavigationTreeById = exports.fetchNavigationTreeById = async function
|
|
|
28
29
|
return await cached(navigation.getById, {
|
|
29
30
|
cacheKeyPrefix: `getById-navigation-trees-${treeId}`
|
|
30
31
|
})(treeId, params);
|
|
31
|
-
};
|
|
32
|
+
};
|
|
33
|
+
exports.fetchNavigationTreeById = fetchNavigationTreeById;
|
|
@@ -7,7 +7,7 @@ exports.getProductsCount = exports.getProductsByIds = exports.getProductsByCateg
|
|
|
7
7
|
var _helpers = require("../../helpers/index.cjs");
|
|
8
8
|
var _constants = require("../../constants/index.cjs");
|
|
9
9
|
const MAX_PER_PAGE = 100;
|
|
10
|
-
const getProductById =
|
|
10
|
+
const getProductById = async function getProductById2(options, {
|
|
11
11
|
bapiClient,
|
|
12
12
|
cached,
|
|
13
13
|
campaignKey,
|
|
@@ -22,7 +22,8 @@ const getProductById = exports.getProductById = async function getProductById2(o
|
|
|
22
22
|
includeSellableForFree: options.includeSellableForFree
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
exports.getProductById = getProductById;
|
|
26
|
+
const getProductsByIds = async function getProductsByIds2(options, {
|
|
26
27
|
bapiClient,
|
|
27
28
|
cached,
|
|
28
29
|
campaignKey,
|
|
@@ -37,7 +38,8 @@ const getProductsByIds = exports.getProductsByIds = async function getProductsBy
|
|
|
37
38
|
includeSellableForFree: options.includeSellableForFree
|
|
38
39
|
});
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
+
exports.getProductsByIds = getProductsByIds;
|
|
42
|
+
const getProductsByCategory = async function getProductsByCategory2({
|
|
41
43
|
category = "/",
|
|
42
44
|
cache,
|
|
43
45
|
with: _with,
|
|
@@ -104,7 +106,8 @@ const getProductsByCategory = exports.getProductsByCategory = async function get
|
|
|
104
106
|
pagination
|
|
105
107
|
};
|
|
106
108
|
};
|
|
107
|
-
|
|
109
|
+
exports.getProductsByCategory = getProductsByCategory;
|
|
110
|
+
const getFilters = async function getFilters2({
|
|
108
111
|
category = "/",
|
|
109
112
|
includedFilters,
|
|
110
113
|
where = void 0,
|
|
@@ -176,7 +179,8 @@ const getFilters = exports.getFilters = async function getFilters2({
|
|
|
176
179
|
unfilteredCount: productCount?.pagination.total
|
|
177
180
|
};
|
|
178
181
|
};
|
|
179
|
-
|
|
182
|
+
exports.getFilters = getFilters;
|
|
183
|
+
const fetchAllFiltersForCategory = async function fetchAllFiltersForCategory2({
|
|
180
184
|
includedFilters = [],
|
|
181
185
|
category
|
|
182
186
|
}, {
|
|
@@ -200,7 +204,8 @@ const fetchAllFiltersForCategory = exports.fetchAllFiltersForCategory = async fu
|
|
|
200
204
|
cacheKey: `filters-for-category-${category.slug}`
|
|
201
205
|
})();
|
|
202
206
|
};
|
|
203
|
-
|
|
207
|
+
exports.fetchAllFiltersForCategory = fetchAllFiltersForCategory;
|
|
208
|
+
const getProductsCount = async function getProductsCount2({
|
|
204
209
|
category = "/",
|
|
205
210
|
categoryId = void 0,
|
|
206
211
|
where = void 0,
|
|
@@ -241,6 +246,7 @@ const getProductsCount = exports.getProductsCount = async function getProductsCo
|
|
|
241
246
|
count: productCount?.pagination.total
|
|
242
247
|
};
|
|
243
248
|
};
|
|
249
|
+
exports.getProductsCount = getProductsCount;
|
|
244
250
|
const sanitizeAttributesForBAPI = ({
|
|
245
251
|
attributes,
|
|
246
252
|
filterKeys,
|
|
@@ -11,7 +11,7 @@ const setPaginationDefault = pagination => {
|
|
|
11
11
|
perPage: pagination?.perPage || _constants.PROMOTION_PER_PAGE_DEFAULT
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
const getPromotions =
|
|
14
|
+
const getPromotions = async function getPromotions2(params = {}, context) {
|
|
15
15
|
const {
|
|
16
16
|
bapiClient,
|
|
17
17
|
cached
|
|
@@ -23,7 +23,8 @@ const getPromotions = exports.getPromotions = async function getPromotions2(para
|
|
|
23
23
|
pagination: setPaginationDefault(params.pagination)
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
exports.getPromotions = getPromotions;
|
|
27
|
+
const getCurrentPromotions = async function getCurrentPromotions2(params = {}, context) {
|
|
27
28
|
const {
|
|
28
29
|
bapiClient,
|
|
29
30
|
cached
|
|
@@ -39,7 +40,8 @@ const getCurrentPromotions = exports.getCurrentPromotions = async function getCu
|
|
|
39
40
|
pagination: setPaginationDefault(params.pagination)
|
|
40
41
|
});
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
exports.getCurrentPromotions = getCurrentPromotions;
|
|
44
|
+
const getPromotionsByIds = async function getPromotionsByIds2(ids, context) {
|
|
43
45
|
const {
|
|
44
46
|
bapiClient,
|
|
45
47
|
cached
|
|
@@ -47,4 +49,5 @@ const getPromotionsByIds = exports.getPromotionsByIds = async function getPromot
|
|
|
47
49
|
return await cached(bapiClient.promotions.getByIds, {
|
|
48
50
|
cacheKeyPrefix: "getByIds-promotions"
|
|
49
51
|
})(ids);
|
|
50
|
-
};
|
|
52
|
+
};
|
|
53
|
+
exports.getPromotionsByIds = getPromotionsByIds;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.searchProducts = void 0;
|
|
7
7
|
var _constants = require("../../constants/index.cjs");
|
|
8
8
|
var _stringHelpers = require("../../helpers/stringHelpers.cjs");
|
|
9
|
-
const searchProducts =
|
|
9
|
+
const searchProducts = async function searchProducts2({
|
|
10
10
|
term,
|
|
11
11
|
slug,
|
|
12
12
|
with: _with,
|
|
@@ -25,6 +25,7 @@ const searchProducts = exports.searchProducts = async function searchProducts2({
|
|
|
25
25
|
with: _with ?? withParams?.search ?? _constants.MIN_WITH_PARAMS_SEARCH
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
+
exports.searchProducts = searchProducts;
|
|
28
29
|
const getCategoryId = async (cached, bapiClient, slug) => {
|
|
29
30
|
if (!slug) {
|
|
30
31
|
return;
|
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getShopConfiguration = void 0;
|
|
7
|
-
const getShopConfiguration =
|
|
7
|
+
const getShopConfiguration = async function getShopConfiguration2({
|
|
8
8
|
cached,
|
|
9
9
|
bapiClient
|
|
10
10
|
}) {
|
|
11
11
|
return await cached(bapiClient.shopConfiguration.get, {
|
|
12
12
|
cacheKeyPrefix: "get-shopConfigurations"
|
|
13
13
|
})();
|
|
14
|
-
};
|
|
14
|
+
};
|
|
15
|
+
exports.getShopConfiguration = getShopConfiguration;
|
|
@@ -7,12 +7,13 @@ exports.refreshUser = exports.getUser = exports.fetchUser = void 0;
|
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
var _httpStatus = require("../../constants/httpStatus.cjs");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const getUser =
|
|
10
|
+
const getUser = function getUser2(context) {
|
|
11
11
|
return {
|
|
12
12
|
user: context.user
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
exports.getUser = getUser;
|
|
16
|
+
const fetchUser = async function fetchUser2(payload, options) {
|
|
16
17
|
const {
|
|
17
18
|
accessToken
|
|
18
19
|
} = payload;
|
|
@@ -42,7 +43,8 @@ const fetchUser = exports.fetchUser = async function fetchUser2(payload, options
|
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
+
exports.fetchUser = fetchUser;
|
|
47
|
+
const refreshUser = async function refreshUser2(context) {
|
|
46
48
|
const {
|
|
47
49
|
accessToken,
|
|
48
50
|
checkout,
|
|
@@ -83,4 +85,5 @@ const refreshUser = exports.refreshUser = async function refreshUser2(context) {
|
|
|
83
85
|
return {
|
|
84
86
|
user: void 0
|
|
85
87
|
};
|
|
86
|
-
};
|
|
88
|
+
};
|
|
89
|
+
exports.refreshUser = refreshUser;
|
|
@@ -7,7 +7,7 @@ exports.getVariantById = void 0;
|
|
|
7
7
|
const defaultWith = {
|
|
8
8
|
attributes: "all"
|
|
9
9
|
};
|
|
10
|
-
const getVariantById =
|
|
10
|
+
const getVariantById = async function getVariantById2({
|
|
11
11
|
ids,
|
|
12
12
|
include = defaultWith,
|
|
13
13
|
pricePromotionKey = "default"
|
|
@@ -25,4 +25,5 @@ const getVariantById = exports.getVariantById = async function getVariantById2({
|
|
|
25
25
|
campaignKey,
|
|
26
26
|
pricePromotionKey
|
|
27
27
|
} : void 0);
|
|
28
|
-
};
|
|
28
|
+
};
|
|
29
|
+
exports.getVariantById = getVariantById;
|
|
@@ -9,7 +9,7 @@ var _constants = require("../../constants/index.cjs");
|
|
|
9
9
|
function getWithParams(params, context) {
|
|
10
10
|
return params.with ?? context.withParams?.basket ?? _constants.MIN_WITH_PARAMS_WISHLIST;
|
|
11
11
|
}
|
|
12
|
-
const addItemToWishlist =
|
|
12
|
+
const addItemToWishlist = async function addItemToWishlist2(options, context) {
|
|
13
13
|
const {
|
|
14
14
|
bapiClient,
|
|
15
15
|
campaignKey,
|
|
@@ -44,7 +44,8 @@ const addItemToWishlist = exports.addItemToWishlist = async function addItemToWi
|
|
|
44
44
|
throw new _errors.BAPIError("BAPI ERROR", code, message, "bapiClient.wishlist.addItem");
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
exports.addItemToWishlist = addItemToWishlist;
|
|
48
|
+
const getWishlist = async function getWishlist2(options, context) {
|
|
48
49
|
const {
|
|
49
50
|
bapiClient,
|
|
50
51
|
campaignKey
|
|
@@ -58,7 +59,8 @@ const getWishlist = exports.getWishlist = async function getWishlist2(options, c
|
|
|
58
59
|
pricePromotionKey: resolvedWith?.pricePromotionKey ?? ""
|
|
59
60
|
});
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
+
exports.getWishlist = getWishlist;
|
|
63
|
+
const removeItemFromWishlist = async function removeItemFromWishlist2(options, context) {
|
|
62
64
|
const {
|
|
63
65
|
bapiClient,
|
|
64
66
|
campaignKey,
|
|
@@ -70,7 +72,8 @@ const removeItemFromWishlist = exports.removeItemFromWishlist = async function r
|
|
|
70
72
|
campaignKey
|
|
71
73
|
});
|
|
72
74
|
};
|
|
73
|
-
|
|
75
|
+
exports.removeItemFromWishlist = removeItemFromWishlist;
|
|
76
|
+
const clearWishlist = async function clearWishlist2(context) {
|
|
74
77
|
const wishlist = await getWishlist({}, context);
|
|
75
78
|
await Promise.all(wishlist.items.map(async item => {
|
|
76
79
|
await removeItemFromWishlist({
|
|
@@ -78,4 +81,5 @@ const clearWishlist = exports.clearWishlist = async function clearWishlist2(cont
|
|
|
78
81
|
}, context);
|
|
79
82
|
}));
|
|
80
83
|
return await getWishlist({}, context);
|
|
81
|
-
};
|
|
84
|
+
};
|
|
85
|
+
exports.clearWishlist = clearWishlist;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.25.1",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
"@scayle/eslint-config-storefront": "3.2.5",
|
|
75
75
|
"@scayle/prettier-config-storefront": "2.0.2",
|
|
76
76
|
"@types/crypto-js": "4.1.3",
|
|
77
|
-
"@types/jest": "29.5.
|
|
78
|
-
"@types/node": "20.
|
|
79
|
-
"@types/webpack-env": "1.18.
|
|
77
|
+
"@types/jest": "29.5.8",
|
|
78
|
+
"@types/node": "20.9.0",
|
|
79
|
+
"@types/webpack-env": "1.18.4",
|
|
80
80
|
"unbuild": "2.0.0",
|
|
81
81
|
"axios": "0.27.2",
|
|
82
82
|
"eslint": "8.53.0",
|
|
83
|
-
"eslint-formatter-gitlab": "5.
|
|
83
|
+
"eslint-formatter-gitlab": "5.1.0",
|
|
84
84
|
"jest": "29.7.0",
|
|
85
85
|
"jest-junit": "16.0.0",
|
|
86
86
|
"prettier": "3.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"rimraf": "5.0.5",
|
|
89
89
|
"ts-jest": "29.1.1",
|
|
90
90
|
"ts-node": "10.9.1",
|
|
91
|
-
"unstorage": "1.
|
|
91
|
+
"unstorage": "1.10.1"
|
|
92
92
|
},
|
|
93
93
|
"optionalDependencies": {
|
|
94
94
|
"redis": "4"
|
package/dist/cache/types.cjs
DELETED
package/dist/cache/types.d.ts
DELETED
package/dist/cache/types.mjs
DELETED