@scayle/storefront-core 7.23.0 → 7.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Remove `sanitize` helper function and jsdom dependency
8
+
3
9
  ## 7.23.0
4
10
 
5
11
  ### Minor Changes
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CacheProvider = void 0;
7
- const CacheProvider = {
7
+ const CacheProvider = exports.CacheProvider = {
8
8
  REDIS: "redis",
9
9
  UNSTORAGE: "unstorage"
10
- };
11
- exports.CacheProvider = CacheProvider;
10
+ };
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExistingItemHandling = void 0;
7
- const ExistingItemHandling = {
7
+ const ExistingItemHandling = exports.ExistingItemHandling = {
8
8
  KeepExisting: 0,
9
9
  AddQuantityToExisting: 1,
10
10
  ReplaceExisting: 2,
11
11
  ReplaceExistingWithCombinedQuantity: 3
12
- };
13
- exports.ExistingItemHandling = ExistingItemHandling;
12
+ };
@@ -4,5 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CACHE_TIMEOUT = void 0;
7
- const CACHE_TIMEOUT = 500;
8
- exports.CACHE_TIMEOUT = CACHE_TIMEOUT;
7
+ const CACHE_TIMEOUT = exports.CACHE_TIMEOUT = 500;
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.HashAlgorithm = void 0;
7
- const HashAlgorithm = {
7
+ const HashAlgorithm = exports.HashAlgorithm = {
8
8
  MD5: "md5",
9
9
  SHA256: "sha256"
10
- };
11
- exports.HashAlgorithm = HashAlgorithm;
10
+ };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.HttpStatusMessage = exports.HttpStatusCode = void 0;
7
- const HttpStatusCode = {
7
+ const HttpStatusCode = exports.HttpStatusCode = {
8
8
  /**
9
9
  * The server has received the request headers and the client should proceed to send the request body
10
10
  * (in the case of a request for which a body needs to be sent; for example, a POST request).
@@ -318,8 +318,7 @@ const HttpStatusCode = {
318
318
  */
319
319
  NETWORK_AUTHENTICATION_REQUIRED: 511
320
320
  };
321
- exports.HttpStatusCode = HttpStatusCode;
322
- const HttpStatusMessage = {
321
+ const HttpStatusMessage = exports.HttpStatusMessage = {
323
322
  /**
324
323
  * The server has received the request headers and the client should proceed to send the request body
325
324
  * (in the case of a request for which a body needs to be sent; for example, a POST request).
@@ -632,5 +631,4 @@ const HttpStatusMessage = {
632
631
  * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
633
632
  */
634
633
  NETWORK_AUTHENTICATION_REQUIRED: "NETWORK AUTHENTICATION REQUIRED"
635
- };
636
- exports.HttpStatusMessage = HttpStatusMessage;
634
+ };
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ProductImageType = void 0;
7
- const ProductImageType = {
7
+ const ProductImageType = exports.ProductImageType = {
8
8
  MODEL: "model",
9
9
  BUST: "bust"
10
- };
11
- exports.ProductImageType = ProductImageType;
10
+ };
@@ -4,7 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PROMOTION_PER_PAGE_DEFAULT = exports.PROMOTION_PAGE_DEFAULT = void 0;
7
- const PROMOTION_PAGE_DEFAULT = 1;
8
- exports.PROMOTION_PAGE_DEFAULT = PROMOTION_PAGE_DEFAULT;
9
- const PROMOTION_PER_PAGE_DEFAULT = 100;
10
- exports.PROMOTION_PER_PAGE_DEFAULT = PROMOTION_PER_PAGE_DEFAULT;
7
+ const PROMOTION_PAGE_DEFAULT = exports.PROMOTION_PAGE_DEFAULT = 1;
8
+ const PROMOTION_PER_PAGE_DEFAULT = exports.PROMOTION_PER_PAGE_DEFAULT = 100;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SortQuery = exports.SortName = void 0;
7
- const SortName = {
7
+ const SortName = exports.SortName = {
8
8
  TOPSELLER: "topseller",
9
9
  DATE_NEWEST: "date_newest",
10
10
  PRICE_DESC: "price_desc",
@@ -12,13 +12,11 @@ const SortName = {
12
12
  REDUCTION_DESC: "reduction_desc",
13
13
  REDUCTION_ASC: "reduction_asc"
14
14
  };
15
- exports.SortName = SortName;
16
- const SortQuery = {
15
+ const SortQuery = exports.SortQuery = {
17
16
  TOPSELLER: "topseller",
18
17
  DATE_NEWEST: "date-newest",
19
18
  PRICE_DESC: "price-desc",
20
19
  PRICE_ASC: "price-asc",
21
20
  REDUCTION_DESC: "reduction-desc",
22
21
  REDUCTION_ASC: "reduction-asc"
23
- };
24
- exports.SortQuery = SortQuery;
22
+ };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MIN_WITH_PARAMS_WISHLIST = exports.MIN_WITH_PARAMS_VARIANT = exports.MIN_WITH_PARAMS_SEARCH = exports.MIN_WITH_PARAMS_PRODUCT = exports.MIN_WITH_PARAMS_BASKET = exports.DEFAULT_WITH_LISTING = void 0;
7
- const DEFAULT_WITH_LISTING = {
7
+ const DEFAULT_WITH_LISTING = exports.DEFAULT_WITH_LISTING = {
8
8
  items: {
9
9
  product: {
10
10
  attributes: "all",
@@ -24,8 +24,7 @@ const DEFAULT_WITH_LISTING = {
24
24
  }
25
25
  }
26
26
  };
27
- exports.DEFAULT_WITH_LISTING = DEFAULT_WITH_LISTING;
28
- const MIN_WITH_PARAMS_SEARCH = {
27
+ const MIN_WITH_PARAMS_SEARCH = exports.MIN_WITH_PARAMS_SEARCH = {
29
28
  products: {
30
29
  attributes: {
31
30
  withKey: ["brand", "color", "colorDetail", "name"]
@@ -40,8 +39,7 @@ const MIN_WITH_PARAMS_SEARCH = {
40
39
  }
41
40
  }
42
41
  };
43
- exports.MIN_WITH_PARAMS_SEARCH = MIN_WITH_PARAMS_SEARCH;
44
- const MIN_WITH_PARAMS_PRODUCT = {
42
+ const MIN_WITH_PARAMS_PRODUCT = exports.MIN_WITH_PARAMS_PRODUCT = {
45
43
  attributes: {
46
44
  withKey: ["color", "brand", "name", "material", "careSymbol"]
47
45
  },
@@ -69,8 +67,7 @@ const MIN_WITH_PARAMS_PRODUCT = {
69
67
  }
70
68
  }
71
69
  };
72
- exports.MIN_WITH_PARAMS_PRODUCT = MIN_WITH_PARAMS_PRODUCT;
73
- const MIN_WITH_PARAMS_BASKET = {
70
+ const MIN_WITH_PARAMS_BASKET = exports.MIN_WITH_PARAMS_BASKET = {
74
71
  items: {
75
72
  product: {
76
73
  attributes: {
@@ -99,8 +96,7 @@ const MIN_WITH_PARAMS_BASKET = {
99
96
  }
100
97
  }
101
98
  };
102
- exports.MIN_WITH_PARAMS_BASKET = MIN_WITH_PARAMS_BASKET;
103
- const MIN_WITH_PARAMS_WISHLIST = {
99
+ const MIN_WITH_PARAMS_WISHLIST = exports.MIN_WITH_PARAMS_WISHLIST = {
104
100
  items: {
105
101
  product: {
106
102
  attributes: {
@@ -129,10 +125,8 @@ const MIN_WITH_PARAMS_WISHLIST = {
129
125
  }
130
126
  }
131
127
  };
132
- exports.MIN_WITH_PARAMS_WISHLIST = MIN_WITH_PARAMS_WISHLIST;
133
- const MIN_WITH_PARAMS_VARIANT = {
128
+ const MIN_WITH_PARAMS_VARIANT = exports.MIN_WITH_PARAMS_VARIANT = {
134
129
  attributes: {
135
130
  withKey: ["size", "shopSize", "vendorSize"]
136
131
  }
137
- };
138
- exports.MIN_WITH_PARAMS_VARIANT = MIN_WITH_PARAMS_VARIANT;
132
+ };
@@ -7,7 +7,7 @@ exports.productFromEDT = exports.product = exports.priceFixtureWithReductions =
7
7
  const BILD_HINTERGRUND_LABEL = "Bild Hintergrund";
8
8
  const CREATED_AT = "2022-04-26T15:04:56+00:00";
9
9
  const WOMEN_CLOTHING_CATEGORY_URL = "/women/kleidung";
10
- const product = {
10
+ const product = exports.product = {
11
11
  id: 6,
12
12
  isActive: true,
13
13
  isSoldOut: false,
@@ -178,8 +178,7 @@ const product = {
178
178
  categoryProperties: []
179
179
  }]]
180
180
  };
181
- exports.product = product;
182
- const productFromEDT = {
181
+ const productFromEDT = exports.productFromEDT = {
183
182
  id: 5703863,
184
183
  isActive: true,
185
184
  isSoldOut: false,
@@ -763,8 +762,5 @@ const productFromEDT = {
763
762
  categoryProperties: []
764
763
  }]]
765
764
  };
766
- exports.productFromEDT = productFromEDT;
767
- const priceFixture = product.variants[0].price;
768
- exports.priceFixture = priceFixture;
769
- const priceFixtureWithReductions = productFromEDT.variants[0].price;
770
- exports.priceFixtureWithReductions = priceFixtureWithReductions;
765
+ const priceFixture = exports.priceFixture = product.variants[0].price;
766
+ const priceFixtureWithReductions = exports.priceFixtureWithReductions = productFromEDT.variants[0].price;
@@ -3,13 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.stripShopLocaleFromPath = exports.sanitize = void 0;
7
- var _isomorphicDompurify = _interopRequireDefault(require("isomorphic-dompurify"));
8
- var _radash = require("radash");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const sanitize = payload => {
11
- return (0, _radash.mapValues)(payload, value => value && _isomorphicDompurify.default.sanitize(value));
12
- };
13
- exports.sanitize = sanitize;
6
+ exports.stripShopLocaleFromPath = void 0;
14
7
  const stripShopLocaleFromPath = (locale, path, splitter = "/") => path.split(splitter).filter(segment => segment.toLowerCase() !== locale.toLowerCase()).join("/");
15
8
  exports.stripShopLocaleFromPath = stripShopLocaleFromPath;
@@ -1,2 +1 @@
1
- export declare const sanitize: <T extends Record<string, string | undefined>>(payload: T) => Record<string, any>;
2
1
  export declare const stripShopLocaleFromPath: (locale: string, path: string, splitter?: string) => string;
@@ -1,6 +1 @@
1
- import DOMPurify from "isomorphic-dompurify";
2
- import { mapValues } from "radash";
3
- export const sanitize = (payload) => {
4
- return mapValues(payload, (value) => value && DOMPurify.sanitize(value));
5
- };
6
1
  export const stripShopLocaleFromPath = (locale, path, splitter = "/") => path.split(splitter).filter((segment) => segment.toLowerCase() !== locale.toLowerCase()).join("/");
package/dist/index.cjs CHANGED
@@ -81,5 +81,5 @@ Object.keys(_types).forEach(function (key) {
81
81
  }
82
82
  });
83
83
  });
84
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
85
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
84
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
85
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -11,7 +11,7 @@ const BAPI_ERROR_NAME = "BAPI ERROR";
11
11
  function getWithParams(params, context) {
12
12
  return params.with ?? context.withParams?.basket ?? _constants.MIN_WITH_PARAMS_BASKET;
13
13
  }
14
- const addItemToBasket = async function addItemToBasket2({
14
+ const addItemToBasket = exports.addItemToBasket = async function addItemToBasket2({
15
15
  variantId,
16
16
  promotionId,
17
17
  quantity,
@@ -61,8 +61,7 @@ const addItemToBasket = async function addItemToBasket2({
61
61
  throw new _errors.BAPIError(BAPI_ERROR_NAME, statusCode, message, "addItemToBasket:bapiClient.basket.addOrUpdateItems");
62
62
  }
63
63
  };
64
- exports.addItemToBasket = addItemToBasket;
65
- const addItemsToBasket = async function addItemsToBasket2(params, context) {
64
+ const addItemsToBasket = exports.addItemsToBasket = async function addItemsToBasket2(params, context) {
66
65
  const {
67
66
  campaignKey,
68
67
  bapiClient,
@@ -104,8 +103,7 @@ const addItemsToBasket = async function addItemsToBasket2(params, context) {
104
103
  throw new _errors.BAPIError(BAPI_ERROR_NAME, statusCode, message, "addItemsToBasket:bapiClient.basket.addOrUpdateItems");
105
104
  }
106
105
  };
107
- exports.addItemsToBasket = addItemsToBasket;
108
- const getBasket = async function getBasket2(options, context) {
106
+ const getBasket = exports.getBasket = async function getBasket2(options, context) {
109
107
  const {
110
108
  bapiClient,
111
109
  campaignKey,
@@ -128,8 +126,7 @@ const getBasket = async function getBasket2(options, context) {
128
126
  }
129
127
  return response.basket;
130
128
  };
131
- exports.getBasket = getBasket;
132
- const removeItemFromBasket = async function removeItemFromBasket2(options, context) {
129
+ const removeItemFromBasket = exports.removeItemFromBasket = async function removeItemFromBasket2(options, context) {
133
130
  const {
134
131
  bapiClient,
135
132
  campaignKey,
@@ -142,8 +139,7 @@ const removeItemFromBasket = async function removeItemFromBasket2(options, conte
142
139
  includeItemsWithoutProductData: resolvedWith?.includeItemsWithoutProductData
143
140
  });
144
141
  };
145
- exports.removeItemFromBasket = removeItemFromBasket;
146
- const clearBasket = async function clearBasket2(context) {
142
+ const clearBasket = exports.clearBasket = async function clearBasket2(context) {
147
143
  const basket = await getBasket({}, context);
148
144
  await Promise.all(basket.items.map(async item => {
149
145
  await removeItemFromBasket({
@@ -153,8 +149,7 @@ const clearBasket = async function clearBasket2(context) {
153
149
  context.log.debug("The basket has been cleared");
154
150
  return true;
155
151
  };
156
- exports.clearBasket = clearBasket;
157
- const mergeBaskets = async function mergeBaskets2({
152
+ const mergeBaskets = exports.mergeBaskets = async function mergeBaskets2({
158
153
  fromBasketKey,
159
154
  toBasketKey,
160
155
  with: _with
@@ -164,7 +159,6 @@ const mergeBaskets = async function mergeBaskets2({
164
159
  }, context);
165
160
  return await (0, _user.mergeBaskets)(fromBasketKey, toBasketKey, resolvedWith, context);
166
161
  };
167
- exports.mergeBaskets = mergeBaskets;
168
162
  function parseBasketError(response) {
169
163
  if (response.type === "failure") {
170
164
  const parsedError = {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getBrands = exports.getBrandById = void 0;
7
7
  const MAX_PER_PAGE = 100;
8
- const getBrands = async function getBrands2({
8
+ const getBrands = exports.getBrands = async function getBrands2({
9
9
  pagination
10
10
  }, {
11
11
  bapiClient,
@@ -20,8 +20,7 @@ const getBrands = async function getBrands2({
20
20
  }
21
21
  });
22
22
  };
23
- exports.getBrands = getBrands;
24
- const getBrandById = async function getBrandById2({
23
+ const getBrandById = exports.getBrandById = async function getBrandById2({
25
24
  brandId
26
25
  }, {
27
26
  bapiClient,
@@ -30,5 +29,4 @@ const getBrandById = async function getBrandById2({
30
29
  return await cached(bapiClient.brands.getById, {
31
30
  cacheKeyPrefix: `getBrandById-${brandId}`
32
31
  })(brandId);
33
- };
34
- exports.getBrandById = getBrandById;
32
+ };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getRootCategories = exports.getCategoryById = exports.getCategoriesByPath = void 0;
7
7
  var _helpers = require("../../helpers/index.cjs");
8
- const getRootCategories = async function getRootCategories2({
8
+ const getRootCategories = exports.getRootCategories = async function getRootCategories2({
9
9
  children = 1,
10
10
  includeHidden
11
11
  }, {
@@ -25,8 +25,7 @@ const getRootCategories = async function getRootCategories2({
25
25
  activeNode: void 0
26
26
  };
27
27
  };
28
- exports.getRootCategories = getRootCategories;
29
- const getCategoriesByPath = async function getCategoriesByPath2({
28
+ const getCategoriesByPath = exports.getCategoriesByPath = async function getCategoriesByPath2({
30
29
  path,
31
30
  children = 1,
32
31
  includeHidden
@@ -79,8 +78,7 @@ const getCategoriesByPath = async function getCategoriesByPath2({
79
78
  activeNode: result
80
79
  };
81
80
  };
82
- exports.getCategoriesByPath = getCategoriesByPath;
83
- const getCategoryById = async function getCategoryById2({
81
+ const getCategoryById = exports.getCategoryById = async function getCategoryById2({
84
82
  id,
85
83
  children = 1,
86
84
  includeHidden
@@ -98,5 +96,4 @@ const getCategoryById = async function getCategoryById2({
98
96
  },
99
97
  includeHidden
100
98
  });
101
- };
102
- exports.getCategoryById = getCategoryById;
99
+ };
@@ -7,7 +7,7 @@ exports.getOrderDataByCbd = void 0;
7
7
  var _axios = _interopRequireDefault(require("axios"));
8
8
  var _hash = require("../../utils/hash.cjs");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const getOrderDataByCbd = async function getOrderDataByCbd2({
10
+ const getOrderDataByCbd = exports.getOrderDataByCbd = async function getOrderDataByCbd2({
11
11
  cbdToken
12
12
  }, context) {
13
13
  if (!cbdToken) {
@@ -41,5 +41,4 @@ const getOrderDataByCbd = async function getOrderDataByCbd2({
41
41
  });
42
42
  return orderSuccessData;
43
43
  }
44
- };
45
- exports.getOrderDataByCbd = getOrderDataByCbd;
44
+ };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getOrderById = void 0;
7
7
  var _axios = _interopRequireDefault(require("axios"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- const getOrderById = async function getOrderById2({
9
+ const getOrderById = exports.getOrderById = async function getOrderById2({
10
10
  orderId
11
11
  }, context) {
12
12
  const accessToken = context.accessToken;
@@ -51,5 +51,4 @@ const getOrderById = async function getOrderById2({
51
51
  });
52
52
  throw error;
53
53
  }
54
- };
55
- exports.getOrderById = getOrderById;
54
+ };
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.updateShopUser = exports.updatePassword = void 0;
7
7
  var _axios = _interopRequireDefault(require("axios"));
8
- var _sanitizationHelpers = require("../../../helpers/sanitizationHelpers.cjs");
9
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const updateShopUser = async function updateShopUser2(payload, context) {
9
+ const updateShopUser = exports.updateShopUser = async function updateShopUser2(payload, context) {
11
10
  const shopId = context.shopId;
12
11
  const accessHeader = context.checkout.accessHeader;
13
12
  const checkoutUrl = context.checkout.url;
14
- const updatedUser = (0, _sanitizationHelpers.sanitize)({
13
+ const updatedUser = {
15
14
  email: payload.email,
16
15
  phone: payload.phone,
17
16
  firstName: payload.firstName,
@@ -19,7 +18,7 @@ const updateShopUser = async function updateShopUser2(payload, context) {
19
18
  birthDate: payload.birthDate,
20
19
  gender: payload.gender,
21
20
  title: payload.title
22
- });
21
+ };
23
22
  if (!context.user) {
24
23
  const message = "Unauthorized request: Missing access token";
25
24
  context.log.error(message);
@@ -81,8 +80,7 @@ const updateShopUser = async function updateShopUser2(payload, context) {
81
80
  user
82
81
  };
83
82
  };
84
- exports.updateShopUser = updateShopUser;
85
- const updatePassword = async function updatePassword2({
83
+ const updatePassword = exports.updatePassword = async function updatePassword2({
86
84
  oldPassword,
87
85
  newPassword
88
86
  }, context) {
@@ -122,5 +120,4 @@ const updatePassword = async function updatePassword2({
122
120
  return {
123
121
  user: shopUser
124
122
  };
125
- };
126
- exports.updatePassword = updatePassword;
123
+ };
@@ -1,10 +1,9 @@
1
1
  import axios from "axios";
2
- import { sanitize } from "../../../helpers/sanitizationHelpers.mjs";
3
2
  export const updateShopUser = async function updateShopUser2(payload, context) {
4
3
  const shopId = context.shopId;
5
4
  const accessHeader = context.checkout.accessHeader;
6
5
  const checkoutUrl = context.checkout.url;
7
- const updatedUser = sanitize({
6
+ const updatedUser = {
8
7
  email: payload.email,
9
8
  phone: payload.phone,
10
9
  firstName: payload.firstName,
@@ -12,7 +11,7 @@ export const updateShopUser = async function updateShopUser2(payload, context) {
12
11
  birthDate: payload.birthDate,
13
12
  gender: payload.gender,
14
13
  title: payload.title
15
- });
14
+ };
16
15
  if (!context.user) {
17
16
  const message = "Unauthorized request: Missing access token";
18
17
  context.log.error(message);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getShopUserAddresses = void 0;
7
7
  var _axios = _interopRequireDefault(require("axios"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- const getShopUserAddresses = async function getShopUserAddresses2(context) {
9
+ const getShopUserAddresses = exports.getShopUserAddresses = async function getShopUserAddresses2(context) {
10
10
  const shopId = context.shopId;
11
11
  const accessHeader = context.checkout.accessHeader;
12
12
  const checkoutUrl = context.checkout.url;
@@ -21,5 +21,4 @@ const getShopUserAddresses = async function getShopUserAddresses2(context) {
21
21
  }
22
22
  });
23
23
  return response.data.entities;
24
- };
25
- exports.getShopUserAddresses = getShopUserAddresses;
24
+ };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.fetchNavigationTreeById = exports.fetchAllNavigationTrees = void 0;
7
- const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({
7
+ const fetchAllNavigationTrees = exports.fetchAllNavigationTrees = async function fetchAllNavigationTrees2({
8
8
  params
9
9
  }, {
10
10
  bapiClient: {
@@ -16,8 +16,7 @@ const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({
16
16
  cacheKeyPrefix: "getAll-navigation-trees"
17
17
  })(params);
18
18
  };
19
- exports.fetchAllNavigationTrees = fetchAllNavigationTrees;
20
- const fetchNavigationTreeById = async function fetchNavigationTreeById2({
19
+ const fetchNavigationTreeById = exports.fetchNavigationTreeById = async function fetchNavigationTreeById2({
21
20
  treeId,
22
21
  params
23
22
  }, {
@@ -29,5 +28,4 @@ const fetchNavigationTreeById = async function fetchNavigationTreeById2({
29
28
  return await cached(navigation.getById, {
30
29
  cacheKeyPrefix: `getById-navigation-trees-${treeId}`
31
30
  })(treeId, params);
32
- };
33
- exports.fetchNavigationTreeById = fetchNavigationTreeById;
31
+ };
@@ -7,7 +7,7 @@ exports.getProductsCount = exports.getProductsByIds = exports.getProductsByCateg
7
7
  var _helpers = require("../../helpers/index.cjs");
8
8
  var _constants = require("../../constants/index.cjs");
9
9
  const MAX_PER_PAGE = 100;
10
- const getProductById = async function getProductById2(options, {
10
+ const getProductById = exports.getProductById = async function getProductById2(options, {
11
11
  bapiClient,
12
12
  cached,
13
13
  campaignKey,
@@ -22,8 +22,7 @@ const getProductById = async function getProductById2(options, {
22
22
  includeSellableForFree: options.includeSellableForFree
23
23
  });
24
24
  };
25
- exports.getProductById = getProductById;
26
- const getProductsByIds = async function getProductsByIds2(options, {
25
+ const getProductsByIds = exports.getProductsByIds = async function getProductsByIds2(options, {
27
26
  bapiClient,
28
27
  cached,
29
28
  campaignKey,
@@ -38,8 +37,7 @@ const getProductsByIds = async function getProductsByIds2(options, {
38
37
  includeSellableForFree: options.includeSellableForFree
39
38
  });
40
39
  };
41
- exports.getProductsByIds = getProductsByIds;
42
- const getProductsByCategory = async function getProductsByCategory2({
40
+ const getProductsByCategory = exports.getProductsByCategory = async function getProductsByCategory2({
43
41
  category = "/",
44
42
  cache,
45
43
  with: _with,
@@ -106,8 +104,7 @@ const getProductsByCategory = async function getProductsByCategory2({
106
104
  pagination
107
105
  };
108
106
  };
109
- exports.getProductsByCategory = getProductsByCategory;
110
- const getFilters = async function getFilters2({
107
+ const getFilters = exports.getFilters = async function getFilters2({
111
108
  category = "/",
112
109
  includedFilters,
113
110
  where = void 0,
@@ -179,8 +176,7 @@ const getFilters = async function getFilters2({
179
176
  unfilteredCount: productCount?.pagination.total
180
177
  };
181
178
  };
182
- exports.getFilters = getFilters;
183
- const fetchAllFiltersForCategory = async function fetchAllFiltersForCategory2({
179
+ const fetchAllFiltersForCategory = exports.fetchAllFiltersForCategory = async function fetchAllFiltersForCategory2({
184
180
  includedFilters = [],
185
181
  category
186
182
  }, {
@@ -204,8 +200,7 @@ const fetchAllFiltersForCategory = async function fetchAllFiltersForCategory2({
204
200
  cacheKey: `filters-for-category-${category.slug}`
205
201
  })();
206
202
  };
207
- exports.fetchAllFiltersForCategory = fetchAllFiltersForCategory;
208
- const getProductsCount = async function getProductsCount2({
203
+ const getProductsCount = exports.getProductsCount = async function getProductsCount2({
209
204
  category = "/",
210
205
  categoryId = void 0,
211
206
  where = void 0,
@@ -246,7 +241,6 @@ const getProductsCount = async function getProductsCount2({
246
241
  count: productCount?.pagination.total
247
242
  };
248
243
  };
249
- exports.getProductsCount = getProductsCount;
250
244
  const sanitizeAttributesForBAPI = ({
251
245
  attributes,
252
246
  filterKeys,
@@ -11,7 +11,7 @@ const setPaginationDefault = pagination => {
11
11
  perPage: pagination?.perPage || _constants.PROMOTION_PER_PAGE_DEFAULT
12
12
  };
13
13
  };
14
- const getPromotions = async function getPromotions2(params = {}, context) {
14
+ const getPromotions = exports.getPromotions = async function getPromotions2(params = {}, context) {
15
15
  const {
16
16
  bapiClient,
17
17
  cached
@@ -23,8 +23,7 @@ const getPromotions = async function getPromotions2(params = {}, context) {
23
23
  pagination: setPaginationDefault(params.pagination)
24
24
  });
25
25
  };
26
- exports.getPromotions = getPromotions;
27
- const getCurrentPromotions = async function getCurrentPromotions2(params = {}, context) {
26
+ const getCurrentPromotions = exports.getCurrentPromotions = async function getCurrentPromotions2(params = {}, context) {
28
27
  const {
29
28
  bapiClient,
30
29
  cached
@@ -40,8 +39,7 @@ const getCurrentPromotions = async function getCurrentPromotions2(params = {}, c
40
39
  pagination: setPaginationDefault(params.pagination)
41
40
  });
42
41
  };
43
- exports.getCurrentPromotions = getCurrentPromotions;
44
- const getPromotionsByIds = async function getPromotionsByIds2(ids, context) {
42
+ const getPromotionsByIds = exports.getPromotionsByIds = async function getPromotionsByIds2(ids, context) {
45
43
  const {
46
44
  bapiClient,
47
45
  cached
@@ -49,5 +47,4 @@ const getPromotionsByIds = async function getPromotionsByIds2(ids, context) {
49
47
  return await cached(bapiClient.promotions.getByIds, {
50
48
  cacheKeyPrefix: "getByIds-promotions"
51
49
  })(ids);
52
- };
53
- exports.getPromotionsByIds = getPromotionsByIds;
50
+ };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.searchProducts = void 0;
7
7
  var _constants = require("../../constants/index.cjs");
8
8
  var _stringHelpers = require("../../helpers/stringHelpers.cjs");
9
- const searchProducts = async function searchProducts2({
9
+ const searchProducts = exports.searchProducts = async function searchProducts2({
10
10
  term,
11
11
  slug,
12
12
  with: _with,
@@ -25,7 +25,6 @@ const searchProducts = async function searchProducts2({
25
25
  with: _with ?? withParams?.search ?? _constants.MIN_WITH_PARAMS_SEARCH
26
26
  });
27
27
  };
28
- exports.searchProducts = searchProducts;
29
28
  const getCategoryId = async (cached, bapiClient, slug) => {
30
29
  if (!slug) {
31
30
  return;
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getShopConfiguration = void 0;
7
- const getShopConfiguration = async function getShopConfiguration2({
7
+ const getShopConfiguration = exports.getShopConfiguration = async function getShopConfiguration2({
8
8
  cached,
9
9
  bapiClient
10
10
  }) {
11
11
  return await cached(bapiClient.shopConfiguration.get, {
12
12
  cacheKeyPrefix: "get-shopConfigurations"
13
13
  })();
14
- };
15
- exports.getShopConfiguration = getShopConfiguration;
14
+ };
@@ -7,13 +7,12 @@ exports.refreshUser = exports.getUser = exports.fetchUser = void 0;
7
7
  var _axios = _interopRequireDefault(require("axios"));
8
8
  var _httpStatus = require("../../constants/httpStatus.cjs");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const getUser = function getUser2(context) {
10
+ const getUser = exports.getUser = function getUser2(context) {
11
11
  return {
12
12
  user: context.user
13
13
  };
14
14
  };
15
- exports.getUser = getUser;
16
- const fetchUser = async function fetchUser2(payload, options) {
15
+ const fetchUser = exports.fetchUser = async function fetchUser2(payload, options) {
17
16
  const {
18
17
  accessToken
19
18
  } = payload;
@@ -43,8 +42,7 @@ const fetchUser = async function fetchUser2(payload, options) {
43
42
  }
44
43
  };
45
44
  };
46
- exports.fetchUser = fetchUser;
47
- const refreshUser = async function refreshUser2(context) {
45
+ const refreshUser = exports.refreshUser = async function refreshUser2(context) {
48
46
  const {
49
47
  accessToken,
50
48
  checkout,
@@ -85,5 +83,4 @@ const refreshUser = async function refreshUser2(context) {
85
83
  return {
86
84
  user: void 0
87
85
  };
88
- };
89
- exports.refreshUser = refreshUser;
86
+ };
@@ -7,7 +7,7 @@ exports.getVariantById = void 0;
7
7
  const defaultWith = {
8
8
  attributes: "all"
9
9
  };
10
- const getVariantById = async function getVariantById2({
10
+ const getVariantById = exports.getVariantById = async function getVariantById2({
11
11
  ids,
12
12
  include = defaultWith,
13
13
  pricePromotionKey = "default"
@@ -25,5 +25,4 @@ const getVariantById = async function getVariantById2({
25
25
  campaignKey,
26
26
  pricePromotionKey
27
27
  } : void 0);
28
- };
29
- exports.getVariantById = getVariantById;
28
+ };
@@ -9,7 +9,7 @@ var _constants = require("../../constants/index.cjs");
9
9
  function getWithParams(params, context) {
10
10
  return params.with ?? context.withParams?.basket ?? _constants.MIN_WITH_PARAMS_WISHLIST;
11
11
  }
12
- const addItemToWishlist = async function addItemToWishlist2(options, context) {
12
+ const addItemToWishlist = exports.addItemToWishlist = async function addItemToWishlist2(options, context) {
13
13
  const {
14
14
  bapiClient,
15
15
  campaignKey,
@@ -44,8 +44,7 @@ const addItemToWishlist = async function addItemToWishlist2(options, context) {
44
44
  throw new _errors.BAPIError("BAPI ERROR", code, message, "bapiClient.wishlist.addItem");
45
45
  }
46
46
  };
47
- exports.addItemToWishlist = addItemToWishlist;
48
- const getWishlist = async function getWishlist2(options, context) {
47
+ const getWishlist = exports.getWishlist = async function getWishlist2(options, context) {
49
48
  const {
50
49
  bapiClient,
51
50
  campaignKey
@@ -59,8 +58,7 @@ const getWishlist = async function getWishlist2(options, context) {
59
58
  pricePromotionKey: resolvedWith?.pricePromotionKey ?? ""
60
59
  });
61
60
  };
62
- exports.getWishlist = getWishlist;
63
- const removeItemFromWishlist = async function removeItemFromWishlist2(options, context) {
61
+ const removeItemFromWishlist = exports.removeItemFromWishlist = async function removeItemFromWishlist2(options, context) {
64
62
  const {
65
63
  bapiClient,
66
64
  campaignKey,
@@ -72,8 +70,7 @@ const removeItemFromWishlist = async function removeItemFromWishlist2(options, c
72
70
  campaignKey
73
71
  });
74
72
  };
75
- exports.removeItemFromWishlist = removeItemFromWishlist;
76
- const clearWishlist = async function clearWishlist2(context) {
73
+ const clearWishlist = exports.clearWishlist = async function clearWishlist2(context) {
77
74
  const wishlist = await getWishlist({}, context);
78
75
  await Promise.all(wishlist.items.map(async item => {
79
76
  await removeItemFromWishlist({
@@ -81,5 +78,4 @@ const clearWishlist = async function clearWishlist2(context) {
81
78
  }, context);
82
79
  }));
83
80
  return await getWishlist({}, context);
84
- };
85
- exports.clearWishlist = clearWishlist;
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.23.0",
3
+ "version": "7.24.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -62,7 +62,6 @@
62
62
  "dependencies": {
63
63
  "@aboutyou/backbone": "15.14.1",
64
64
  "crypto-js": "4.2.0",
65
- "isomorphic-dompurify": "^1.5.0",
66
65
  "jose": "^4.14.4",
67
66
  "radash": "^11.0.0",
68
67
  "slugify": "^1.6.0",
@@ -80,7 +79,7 @@
80
79
  "@types/webpack-env": "1.18.3",
81
80
  "unbuild": "2.0.0",
82
81
  "axios": "0.27.2",
83
- "eslint": "8.52.0",
82
+ "eslint": "8.53.0",
84
83
  "eslint-formatter-gitlab": "5.0.0",
85
84
  "jest": "29.7.0",
86
85
  "jest-junit": "16.0.0",