@tracktor/shared-module 2.13.0 → 2.13.2
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 +2 -2
- package/dist/hooks/useResponseError/useResponseError.d.ts +1 -1
- package/dist/main.cjs +7 -7
- package/dist/main.js +266 -251
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -28,6 +28,6 @@ export interface useResponseErrorParams {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const useResponseError: <T = ResponseError>(params?: useResponseErrorParams) => {
|
|
30
30
|
getErrorCode: (error?: any) => string;
|
|
31
|
-
printError: (error?:
|
|
31
|
+
printError: (error?: unknown) => any;
|
|
32
32
|
};
|
|
33
33
|
export default useResponseError;
|
package/dist/main.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var gt=Object.create;var Ie=Object.defineProperty;var
|
|
1
|
+
"use strict";var gt=Object.create;var Ie=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var pt=(t,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ht(r))!Et.call(t,a)&&a!==o&&Ie(t,a,{get:()=>r[a],enumerable:!(i=yt(r,a))||i.enumerable});return t};var Fe=(t,r,o)=>(o=t!=null?gt(mt(t)):{},pt(r||!t||!t.__esModule?Ie(o,"default",{value:t,enumerable:!0}):o,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react");var se={exports:{}},G={};/**
|
|
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 Le;function
|
|
9
|
+
*/var Le;function wt(){if(Le)return G;Le=1;var t=p,r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function l(d,u,y){var g,S={},w=null,s=null;y!==void 0&&(w=""+y),u.key!==void 0&&(w=""+u.key),u.ref!==void 0&&(s=u.ref);for(g in u)i.call(u,g)&&!f.hasOwnProperty(g)&&(S[g]=u[g]);if(d&&d.defaultProps)for(g in u=d.defaultProps,u)S[g]===void 0&&(S[g]=u[g]);return{$$typeof:r,type:d,key:w,ref:s,props:S,_owner:a.current}}return G.Fragment=o,G.jsx=l,G.jsxs=l,G}var J={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,12 +14,12 @@
|
|
|
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 $e;function
|
|
18
|
-
`+re+e}}var ne=!1,B;{var Ge=typeof WeakMap=="function"?WeakMap:Map;B=new Ge}function
|
|
17
|
+
*/var $e;function Rt(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){var t=p,r=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),d=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),s=Symbol.for("react.offscreen"),R=Symbol.iterator,_="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var n=R&&e[R]||e[_];return typeof n=="function"?n:null}var E=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(e){{for(var n=arguments.length,c=new Array(n>1?n-1:0),v=1;v<n;v++)c[v-1]=arguments[v];I("error",e,c)}}function I(e,n,c){{var v=E.ReactDebugCurrentFrame,C=v.getStackAddendum();C!==""&&(n+="%s",c=c.concat([C]));var b=c.map(function(m){return String(m)});b.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,b)}}var $=!1,N=!1,Y=!1,O=!1,ue=!1,ee;ee=Symbol.for("react.module.reference");function q(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===f||ue||e===a||e===y||e===g||O||e===s||$||N||Y||typeof e=="object"&&e!==null&&(e.$$typeof===w||e.$$typeof===S||e.$$typeof===l||e.$$typeof===d||e.$$typeof===u||e.$$typeof===ee||e.getModuleId!==void 0))}function Ue(e,n,c){var v=e.displayName;if(v)return v;var C=n.displayName||n.name||"";return C!==""?c+"("+C+")":c}function le(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&j("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 i:return"Fragment";case o:return"Portal";case f:return"Profiler";case a:return"StrictMode";case y:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var n=e;return le(n)+".Consumer";case l:var c=e;return le(c._context)+".Provider";case u:return Ue(e,e.render,"ForwardRef");case S:var v=e.displayName||null;return v!==null?v:W(e.type)||"Memo";case w:{var C=e,b=C._payload,m=C._init;try{return W(m(b))}catch{return null}}}return null}var z=Object.assign,M=0,fe,de,ve,ge,ye,he,me;function Ee(){}Ee.__reactDisabledLog=!0;function Ve(){{if(M===0){fe=console.log,de=console.info,ve=console.warn,ge=console.error,ye=console.group,he=console.groupCollapsed,me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function Me(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:fe}),info:z({},e,{value:de}),warn:z({},e,{value:ve}),error:z({},e,{value:ge}),group:z({},e,{value:ye}),groupCollapsed:z({},e,{value:he}),groupEnd:z({},e,{value:me})})}M<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=E.ReactCurrentDispatcher,re;function K(e,n,c){{if(re===void 0)try{throw Error()}catch(C){var v=C.stack.trim().match(/\n( *(at )?)/);re=v&&v[1]||""}return`
|
|
18
|
+
`+re+e}}var ne=!1,B;{var Ge=typeof WeakMap=="function"?WeakMap:Map;B=new Ge}function pe(e,n){if(!e||ne)return"";{var c=B.get(e);if(c!==void 0)return c}var v;ne=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=te.current,te.current=null,Ve();try{if(n){var m=function(){throw Error()};if(Object.defineProperty(m.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(m,[])}catch(F){v=F}Reflect.construct(e,[],m)}else{try{m.call()}catch(F){v=F}e.call(m.prototype)}}else{try{throw Error()}catch(F){v=F}e()}}catch(F){if(F&&v&&typeof F.stack=="string"){for(var h=F.stack.split(`
|
|
19
19
|
`),A=v.stack.split(`
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
20
|
+
`),P=h.length-1,T=A.length-1;P>=1&&T>=0&&h[P]!==A[T];)T--;for(;P>=1&&T>=0;P--,T--)if(h[P]!==A[T]){if(P!==1||T!==1)do if(P--,T--,T<0||h[P]!==A[T]){var D=`
|
|
21
|
+
`+h[P].replace(" at new "," at ");return e.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",e.displayName)),typeof e=="function"&&B.set(e,D),D}while(P>=1&&T>=0);break}}}finally{ne=!1,te.current=b,Me(),Error.prepareStackTrace=C}var V=e?e.displayName||e.name:"",De=V?K(V):"";return typeof e=="function"&&B.set(e,De),De}function Je(e,n,c){return pe(e,!1)}function qe(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function Q(e,n,c){if(e==null)return"";if(typeof e=="function")return pe(e,qe(e));if(typeof e=="string")return K(e);switch(e){case y:return K("Suspense");case g:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Je(e.render);case S:return Q(e.type,n,c);case w:{var v=e,C=v._payload,b=v._init;try{return Q(b(C),n,c)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,we={},Re=E.ReactDebugCurrentFrame;function X(e){if(e){var n=e._owner,c=Q(e.type,e._source,n?n.type:null);Re.setExtraStackFrame(c)}else Re.setExtraStackFrame(null)}function Ke(e,n,c,v,C){{var b=Function.call.bind(H);for(var m in e)if(b(e,m)){var h=void 0;try{if(typeof e[m]!="function"){var A=Error((v||"React class")+": "+c+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}h=e[m](n,m,v,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(P){h=P}h&&!(h instanceof Error)&&(X(C),j("%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).",v||"React class",c,m,typeof h),X(null)),h instanceof Error&&!(h.message in we)&&(we[h.message]=!0,X(C),j("Failed %s type: %s",c,h.message),X(null))}}}var Be=Array.isArray;function oe(e){return Be(e)}function Qe(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,c=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function He(e){try{return Ce(e),!1}catch{return!0}}function Ce(e){return""+e}function _e(e){if(He(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qe(e)),Ce(e)}var Se=E.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},be,je;function Ze(e){if(H.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function et(e){if(H.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function tt(e,n){typeof e.ref=="string"&&Se.current}function rt(e,n){{var c=function(){be||(be=!0,j("%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)",n))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function nt(e,n){{var c=function(){je||(je=!0,j("%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)",n))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var ot=function(e,n,c,v,C,b,m){var h={$$typeof:r,type:e,key:n,ref:c,props:m,_owner:b};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function at(e,n,c,v,C){{var b,m={},h=null,A=null;c!==void 0&&(_e(c),h=""+c),et(n)&&(_e(n.key),h=""+n.key),Ze(n)&&(A=n.ref,tt(n,C));for(b in n)H.call(n,b)&&!Xe.hasOwnProperty(b)&&(m[b]=n[b]);if(e&&e.defaultProps){var P=e.defaultProps;for(b in P)m[b]===void 0&&(m[b]=P[b])}if(h||A){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&rt(m,T),A&&nt(m,T)}return ot(e,h,A,C,v,Se.current,m)}}var ae=E.ReactCurrentOwner,Pe=E.ReactDebugCurrentFrame;function U(e){if(e){var n=e._owner,c=Q(e.type,e._source,n?n.type:null);Pe.setExtraStackFrame(c)}else Pe.setExtraStackFrame(null)}var ie;ie=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Te(){{if(ae.current){var e=W(ae.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function it(e){return""}var Oe={};function ct(e){{var n=Te();if(!n){var c=typeof e=="string"?e:e.displayName||e.name;c&&(n=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+c+">.")}return n}}function xe(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ct(n);if(Oe[c])return;Oe[c]=!0;var v="";e&&e._owner&&e._owner!==ae.current&&(v=" It was passed a child from "+W(e._owner.type)+"."),U(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,v),U(null)}}function Ae(e,n){{if(typeof e!="object")return;if(oe(e))for(var c=0;c<e.length;c++){var v=e[c];ce(v)&&xe(v,n)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=j(e);if(typeof R=="function"&&R!==e.entries)for(var S=R.call(e),E;!(E=S.next()).done;)ce(E.value)&&xe(E.value,n)}}}function st(e){{var n=e.type;if(n==null||typeof n=="string")return;var c;if(typeof n=="function")c=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===C))c=n.propTypes;else return;if(c){var v=W(n);Ke(c,e.props,"prop",v,e)}else if(n.PropTypes!==void 0&&!ie){ie=!0;var R=W(n);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ut(e){{for(var n=Object.keys(e.props),c=0;c<n.length;c++){var v=n[c];if(v!=="children"&&v!=="key"){U(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),U(null);break}}e.ref!==null&&(U(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function ke(e,n,c,v,R,S){{var E=q(e);if(!E){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" 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 A=it();A?m+=A:m+=Te();var T;e===null?T="null":oe(e)?T="array":e!==void 0&&e.$$typeof===r?(T="<"+(W(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,m)}var O=at(e,n,c,R,S);if(O==null)return O;if(E){var I=n.children;if(I!==void 0)if(v)if(oe(I)){for(var V=0;V<I.length;V++)Ae(I[V],e);Object.freeze&&Object.freeze(I)}else _("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 Ae(I,e)}return e===i?ut(O):st(O),O}}function lt(e,n,c){return ke(e,n,c,!0)}function ft(e,n,c){return ke(e,n,c,!1)}var dt=ft,vt=lt;J.Fragment=i,J.jsx=dt,J.jsxs=vt}()),J}process.env.NODE_ENV==="production"?se.exports=Rt():se.exports=pt();var Y=se.exports;const D=w.createContext({}),Ct=({children:t,apiURL:r,libraries:o,localStorageKeys:i})=>{const a=w.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:i}),[r,o,i]);return Y.jsx(D.Provider,{value:a,children:t})},_t="user",St=({Fallback:t,isLogged:r,loginPath:o="/login",redirect401Path:i="/login",...a})=>{var k,F,L,$;const{libraries:f,localStorageKeys:l}=w.useContext(D),d=(a==null?void 0:a.reactRouter)||(f==null?void 0:f.reactRouter),u=(a==null?void 0:a.axios)||(f==null?void 0:f.axios),h=(a==null?void 0:a.localStorageKey)||(l==null?void 0:l.user)||_t;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,C]=w.useState(null),{useLocation:b,Navigate:s,Outlet:P}=d,p=b(),j=w.useRef(!1),y=typeof r=="function"?r():!!r,_=typeof y=="boolean"?y:y==null?void 0:y.isLogged;return w.useEffect(()=>{j.current||(j.current=!0,u.interceptors.response.use(x=>x,async x=>{var q;return typeof x=="object"&&x&&"response"in x&&x.response&&typeof x.response=="object"&&"status"in x.response&&x.response&&typeof x.response=="object"&&"status"in x.response&&((q=x==null?void 0:x.response)==null?void 0:q.status)===401&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(h),C(i)),Promise.reject(x)}))},[u.defaults.headers.common,u.interceptors.response,h,i]),_&&!g?Y.jsx(w.Suspense,{fallback:t,children:(F=(k=p.state)==null?void 0:k.from)!=null&&F.state&&(($=(L=p.state)==null?void 0:L.from)==null?void 0:$.pathname)===o?Y.jsx(s,{to:p.state.from.state.from.pathname+p.state.from.state.from.search,replace:!0}):Y.jsx(P,{})}):Y.jsx(s,{to:o+p.search,state:{from:p},replace:!0})},Pt=({data:t,...r})=>{const{libraries:o}=w.useContext(D),i=(r==null?void 0:r.reactRouter)||(o==null?void 0:o.reactRouter),a=(r==null?void 0:r.gtm)||(o==null?void 0:o.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!a)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:f}=a,{useLocation:l,Outlet:d}=i,{pathname:u}=l(),{sendEvent:h}=f();return w.useEffect(()=>{h({event:"pageView",pathname:u,...t})},[t,u,h]),Y.jsx(d,{})},bt="user",jt=({tokenTypeKey:t="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...i})=>{const{apiURL:a=i.apiURL,libraries:f,localStorageKeys:l}=w.useContext(D),d=(i==null?void 0:i.userLocalStorageKey)||(l==null?void 0:l.user)||bt,u=(i==null?void 0:i.axios)||(f==null?void 0:f.axios);if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(u!=null&&u.defaults))return null;if(typeof window<"u"&&window.localStorage){const h=localStorage.getItem(d),g=h?JSON.parse(h):null,C=g!=null&&g[t]?g[t]:null,b=g!=null&&g[r]?g[r]:null,s=h?`${C} ${b}`:null;s&&(u.defaults.headers.common.Authorization=s)}return u.defaults.baseURL=a,u.defaults.headers.post["Content-Type"]=o,null},Tt=({debug:t,resources:r,...o})=>{const{libraries:i}=w.useContext(D),a=(o==null?void 0:o.i18)||(i==null?void 0:i.i18),{i18next:f,initReactI18next:l,languageDetector:d}=a||{};if(!a)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Ot=({dsn:t,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:i,replaysOnErrorSampleRate:a,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:u,release:h,...g})=>{const{libraries:C}=w.useContext(D),b=(g==null?void 0:g.sentry)||(C==null?void 0:C.sentry),s=(g==null?void 0:g.reactRouter)||(C==null?void 0:C.reactRouter);if(!b)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(b.isInitialized())return null;const{createRoutesFromChildren:P,matchRoutes:p,useLocation:j,useNavigationType:y}=s;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&b.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...l||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[b.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:P,matchRoutes:p,useEffect:w.useEffect,useLocation:j,useNavigationType:y}),...r||[]],release:h,replaysOnErrorSampleRate:a||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},xt=({IMaskMixin:t,...r})=>{const o=w.useMemo(()=>t(({TextField:i,...a})=>Y.jsx(i,{...a})),[t]);return Y.jsx(o,{...r})},At=({language:t,...r})=>{const{libraries:o}=w.useContext(D),i=(r==null?void 0:r.dayjs)||(o==null?void 0:o.dayjs),a=(r==null?void 0:r.plugin)||(o==null?void 0:o.dayjsPlugin);if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return w.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";a&&a.forEach(u=>{u&&i.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(l)})().then()},[i,a,t]),null},kt=()=>(w.useEffect(()=>{const t=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),Dt=t=>t&&typeof t=="function",It=t=>t&&typeof t=="function",Ft=({children:t,defaultQueriesOptions:r,defaultMutationsOptions:o,...i})=>{var u,h;const{libraries:a}=w.useContext(D),f=(i==null?void 0:i.QueryClient)||((u=a==null?void 0:a.reactQuery)==null?void 0:u.QueryClient),l=(i==null?void 0:i.QueryClientProvider)||((h=a==null?void 0:a.reactQuery)==null?void 0:h.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Dt(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!It(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(g,C,b)=>g.length+(b||0),refetchOnWindowFocus:!1,retry:3,...r}}});return Y.jsx(l,{client:d,children:t})},Lt=t=>{var h,g,C;const{libraries:r}=w.useContext(D),o=(t==null?void 0:t.i18)||(r==null?void 0:r.i18),i=((h=t==null?void 0:t.i18)==null?void 0:h.translateFunction)||((g=r==null?void 0:r.i18)==null?void 0:g.translateFunction),a=((C=o==null?void 0:o.i18next)==null?void 0:C.t)||i||(b=>b),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=a(f),d=w.useCallback(b=>{var P,p,j,y,_,k,F,L,$;const{response:s}=b||{};return s!=null&&s.reason?String(s.reason):(P=s==null?void 0:s.data)!=null&&P.reason?String(s.data.reason):(p=s==null?void 0:s.data)!=null&&p.message?String(s.data.message):(y=(j=s==null?void 0:s.data)==null?void 0:j.detail)!=null&&y.length&&Array.isArray((_=s==null?void 0:s.data)==null?void 0:_.detail)&&((F=(k=s==null?void 0:s.data)==null?void 0:k.detail[0])!=null&&F.msg)&&typeof(($=(L=s==null?void 0:s.data)==null?void 0:L.detail[0])==null?void 0:$.msg)=="string"?String(s.data.detail[0].msg):l},[l]);return{getErrorCode:w.useCallback(b=>{var P,p,j;const{response:s}=b||{};return s!=null&&s.error_code?String(s==null?void 0:s.error_code):(P=s==null?void 0:s.data)!=null&&P.error_code?String((p=s==null?void 0:s.data)==null?void 0:p.error_code):s!=null&&s.error_code?String(s==null?void 0:s.error_code):(j=s==null?void 0:s.data)!=null&&j.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:d}},$t=({data:t,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:i,isLoading:a,enabled:f=!0})=>{const l=w.useCallback(async u=>{o||!f||await r({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[f,r,o]),d=w.useMemo(()=>{if(t)return t.pages.reduce((u,h)=>[...u,...h],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||a,loadingVariant:i?"skeleton":"linear",rows:d}},Nt=t=>{const{libraries:r}=w.useContext(D),o=(t==null?void 0:t.axios)||(r==null?void 0:r.axios),i=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=w.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return w.useEffect(()=>{const l=({newValue:d,key:u})=>{if(u===i&&d)try{const{accessToken:h,tokenType:g}=JSON.parse(d);a({accessToken:h,tokenType:g})}catch(h){console.error("Failed to parse newValue from localStorage:",h)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[i,a]),{clearAuthenticationToken:f,setAuthenticationToken:a}},Ye=({library:t,date:r,format:o="ll"})=>t(r).format(o),We=(t,r)=>{const{fractionDigits:o=0,metric:i="km"}=r||{},a=Number(t);return Number.isNaN(a)?`0${i}`:`${a.toFixed(o)}${i}`},ze=t=>!t||typeof t!="string"?"":t.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Yt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,Wt=({path:t,size:r,apiURL:o})=>{if(!t)return"";const i=Yt(t),a=`${o}${i}`,f=a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&f?`${a.replace("/files",`/thumbs/${r}`)}`:a},zt=t=>{const{apiURL:r,libraries:o}=w.useContext(D),i=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return Ye({date:l,format:d,library:i})},distanceAdapter:We,filePathAdapter:(l,d)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return Wt({apiURL:r,path:l,size:d})},worksiteNameAdapter:ze}},Z=(t,r)=>r==="short"?t.split("-")[0]:t,Ut=(t,r="full")=>{const[o,i]=w.useState(()=>{const a=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,Z(a,r)});return w.useEffect(()=>{var f;t&&"isInitialized"in t&&t.isInitialized&&t.language&&i(Z(t.language,r));const a=l=>{i(Z(l,r))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",a),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",a)}},[t,r]),o},Vt="tracktor.filter",Ne=(t,r,o)=>`${o}_${t}=>${r}`,Mt=t=>{const{libraries:r,localStorageKeys:o}=w.useContext(D),i=(t==null?void 0:t.reactRouter)||(r==null?void 0:r.reactRouter),{useLocation:a,useSearchParams:f}=i,{pathname:l}=a(),[d,u]=f(),h=(o==null?void 0:o.filter)||Vt;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const g=(P,p,j=!0)=>{const y=Ne(P,(t==null?void 0:t.pathname)||l,h);if(!p||Array.isArray(p)&&!p.length){d.delete(P),u(d),localStorage.removeItem(y);return}j&&p&&localStorage.setItem(y,JSON.stringify({...d,[P]:p})),p&&(d.set(P,JSON.stringify(p)),u(d))};return{getFilter:(P,p)=>{const j=d.get(P);if(j)try{return JSON.parse(j)}catch{return j}const y=Ne(P,(t==null?void 0:t.pathname)||l,h),_=localStorage.getItem(y);if(_)try{return JSON.parse(_)[P]}catch{}return p},getFilters:()=>{const P=Object.fromEntries(d.entries()),j=Object.keys(localStorage).filter(y=>y.startsWith(h)&&y.endsWith((t==null?void 0:t.pathname)||l)).reduce((y,_)=>{var F,L;const k=localStorage.getItem(_);if(k){const $=JSON.parse(k),x=(F=Object.keys($))==null?void 0:F[0];y[x]=(L=Object.values($))==null?void 0:L[0]}return y},{});return{...P,...j}},handleFilter:(P,p)=>(j,y)=>{if(y||Array.isArray(y)&&y.length===0){const _=p||"value",k=typeof y=="object"&&_ in y?y[_]:y;g(P,k);return}g(P,void 0)},setFilter:g}},Gt=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Jt=t=>{const i=t.split("/").filter(a=>a.length>0).map(a=>a.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},qt=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),Kt=(t,r,o,i)=>{const a=Jt(r),f=Gt(o),l=`${a}${f}`;return t&&typeof t=="object"&&"operationId"in t&&(i!=null&&i.includes(String(t.operationId)))?`${l}AsQuery`:l},Bt=(t,r)=>{const o={};return t==null||t.forEach(i=>{o[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),r==null||r.filter(i=>!o[i]).forEach(i=>{o[i]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Qt=t=>(Array.isArray(t)?t:[t]).reduce((o,i)=>{const{output:a,useInfiniteIds:f,useQueryIds:l,input:d="./openapi.json"}=i||{},u=qt(d);return{...o,[u]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:d,output:{baseUrl:a==null?void 0:a.baseUrl,client:"react-query",mode:"tags-split",override:{...((f==null?void 0:f.length)||(l==null?void 0:l.length))&&{operations:Bt(f,l)},header:h=>["Generated by orval 🍺",...h.title?[h.title]:[],...h.description?[h.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(h,g,C)=>Kt(h,g,C,l),query:{useQuery:!0}},schemas:(a==null?void 0:a.schemas)||`src/api/${u}/model`,target:(a==null?void 0:a.target)||`src/api/${u}/services/api.ts`,...a}}}},{});exports.GTMSendPageView=Pt;exports.InitializeAxiosConfig=jt;exports.InitializeDaysJSConfig=At;exports.InitializeI18nConfig=Tt;exports.InitializeSentryConfig=Ot;exports.InjectDependenciesContext=D;exports.InjectDependenciesProvider=Ct;exports.MaskTextField=xt;exports.PreloadErrorHandler=kt;exports.QueryClientProviderWithConfig=Ft;exports.RequireAuth=St;exports.dateAdapter=Ye;exports.distanceAdapter=We;exports.getOrvalConfig=Qt;exports.useAdapter=zt;exports.useAuth=Nt;exports.useCurrentLanguage=Ut;exports.useFilters=Mt;exports.useInfiniteDataGrid=$t;exports.useResponseError=Lt;exports.worksiteNameAdapter=ze;
|
|
25
|
+
Check the top-level render call using <`+c+">.")}return n}}function xe(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ct(n);if(Oe[c])return;Oe[c]=!0;var v="";e&&e._owner&&e._owner!==ae.current&&(v=" It was passed a child from "+W(e._owner.type)+"."),U(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,v),U(null)}}function Ae(e,n){{if(typeof e!="object")return;if(oe(e))for(var c=0;c<e.length;c++){var v=e[c];ce(v)&&xe(v,n)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var C=x(e);if(typeof C=="function"&&C!==e.entries)for(var b=C.call(e),m;!(m=b.next()).done;)ce(m.value)&&xe(m.value,n)}}}function st(e){{var n=e.type;if(n==null||typeof n=="string")return;var c;if(typeof n=="function")c=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===S))c=n.propTypes;else return;if(c){var v=W(n);Ke(c,e.props,"prop",v,e)}else if(n.PropTypes!==void 0&&!ie){ie=!0;var C=W(n);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ut(e){{for(var n=Object.keys(e.props),c=0;c<n.length;c++){var v=n[c];if(v!=="children"&&v!=="key"){U(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),U(null);break}}e.ref!==null&&(U(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function ke(e,n,c,v,C,b){{var m=q(e);if(!m){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" 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 A=it();A?h+=A:h+=Te();var P;e===null?P="null":oe(e)?P="array":e!==void 0&&e.$$typeof===r?(P="<"+(W(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,h)}var T=at(e,n,c,C,b);if(T==null)return T;if(m){var D=n.children;if(D!==void 0)if(v)if(oe(D)){for(var V=0;V<D.length;V++)Ae(D[V],e);Object.freeze&&Object.freeze(D)}else j("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 Ae(D,e)}return e===i?ut(T):st(T),T}}function lt(e,n,c){return ke(e,n,c,!0)}function ft(e,n,c){return ke(e,n,c,!1)}var dt=ft,vt=lt;J.Fragment=i,J.jsx=dt,J.jsxs=vt}()),J}process.env.NODE_ENV==="production"?se.exports=wt():se.exports=Rt();var L=se.exports;const k=p.createContext({}),Ct=({children:t,apiURL:r,libraries:o,localStorageKeys:i})=>{const a=p.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:i}),[r,o,i]);return L.jsx(k.Provider,{value:a,children:t})},_t="user",St=({Fallback:t,isLogged:r,loginPath:o="/login",redirect401Path:i="/login",...a})=>{var I,$,N,Y;const{libraries:f,localStorageKeys:l}=p.useContext(k),d=(a==null?void 0:a.reactRouter)||(f==null?void 0:f.reactRouter),u=(a==null?void 0:a.axios)||(f==null?void 0:f.axios),y=(a==null?void 0:a.localStorageKey)||(l==null?void 0:l.user)||_t;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,S]=p.useState(null),{useLocation:w,Navigate:s,Outlet:R}=d,_=w(),x=p.useRef(!1),E=typeof r=="function"?r():!!r,j=typeof E=="boolean"?E:E==null?void 0:E.isLogged;return p.useEffect(()=>{x.current||(x.current=!0,u.interceptors.response.use(O=>O,async O=>{var q;return typeof O=="object"&&O&&"response"in O&&O.response&&typeof O.response=="object"&&"status"in O.response&&O.response&&typeof O.response=="object"&&"status"in O.response&&((q=O==null?void 0:O.response)==null?void 0:q.status)===401&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(y),S(i)),Promise.reject(O)}))},[u.defaults.headers.common,u.interceptors.response,y,i]),j&&!g?L.jsx(p.Suspense,{fallback:t,children:($=(I=_.state)==null?void 0:I.from)!=null&&$.state&&((Y=(N=_.state)==null?void 0:N.from)==null?void 0:Y.pathname)===o?L.jsx(s,{to:_.state.from.state.from.pathname+_.state.from.state.from.search,replace:!0}):L.jsx(R,{})}):L.jsx(s,{to:o+_.search,state:{from:_},replace:!0})},bt=({data:t,...r})=>{const{libraries:o}=p.useContext(k),i=(r==null?void 0:r.reactRouter)||(o==null?void 0:o.reactRouter),a=(r==null?void 0:r.gtm)||(o==null?void 0:o.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!a)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:f}=a,{useLocation:l,Outlet:d}=i,{pathname:u}=l(),{sendEvent:y}=f();return p.useEffect(()=>{y({event:"pageView",pathname:u,...t})},[t,u,y]),L.jsx(d,{})},jt="user",Pt=({tokenTypeKey:t="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...i})=>{const{apiURL:a=i.apiURL,libraries:f,localStorageKeys:l}=p.useContext(k),d=(i==null?void 0:i.userLocalStorageKey)||(l==null?void 0:l.user)||jt,u=(i==null?void 0:i.axios)||(f==null?void 0:f.axios);if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(u!=null&&u.defaults))return null;if(typeof window<"u"&&window.localStorage){const y=localStorage.getItem(d),g=y?JSON.parse(y):null,S=g!=null&&g[t]?g[t]:null,w=g!=null&&g[r]?g[r]:null,s=y?`${S} ${w}`:null;s&&(u.defaults.headers.common.Authorization=s)}return u.defaults.baseURL=a,u.defaults.headers.post["Content-Type"]=o,null},Tt=({debug:t,resources:r,...o})=>{const{libraries:i}=p.useContext(k),a=(o==null?void 0:o.i18)||(i==null?void 0:i.i18),{i18next:f,initReactI18next:l,languageDetector:d}=a||{};if(!a)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Ot=({dsn:t,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:i,replaysOnErrorSampleRate:a,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:u,release:y,...g})=>{const{libraries:S}=p.useContext(k),w=(g==null?void 0:g.sentry)||(S==null?void 0:S.sentry),s=(g==null?void 0:g.reactRouter)||(S==null?void 0:S.reactRouter);if(!w)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(w.isInitialized())return null;const{createRoutesFromChildren:R,matchRoutes:_,useLocation:x,useNavigationType:E}=s;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&w.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...l||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[w.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:R,matchRoutes:_,useEffect:p.useEffect,useLocation:x,useNavigationType:E}),...r||[]],release:y,replaysOnErrorSampleRate:a||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},xt=({IMaskMixin:t,...r})=>{const o=p.useMemo(()=>t(({TextField:i,...a})=>L.jsx(i,{...a})),[t]);return L.jsx(o,{...r})},At=({language:t,...r})=>{const{libraries:o}=p.useContext(k),i=(r==null?void 0:r.dayjs)||(o==null?void 0:o.dayjs),a=(r==null?void 0:r.plugin)||(o==null?void 0:o.dayjsPlugin);if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return p.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";a&&a.forEach(u=>{u&&i.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(l)})().then()},[i,a,t]),null},kt=()=>(p.useEffect(()=>{const t=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),Dt=t=>t&&typeof t=="function",It=t=>t&&typeof t=="function",Ft=({children:t,defaultQueriesOptions:r,defaultMutationsOptions:o,...i})=>{var u,y;const{libraries:a}=p.useContext(k),f=(i==null?void 0:i.QueryClient)||((u=a==null?void 0:a.reactQuery)==null?void 0:u.QueryClient),l=(i==null?void 0:i.QueryClientProvider)||((y=a==null?void 0:a.reactQuery)==null?void 0:y.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Dt(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!It(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(g,S,w)=>g.length+(w||0),refetchOnWindowFocus:!1,retry:3,...r}}});return L.jsx(l,{client:d,children:t})},Lt=t=>{var y,g,S;const{libraries:r}=p.useContext(k),o=(t==null?void 0:t.i18)||(r==null?void 0:r.i18),i=((y=t==null?void 0:t.i18)==null?void 0:y.translateFunction)||((g=r==null?void 0:r.i18)==null?void 0:g.translateFunction),a=((S=o==null?void 0:o.i18next)==null?void 0:S.t)||i||(w=>w),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=a(f),d=p.useCallback(w=>{if(w&&typeof w=="object"&&"response"in w){const{response:s}=w||{};if(s&&typeof s=="object"&&"reason"in s)return String(s.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"reason"in s.data)return String(s.data.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data)return String(s.data.message);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"detail"in s.data){const{detail:R}=s.data;if(Array.isArray(R)&&R.length>0&&typeof R[0]=="object"&&R[0]!==null&&"msg"in R[0]){const{msg:_}=R[0];if(typeof _=="string")return String(_)}}}return w instanceof Error?w.message:l},[l]);return{getErrorCode:p.useCallback(w=>{var R,_,x;const{response:s}=w||{};return s!=null&&s.error_code?String(s==null?void 0:s.error_code):(R=s==null?void 0:s.data)!=null&&R.error_code?String((_=s==null?void 0:s.data)==null?void 0:_.error_code):s!=null&&s.error_code?String(s==null?void 0:s.error_code):(x=s==null?void 0:s.data)!=null&&x.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:d}},$t=({data:t,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:i,isLoading:a,enabled:f=!0})=>{const l=p.useCallback(async u=>{o||!f||await r({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[f,r,o]),d=p.useMemo(()=>{if(t)return t.pages.reduce((u,y)=>[...u,...y],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||a,loadingVariant:i?"skeleton":"linear",rows:d}},Nt=t=>{const{libraries:r}=p.useContext(k),o=(t==null?void 0:t.axios)||(r==null?void 0:r.axios),i=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=p.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return p.useEffect(()=>{const l=({newValue:d,key:u})=>{if(u===i&&d)try{const{accessToken:y,tokenType:g}=JSON.parse(d);a({accessToken:y,tokenType:g})}catch(y){console.error("Failed to parse newValue from localStorage:",y)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[i,a]),{clearAuthenticationToken:f,setAuthenticationToken:a}},Ye=({library:t,date:r,format:o="ll"})=>t(r).format(o),We=(t,r)=>{const{fractionDigits:o=0,metric:i="km"}=r||{},a=Number(t);return Number.isNaN(a)?`0${i}`:`${a.toFixed(o)}${i}`},ze=t=>!t||typeof t!="string"?"":t.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Yt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,Wt=({path:t,size:r,apiURL:o})=>{if(!t)return"";const i=Yt(t),a=`${o}${i}`,f=a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&f?`${a.replace("/files",`/thumbs/${r}`)}`:a},zt=t=>{const{apiURL:r,libraries:o}=p.useContext(k),i=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return Ye({date:l,format:d,library:i})},distanceAdapter:We,filePathAdapter:(l,d)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return Wt({apiURL:r,path:l,size:d})},worksiteNameAdapter:ze}},Z=(t,r)=>r==="short"?t.split("-")[0]:t,Ut=(t,r="full")=>{const[o,i]=p.useState(()=>{const a=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,Z(a,r)});return p.useEffect(()=>{var f;t&&"isInitialized"in t&&t.isInitialized&&t.language&&i(Z(t.language,r));const a=l=>{i(Z(l,r))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",a),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",a)}},[t,r]),o},Vt="tracktor.filter",Ne=(t,r,o)=>`${o}_${t}=>${r}`,Mt=t=>{const{libraries:r,localStorageKeys:o}=p.useContext(k),i=(t==null?void 0:t.reactRouter)||(r==null?void 0:r.reactRouter),{useLocation:a,useSearchParams:f}=i,{pathname:l}=a(),[d,u]=f(),y=(o==null?void 0:o.filter)||Vt;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const g=(R,_,x=!0)=>{const E=Ne(R,(t==null?void 0:t.pathname)||l,y);if(!_||Array.isArray(_)&&!_.length){d.delete(R),u(d),localStorage.removeItem(E);return}x&&_&&localStorage.setItem(E,JSON.stringify({...d,[R]:_})),_&&(d.set(R,JSON.stringify(_)),u(d))};return{getFilter:(R,_)=>{const x=d.get(R);if(x)try{return JSON.parse(x)}catch{return x}const E=Ne(R,(t==null?void 0:t.pathname)||l,y),j=localStorage.getItem(E);if(j)try{return JSON.parse(j)[R]}catch{}return _},getFilters:()=>{const R=Object.fromEntries(d.entries()),x=Object.keys(localStorage).filter(E=>E.startsWith(y)&&E.endsWith((t==null?void 0:t.pathname)||l)).reduce((E,j)=>{var $,N;const I=localStorage.getItem(j);if(I){const Y=JSON.parse(I),O=($=Object.keys(Y))==null?void 0:$[0];E[O]=(N=Object.values(Y))==null?void 0:N[0]}return E},{});return{...R,...x}},handleFilter:(R,_)=>(x,E)=>{if(E||Array.isArray(E)&&E.length===0){const j=_||"value",I=typeof E=="object"&&j in E?E[j]:E;g(R,I);return}g(R,void 0)},setFilter:g}},Gt=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Jt=t=>{const i=t.split("/").filter(a=>a.length>0).map(a=>a.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},qt=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),Kt=(t,r,o,i)=>{const a=Jt(r),f=Gt(o),l=`${a}${f}`;return t&&typeof t=="object"&&"operationId"in t&&(i!=null&&i.includes(String(t.operationId)))?`${l}AsQuery`:l},Bt=(t,r)=>{const o={};return t==null||t.forEach(i=>{o[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),r==null||r.filter(i=>!o[i]).forEach(i=>{o[i]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Qt=t=>(Array.isArray(t)?t:[t]).reduce((o,i)=>{const{output:a,useInfiniteIds:f,useQueryIds:l,input:d="./openapi.json"}=i||{},u=qt(d);return{...o,[u]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:d,output:{baseUrl:a==null?void 0:a.baseUrl,client:"react-query",mode:"tags-split",override:{...((f==null?void 0:f.length)||(l==null?void 0:l.length))&&{operations:Bt(f,l)},header:y=>["Generated by orval 🍺",...y.title?[y.title]:[],...y.description?[y.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(y,g,S)=>Kt(y,g,S,l),query:{useQuery:!0}},schemas:(a==null?void 0:a.schemas)||`src/api/${u}/model`,target:(a==null?void 0:a.target)||`src/api/${u}/services/api.ts`,...a}}}},{});exports.GTMSendPageView=bt;exports.InitializeAxiosConfig=Pt;exports.InitializeDaysJSConfig=At;exports.InitializeI18nConfig=Tt;exports.InitializeSentryConfig=Ot;exports.InjectDependenciesContext=k;exports.InjectDependenciesProvider=Ct;exports.MaskTextField=xt;exports.PreloadErrorHandler=kt;exports.QueryClientProviderWithConfig=Ft;exports.RequireAuth=St;exports.dateAdapter=Ye;exports.distanceAdapter=We;exports.getOrvalConfig=Qt;exports.useAdapter=zt;exports.useAuth=Nt;exports.useCurrentLanguage=Ut;exports.useFilters=Mt;exports.useInfiniteDataGrid=$t;exports.useResponseError=Lt;exports.worksiteNameAdapter=ze;
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import We, { createContext as gt, useMemo as fe, useContext as F, useState as Ue, useRef as
|
|
1
|
+
import We, { createContext as gt, useMemo as fe, useContext as F, useState as Ue, useRef as yt, useEffect as V, Suspense as ht, useCallback as te } from "react";
|
|
2
2
|
var le = { exports: {} }, J = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -14,12 +14,12 @@ function mt() {
|
|
|
14
14
|
if ($e) return J;
|
|
15
15
|
$e = 1;
|
|
16
16
|
var t = We, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, a = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
-
function l(d, u,
|
|
18
|
-
var g,
|
|
19
|
-
|
|
20
|
-
for (g in u) i.call(u, g) && !f.hasOwnProperty(g) && (
|
|
21
|
-
if (d && d.defaultProps) for (g in u = d.defaultProps, u)
|
|
22
|
-
return { $$typeof: n, type: d, key:
|
|
17
|
+
function l(d, u, y) {
|
|
18
|
+
var g, S = {}, p = null, s = null;
|
|
19
|
+
y !== void 0 && (p = "" + y), u.key !== void 0 && (p = "" + u.key), u.ref !== void 0 && (s = u.ref);
|
|
20
|
+
for (g in u) i.call(u, g) && !f.hasOwnProperty(g) && (S[g] = u[g]);
|
|
21
|
+
if (d && d.defaultProps) for (g in u = d.defaultProps, u) S[g] === void 0 && (S[g] = u[g]);
|
|
22
|
+
return { $$typeof: n, type: d, key: p, ref: s, props: S, _owner: a.current };
|
|
23
23
|
}
|
|
24
24
|
return J.Fragment = o, J.jsx = l, J.jsxs = l, J;
|
|
25
25
|
}
|
|
@@ -36,35 +36,35 @@ var q = {};
|
|
|
36
36
|
var Ne;
|
|
37
37
|
function Et() {
|
|
38
38
|
return Ne || (Ne = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
-
var t = We, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"),
|
|
40
|
-
function
|
|
39
|
+
var t = We, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), s = Symbol.for("react.offscreen"), w = Symbol.iterator, _ = "@@iterator";
|
|
40
|
+
function O(e) {
|
|
41
41
|
if (e === null || typeof e != "object")
|
|
42
42
|
return null;
|
|
43
|
-
var r =
|
|
43
|
+
var r = w && e[w] || e[_];
|
|
44
44
|
return typeof r == "function" ? r : null;
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var E = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function C(e) {
|
|
48
48
|
{
|
|
49
49
|
for (var r = arguments.length, c = new Array(r > 1 ? r - 1 : 0), v = 1; v < r; v++)
|
|
50
50
|
c[v - 1] = arguments[v];
|
|
51
|
-
|
|
51
|
+
D("error", e, c);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function D(e, r, c) {
|
|
55
55
|
{
|
|
56
|
-
var v =
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
return String(
|
|
56
|
+
var v = E.ReactDebugCurrentFrame, R = v.getStackAddendum();
|
|
57
|
+
R !== "" && (r += "%s", c = c.concat([R]));
|
|
58
|
+
var b = c.map(function(m) {
|
|
59
|
+
return String(m);
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
b.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, b);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
var
|
|
64
|
+
var $ = !1, N = !1, Y = !1, T = !1, de = !1, re;
|
|
65
65
|
re = Symbol.for("react.module.reference");
|
|
66
66
|
function K(e) {
|
|
67
|
-
return !!(typeof e == "string" || typeof e == "function" || e === i || e === f || de || e === a || e ===
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === i || e === f || de || e === a || e === y || e === g || T || e === s || $ || N || Y || typeof e == "object" && e !== null && (e.$$typeof === p || e.$$typeof === S || e.$$typeof === l || e.$$typeof === d || e.$$typeof === u || // This needs to include all possible module reference object
|
|
68
68
|
// types supported by any Flight configuration anywhere since
|
|
69
69
|
// we don't know which Flight build this will end up being used
|
|
70
70
|
// with.
|
|
@@ -74,8 +74,8 @@ function Et() {
|
|
|
74
74
|
var v = e.displayName;
|
|
75
75
|
if (v)
|
|
76
76
|
return v;
|
|
77
|
-
var
|
|
78
|
-
return
|
|
77
|
+
var R = r.displayName || r.name || "";
|
|
78
|
+
return R !== "" ? c + "(" + R + ")" : c;
|
|
79
79
|
}
|
|
80
80
|
function ve(e) {
|
|
81
81
|
return e.displayName || "Context";
|
|
@@ -83,7 +83,7 @@ function Et() {
|
|
|
83
83
|
function W(e) {
|
|
84
84
|
if (e == null)
|
|
85
85
|
return null;
|
|
86
|
-
if (typeof e.tag == "number" &&
|
|
86
|
+
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")
|
|
87
87
|
return e.displayName || e.name || null;
|
|
88
88
|
if (typeof e == "string")
|
|
89
89
|
return e;
|
|
@@ -96,7 +96,7 @@ function Et() {
|
|
|
96
96
|
return "Profiler";
|
|
97
97
|
case a:
|
|
98
98
|
return "StrictMode";
|
|
99
|
-
case
|
|
99
|
+
case y:
|
|
100
100
|
return "Suspense";
|
|
101
101
|
case g:
|
|
102
102
|
return "SuspenseList";
|
|
@@ -111,13 +111,13 @@ function Et() {
|
|
|
111
111
|
return ve(c._context) + ".Provider";
|
|
112
112
|
case u:
|
|
113
113
|
return Ve(e, e.render, "ForwardRef");
|
|
114
|
-
case
|
|
114
|
+
case S:
|
|
115
115
|
var v = e.displayName || null;
|
|
116
116
|
return v !== null ? v : W(e.type) || "Memo";
|
|
117
|
-
case
|
|
118
|
-
var
|
|
117
|
+
case p: {
|
|
118
|
+
var R = e, b = R._payload, m = R._init;
|
|
119
119
|
try {
|
|
120
|
-
return W(
|
|
120
|
+
return W(m(b));
|
|
121
121
|
} catch {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
@@ -125,18 +125,18 @@ function Et() {
|
|
|
125
125
|
}
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
-
var U = Object.assign, G = 0, ge,
|
|
129
|
-
function
|
|
128
|
+
var U = Object.assign, G = 0, ge, ye, he, me, Ee, pe, we;
|
|
129
|
+
function Re() {
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
Re.__reactDisabledLog = !0;
|
|
132
132
|
function ze() {
|
|
133
133
|
{
|
|
134
134
|
if (G === 0) {
|
|
135
|
-
ge = console.log,
|
|
135
|
+
ge = console.log, ye = console.info, he = console.warn, me = console.error, Ee = console.group, pe = console.groupCollapsed, we = console.groupEnd;
|
|
136
136
|
var e = {
|
|
137
137
|
configurable: !0,
|
|
138
138
|
enumerable: !0,
|
|
139
|
-
value:
|
|
139
|
+
value: Re,
|
|
140
140
|
writable: !0
|
|
141
141
|
};
|
|
142
142
|
Object.defineProperties(console, {
|
|
@@ -165,10 +165,10 @@ function Et() {
|
|
|
165
165
|
value: ge
|
|
166
166
|
}),
|
|
167
167
|
info: U({}, e, {
|
|
168
|
-
value:
|
|
168
|
+
value: ye
|
|
169
169
|
}),
|
|
170
170
|
warn: U({}, e, {
|
|
171
|
-
value:
|
|
171
|
+
value: he
|
|
172
172
|
}),
|
|
173
173
|
error: U({}, e, {
|
|
174
174
|
value: me
|
|
@@ -177,24 +177,24 @@ function Et() {
|
|
|
177
177
|
value: Ee
|
|
178
178
|
}),
|
|
179
179
|
groupCollapsed: U({}, e, {
|
|
180
|
-
value:
|
|
180
|
+
value: pe
|
|
181
181
|
}),
|
|
182
182
|
groupEnd: U({}, e, {
|
|
183
|
-
value:
|
|
183
|
+
value: we
|
|
184
184
|
})
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
G < 0 &&
|
|
187
|
+
G < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
var ne =
|
|
190
|
+
var ne = E.ReactCurrentDispatcher, oe;
|
|
191
191
|
function B(e, r, c) {
|
|
192
192
|
{
|
|
193
193
|
if (oe === void 0)
|
|
194
194
|
try {
|
|
195
195
|
throw Error();
|
|
196
|
-
} catch (
|
|
197
|
-
var v =
|
|
196
|
+
} catch (R) {
|
|
197
|
+
var v = R.stack.trim().match(/\n( *(at )?)/);
|
|
198
198
|
oe = v && v[1] || "";
|
|
199
199
|
}
|
|
200
200
|
return `
|
|
@@ -216,63 +216,63 @@ function Et() {
|
|
|
216
216
|
}
|
|
217
217
|
var v;
|
|
218
218
|
ae = !0;
|
|
219
|
-
var
|
|
219
|
+
var R = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
|
-
var
|
|
222
|
-
|
|
221
|
+
var b;
|
|
222
|
+
b = ne.current, ne.current = null, ze();
|
|
223
223
|
try {
|
|
224
224
|
if (r) {
|
|
225
|
-
var
|
|
225
|
+
var m = function() {
|
|
226
226
|
throw Error();
|
|
227
227
|
};
|
|
228
|
-
if (Object.defineProperty(
|
|
228
|
+
if (Object.defineProperty(m.prototype, "props", {
|
|
229
229
|
set: function() {
|
|
230
230
|
throw Error();
|
|
231
231
|
}
|
|
232
232
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
233
|
try {
|
|
234
|
-
Reflect.construct(
|
|
235
|
-
} catch (
|
|
236
|
-
v =
|
|
234
|
+
Reflect.construct(m, []);
|
|
235
|
+
} catch (L) {
|
|
236
|
+
v = L;
|
|
237
237
|
}
|
|
238
|
-
Reflect.construct(e, [],
|
|
238
|
+
Reflect.construct(e, [], m);
|
|
239
239
|
} else {
|
|
240
240
|
try {
|
|
241
|
-
|
|
242
|
-
} catch (
|
|
243
|
-
v =
|
|
241
|
+
m.call();
|
|
242
|
+
} catch (L) {
|
|
243
|
+
v = L;
|
|
244
244
|
}
|
|
245
|
-
e.call(
|
|
245
|
+
e.call(m.prototype);
|
|
246
246
|
}
|
|
247
247
|
} else {
|
|
248
248
|
try {
|
|
249
249
|
throw Error();
|
|
250
|
-
} catch (
|
|
251
|
-
v =
|
|
250
|
+
} catch (L) {
|
|
251
|
+
v = L;
|
|
252
252
|
}
|
|
253
253
|
e();
|
|
254
254
|
}
|
|
255
|
-
} catch (
|
|
256
|
-
if (
|
|
257
|
-
for (var
|
|
255
|
+
} catch (L) {
|
|
256
|
+
if (L && v && typeof L.stack == "string") {
|
|
257
|
+
for (var h = L.stack.split(`
|
|
258
258
|
`), A = v.stack.split(`
|
|
259
|
-
`), j =
|
|
260
|
-
|
|
261
|
-
for (; j >= 1 &&
|
|
262
|
-
if (
|
|
263
|
-
if (j !== 1 ||
|
|
259
|
+
`), j = h.length - 1, P = A.length - 1; j >= 1 && P >= 0 && h[j] !== A[P]; )
|
|
260
|
+
P--;
|
|
261
|
+
for (; j >= 1 && P >= 0; j--, P--)
|
|
262
|
+
if (h[j] !== A[P]) {
|
|
263
|
+
if (j !== 1 || P !== 1)
|
|
264
264
|
do
|
|
265
|
-
if (j--,
|
|
266
|
-
var
|
|
267
|
-
` +
|
|
268
|
-
return e.displayName &&
|
|
265
|
+
if (j--, P--, P < 0 || h[j] !== A[P]) {
|
|
266
|
+
var x = `
|
|
267
|
+
` + h[j].replace(" at new ", " at ");
|
|
268
|
+
return e.displayName && x.includes("<anonymous>") && (x = x.replace("<anonymous>", e.displayName)), typeof e == "function" && Q.set(e, x), x;
|
|
269
269
|
}
|
|
270
|
-
while (j >= 1 &&
|
|
270
|
+
while (j >= 1 && P >= 0);
|
|
271
271
|
break;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
} finally {
|
|
275
|
-
ae = !1, ne.current =
|
|
275
|
+
ae = !1, ne.current = b, Me(), Error.prepareStackTrace = R;
|
|
276
276
|
}
|
|
277
277
|
var M = e ? e.displayName || e.name : "", Ie = M ? B(M) : "";
|
|
278
278
|
return typeof e == "function" && Q.set(e, Ie), Ie;
|
|
@@ -292,7 +292,7 @@ function Et() {
|
|
|
292
292
|
if (typeof e == "string")
|
|
293
293
|
return B(e);
|
|
294
294
|
switch (e) {
|
|
295
|
-
case
|
|
295
|
+
case y:
|
|
296
296
|
return B("Suspense");
|
|
297
297
|
case g:
|
|
298
298
|
return B("SuspenseList");
|
|
@@ -301,42 +301,42 @@ function Et() {
|
|
|
301
301
|
switch (e.$$typeof) {
|
|
302
302
|
case u:
|
|
303
303
|
return Je(e.render);
|
|
304
|
-
case
|
|
304
|
+
case S:
|
|
305
305
|
return H(e.type, r, c);
|
|
306
|
-
case
|
|
307
|
-
var v = e,
|
|
306
|
+
case p: {
|
|
307
|
+
var v = e, R = v._payload, b = v._init;
|
|
308
308
|
try {
|
|
309
|
-
return H(
|
|
309
|
+
return H(b(R), r, c);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
|
-
var X = Object.prototype.hasOwnProperty, Se = {},
|
|
316
|
+
var X = Object.prototype.hasOwnProperty, Se = {}, be = E.ReactDebugCurrentFrame;
|
|
317
317
|
function Z(e) {
|
|
318
318
|
if (e) {
|
|
319
319
|
var r = e._owner, c = H(e.type, e._source, r ? r.type : null);
|
|
320
|
-
|
|
320
|
+
be.setExtraStackFrame(c);
|
|
321
321
|
} else
|
|
322
|
-
|
|
322
|
+
be.setExtraStackFrame(null);
|
|
323
323
|
}
|
|
324
|
-
function Ke(e, r, c, v,
|
|
324
|
+
function Ke(e, r, c, v, R) {
|
|
325
325
|
{
|
|
326
|
-
var
|
|
327
|
-
for (var
|
|
328
|
-
if (
|
|
329
|
-
var
|
|
326
|
+
var b = Function.call.bind(X);
|
|
327
|
+
for (var m in e)
|
|
328
|
+
if (b(e, m)) {
|
|
329
|
+
var h = void 0;
|
|
330
330
|
try {
|
|
331
|
-
if (typeof e[
|
|
332
|
-
var A = Error((v || "React class") + ": " + c + " type `" +
|
|
331
|
+
if (typeof e[m] != "function") {
|
|
332
|
+
var A = Error((v || "React class") + ": " + c + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
333
|
throw A.name = "Invariant Violation", A;
|
|
334
334
|
}
|
|
335
|
-
|
|
335
|
+
h = e[m](r, m, v, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
336
|
} catch (j) {
|
|
337
|
-
|
|
337
|
+
h = j;
|
|
338
338
|
}
|
|
339
|
-
|
|
339
|
+
h && !(h instanceof Error) && (Z(R), 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).", v || "React class", c, m, typeof h), Z(null)), h instanceof Error && !(h.message in Se) && (Se[h.message] = !0, Z(R), C("Failed %s type: %s", c, h.message), Z(null));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
@@ -352,19 +352,19 @@ function Et() {
|
|
|
352
352
|
}
|
|
353
353
|
function He(e) {
|
|
354
354
|
try {
|
|
355
|
-
return
|
|
355
|
+
return Ce(e), !1;
|
|
356
356
|
} catch {
|
|
357
357
|
return !0;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Ce(e) {
|
|
361
361
|
return "" + e;
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function je(e) {
|
|
364
364
|
if (He(e))
|
|
365
|
-
return
|
|
365
|
+
return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Qe(e)), Ce(e);
|
|
366
366
|
}
|
|
367
|
-
var
|
|
367
|
+
var Pe = E.ReactCurrentOwner, Xe = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
@@ -387,12 +387,12 @@ function Et() {
|
|
|
387
387
|
return e.key !== void 0;
|
|
388
388
|
}
|
|
389
389
|
function tt(e, r) {
|
|
390
|
-
typeof e.ref == "string" &&
|
|
390
|
+
typeof e.ref == "string" && Pe.current;
|
|
391
391
|
}
|
|
392
392
|
function rt(e, r) {
|
|
393
393
|
{
|
|
394
394
|
var c = function() {
|
|
395
|
-
Te || (Te = !0,
|
|
395
|
+
Te || (Te = !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));
|
|
396
396
|
};
|
|
397
397
|
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
398
|
get: c,
|
|
@@ -403,7 +403,7 @@ function Et() {
|
|
|
403
403
|
function nt(e, r) {
|
|
404
404
|
{
|
|
405
405
|
var c = function() {
|
|
406
|
-
Oe || (Oe = !0,
|
|
406
|
+
Oe || (Oe = !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));
|
|
407
407
|
};
|
|
408
408
|
c.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
409
|
get: c,
|
|
@@ -411,54 +411,54 @@ function Et() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
var ot = function(e, r, c, v,
|
|
415
|
-
var
|
|
414
|
+
var ot = function(e, r, c, v, R, b, m) {
|
|
415
|
+
var h = {
|
|
416
416
|
// This tag allows us to uniquely identify this as a React Element
|
|
417
417
|
$$typeof: n,
|
|
418
418
|
// Built-in properties that belong on the element
|
|
419
419
|
type: e,
|
|
420
420
|
key: r,
|
|
421
421
|
ref: c,
|
|
422
|
-
props:
|
|
422
|
+
props: m,
|
|
423
423
|
// Record the component responsible for creating this element.
|
|
424
|
-
_owner:
|
|
424
|
+
_owner: b
|
|
425
425
|
};
|
|
426
|
-
return
|
|
426
|
+
return h._store = {}, Object.defineProperty(h._store, "validated", {
|
|
427
427
|
configurable: !1,
|
|
428
428
|
enumerable: !1,
|
|
429
429
|
writable: !0,
|
|
430
430
|
value: !1
|
|
431
|
-
}), Object.defineProperty(
|
|
431
|
+
}), Object.defineProperty(h, "_self", {
|
|
432
432
|
configurable: !1,
|
|
433
433
|
enumerable: !1,
|
|
434
434
|
writable: !1,
|
|
435
435
|
value: v
|
|
436
|
-
}), Object.defineProperty(
|
|
436
|
+
}), Object.defineProperty(h, "_source", {
|
|
437
437
|
configurable: !1,
|
|
438
438
|
enumerable: !1,
|
|
439
439
|
writable: !1,
|
|
440
|
-
value:
|
|
441
|
-
}), Object.freeze && (Object.freeze(
|
|
440
|
+
value: R
|
|
441
|
+
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
442
442
|
};
|
|
443
|
-
function at(e, r, c, v,
|
|
443
|
+
function at(e, r, c, v, R) {
|
|
444
444
|
{
|
|
445
|
-
var
|
|
446
|
-
c !== void 0 && (
|
|
447
|
-
for (
|
|
448
|
-
X.call(r,
|
|
445
|
+
var b, m = {}, h = null, A = null;
|
|
446
|
+
c !== void 0 && (je(c), h = "" + c), et(r) && (je(r.key), h = "" + r.key), Ze(r) && (A = r.ref, tt(r, R));
|
|
447
|
+
for (b in r)
|
|
448
|
+
X.call(r, b) && !Xe.hasOwnProperty(b) && (m[b] = r[b]);
|
|
449
449
|
if (e && e.defaultProps) {
|
|
450
450
|
var j = e.defaultProps;
|
|
451
|
-
for (
|
|
452
|
-
|
|
451
|
+
for (b in j)
|
|
452
|
+
m[b] === void 0 && (m[b] = j[b]);
|
|
453
453
|
}
|
|
454
|
-
if (
|
|
455
|
-
var
|
|
456
|
-
|
|
454
|
+
if (h || A) {
|
|
455
|
+
var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
h && rt(m, P), A && nt(m, P);
|
|
457
457
|
}
|
|
458
|
-
return ot(e,
|
|
458
|
+
return ot(e, h, A, R, v, Pe.current, m);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
var ce =
|
|
461
|
+
var ce = E.ReactCurrentOwner, Ae = E.ReactDebugCurrentFrame;
|
|
462
462
|
function z(e) {
|
|
463
463
|
if (e) {
|
|
464
464
|
var r = e._owner, c = H(e.type, e._source, r ? r.type : null);
|
|
@@ -509,7 +509,7 @@ Check the top-level render call using <` + c + ">.");
|
|
|
509
509
|
return;
|
|
510
510
|
ke[c] = !0;
|
|
511
511
|
var v = "";
|
|
512
|
-
e && e._owner && e._owner !== ce.current && (v = " It was passed a child from " + W(e._owner.type) + "."), z(e),
|
|
512
|
+
e && e._owner && e._owner !== ce.current && (v = " It was passed a child from " + W(e._owner.type) + "."), z(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.', c, v), z(null);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
function Fe(e, r) {
|
|
@@ -524,10 +524,10 @@ Check the top-level render call using <` + c + ">.");
|
|
|
524
524
|
else if (ue(e))
|
|
525
525
|
e._store && (e._store.validated = !0);
|
|
526
526
|
else if (e) {
|
|
527
|
-
var
|
|
528
|
-
if (typeof
|
|
529
|
-
for (var
|
|
530
|
-
ue(
|
|
527
|
+
var R = O(e);
|
|
528
|
+
if (typeof R == "function" && R !== e.entries)
|
|
529
|
+
for (var b = R.call(e), m; !(m = b.next()).done; )
|
|
530
|
+
ue(m.value) && De(m.value, r);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
@@ -541,7 +541,7 @@ Check the top-level render call using <` + c + ">.");
|
|
|
541
541
|
c = r.propTypes;
|
|
542
542
|
else if (typeof r == "object" && (r.$$typeof === u || // Note: Memo only checks outer props here.
|
|
543
543
|
// Inner props are checked in the reconciler.
|
|
544
|
-
r.$$typeof ===
|
|
544
|
+
r.$$typeof === S))
|
|
545
545
|
c = r.propTypes;
|
|
546
546
|
else
|
|
547
547
|
return;
|
|
@@ -550,10 +550,10 @@ Check the top-level render call using <` + c + ">.");
|
|
|
550
550
|
Ke(c, e.props, "prop", v, e);
|
|
551
551
|
} else if (r.PropTypes !== void 0 && !se) {
|
|
552
552
|
se = !0;
|
|
553
|
-
var
|
|
554
|
-
|
|
553
|
+
var R = W(r);
|
|
554
|
+
C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", R || "Unknown");
|
|
555
555
|
}
|
|
556
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved &&
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
function ut(e) {
|
|
@@ -561,41 +561,41 @@ Check the top-level render call using <` + c + ">.");
|
|
|
561
561
|
for (var r = Object.keys(e.props), c = 0; c < r.length; c++) {
|
|
562
562
|
var v = r[c];
|
|
563
563
|
if (v !== "children" && v !== "key") {
|
|
564
|
-
z(e),
|
|
564
|
+
z(e), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), z(null);
|
|
565
565
|
break;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
e.ref !== null && (z(e),
|
|
568
|
+
e.ref !== null && (z(e), C("Invalid attribute `ref` supplied to `React.Fragment`."), z(null));
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
function Le(e, r, c, v,
|
|
571
|
+
function Le(e, r, c, v, R, b) {
|
|
572
572
|
{
|
|
573
|
-
var
|
|
574
|
-
if (!
|
|
575
|
-
var
|
|
576
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
573
|
+
var m = K(e);
|
|
574
|
+
if (!m) {
|
|
575
|
+
var h = "";
|
|
576
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
577
577
|
var A = it();
|
|
578
|
-
A ?
|
|
578
|
+
A ? h += A : h += xe();
|
|
579
579
|
var j;
|
|
580
|
-
e === null ? j = "null" : ie(e) ? j = "array" : e !== void 0 && e.$$typeof === n ? (j = "<" + (W(e.type) || "Unknown") + " />",
|
|
580
|
+
e === null ? j = "null" : ie(e) ? j = "array" : e !== void 0 && e.$$typeof === n ? (j = "<" + (W(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : j = 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", j, h);
|
|
581
581
|
}
|
|
582
|
-
var
|
|
583
|
-
if (
|
|
584
|
-
return
|
|
585
|
-
if (
|
|
586
|
-
var
|
|
587
|
-
if (
|
|
582
|
+
var P = at(e, r, c, R, b);
|
|
583
|
+
if (P == null)
|
|
584
|
+
return P;
|
|
585
|
+
if (m) {
|
|
586
|
+
var x = r.children;
|
|
587
|
+
if (x !== void 0)
|
|
588
588
|
if (v)
|
|
589
|
-
if (ie(
|
|
590
|
-
for (var M = 0; M <
|
|
591
|
-
Fe(
|
|
592
|
-
Object.freeze && Object.freeze(
|
|
589
|
+
if (ie(x)) {
|
|
590
|
+
for (var M = 0; M < x.length; M++)
|
|
591
|
+
Fe(x[M], e);
|
|
592
|
+
Object.freeze && Object.freeze(x);
|
|
593
593
|
} else
|
|
594
|
-
|
|
594
|
+
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.");
|
|
595
595
|
else
|
|
596
|
-
Fe(
|
|
596
|
+
Fe(x, e);
|
|
597
597
|
}
|
|
598
|
-
return e === i ? ut(
|
|
598
|
+
return e === i ? ut(P) : st(P), P;
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
function lt(e, r, c) {
|
|
@@ -609,8 +609,8 @@ Check the top-level render call using <` + c + ">.");
|
|
|
609
609
|
}()), q;
|
|
610
610
|
}
|
|
611
611
|
process.env.NODE_ENV === "production" ? le.exports = mt() : le.exports = Et();
|
|
612
|
-
var
|
|
613
|
-
const
|
|
612
|
+
var I = le.exports;
|
|
613
|
+
const k = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys: i }) => {
|
|
614
614
|
const a = fe(
|
|
615
615
|
() => ({
|
|
616
616
|
apiURL: n,
|
|
@@ -619,56 +619,56 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
619
619
|
}),
|
|
620
620
|
[n, o, i]
|
|
621
621
|
);
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
},
|
|
624
|
-
var
|
|
625
|
-
const { libraries: f, localStorageKeys: l } = F(
|
|
622
|
+
return /* @__PURE__ */ I.jsx(k.Provider, { value: a, children: t });
|
|
623
|
+
}, pt = "user", It = ({ Fallback: t, isLogged: n, loginPath: o = "/login", redirect401Path: i = "/login", ...a }) => {
|
|
624
|
+
var D, $, N, Y;
|
|
625
|
+
const { libraries: f, localStorageKeys: l } = F(k), d = (a == null ? void 0 : a.reactRouter) || (f == null ? void 0 : f.reactRouter), u = (a == null ? void 0 : a.axios) || (f == null ? void 0 : f.axios), y = (a == null ? void 0 : a.localStorageKey) || (l == null ? void 0 : l.user) || pt;
|
|
626
626
|
if (!d)
|
|
627
627
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
628
|
-
const [g,
|
|
628
|
+
const [g, S] = Ue(null), { useLocation: p, Navigate: s, Outlet: w } = d, _ = p(), O = yt(!1), E = typeof n == "function" ? n() : !!n, C = typeof E == "boolean" ? E : E == null ? void 0 : E.isLogged;
|
|
629
629
|
return V(() => {
|
|
630
|
-
|
|
631
|
-
(
|
|
632
|
-
async (
|
|
630
|
+
O.current || (O.current = !0, u.interceptors.response.use(
|
|
631
|
+
(T) => T,
|
|
632
|
+
async (T) => {
|
|
633
633
|
var K;
|
|
634
|
-
return typeof
|
|
634
|
+
return typeof T == "object" && T && "response" in T && T.response && typeof T.response == "object" && "status" in T.response && T.response && typeof T.response == "object" && "status" in T.response && ((K = T == null ? void 0 : T.response) == null ? void 0 : K.status) === 401 && (u.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(y), S(i)), Promise.reject(T);
|
|
635
635
|
}
|
|
636
636
|
));
|
|
637
|
-
}, [u.defaults.headers.common, u.interceptors.response,
|
|
637
|
+
}, [u.defaults.headers.common, u.interceptors.response, y, i]), C && !g ? /* @__PURE__ */ I.jsx(ht, { fallback: t, children: ($ = (D = _.state) == null ? void 0 : D.from) != null && $.state && ((Y = (N = _.state) == null ? void 0 : N.from) == null ? void 0 : Y.pathname) === o ? /* @__PURE__ */ I.jsx(s, { to: _.state.from.state.from.pathname + _.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ I.jsx(w, {}) }) : /* @__PURE__ */ I.jsx(s, { to: o + _.search, state: { from: _ }, replace: !0 });
|
|
638
638
|
}, $t = ({ data: t, ...n }) => {
|
|
639
|
-
const { libraries: o } = F(
|
|
639
|
+
const { libraries: o } = F(k), i = (n == null ? void 0 : n.reactRouter) || (o == null ? void 0 : o.reactRouter), a = (n == null ? void 0 : n.gtm) || (o == null ? void 0 : o.gtm);
|
|
640
640
|
if (!i)
|
|
641
641
|
throw new Error(
|
|
642
642
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
643
643
|
);
|
|
644
644
|
if (!a)
|
|
645
645
|
throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
646
|
-
const { useGoogleTagManager: f } = a, { useLocation: l, Outlet: d } = i, { pathname: u } = l(), { sendEvent:
|
|
646
|
+
const { useGoogleTagManager: f } = a, { useLocation: l, Outlet: d } = i, { pathname: u } = l(), { sendEvent: y } = f();
|
|
647
647
|
return V(() => {
|
|
648
|
-
|
|
648
|
+
y({
|
|
649
649
|
event: "pageView",
|
|
650
650
|
pathname: u,
|
|
651
651
|
...t
|
|
652
652
|
});
|
|
653
|
-
}, [t, u,
|
|
654
|
-
},
|
|
653
|
+
}, [t, u, y]), /* @__PURE__ */ I.jsx(d, {});
|
|
654
|
+
}, wt = "user", Nt = ({
|
|
655
655
|
tokenTypeKey: t = "tokenType",
|
|
656
656
|
tokenKey: n = "accessToken",
|
|
657
657
|
postContentType: o = "application/json",
|
|
658
658
|
...i
|
|
659
659
|
}) => {
|
|
660
|
-
const { apiURL: a = i.apiURL, libraries: f, localStorageKeys: l } = F(
|
|
660
|
+
const { apiURL: a = i.apiURL, libraries: f, localStorageKeys: l } = F(k), d = (i == null ? void 0 : i.userLocalStorageKey) || (l == null ? void 0 : l.user) || wt, u = (i == null ? void 0 : i.axios) || (f == null ? void 0 : f.axios);
|
|
661
661
|
if (!u)
|
|
662
662
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
663
663
|
if (!(u != null && u.defaults))
|
|
664
664
|
return null;
|
|
665
665
|
if (typeof window < "u" && window.localStorage) {
|
|
666
|
-
const
|
|
666
|
+
const y = localStorage.getItem(d), g = y ? JSON.parse(y) : null, S = g != null && g[t] ? g[t] : null, p = g != null && g[n] ? g[n] : null, s = y ? `${S} ${p}` : null;
|
|
667
667
|
s && (u.defaults.headers.common.Authorization = s);
|
|
668
668
|
}
|
|
669
669
|
return u.defaults.baseURL = a, u.defaults.headers.post["Content-Type"] = o, null;
|
|
670
670
|
}, Yt = ({ debug: t, resources: n, ...o }) => {
|
|
671
|
-
const { libraries: i } = F(
|
|
671
|
+
const { libraries: i } = F(k), a = (o == null ? void 0 : o.i18) || (i == null ? void 0 : i.i18), { i18next: f, initReactI18next: l, languageDetector: d } = a || {};
|
|
672
672
|
if (!a)
|
|
673
673
|
throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
674
674
|
return f != null && f.isInitialized || (f.use(d).use(l).init({
|
|
@@ -699,18 +699,18 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
699
699
|
ignoreErrors: l,
|
|
700
700
|
debug: d,
|
|
701
701
|
environment: u,
|
|
702
|
-
release:
|
|
702
|
+
release: y,
|
|
703
703
|
...g
|
|
704
704
|
}) => {
|
|
705
|
-
const { libraries:
|
|
706
|
-
if (!
|
|
705
|
+
const { libraries: S } = F(k), p = (g == null ? void 0 : g.sentry) || (S == null ? void 0 : S.sentry), s = (g == null ? void 0 : g.reactRouter) || (S == null ? void 0 : S.reactRouter);
|
|
706
|
+
if (!p)
|
|
707
707
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
708
708
|
if (!s)
|
|
709
709
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
710
|
-
if (
|
|
710
|
+
if (p.isInitialized())
|
|
711
711
|
return null;
|
|
712
|
-
const { createRoutesFromChildren:
|
|
713
|
-
return (d || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") &&
|
|
712
|
+
const { createRoutesFromChildren: w, matchRoutes: _, useLocation: O, useNavigationType: E } = s;
|
|
713
|
+
return (d || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && p.init({
|
|
714
714
|
debug: d,
|
|
715
715
|
dsn: t,
|
|
716
716
|
environment: u || "production",
|
|
@@ -724,16 +724,16 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
724
724
|
/vite:preloadError/
|
|
725
725
|
],
|
|
726
726
|
integrations: [
|
|
727
|
-
|
|
728
|
-
createRoutesFromChildren:
|
|
729
|
-
matchRoutes:
|
|
727
|
+
p.reactRouterV6BrowserTracingIntegration({
|
|
728
|
+
createRoutesFromChildren: w,
|
|
729
|
+
matchRoutes: _,
|
|
730
730
|
useEffect: V,
|
|
731
|
-
useLocation:
|
|
732
|
-
useNavigationType:
|
|
731
|
+
useLocation: O,
|
|
732
|
+
useNavigationType: E
|
|
733
733
|
}),
|
|
734
734
|
...n || []
|
|
735
735
|
],
|
|
736
|
-
release:
|
|
736
|
+
release: y,
|
|
737
737
|
replaysOnErrorSampleRate: a || 1,
|
|
738
738
|
replaysSessionSampleRate: i || 0.1,
|
|
739
739
|
tracePropagationTargets: f,
|
|
@@ -742,12 +742,12 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
742
742
|
}, Ut = ({ IMaskMixin: t, ...n }) => {
|
|
743
743
|
const o = fe(
|
|
744
744
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
745
|
-
() => t(({ TextField: i, ...a }) => /* @__PURE__ */
|
|
745
|
+
() => t(({ TextField: i, ...a }) => /* @__PURE__ */ I.jsx(i, { ...a })),
|
|
746
746
|
[t]
|
|
747
747
|
);
|
|
748
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ I.jsx(o, { ...n });
|
|
749
749
|
}, Vt = ({ language: t, ...n }) => {
|
|
750
|
-
const { libraries: o } = F(
|
|
750
|
+
const { libraries: o } = F(k), i = (n == null ? void 0 : n.dayjs) || (o == null ? void 0 : o.dayjs), a = (n == null ? void 0 : n.plugin) || (o == null ? void 0 : o.dayjsPlugin);
|
|
751
751
|
if (!i)
|
|
752
752
|
throw new Error(
|
|
753
753
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
@@ -771,19 +771,19 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
771
771
|
return window.addEventListener("vite:preloadError", t), () => {
|
|
772
772
|
window.removeEventListener("vite:preloadError", t);
|
|
773
773
|
};
|
|
774
|
-
}, []), null),
|
|
774
|
+
}, []), null), Rt = (t) => t && typeof t == "function", _t = (t) => t && typeof t == "function", Mt = ({
|
|
775
775
|
children: t,
|
|
776
776
|
defaultQueriesOptions: n,
|
|
777
777
|
defaultMutationsOptions: o,
|
|
778
778
|
...i
|
|
779
779
|
}) => {
|
|
780
|
-
var u,
|
|
781
|
-
const { libraries: a } = F(
|
|
780
|
+
var u, y;
|
|
781
|
+
const { libraries: a } = F(k), f = (i == null ? void 0 : i.QueryClient) || ((u = a == null ? void 0 : a.reactQuery) == null ? void 0 : u.QueryClient), l = (i == null ? void 0 : i.QueryClientProvider) || ((y = a == null ? void 0 : a.reactQuery) == null ? void 0 : y.QueryClientProvider);
|
|
782
782
|
if (!f)
|
|
783
783
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
784
784
|
if (!l)
|
|
785
785
|
throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
786
|
-
if (!
|
|
786
|
+
if (!Rt(l))
|
|
787
787
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
788
788
|
if (!_t(f))
|
|
789
789
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
@@ -793,28 +793,43 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
793
793
|
...o
|
|
794
794
|
},
|
|
795
795
|
queries: {
|
|
796
|
-
getNextPageParam: (g,
|
|
796
|
+
getNextPageParam: (g, S, p) => g.length + (p || 0),
|
|
797
797
|
refetchOnWindowFocus: !1,
|
|
798
798
|
retry: 3,
|
|
799
799
|
...n
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ I.jsx(l, { client: d, children: t });
|
|
804
804
|
}, Gt = (t) => {
|
|
805
|
-
var
|
|
806
|
-
const { libraries: n } = F(
|
|
807
|
-
(
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
805
|
+
var y, g, S;
|
|
806
|
+
const { libraries: n } = F(k), o = (t == null ? void 0 : t.i18) || (n == null ? void 0 : n.i18), i = ((y = t == null ? void 0 : t.i18) == null ? void 0 : y.translateFunction) || ((g = n == null ? void 0 : n.i18) == null ? void 0 : g.translateFunction), a = ((S = o == null ? void 0 : o.i18next) == null ? void 0 : S.t) || i || ((p) => p), { unknownErrorTranslationKey: f = "error.unknownError" } = t || {}, l = a(f), d = te(
|
|
807
|
+
(p) => {
|
|
808
|
+
if (p && typeof p == "object" && "response" in p) {
|
|
809
|
+
const { response: s } = p || {};
|
|
810
|
+
if (s && typeof s == "object" && "reason" in s)
|
|
811
|
+
return String(s.reason);
|
|
812
|
+
if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "reason" in s.data)
|
|
813
|
+
return String(s.data.reason);
|
|
814
|
+
if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "message" in s.data)
|
|
815
|
+
return String(s.data.message);
|
|
816
|
+
if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "detail" in s.data) {
|
|
817
|
+
const { detail: w } = s.data;
|
|
818
|
+
if (Array.isArray(w) && w.length > 0 && typeof w[0] == "object" && w[0] !== null && "msg" in w[0]) {
|
|
819
|
+
const { msg: _ } = w[0];
|
|
820
|
+
if (typeof _ == "string")
|
|
821
|
+
return String(_);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return p instanceof Error ? p.message : l;
|
|
811
826
|
},
|
|
812
827
|
[l]
|
|
813
828
|
);
|
|
814
|
-
return { getErrorCode: te((
|
|
815
|
-
var
|
|
816
|
-
const { response: s } =
|
|
817
|
-
return s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (
|
|
829
|
+
return { getErrorCode: te((p) => {
|
|
830
|
+
var w, _, O;
|
|
831
|
+
const { response: s } = p || {};
|
|
832
|
+
return s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (w = s == null ? void 0 : s.data) != null && w.error_code ? String((_ = s == null ? void 0 : s.data) == null ? void 0 : _.error_code) : s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (O = s == null ? void 0 : s.data) != null && O.error_code ? String(s.data.error_code) : "unknown_error_code";
|
|
818
833
|
}, []), printError: d };
|
|
819
834
|
}, Jt = ({
|
|
820
835
|
data: t,
|
|
@@ -831,7 +846,7 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
831
846
|
[f, n, o]
|
|
832
847
|
), d = fe(() => {
|
|
833
848
|
if (t)
|
|
834
|
-
return t.pages.reduce((u,
|
|
849
|
+
return t.pages.reduce((u, y) => [...u, ...y], []);
|
|
835
850
|
}, [t]);
|
|
836
851
|
return {
|
|
837
852
|
fetchNextPageOnRowsScrollEnd: l,
|
|
@@ -840,7 +855,7 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
840
855
|
rows: d
|
|
841
856
|
};
|
|
842
857
|
}, qt = (t) => {
|
|
843
|
-
const { libraries: n } = F(
|
|
858
|
+
const { libraries: n } = F(k), o = (t == null ? void 0 : t.axios) || (n == null ? void 0 : n.axios), i = (t == null ? void 0 : t.localStorageKey) || "user";
|
|
844
859
|
if (!o)
|
|
845
860
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
846
861
|
const a = te(
|
|
@@ -855,10 +870,10 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
855
870
|
const l = ({ newValue: d, key: u }) => {
|
|
856
871
|
if (u === i && d)
|
|
857
872
|
try {
|
|
858
|
-
const { accessToken:
|
|
859
|
-
a({ accessToken:
|
|
860
|
-
} catch (
|
|
861
|
-
console.error("Failed to parse newValue from localStorage:",
|
|
873
|
+
const { accessToken: y, tokenType: g } = JSON.parse(d);
|
|
874
|
+
a({ accessToken: y, tokenType: g });
|
|
875
|
+
} catch (y) {
|
|
876
|
+
console.error("Failed to parse newValue from localStorage:", y);
|
|
862
877
|
}
|
|
863
878
|
};
|
|
864
879
|
return window.addEventListener("storage", l), () => {
|
|
@@ -868,16 +883,16 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
868
883
|
clearAuthenticationToken: f,
|
|
869
884
|
setAuthenticationToken: a
|
|
870
885
|
};
|
|
871
|
-
}, St = ({ library: t, date: n, format: o = "ll" }) => t(n).format(o),
|
|
886
|
+
}, St = ({ library: t, date: n, format: o = "ll" }) => t(n).format(o), bt = (t, n) => {
|
|
872
887
|
const { fractionDigits: o = 0, metric: i = "km" } = n || {}, a = Number(t);
|
|
873
888
|
return Number.isNaN(a) ? `0${i}` : `${a.toFixed(o)}${i}`;
|
|
874
|
-
},
|
|
889
|
+
}, Ct = (t) => !t || typeof t != "string" ? "" : t.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), jt = (t) => t != null && t.startsWith("/") ? t != null && t.startsWith("/files") ? t : `/files${t}` : t != null && t.startsWith("files") ? `/${t}` : `/files/${t}`, Pt = ({ path: t, size: n, apiURL: o }) => {
|
|
875
890
|
if (!t)
|
|
876
891
|
return "";
|
|
877
|
-
const i =
|
|
892
|
+
const i = jt(t), a = `${o}${i}`, f = a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
878
893
|
return typeof n == "number" && f ? `${a.replace("/files", `/thumbs/${n}`)}` : a;
|
|
879
894
|
}, Kt = (t) => {
|
|
880
|
-
const { apiURL: n, libraries: o } = F(
|
|
895
|
+
const { apiURL: n, libraries: o } = F(k), i = (t == null ? void 0 : t.dayjs) || (o == null ? void 0 : o.dayjs);
|
|
881
896
|
return {
|
|
882
897
|
dateAdapter: (l, d) => {
|
|
883
898
|
if (!i)
|
|
@@ -888,19 +903,19 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
888
903
|
library: i
|
|
889
904
|
});
|
|
890
905
|
},
|
|
891
|
-
distanceAdapter:
|
|
906
|
+
distanceAdapter: bt,
|
|
892
907
|
filePathAdapter: (l, d) => {
|
|
893
908
|
if (!n)
|
|
894
909
|
throw new Error(
|
|
895
910
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
896
911
|
);
|
|
897
|
-
return
|
|
912
|
+
return Pt({
|
|
898
913
|
apiURL: n,
|
|
899
914
|
path: l,
|
|
900
915
|
size: d
|
|
901
916
|
});
|
|
902
917
|
},
|
|
903
|
-
worksiteNameAdapter:
|
|
918
|
+
worksiteNameAdapter: Ct
|
|
904
919
|
};
|
|
905
920
|
}, ee = (t, n) => n === "short" ? t.split("-")[0] : t, Bt = (t, n = "full") => {
|
|
906
921
|
const [o, i] = Ue(() => {
|
|
@@ -919,60 +934,60 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
919
934
|
};
|
|
920
935
|
}, [t, n]), o;
|
|
921
936
|
}, Tt = "tracktor.filter", Ye = (t, n, o) => `${o}_${t}=>${n}`, Qt = (t) => {
|
|
922
|
-
const { libraries: n, localStorageKeys: o } = F(
|
|
937
|
+
const { libraries: n, localStorageKeys: o } = F(k), i = (t == null ? void 0 : t.reactRouter) || (n == null ? void 0 : n.reactRouter), { useLocation: a, useSearchParams: f } = i, { pathname: l } = a(), [d, u] = f(), y = (o == null ? void 0 : o.filter) || Tt;
|
|
923
938
|
if (!i)
|
|
924
939
|
throw new Error(
|
|
925
940
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
926
941
|
);
|
|
927
|
-
const g = (
|
|
928
|
-
const
|
|
929
|
-
if (!
|
|
930
|
-
d.delete(
|
|
942
|
+
const g = (w, _, O = !0) => {
|
|
943
|
+
const E = Ye(w, (t == null ? void 0 : t.pathname) || l, y);
|
|
944
|
+
if (!_ || Array.isArray(_) && !_.length) {
|
|
945
|
+
d.delete(w), u(d), localStorage.removeItem(E);
|
|
931
946
|
return;
|
|
932
947
|
}
|
|
933
|
-
|
|
948
|
+
O && _ && localStorage.setItem(E, JSON.stringify({ ...d, [w]: _ })), _ && (d.set(w, JSON.stringify(_)), u(d));
|
|
934
949
|
};
|
|
935
950
|
return {
|
|
936
|
-
getFilter: (
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
951
|
+
getFilter: (w, _) => {
|
|
952
|
+
const O = d.get(w);
|
|
953
|
+
if (O)
|
|
939
954
|
try {
|
|
940
|
-
return JSON.parse(
|
|
955
|
+
return JSON.parse(O);
|
|
941
956
|
} catch {
|
|
942
|
-
return
|
|
957
|
+
return O;
|
|
943
958
|
}
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
959
|
+
const E = Ye(w, (t == null ? void 0 : t.pathname) || l, y), C = localStorage.getItem(E);
|
|
960
|
+
if (C)
|
|
946
961
|
try {
|
|
947
|
-
return JSON.parse(
|
|
962
|
+
return JSON.parse(C)[w];
|
|
948
963
|
} catch {
|
|
949
964
|
}
|
|
950
|
-
return
|
|
965
|
+
return _;
|
|
951
966
|
},
|
|
952
967
|
getFilters: () => {
|
|
953
|
-
const
|
|
954
|
-
(
|
|
955
|
-
).reduce((
|
|
956
|
-
var
|
|
957
|
-
const
|
|
958
|
-
if (
|
|
959
|
-
const
|
|
960
|
-
|
|
968
|
+
const w = Object.fromEntries(d.entries()), O = Object.keys(localStorage).filter(
|
|
969
|
+
(E) => E.startsWith(y) && E.endsWith((t == null ? void 0 : t.pathname) || l)
|
|
970
|
+
).reduce((E, C) => {
|
|
971
|
+
var $, N;
|
|
972
|
+
const D = localStorage.getItem(C);
|
|
973
|
+
if (D) {
|
|
974
|
+
const Y = JSON.parse(D), T = ($ = Object.keys(Y)) == null ? void 0 : $[0];
|
|
975
|
+
E[T] = (N = Object.values(Y)) == null ? void 0 : N[0];
|
|
961
976
|
}
|
|
962
|
-
return
|
|
977
|
+
return E;
|
|
963
978
|
}, {});
|
|
964
979
|
return {
|
|
965
|
-
...
|
|
966
|
-
...
|
|
980
|
+
...w,
|
|
981
|
+
...O
|
|
967
982
|
};
|
|
968
983
|
},
|
|
969
|
-
handleFilter: (
|
|
970
|
-
if (
|
|
971
|
-
const
|
|
972
|
-
g(
|
|
984
|
+
handleFilter: (w, _) => (O, E) => {
|
|
985
|
+
if (E || Array.isArray(E) && E.length === 0) {
|
|
986
|
+
const C = _ || "value", D = typeof E == "object" && C in E ? E[C] : E;
|
|
987
|
+
g(w, D);
|
|
973
988
|
return;
|
|
974
989
|
}
|
|
975
|
-
g(
|
|
990
|
+
g(w, void 0);
|
|
976
991
|
},
|
|
977
992
|
setFilter: g
|
|
978
993
|
};
|
|
@@ -1016,16 +1031,16 @@ const D = gt({}), Lt = ({ children: t, apiURL: n, libraries: o, localStorageKeys
|
|
|
1016
1031
|
...((f == null ? void 0 : f.length) || (l == null ? void 0 : l.length)) && {
|
|
1017
1032
|
operations: Dt(f, l)
|
|
1018
1033
|
},
|
|
1019
|
-
header: (
|
|
1034
|
+
header: (y) => [
|
|
1020
1035
|
"Generated by orval 🍺",
|
|
1021
|
-
...
|
|
1022
|
-
...
|
|
1036
|
+
...y.title ? [y.title] : [],
|
|
1037
|
+
...y.description ? [y.description] : []
|
|
1023
1038
|
],
|
|
1024
1039
|
mutator: {
|
|
1025
1040
|
name: "axiosCustomInstance",
|
|
1026
1041
|
path: "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"
|
|
1027
1042
|
},
|
|
1028
|
-
operationName: (
|
|
1043
|
+
operationName: (y, g, S) => kt(y, g, S, l),
|
|
1029
1044
|
query: {
|
|
1030
1045
|
useQuery: !0
|
|
1031
1046
|
}
|
|
@@ -1043,14 +1058,14 @@ export {
|
|
|
1043
1058
|
Vt as InitializeDaysJSConfig,
|
|
1044
1059
|
Yt as InitializeI18nConfig,
|
|
1045
1060
|
Wt as InitializeSentryConfig,
|
|
1046
|
-
|
|
1061
|
+
k as InjectDependenciesContext,
|
|
1047
1062
|
Lt as InjectDependenciesProvider,
|
|
1048
1063
|
Ut as MaskTextField,
|
|
1049
1064
|
zt as PreloadErrorHandler,
|
|
1050
1065
|
Mt as QueryClientProviderWithConfig,
|
|
1051
1066
|
It as RequireAuth,
|
|
1052
1067
|
St as dateAdapter,
|
|
1053
|
-
|
|
1068
|
+
bt as distanceAdapter,
|
|
1054
1069
|
Ht as getOrvalConfig,
|
|
1055
1070
|
Kt as useAdapter,
|
|
1056
1071
|
qt as useAuth,
|
|
@@ -1058,5 +1073,5 @@ export {
|
|
|
1058
1073
|
Qt as useFilters,
|
|
1059
1074
|
Jt as useInfiniteDataGrid,
|
|
1060
1075
|
Gt as useResponseError,
|
|
1061
|
-
|
|
1076
|
+
Ct as worksiteNameAdapter
|
|
1062
1077
|
};
|