@jetshop/core 6.0.1 → 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,12 +3,17 @@
3
3
  * @param condition
4
4
  * @param msg
5
5
  */
6
- export default function throwErrorInDev(condition, msg, info = 'n/a') {
6
+ export default function throwErrorInDev(condition, msg, info = null) {
7
7
  if (process.env.NODE_ENV !== 'production') {
8
8
  if (!condition) {
9
9
  return;
10
10
  }
11
- console.error(msg, 'Info:', info);
11
+ if (info) {
12
+ console.error(msg, 'Info:', info);
13
+ }
14
+ else {
15
+ console.error(msg);
16
+ }
12
17
  throw new Error(msg);
13
18
  }
14
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"throwErrorInDev.js","sourceRoot":"","sources":["throwErrorInDev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAkB,EAClB,GAAW,EACX,OAAY,KAAK;IAEjB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;SACR;QAED,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAElC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;KACtB;AACH,CAAC"}
1
+ {"version":3,"file":"throwErrorInDev.js","sourceRoot":"","sources":["throwErrorInDev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAkB,EAClB,GAAW,EACX,OAAY,IAAI;IAEhB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;SACR;QAED,IAAI,IAAI,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SACnC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;QAED,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;KACtB;AACH,CAAC"}
@@ -3,10 +3,15 @@ import { useContext } from 'react';
3
3
  import { useShopConfig } from './useShopConfig';
4
4
  import { usePagination } from '../components/Pagination/PaginationProvider';
5
5
  import SortOrderContext from '../components/SortOrder/SortOrderContext';
6
+ import throwErrorInDev from '@jetshop/core/helpers/throwErrorInDev';
6
7
  export const useRoutePreload = () => {
7
8
  var _a, _b, _c;
8
9
  const config = useShopConfig();
9
10
  const routeQuery = (_b = (_a = config === null || config === void 0 ? void 0 : config.preload) === null || _a === void 0 ? void 0 : _a.routeQuery) !== null && _b !== void 0 ? _b : null;
11
+ throwErrorInDev(!routeQuery, `\n ⛔️ useRoutePreload hook requires a routeQuery from shop.config.
12
+ This error messages is shown because you are using CategoryLink and ProductLink components.
13
+ Visit https://flight.norce.io/flight-frontend/features/general/#route-preloading for details on adding a routeQuery to your shop.config. \n
14
+ `);
10
15
  const preloadComponents = (_c = config === null || config === void 0 ? void 0 : config.preload) === null || _c === void 0 ? void 0 : _c.preloadComponents;
11
16
  const pagination = usePagination();
12
17
  const sortOrderState = useContext(SortOrderContext);
@@ -1 +1 @@
1
- {"version":3,"file":"useRoutePreload.js","sourceRoot":"","sources":["useRoutePreload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AAoBxE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;;IAClC,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,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