@bluemarble/bm-components 1.13.4 → 1.15.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/dist/index.mjs CHANGED
@@ -4427,7 +4427,7 @@ function decodeSessionToken({
4427
4427
  try {
4428
4428
  const decoded = jwtDecode(token);
4429
4429
  req.user = decoded.sub;
4430
- } catch (error) {
4430
+ } catch (_) {
4431
4431
  res.status(401).json({ error: "Token inv\xE1lido", code: "token.expired" });
4432
4432
  return true;
4433
4433
  }
@@ -4637,7 +4637,9 @@ var AuthHelper = class {
4637
4637
  try {
4638
4638
  const { fullName, email } = yield this.oauthSignInCallback(code);
4639
4639
  const userExists = yield this.onGetUserData(email);
4640
- if (!userExists && this.oauth) {
4640
+ if (!userExists && !this.oauth.onCreateUser)
4641
+ throw new Error("User does not exists");
4642
+ if (!userExists && this.oauth.onCreateUser) {
4641
4643
  yield this.oauth.onCreateUser({ fullname: fullName, email });
4642
4644
  }
4643
4645
  const { token, refreshToken } = yield this.generateJwtAndRefreshToken(
@@ -4664,10 +4666,9 @@ var AuthHelper = class {
4664
4666
  }
4665
4667
  };
4666
4668
  } catch (error) {
4667
- console.log(error);
4668
4669
  return {
4669
4670
  props: {
4670
- destination: onFailedDestination || "/"
4671
+ error: JSON.stringify(error)
4671
4672
  }
4672
4673
  };
4673
4674
  }
@@ -4800,9 +4801,15 @@ function useGrid({
4800
4801
  },
4801
4802
  []
4802
4803
  );
4803
- const setSort = useCallback5((prop, direction) => {
4804
+ const clearSort = useCallback5(() => {
4805
+ setSortedBy([]);
4806
+ }, []);
4807
+ const appendSort = useCallback5((prop, direction) => {
4804
4808
  setSortedBy((prev) => [...prev, { prop, direction }]);
4805
4809
  }, []);
4810
+ const setSort = useCallback5((prop, direction) => {
4811
+ setSortedBy([{ prop, direction }]);
4812
+ }, []);
4806
4813
  const onSortBy = useCallback5(
4807
4814
  (prop) => {
4808
4815
  if (!prop)
@@ -4890,18 +4897,20 @@ function useGrid({
4890
4897
  }, [externalDefaultData]);
4891
4898
  return {
4892
4899
  data: displayData,
4893
- set,
4894
- onSortBy,
4895
4900
  sortedBy,
4896
4901
  defaultData,
4897
4902
  columns,
4898
4903
  currentPage,
4899
4904
  totalNumberOfPages: totalNumberOfPages < 0 ? 0 : totalNumberOfPages,
4900
- onPageChange,
4901
- setRowsPerPage: onChangeRowsPerPage,
4902
4905
  rowsPerPageOptions,
4903
4906
  rowsPerPage,
4904
- setSort
4907
+ set,
4908
+ onSortBy,
4909
+ onPageChange,
4910
+ setRowsPerPage: onChangeRowsPerPage,
4911
+ appendSort,
4912
+ setSort,
4913
+ clearSort
4905
4914
  };
4906
4915
  }
4907
4916
  function searchKeysForValue(row, compare) {