@scayle/storefront-core 7.22.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 +480 -0
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/bapi/init.cjs +30 -0
- package/dist/bapi/init.d.ts +14 -0
- package/dist/bapi/init.mjs +23 -0
- package/dist/cache/cache.cjs +1 -0
- package/dist/cache/cache.d.ts +8 -0
- package/dist/cache/cache.mjs +0 -0
- package/dist/cache/cached.cjs +89 -0
- package/dist/cache/cached.d.ts +24 -0
- package/dist/cache/cached.mjs +92 -0
- package/dist/cache/index.cjs +38 -0
- package/dist/cache/index.d.ts +3 -0
- package/dist/cache/index.mjs +3 -0
- package/dist/cache/providers/redis.cjs +94 -0
- package/dist/cache/providers/redis.d.ts +28 -0
- package/dist/cache/providers/redis.mjs +86 -0
- package/dist/cache/providers/unstorage.cjs +54 -0
- package/dist/cache/providers/unstorage.d.ts +16 -0
- package/dist/cache/providers/unstorage.mjs +49 -0
- package/dist/cache/types.cjs +11 -0
- package/dist/cache/types.d.ts +6 -0
- package/dist/cache/types.mjs +4 -0
- package/dist/constants/basket.cjs +13 -0
- package/dist/constants/basket.d.ts +8 -0
- package/dist/constants/basket.mjs +6 -0
- package/dist/constants/cache.cjs +8 -0
- package/dist/constants/cache.d.ts +1 -0
- package/dist/constants/cache.mjs +1 -0
- package/dist/constants/hash.cjs +11 -0
- package/dist/constants/hash.d.ts +6 -0
- package/dist/constants/hash.mjs +4 -0
- package/dist/constants/httpStatus.cjs +636 -0
- package/dist/constants/httpStatus.d.ts +632 -0
- package/dist/constants/httpStatus.mjs +629 -0
- package/dist/constants/index.cjs +93 -0
- package/dist/constants/index.d.ts +8 -0
- package/dist/constants/index.mjs +8 -0
- package/dist/constants/product.cjs +11 -0
- package/dist/constants/product.d.ts +6 -0
- package/dist/constants/product.mjs +4 -0
- package/dist/constants/promotion.cjs +10 -0
- package/dist/constants/promotion.d.ts +2 -0
- package/dist/constants/promotion.mjs +2 -0
- package/dist/constants/sorting.cjs +24 -0
- package/dist/constants/sorting.d.ts +20 -0
- package/dist/constants/sorting.mjs +17 -0
- package/dist/constants/withParameters.cjs +138 -0
- package/dist/constants/withParameters.d.ts +30 -0
- package/dist/constants/withParameters.mjs +132 -0
- package/dist/errors/BAPIError.cjs +16 -0
- package/dist/errors/BAPIError.d.ts +6 -0
- package/dist/errors/BAPIError.mjs +9 -0
- package/dist/errors/baseError.cjs +17 -0
- package/dist/errors/baseError.d.ts +5 -0
- package/dist/errors/baseError.mjs +10 -0
- package/dist/errors/index.cjs +27 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.mjs +2 -0
- package/dist/helpers/advancedAttributeHelpers.cjs +26 -0
- package/dist/helpers/advancedAttributeHelpers.d.ts +12 -0
- package/dist/helpers/advancedAttributeHelpers.mjs +21 -0
- package/dist/helpers/arrayHelpers.cjs +10 -0
- package/dist/helpers/arrayHelpers.d.ts +1 -0
- package/dist/helpers/arrayHelpers.mjs +3 -0
- package/dist/helpers/attributeHelpers.cjs +24 -0
- package/dist/helpers/attributeHelpers.d.ts +5 -0
- package/dist/helpers/attributeHelpers.mjs +17 -0
- package/dist/helpers/autobind.cjs +44 -0
- package/dist/helpers/autobind.d.ts +39 -0
- package/dist/helpers/autobind.mjs +35 -0
- package/dist/helpers/basketHelpers.cjs +12 -0
- package/dist/helpers/basketHelpers.d.ts +2 -0
- package/dist/helpers/basketHelpers.mjs +5 -0
- package/dist/helpers/categoryHelper.cjs +61 -0
- package/dist/helpers/categoryHelper.d.ts +7 -0
- package/dist/helpers/categoryHelper.mjs +44 -0
- package/dist/helpers/filterHelper.cjs +156 -0
- package/dist/helpers/filterHelper.d.ts +82 -0
- package/dist/helpers/filterHelper.mjs +147 -0
- package/dist/helpers/formHelpers.cjs +114 -0
- package/dist/helpers/formHelpers.d.ts +48 -0
- package/dist/helpers/formHelpers.mjs +106 -0
- package/dist/helpers/imageHelpers.cjs +20 -0
- package/dist/helpers/imageHelpers.d.ts +4 -0
- package/dist/helpers/imageHelpers.mjs +14 -0
- package/dist/helpers/index.cjs +192 -0
- package/dist/helpers/index.d.ts +17 -0
- package/dist/helpers/index.mjs +17 -0
- package/dist/helpers/localization.cjs +13 -0
- package/dist/helpers/localization.d.ts +7 -0
- package/dist/helpers/localization.mjs +6 -0
- package/dist/helpers/objectHelpers.cjs +19 -0
- package/dist/helpers/objectHelpers.d.ts +1 -0
- package/dist/helpers/objectHelpers.mjs +6 -0
- package/dist/helpers/orderHelpers.cjs +10 -0
- package/dist/helpers/orderHelpers.d.ts +67 -0
- package/dist/helpers/orderHelpers.mjs +4 -0
- package/dist/helpers/product.fixture.cjs +770 -0
- package/dist/helpers/product.fixture.d.ts +415 -0
- package/dist/helpers/product.fixture.mjs +838 -0
- package/dist/helpers/productDisruptorHelper.cjs +37 -0
- package/dist/helpers/productDisruptorHelper.d.ts +10 -0
- package/dist/helpers/productDisruptorHelper.mjs +23 -0
- package/dist/helpers/productHelpers.cjs +188 -0
- package/dist/helpers/productHelpers.d.ts +41 -0
- package/dist/helpers/productHelpers.mjs +170 -0
- package/dist/helpers/sanitizationHelpers.cjs +15 -0
- package/dist/helpers/sanitizationHelpers.d.ts +2 -0
- package/dist/helpers/sanitizationHelpers.mjs +6 -0
- package/dist/helpers/sortingHelper.cjs +67 -0
- package/dist/helpers/sortingHelper.d.ts +69 -0
- package/dist/helpers/sortingHelper.mjs +66 -0
- package/dist/helpers/stringHelpers.cjs +8 -0
- package/dist/helpers/stringHelpers.d.ts +2 -0
- package/dist/helpers/stringHelpers.mjs +2 -0
- package/dist/index.cjs +85 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +8 -0
- package/dist/rpc/methods/basket/basket.cjs +183 -0
- package/dist/rpc/methods/basket/basket.d.ts +23 -0
- package/dist/rpc/methods/basket/basket.mjs +181 -0
- package/dist/rpc/methods/brands.cjs +34 -0
- package/dist/rpc/methods/brands.d.ts +5 -0
- package/dist/rpc/methods/brands.mjs +16 -0
- package/dist/rpc/methods/categories.cjs +102 -0
- package/dist/rpc/methods/categories.d.ts +21 -0
- package/dist/rpc/methods/categories.mjs +64 -0
- package/dist/rpc/methods/cbd.cjs +45 -0
- package/dist/rpc/methods/cbd.d.ts +4 -0
- package/dist/rpc/methods/cbd.mjs +36 -0
- package/dist/rpc/methods/checkout/index.cjs +38 -0
- package/dist/rpc/methods/checkout/index.d.ts +3 -0
- package/dist/rpc/methods/checkout/index.mjs +3 -0
- package/dist/rpc/methods/checkout/order.cjs +55 -0
- package/dist/rpc/methods/checkout/order.d.ts +4 -0
- package/dist/rpc/methods/checkout/order.mjs +43 -0
- package/dist/rpc/methods/checkout/shopUser.cjs +126 -0
- package/dist/rpc/methods/checkout/shopUser.d.ts +7 -0
- package/dist/rpc/methods/checkout/shopUser.mjs +109 -0
- package/dist/rpc/methods/checkout/shopUserAddresses.cjs +25 -0
- package/dist/rpc/methods/checkout/shopUserAddresses.d.ts +3 -0
- package/dist/rpc/methods/checkout/shopUserAddresses.mjs +19 -0
- package/dist/rpc/methods/index.cjs +159 -0
- package/dist/rpc/methods/index.d.ts +14 -0
- package/dist/rpc/methods/index.mjs +14 -0
- package/dist/rpc/methods/navigationTrees.cjs +33 -0
- package/dist/rpc/methods/navigationTrees.d.ts +5 -0
- package/dist/rpc/methods/navigationTrees.mjs +10 -0
- package/dist/rpc/methods/products.cjs +261 -0
- package/dist/rpc/methods/products.d.ts +13 -0
- package/dist/rpc/methods/products.mjs +217 -0
- package/dist/rpc/methods/promotion.cjs +53 -0
- package/dist/rpc/methods/promotion.d.ts +4 -0
- package/dist/rpc/methods/promotion.mjs +38 -0
- package/dist/rpc/methods/search.cjs +38 -0
- package/dist/rpc/methods/search.d.ts +10 -0
- package/dist/rpc/methods/search.mjs +22 -0
- package/dist/rpc/methods/session.cjs +274 -0
- package/dist/rpc/methods/session.d.ts +20 -0
- package/dist/rpc/methods/session.mjs +309 -0
- package/dist/rpc/methods/shopConfiguration.cjs +15 -0
- package/dist/rpc/methods/shopConfiguration.d.ts +4 -0
- package/dist/rpc/methods/shopConfiguration.mjs +6 -0
- package/dist/rpc/methods/user.cjs +89 -0
- package/dist/rpc/methods/user.d.ts +20 -0
- package/dist/rpc/methods/user.mjs +56 -0
- package/dist/rpc/methods/variants.cjs +29 -0
- package/dist/rpc/methods/variants.d.ts +8 -0
- package/dist/rpc/methods/variants.mjs +12 -0
- package/dist/rpc/methods/wishlist.cjs +85 -0
- package/dist/rpc/methods/wishlist.d.ts +13 -0
- package/dist/rpc/methods/wishlist.mjs +61 -0
- package/dist/server.cjs +39 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.mjs +4 -0
- package/dist/types/api/auth.cjs +1 -0
- package/dist/types/api/auth.d.ts +63 -0
- package/dist/types/api/auth.mjs +0 -0
- package/dist/types/api/context.cjs +1 -0
- package/dist/types/api/context.d.ts +61 -0
- package/dist/types/api/context.mjs +0 -0
- package/dist/types/api/rpc.cjs +1 -0
- package/dist/types/api/rpc.d.ts +4 -0
- package/dist/types/api/rpc.mjs +0 -0
- package/dist/types/bapi/basket.cjs +1 -0
- package/dist/types/bapi/basket.d.ts +25 -0
- package/dist/types/bapi/basket.mjs +0 -0
- package/dist/types/bapi/brand.cjs +1 -0
- package/dist/types/bapi/brand.d.ts +2 -0
- package/dist/types/bapi/brand.mjs +0 -0
- package/dist/types/bapi/category.cjs +1 -0
- package/dist/types/bapi/category.d.ts +6 -0
- package/dist/types/bapi/category.mjs +0 -0
- package/dist/types/bapi/filter.cjs +1 -0
- package/dist/types/bapi/filter.d.ts +49 -0
- package/dist/types/bapi/filter.mjs +0 -0
- package/dist/types/bapi/navigation.cjs +1 -0
- package/dist/types/bapi/navigation.d.ts +10 -0
- package/dist/types/bapi/navigation.mjs +0 -0
- package/dist/types/bapi/order.cjs +1 -0
- package/dist/types/bapi/order.d.ts +554 -0
- package/dist/types/bapi/order.mjs +0 -0
- package/dist/types/bapi/pagination.cjs +1 -0
- package/dist/types/bapi/pagination.d.ts +13 -0
- package/dist/types/bapi/pagination.mjs +0 -0
- package/dist/types/bapi/product.cjs +1 -0
- package/dist/types/bapi/product.d.ts +84 -0
- package/dist/types/bapi/product.mjs +0 -0
- package/dist/types/bapi/productFilter.cjs +1 -0
- package/dist/types/bapi/productFilter.d.ts +7 -0
- package/dist/types/bapi/productFilter.mjs +0 -0
- package/dist/types/bapi/promotion.cjs +1 -0
- package/dist/types/bapi/promotion.d.ts +2 -0
- package/dist/types/bapi/promotion.mjs +0 -0
- package/dist/types/bapi/redirects.cjs +1 -0
- package/dist/types/bapi/redirects.d.ts +1 -0
- package/dist/types/bapi/redirects.mjs +0 -0
- package/dist/types/bapi/router.cjs +1 -0
- package/dist/types/bapi/router.d.ts +1 -0
- package/dist/types/bapi/router.mjs +0 -0
- package/dist/types/bapi/search.cjs +1 -0
- package/dist/types/bapi/search.d.ts +21 -0
- package/dist/types/bapi/search.mjs +0 -0
- package/dist/types/bapi/sorting.cjs +5 -0
- package/dist/types/bapi/sorting.d.ts +10 -0
- package/dist/types/bapi/sorting.mjs +1 -0
- package/dist/types/bapi/wishlist.cjs +1 -0
- package/dist/types/bapi/wishlist.d.ts +9 -0
- package/dist/types/bapi/wishlist.mjs +0 -0
- package/dist/types/breadcrumb.cjs +1 -0
- package/dist/types/breadcrumb.d.ts +4 -0
- package/dist/types/breadcrumb.mjs +0 -0
- package/dist/types/index.cjs +236 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.mjs +21 -0
- package/dist/types/promises.cjs +1 -0
- package/dist/types/promises.d.ts +2 -0
- package/dist/types/promises.mjs +0 -0
- package/dist/types/user.cjs +1 -0
- package/dist/types/user.d.ts +100 -0
- package/dist/types/user.mjs +0 -0
- package/dist/utils/compression.cjs +24 -0
- package/dist/utils/compression.d.ts +2 -0
- package/dist/utils/compression.mjs +16 -0
- package/dist/utils/hash.cjs +68 -0
- package/dist/utils/hash.d.ts +8 -0
- package/dist/utils/hash.mjs +61 -0
- package/dist/utils/index.cjs +27 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/keys.cjs +67 -0
- package/dist/utils/keys.d.ts +24 -0
- package/dist/utils/keys.mjs +56 -0
- package/dist/utils/log.cjs +93 -0
- package/dist/utils/log.d.ts +43 -0
- package/dist/utils/log.mjs +75 -0
- package/dist/utils/rpc.cjs +41 -0
- package/dist/utils/rpc.d.ts +6 -0
- package/dist/utils/rpc.mjs +35 -0
- package/dist/utils/timeout.cjs +17 -0
- package/dist/utils/timeout.d.ts +2 -0
- package/dist/utils/timeout.mjs +9 -0
- package/dist/utils/user.cjs +75 -0
- package/dist/utils/user.d.ts +14 -0
- package/dist/utils/user.mjs +65 -0
- package/package.json +97 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getShopUserAddresses = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const getShopUserAddresses = async function getShopUserAddresses2(context) {
|
|
10
|
+
const shopId = context.shopId;
|
|
11
|
+
const accessHeader = context.checkout.accessHeader;
|
|
12
|
+
const checkoutUrl = context.checkout.url;
|
|
13
|
+
const response = await _axios.default.get(`${checkoutUrl}/api/oauth/customer/addresses`, {
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${context.accessToken}`,
|
|
16
|
+
"X-Shop-Id": shopId,
|
|
17
|
+
Accept: "application/json",
|
|
18
|
+
...(accessHeader && {
|
|
19
|
+
"X-Access-Header": accessHeader
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return response.data.entities;
|
|
24
|
+
};
|
|
25
|
+
exports.getShopUserAddresses = getShopUserAddresses;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
const getShopUserAddresses = async function getShopUserAddresses2(context) {
|
|
3
|
+
const shopId = context.shopId;
|
|
4
|
+
const accessHeader = context.checkout.accessHeader;
|
|
5
|
+
const checkoutUrl = context.checkout.url;
|
|
6
|
+
const response = await axios.get(
|
|
7
|
+
`${checkoutUrl}/api/oauth/customer/addresses`,
|
|
8
|
+
{
|
|
9
|
+
headers: {
|
|
10
|
+
Authorization: `Bearer ${context.accessToken}`,
|
|
11
|
+
"X-Shop-Id": shopId,
|
|
12
|
+
Accept: "application/json",
|
|
13
|
+
...accessHeader && { "X-Access-Header": accessHeader }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
return response.data.entities;
|
|
18
|
+
};
|
|
19
|
+
export { getShopUserAddresses };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _basket = require("./basket/basket.cjs");
|
|
7
|
+
Object.keys(_basket).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _basket[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _basket[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _brands = require("./brands.cjs");
|
|
18
|
+
Object.keys(_brands).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _brands[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _brands[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _categories = require("./categories.cjs");
|
|
29
|
+
Object.keys(_categories).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _categories[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _categories[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _cbd = require("./cbd.cjs");
|
|
40
|
+
Object.keys(_cbd).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _cbd[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _cbd[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _products = require("./products.cjs");
|
|
51
|
+
Object.keys(_products).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _products[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _products[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _search = require("./search.cjs");
|
|
62
|
+
Object.keys(_search).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _search[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _search[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _shopConfiguration = require("./shopConfiguration.cjs");
|
|
73
|
+
Object.keys(_shopConfiguration).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _shopConfiguration[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _shopConfiguration[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _user = require("./user.cjs");
|
|
84
|
+
Object.keys(_user).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _user[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _user[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _wishlist = require("./wishlist.cjs");
|
|
95
|
+
Object.keys(_wishlist).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _wishlist[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _wishlist[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _checkout = require("./checkout/index.cjs");
|
|
106
|
+
Object.keys(_checkout).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _checkout[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _checkout[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
var _variants = require("./variants.cjs");
|
|
117
|
+
Object.keys(_variants).forEach(function (key) {
|
|
118
|
+
if (key === "default" || key === "__esModule") return;
|
|
119
|
+
if (key in exports && exports[key] === _variants[key]) return;
|
|
120
|
+
Object.defineProperty(exports, key, {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _variants[key];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
var _navigationTrees = require("./navigationTrees.cjs");
|
|
128
|
+
Object.keys(_navigationTrees).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _navigationTrees[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _navigationTrees[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
var _session = require("./session.cjs");
|
|
139
|
+
Object.keys(_session).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _session[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return _session[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
var _promotion = require("./promotion.cjs");
|
|
150
|
+
Object.keys(_promotion).forEach(function (key) {
|
|
151
|
+
if (key === "default" || key === "__esModule") return;
|
|
152
|
+
if (key in exports && exports[key] === _promotion[key]) return;
|
|
153
|
+
Object.defineProperty(exports, key, {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () {
|
|
156
|
+
return _promotion[key];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './basket/basket';
|
|
2
|
+
export * from './brands';
|
|
3
|
+
export * from './categories';
|
|
4
|
+
export * from './cbd';
|
|
5
|
+
export * from './products';
|
|
6
|
+
export * from './search';
|
|
7
|
+
export * from './shopConfiguration';
|
|
8
|
+
export * from './user';
|
|
9
|
+
export * from './wishlist';
|
|
10
|
+
export * from './checkout';
|
|
11
|
+
export * from './variants';
|
|
12
|
+
export * from './navigationTrees';
|
|
13
|
+
export * from './session';
|
|
14
|
+
export * from './promotion';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./basket/basket.mjs";
|
|
2
|
+
export * from "./brands.mjs";
|
|
3
|
+
export * from "./categories.mjs";
|
|
4
|
+
export * from "./cbd.mjs";
|
|
5
|
+
export * from "./products.mjs";
|
|
6
|
+
export * from "./search.mjs";
|
|
7
|
+
export * from "./shopConfiguration.mjs";
|
|
8
|
+
export * from "./user.mjs";
|
|
9
|
+
export * from "./wishlist.mjs";
|
|
10
|
+
export * from "./checkout/index.mjs";
|
|
11
|
+
export * from "./variants.mjs";
|
|
12
|
+
export * from "./navigationTrees.mjs";
|
|
13
|
+
export * from "./session.mjs";
|
|
14
|
+
export * from "./promotion.mjs";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fetchNavigationTreeById = exports.fetchAllNavigationTrees = void 0;
|
|
7
|
+
const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({
|
|
8
|
+
params
|
|
9
|
+
}, {
|
|
10
|
+
bapiClient: {
|
|
11
|
+
navigation
|
|
12
|
+
},
|
|
13
|
+
cached
|
|
14
|
+
}) {
|
|
15
|
+
return await cached(navigation.getAll, {
|
|
16
|
+
cacheKeyPrefix: "getAll-navigation-trees"
|
|
17
|
+
})(params);
|
|
18
|
+
};
|
|
19
|
+
exports.fetchAllNavigationTrees = fetchAllNavigationTrees;
|
|
20
|
+
const fetchNavigationTreeById = async function fetchNavigationTreeById2({
|
|
21
|
+
treeId,
|
|
22
|
+
params
|
|
23
|
+
}, {
|
|
24
|
+
bapiClient: {
|
|
25
|
+
navigation
|
|
26
|
+
},
|
|
27
|
+
cached
|
|
28
|
+
}) {
|
|
29
|
+
return await cached(navigation.getById, {
|
|
30
|
+
cacheKeyPrefix: `getById-navigation-trees-${treeId}`
|
|
31
|
+
})(treeId, params);
|
|
32
|
+
};
|
|
33
|
+
exports.fetchNavigationTreeById = fetchNavigationTreeById;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NavigationTree } from '@aboutyou/backbone/types/navigation';
|
|
2
|
+
import type { NavigationAllEndpointResponseData } from '@aboutyou/backbone/endpoints/navigation/navigation';
|
|
3
|
+
import { FetchNavigationTreesParams, FetchNavigationTreeByIdParams, RpcHandler } from '../../types';
|
|
4
|
+
export declare const fetchAllNavigationTrees: RpcHandler<FetchNavigationTreesParams, NavigationAllEndpointResponseData>;
|
|
5
|
+
export declare const fetchNavigationTreeById: RpcHandler<FetchNavigationTreeByIdParams, NavigationTree>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({ params }, { bapiClient: { navigation }, cached }) {
|
|
2
|
+
return await cached(navigation.getAll, {
|
|
3
|
+
cacheKeyPrefix: "getAll-navigation-trees"
|
|
4
|
+
})(params);
|
|
5
|
+
};
|
|
6
|
+
export const fetchNavigationTreeById = async function fetchNavigationTreeById2({ treeId, params }, { bapiClient: { navigation }, cached }) {
|
|
7
|
+
return await cached(navigation.getById, {
|
|
8
|
+
cacheKeyPrefix: `getById-navigation-trees-${treeId}`
|
|
9
|
+
})(treeId, params);
|
|
10
|
+
};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getProductsCount = exports.getProductsByIds = exports.getProductsByCategory = exports.getProductById = exports.getFilters = exports.fetchAllFiltersForCategory = void 0;
|
|
7
|
+
var _helpers = require("../../helpers/index.cjs");
|
|
8
|
+
var _constants = require("../../constants/index.cjs");
|
|
9
|
+
const MAX_PER_PAGE = 100;
|
|
10
|
+
const getProductById = async function getProductById2(options, {
|
|
11
|
+
bapiClient,
|
|
12
|
+
cached,
|
|
13
|
+
campaignKey,
|
|
14
|
+
withParams
|
|
15
|
+
}) {
|
|
16
|
+
return await cached(bapiClient.products.getById, {
|
|
17
|
+
cacheKeyPrefix: `getById-product-${options.id}`
|
|
18
|
+
})(options.id, {
|
|
19
|
+
with: options.with ?? withParams?.product ?? _constants.MIN_WITH_PARAMS_PRODUCT,
|
|
20
|
+
campaignKey,
|
|
21
|
+
pricePromotionKey: options.pricePromotionKey,
|
|
22
|
+
includeSellableForFree: options.includeSellableForFree
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.getProductById = getProductById;
|
|
26
|
+
const getProductsByIds = async function getProductsByIds2(options, {
|
|
27
|
+
bapiClient,
|
|
28
|
+
cached,
|
|
29
|
+
campaignKey,
|
|
30
|
+
withParams
|
|
31
|
+
}) {
|
|
32
|
+
return await cached(bapiClient.products.getByIds, {
|
|
33
|
+
cacheKeyPrefix: "getByIds-products"
|
|
34
|
+
})(options.ids, {
|
|
35
|
+
with: options.with ?? withParams?.product ?? _constants.MIN_WITH_PARAMS_PRODUCT,
|
|
36
|
+
campaignKey,
|
|
37
|
+
pricePromotionKey: options.pricePromotionKey,
|
|
38
|
+
includeSellableForFree: options.includeSellableForFree
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.getProductsByIds = getProductsByIds;
|
|
42
|
+
const getProductsByCategory = async function getProductsByCategory2({
|
|
43
|
+
category = "/",
|
|
44
|
+
cache,
|
|
45
|
+
with: _with,
|
|
46
|
+
perPage = 20,
|
|
47
|
+
page = 1,
|
|
48
|
+
where = void 0,
|
|
49
|
+
sort = void 0,
|
|
50
|
+
pricePromotionKey = "",
|
|
51
|
+
includeSellableForFree = void 0,
|
|
52
|
+
includeSoldOut = void 0,
|
|
53
|
+
orFiltersOperator = void 0
|
|
54
|
+
}, context) {
|
|
55
|
+
let result;
|
|
56
|
+
const {
|
|
57
|
+
cached,
|
|
58
|
+
bapiClient,
|
|
59
|
+
campaignKey
|
|
60
|
+
} = context;
|
|
61
|
+
if (category !== "/") {
|
|
62
|
+
result = await cached(bapiClient.categories.getByPath, {
|
|
63
|
+
cacheKeyPrefix: `getByPath-categories-${category}`
|
|
64
|
+
})((0, _helpers.splitAndRemoveEmpty)(category));
|
|
65
|
+
}
|
|
66
|
+
const {
|
|
67
|
+
filters
|
|
68
|
+
} = await getFilters({
|
|
69
|
+
category,
|
|
70
|
+
includeSoldOut,
|
|
71
|
+
where,
|
|
72
|
+
includeSellableForFree
|
|
73
|
+
}, context);
|
|
74
|
+
const {
|
|
75
|
+
entities: products,
|
|
76
|
+
pagination
|
|
77
|
+
} = await cached(bapiClient.products.query, {
|
|
78
|
+
...cache,
|
|
79
|
+
cacheKeyPrefix: `products-query-category-${category === "/" ? "root" : category}`
|
|
80
|
+
})({
|
|
81
|
+
where: {
|
|
82
|
+
term: where?.term,
|
|
83
|
+
categoryId: result?.id,
|
|
84
|
+
minPrice: where?.minPrice,
|
|
85
|
+
maxPrice: where?.maxPrice,
|
|
86
|
+
attributes: [...sanitizeAttributesForBAPI({
|
|
87
|
+
attributes: where?.attributes || [],
|
|
88
|
+
filterKeys: mapFiltersToSlugs(filters)
|
|
89
|
+
}), ...(where?.whitelistAttributes || [])],
|
|
90
|
+
disableFuzziness: where?.disableFuzziness
|
|
91
|
+
},
|
|
92
|
+
pagination: {
|
|
93
|
+
perPage: Math.min(perPage, MAX_PER_PAGE),
|
|
94
|
+
page
|
|
95
|
+
},
|
|
96
|
+
campaignKey,
|
|
97
|
+
pricePromotionKey,
|
|
98
|
+
includeSellableForFree,
|
|
99
|
+
includeSoldOut,
|
|
100
|
+
with: _with ?? context.withParams?.product ?? _constants.MIN_WITH_PARAMS_PRODUCT,
|
|
101
|
+
sort,
|
|
102
|
+
orFiltersOperator
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
products,
|
|
106
|
+
pagination
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
exports.getProductsByCategory = getProductsByCategory;
|
|
110
|
+
const getFilters = async function getFilters2({
|
|
111
|
+
category = "/",
|
|
112
|
+
includedFilters,
|
|
113
|
+
where = void 0,
|
|
114
|
+
includeSoldOut = false,
|
|
115
|
+
includeSellableForFree = false,
|
|
116
|
+
orFiltersOperator
|
|
117
|
+
}, {
|
|
118
|
+
cached,
|
|
119
|
+
bapiClient,
|
|
120
|
+
campaignKey
|
|
121
|
+
}) {
|
|
122
|
+
let result;
|
|
123
|
+
let allFiltersForCategory = [];
|
|
124
|
+
if (category !== "/") {
|
|
125
|
+
result = await cached(bapiClient.categories.getByPath, {
|
|
126
|
+
cacheKeyPrefix: `getByPath-categories-${category}`
|
|
127
|
+
})((0, _helpers.splitAndRemoveEmpty)(category));
|
|
128
|
+
allFiltersForCategory = await fetchAllFiltersForCategory({
|
|
129
|
+
category: {
|
|
130
|
+
id: result.id,
|
|
131
|
+
slug: category
|
|
132
|
+
},
|
|
133
|
+
includedFilters
|
|
134
|
+
}, {
|
|
135
|
+
cached,
|
|
136
|
+
bapiClient,
|
|
137
|
+
campaignKey
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const sanitizedAttributes = sanitizeAttributesForBAPI({
|
|
141
|
+
attributes: where?.attributes || [],
|
|
142
|
+
filterKeys: allFiltersForCategory,
|
|
143
|
+
includedFilters
|
|
144
|
+
});
|
|
145
|
+
const [filters, productCount] = await Promise.all([cached(bapiClient.filters.get, {
|
|
146
|
+
cacheKeyPrefix: `get-filters-${category}`
|
|
147
|
+
})({
|
|
148
|
+
where: {
|
|
149
|
+
categoryId: result?.id,
|
|
150
|
+
minPrice: where?.minPrice,
|
|
151
|
+
maxPrice: where?.maxPrice,
|
|
152
|
+
term: where?.term,
|
|
153
|
+
attributes: [...sanitizedAttributes, ...(where?.whitelistAttributes || [])]
|
|
154
|
+
},
|
|
155
|
+
includeSoldOut,
|
|
156
|
+
includeSellableForFree,
|
|
157
|
+
campaignKey,
|
|
158
|
+
including: includedFilters,
|
|
159
|
+
orFiltersOperator
|
|
160
|
+
}), cached(bapiClient.products.query, {
|
|
161
|
+
cacheKeyPrefix: `products-query-category-${category === "/" ? "root" : category}`
|
|
162
|
+
})({
|
|
163
|
+
where: {
|
|
164
|
+
categoryId: result?.id,
|
|
165
|
+
minPrice: where?.minPrice,
|
|
166
|
+
maxPrice: where?.maxPrice,
|
|
167
|
+
term: where?.term,
|
|
168
|
+
attributes: [...sanitizedAttributes, ...(where?.whitelistAttributes || [])]
|
|
169
|
+
},
|
|
170
|
+
includeSoldOut,
|
|
171
|
+
campaignKey,
|
|
172
|
+
pagination: {
|
|
173
|
+
perPage: 1
|
|
174
|
+
},
|
|
175
|
+
orFiltersOperator
|
|
176
|
+
})]);
|
|
177
|
+
return {
|
|
178
|
+
filters,
|
|
179
|
+
unfilteredCount: productCount?.pagination.total
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
exports.getFilters = getFilters;
|
|
183
|
+
const fetchAllFiltersForCategory = async function fetchAllFiltersForCategory2({
|
|
184
|
+
includedFilters = [],
|
|
185
|
+
category
|
|
186
|
+
}, {
|
|
187
|
+
cached,
|
|
188
|
+
bapiClient,
|
|
189
|
+
campaignKey
|
|
190
|
+
}) {
|
|
191
|
+
const fetchAndMapFiltersToSlugs = async () => {
|
|
192
|
+
const filtersFromBAPI = await cached(bapiClient.filters.get)({
|
|
193
|
+
where: {
|
|
194
|
+
categoryId: category.id
|
|
195
|
+
},
|
|
196
|
+
campaignKey,
|
|
197
|
+
including: includedFilters
|
|
198
|
+
});
|
|
199
|
+
return mapFiltersToSlugs(filtersFromBAPI);
|
|
200
|
+
};
|
|
201
|
+
return await cached(fetchAndMapFiltersToSlugs, {
|
|
202
|
+
ttl: 4 * 60 * 60,
|
|
203
|
+
// cached for 4 hours
|
|
204
|
+
cacheKey: `filters-for-category-${category.slug}`
|
|
205
|
+
})();
|
|
206
|
+
};
|
|
207
|
+
exports.fetchAllFiltersForCategory = fetchAllFiltersForCategory;
|
|
208
|
+
const getProductsCount = async function getProductsCount2({
|
|
209
|
+
category = "/",
|
|
210
|
+
categoryId = void 0,
|
|
211
|
+
where = void 0,
|
|
212
|
+
includeSoldOut = false,
|
|
213
|
+
includeSellableForFree = false,
|
|
214
|
+
orFiltersOperator = void 0
|
|
215
|
+
}, {
|
|
216
|
+
cached,
|
|
217
|
+
bapiClient,
|
|
218
|
+
campaignKey
|
|
219
|
+
}) {
|
|
220
|
+
let result;
|
|
221
|
+
if (category !== "/") {
|
|
222
|
+
const sanitizedPath = (0, _helpers.splitAndRemoveEmpty)(category);
|
|
223
|
+
result = await cached(bapiClient.categories.getByPath, {
|
|
224
|
+
cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
|
|
225
|
+
})(sanitizedPath);
|
|
226
|
+
}
|
|
227
|
+
const productCount = await cached(bapiClient.products.query, {
|
|
228
|
+
cacheKeyPrefix: "products-query"
|
|
229
|
+
})({
|
|
230
|
+
where: {
|
|
231
|
+
categoryId: categoryId ?? result?.id,
|
|
232
|
+
minPrice: where?.minPrice,
|
|
233
|
+
maxPrice: where?.maxPrice,
|
|
234
|
+
attributes: where?.attributes,
|
|
235
|
+
term: where?.term
|
|
236
|
+
},
|
|
237
|
+
includeSoldOut,
|
|
238
|
+
includeSellableForFree,
|
|
239
|
+
campaignKey,
|
|
240
|
+
pagination: {
|
|
241
|
+
perPage: 1
|
|
242
|
+
},
|
|
243
|
+
orFiltersOperator
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
count: productCount?.pagination.total
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
exports.getProductsCount = getProductsCount;
|
|
250
|
+
const sanitizeAttributesForBAPI = ({
|
|
251
|
+
attributes,
|
|
252
|
+
filterKeys,
|
|
253
|
+
includedFilters = []
|
|
254
|
+
}) => {
|
|
255
|
+
return attributes.filter(({
|
|
256
|
+
key
|
|
257
|
+
}) => key && filterKeys.includes(key.toLowerCase()) && !includedFilters?.includes(key.toLowerCase()));
|
|
258
|
+
};
|
|
259
|
+
const mapFiltersToSlugs = (filters = []) => filters.map(({
|
|
260
|
+
slug
|
|
261
|
+
}) => slug.toLowerCase());
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FetchFiltersParams, FetchFiltersResponse, FetchProductParams, FetchProductsByCategoryParams, FetchProductsByCategoryResponse, FetchProductsCountParams, FetchProductsCountResponse, FetchProductsParams, Product, RpcHandler } from '../../types';
|
|
2
|
+
export declare const getProductById: RpcHandler<FetchProductParams, Product>;
|
|
3
|
+
export declare const getProductsByIds: RpcHandler<FetchProductsParams, Product[]>;
|
|
4
|
+
export declare const getProductsByCategory: RpcHandler<FetchProductsByCategoryParams, FetchProductsByCategoryResponse>;
|
|
5
|
+
export declare const getFilters: RpcHandler<FetchFiltersParams, FetchFiltersResponse>;
|
|
6
|
+
export declare const fetchAllFiltersForCategory: RpcHandler<{
|
|
7
|
+
includedFilters?: string[];
|
|
8
|
+
category: {
|
|
9
|
+
slug: string;
|
|
10
|
+
id: number;
|
|
11
|
+
};
|
|
12
|
+
}, string[]>;
|
|
13
|
+
export declare const getProductsCount: RpcHandler<FetchProductsCountParams, FetchProductsCountResponse>;
|