@tracktor/shared-module 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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(_,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],y):(_=typeof globalThis<"u"?globalThis:_||self,y(_["@tracktor/shared-module"]={},_.React))})(this,function(_,y){"use strict";var Q={},Ie={get exports(){return Q},set exports(n){Q=n}},N={};/**
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 N;ue=1;var n=y,d=Symbol.for("react.element"),g=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty,f=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function i(b,p,C){var R,w={},S=null,O=null;C!==void 0&&(S=""+C),p.key!==void 0&&(S=""+p.key),p.ref!==void 0&&(O=p.ref);for(R in p)h.call(p,R)&&!u.hasOwnProperty(R)&&(w[R]=p[R]);if(b&&b.defaultProps)for(R in p=b.defaultProps,p)w[R]===void 0&&(w[R]=p[R]);return{$$typeof:d,type:b,key:S,ref:O,props:w,_owner:f.current}}return N.Fragment=g,N.jsx=i,N.jsxs=i,N}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 n=y,d=Symbol.for("react.element"),g=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),b=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),x=Symbol.iterator,F="@@iterator";function B(e){if(e===null||typeof e!="object")return null;var r=x&&e[x]||e[F];return typeof r=="function"?r:null}var j=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function c(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];ce("error",e,t)}}function ce(e,r,t){{var a=j.ReactDebugCurrentFrame,l=a.getStackAddendum();l!==""&&(r+="%s",t=t.concat([l]));var v=t.map(function(s){return String(s)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var le=!1,z=!1,Je=!1,He=!1,Ke=!1,fe;fe=Symbol.for("react.module.reference");function Xe(e){return!!(typeof e=="string"||typeof e=="function"||e===h||e===u||Ke||e===f||e===C||e===R||He||e===O||le||z||Je||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===w||e.$$typeof===i||e.$$typeof===b||e.$$typeof===p||e.$$typeof===fe||e.getModuleId!==void 0))}function qe(e,r,t){var a=e.displayName;if(a)return a;var l=r.displayName||r.name||"";return l!==""?t+"("+l+")":t}function de(e){return e.displayName||"Context"}function k(e){if(e==null)return null;if(typeof e.tag=="number"&&c("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 h:return"Fragment";case g:return"Portal";case u:return"Profiler";case f:return"StrictMode";case C:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case b:var r=e;return de(r)+".Consumer";case i:var t=e;return de(t._context)+".Provider";case p:return qe(e,e.render,"ForwardRef");case w:var a=e.displayName||null;return a!==null?a:k(e.type)||"Memo";case S:{var l=e,v=l._payload,s=l._init;try{return k(s(v))}catch{return null}}}return null}var I=Object.assign,V=0,ve,pe,ge,he,me,Ee,ye;function be(){}be.__reactDisabledLog=!0;function Qe(){{if(V===0){ve=console.log,pe=console.info,ge=console.warn,he=console.error,me=console.group,Ee=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:I({},e,{value:ve}),info:I({},e,{value:pe}),warn:I({},e,{value:ge}),error:I({},e,{value:he}),group:I({},e,{value:me}),groupCollapsed:I({},e,{value:Ee}),groupEnd:I({},e,{value:ye})})}V<0&&c("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=j.ReactCurrentDispatcher,ee;function J(e,r,t){{if(ee===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);ee=a&&a[1]||""}return`
18
+ `+ee+e}}var re=!1,H;{var Ze=typeof WeakMap=="function"?WeakMap:Map;H=new Ze}function Re(e,r){if(!e||re)return"";{var t=H.get(e);if(t!==void 0)return t}var a;re=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=Z.current,Z.current=null,Qe();try{if(r){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(A){a=A}Reflect.construct(e,[],s)}else{try{s.call()}catch(A){a=A}e.call(s.prototype)}}else{try{throw Error()}catch(A){a=A}e()}}catch(A){if(A&&a&&typeof A.stack=="string"){for(var o=A.stack.split(`
19
+ `),T=a.stack.split(`
20
+ `),m=o.length-1,E=T.length-1;m>=1&&E>=0&&o[m]!==T[E];)E--;for(;m>=1&&E>=0;m--,E--)if(o[m]!==T[E]){if(m!==1||E!==1)do if(m--,E--,E<0||o[m]!==T[E]){var P=`
21
+ `+o[m].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,P),P}while(m>=1&&E>=0);break}}}finally{re=!1,Z.current=v,$e(),Error.prepareStackTrace=l}var M=e?e.displayName||e.name:"",Fe=M?J(M):"";return typeof e=="function"&&H.set(e,Fe),Fe}function er(e,r,t){return Re(e,!1)}function rr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,rr(e));if(typeof e=="string")return J(e);switch(e){case C:return J("Suspense");case R:return J("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return er(e.render);case w:return K(e.type,r,t);case S:{var a=e,l=a._payload,v=a._init;try{return K(v(l),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,_e={},Te=j.ReactDebugCurrentFrame;function q(e){if(e){var r=e._owner,t=K(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(t)}else Te.setExtraStackFrame(null)}function tr(e,r,t,a,l){{var v=Function.call.bind(X);for(var s in e)if(v(e,s)){var o=void 0;try{if(typeof e[s]!="function"){var T=Error((a||"React class")+": "+t+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}o=e[s](r,s,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(m){o=m}o&&!(o instanceof Error)&&(q(l),c("%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).",a||"React class",t,s,typeof o),q(null)),o instanceof Error&&!(o.message in _e)&&(_e[o.message]=!0,q(l),c("Failed %s type: %s",t,o.message),q(null))}}}var nr=Array.isArray;function te(e){return nr(e)}function ar(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function or(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function Ce(e){if(or(e))return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ar(e)),we(e)}var U=j.ReactCurrentOwner,ir={key:!0,ref:!0,__self:!0,__source:!0},Oe,Se,ne;ne={};function ur(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function sr(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function cr(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=k(U.current.type);ne[t]||(c('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',k(U.current.type),e.ref),ne[t]=!0)}}function lr(e,r){{var t=function(){Oe||(Oe=!0,c("%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 fr(e,r){{var t=function(){Se||(Se=!0,c("%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 dr=function(e,r,t,a,l,v,s){var o={$$typeof:d,type:e,key:r,ref:t,props:s,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function vr(e,r,t,a,l){{var v,s={},o=null,T=null;t!==void 0&&(Ce(t),o=""+t),sr(r)&&(Ce(r.key),o=""+r.key),ur(r)&&(T=r.ref,cr(r,l));for(v in r)X.call(r,v)&&!ir.hasOwnProperty(v)&&(s[v]=r[v]);if(e&&e.defaultProps){var m=e.defaultProps;for(v in m)s[v]===void 0&&(s[v]=m[v])}if(o||T){var E=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&lr(s,E),T&&fr(s,E)}return dr(e,o,T,l,a,U.current,s)}}var ae=j.ReactCurrentOwner,Pe=j.ReactDebugCurrentFrame;function L(e){if(e){var r=e._owner,t=K(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===d}function je(){{if(ae.current){var e=k(ae.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function fr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
23
+ Check the render method of \``+e+"`."}return""}}function pr(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 ke={};function gr(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 Ae(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=gr(r);if(ke[t])return;ke[t]=!0;var a="";e&&e._owner&&e._owner!==ae.current&&(a=" It was passed a child from "+k(e._owner.type)+"."),L(e),c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),L(null)}}function xe(e,r){{if(typeof e!="object")return;if(te(e))for(var t=0;t<e.length;t++){var a=e[t];ie(a)&&Ae(a,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var l=B(e);if(typeof l=="function"&&l!==e.entries)for(var v=l.call(e),s;!(s=v.next()).done;)ie(s.value)&&Ae(s.value,r)}}}function hr(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===p||r.$$typeof===w))t=r.propTypes;else return;if(t){var a=k(r);tr(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!oe){oe=!0;var l=k(r);c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){L(e),c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),L(null);break}}e.ref!==null&&(L(e),c("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}function De(e,r,t,a,l,v){{var s=Xe(e);if(!s){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" 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 T=pr(l);T?o+=T:o+=je();var m;e===null?m="null":te(e)?m="array":e!==void 0&&e.$$typeof===d?(m="<"+(k(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):m=typeof e,c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",m,o)}var E=vr(e,r,t,l,v);if(E==null)return E;if(s){var P=r.children;if(P!==void 0)if(a)if(te(P)){for(var M=0;M<P.length;M++)xe(P[M],e);Object.freeze&&Object.freeze(P)}else c("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 xe(P,e)}return e===h?mr(E):hr(E),E}}function Er(e,r,t){return De(e,r,t,!0)}function yr(e,r,t){return De(e,r,t,!1)}var br=yr,Rr=Er;W.Fragment=h,W.jsx=br,W.jsxs=Rr}()),W}(function(n){process.env.NODE_ENV==="production"?n.exports=Le():n.exports=Me()})(Ie);const D=Q.jsx,Y=y.createContext({axios:void 0,children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),Ne=({axios:n,children:d,translate:g,useAuth:h,Outlet:f,Navigate:u,useLocation:i,useGoogleTagManager:b})=>{const p=y.useMemo(()=>({axios:n,Navigate:u,Outlet:f,translate:g,useAuth:h,useGoogleTagManager:b,useLocation:i}),[u,f,n,g,h,b,i]);return D(Y.Provider,{value:p,children:d})},G=n=>`RequireAuth require « ${n} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,We=({Fallback:n,loginPath:d="/login",localStorageKey:g="user",redirect401Path:h="/login",...f})=>{var x,F,B,j;const{axios:u=f.axios,useLocation:i=f.useLocation,useAuth:b=f.useAuth,Outlet:p=f.Outlet,Navigate:C=f.Navigate}=y.useContext(Y);if(b===void 0)throw new Error(G("useAuth"));if(i===void 0)throw new Error(G("useLocation"));if(p===void 0)throw new Error(G("Outlet"));if(C===void 0)throw new Error(G("Navigate"));const[R,w]=y.useState(null),{isLogged:S}=b(),O=i();return y.useLayoutEffect(()=>{u==null||u.interceptors.response.use(c=>c,async c=>{var z;return typeof c=="object"&&c&&"response"in c&&c.response&&typeof c.response=="object"&&"status"in c.response&&c.response&&typeof c.response=="object"&&"status"in c.response&&((z=c==null?void 0:c.response)==null?void 0:z.status)===401&&(u.defaults.headers.common.Authorization=null,localStorage.removeItem(g),w(h)),Promise.reject(c)})},[u==null?void 0:u.defaults,u==null?void 0:u.interceptors.response,g,h]),S&&!R?D(y.Suspense,{fallback:n,children:(F=(x=O.state)==null?void 0:x.from)!=null&&F.state&&((j=(B=O.state)==null?void 0:B.from)==null?void 0:j.pathname)===d?D(C,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):D(p,{})}):D(C,{to:d,state:{from:O},replace:!0})},$=n=>`GTMSendPageView require « ${n} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ye=({...n})=>{const{useLocation:d=n.useLocation,Outlet:g=n.Outlet,useGoogleTagManager:h=n.useGoogleTagManager}=y.useContext(Y);if(d===void 0)throw new Error($("useLocation"));if(g===void 0)throw new Error($("Outlet"));if(h===void 0)throw new Error($("useGoogleTagManager"));const{pathname:f}=d(),{sendEvent:u}=h();return y.useEffect(()=>{u({event:"pageView",pathname:f})},[f,u]),D(g,{})},Ve=({axios:n,baseURL:d,userLocalStorageKey:g="user",postContentType:h="application/json"})=>(y.useLayoutEffect(()=>{if(!n.defaults)return;const f=localStorage.getItem(g),u=f?JSON.parse(f):null,i=u&&typeof u=="object"&&"tokenType"in u&&u.tokenType?u.tokenType:null,b=u&&typeof u=="object"&&"accessToken"in u&&u.accessToken?u.accessToken:null,p=f?`${i} ${b}`:null;n.defaults.baseURL=d,n.defaults.headers.post["Content-Type"]=h,p&&(n.defaults.headers.common.Authorization=p)},[n.defaults,n.defaults.baseURL,n.defaults.headers.common,n.defaults.headers.post,d,h,g]),null),Ue=({i18n:n,initReactI18next:d,resources:g,LanguageDetector:h})=>(n.use(h).use(d).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:g,returnNull:!1}).then(()=>{document.documentElement.lang!==n.resolvedLanguage&&n.resolvedLanguage&&document.documentElement.setAttribute("lang",n.resolvedLanguage)}),n.on("languageChanged",f=>{document.documentElement.setAttribute("lang",f)}),null),Ge=({dsn:n,sentry:d})=>(y.useLayoutEffect(()=>{d&&process.env.NODE_ENV!=="development"&&d.init({dsn:n,integrations:[new d.BrowserTracing],tracesSampleRate:1})},[n,d]),null),Be=({children:n,defaultOptions:d,QueryClient:g,QueryClientProvider:h})=>{const f=new g({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,...d}}});return D(h,{client:f,children:n})},ze=n=>{const{unknownErrorTranslationKey:d="error.unknownError"}=n||{},{translate:g=n==null?void 0:n.translate}=y.useContext(Y);return{printError:y.useCallback(f=>{var b,p,C,R,w,S,O,x,F;const u=g?g(d):"Unknown error",{response:i}=f||{};return f!=null&&f.reason?String(f.reason):(b=i==null?void 0:i.data)!=null&&b.reason?String(i.data.reason):(p=i==null?void 0:i.data)!=null&&p.message?String(i.data.message):(R=(C=i==null?void 0:i.data)==null?void 0:C.detail)!=null&&R.length&&Array.isArray((w=i==null?void 0:i.data)==null?void 0:w.detail)&&((O=(S=i==null?void 0:i.data)==null?void 0:S.detail[0])!=null&&O.msg)&&typeof((F=(x=i==null?void 0:i.data)==null?void 0:x.detail[0])==null?void 0:F.msg)=="string"?String(i.data.detail[0].msg):u},[g,d])}};_.AxiosConfig=Ve,_.GTMSendPageView=Ye,_.I18nConfig=Ue,_.InjectDependenciesContext=Y,_.InjectDependenciesProvider=Ne,_.QueryClientProvider=Be,_.RequireAuth=We,_.SentryConfig=Ge,_.useResponseError=ze,Object.defineProperty(_,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.5.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "types": "./dist/main.d.ts",
@@ -1,3 +0,0 @@
1
- import GTMSendPageView from "./GTMSendPageView";
2
- export default GTMSendPageView;
3
- export * from "./GTMSendPageView";
@@ -1,19 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { InjectDependenciesContextProps } from '../../context/InjectDependenciesProvider';
3
- export interface RequireAuthProps {
4
- loginPath?: string;
5
- Fallback?: ReactNode;
6
- Outlet?: InjectDependenciesContextProps["Outlet"];
7
- Navigate?: InjectDependenciesContextProps["Navigate"];
8
- useLocation?: InjectDependenciesContextProps["useLocation"];
9
- useAuth?: InjectDependenciesContextProps["useAuth"];
10
- }
11
- /**
12
- * RequireAuth component for protected routing
13
- * @param Fallback
14
- * @param loginPath
15
- * @param props
16
- * @constructor
17
- */
18
- declare const RequireAuth: ({ Fallback, loginPath, ...props }: RequireAuthProps) => JSX.Element;
19
- export default RequireAuth;
@@ -1,3 +0,0 @@
1
- import RequireAuth from "./RequireAuth";
2
- export default RequireAuth;
3
- export * from "./RequireAuth";