@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,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRootCategories = exports.getCategoryById = exports.getCategoriesByPath = void 0;
|
|
7
|
+
var _helpers = require("../../helpers/index.cjs");
|
|
8
|
+
const getRootCategories = async function getRootCategories2({
|
|
9
|
+
children = 1,
|
|
10
|
+
includeHidden
|
|
11
|
+
}, {
|
|
12
|
+
cached,
|
|
13
|
+
bapiClient
|
|
14
|
+
}) {
|
|
15
|
+
const result = await cached(bapiClient.categories.getRoots, {
|
|
16
|
+
cacheKeyPrefix: "root-categories"
|
|
17
|
+
})({
|
|
18
|
+
with: {
|
|
19
|
+
children
|
|
20
|
+
},
|
|
21
|
+
includeHidden
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
categories: result,
|
|
25
|
+
activeNode: void 0
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.getRootCategories = getRootCategories;
|
|
29
|
+
const getCategoriesByPath = async function getCategoriesByPath2({
|
|
30
|
+
path,
|
|
31
|
+
children = 1,
|
|
32
|
+
includeHidden
|
|
33
|
+
}, context) {
|
|
34
|
+
const {
|
|
35
|
+
cached,
|
|
36
|
+
bapiClient
|
|
37
|
+
} = context;
|
|
38
|
+
if (path === "/") {
|
|
39
|
+
return getRootCategories({
|
|
40
|
+
children,
|
|
41
|
+
includeHidden
|
|
42
|
+
}, context);
|
|
43
|
+
}
|
|
44
|
+
const sanitizedPath = (0, _helpers.splitAndRemoveEmpty)(path);
|
|
45
|
+
const result = await cached(bapiClient.categories.getByPath, {
|
|
46
|
+
cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
|
|
47
|
+
})(sanitizedPath, {
|
|
48
|
+
with: {
|
|
49
|
+
children
|
|
50
|
+
},
|
|
51
|
+
includeHidden
|
|
52
|
+
});
|
|
53
|
+
const rootPath = await Promise.all((result.rootlineIds || []).map(id => {
|
|
54
|
+
return cached(bapiClient.categories.getById, {
|
|
55
|
+
cacheKeyPrefix: `getById-categories-${id}`
|
|
56
|
+
})(id, {
|
|
57
|
+
with: {
|
|
58
|
+
children,
|
|
59
|
+
parents: "all"
|
|
60
|
+
},
|
|
61
|
+
includeHidden
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
let tree = rootPath[rootPath.length - 1];
|
|
65
|
+
let lastNode = null;
|
|
66
|
+
for (let i = 0; i < rootPath.length; i++) {
|
|
67
|
+
if (lastNode === null) {
|
|
68
|
+
tree = rootPath[i];
|
|
69
|
+
} else if (lastNode.children) {
|
|
70
|
+
const activeElement = lastNode.children?.find(c => c?.id === rootPath[i]?.id);
|
|
71
|
+
if (activeElement) {
|
|
72
|
+
activeElement.children = rootPath[i].children;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
lastNode = rootPath[i];
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
categories: tree,
|
|
79
|
+
activeNode: result
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
exports.getCategoriesByPath = getCategoriesByPath;
|
|
83
|
+
const getCategoryById = async function getCategoryById2({
|
|
84
|
+
id,
|
|
85
|
+
children = 1,
|
|
86
|
+
includeHidden
|
|
87
|
+
}, context) {
|
|
88
|
+
const {
|
|
89
|
+
cached,
|
|
90
|
+
bapiClient
|
|
91
|
+
} = context;
|
|
92
|
+
return await cached(bapiClient.categories.getById, {
|
|
93
|
+
cacheKeyPrefix: `getById-categories-${id}`
|
|
94
|
+
})(id, {
|
|
95
|
+
with: {
|
|
96
|
+
children,
|
|
97
|
+
parents: "all"
|
|
98
|
+
},
|
|
99
|
+
includeHidden
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
exports.getCategoryById = getCategoryById;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Category, RpcHandler } from '../../types';
|
|
2
|
+
export declare const getRootCategories: RpcHandler<{
|
|
3
|
+
children?: number;
|
|
4
|
+
includeHidden?: true;
|
|
5
|
+
}, {
|
|
6
|
+
categories: Category[];
|
|
7
|
+
activeNode: undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const getCategoriesByPath: RpcHandler<{
|
|
10
|
+
path: string;
|
|
11
|
+
children?: number;
|
|
12
|
+
includeHidden?: true;
|
|
13
|
+
}, {
|
|
14
|
+
categories: Category[] | Category;
|
|
15
|
+
activeNode: Category | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const getCategoryById: RpcHandler<{
|
|
18
|
+
id: number;
|
|
19
|
+
children?: number;
|
|
20
|
+
includeHidden?: true;
|
|
21
|
+
}, Category>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { splitAndRemoveEmpty } from "../../helpers/index.mjs";
|
|
2
|
+
export const getRootCategories = async function getRootCategories2({ children = 1, includeHidden }, { cached, bapiClient }) {
|
|
3
|
+
const result = await cached(bapiClient.categories.getRoots, {
|
|
4
|
+
cacheKeyPrefix: "root-categories"
|
|
5
|
+
})({
|
|
6
|
+
with: { children },
|
|
7
|
+
includeHidden
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
categories: result,
|
|
11
|
+
activeNode: void 0
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const getCategoriesByPath = async function getCategoriesByPath2({ path, children = 1, includeHidden }, context) {
|
|
15
|
+
const { cached, bapiClient } = context;
|
|
16
|
+
if (path === "/") {
|
|
17
|
+
return getRootCategories({ children, includeHidden }, context);
|
|
18
|
+
}
|
|
19
|
+
const sanitizedPath = splitAndRemoveEmpty(path);
|
|
20
|
+
const result = await cached(bapiClient.categories.getByPath, {
|
|
21
|
+
cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
|
|
22
|
+
})(sanitizedPath, { with: { children }, includeHidden });
|
|
23
|
+
const rootPath = await Promise.all(
|
|
24
|
+
(result.rootlineIds || []).map((id) => {
|
|
25
|
+
return cached(bapiClient.categories.getById, {
|
|
26
|
+
cacheKeyPrefix: `getById-categories-${id}`
|
|
27
|
+
})(id, {
|
|
28
|
+
with: {
|
|
29
|
+
children,
|
|
30
|
+
parents: "all"
|
|
31
|
+
},
|
|
32
|
+
includeHidden
|
|
33
|
+
});
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
let tree = rootPath[rootPath.length - 1];
|
|
37
|
+
let lastNode = null;
|
|
38
|
+
for (let i = 0; i < rootPath.length; i++) {
|
|
39
|
+
if (lastNode === null) {
|
|
40
|
+
tree = rootPath[i];
|
|
41
|
+
} else if (lastNode.children) {
|
|
42
|
+
const activeElement = lastNode.children?.find(
|
|
43
|
+
(c) => c?.id === rootPath[i]?.id
|
|
44
|
+
);
|
|
45
|
+
if (activeElement) {
|
|
46
|
+
activeElement.children = rootPath[i].children;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
lastNode = rootPath[i];
|
|
50
|
+
}
|
|
51
|
+
return { categories: tree, activeNode: result };
|
|
52
|
+
};
|
|
53
|
+
export const getCategoryById = async function getCategoryById2({ id, children = 1, includeHidden }, context) {
|
|
54
|
+
const { cached, bapiClient } = context;
|
|
55
|
+
return await cached(bapiClient.categories.getById, {
|
|
56
|
+
cacheKeyPrefix: `getById-categories-${id}`
|
|
57
|
+
})(id, {
|
|
58
|
+
with: {
|
|
59
|
+
children,
|
|
60
|
+
parents: "all"
|
|
61
|
+
},
|
|
62
|
+
includeHidden
|
|
63
|
+
});
|
|
64
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOrderDataByCbd = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
var _hash = require("../../utils/hash.cjs");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const getOrderDataByCbd = async function getOrderDataByCbd2({
|
|
11
|
+
cbdToken
|
|
12
|
+
}, context) {
|
|
13
|
+
if (!cbdToken) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const shopId = context.shopId;
|
|
17
|
+
const accessHeader = context.checkout.accessHeader;
|
|
18
|
+
const checkoutSecret = context.checkout.secret;
|
|
19
|
+
const decodedPayload = await (0, _hash.verifyToken)(cbdToken, checkoutSecret);
|
|
20
|
+
if (decodedPayload) {
|
|
21
|
+
const payload = JSON.parse(decodedPayload);
|
|
22
|
+
const checkoutUsername = context.checkout.user;
|
|
23
|
+
const checkoutToken = context.checkout.token;
|
|
24
|
+
const checkoutUrl = context.checkout.url;
|
|
25
|
+
if (context.checkout.cbdExpiration && Math.floor(Date.now() / 1e3) - payload.issued_at > context.checkout.cbdExpiration) {
|
|
26
|
+
context.log.debug("Attempting to use expired CBD token");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const accessToken = (0, _hash.encodeBase64)(`${checkoutUsername}:${unescape(checkoutToken)}`);
|
|
30
|
+
const {
|
|
31
|
+
data: orderSuccessData
|
|
32
|
+
} = await _axios.default.get(`${checkoutUrl}/api/v1/orders/${payload.order_id}`, {
|
|
33
|
+
headers: {
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
Authorization: `Basic ${accessToken}`,
|
|
36
|
+
"x-shop-id": shopId.toString(),
|
|
37
|
+
...(accessHeader ? {
|
|
38
|
+
"X-Access-Header": accessHeader
|
|
39
|
+
} : {})
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return orderSuccessData;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.getOrderDataByCbd = getOrderDataByCbd;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { encodeBase64, verifyToken } from "../../utils/hash.mjs";
|
|
3
|
+
export const getOrderDataByCbd = async function getOrderDataByCbd2({ cbdToken }, context) {
|
|
4
|
+
if (!cbdToken) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const shopId = context.shopId;
|
|
8
|
+
const accessHeader = context.checkout.accessHeader;
|
|
9
|
+
const checkoutSecret = context.checkout.secret;
|
|
10
|
+
const decodedPayload = await verifyToken(cbdToken, checkoutSecret);
|
|
11
|
+
if (decodedPayload) {
|
|
12
|
+
const payload = JSON.parse(decodedPayload);
|
|
13
|
+
const checkoutUsername = context.checkout.user;
|
|
14
|
+
const checkoutToken = context.checkout.token;
|
|
15
|
+
const checkoutUrl = context.checkout.url;
|
|
16
|
+
if (context.checkout.cbdExpiration && Math.floor(Date.now() / 1e3) - payload.issued_at > context.checkout.cbdExpiration) {
|
|
17
|
+
context.log.debug("Attempting to use expired CBD token");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const accessToken = encodeBase64(
|
|
21
|
+
`${checkoutUsername}:${unescape(checkoutToken)}`
|
|
22
|
+
);
|
|
23
|
+
const { data: orderSuccessData } = await axios.get(
|
|
24
|
+
`${checkoutUrl}/api/v1/orders/${payload.order_id}`,
|
|
25
|
+
{
|
|
26
|
+
headers: {
|
|
27
|
+
Accept: "application/json",
|
|
28
|
+
Authorization: `Basic ${accessToken}`,
|
|
29
|
+
"x-shop-id": shopId.toString(),
|
|
30
|
+
...accessHeader ? { "X-Access-Header": accessHeader } : {}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
return orderSuccessData;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _order = require("./order.cjs");
|
|
7
|
+
Object.keys(_order).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _order[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _order[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _shopUserAddresses = require("./shopUserAddresses.cjs");
|
|
18
|
+
Object.keys(_shopUserAddresses).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _shopUserAddresses[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _shopUserAddresses[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _shopUser = require("./shopUser.cjs");
|
|
29
|
+
Object.keys(_shopUser).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _shopUser[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _shopUser[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOrderById = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const getOrderById = async function getOrderById2({
|
|
10
|
+
orderId
|
|
11
|
+
}, context) {
|
|
12
|
+
const accessToken = context.accessToken;
|
|
13
|
+
const shopId = context.shopId;
|
|
14
|
+
const accessHeader = context.checkout.accessHeader;
|
|
15
|
+
const checkoutUrl = context.checkout.url;
|
|
16
|
+
if (!orderId || isNaN(orderId)) {
|
|
17
|
+
throw new Error("No order-id provided");
|
|
18
|
+
}
|
|
19
|
+
if (!accessToken) {
|
|
20
|
+
throw new Error("No access token");
|
|
21
|
+
}
|
|
22
|
+
const isOrderInUserOrderlist = context.user?.orderSummary?.find(order => order.id === orderId);
|
|
23
|
+
if (!isOrderInUserOrderlist) {
|
|
24
|
+
throw new Error("Order not belonging to current user");
|
|
25
|
+
}
|
|
26
|
+
if (!accessToken) {
|
|
27
|
+
throw new Error("No access token");
|
|
28
|
+
}
|
|
29
|
+
const orderUrl = `${checkoutUrl}/api/customer/order/${orderId}`;
|
|
30
|
+
try {
|
|
31
|
+
const response = await _axios.default.get(orderUrl, {
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `Bearer ${accessToken}`,
|
|
34
|
+
"X-Shop-Id": shopId,
|
|
35
|
+
Accept: "application/json",
|
|
36
|
+
...(accessHeader ? {
|
|
37
|
+
"X-Access-Header": accessHeader
|
|
38
|
+
} : {})
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (response.status === 404) {
|
|
42
|
+
throw new Error("Order not found");
|
|
43
|
+
}
|
|
44
|
+
if (response.status === 200) {
|
|
45
|
+
return response.data;
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`Unknown response status: ${response.status}`);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
context.log.error("Error while fetching order details", {
|
|
50
|
+
error
|
|
51
|
+
});
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.getOrderById = getOrderById;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export const getOrderById = async function getOrderById2({ orderId }, context) {
|
|
3
|
+
const accessToken = context.accessToken;
|
|
4
|
+
const shopId = context.shopId;
|
|
5
|
+
const accessHeader = context.checkout.accessHeader;
|
|
6
|
+
const checkoutUrl = context.checkout.url;
|
|
7
|
+
if (!orderId || isNaN(orderId)) {
|
|
8
|
+
throw new Error("No order-id provided");
|
|
9
|
+
}
|
|
10
|
+
if (!accessToken) {
|
|
11
|
+
throw new Error("No access token");
|
|
12
|
+
}
|
|
13
|
+
const isOrderInUserOrderlist = context.user?.orderSummary?.find(
|
|
14
|
+
(order) => order.id === orderId
|
|
15
|
+
);
|
|
16
|
+
if (!isOrderInUserOrderlist) {
|
|
17
|
+
throw new Error("Order not belonging to current user");
|
|
18
|
+
}
|
|
19
|
+
if (!accessToken) {
|
|
20
|
+
throw new Error("No access token");
|
|
21
|
+
}
|
|
22
|
+
const orderUrl = `${checkoutUrl}/api/customer/order/${orderId}`;
|
|
23
|
+
try {
|
|
24
|
+
const response = await axios.get(orderUrl, {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${accessToken}`,
|
|
27
|
+
"X-Shop-Id": shopId,
|
|
28
|
+
Accept: "application/json",
|
|
29
|
+
...accessHeader ? { "X-Access-Header": accessHeader } : {}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (response.status === 404) {
|
|
33
|
+
throw new Error("Order not found");
|
|
34
|
+
}
|
|
35
|
+
if (response.status === 200) {
|
|
36
|
+
return response.data;
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Unknown response status: ${response.status}`);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
context.log.error("Error while fetching order details", { error });
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateShopUser = exports.updatePassword = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
var _sanitizationHelpers = require("../../../helpers/sanitizationHelpers.cjs");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const updateShopUser = async function updateShopUser2(payload, context) {
|
|
11
|
+
const shopId = context.shopId;
|
|
12
|
+
const accessHeader = context.checkout.accessHeader;
|
|
13
|
+
const checkoutUrl = context.checkout.url;
|
|
14
|
+
const updatedUser = (0, _sanitizationHelpers.sanitize)({
|
|
15
|
+
email: payload.email,
|
|
16
|
+
phone: payload.phone,
|
|
17
|
+
firstName: payload.firstName,
|
|
18
|
+
lastName: payload.lastName,
|
|
19
|
+
birthDate: payload.birthDate,
|
|
20
|
+
gender: payload.gender,
|
|
21
|
+
title: payload.title
|
|
22
|
+
});
|
|
23
|
+
if (!context.user) {
|
|
24
|
+
const message = "Unauthorized request: Missing access token";
|
|
25
|
+
context.log.error(message);
|
|
26
|
+
throw new Error(message);
|
|
27
|
+
}
|
|
28
|
+
const user = {
|
|
29
|
+
...context.user,
|
|
30
|
+
...updatedUser
|
|
31
|
+
};
|
|
32
|
+
const contactUrl = `${checkoutUrl}/api/customer/contact`;
|
|
33
|
+
const personalUrl = `${checkoutUrl}/api/customer/personal`;
|
|
34
|
+
const headers = {
|
|
35
|
+
Authorization: `Bearer ${context.accessToken}`,
|
|
36
|
+
"X-Shop-Id": shopId,
|
|
37
|
+
"Content-Type": "application/json",
|
|
38
|
+
...(accessHeader ? {
|
|
39
|
+
"X-Access-Header": accessHeader
|
|
40
|
+
} : {})
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
const contactResponse = await _axios.default.patch(contactUrl, {
|
|
44
|
+
email: user?.email,
|
|
45
|
+
phone: user?.phone
|
|
46
|
+
}, {
|
|
47
|
+
headers
|
|
48
|
+
});
|
|
49
|
+
if (contactResponse.status === 404) {
|
|
50
|
+
throw new Error("Failed to update user's contact information");
|
|
51
|
+
}
|
|
52
|
+
if (contactResponse.status === 200) {
|
|
53
|
+
const personalResponse = await _axios.default.patch(personalUrl, {
|
|
54
|
+
firstName: user?.firstName,
|
|
55
|
+
lastName: user?.lastName,
|
|
56
|
+
birthDate: user?.birthDate,
|
|
57
|
+
...(user?.gender && {
|
|
58
|
+
gender: user?.gender
|
|
59
|
+
}),
|
|
60
|
+
...(user?.title && {
|
|
61
|
+
title: user?.title
|
|
62
|
+
})
|
|
63
|
+
}, {
|
|
64
|
+
headers
|
|
65
|
+
});
|
|
66
|
+
if (personalResponse.status === 404) {
|
|
67
|
+
throw new Error("Failed to update user's personal information");
|
|
68
|
+
}
|
|
69
|
+
if (personalResponse.status === 200) {
|
|
70
|
+
context.updateUser(user);
|
|
71
|
+
return {
|
|
72
|
+
user
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
context.log.error("Error while updating user information", error);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
user
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
exports.updateShopUser = updateShopUser;
|
|
85
|
+
const updatePassword = async function updatePassword2({
|
|
86
|
+
oldPassword,
|
|
87
|
+
newPassword
|
|
88
|
+
}, context) {
|
|
89
|
+
const shopUser = context.user;
|
|
90
|
+
try {
|
|
91
|
+
const apiResponse = await _axios.default.put(`${context.checkout.url}/api/oauth/customer/password`, {
|
|
92
|
+
password: oldPassword,
|
|
93
|
+
newPassword
|
|
94
|
+
}, {
|
|
95
|
+
headers: {
|
|
96
|
+
Authorization: `Bearer ${context.accessToken}`,
|
|
97
|
+
"X-Shop-Id": context.shopId,
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
...(context.checkout.accessHeader ? {
|
|
100
|
+
"X-Access-Header": context.checkout.accessHeader
|
|
101
|
+
} : {})
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
if (apiResponse.status === 200) {
|
|
105
|
+
if (shopUser?.id) {
|
|
106
|
+
await context.destroySessionsForUserId(shopUser.id, [context.sessionId]);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
user: apiResponse.data
|
|
110
|
+
};
|
|
111
|
+
} else if (apiResponse.status === 401) {
|
|
112
|
+
throw new Error("401 - Failed to update user's password - Unauthorized request");
|
|
113
|
+
} else if (apiResponse.status === 403) {
|
|
114
|
+
throw new Error("403 - Failed to update user's password - Invalid auth");
|
|
115
|
+
} else if (apiResponse.status === 404) {
|
|
116
|
+
throw new Error("404 - Failed to update user's password - User not found");
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
context.log.error("Error while updating user's password", error);
|
|
120
|
+
throw new Error(error);
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
user: shopUser
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
exports.updatePassword = updatePassword;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UpdatePasswordParams, RpcHandler, ShopUser } from '../../../types';
|
|
2
|
+
export declare const updateShopUser: RpcHandler<Partial<ShopUser>, {
|
|
3
|
+
user: ShopUser;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const updatePassword: RpcHandler<UpdatePasswordParams, {
|
|
6
|
+
user: ShopUser;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { sanitize } from "../../../helpers/sanitizationHelpers.mjs";
|
|
3
|
+
export const updateShopUser = async function updateShopUser2(payload, context) {
|
|
4
|
+
const shopId = context.shopId;
|
|
5
|
+
const accessHeader = context.checkout.accessHeader;
|
|
6
|
+
const checkoutUrl = context.checkout.url;
|
|
7
|
+
const updatedUser = sanitize({
|
|
8
|
+
email: payload.email,
|
|
9
|
+
phone: payload.phone,
|
|
10
|
+
firstName: payload.firstName,
|
|
11
|
+
lastName: payload.lastName,
|
|
12
|
+
birthDate: payload.birthDate,
|
|
13
|
+
gender: payload.gender,
|
|
14
|
+
title: payload.title
|
|
15
|
+
});
|
|
16
|
+
if (!context.user) {
|
|
17
|
+
const message = "Unauthorized request: Missing access token";
|
|
18
|
+
context.log.error(message);
|
|
19
|
+
throw new Error(message);
|
|
20
|
+
}
|
|
21
|
+
const user = {
|
|
22
|
+
...context.user,
|
|
23
|
+
...updatedUser
|
|
24
|
+
};
|
|
25
|
+
const contactUrl = `${checkoutUrl}/api/customer/contact`;
|
|
26
|
+
const personalUrl = `${checkoutUrl}/api/customer/personal`;
|
|
27
|
+
const headers = {
|
|
28
|
+
Authorization: `Bearer ${context.accessToken}`,
|
|
29
|
+
"X-Shop-Id": shopId,
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
...accessHeader ? { "X-Access-Header": accessHeader } : {}
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
const contactResponse = await axios.patch(
|
|
35
|
+
contactUrl,
|
|
36
|
+
{
|
|
37
|
+
email: user?.email,
|
|
38
|
+
phone: user?.phone
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
headers
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
if (contactResponse.status === 404) {
|
|
45
|
+
throw new Error("Failed to update user's contact information");
|
|
46
|
+
}
|
|
47
|
+
if (contactResponse.status === 200) {
|
|
48
|
+
const personalResponse = await axios.patch(
|
|
49
|
+
personalUrl,
|
|
50
|
+
{
|
|
51
|
+
firstName: user?.firstName,
|
|
52
|
+
lastName: user?.lastName,
|
|
53
|
+
birthDate: user?.birthDate,
|
|
54
|
+
...user?.gender && { gender: user?.gender },
|
|
55
|
+
...user?.title && { title: user?.title }
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
headers
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
if (personalResponse.status === 404) {
|
|
62
|
+
throw new Error("Failed to update user's personal information");
|
|
63
|
+
}
|
|
64
|
+
if (personalResponse.status === 200) {
|
|
65
|
+
context.updateUser(user);
|
|
66
|
+
return { user };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
context.log.error("Error while updating user information", error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
return { user };
|
|
74
|
+
};
|
|
75
|
+
export const updatePassword = async function updatePassword2({ oldPassword, newPassword }, context) {
|
|
76
|
+
const shopUser = context.user;
|
|
77
|
+
try {
|
|
78
|
+
const apiResponse = await axios.put(
|
|
79
|
+
`${context.checkout.url}/api/oauth/customer/password`,
|
|
80
|
+
{ password: oldPassword, newPassword },
|
|
81
|
+
{
|
|
82
|
+
headers: {
|
|
83
|
+
Authorization: `Bearer ${context.accessToken}`,
|
|
84
|
+
"X-Shop-Id": context.shopId,
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
...context.checkout.accessHeader ? { "X-Access-Header": context.checkout.accessHeader } : {}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
if (apiResponse.status === 200) {
|
|
91
|
+
if (shopUser?.id) {
|
|
92
|
+
await context.destroySessionsForUserId(shopUser.id, [context.sessionId]);
|
|
93
|
+
}
|
|
94
|
+
return { user: apiResponse.data };
|
|
95
|
+
} else if (apiResponse.status === 401) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
"401 - Failed to update user's password - Unauthorized request"
|
|
98
|
+
);
|
|
99
|
+
} else if (apiResponse.status === 403) {
|
|
100
|
+
throw new Error("403 - Failed to update user's password - Invalid auth");
|
|
101
|
+
} else if (apiResponse.status === 404) {
|
|
102
|
+
throw new Error("404 - Failed to update user's password - User not found");
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
context.log.error("Error while updating user's password", error);
|
|
106
|
+
throw new Error(error);
|
|
107
|
+
}
|
|
108
|
+
return { user: shopUser };
|
|
109
|
+
};
|