propro-common-components 0.1.4 → 0.1.6

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.
@@ -6,7 +6,6 @@ import React__default, { useCallback, createContext, useMemo as useMemo$1, creat
6
6
  import { useMutation, QueryClient, QueryClientProvider } from "@tanstack/react-query";
7
7
  import axios from "axios";
8
8
  import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
9
- import { useNavigate } from "react-router-dom";
10
9
  function _mergeNamespaces(m, g) {
11
10
  for (var b = 0; b < g.length; b++) {
12
11
  const _ = g[b];
@@ -56821,15 +56820,19 @@ var _coreExports = _core.exports, _aFunction = function(m) {
56821
56820
  if (!isObject$3(m))
56822
56821
  throw TypeError(m + " is not an object!");
56823
56822
  return m;
56824
- }, _fails = function(m) {
56825
- try {
56826
- return !!m();
56827
- } catch {
56828
- return !0;
56829
- }
56830
- }, _descriptors, hasRequired_descriptors;
56823
+ }, _fails, hasRequired_fails;
56824
+ function require_fails() {
56825
+ return hasRequired_fails || (hasRequired_fails = 1, _fails = function(m) {
56826
+ try {
56827
+ return !!m();
56828
+ } catch {
56829
+ return !0;
56830
+ }
56831
+ }), _fails;
56832
+ }
56833
+ var _descriptors, hasRequired_descriptors;
56831
56834
  function require_descriptors() {
56832
- return hasRequired_descriptors || (hasRequired_descriptors = 1, _descriptors = !_fails(function() {
56835
+ return hasRequired_descriptors || (hasRequired_descriptors = 1, _descriptors = !require_fails()(function() {
56833
56836
  return Object.defineProperty({}, "a", { get: function() {
56834
56837
  return 7;
56835
56838
  } }).a != 7;
@@ -56845,15 +56848,11 @@ function require_domCreate() {
56845
56848
  return b ? g.createElement(_) : {};
56846
56849
  }, _domCreate;
56847
56850
  }
56848
- var _ie8DomDefine, hasRequired_ie8DomDefine;
56849
- function require_ie8DomDefine() {
56850
- return hasRequired_ie8DomDefine || (hasRequired_ie8DomDefine = 1, _ie8DomDefine = !require_descriptors() && !_fails(function() {
56851
- return Object.defineProperty(require_domCreate()("div"), "a", { get: function() {
56852
- return 7;
56853
- } }).a != 7;
56854
- })), _ie8DomDefine;
56855
- }
56856
- var isObject$2 = _isObject, _toPrimitive = function(m, g) {
56851
+ var _ie8DomDefine = !require_descriptors() && !require_fails()(function() {
56852
+ return Object.defineProperty(require_domCreate()("div"), "a", { get: function() {
56853
+ return 7;
56854
+ } }).a != 7;
56855
+ }), isObject$2 = _isObject, _toPrimitive = function(m, g) {
56857
56856
  if (!isObject$2(m))
56858
56857
  return m;
56859
56858
  var b, _;
@@ -56865,7 +56864,7 @@ function require_objectDp() {
56865
56864
  if (hasRequired_objectDp)
56866
56865
  return _objectDp;
56867
56866
  hasRequired_objectDp = 1;
56868
- var m = _anObject, g = require_ie8DomDefine(), b = _toPrimitive, _ = Object.defineProperty;
56867
+ var m = _anObject, g = _ie8DomDefine, b = _toPrimitive, _ = Object.defineProperty;
56869
56868
  return _objectDp.f = require_descriptors() ? Object.defineProperty : function(C, $, I) {
56870
56869
  if (m(C), $ = b($, !0), m(I), g)
56871
56870
  try {
@@ -56992,7 +56991,7 @@ function require_objectAssign() {
56992
56991
  return _objectAssign;
56993
56992
  hasRequired_objectAssign = 1;
56994
56993
  var m = require_descriptors(), g = _objectKeys, b = _objectGops, _ = require_objectPie(), x = _toObject, C = require_iobject(), $ = Object.assign;
56995
- return _objectAssign = !$ || _fails(function() {
56994
+ return _objectAssign = !$ || require_fails()(function() {
56996
56995
  var I = {}, R = {}, P = Symbol(), N = "abcdefghijklmnopqrst";
56997
56996
  return I[P] = 7, N.split("").forEach(function(z) {
56998
56997
  R[z] = z;
@@ -57027,7 +57026,7 @@ function require_objectSap() {
57027
57026
  if (hasRequired_objectSap)
57028
57027
  return _objectSap;
57029
57028
  hasRequired_objectSap = 1;
57030
- var m = _export, g = _coreExports, b = _fails;
57029
+ var m = _export, g = _coreExports, b = require_fails();
57031
57030
  return _objectSap = function(_, x) {
57032
57031
  var C = (g.Object || {})[_] || Object[_], $ = {};
57033
57032
  $[_] = x(C), m(m.S + m.F * b(function() {
@@ -57197,7 +57196,7 @@ var _wksExt = {};
57197
57196
  _wksExt.f = _wksExports;
57198
57197
  var iterator$1 = _wksExt.f("iterator"), iterator = { default: iterator$1, __esModule: !0 }, _meta = { exports: {} }, META$1 = _uid("meta"), isObject$1 = _isObject, has$2 = _has, setDesc = require_objectDp().f, id = 0, isExtensible = Object.isExtensible || function() {
57199
57198
  return !0;
57200
- }, FREEZE = !_fails(function() {
57199
+ }, FREEZE = !require_fails()(function() {
57201
57200
  return isExtensible(Object.preventExtensions({}));
57202
57201
  }), setMeta = function(m) {
57203
57202
  setDesc(m, META$1, { value: {
@@ -57259,7 +57258,7 @@ var toIObject$2 = _toIobject, gOPN$1 = _objectGopn.f, toString = {}.toString, wi
57259
57258
  _objectGopnExt.f = function(g) {
57260
57259
  return windowNames && toString.call(g) == "[object Window]" ? getWindowNames(g) : gOPN$1(toIObject$2(g));
57261
57260
  };
57262
- var _objectGopd = {}, pIE = require_objectPie(), createDesc$1 = _propertyDesc, toIObject$1 = _toIobject, toPrimitive$1 = _toPrimitive, has$1 = _has, IE8_DOM_DEFINE = require_ie8DomDefine(), gOPD$1 = Object.getOwnPropertyDescriptor;
57261
+ var _objectGopd = {}, pIE = require_objectPie(), createDesc$1 = _propertyDesc, toIObject$1 = _toIobject, toPrimitive$1 = _toPrimitive, has$1 = _has, IE8_DOM_DEFINE = _ie8DomDefine, gOPD$1 = Object.getOwnPropertyDescriptor;
57263
57262
  _objectGopd.f = require_descriptors() ? gOPD$1 : function(g, b) {
57264
57263
  if (g = toIObject$1(g), b = toPrimitive$1(b, !0), IE8_DOM_DEFINE)
57265
57264
  try {
@@ -57269,7 +57268,7 @@ _objectGopd.f = require_descriptors() ? gOPD$1 : function(g, b) {
57269
57268
  if (has$1(g, b))
57270
57269
  return createDesc$1(!pIE.f.call(g, b), g[b]);
57271
57270
  };
57272
- var global$1 = _globalExports, has = _has, DESCRIPTORS = require_descriptors(), $export$2 = _export, redefine = _redefine, META = _metaExports.KEY, $fails = _fails, shared = _sharedExports, setToStringTag = _setToStringTag, uid = _uid, wks = _wksExports, wksExt = _wksExt, wksDefine = _wksDefine, enumKeys = _enumKeys, isArray = _isArray, anObject = _anObject, isObject = _isObject, toObject = _toObject, toIObject = _toIobject, toPrimitive = _toPrimitive, createDesc = _propertyDesc, _create$1 = require_objectCreate(), gOPNExt = _objectGopnExt, $GOPD = _objectGopd, $GOPS = _objectGops, $DP = require_objectDp(), $keys = _objectKeys, gOPD = $GOPD.f, dP = $DP.f, gOPN = gOPNExt.f, $Symbol = global$1.Symbol, $JSON = global$1.JSON, _stringify = $JSON && $JSON.stringify, PROTOTYPE = "prototype", HIDDEN = wks("_hidden"), TO_PRIMITIVE = wks("toPrimitive"), isEnum = {}.propertyIsEnumerable, SymbolRegistry = shared("symbol-registry"), AllSymbols = shared("symbols"), OPSymbols = shared("op-symbols"), ObjectProto = Object[PROTOTYPE], USE_NATIVE = typeof $Symbol == "function" && !!$GOPS.f, QObject = global$1.QObject, setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild, setSymbolDesc = DESCRIPTORS && $fails(function() {
57271
+ var global$1 = _globalExports, has = _has, DESCRIPTORS = require_descriptors(), $export$2 = _export, redefine = _redefine, META = _metaExports.KEY, $fails = require_fails(), shared = _sharedExports, setToStringTag = _setToStringTag, uid = _uid, wks = _wksExports, wksExt = _wksExt, wksDefine = _wksDefine, enumKeys = _enumKeys, isArray = _isArray, anObject = _anObject, isObject = _isObject, toObject = _toObject, toIObject = _toIobject, toPrimitive = _toPrimitive, createDesc = _propertyDesc, _create$1 = require_objectCreate(), gOPNExt = _objectGopnExt, $GOPD = _objectGopd, $GOPS = _objectGops, $DP = require_objectDp(), $keys = _objectKeys, gOPD = $GOPD.f, dP = $DP.f, gOPN = gOPNExt.f, $Symbol = global$1.Symbol, $JSON = global$1.JSON, _stringify = $JSON && $JSON.stringify, PROTOTYPE = "prototype", HIDDEN = wks("_hidden"), TO_PRIMITIVE = wks("toPrimitive"), isEnum = {}.propertyIsEnumerable, SymbolRegistry = shared("symbol-registry"), AllSymbols = shared("symbols"), OPSymbols = shared("op-symbols"), ObjectProto = Object[PROTOTYPE], USE_NATIVE = typeof $Symbol == "function" && !!$GOPS.f, QObject = global$1.QObject, setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild, setSymbolDesc = DESCRIPTORS && $fails(function() {
57273
57272
  return _create$1(dP({}, "a", {
57274
57273
  get: function() {
57275
57274
  return dP(this, "a", { value: 7 }).a;
@@ -65332,23 +65331,31 @@ function PrivateRoute({
65332
65331
  // permission,
65333
65332
  children: m
65334
65333
  }) {
65335
- const g = getCookie("account"), b = useNavigate(), _ = async () => {
65334
+ const g = getCookie("account"), b = async () => {
65336
65335
  try {
65337
65336
  await axios.post("/api/refreshToken");
65338
- } catch (x) {
65339
- console.log(x);
65337
+ } catch (_) {
65338
+ console.log(_);
65340
65339
  }
65341
65340
  };
65342
65341
  return useEffect(() => {
65343
- g === void 0 && b("/testAuth");
65344
- const x = setInterval(() => {
65345
- _();
65342
+ g === void 0 && handleAuth();
65343
+ const _ = setInterval(() => {
65344
+ b();
65346
65345
  }, 28 * 60 * 1e3);
65347
65346
  return () => {
65348
- clearInterval(x);
65347
+ clearInterval(_);
65349
65348
  };
65350
65349
  }, []), /* @__PURE__ */ jsx$2(Fragment$2, { children: m });
65351
65350
  }
65351
+ const handleAuth = async () => {
65352
+ try {
65353
+ const m = await axios.post("/api/auth");
65354
+ m.data.redirectUrl && (window.location.href = m.data.redirectUrl);
65355
+ } catch (m) {
65356
+ console.error("Error during authentication:", m);
65357
+ }
65358
+ };
65352
65359
  export {
65353
65360
  AppContext,
65354
65361
  AppHOC,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-common-components",
3
- "version": "0.1.04",
3
+ "version": "0.1.06",
4
4
  "type": "module",
5
5
  "main": "dist/propro-common-components.js",
6
6
  "types": "dist/main.d.ts",