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