@tracktor/shared-module 0.3.0 → 0.4.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,4 +1,4 @@
1
1
  # [Versions](https://github.com/Tracktor/react-google-tag-manager/releases)
2
2
 
3
- ## v0.3.0
4
- - **[feat]** : Add GTMSendPageView
3
+ ## v0.4.0
4
+ - **[feat]** : redirect 401 with router in component `RequireAuth`
@@ -1,19 +1,52 @@
1
1
  import { ReactNode } from "react";
2
2
  import { InjectDependenciesContextProps } from '../../context/InjectDependenciesProvider';
3
3
  export interface RequireAuthProps {
4
+ /**
5
+ *
6
+ */
4
7
  loginPath?: string;
8
+ /**
9
+ * Fallback component for Suspense
10
+ */
5
11
  Fallback?: ReactNode;
12
+ /**
13
+ * Outlet dependency for RequireAuth component
14
+ */
6
15
  Outlet?: InjectDependenciesContextProps["Outlet"];
16
+ /**
17
+ * Navigate dependency for RequireAuth component
18
+ */
7
19
  Navigate?: InjectDependenciesContextProps["Navigate"];
20
+ /**
21
+ * useLocation dependency for RequireAuth component
22
+ */
8
23
  useLocation?: InjectDependenciesContextProps["useLocation"];
24
+ /**
25
+ * useAuth dependency for RequireAuth component
26
+ */
9
27
  useAuth?: InjectDependenciesContextProps["useAuth"];
28
+ /**
29
+ * Axios instance dependency is used for intercepting 401 responses
30
+ */
31
+ axios?: InjectDependenciesContextProps["axios"];
32
+ /**
33
+ * Local storage key for user data
34
+ */
35
+ localStorageKey?: string;
36
+ /**
37
+ * Redirect path for 401 responses
38
+ */
39
+ redirect401Path?: string;
10
40
  }
11
41
  /**
12
42
  * RequireAuth component for protected routing
43
+ * @param axios
13
44
  * @param Fallback
14
45
  * @param loginPath
46
+ * @param localStorageKey
47
+ * @param redirect401Path
15
48
  * @param props
16
49
  * @constructor
17
50
  */
18
- declare const RequireAuth: ({ Fallback, loginPath, ...props }: RequireAuthProps) => JSX.Element;
51
+ declare const RequireAuth: ({ Fallback, loginPath, localStorageKey, redirect401Path, ...props }: RequireAuthProps) => JSX.Element;
19
52
  export default RequireAuth;
@@ -4,6 +4,10 @@ export interface InjectDependenciesContextProps {
4
4
  * Children
5
5
  */
6
6
  children?: ReactNode;
7
+ /**
8
+ * Axios instance dependency
9
+ */
10
+ axios?: any;
7
11
  /**
8
12
  * Translate function dependency for useResponseError hook
9
13
  * @param str
@@ -47,5 +51,5 @@ export interface InjectDependenciesContextProps {
47
51
  };
48
52
  }
49
53
  export declare const InjectDependenciesContext: import("react").Context<InjectDependenciesContextProps>;
50
- declare const InjectDependenciesProvider: ({ children, translate, useAuth, Outlet, Navigate, useLocation, useGoogleTagManager, }: InjectDependenciesContextProps) => JSX.Element;
54
+ declare const InjectDependenciesProvider: ({ axios, children, translate, useAuth, Outlet, Navigate, useLocation, useGoogleTagManager, }: InjectDependenciesContextProps) => JSX.Element;
51
55
  export default InjectDependenciesProvider;
package/dist/main.js CHANGED
@@ -1,12 +1,12 @@
1
- import je, { createContext as lr, useMemo as dr, useContext as ne, Suspense as vr, useEffect as pr, useCallback as gr } from "react";
2
- var te = {}, hr = {
1
+ import Fe, { createContext as lr, useMemo as dr, useContext as oe, useState as vr, useLayoutEffect as pr, Suspense as gr, useEffect as hr, useCallback as Er } from "react";
2
+ var ae = {}, mr = {
3
3
  get exports() {
4
- return te;
4
+ return ae;
5
5
  },
6
6
  set exports(f) {
7
- te = f;
7
+ ae = f;
8
8
  }
9
- }, L = {};
9
+ }, Y = {};
10
10
  /**
11
11
  * @license React
12
12
  * react-jsx-runtime.production.min.js
@@ -16,25 +16,25 @@ var te = {}, hr = {
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
18
  */
19
- var Pe;
20
- function Er() {
21
- if (Pe)
22
- return L;
23
- Pe = 1;
24
- var f = je, h = Symbol.for("react.element"), g = Symbol.for("react.fragment"), E = Object.prototype.hasOwnProperty, v = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
25
- function o(_, c, T) {
26
- var p, y = {}, w = null, P = null;
27
- T !== void 0 && (w = "" + T), c.key !== void 0 && (w = "" + c.key), c.ref !== void 0 && (P = c.ref);
28
- for (p in c)
29
- E.call(c, p) && !m.hasOwnProperty(p) && (y[p] = c[p]);
30
- if (_ && _.defaultProps)
31
- for (p in c = _.defaultProps, c)
32
- y[p] === void 0 && (y[p] = c[p]);
33
- return { $$typeof: h, type: _, key: w, ref: P, props: y, _owner: v.current };
19
+ var Ae;
20
+ function yr() {
21
+ if (Ae)
22
+ return Y;
23
+ Ae = 1;
24
+ var f = Fe, E = Symbol.for("react.element"), m = Symbol.for("react.fragment"), y = Object.prototype.hasOwnProperty, v = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
25
+ function i(b, d, w) {
26
+ var h, _ = {}, O = null, T = null;
27
+ w !== void 0 && (O = "" + w), d.key !== void 0 && (O = "" + d.key), d.ref !== void 0 && (T = d.ref);
28
+ for (h in d)
29
+ y.call(d, h) && !l.hasOwnProperty(h) && (_[h] = d[h]);
30
+ if (b && b.defaultProps)
31
+ for (h in d = b.defaultProps, d)
32
+ _[h] === void 0 && (_[h] = d[h]);
33
+ return { $$typeof: E, type: b, key: O, ref: T, props: _, _owner: v.current };
34
34
  }
35
- return L.Fragment = g, L.jsx = o, L.jsxs = o, L;
35
+ return Y.Fragment = m, Y.jsx = i, Y.jsxs = i, Y;
36
36
  }
37
- var Y = {};
37
+ var W = {};
38
38
  /**
39
39
  * @license React
40
40
  * react-jsx-runtime.development.js
@@ -44,91 +44,91 @@ var Y = {};
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
- var xe;
48
- function mr() {
49
- return xe || (xe = 1, process.env.NODE_ENV !== "production" && function() {
50
- var f = je, h = Symbol.for("react.element"), g = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), _ = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), F = Symbol.iterator, W = "@@iterator";
51
- function ke(e) {
47
+ var De;
48
+ function br() {
49
+ return De || (De = 1, process.env.NODE_ENV !== "production" && function() {
50
+ var f = Fe, E = Symbol.for("react.element"), m = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), b = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), x = Symbol.iterator, k = "@@iterator";
51
+ function M(e) {
52
52
  if (e === null || typeof e != "object")
53
53
  return null;
54
- var r = F && e[F] || e[W];
54
+ var r = x && e[x] || e[k];
55
55
  return typeof r == "function" ? r : null;
56
56
  }
57
- var j = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
- function b(e) {
57
+ var C = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
+ function u(e) {
59
59
  {
60
60
  for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
61
61
  t[n - 1] = arguments[n];
62
- De("error", e, t);
62
+ ie("error", e, t);
63
63
  }
64
64
  }
65
- function De(e, r, t) {
65
+ function ie(e, r, t) {
66
66
  {
67
- var n = j.ReactDebugCurrentFrame, u = n.getStackAddendum();
68
- u !== "" && (r += "%s", t = t.concat([u]));
69
- var s = t.map(function(i) {
70
- return String(i);
67
+ var n = C.ReactDebugCurrentFrame, s = n.getStackAddendum();
68
+ s !== "" && (r += "%s", t = t.concat([s]));
69
+ var c = t.map(function(o) {
70
+ return String(o);
71
71
  });
72
- s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
72
+ c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
73
73
  }
74
74
  }
75
- var Ae = !1, Fe = !1, Ie = !1, $e = !1, Le = !1, ae;
76
- ae = Symbol.for("react.module.reference");
75
+ var ue = !1, N = !1, Ie = !1, $e = !1, Le = !1, se;
76
+ se = Symbol.for("react.module.reference");
77
77
  function Ye(e) {
78
- return !!(typeof e == "string" || typeof e == "function" || e === E || e === m || Le || e === v || e === T || e === p || $e || e === P || Ae || Fe || Ie || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === y || e.$$typeof === o || e.$$typeof === _ || e.$$typeof === c || // This needs to include all possible module reference object
78
+ return !!(typeof e == "string" || typeof e == "function" || e === y || e === l || Le || e === v || e === w || e === h || $e || e === T || ue || N || Ie || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === _ || e.$$typeof === i || e.$$typeof === b || e.$$typeof === d || // This needs to include all possible module reference object
79
79
  // types supported by any Flight configuration anywhere since
80
80
  // we don't know which Flight build this will end up being used
81
81
  // with.
82
- e.$$typeof === ae || e.getModuleId !== void 0));
82
+ e.$$typeof === se || e.getModuleId !== void 0));
83
83
  }
84
84
  function We(e, r, t) {
85
85
  var n = e.displayName;
86
86
  if (n)
87
87
  return n;
88
- var u = r.displayName || r.name || "";
89
- return u !== "" ? t + "(" + u + ")" : t;
88
+ var s = r.displayName || r.name || "";
89
+ return s !== "" ? t + "(" + s + ")" : t;
90
90
  }
91
- function oe(e) {
91
+ function ce(e) {
92
92
  return e.displayName || "Context";
93
93
  }
94
- function S(e) {
94
+ function P(e) {
95
95
  if (e == null)
96
96
  return null;
97
- if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
97
+ if (typeof e.tag == "number" && u("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
98
98
  return e.displayName || e.name || null;
99
99
  if (typeof e == "string")
100
100
  return e;
101
101
  switch (e) {
102
- case E:
102
+ case y:
103
103
  return "Fragment";
104
- case g:
105
- return "Portal";
106
104
  case m:
105
+ return "Portal";
106
+ case l:
107
107
  return "Profiler";
108
108
  case v:
109
109
  return "StrictMode";
110
- case T:
110
+ case w:
111
111
  return "Suspense";
112
- case p:
112
+ case h:
113
113
  return "SuspenseList";
114
114
  }
115
115
  if (typeof e == "object")
116
116
  switch (e.$$typeof) {
117
- case _:
117
+ case b:
118
118
  var r = e;
119
- return oe(r) + ".Consumer";
120
- case o:
119
+ return ce(r) + ".Consumer";
120
+ case i:
121
121
  var t = e;
122
- return oe(t._context) + ".Provider";
123
- case c:
122
+ return ce(t._context) + ".Provider";
123
+ case d:
124
124
  return We(e, e.render, "ForwardRef");
125
- case y:
125
+ case _:
126
126
  var n = e.displayName || null;
127
- return n !== null ? n : S(e.type) || "Memo";
128
- case w: {
129
- var u = e, s = u._payload, i = u._init;
127
+ return n !== null ? n : P(e.type) || "Memo";
128
+ case O: {
129
+ var s = e, c = s._payload, o = s._init;
130
130
  try {
131
- return S(i(s));
131
+ return P(o(c));
132
132
  } catch {
133
133
  return null;
134
134
  }
@@ -136,18 +136,18 @@ function mr() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var x = Object.assign, I = 0, ie, ue, se, fe, ce, le, de;
140
- function ve() {
139
+ var A = Object.assign, $ = 0, fe, le, de, ve, pe, ge, he;
140
+ function Ee() {
141
141
  }
142
- ve.__reactDisabledLog = !0;
142
+ Ee.__reactDisabledLog = !0;
143
143
  function Me() {
144
144
  {
145
- if (I === 0) {
146
- ie = console.log, ue = console.info, se = console.warn, fe = console.error, ce = console.group, le = console.groupCollapsed, de = console.groupEnd;
145
+ if ($ === 0) {
146
+ fe = console.log, le = console.info, de = console.warn, ve = console.error, pe = console.group, ge = console.groupCollapsed, he = console.groupEnd;
147
147
  var e = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
150
- value: ve,
150
+ value: Ee,
151
151
  writable: !0
152
152
  };
153
153
  Object.defineProperties(console, {
@@ -160,199 +160,199 @@ function mr() {
160
160
  groupEnd: e
161
161
  });
162
162
  }
163
- I++;
163
+ $++;
164
164
  }
165
165
  }
166
166
  function Ne() {
167
167
  {
168
- if (I--, I === 0) {
168
+ if ($--, $ === 0) {
169
169
  var e = {
170
170
  configurable: !0,
171
171
  enumerable: !0,
172
172
  writable: !0
173
173
  };
174
174
  Object.defineProperties(console, {
175
- log: x({}, e, {
176
- value: ie
175
+ log: A({}, e, {
176
+ value: fe
177
177
  }),
178
- info: x({}, e, {
179
- value: ue
178
+ info: A({}, e, {
179
+ value: le
180
180
  }),
181
- warn: x({}, e, {
182
- value: se
181
+ warn: A({}, e, {
182
+ value: de
183
183
  }),
184
- error: x({}, e, {
185
- value: fe
184
+ error: A({}, e, {
185
+ value: ve
186
186
  }),
187
- group: x({}, e, {
188
- value: ce
187
+ group: A({}, e, {
188
+ value: pe
189
189
  }),
190
- groupCollapsed: x({}, e, {
191
- value: le
190
+ groupCollapsed: A({}, e, {
191
+ value: ge
192
192
  }),
193
- groupEnd: x({}, e, {
194
- value: de
193
+ groupEnd: A({}, e, {
194
+ value: he
195
195
  })
196
196
  });
197
197
  }
198
- I < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
198
+ $ < 0 && u("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
199
199
  }
200
200
  }
201
- var J = j.ReactCurrentDispatcher, z;
202
- function M(e, r, t) {
201
+ var K = C.ReactCurrentDispatcher, H;
202
+ function V(e, r, t) {
203
203
  {
204
- if (z === void 0)
204
+ if (H === void 0)
205
205
  try {
206
206
  throw Error();
207
- } catch (u) {
208
- var n = u.stack.trim().match(/\n( *(at )?)/);
209
- z = n && n[1] || "";
207
+ } catch (s) {
208
+ var n = s.stack.trim().match(/\n( *(at )?)/);
209
+ H = n && n[1] || "";
210
210
  }
211
211
  return `
212
- ` + z + e;
212
+ ` + H + e;
213
213
  }
214
214
  }
215
- var K = !1, N;
215
+ var X = !1, U;
216
216
  {
217
217
  var Ve = typeof WeakMap == "function" ? WeakMap : Map;
218
- N = new Ve();
218
+ U = new Ve();
219
219
  }
220
- function pe(e, r) {
221
- if (!e || K)
220
+ function me(e, r) {
221
+ if (!e || X)
222
222
  return "";
223
223
  {
224
- var t = N.get(e);
224
+ var t = U.get(e);
225
225
  if (t !== void 0)
226
226
  return t;
227
227
  }
228
228
  var n;
229
- K = !0;
230
- var u = Error.prepareStackTrace;
229
+ X = !0;
230
+ var s = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
- var s;
233
- s = J.current, J.current = null, Me();
232
+ var c;
233
+ c = K.current, K.current = null, Me();
234
234
  try {
235
235
  if (r) {
236
- var i = function() {
236
+ var o = function() {
237
237
  throw Error();
238
238
  };
239
- if (Object.defineProperty(i.prototype, "props", {
239
+ if (Object.defineProperty(o.prototype, "props", {
240
240
  set: function() {
241
241
  throw Error();
242
242
  }
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
- Reflect.construct(i, []);
246
- } catch (C) {
247
- n = C;
245
+ Reflect.construct(o, []);
246
+ } catch (j) {
247
+ n = j;
248
248
  }
249
- Reflect.construct(e, [], i);
249
+ Reflect.construct(e, [], o);
250
250
  } else {
251
251
  try {
252
- i.call();
253
- } catch (C) {
254
- n = C;
252
+ o.call();
253
+ } catch (j) {
254
+ n = j;
255
255
  }
256
- e.call(i.prototype);
256
+ e.call(o.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
260
260
  throw Error();
261
- } catch (C) {
262
- n = C;
261
+ } catch (j) {
262
+ n = j;
263
263
  }
264
264
  e();
265
265
  }
266
- } catch (C) {
267
- if (C && n && typeof C.stack == "string") {
268
- for (var a = C.stack.split(`
266
+ } catch (j) {
267
+ if (j && n && typeof j.stack == "string") {
268
+ for (var a = j.stack.split(`
269
269
  `), R = n.stack.split(`
270
- `), l = a.length - 1, d = R.length - 1; l >= 1 && d >= 0 && a[l] !== R[d]; )
271
- d--;
272
- for (; l >= 1 && d >= 0; l--, d--)
273
- if (a[l] !== R[d]) {
274
- if (l !== 1 || d !== 1)
270
+ `), p = a.length - 1, g = R.length - 1; p >= 1 && g >= 0 && a[p] !== R[g]; )
271
+ g--;
272
+ for (; p >= 1 && g >= 0; p--, g--)
273
+ if (a[p] !== R[g]) {
274
+ if (p !== 1 || g !== 1)
275
275
  do
276
- if (l--, d--, d < 0 || a[l] !== R[d]) {
277
- var O = `
278
- ` + a[l].replace(" at new ", " at ");
279
- return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && N.set(e, O), O;
276
+ if (p--, g--, g < 0 || a[p] !== R[g]) {
277
+ var S = `
278
+ ` + a[p].replace(" at new ", " at ");
279
+ return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, S), S;
280
280
  }
281
- while (l >= 1 && d >= 0);
281
+ while (p >= 1 && g >= 0);
282
282
  break;
283
283
  }
284
284
  }
285
285
  } finally {
286
- K = !1, J.current = s, Ne(), Error.prepareStackTrace = u;
286
+ X = !1, K.current = c, Ne(), Error.prepareStackTrace = s;
287
287
  }
288
- var D = e ? e.displayName || e.name : "", Ce = D ? M(D) : "";
289
- return typeof e == "function" && N.set(e, Ce), Ce;
288
+ var F = e ? e.displayName || e.name : "", ke = F ? V(F) : "";
289
+ return typeof e == "function" && U.set(e, ke), ke;
290
290
  }
291
291
  function Ue(e, r, t) {
292
- return pe(e, !1);
292
+ return me(e, !1);
293
293
  }
294
294
  function qe(e) {
295
295
  var r = e.prototype;
296
296
  return !!(r && r.isReactComponent);
297
297
  }
298
- function V(e, r, t) {
298
+ function q(e, r, t) {
299
299
  if (e == null)
300
300
  return "";
301
301
  if (typeof e == "function")
302
- return pe(e, qe(e));
302
+ return me(e, qe(e));
303
303
  if (typeof e == "string")
304
- return M(e);
304
+ return V(e);
305
305
  switch (e) {
306
- case T:
307
- return M("Suspense");
308
- case p:
309
- return M("SuspenseList");
306
+ case w:
307
+ return V("Suspense");
308
+ case h:
309
+ return V("SuspenseList");
310
310
  }
311
311
  if (typeof e == "object")
312
312
  switch (e.$$typeof) {
313
- case c:
313
+ case d:
314
314
  return Ue(e.render);
315
- case y:
316
- return V(e.type, r, t);
317
- case w: {
318
- var n = e, u = n._payload, s = n._init;
315
+ case _:
316
+ return q(e.type, r, t);
317
+ case O: {
318
+ var n = e, s = n._payload, c = n._init;
319
319
  try {
320
- return V(s(u), r, t);
320
+ return q(c(s), r, t);
321
321
  } catch {
322
322
  }
323
323
  }
324
324
  }
325
325
  return "";
326
326
  }
327
- var U = Object.prototype.hasOwnProperty, ge = {}, he = j.ReactDebugCurrentFrame;
328
- function q(e) {
327
+ var G = Object.prototype.hasOwnProperty, ye = {}, be = C.ReactDebugCurrentFrame;
328
+ function B(e) {
329
329
  if (e) {
330
- var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
331
- he.setExtraStackFrame(t);
330
+ var r = e._owner, t = q(e.type, e._source, r ? r.type : null);
331
+ be.setExtraStackFrame(t);
332
332
  } else
333
- he.setExtraStackFrame(null);
333
+ be.setExtraStackFrame(null);
334
334
  }
335
- function Ge(e, r, t, n, u) {
335
+ function Ge(e, r, t, n, s) {
336
336
  {
337
- var s = Function.call.bind(U);
338
- for (var i in e)
339
- if (s(e, i)) {
337
+ var c = Function.call.bind(G);
338
+ for (var o in e)
339
+ if (c(e, o)) {
340
340
  var a = void 0;
341
341
  try {
342
- if (typeof e[i] != "function") {
343
- var R = Error((n || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof e[o] != "function") {
343
+ var R = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw R.name = "Invariant Violation", R;
345
345
  }
346
- a = e[i](r, i, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
- } catch (l) {
348
- a = l;
346
+ a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
+ } catch (p) {
348
+ a = p;
349
349
  }
350
- a && !(a instanceof Error) && (q(u), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, i, typeof a), q(null)), a instanceof Error && !(a.message in ge) && (ge[a.message] = !0, q(u), b("Failed %s type: %s", t, a.message), q(null));
350
+ a && !(a instanceof Error) && (B(s), u("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), B(null)), a instanceof Error && !(a.message in ye) && (ye[a.message] = !0, B(s), u("Failed %s type: %s", t, a.message), B(null));
351
351
  }
352
352
  }
353
353
  }
354
354
  var Be = Array.isArray;
355
- function H(e) {
355
+ function Z(e) {
356
356
  return Be(e);
357
357
  }
358
358
  function Je(e) {
@@ -363,27 +363,27 @@ function mr() {
363
363
  }
364
364
  function ze(e) {
365
365
  try {
366
- return Ee(e), !1;
366
+ return Re(e), !1;
367
367
  } catch {
368
368
  return !0;
369
369
  }
370
370
  }
371
- function Ee(e) {
371
+ function Re(e) {
372
372
  return "" + e;
373
373
  }
374
- function me(e) {
374
+ function _e(e) {
375
375
  if (ze(e))
376
- return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(e)), Ee(e);
376
+ return u("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(e)), Re(e);
377
377
  }
378
- var $ = j.ReactCurrentOwner, Ke = {
378
+ var L = C.ReactCurrentOwner, Ke = {
379
379
  key: !0,
380
380
  ref: !0,
381
381
  __self: !0,
382
382
  __source: !0
383
- }, ye, be, X;
384
- X = {};
383
+ }, we, Te, Q;
384
+ Q = {};
385
385
  function He(e) {
386
- if (U.call(e, "ref")) {
386
+ if (G.call(e, "ref")) {
387
387
  var r = Object.getOwnPropertyDescriptor(e, "ref").get;
388
388
  if (r && r.isReactWarning)
389
389
  return !1;
@@ -391,7 +391,7 @@ function mr() {
391
391
  return e.ref !== void 0;
392
392
  }
393
393
  function Xe(e) {
394
- if (U.call(e, "key")) {
394
+ if (G.call(e, "key")) {
395
395
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
396
396
  if (r && r.isReactWarning)
397
397
  return !1;
@@ -399,15 +399,15 @@ function mr() {
399
399
  return e.key !== void 0;
400
400
  }
401
401
  function Ze(e, r) {
402
- if (typeof e.ref == "string" && $.current && r && $.current.stateNode !== r) {
403
- var t = S($.current.type);
404
- X[t] || (b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', S($.current.type), e.ref), X[t] = !0);
402
+ if (typeof e.ref == "string" && L.current && r && L.current.stateNode !== r) {
403
+ var t = P(L.current.type);
404
+ Q[t] || (u('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', P(L.current.type), e.ref), Q[t] = !0);
405
405
  }
406
406
  }
407
407
  function Qe(e, r) {
408
408
  {
409
409
  var t = function() {
410
- ye || (ye = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
410
+ we || (we = !0, u("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
411
411
  };
412
412
  t.isReactWarning = !0, Object.defineProperty(e, "key", {
413
413
  get: t,
@@ -418,7 +418,7 @@ function mr() {
418
418
  function er(e, r) {
419
419
  {
420
420
  var t = function() {
421
- be || (be = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
421
+ Te || (Te = !0, u("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
422
422
  };
423
423
  t.isReactWarning = !0, Object.defineProperty(e, "ref", {
424
424
  get: t,
@@ -426,17 +426,17 @@ function mr() {
426
426
  });
427
427
  }
428
428
  }
429
- var rr = function(e, r, t, n, u, s, i) {
429
+ var rr = function(e, r, t, n, s, c, o) {
430
430
  var a = {
431
431
  // This tag allows us to uniquely identify this as a React Element
432
- $$typeof: h,
432
+ $$typeof: E,
433
433
  // Built-in properties that belong on the element
434
434
  type: e,
435
435
  key: r,
436
436
  ref: t,
437
- props: i,
437
+ props: o,
438
438
  // Record the component responsible for creating this element.
439
- _owner: s
439
+ _owner: c
440
440
  };
441
441
  return a._store = {}, Object.defineProperty(a._store, "validated", {
442
442
  configurable: !1,
@@ -452,44 +452,44 @@ function mr() {
452
452
  configurable: !1,
453
453
  enumerable: !1,
454
454
  writable: !1,
455
- value: u
455
+ value: s
456
456
  }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
457
457
  };
458
- function tr(e, r, t, n, u) {
458
+ function tr(e, r, t, n, s) {
459
459
  {
460
- var s, i = {}, a = null, R = null;
461
- t !== void 0 && (me(t), a = "" + t), Xe(r) && (me(r.key), a = "" + r.key), He(r) && (R = r.ref, Ze(r, u));
462
- for (s in r)
463
- U.call(r, s) && !Ke.hasOwnProperty(s) && (i[s] = r[s]);
460
+ var c, o = {}, a = null, R = null;
461
+ t !== void 0 && (_e(t), a = "" + t), Xe(r) && (_e(r.key), a = "" + r.key), He(r) && (R = r.ref, Ze(r, s));
462
+ for (c in r)
463
+ G.call(r, c) && !Ke.hasOwnProperty(c) && (o[c] = r[c]);
464
464
  if (e && e.defaultProps) {
465
- var l = e.defaultProps;
466
- for (s in l)
467
- i[s] === void 0 && (i[s] = l[s]);
465
+ var p = e.defaultProps;
466
+ for (c in p)
467
+ o[c] === void 0 && (o[c] = p[c]);
468
468
  }
469
469
  if (a || R) {
470
- var d = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
471
- a && Qe(i, d), R && er(i, d);
470
+ var g = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
471
+ a && Qe(o, g), R && er(o, g);
472
472
  }
473
- return rr(e, a, R, u, n, $.current, i);
473
+ return rr(e, a, R, s, n, L.current, o);
474
474
  }
475
475
  }
476
- var Z = j.ReactCurrentOwner, Re = j.ReactDebugCurrentFrame;
477
- function k(e) {
476
+ var ee = C.ReactCurrentOwner, Oe = C.ReactDebugCurrentFrame;
477
+ function D(e) {
478
478
  if (e) {
479
- var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
480
- Re.setExtraStackFrame(t);
479
+ var r = e._owner, t = q(e.type, e._source, r ? r.type : null);
480
+ Oe.setExtraStackFrame(t);
481
481
  } else
482
- Re.setExtraStackFrame(null);
482
+ Oe.setExtraStackFrame(null);
483
483
  }
484
- var Q;
485
- Q = !1;
486
- function ee(e) {
487
- return typeof e == "object" && e !== null && e.$$typeof === h;
484
+ var re;
485
+ re = !1;
486
+ function te(e) {
487
+ return typeof e == "object" && e !== null && e.$$typeof === E;
488
488
  }
489
- function _e() {
489
+ function Se() {
490
490
  {
491
- if (Z.current) {
492
- var e = S(Z.current.type);
491
+ if (ee.current) {
492
+ var e = P(ee.current.type);
493
493
  if (e)
494
494
  return `
495
495
 
@@ -509,10 +509,10 @@ Check your code at ` + r + ":" + t + ".";
509
509
  return "";
510
510
  }
511
511
  }
512
- var we = {};
512
+ var Ce = {};
513
513
  function ar(e) {
514
514
  {
515
- var r = _e();
515
+ var r = Se();
516
516
  if (!r) {
517
517
  var t = typeof e == "string" ? e : e.displayName || e.name;
518
518
  t && (r = `
@@ -522,35 +522,35 @@ Check the top-level render call using <` + t + ">.");
522
522
  return r;
523
523
  }
524
524
  }
525
- function Te(e, r) {
525
+ function Pe(e, r) {
526
526
  {
527
527
  if (!e._store || e._store.validated || e.key != null)
528
528
  return;
529
529
  e._store.validated = !0;
530
530
  var t = ar(r);
531
- if (we[t])
531
+ if (Ce[t])
532
532
  return;
533
- we[t] = !0;
533
+ Ce[t] = !0;
534
534
  var n = "";
535
- e && e._owner && e._owner !== Z.current && (n = " It was passed a child from " + S(e._owner.type) + "."), k(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), k(null);
535
+ e && e._owner && e._owner !== ee.current && (n = " It was passed a child from " + P(e._owner.type) + "."), D(e), u('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
536
536
  }
537
537
  }
538
- function Oe(e, r) {
538
+ function je(e, r) {
539
539
  {
540
540
  if (typeof e != "object")
541
541
  return;
542
- if (H(e))
542
+ if (Z(e))
543
543
  for (var t = 0; t < e.length; t++) {
544
544
  var n = e[t];
545
- ee(n) && Te(n, r);
545
+ te(n) && Pe(n, r);
546
546
  }
547
- else if (ee(e))
547
+ else if (te(e))
548
548
  e._store && (e._store.validated = !0);
549
549
  else if (e) {
550
- var u = ke(e);
551
- if (typeof u == "function" && u !== e.entries)
552
- for (var s = u.call(e), i; !(i = s.next()).done; )
553
- ee(i.value) && Te(i.value, r);
550
+ var s = M(e);
551
+ if (typeof s == "function" && s !== e.entries)
552
+ for (var c = s.call(e), o; !(o = c.next()).done; )
553
+ te(o.value) && Pe(o.value, r);
554
554
  }
555
555
  }
556
556
  }
@@ -562,21 +562,21 @@ Check the top-level render call using <` + t + ">.");
562
562
  var t;
563
563
  if (typeof r == "function")
564
564
  t = r.propTypes;
565
- else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
565
+ else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
566
566
  // Inner props are checked in the reconciler.
567
- r.$$typeof === y))
567
+ r.$$typeof === _))
568
568
  t = r.propTypes;
569
569
  else
570
570
  return;
571
571
  if (t) {
572
- var n = S(r);
572
+ var n = P(r);
573
573
  Ge(t, e.props, "prop", n, e);
574
- } else if (r.PropTypes !== void 0 && !Q) {
575
- Q = !0;
576
- var u = S(r);
577
- b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown");
574
+ } else if (r.PropTypes !== void 0 && !re) {
575
+ re = !0;
576
+ var s = P(r);
577
+ u("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
578
578
  }
579
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
579
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && u("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
580
580
  }
581
581
  }
582
582
  function ir(e) {
@@ -584,133 +584,151 @@ Check the top-level render call using <` + t + ">.");
584
584
  for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
585
585
  var n = r[t];
586
586
  if (n !== "children" && n !== "key") {
587
- k(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), k(null);
587
+ D(e), u("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
588
588
  break;
589
589
  }
590
590
  }
591
- e.ref !== null && (k(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
591
+ e.ref !== null && (D(e), u("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
592
592
  }
593
593
  }
594
- function Se(e, r, t, n, u, s) {
594
+ function xe(e, r, t, n, s, c) {
595
595
  {
596
- var i = Ye(e);
597
- if (!i) {
596
+ var o = Ye(e);
597
+ if (!o) {
598
598
  var a = "";
599
599
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
600
- var R = nr(u);
601
- R ? a += R : a += _e();
602
- var l;
603
- e === null ? l = "null" : H(e) ? l = "array" : e !== void 0 && e.$$typeof === h ? (l = "<" + (S(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
600
+ var R = nr(s);
601
+ R ? a += R : a += Se();
602
+ var p;
603
+ e === null ? p = "null" : Z(e) ? p = "array" : e !== void 0 && e.$$typeof === E ? (p = "<" + (P(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : p = typeof e, u("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", p, a);
604
604
  }
605
- var d = tr(e, r, t, u, s);
606
- if (d == null)
607
- return d;
608
- if (i) {
609
- var O = r.children;
610
- if (O !== void 0)
605
+ var g = tr(e, r, t, s, c);
606
+ if (g == null)
607
+ return g;
608
+ if (o) {
609
+ var S = r.children;
610
+ if (S !== void 0)
611
611
  if (n)
612
- if (H(O)) {
613
- for (var D = 0; D < O.length; D++)
614
- Oe(O[D], e);
615
- Object.freeze && Object.freeze(O);
612
+ if (Z(S)) {
613
+ for (var F = 0; F < S.length; F++)
614
+ je(S[F], e);
615
+ Object.freeze && Object.freeze(S);
616
616
  } else
617
- b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
617
+ u("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
618
618
  else
619
- Oe(O, e);
619
+ je(S, e);
620
620
  }
621
- return e === E ? ir(d) : or(d), d;
621
+ return e === y ? ir(g) : or(g), g;
622
622
  }
623
623
  }
624
624
  function ur(e, r, t) {
625
- return Se(e, r, t, !0);
625
+ return xe(e, r, t, !0);
626
626
  }
627
627
  function sr(e, r, t) {
628
- return Se(e, r, t, !1);
628
+ return xe(e, r, t, !1);
629
629
  }
630
- var fr = sr, cr = ur;
631
- Y.Fragment = E, Y.jsx = fr, Y.jsxs = cr;
632
- }()), Y;
630
+ var cr = sr, fr = ur;
631
+ W.Fragment = y, W.jsx = cr, W.jsxs = fr;
632
+ }()), W;
633
633
  }
634
634
  (function(f) {
635
- process.env.NODE_ENV === "production" ? f.exports = Er() : f.exports = mr();
636
- })(hr);
637
- const A = te.jsx, B = lr({
635
+ process.env.NODE_ENV === "production" ? f.exports = yr() : f.exports = br();
636
+ })(mr);
637
+ const I = ae.jsx, z = lr({
638
+ axios: void 0,
638
639
  children: void 0,
639
640
  Navigate: void 0,
640
641
  Outlet: void 0,
641
642
  translate: void 0,
642
643
  useAuth: void 0,
643
644
  useLocation: void 0
644
- }), br = ({
645
- children: f,
646
- translate: h,
647
- useAuth: g,
648
- Outlet: E,
649
- Navigate: v,
650
- useLocation: m,
651
- useGoogleTagManager: o
645
+ }), _r = ({
646
+ axios: f,
647
+ children: E,
648
+ translate: m,
649
+ useAuth: y,
650
+ Outlet: v,
651
+ Navigate: l,
652
+ useLocation: i,
653
+ useGoogleTagManager: b
652
654
  }) => {
653
- const _ = dr(
655
+ const d = dr(
654
656
  () => ({
655
- Navigate: v,
656
- Outlet: E,
657
- translate: h,
658
- useAuth: g,
659
- useGoogleTagManager: o,
660
- useLocation: m
657
+ axios: f,
658
+ Navigate: l,
659
+ Outlet: v,
660
+ translate: m,
661
+ useAuth: y,
662
+ useGoogleTagManager: b,
663
+ useLocation: i
661
664
  }),
662
- [v, E, h, g, o, m]
665
+ [l, v, f, m, y, b, i]
663
666
  );
664
- return /* @__PURE__ */ A(B.Provider, { value: _, children: f });
665
- }, G = (f) => `RequireAuth require « ${f} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, Rr = ({ Fallback: f, loginPath: h = "/login", ...g }) => {
666
- var T, p, y, w;
667
+ return /* @__PURE__ */ I(z.Provider, { value: d, children: E });
668
+ }, J = (f) => `RequireAuth require « ${f} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, wr = ({
669
+ Fallback: f,
670
+ loginPath: E = "/login",
671
+ localStorageKey: m = "user",
672
+ redirect401Path: y = "/login",
673
+ ...v
674
+ }) => {
675
+ var x, k, M, C;
667
676
  const {
668
- useLocation: E = g.useLocation,
669
- useAuth: v = g.useAuth,
670
- Outlet: m = g.Outlet,
671
- Navigate: o = g.Navigate
672
- } = ne(B);
673
- if (v === void 0)
674
- throw new Error(G("useAuth"));
675
- if (E === void 0)
676
- throw new Error(G("useLocation"));
677
- if (m === void 0)
678
- throw new Error(G("Outlet"));
679
- if (o === void 0)
680
- throw new Error(G("Navigate"));
681
- const { isLogged: _ } = v(), c = E();
682
- return _ ? /* @__PURE__ */ A(vr, { fallback: f, children: (p = (T = c.state) == null ? void 0 : T.from) != null && p.state && ((w = (y = c.state) == null ? void 0 : y.from) == null ? void 0 : w.pathname) === h ? /* @__PURE__ */ A(o, { to: c.state.from.state.from.pathname + c.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ A(m, {}) }) : /* @__PURE__ */ A(o, { to: h, state: { from: c }, replace: !0 });
683
- }, re = (f) => `GTMSendPageView require « ${f} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, _r = ({ ...f }) => {
677
+ axios: l = v.axios,
678
+ useLocation: i = v.useLocation,
679
+ useAuth: b = v.useAuth,
680
+ Outlet: d = v.Outlet,
681
+ Navigate: w = v.Navigate
682
+ } = oe(z);
683
+ if (b === void 0)
684
+ throw new Error(J("useAuth"));
685
+ if (i === void 0)
686
+ throw new Error(J("useLocation"));
687
+ if (d === void 0)
688
+ throw new Error(J("Outlet"));
689
+ if (w === void 0)
690
+ throw new Error(J("Navigate"));
691
+ const [h, _] = vr(null), { isLogged: O } = b(), T = i();
692
+ return pr(() => {
693
+ l == null || l.interceptors.response.use(
694
+ (u) => u,
695
+ async (u) => {
696
+ var N;
697
+ return typeof u == "object" && u && "response" in u && u.response && typeof u.response == "object" && "status" in u.response && u.response && typeof u.response == "object" && "status" in u.response && ((N = u == null ? void 0 : u.response) == null ? void 0 : N.status) === 401 && (l.defaults.headers.common.Authorization = null, localStorage.removeItem(m), _(y)), Promise.reject(u);
698
+ }
699
+ );
700
+ }, [l == null ? void 0 : l.defaults, l == null ? void 0 : l.interceptors.response, m, y]), O && !h ? /* @__PURE__ */ I(gr, { fallback: f, children: (k = (x = T.state) == null ? void 0 : x.from) != null && k.state && ((C = (M = T.state) == null ? void 0 : M.from) == null ? void 0 : C.pathname) === E ? /* @__PURE__ */ I(w, { to: T.state.from.state.from.pathname + T.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ I(d, {}) }) : /* @__PURE__ */ I(w, { to: E, state: { from: T }, replace: !0 });
701
+ }, ne = (f) => `GTMSendPageView require « ${f} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, Tr = ({ ...f }) => {
684
702
  const {
685
- useLocation: h = f.useLocation,
686
- Outlet: g = f.Outlet,
687
- useGoogleTagManager: E = f.useGoogleTagManager
688
- } = ne(B);
689
- if (h === void 0)
690
- throw new Error(re("useLocation"));
691
- if (g === void 0)
692
- throw new Error(re("Outlet"));
703
+ useLocation: E = f.useLocation,
704
+ Outlet: m = f.Outlet,
705
+ useGoogleTagManager: y = f.useGoogleTagManager
706
+ } = oe(z);
693
707
  if (E === void 0)
694
- throw new Error(re("useGoogleTagManager"));
695
- const { pathname: v } = h(), { sendEvent: m } = E();
696
- return pr(() => {
697
- m({ event: "pageView", pathname: v });
698
- }, [v, m]), /* @__PURE__ */ A(g, {});
699
- }, wr = (f) => {
700
- const { unknownErrorTranslationKey: h = "error.unknownError" } = f || {}, { translate: g = f == null ? void 0 : f.translate } = ne(B);
701
- return { printError: gr(
708
+ throw new Error(ne("useLocation"));
709
+ if (m === void 0)
710
+ throw new Error(ne("Outlet"));
711
+ if (y === void 0)
712
+ throw new Error(ne("useGoogleTagManager"));
713
+ const { pathname: v } = E(), { sendEvent: l } = y();
714
+ return hr(() => {
715
+ l({ event: "pageView", pathname: v });
716
+ }, [v, l]), /* @__PURE__ */ I(m, {});
717
+ }, Or = (f) => {
718
+ const { unknownErrorTranslationKey: E = "error.unknownError" } = f || {}, { translate: m = f == null ? void 0 : f.translate } = oe(z);
719
+ return { printError: Er(
702
720
  (v) => {
703
- var _, c, T, p, y, w, P, F, W;
704
- const m = g ? g(h) : "Unknown error", { response: o } = v || {};
705
- return v != null && v.reason ? String(v.reason) : (_ = o == null ? void 0 : o.data) != null && _.reason ? String(o.data.reason) : (c = o == null ? void 0 : o.data) != null && c.message ? String(o.data.message) : (p = (T = o == null ? void 0 : o.data) == null ? void 0 : T.detail) != null && p.length && Array.isArray((y = o == null ? void 0 : o.data) == null ? void 0 : y.detail) && ((P = (w = o == null ? void 0 : o.data) == null ? void 0 : w.detail[0]) != null && P.msg) && typeof ((W = (F = o == null ? void 0 : o.data) == null ? void 0 : F.detail[0]) == null ? void 0 : W.msg) == "string" ? String(o.data.detail[0].msg) : m;
721
+ var b, d, w, h, _, O, T, x, k;
722
+ const l = m ? m(E) : "Unknown error", { response: i } = v || {};
723
+ return v != null && v.reason ? String(v.reason) : (b = i == null ? void 0 : i.data) != null && b.reason ? String(i.data.reason) : (d = i == null ? void 0 : i.data) != null && d.message ? String(i.data.message) : (h = (w = i == null ? void 0 : i.data) == null ? void 0 : w.detail) != null && h.length && Array.isArray((_ = i == null ? void 0 : i.data) == null ? void 0 : _.detail) && ((T = (O = i == null ? void 0 : i.data) == null ? void 0 : O.detail[0]) != null && T.msg) && typeof ((k = (x = i == null ? void 0 : i.data) == null ? void 0 : x.detail[0]) == null ? void 0 : k.msg) == "string" ? String(i.data.detail[0].msg) : l;
706
724
  },
707
- [g, h]
725
+ [m, E]
708
726
  ) };
709
727
  };
710
728
  export {
711
- _r as GTMSendPageView,
712
- B as InjectDependenciesContext,
713
- br as InjectDependenciesProvider,
714
- Rr as RequireAuth,
715
- wr as useResponseError
729
+ Tr as GTMSendPageView,
730
+ z as InjectDependenciesContext,
731
+ _r as InjectDependenciesProvider,
732
+ wr as RequireAuth,
733
+ Or as useResponseError
716
734
  };
package/dist/main.umd.cjs CHANGED
@@ -1,4 +1,4 @@
1
- (function(C,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],_):(C=typeof globalThis<"u"?globalThis:C||self,_(C["@tracktor/shared-module"]={},C.React))})(this,function(C,_){"use strict";var q={},ke={get exports(){return q},set exports(c){q=c}},L={};/**
1
+ (function(P,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(P=typeof globalThis<"u"?globalThis:P||self,E(P["@tracktor/shared-module"]={},P.React))})(this,function(P,E){"use strict";var q={},Ie={get exports(){return q},set exports(f){q=f}},Y={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var oe;function De(){if(oe)return L;oe=1;var c=_,h=Symbol.for("react.element"),g=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,v=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function o(w,f,O){var p,y={},T=null,x=null;O!==void 0&&(T=""+O),f.key!==void 0&&(T=""+f.key),f.ref!==void 0&&(x=f.ref);for(p in f)E.call(f,p)&&!m.hasOwnProperty(p)&&(y[p]=f[p]);if(w&&w.defaultProps)for(p in f=w.defaultProps,f)y[p]===void 0&&(y[p]=f[p]);return{$$typeof:h,type:w,key:T,ref:x,props:y,_owner:v.current}}return L.Fragment=g,L.jsx=o,L.jsxs=o,L}var M={};/**
9
+ */var ue;function Le(){if(ue)return Y;ue=1;var f=E,m=Symbol.for("react.element"),y=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,v=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function i(R,d,w){var h,T={},S=null,O=null;w!==void 0&&(S=""+w),d.key!==void 0&&(S=""+d.key),d.ref!==void 0&&(O=d.ref);for(h in d)b.call(d,h)&&!l.hasOwnProperty(h)&&(T[h]=d[h]);if(R&&R.defaultProps)for(h in d=R.defaultProps,d)T[h]===void 0&&(T[h]=d[h]);return{$$typeof:m,type:R,key:S,ref:O,props:T,_owner:v.current}}return Y.Fragment=y,Y.jsx=i,Y.jsxs=i,Y}var W={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ie;function Ae(){return ie||(ie=1,process.env.NODE_ENV!=="production"&&function(){var c=_,h=Symbol.for("react.element"),g=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),w=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),W=Symbol.iterator,G="@@iterator";function Ye(e){if(e===null||typeof e!="object")return null;var r=W&&e[W]||e[G];return typeof r=="function"?r:null}var A=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];We("error",e,t)}}function We(e,r,t){{var n=A.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var s=t.map(function(i){return String(i)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Ne=!1,Ve=!1,Ue=!1,Ge=!1,Be=!1,ue;ue=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===m||Be||e===v||e===O||e===p||Ge||e===x||Ne||Ve||Ue||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===y||e.$$typeof===o||e.$$typeof===w||e.$$typeof===f||e.$$typeof===ue||e.getModuleId!==void 0))}function Je(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function se(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case g:return"Portal";case m:return"Profiler";case v:return"StrictMode";case O:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return se(r)+".Consumer";case o:var t=e;return se(t._context)+".Provider";case f:return Je(e,e.render,"ForwardRef");case y:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case T:{var u=e,s=u._payload,i=u._init;try{return P(i(s))}catch{return null}}}return null}var k=Object.assign,N=0,ce,fe,le,de,ve,pe,ge;function he(){}he.__reactDisabledLog=!0;function ze(){{if(N===0){ce=console.log,fe=console.info,le=console.warn,de=console.error,ve=console.group,pe=console.groupCollapsed,ge=console.groupEnd;var e={configurable:!0,enumerable:!0,value:he,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function Ke(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:ce}),info:k({},e,{value:fe}),warn:k({},e,{value:le}),error:k({},e,{value:de}),group:k({},e,{value:ve}),groupCollapsed:k({},e,{value:pe}),groupEnd:k({},e,{value:ge})})}N<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=A.ReactCurrentDispatcher,Z;function B(e,r,t){{if(Z===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);Z=n&&n[1]||""}return`
18
- `+Z+e}}var Q=!1,$;{var qe=typeof WeakMap=="function"?WeakMap:Map;$=new qe}function Ee(e,r){if(!e||Q)return"";{var t=$.get(e);if(t!==void 0)return t}var n;Q=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=X.current,X.current=null,ze();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(j){n=j}Reflect.construct(e,[],i)}else{try{i.call()}catch(j){n=j}e.call(i.prototype)}}else{try{throw Error()}catch(j){n=j}e()}}catch(j){if(j&&n&&typeof j.stack=="string"){for(var a=j.stack.split(`
19
- `),R=n.stack.split(`
20
- `),l=a.length-1,d=R.length-1;l>=1&&d>=0&&a[l]!==R[d];)d--;for(;l>=1&&d>=0;l--,d--)if(a[l]!==R[d]){if(l!==1||d!==1)do if(l--,d--,d<0||a[l]!==R[d]){var S=`
21
- `+a[l].replace(" at new "," at ");return e.displayName&&S.includes("<anonymous>")&&(S=S.replace("<anonymous>",e.displayName)),typeof e=="function"&&$.set(e,S),S}while(l>=1&&d>=0);break}}}finally{Q=!1,X.current=s,Ke(),Error.prepareStackTrace=u}var I=e?e.displayName||e.name:"",xe=I?B(I):"";return typeof e=="function"&&$.set(e,xe),xe}function He(e,r,t){return Ee(e,!1)}function Xe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function J(e,r,t){if(e==null)return"";if(typeof e=="function")return Ee(e,Xe(e));if(typeof e=="string")return B(e);switch(e){case O:return B("Suspense");case p:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return He(e.render);case y:return J(e.type,r,t);case T:{var n=e,u=n._payload,s=n._init;try{return J(s(u),r,t)}catch{}}}return""}var z=Object.prototype.hasOwnProperty,me={},ye=A.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);ye.setExtraStackFrame(t)}else ye.setExtraStackFrame(null)}function Ze(e,r,t,n,u){{var s=Function.call.bind(z);for(var i in e)if(s(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var R=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(K(u),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),K(null)),a instanceof Error&&!(a.message in me)&&(me[a.message]=!0,K(u),b("Failed %s type: %s",t,a.message),K(null))}}}var Qe=Array.isArray;function ee(e){return Qe(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function Re(e){if(rr(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),be(e)}var V=A.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},_e,we,re;re={};function nr(e){if(z.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if(z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&V.current&&r&&V.current.stateNode!==r){var t=P(V.current.type);re[t]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',P(V.current.type),e.ref),re[t]=!0)}}function ir(e,r){{var t=function(){_e||(_e=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function ur(e,r){{var t=function(){we||(we=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var sr=function(e,r,t,n,u,s,i){var a={$$typeof:h,type:e,key:r,ref:t,props:i,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function cr(e,r,t,n,u){{var s,i={},a=null,R=null;t!==void 0&&(Re(t),a=""+t),ar(r)&&(Re(r.key),a=""+r.key),nr(r)&&(R=r.ref,or(r,u));for(s in r)z.call(r,s)&&!tr.hasOwnProperty(s)&&(i[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)i[s]===void 0&&(i[s]=l[s])}if(a||R){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ir(i,d),R&&ur(i,d)}return sr(e,a,R,u,n,V.current,i)}}var te=A.ReactCurrentOwner,Te=A.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(t)}else Te.setExtraStackFrame(null)}var ne;ne=!1;function ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===h}function Oe(){{if(te.current){var e=P(te.current.type);if(e)return`
17
+ */var se;function Me(){return se||(se=1,process.env.NODE_ENV!=="production"&&function(){var f=E,m=Symbol.for("react.element"),y=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),R=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),D=Symbol.iterator,A="@@iterator";function B(e){if(e===null||typeof e!="object")return null;var r=D&&e[D]||e[A];return typeof r=="function"?r:null}var j=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function u(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];ce("error",e,t)}}function ce(e,r,t){{var n=j.ReactDebugCurrentFrame,s=n.getStackAddendum();s!==""&&(r+="%s",t=t.concat([s]));var c=t.map(function(o){return String(o)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var fe=!1,J=!1,Ue=!1,Ge=!1,Be=!1,le;le=Symbol.for("react.module.reference");function Je(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===l||Be||e===v||e===w||e===h||Ge||e===O||fe||J||Ue||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===T||e.$$typeof===i||e.$$typeof===R||e.$$typeof===d||e.$$typeof===le||e.getModuleId!==void 0))}function ze(e,r,t){var n=e.displayName;if(n)return n;var s=r.displayName||r.name||"";return s!==""?t+"("+s+")":t}function de(e){return e.displayName||"Context"}function x(e){if(e==null)return null;if(typeof e.tag=="number"&&u("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case y:return"Portal";case l:return"Profiler";case v:return"StrictMode";case w:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var r=e;return de(r)+".Consumer";case i:var t=e;return de(t._context)+".Provider";case d:return ze(e,e.render,"ForwardRef");case T:var n=e.displayName||null;return n!==null?n:x(e.type)||"Memo";case S:{var s=e,c=s._payload,o=s._init;try{return x(o(c))}catch{return null}}}return null}var F=Object.assign,V=0,ve,pe,ge,he,Ee,me,ye;function be(){}be.__reactDisabledLog=!0;function Ke(){{if(V===0){ve=console.log,pe=console.info,ge=console.warn,he=console.error,Ee=console.group,me=console.groupCollapsed,ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function $e(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:ve}),info:F({},e,{value:pe}),warn:F({},e,{value:ge}),error:F({},e,{value:he}),group:F({},e,{value:Ee}),groupCollapsed:F({},e,{value:me}),groupEnd:F({},e,{value:ye})})}V<0&&u("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=j.ReactCurrentDispatcher,ee;function z(e,r,t){{if(ee===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);ee=n&&n[1]||""}return`
18
+ `+ee+e}}var re=!1,K;{var He=typeof WeakMap=="function"?WeakMap:Map;K=new He}function Re(e,r){if(!e||re)return"";{var t=K.get(e);if(t!==void 0)return t}var n;re=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=Q.current,Q.current=null,Ke();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(k){n=k}Reflect.construct(e,[],o)}else{try{o.call()}catch(k){n=k}e.call(o.prototype)}}else{try{throw Error()}catch(k){n=k}e()}}catch(k){if(k&&n&&typeof k.stack=="string"){for(var a=k.stack.split(`
19
+ `),_=n.stack.split(`
20
+ `),p=a.length-1,g=_.length-1;p>=1&&g>=0&&a[p]!==_[g];)g--;for(;p>=1&&g>=0;p--,g--)if(a[p]!==_[g]){if(p!==1||g!==1)do if(p--,g--,g<0||a[p]!==_[g]){var C=`
21
+ `+a[p].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&K.set(e,C),C}while(p>=1&&g>=0);break}}}finally{re=!1,Q.current=c,$e(),Error.prepareStackTrace=s}var M=e?e.displayName||e.name:"",Fe=M?z(M):"";return typeof e=="function"&&K.set(e,Fe),Fe}function Xe(e,r,t){return Re(e,!1)}function qe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function $(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,qe(e));if(typeof e=="string")return z(e);switch(e){case w:return z("Suspense");case h:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Xe(e.render);case T:return $(e.type,r,t);case S:{var n=e,s=n._payload,c=n._init;try{return $(c(s),r,t)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,_e={},Te=j.ReactDebugCurrentFrame;function X(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(t)}else Te.setExtraStackFrame(null)}function Ze(e,r,t,n,s){{var c=Function.call.bind(H);for(var o in e)if(c(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var _=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(p){a=p}a&&!(a instanceof Error)&&(X(s),u("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),X(null)),a instanceof Error&&!(a.message in _e)&&(_e[a.message]=!0,X(s),u("Failed %s type: %s",t,a.message),X(null))}}}var Qe=Array.isArray;function te(e){return Qe(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function Oe(e){if(rr(e))return u("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),we(e)}var U=j.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},Se,Ce,ne;ne={};function nr(e){if(H.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if(H.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=x(U.current.type);ne[t]||(u('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(U.current.type),e.ref),ne[t]=!0)}}function ir(e,r){{var t=function(){Se||(Se=!0,u("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function ur(e,r){{var t=function(){Ce||(Ce=!0,u("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var sr=function(e,r,t,n,s,c,o){var a={$$typeof:m,type:e,key:r,ref:t,props:o,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function cr(e,r,t,n,s){{var c,o={},a=null,_=null;t!==void 0&&(Oe(t),a=""+t),ar(r)&&(Oe(r.key),a=""+r.key),nr(r)&&(_=r.ref,or(r,s));for(c in r)H.call(r,c)&&!tr.hasOwnProperty(c)&&(o[c]=r[c]);if(e&&e.defaultProps){var p=e.defaultProps;for(c in p)o[c]===void 0&&(o[c]=p[c])}if(a||_){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ir(o,g),_&&ur(o,g)}return sr(e,a,_,s,n,U.current,o)}}var ae=j.ReactCurrentOwner,Pe=j.ReactDebugCurrentFrame;function L(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}var oe;oe=!1;function ie(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function je(){{if(ae.current){var e=x(ae.current.type);if(e)return`
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function fr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
24
24
 
25
- Check your code at `+r+":"+t+"."}return""}}var Se={};function lr(e){{var r=Oe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
25
+ Check your code at `+r+":"+t+"."}return""}}var xe={};function lr(e){{var r=je();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
26
26
 
27
- Check the top-level render call using <`+t+">.")}return r}}function Ce(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=lr(r);if(Se[t])return;Se[t]=!0;var n="";e&&e._owner&&e._owner!==te.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),F(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function Pe(e,r){{if(typeof e!="object")return;if(ee(e))for(var t=0;t<e.length;t++){var n=e[t];ae(n)&&Ce(n,r)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var u=Ye(e);if(typeof u=="function"&&u!==e.entries)for(var s=u.call(e),i;!(i=s.next()).done;)ae(i.value)&&Ce(i.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===y))t=r.propTypes;else return;if(t){var n=P(r);Ze(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ne){ne=!0;var u=P(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}function je(e,r,t,n,u,s){{var i=$e(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R=fr(u);R?a+=R:a+=Oe();var l;e===null?l="null":ee(e)?l="array":e!==void 0&&e.$$typeof===h?(l="<"+(P(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var d=cr(e,r,t,u,s);if(d==null)return d;if(i){var S=r.children;if(S!==void 0)if(n)if(ee(S)){for(var I=0;I<S.length;I++)Pe(S[I],e);Object.freeze&&Object.freeze(S)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Pe(S,e)}return e===E?vr(d):dr(d),d}}function pr(e,r,t){return je(e,r,t,!0)}function gr(e,r,t){return je(e,r,t,!1)}var hr=gr,Er=pr;M.Fragment=E,M.jsx=hr,M.jsxs=Er}()),M}(function(c){process.env.NODE_ENV==="production"?c.exports=De():c.exports=Ae()})(ke);const D=q.jsx,Y=_.createContext({children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),Fe=({children:c,translate:h,useAuth:g,Outlet:E,Navigate:v,useLocation:m,useGoogleTagManager:o})=>{const w=_.useMemo(()=>({Navigate:v,Outlet:E,translate:h,useAuth:g,useGoogleTagManager:o,useLocation:m}),[v,E,h,g,o,m]);return D(Y.Provider,{value:w,children:c})},U=c=>`RequireAuth require « ${c} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ie=({Fallback:c,loginPath:h="/login",...g})=>{var O,p,y,T;const{useLocation:E=g.useLocation,useAuth:v=g.useAuth,Outlet:m=g.Outlet,Navigate:o=g.Navigate}=_.useContext(Y);if(v===void 0)throw new Error(U("useAuth"));if(E===void 0)throw new Error(U("useLocation"));if(m===void 0)throw new Error(U("Outlet"));if(o===void 0)throw new Error(U("Navigate"));const{isLogged:w}=v(),f=E();return w?D(_.Suspense,{fallback:c,children:(p=(O=f.state)==null?void 0:O.from)!=null&&p.state&&((T=(y=f.state)==null?void 0:y.from)==null?void 0:T.pathname)===h?D(o,{to:f.state.from.state.from.pathname+f.state.from.state.from.search,replace:!0}):D(m,{})}):D(o,{to:h,state:{from:f},replace:!0})},H=c=>`GTMSendPageView require « ${c} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Le=({...c})=>{const{useLocation:h=c.useLocation,Outlet:g=c.Outlet,useGoogleTagManager:E=c.useGoogleTagManager}=_.useContext(Y);if(h===void 0)throw new Error(H("useLocation"));if(g===void 0)throw new Error(H("Outlet"));if(E===void 0)throw new Error(H("useGoogleTagManager"));const{pathname:v}=h(),{sendEvent:m}=E();return _.useEffect(()=>{m({event:"pageView",pathname:v})},[v,m]),D(g,{})},Me=c=>{const{unknownErrorTranslationKey:h="error.unknownError"}=c||{},{translate:g=c==null?void 0:c.translate}=_.useContext(Y);return{printError:_.useCallback(v=>{var w,f,O,p,y,T,x,W,G;const m=g?g(h):"Unknown error",{response:o}=v||{};return v!=null&&v.reason?String(v.reason):(w=o==null?void 0:o.data)!=null&&w.reason?String(o.data.reason):(f=o==null?void 0:o.data)!=null&&f.message?String(o.data.message):(p=(O=o==null?void 0:o.data)==null?void 0:O.detail)!=null&&p.length&&Array.isArray((y=o==null?void 0:o.data)==null?void 0:y.detail)&&((x=(T=o==null?void 0:o.data)==null?void 0:T.detail[0])!=null&&x.msg)&&typeof((G=(W=o==null?void 0:o.data)==null?void 0:W.detail[0])==null?void 0:G.msg)=="string"?String(o.data.detail[0].msg):m},[g,h])}};C.GTMSendPageView=Le,C.InjectDependenciesContext=Y,C.InjectDependenciesProvider=Fe,C.RequireAuth=Ie,C.useResponseError=Me,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
27
+ Check the top-level render call using <`+t+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=lr(r);if(xe[t])return;xe[t]=!0;var n="";e&&e._owner&&e._owner!==ae.current&&(n=" It was passed a child from "+x(e._owner.type)+"."),L(e),u('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),L(null)}}function De(e,r){{if(typeof e!="object")return;if(te(e))for(var t=0;t<e.length;t++){var n=e[t];ie(n)&&ke(n,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var s=B(e);if(typeof s=="function"&&s!==e.entries)for(var c=s.call(e),o;!(o=c.next()).done;)ie(o.value)&&ke(o.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===T))t=r.propTypes;else return;if(t){var n=x(r);Ze(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!oe){oe=!0;var s=x(r);u("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&u("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){L(e),u("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),L(null);break}}e.ref!==null&&(L(e),u("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}function Ae(e,r,t,n,s,c){{var o=Je(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=fr(s);_?a+=_:a+=je();var p;e===null?p="null":te(e)?p="array":e!==void 0&&e.$$typeof===m?(p="<"+(x(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):p=typeof e,u("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",p,a)}var g=cr(e,r,t,s,c);if(g==null)return g;if(o){var C=r.children;if(C!==void 0)if(n)if(te(C)){for(var M=0;M<C.length;M++)De(C[M],e);Object.freeze&&Object.freeze(C)}else u("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else De(C,e)}return e===b?vr(g):dr(g),g}}function pr(e,r,t){return Ae(e,r,t,!0)}function gr(e,r,t){return Ae(e,r,t,!1)}var hr=gr,Er=pr;W.Fragment=b,W.jsx=hr,W.jsxs=Er}()),W}(function(f){process.env.NODE_ENV==="production"?f.exports=Le():f.exports=Me()})(Ie);const I=q.jsx,N=E.createContext({axios:void 0,children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),Ye=({axios:f,children:m,translate:y,useAuth:b,Outlet:v,Navigate:l,useLocation:i,useGoogleTagManager:R})=>{const d=E.useMemo(()=>({axios:f,Navigate:l,Outlet:v,translate:y,useAuth:b,useGoogleTagManager:R,useLocation:i}),[l,v,f,y,b,R,i]);return I(N.Provider,{value:d,children:m})},G=f=>`RequireAuth require « ${f} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,We=({Fallback:f,loginPath:m="/login",localStorageKey:y="user",redirect401Path:b="/login",...v})=>{var D,A,B,j;const{axios:l=v.axios,useLocation:i=v.useLocation,useAuth:R=v.useAuth,Outlet:d=v.Outlet,Navigate:w=v.Navigate}=E.useContext(N);if(R===void 0)throw new Error(G("useAuth"));if(i===void 0)throw new Error(G("useLocation"));if(d===void 0)throw new Error(G("Outlet"));if(w===void 0)throw new Error(G("Navigate"));const[h,T]=E.useState(null),{isLogged:S}=R(),O=i();return E.useLayoutEffect(()=>{l==null||l.interceptors.response.use(u=>u,async u=>{var J;return typeof u=="object"&&u&&"response"in u&&u.response&&typeof u.response=="object"&&"status"in u.response&&u.response&&typeof u.response=="object"&&"status"in u.response&&((J=u==null?void 0:u.response)==null?void 0:J.status)===401&&(l.defaults.headers.common.Authorization=null,localStorage.removeItem(y),T(b)),Promise.reject(u)})},[l==null?void 0:l.defaults,l==null?void 0:l.interceptors.response,y,b]),S&&!h?I(E.Suspense,{fallback:f,children:(A=(D=O.state)==null?void 0:D.from)!=null&&A.state&&((j=(B=O.state)==null?void 0:B.from)==null?void 0:j.pathname)===m?I(w,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):I(d,{})}):I(w,{to:m,state:{from:O},replace:!0})},Z=f=>`GTMSendPageView require « ${f} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ne=({...f})=>{const{useLocation:m=f.useLocation,Outlet:y=f.Outlet,useGoogleTagManager:b=f.useGoogleTagManager}=E.useContext(N);if(m===void 0)throw new Error(Z("useLocation"));if(y===void 0)throw new Error(Z("Outlet"));if(b===void 0)throw new Error(Z("useGoogleTagManager"));const{pathname:v}=m(),{sendEvent:l}=b();return E.useEffect(()=>{l({event:"pageView",pathname:v})},[v,l]),I(y,{})},Ve=f=>{const{unknownErrorTranslationKey:m="error.unknownError"}=f||{},{translate:y=f==null?void 0:f.translate}=E.useContext(N);return{printError:E.useCallback(v=>{var R,d,w,h,T,S,O,D,A;const l=y?y(m):"Unknown error",{response:i}=v||{};return v!=null&&v.reason?String(v.reason):(R=i==null?void 0:i.data)!=null&&R.reason?String(i.data.reason):(d=i==null?void 0:i.data)!=null&&d.message?String(i.data.message):(h=(w=i==null?void 0:i.data)==null?void 0:w.detail)!=null&&h.length&&Array.isArray((T=i==null?void 0:i.data)==null?void 0:T.detail)&&((O=(S=i==null?void 0:i.data)==null?void 0:S.detail[0])!=null&&O.msg)&&typeof((A=(D=i==null?void 0:i.data)==null?void 0:D.detail[0])==null?void 0:A.msg)=="string"?String(i.data.detail[0].msg):l},[y,m])}};P.GTMSendPageView=Ne,P.InjectDependenciesContext=N,P.InjectDependenciesProvider=Ye,P.RequireAuth=We,P.useResponseError=Ve,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracktor/shared-module",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "types": "./dist/main.d.ts",