@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,61 @@
|
|
|
1
|
+
import { subtle } from "uncrypto";
|
|
2
|
+
export const md5 = async (value) => {
|
|
3
|
+
if (!process.env.SFC_OMIT_MD5) {
|
|
4
|
+
const md5EncryptImport = await import("crypto-js/md5");
|
|
5
|
+
const hexImport = await import("crypto-js/enc-hex");
|
|
6
|
+
const md5Encrypt = md5EncryptImport.default && typeof md5EncryptImport.default === "function" ? md5EncryptImport.default : md5EncryptImport;
|
|
7
|
+
const hex = hexImport.default && typeof hexImport.default === "function" ? hexImport.default : hexImport;
|
|
8
|
+
return hex.stringify(md5Encrypt(value));
|
|
9
|
+
} else {
|
|
10
|
+
throw Error("SFC was built without support for MD5");
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const sha256 = async (value) => Array.from(
|
|
14
|
+
new Uint8Array(
|
|
15
|
+
await subtle.digest("SHA-256", new TextEncoder().encode(value))
|
|
16
|
+
)
|
|
17
|
+
).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
18
|
+
export const hmac = async (value, secret, algorithm = "SHA-256") => {
|
|
19
|
+
const encoder = new TextEncoder();
|
|
20
|
+
const messageUint8Array = encoder.encode(value);
|
|
21
|
+
const keyUint8Array = encoder.encode(secret);
|
|
22
|
+
const cryptoKey = await subtle.importKey(
|
|
23
|
+
"raw",
|
|
24
|
+
keyUint8Array,
|
|
25
|
+
{ name: "HMAC", hash: algorithm },
|
|
26
|
+
false,
|
|
27
|
+
["sign"]
|
|
28
|
+
);
|
|
29
|
+
const signature = await subtle.sign("HMAC", cryptoKey, messageUint8Array);
|
|
30
|
+
const hashArray = Array.from(new Uint8Array(signature));
|
|
31
|
+
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
32
|
+
};
|
|
33
|
+
function base64ToBytes(base64) {
|
|
34
|
+
const binString = atob(base64);
|
|
35
|
+
return Uint8Array.from(binString, (m) => m.codePointAt(0));
|
|
36
|
+
}
|
|
37
|
+
function bytesToBase64(bytes) {
|
|
38
|
+
const binString = Array.from(bytes, (x) => String.fromCodePoint(x)).join("");
|
|
39
|
+
return btoa(binString);
|
|
40
|
+
}
|
|
41
|
+
export const encodeBase64 = (string) => {
|
|
42
|
+
if (typeof Buffer === "function") {
|
|
43
|
+
return Buffer.from(string).toString("base64");
|
|
44
|
+
}
|
|
45
|
+
return bytesToBase64(new TextEncoder().encode(string));
|
|
46
|
+
};
|
|
47
|
+
export const decodeBase64 = (string) => {
|
|
48
|
+
if (typeof Buffer === "function") {
|
|
49
|
+
return Buffer.from(string, "base64").toString("utf-8");
|
|
50
|
+
}
|
|
51
|
+
return new TextDecoder().decode(base64ToBytes(string));
|
|
52
|
+
};
|
|
53
|
+
export const verifyToken = async (token, secret) => {
|
|
54
|
+
const [encodedPayload, signature] = token.split(".", 2);
|
|
55
|
+
const expectedSignature = encodeBase64(await hmac(encodedPayload, secret));
|
|
56
|
+
if (expectedSignature === signature) {
|
|
57
|
+
return decodeBase64(encodedPayload);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export const buildHashPayload = (payload) => encodeBase64(JSON.stringify(payload));
|
|
61
|
+
export const buildSignature = async (payloadHash, secret) => encodeBase64(await hmac(payloadHash, secret));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _timeout = require("./timeout.cjs");
|
|
7
|
+
Object.keys(_timeout).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _timeout[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _timeout[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _log = require("./log.cjs");
|
|
18
|
+
Object.keys(_log).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _log[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _log[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateWishlistKey = exports.generateKey = exports.generateBasketKey = void 0;
|
|
7
|
+
var _hash = require("../constants/hash.cjs");
|
|
8
|
+
var _hash2 = require("./hash.cjs");
|
|
9
|
+
const generateKey = async ({
|
|
10
|
+
keyTemplate,
|
|
11
|
+
hashAlgorithm = _hash.HashAlgorithm.MD5,
|
|
12
|
+
shopId,
|
|
13
|
+
userId,
|
|
14
|
+
log
|
|
15
|
+
}) => {
|
|
16
|
+
if (!shopId) {
|
|
17
|
+
log?.warn("No shopId provided", {
|
|
18
|
+
shopId
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!userId) {
|
|
22
|
+
log?.warn("No userId provided", {
|
|
23
|
+
userId
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const key = String(keyTemplate.replace("{shopId}", shopId).replace("{userId}", userId));
|
|
27
|
+
if (hashAlgorithm === _hash.HashAlgorithm.MD5) {
|
|
28
|
+
return await (0, _hash2.md5)(key);
|
|
29
|
+
}
|
|
30
|
+
if (hashAlgorithm === _hash.HashAlgorithm.SHA256) {
|
|
31
|
+
return await (0, _hash2.sha256)(key);
|
|
32
|
+
}
|
|
33
|
+
return key;
|
|
34
|
+
};
|
|
35
|
+
exports.generateKey = generateKey;
|
|
36
|
+
const generateWishlistKey = async ({
|
|
37
|
+
keyTemplate,
|
|
38
|
+
hashAlgorithm = _hash.HashAlgorithm.MD5,
|
|
39
|
+
shopId,
|
|
40
|
+
userId,
|
|
41
|
+
log
|
|
42
|
+
}) => {
|
|
43
|
+
return await generateKey({
|
|
44
|
+
log: log?.space("core.generateWishlistKey"),
|
|
45
|
+
keyTemplate,
|
|
46
|
+
hashAlgorithm,
|
|
47
|
+
shopId,
|
|
48
|
+
userId
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
exports.generateWishlistKey = generateWishlistKey;
|
|
52
|
+
const generateBasketKey = async ({
|
|
53
|
+
keyTemplate,
|
|
54
|
+
hashAlgorithm = _hash.HashAlgorithm.MD5,
|
|
55
|
+
shopId,
|
|
56
|
+
userId,
|
|
57
|
+
log
|
|
58
|
+
}) => {
|
|
59
|
+
return await generateKey({
|
|
60
|
+
log: log?.space("core.generateBasketKey"),
|
|
61
|
+
keyTemplate,
|
|
62
|
+
hashAlgorithm,
|
|
63
|
+
shopId,
|
|
64
|
+
userId
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.generateBasketKey = generateBasketKey;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Log } from '..';
|
|
2
|
+
import { HashAlgorithm } from '../constants/hash';
|
|
3
|
+
export declare const generateKey: ({ keyTemplate, hashAlgorithm, shopId, userId, log, }: {
|
|
4
|
+
keyName?: string | undefined;
|
|
5
|
+
keyTemplate: string;
|
|
6
|
+
hashAlgorithm: HashAlgorithm;
|
|
7
|
+
shopId: string;
|
|
8
|
+
userId: string;
|
|
9
|
+
log?: Log | undefined;
|
|
10
|
+
}) => Promise<any>;
|
|
11
|
+
export declare const generateWishlistKey: ({ keyTemplate, hashAlgorithm, shopId, userId, log, }: {
|
|
12
|
+
keyTemplate: string;
|
|
13
|
+
hashAlgorithm: HashAlgorithm;
|
|
14
|
+
shopId: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
log?: Log | undefined;
|
|
17
|
+
}) => Promise<any>;
|
|
18
|
+
export declare const generateBasketKey: ({ keyTemplate, hashAlgorithm, shopId, userId, log, }: {
|
|
19
|
+
keyTemplate: string;
|
|
20
|
+
hashAlgorithm: HashAlgorithm;
|
|
21
|
+
shopId: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
log?: Log | undefined;
|
|
24
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HashAlgorithm } from "../constants/hash.mjs";
|
|
2
|
+
import { md5, sha256 } from "./hash.mjs";
|
|
3
|
+
export const generateKey = async ({
|
|
4
|
+
keyTemplate,
|
|
5
|
+
hashAlgorithm = HashAlgorithm.MD5,
|
|
6
|
+
shopId,
|
|
7
|
+
userId,
|
|
8
|
+
log
|
|
9
|
+
}) => {
|
|
10
|
+
if (!shopId) {
|
|
11
|
+
log?.warn("No shopId provided", { shopId });
|
|
12
|
+
}
|
|
13
|
+
if (!userId) {
|
|
14
|
+
log?.warn("No userId provided", { userId });
|
|
15
|
+
}
|
|
16
|
+
const key = String(
|
|
17
|
+
keyTemplate.replace("{shopId}", shopId).replace("{userId}", userId)
|
|
18
|
+
);
|
|
19
|
+
if (hashAlgorithm === HashAlgorithm.MD5) {
|
|
20
|
+
return await md5(key);
|
|
21
|
+
}
|
|
22
|
+
if (hashAlgorithm === HashAlgorithm.SHA256) {
|
|
23
|
+
return await sha256(key);
|
|
24
|
+
}
|
|
25
|
+
return key;
|
|
26
|
+
};
|
|
27
|
+
export const generateWishlistKey = async ({
|
|
28
|
+
keyTemplate,
|
|
29
|
+
hashAlgorithm = HashAlgorithm.MD5,
|
|
30
|
+
shopId,
|
|
31
|
+
userId,
|
|
32
|
+
log
|
|
33
|
+
}) => {
|
|
34
|
+
return await generateKey({
|
|
35
|
+
log: log?.space("core.generateWishlistKey"),
|
|
36
|
+
keyTemplate,
|
|
37
|
+
hashAlgorithm,
|
|
38
|
+
shopId,
|
|
39
|
+
userId
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export const generateBasketKey = async ({
|
|
43
|
+
keyTemplate,
|
|
44
|
+
hashAlgorithm = HashAlgorithm.MD5,
|
|
45
|
+
shopId,
|
|
46
|
+
userId,
|
|
47
|
+
log
|
|
48
|
+
}) => {
|
|
49
|
+
return await generateKey({
|
|
50
|
+
log: log?.space("core.generateBasketKey"),
|
|
51
|
+
keyTemplate,
|
|
52
|
+
hashAlgorithm,
|
|
53
|
+
shopId,
|
|
54
|
+
userId
|
|
55
|
+
});
|
|
56
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Log = void 0;
|
|
7
|
+
class Log {
|
|
8
|
+
static default = new this({
|
|
9
|
+
space: "global",
|
|
10
|
+
handler: consoleLogHandler
|
|
11
|
+
});
|
|
12
|
+
_handler;
|
|
13
|
+
_space;
|
|
14
|
+
_type = "log";
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this._handler = options?.handler || Log.default._handler;
|
|
17
|
+
this._space = options?.space || Log.default._space;
|
|
18
|
+
}
|
|
19
|
+
debug(message, data) {
|
|
20
|
+
this.write("debug", message, data);
|
|
21
|
+
}
|
|
22
|
+
info(message, data) {
|
|
23
|
+
this.write("info", message, data);
|
|
24
|
+
}
|
|
25
|
+
warn(message, data) {
|
|
26
|
+
this.write("warn", message, data);
|
|
27
|
+
}
|
|
28
|
+
error(message, data) {
|
|
29
|
+
const error = message instanceof Error ? message : null;
|
|
30
|
+
if (error) {
|
|
31
|
+
data = {
|
|
32
|
+
error: message,
|
|
33
|
+
...data
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
this.write("error", error?.message ?? message, data);
|
|
37
|
+
}
|
|
38
|
+
write(level, message, data) {
|
|
39
|
+
if (typeof data !== "undefined") {
|
|
40
|
+
data = typeof data !== "object" ? {
|
|
41
|
+
data
|
|
42
|
+
} : data;
|
|
43
|
+
}
|
|
44
|
+
if (this._handler) {
|
|
45
|
+
this._handler({
|
|
46
|
+
level,
|
|
47
|
+
message,
|
|
48
|
+
data,
|
|
49
|
+
space: this._space
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
const logFunc = console[level] || console.log;
|
|
53
|
+
logFunc.apply(console, data ? [message, data] : [message]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create a new sub-space.
|
|
58
|
+
* All spaces are being separated by a dot. E.g. `global.api` and `global.api.getUser`
|
|
59
|
+
* @param subSpace The name of the sub-space in camel-case (e.g. `api` and `api.getUser`)
|
|
60
|
+
*/
|
|
61
|
+
space(subSpace) {
|
|
62
|
+
return new Log({
|
|
63
|
+
space: `${this._space}.${subSpace}`,
|
|
64
|
+
handler: this._handler
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Measure the time of a function.
|
|
69
|
+
*/
|
|
70
|
+
async time(message, func) {
|
|
71
|
+
const start = Date.now();
|
|
72
|
+
const result = await func();
|
|
73
|
+
const end = Date.now();
|
|
74
|
+
this.debug(`${message} took ${end - start}ms`);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Attach the log to the request object: `req.$log`.
|
|
79
|
+
* This function should be called in a server middleware before storefront-core is initialized.
|
|
80
|
+
*/
|
|
81
|
+
static attachToRequest(req, log) {
|
|
82
|
+
req.$log = log;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.Log = Log;
|
|
86
|
+
function consoleLogHandler({
|
|
87
|
+
level,
|
|
88
|
+
message,
|
|
89
|
+
data
|
|
90
|
+
}) {
|
|
91
|
+
const logFunc = console[level] || console.log;
|
|
92
|
+
logFunc.apply(console, data ? [message, data] : [message]);
|
|
93
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
+
export interface LogEntry {
|
|
3
|
+
level: LogLevel;
|
|
4
|
+
space: string;
|
|
5
|
+
message: string;
|
|
6
|
+
data?: Object;
|
|
7
|
+
}
|
|
8
|
+
export type LogHandler = (entry: LogEntry) => void;
|
|
9
|
+
export interface LogOptions {
|
|
10
|
+
handler?: LogHandler;
|
|
11
|
+
space: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This log provides a way to log messages to a custom log handler (in a serial manner).
|
|
15
|
+
* If no handler is provided, it will log to the console.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Log {
|
|
18
|
+
static default: Log;
|
|
19
|
+
_handler?: LogHandler;
|
|
20
|
+
_space: string;
|
|
21
|
+
_type: string;
|
|
22
|
+
constructor(options?: LogOptions);
|
|
23
|
+
debug(message: string, data?: any): void;
|
|
24
|
+
info(message: string, data?: any): void;
|
|
25
|
+
warn(message: string, data?: any): void;
|
|
26
|
+
error(message: string | Error, data?: any): void;
|
|
27
|
+
write(level: LogLevel, message: string, data?: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new sub-space.
|
|
30
|
+
* All spaces are being separated by a dot. E.g. `global.api` and `global.api.getUser`
|
|
31
|
+
* @param subSpace The name of the sub-space in camel-case (e.g. `api` and `api.getUser`)
|
|
32
|
+
*/
|
|
33
|
+
space(subSpace: string): Log;
|
|
34
|
+
/**
|
|
35
|
+
* Measure the time of a function.
|
|
36
|
+
*/
|
|
37
|
+
time(message: string, func: () => any): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Attach the log to the request object: `req.$log`.
|
|
40
|
+
* This function should be called in a server middleware before storefront-core is initialized.
|
|
41
|
+
*/
|
|
42
|
+
static attachToRequest(req: any, log: Log): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export class Log {
|
|
2
|
+
static default = new this({
|
|
3
|
+
space: "global",
|
|
4
|
+
handler: consoleLogHandler
|
|
5
|
+
});
|
|
6
|
+
_handler;
|
|
7
|
+
_space;
|
|
8
|
+
_type = "log";
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this._handler = options?.handler || Log.default._handler;
|
|
11
|
+
this._space = options?.space || Log.default._space;
|
|
12
|
+
}
|
|
13
|
+
debug(message, data) {
|
|
14
|
+
this.write("debug", message, data);
|
|
15
|
+
}
|
|
16
|
+
info(message, data) {
|
|
17
|
+
this.write("info", message, data);
|
|
18
|
+
}
|
|
19
|
+
warn(message, data) {
|
|
20
|
+
this.write("warn", message, data);
|
|
21
|
+
}
|
|
22
|
+
error(message, data) {
|
|
23
|
+
const error = message instanceof Error ? message : null;
|
|
24
|
+
if (error) {
|
|
25
|
+
data = {
|
|
26
|
+
error: message,
|
|
27
|
+
...data
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
this.write("error", error?.message ?? message, data);
|
|
31
|
+
}
|
|
32
|
+
write(level, message, data) {
|
|
33
|
+
if (typeof data !== "undefined") {
|
|
34
|
+
data = typeof data !== "object" ? { data } : data;
|
|
35
|
+
}
|
|
36
|
+
if (this._handler) {
|
|
37
|
+
this._handler({ level, message, data, space: this._space });
|
|
38
|
+
} else {
|
|
39
|
+
const logFunc = console[level] || console.log;
|
|
40
|
+
logFunc.apply(console, data ? [message, data] : [message]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a new sub-space.
|
|
45
|
+
* All spaces are being separated by a dot. E.g. `global.api` and `global.api.getUser`
|
|
46
|
+
* @param subSpace The name of the sub-space in camel-case (e.g. `api` and `api.getUser`)
|
|
47
|
+
*/
|
|
48
|
+
space(subSpace) {
|
|
49
|
+
return new Log({
|
|
50
|
+
space: `${this._space}.${subSpace}`,
|
|
51
|
+
handler: this._handler
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Measure the time of a function.
|
|
56
|
+
*/
|
|
57
|
+
async time(message, func) {
|
|
58
|
+
const start = Date.now();
|
|
59
|
+
const result = await func();
|
|
60
|
+
const end = Date.now();
|
|
61
|
+
this.debug(`${message} took ${end - start}ms`);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Attach the log to the request object: `req.$log`.
|
|
66
|
+
* This function should be called in a server middleware before storefront-core is initialized.
|
|
67
|
+
*/
|
|
68
|
+
static attachToRequest(req, log) {
|
|
69
|
+
req.$log = log;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function consoleLogHandler({ level, message, data }) {
|
|
73
|
+
const logFunc = console[level] || console.log;
|
|
74
|
+
logFunc.apply(console, data ? [message, data] : [message]);
|
|
75
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sanitizeErrorObject = exports.convertErrorForRpcCall = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const isErrorWithConfig = error => {
|
|
10
|
+
return !error || error.constructor !== Object || !("config" in error) || !error.config.headers;
|
|
11
|
+
};
|
|
12
|
+
const sanitizeErrorObject = error => {
|
|
13
|
+
if (!isErrorWithConfig(error)) {
|
|
14
|
+
return error;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
...error,
|
|
18
|
+
config: {
|
|
19
|
+
...error?.config,
|
|
20
|
+
headers: {
|
|
21
|
+
...error.config.headers,
|
|
22
|
+
Authorization: void 0
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.sanitizeErrorObject = sanitizeErrorObject;
|
|
28
|
+
const convertErrorForRpcCall = (error, httpStatuses) => {
|
|
29
|
+
if (_axios.default.isAxiosError(error) && error.response?.status && httpStatuses.includes(error.response.status)) {
|
|
30
|
+
const data = Object.assign({
|
|
31
|
+
code: error.response.status,
|
|
32
|
+
message: error.response.data
|
|
33
|
+
}, error.response.data);
|
|
34
|
+
error.response = {
|
|
35
|
+
...error.response,
|
|
36
|
+
data
|
|
37
|
+
};
|
|
38
|
+
return error;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.convertErrorForRpcCall = convertErrorForRpcCall;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const sanitizeErrorObject: (error: object) => object;
|
|
2
|
+
/**
|
|
3
|
+
* It is important to convert error to the format that catch in rpcCall expects,
|
|
4
|
+
* rpcCall waits for code and message be present in the error otherwise it falls back to 500
|
|
5
|
+
*/
|
|
6
|
+
export declare const convertErrorForRpcCall: (error: any, httpStatuses: Array<number>) => Error;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
const isErrorWithConfig = (error) => {
|
|
3
|
+
return !error || error.constructor !== Object || !("config" in error) || !error.config.headers;
|
|
4
|
+
};
|
|
5
|
+
export const sanitizeErrorObject = (error) => {
|
|
6
|
+
if (!isErrorWithConfig(error)) {
|
|
7
|
+
return error;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
...error,
|
|
11
|
+
config: {
|
|
12
|
+
...error?.config,
|
|
13
|
+
headers: {
|
|
14
|
+
...error.config.headers,
|
|
15
|
+
Authorization: void 0
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export const convertErrorForRpcCall = (error, httpStatuses) => {
|
|
21
|
+
if (axios.isAxiosError(error) && error.response?.status && httpStatuses.includes(error.response.status)) {
|
|
22
|
+
const data = Object.assign(
|
|
23
|
+
{
|
|
24
|
+
code: error.response.status,
|
|
25
|
+
message: error.response.data
|
|
26
|
+
},
|
|
27
|
+
error.response.data
|
|
28
|
+
);
|
|
29
|
+
error.response = {
|
|
30
|
+
...error.response,
|
|
31
|
+
data
|
|
32
|
+
};
|
|
33
|
+
return error;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.wait = exports.timeout = void 0;
|
|
7
|
+
const wait = ms => {
|
|
8
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
9
|
+
};
|
|
10
|
+
exports.wait = wait;
|
|
11
|
+
const timeout = (ms, promise) => {
|
|
12
|
+
const breaker = new Promise((_resolve, reject) => {
|
|
13
|
+
setTimeout(() => reject(new Error("timeout")), ms);
|
|
14
|
+
});
|
|
15
|
+
return Promise.race([promise, breaker]);
|
|
16
|
+
};
|
|
17
|
+
exports.timeout = timeout;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const wait = (ms) => {
|
|
2
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
|
+
};
|
|
4
|
+
export const timeout = (ms, promise) => {
|
|
5
|
+
const breaker = new Promise((_resolve, reject) => {
|
|
6
|
+
setTimeout(() => reject(new Error("timeout")), ms);
|
|
7
|
+
});
|
|
8
|
+
return Promise.race([promise, breaker]);
|
|
9
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mergeWishlists = exports.mergeBaskets = void 0;
|
|
7
|
+
var _constants = require("../constants/index.cjs");
|
|
8
|
+
const mergeBaskets = async (fromBasketKey, toBasketKey, withOptions, context) => {
|
|
9
|
+
const {
|
|
10
|
+
bapiClient,
|
|
11
|
+
campaignKey
|
|
12
|
+
} = context;
|
|
13
|
+
const fromOriginBasket = await bapiClient.basket.get(fromBasketKey, {
|
|
14
|
+
with: withOptions,
|
|
15
|
+
campaignKey
|
|
16
|
+
});
|
|
17
|
+
context.log.debug(`Merging basket ${fromBasketKey} to ${toBasketKey}`);
|
|
18
|
+
if (fromBasketKey === toBasketKey) {
|
|
19
|
+
return fromOriginBasket;
|
|
20
|
+
}
|
|
21
|
+
const {
|
|
22
|
+
basket: fromBasket,
|
|
23
|
+
type
|
|
24
|
+
} = fromOriginBasket;
|
|
25
|
+
if (type === "success" && fromBasket?.items?.length > 0) {
|
|
26
|
+
const itemsToAddOrUpdate = fromBasket.items.map(item => ({
|
|
27
|
+
variantId: item.variant.id,
|
|
28
|
+
quantity: item.quantity,
|
|
29
|
+
params: {
|
|
30
|
+
promotionId: item.promotionId,
|
|
31
|
+
customData: item.customData,
|
|
32
|
+
displayData: item.displayData,
|
|
33
|
+
itemGroup: item.itemGroup,
|
|
34
|
+
pricePromotionKey: withOptions.pricePromotionKey
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
const mergedBasket = await bapiClient.basket.addOrUpdateItems(toBasketKey, itemsToAddOrUpdate, {
|
|
38
|
+
with: withOptions,
|
|
39
|
+
campaignKey,
|
|
40
|
+
includeItemsWithoutProductData: withOptions?.includeItemsWithoutProductData
|
|
41
|
+
}, {
|
|
42
|
+
existingItemHandling: _constants.ExistingItemHandling.AddQuantityToExisting
|
|
43
|
+
});
|
|
44
|
+
fromBasket.items.map(async item => {
|
|
45
|
+
return await bapiClient.basket.deleteItem(fromBasketKey, item.key);
|
|
46
|
+
});
|
|
47
|
+
return mergedBasket;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.mergeBaskets = mergeBaskets;
|
|
51
|
+
const mergeWishlists = async (fromWishlistKey, toWishlistKey, withOptions, context) => {
|
|
52
|
+
const {
|
|
53
|
+
bapiClient,
|
|
54
|
+
campaignKey
|
|
55
|
+
} = context;
|
|
56
|
+
const oldWishlist = await bapiClient.wishlist.get(fromWishlistKey, {
|
|
57
|
+
with: withOptions,
|
|
58
|
+
campaignKey
|
|
59
|
+
});
|
|
60
|
+
context.log.debug(`Merging wishlist ${fromWishlistKey} to ${toWishlistKey}`);
|
|
61
|
+
if (oldWishlist != null) {
|
|
62
|
+
for (const item of oldWishlist.items) {
|
|
63
|
+
const productId = item?.product?.id;
|
|
64
|
+
if (productId) {
|
|
65
|
+
await bapiClient.wishlist.addItem(toWishlistKey, {
|
|
66
|
+
productId
|
|
67
|
+
}, {
|
|
68
|
+
campaignKey
|
|
69
|
+
});
|
|
70
|
+
bapiClient.wishlist.deleteItem(fromWishlistKey, item?.key);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.mergeWishlists = mergeWishlists;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BasketWithOptions, RpcContext } from '../types';
|
|
2
|
+
export declare const mergeBaskets: (fromBasketKey: string, toBasketKey: string, withOptions: BasketWithOptions, context: RpcContext) => Promise<{
|
|
3
|
+
type: "failure";
|
|
4
|
+
statusCode: number;
|
|
5
|
+
basket: import("@aboutyou/backbone/endpoints/basket/getBasket").BasketResponseData<import("@aboutyou/backbone/types/BapiProduct").BapiProduct, import("@aboutyou/backbone/types/BapiProduct").Variant>;
|
|
6
|
+
} | {
|
|
7
|
+
readonly type: "success";
|
|
8
|
+
readonly basket: import("@aboutyou/backbone/endpoints/basket/getBasket").BasketResponseData<import("@aboutyou/backbone/types/BapiProduct").BapiProduct, import("@aboutyou/backbone/types/BapiProduct").Variant>;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: "failure";
|
|
11
|
+
readonly basket: import("@aboutyou/backbone/endpoints/basket/getBasket").BasketResponseData<import("@aboutyou/backbone/types/BapiProduct").BapiProduct, import("@aboutyou/backbone/types/BapiProduct").Variant>;
|
|
12
|
+
readonly errors: import("@aboutyou/backbone/helpers/BapiClient").AddOrUpdateItemError[];
|
|
13
|
+
} | undefined>;
|
|
14
|
+
export declare const mergeWishlists: (fromWishlistKey: string, toWishlistKey: string, withOptions: BasketWithOptions, context: RpcContext) => Promise<void>;
|