@tracktor/shared-module 2.0.0-beta.2 → 2.0.0-beta.4
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 +1 -1
- package/dist/context/InjectDependenciesProvider.d.ts +1 -0
- package/dist/main.js +334 -329
- package/dist/main.umd.cjs +10 -10
- package/package.json +1 -1
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(_,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(_=typeof globalThis<"u"?globalThis:_||self,m(_["@tracktor/shared-module"]={},_.React))})(this,function(_,m){"use strict";var ee={exports:{}},
|
|
1
|
+
(function(_,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(_=typeof globalThis<"u"?globalThis:_||self,m(_["@tracktor/shared-module"]={},_.React))})(this,function(_,m){"use strict";var ee={exports:{}},B={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.development.js
|
|
4
4
|
*
|
|
@@ -6,17 +6,17 @@
|
|
|
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
|
|
10
|
-
`+re+e}}var ne=!1,K;{var ft=typeof WeakMap=="function"?WeakMap:Map;K=new ft}function be(e,t){if(!e||ne)return"";{var
|
|
11
|
-
`),
|
|
12
|
-
`),b=g.length-1,j=
|
|
13
|
-
`+g[b].replace(" at new "," at ");return e.displayName&&
|
|
9
|
+
*/var se;function Ne(){return se||(se=1,process.env.NODE_ENV!=="production"&&function(){var n=m,r=Symbol.for("react.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),a=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),T=Symbol.iterator,A="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var t=T&&e[T]||e[A];return typeof t=="function"?t:null}var k=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(e){{for(var t=arguments.length,o=new Array(t>1?t-1:0),s=1;s<t;s++)o[s-1]=arguments[s];N("error",e,o)}}function N(e,t,o){{var s=k.ReactDebugCurrentFrame,p=s.getStackAddendum();p!==""&&(t+="%s",o=o.concat([p]));var R=o.map(function(h){return String(h)});R.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,R)}}var L=!1,M=!1,P=!1,ve=!1,ge=!1,J;J=Symbol.for("react.module.reference");function ut(e){return!!(typeof e=="string"||typeof e=="function"||e===u||e===v||ge||e===f||e===y||e===E||ve||e===x||L||M||P||typeof e=="object"&&e!==null&&(e.$$typeof===a||e.$$typeof===w||e.$$typeof===d||e.$$typeof===c||e.$$typeof===l||e.$$typeof===J||e.getModuleId!==void 0))}function ct(e,t,o){var s=e.displayName;if(s)return s;var p=t.displayName||t.name||"";return p!==""?o+"("+p+")":o}function he(e){return e.displayName||"Context"}function Y(e){if(e==null)return null;if(typeof e.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case u:return"Fragment";case i:return"Portal";case v:return"Profiler";case f:return"StrictMode";case y:return"Suspense";case E:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case c:var t=e;return he(t)+".Consumer";case d:var o=e;return he(o._context)+".Provider";case l:return ct(e,e.render,"ForwardRef");case w:var s=e.displayName||null;return s!==null?s:Y(e.type)||"Memo";case a:{var p=e,R=p._payload,h=p._init;try{return Y(h(R))}catch{return null}}}return null}var z=Object.assign,Q=0,ye,me,pe,Ee,Re,we,_e;function Ce(){}Ce.__reactDisabledLog=!0;function st(){{if(Q===0){ye=console.log,me=console.info,pe=console.warn,Ee=console.error,Re=console.group,we=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Q++}}function lt(){{if(Q--,Q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:ye}),info:z({},e,{value:me}),warn:z({},e,{value:pe}),error:z({},e,{value:Ee}),group:z({},e,{value:Re}),groupCollapsed:z({},e,{value:we}),groupEnd:z({},e,{value:_e})})}Q<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=k.ReactCurrentDispatcher,re;function H(e,t,o){{if(re===void 0)try{throw Error()}catch(p){var s=p.stack.trim().match(/\n( *(at )?)/);re=s&&s[1]||""}return`
|
|
10
|
+
`+re+e}}var ne=!1,K;{var ft=typeof WeakMap=="function"?WeakMap:Map;K=new ft}function be(e,t){if(!e||ne)return"";{var o=K.get(e);if(o!==void 0)return o}var s;ne=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var R;R=te.current,te.current=null,st();try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(W){s=W}Reflect.construct(e,[],h)}else{try{h.call()}catch(W){s=W}e.call(h.prototype)}}else{try{throw Error()}catch(W){s=W}e()}}catch(W){if(W&&s&&typeof W.stack=="string"){for(var g=W.stack.split(`
|
|
11
|
+
`),S=s.stack.split(`
|
|
12
|
+
`),b=g.length-1,j=S.length-1;b>=1&&j>=0&&g[b]!==S[j];)j--;for(;b>=1&&j>=0;b--,j--)if(g[b]!==S[j]){if(b!==1||j!==1)do if(b--,j--,j<0||g[b]!==S[j]){var I=`
|
|
13
|
+
`+g[b].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),typeof e=="function"&&K.set(e,I),I}while(b>=1&&j>=0);break}}}finally{ne=!1,te.current=R,lt(),Error.prepareStackTrace=p}var U=e?e.displayName||e.name:"",We=U?H(U):"";return typeof e=="function"&&K.set(e,We),We}function dt(e,t,o){return be(e,!1)}function vt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Z(e,t,o){if(e==null)return"";if(typeof e=="function")return be(e,vt(e));if(typeof e=="string")return H(e);switch(e){case y:return H("Suspense");case E:return H("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return dt(e.render);case w:return Z(e.type,t,o);case a:{var s=e,p=s._payload,R=s._init;try{return Z(R(p),t,o)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,je={},Pe=k.ReactDebugCurrentFrame;function q(e){if(e){var t=e._owner,o=Z(e.type,e._source,t?t.type:null);Pe.setExtraStackFrame(o)}else Pe.setExtraStackFrame(null)}function gt(e,t,o,s,p){{var R=Function.call.bind($);for(var h in e)if(R(e,h)){var g=void 0;try{if(typeof e[h]!="function"){var S=Error((s||"React class")+": "+o+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}g=e[h](t,h,s,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(b){g=b}g&&!(g instanceof Error)&&(q(p),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).",s||"React class",o,h,typeof g),q(null)),g instanceof Error&&!(g.message in je)&&(je[g.message]=!0,q(p),C("Failed %s type: %s",o,g.message),q(null))}}}var ht=Array.isArray;function oe(e){return ht(e)}function yt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,o=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o}}function mt(e){try{return Te(e),!1}catch{return!0}}function Te(e){return""+e}function Se(e){if(mt(e))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",yt(e)),Te(e)}var X=k.ReactCurrentOwner,pt={key:!0,ref:!0,__self:!0,__source:!0},xe,Oe,ie;ie={};function Et(e){if($.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Rt(e){if($.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function wt(e,t){if(typeof e.ref=="string"&&X.current&&t&&X.current.stateNode!==t){var o=Y(X.current.type);ie[o]||(C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Y(X.current.type),e.ref),ie[o]=!0)}}function _t(e,t){{var o=function(){xe||(xe=!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)",t))};o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}}function Ct(e,t){{var o=function(){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)",t))};o.isReactWarning=!0,Object.defineProperty(e,"ref",{get:o,configurable:!0})}}var bt=function(e,t,o,s,p,R,h){var g={$$typeof:r,type:e,key:t,ref:o,props:h,_owner:R};return g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(g,"_self",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.defineProperty(g,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g};function jt(e,t,o,s,p){{var R,h={},g=null,S=null;o!==void 0&&(Se(o),g=""+o),Rt(t)&&(Se(t.key),g=""+t.key),Et(t)&&(S=t.ref,wt(t,p));for(R in t)$.call(t,R)&&!pt.hasOwnProperty(R)&&(h[R]=t[R]);if(e&&e.defaultProps){var b=e.defaultProps;for(R in b)h[R]===void 0&&(h[R]=b[R])}if(g||S){var j=typeof e=="function"?e.displayName||e.name||"Unknown":e;g&&_t(h,j),S&&Ct(h,j)}return bt(e,g,S,p,s,X.current,h)}}var ae=k.ReactCurrentOwner,Ae=k.ReactDebugCurrentFrame;function V(e){if(e){var t=e._owner,o=Z(e.type,e._source,t?t.type:null);Ae.setExtraStackFrame(o)}else Ae.setExtraStackFrame(null)}var ue;ue=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function De(){{if(ae.current){var e=Y(ae.current.type);if(e)return`
|
|
14
14
|
|
|
15
|
-
Check the render method of \``+e+"`."}return""}}function Pt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),
|
|
15
|
+
Check the render method of \``+e+"`."}return""}}function Pt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),o=e.lineNumber;return`
|
|
16
16
|
|
|
17
|
-
Check your code at `+t+":"+
|
|
17
|
+
Check your code at `+t+":"+o+"."}return""}}var Ie={};function Tt(e){{var t=De();if(!t){var o=typeof e=="string"?e:e.displayName||e.name;o&&(t=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+
|
|
19
|
+
Check the top-level render call using <`+o+">.")}return t}}function ke(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Tt(t);if(Ie[o])return;Ie[o]=!0;var s="";e&&e._owner&&e._owner!==ae.current&&(s=" It was passed a child from "+Y(e._owner.type)+"."),V(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.',o,s),V(null)}}function Fe(e,t){{if(typeof e!="object")return;if(oe(e))for(var o=0;o<e.length;o++){var s=e[o];ce(s)&&ke(s,t)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var p=D(e);if(typeof p=="function"&&p!==e.entries)for(var R=p.call(e),h;!(h=R.next()).done;)ce(h.value)&&ke(h.value,t)}}}function St(e){{var t=e.type;if(t==null||typeof t=="string")return;var o;if(typeof t=="function")o=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===l||t.$$typeof===w))o=t.propTypes;else return;if(o){var s=Y(t);gt(o,e.props,"prop",s,e)}else if(t.PropTypes!==void 0&&!ue){ue=!0;var p=Y(t);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(e){{for(var t=Object.keys(e.props),o=0;o<t.length;o++){var s=t[o];if(s!=="children"&&s!=="key"){V(e),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),V(null);break}}e.ref!==null&&(V(e),C("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ye(e,t,o,s,p,R){{var h=ut(e);if(!h){var g="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(g+=" 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 S=Pt(p);S?g+=S:g+=De();var b;e===null?b="null":oe(e)?b="array":e!==void 0&&e.$$typeof===r?(b="<"+(Y(e.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):b=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",b,g)}var j=jt(e,t,o,p,R);if(j==null)return j;if(h){var I=t.children;if(I!==void 0)if(s)if(oe(I)){for(var U=0;U<I.length;U++)Fe(I[U],e);Object.freeze&&Object.freeze(I)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(I,e)}return e===u?xt(j):St(j),j}}function Ot(e,t,o){return Ye(e,t,o,!0)}function At(e,t,o){return Ye(e,t,o,!1)}var Dt=At,It=Ot;B.Fragment=u,B.jsx=Dt,B.jsxs=It}()),B}var G={};/**
|
|
20
20
|
* @license React
|
|
21
21
|
* react-jsx-runtime.production.min.js
|
|
22
22
|
*
|
|
@@ -24,4 +24,4 @@ Check the top-level render call using <`+a+">.")}return t}}function De(e,t){{if(
|
|
|
24
24
|
*
|
|
25
25
|
* This source code is licensed under the MIT license found in the
|
|
26
26
|
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/var le;function Le(){if(le)return V;le=1;var n=m,r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,f=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function v(c,s,o){var y,R={},w=null,I=null;o!==void 0&&(w=""+o),s.key!==void 0&&(w=""+s.key),s.ref!==void 0&&(I=s.ref);for(y in s)u.call(s,y)&&!d.hasOwnProperty(y)&&(R[y]=s[y]);if(c&&c.defaultProps)for(y in s=c.defaultProps,s)R[y]===void 0&&(R[y]=s[y]);return{$$typeof:r,type:c,key:w,ref:I,props:R,_owner:f.current}}return V.Fragment=i,V.jsx=v,V.jsxs=v,V}process.env.NODE_ENV==="production"?ee.exports=Le():ee.exports=Ne();var D=ee.exports;const S=m.createContext({}),Me=({children:n,apiURL:r,libraries:i})=>{const u=m.useMemo(()=>({apiURL:r,libraries:i}),[r,i]);return D.jsx(S.Provider,{value:u,children:n})},ze=({Fallback:n,isLogged:r,loginPath:i="/login",localStorageKey:u="user",redirect401Path:f="/login",...d})=>{var C,J,Q,X;const{libraries:v}=m.useContext(S),c=(d==null?void 0:d.axios)||(v==null?void 0:v.axios),s=(d==null?void 0:d.reactRouter)||(v==null?void 0:v.reactRouter);if(s===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(c===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[o,y]=m.useState(null),{useLocation:R,Navigate:w,Outlet:I}=s,x=R(),F=m.useRef(!1),O=typeof r=="function"?r():!!r,k=typeof O=="boolean"?O:O==null?void 0:O.isLogged;return m.useLayoutEffect(()=>{F.current||(F.current=!0,c==null||c.interceptors.response.use(P=>P,async P=>{var U;return typeof P=="object"&&P&&"response"in P&&P.response&&typeof P.response=="object"&&"status"in P.response&&P.response&&typeof P.response=="object"&&"status"in P.response&&((U=P==null?void 0:P.response)==null?void 0:U.status)===401&&(c.defaults.headers.common.Authorization=null,localStorage.removeItem(u),y(f)),Promise.reject(P)}))},[c==null?void 0:c.defaults.headers.common,c==null?void 0:c.interceptors.response,u,f]),k&&!o?D.jsx(m.Suspense,{fallback:n,children:(J=(C=x.state)==null?void 0:C.from)!=null&&J.state&&((X=(Q=x.state)==null?void 0:Q.from)==null?void 0:X.pathname)===i?D.jsx(w,{to:x.state.from.state.from.pathname+x.state.from.state.from.search,replace:!0}):D.jsx(I,{})}):D.jsx(w,{to:i,state:{from:x},replace:!0})},Ve=({...n})=>{const{libraries:r}=m.useContext(S),i=(n==null?void 0:n.reactRouter)||(r==null?void 0:r.reactRouter),u=(n==null?void 0:n.gtm)||(r==null?void 0:r.gtm);if(i===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(u===void 0)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const{useGoogleTagManager:f}=u,{useLocation:d,Outlet:v}=i,{pathname:c}=d(),{sendEvent:s}=f();return m.useEffect(()=>{s({event:"pageView",pathname:c})},[c,s]),D.jsx(v,{})},Ue=({tokenTypeKey:n="tokenType",userLocalStorageKey:r="user",tokenKey:i="accessToken",postContentType:u="application/json",...f})=>{const{apiURL:d=f.apiURL,libraries:v}=m.useContext(S),c=(f==null?void 0:f.axios)||(v==null?void 0:v.axios);if(c===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c.defaults)return null;const s=localStorage.getItem(r),o=s?JSON.parse(s):null,y=o!=null&&o[n]?o[n]:null,R=o!=null&&o[i]?o[i]:null,w=s?`${y} ${R}`:null;return c.defaults.baseURL=d,c.defaults.headers.post["Content-Type"]=u,w&&(c.defaults.headers.common.Authorization=w),null},Be=({debug:n,resources:r,...i})=>{const{libraries:u}=m.useContext(S),f=(i==null?void 0:i.i18)||(u==null?void 0:u.i18),{i18next:d,initReactI18next:v,languageDetector:c}=f||{};if(f===void 0)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return d!=null&&d.isInitialized||(d.use(c).use(v).init({debug:n,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==d.resolvedLanguage&&d.resolvedLanguage&&document.documentElement.setAttribute("lang",d.resolvedLanguage)}),d.on("languageChanged",s=>{document.documentElement.setAttribute("lang",s)})),null},Ge=({dsn:n,integrations:r,tracesSampleRate:i,replaysSessionSampleRate:u,replaysOnErrorSampleRate:f,tracePropagationTargets:d,ignoreErrors:v,debug:c,environment:s,...o})=>{const{libraries:y}=m.useContext(S),R=(o==null?void 0:o.sentry)||(y==null?void 0:y.sentry),w=(o==null?void 0:o.reactRouter)||(y==null?void 0:y.reactRouter),{createRoutesFromChildren:I,matchRoutes:x,useLocation:F,useNavigationType:O}=w;if(R===void 0)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(w===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return R.isInitialized()||(c||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&R.init({debug:c,dsn:n,environment:s||"production",ignoreErrors:[...v||[],/dynamically imported module/],integrations:[R.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:I,matchRoutes:x,useEffect:m.useEffect,useLocation:F,useNavigationType:O}),...r||[]],replaysOnErrorSampleRate:f||1,replaysSessionSampleRate:u||.1,tracePropagationTargets:d,tracesSampleRate:i||1}),null},Je=({IMaskMixin:n,...r})=>{const i=m.useMemo(()=>n(({TextField:u,...f})=>D.jsx(u,{...f})),[n]);return D.jsx(i,{...r})},Qe=({accessToken:n,...r})=>{const{libraries:i}=m.useContext(S),u=(r==null?void 0:r.mapbox)||(i==null?void 0:i.mapbox);if(u===void 0)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return n&&(u.accessToken=n),null},Xe=({language:n,...r})=>{const{libraries:i}=m.useContext(S),u=(r==null?void 0:r.dayjs)||(i==null?void 0:i.dayjs),f=(r==null?void 0:r.dayjsPlugin)||(i==null?void 0:i.dayjsPlugin);if(u===void 0)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return m.useLayoutEffect(()=>{(async()=>{var c;const v=n||((c=navigator.language)==null?void 0:c.slice(0,2))||"en";f&&f.forEach(s=>{u.extend(s.default)}),u.locale(v)})().then()},[u,f,n]),null},He=({children:n,defaultQueriesOptions:r,defaultMutationsOptions:i,...u})=>{var s,o;const{libraries:f}=m.useContext(S),d=(u==null?void 0:u.QueryClient)||((s=f==null?void 0:f.reactQuery)==null?void 0:s.QueryClient),v=(u==null?void 0:u.QueryClientProvider)||((o=f==null?void 0:f.reactQuery)==null?void 0:o.QueryClientProvider);if(d===void 0)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(v===void 0)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const c=new d({defaultOptions:{mutations:{...i},queries:{getNextPageParam:(y,R,w)=>y.length+(w||0),refetchOnWindowFocus:!1,retry:3,...r}}});return D.jsx(v,{client:c,children:n})},Ke=n=>{const{libraries:r}=m.useContext(S),i=(n==null?void 0:n.i18)||(r==null?void 0:r.i18);if(i===void 0)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in params of useResponseError.");const{t:u}=i.i18next,{unknownErrorTranslationKey:f="error.unknownError"}=n||{},d=u(f),v=m.useCallback(s=>{var y,R,w,I,x,F,O,k,C;const{response:o}=s||{};return o!=null&&o.reason?String(o.reason):(y=o==null?void 0:o.data)!=null&&y.reason?String(o.data.reason):(R=o==null?void 0:o.data)!=null&&R.message?String(o.data.message):(I=(w=o==null?void 0:o.data)==null?void 0:w.detail)!=null&&I.length&&Array.isArray((x=o==null?void 0:o.data)==null?void 0:x.detail)&&((O=(F=o==null?void 0:o.data)==null?void 0:F.detail[0])!=null&&O.msg)&&typeof((C=(k=o==null?void 0:o.data)==null?void 0:k.detail[0])==null?void 0:C.msg)=="string"?String(o.data.detail[0].msg):d},[d]);return{getErrorCode:m.useCallback(s=>{var y,R,w;const{response:o}=s||{};return o!=null&&o.error_code?String(o==null?void 0:o.error_code):(y=o==null?void 0:o.data)!=null&&y.error_code?String((R=o==null?void 0:o.data)==null?void 0:R.error_code):o!=null&&o.error_code?String(o==null?void 0:o.error_code):(w=o==null?void 0:o.data)!=null&&w.error_code?String(o.data.error_code):"unknown_error_code"},[]),printError:v}},Ze=({data:n,fetchNextPage:r,isFetchingNextPage:i,isInitialLoading:u,isLoading:f,enabled:d=!0})=>{const v=m.useCallback(async s=>{i||!d||await r({pageParam:(s==null?void 0:s.pageParam)||s.visibleRowsCount})},[d,r,i]),c=m.useMemo(()=>{if(n)return n.pages.reduce((s,o)=>[...s,...o],[])},[n]);return{fetchNextPageOnRowsScrollEnd:v,isLoading:i||f,loadingVariant:u?"skeleton":"linear",rows:c}},$e=n=>{const{libraries:r}=m.useContext(S),i=(n==null?void 0:n.axios)||(r==null?void 0:r.axios);if(i===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");return{clearAuthenticationToken:()=>{i.defaults.headers.common.Authorization=null},setAuthenticationToken:({tokenType:d,accessToken:v})=>{i.defaults.headers.common.Authorization=`${d} ${v}`}}},fe=(n,r="km")=>{const i=Number(n);return Number.isNaN(i)?`0 ${r}`:`${i.toFixed(2)} ${r}`},qe=n=>{const r=n&&typeof n=="object"&&"pathname"in n&&n.pathname?n.pathname:n;return typeof r=="string"?r!=null&&r.startsWith("/")?r!=null&&r.startsWith("/files")?r:`/files${r}`:r!=null&&r.startsWith("files")?`/${r}`:r!=null&&r.startsWith("files")?`/${r}`:`/files/${r}`:r},de=(n,r)=>{if(!n)return"";const i=qe(n),u=typeof n=="object"&&"pathname"in n?`${n.origin}${i}`:n;return typeof r=="number"?`${u.replace("/files",`/thumbs/${r}`)}`:u},et=n=>{const{apiURL:r,libraries:i}=m.useContext(S),u=(n==null?void 0:n.dayjs)||(i==null?void 0:i.dayjs);return{dateAdapter:(v,c="ll")=>u(v).format(c),distanceAdapter:fe,filePathAdapter:(v,c)=>de(r&&typeof v=="string"?{origin:r,pathname:v}:v,c)}},tt=n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase(),rt=n=>{const u=n.split("/").filter(f=>f.length>0).map(f=>f.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join("")).join("");return u.charAt(0).toLowerCase()+u.slice(1)},nt=(n,r,i)=>{const u=rt(r),f=tt(i);return`${u}${f}`},ot=n=>{if(n)return(n==null?void 0:n.reduce((r,i)=>(r[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},r),{}))||{}},at=n=>{const{input:r="./openapi.json",operationsToGenerateInfiniteQueryHook:i=void 0}=n||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:r,output:{client:"react-query",mode:"tags-split",override:{header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:nt,...(i==null?void 0:i.length)&&{operations:ot(i)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}},it=(n,r,i="ll")=>String(n(r).format(i));_.GTMSendPageView=Ve,_.InitializeAxiosConfig=Ue,_.InitializeDaysJSConfig=Xe,_.InitializeI18nConfig=Be,_.InitializeMapBoxConfig=Qe,_.InitializeSentryConfig=Ge,_.InjectDependenciesContext=S,_.InjectDependenciesProvider=Me,_.MaskTextField=Je,_.QueryClientProviderWithConfig=He,_.RequireAuth=ze,_.dateAdapter=it,_.distanceAdapter=fe,_.getOrvalConfig=at,_.useAdapter=et,_.useAuth=$e,_.useInfiniteDataGrid=Ze,_.useResponseError=Ke,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
27
|
+
*/var le;function Le(){if(le)return G;le=1;var n=m,r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,f=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function d(c,l,y){var E,w={},a=null,x=null;y!==void 0&&(a=""+y),l.key!==void 0&&(a=""+l.key),l.ref!==void 0&&(x=l.ref);for(E in l)u.call(l,E)&&!v.hasOwnProperty(E)&&(w[E]=l[E]);if(c&&c.defaultProps)for(E in l=c.defaultProps,l)w[E]===void 0&&(w[E]=l[E]);return{$$typeof:r,type:c,key:a,ref:x,props:w,_owner:f.current}}return G.Fragment=i,G.jsx=d,G.jsxs=d,G}process.env.NODE_ENV==="production"?ee.exports=Le():ee.exports=Ne();var F=ee.exports;const O=m.createContext({}),Me=({children:n,apiURL:r,libraries:i})=>{const u=m.useMemo(()=>({apiURL:r,libraries:i}),[r,i]);return F.jsx(O.Provider,{value:u,children:n})},ze=({Fallback:n,isLogged:r,loginPath:i="/login",localStorageKey:u="user",redirect401Path:f="/login",...v})=>{var C,N,L,M;const{libraries:d}=m.useContext(O),c=(v==null?void 0:v.axios)||(d==null?void 0:d.axios),l=(v==null?void 0:v.reactRouter)||(d==null?void 0:d.reactRouter);if(l===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(c===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[y,E]=m.useState(null),{useLocation:w,Navigate:a,Outlet:x}=l,T=w(),A=m.useRef(!1),D=typeof r=="function"?r():!!r,k=typeof D=="boolean"?D:D==null?void 0:D.isLogged;return m.useLayoutEffect(()=>{A.current||(A.current=!0,c==null||c.interceptors.response.use(P=>P,async P=>{var J;return typeof P=="object"&&P&&"response"in P&&P.response&&typeof P.response=="object"&&"status"in P.response&&P.response&&typeof P.response=="object"&&"status"in P.response&&((J=P==null?void 0:P.response)==null?void 0:J.status)===401&&(c.defaults.headers.common.Authorization=null,localStorage.removeItem(u),E(f)),Promise.reject(P)}))},[c==null?void 0:c.defaults.headers.common,c==null?void 0:c.interceptors.response,u,f]),k&&!y?F.jsx(m.Suspense,{fallback:n,children:(N=(C=T.state)==null?void 0:C.from)!=null&&N.state&&((M=(L=T.state)==null?void 0:L.from)==null?void 0:M.pathname)===i?F.jsx(a,{to:T.state.from.state.from.pathname+T.state.from.state.from.search,replace:!0}):F.jsx(x,{})}):F.jsx(a,{to:i,state:{from:T},replace:!0})},Ve=({...n})=>{const{libraries:r}=m.useContext(O),i=(n==null?void 0:n.reactRouter)||(r==null?void 0:r.reactRouter),u=(n==null?void 0:n.gtm)||(r==null?void 0:r.gtm);if(i===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(u===void 0)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const{useGoogleTagManager:f}=u,{useLocation:v,Outlet:d}=i,{pathname:c}=v(),{sendEvent:l}=f();return m.useEffect(()=>{l({event:"pageView",pathname:c})},[c,l]),F.jsx(d,{})},Ue=({tokenTypeKey:n="tokenType",userLocalStorageKey:r="user",tokenKey:i="accessToken",postContentType:u="application/json",...f})=>{const{apiURL:v=f.apiURL,libraries:d}=m.useContext(O),c=(f==null?void 0:f.axios)||(d==null?void 0:d.axios);if(c===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c.defaults)return null;const l=localStorage.getItem(r),y=l?JSON.parse(l):null,E=y!=null&&y[n]?y[n]:null,w=y!=null&&y[i]?y[i]:null,a=l?`${E} ${w}`:null;return c.defaults.baseURL=v,c.defaults.headers.post["Content-Type"]=u,a&&(c.defaults.headers.common.Authorization=a),null},Be=({debug:n,resources:r,...i})=>{const{libraries:u}=m.useContext(O),f=(i==null?void 0:i.i18)||(u==null?void 0:u.i18),{i18next:v,initReactI18next:d,languageDetector:c}=f||{};if(f===void 0)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return v!=null&&v.isInitialized||(v.use(c).use(d).init({debug:n,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==v.resolvedLanguage&&v.resolvedLanguage&&document.documentElement.setAttribute("lang",v.resolvedLanguage)}),v.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},Ge=({dsn:n,integrations:r,tracesSampleRate:i,replaysSessionSampleRate:u,replaysOnErrorSampleRate:f,tracePropagationTargets:v,ignoreErrors:d,debug:c,environment:l,...y})=>{const{libraries:E}=m.useContext(O),w=(y==null?void 0:y.sentry)||(E==null?void 0:E.sentry),a=(y==null?void 0:y.reactRouter)||(E==null?void 0:E.reactRouter),{createRoutesFromChildren:x,matchRoutes:T,useLocation:A,useNavigationType:D}=a;if(w===void 0)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(a===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return w.isInitialized()||(c||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&w.init({debug:c,dsn:n,environment:l||"production",ignoreErrors:[...d||[],/dynamically imported module/],integrations:[w.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:x,matchRoutes:T,useEffect:m.useEffect,useLocation:A,useNavigationType:D}),...r||[]],replaysOnErrorSampleRate:f||1,replaysSessionSampleRate:u||.1,tracePropagationTargets:v,tracesSampleRate:i||1}),null},Je=({IMaskMixin:n,...r})=>{const i=m.useMemo(()=>n(({TextField:u,...f})=>F.jsx(u,{...f})),[n]);return F.jsx(i,{...r})},Qe=({accessToken:n,...r})=>{const{libraries:i}=m.useContext(O),u=(r==null?void 0:r.mapbox)||(i==null?void 0:i.mapbox);if(u===void 0)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return n&&(u.accessToken=n),null},Xe=({language:n,...r})=>{const{libraries:i}=m.useContext(O),u=(r==null?void 0:r.dayjs)||(i==null?void 0:i.dayjs),f=(r==null?void 0:r.dayjsPlugin)||(i==null?void 0:i.dayjsPlugin);if(u===void 0)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return m.useLayoutEffect(()=>{(async()=>{var c;const d=n||((c=navigator.language)==null?void 0:c.slice(0,2))||"en";f&&f.forEach(l=>{u.extend(l.default)}),u.locale(d)})().then()},[u,f,n]),null},He=({children:n,defaultQueriesOptions:r,defaultMutationsOptions:i,...u})=>{var l,y;const{libraries:f}=m.useContext(O),v=(u==null?void 0:u.QueryClient)||((l=f==null?void 0:f.reactQuery)==null?void 0:l.QueryClient),d=(u==null?void 0:u.QueryClientProvider)||((y=f==null?void 0:f.reactQuery)==null?void 0:y.QueryClientProvider);if(v===void 0)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(d===void 0)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const c=new v({defaultOptions:{mutations:{...i},queries:{getNextPageParam:(E,w,a)=>E.length+(a||0),refetchOnWindowFocus:!1,retry:3,...r}}});return F.jsx(d,{client:c,children:n})},Ke=n=>{var y,E;const{libraries:r}=m.useContext(O),i=(n==null?void 0:n.i18)||(r==null?void 0:r.i18),u=((y=n==null?void 0:n.i18)==null?void 0:y.translateFunction)||((E=r==null?void 0:r.i18)==null?void 0:E.translateFunction);if(i===void 0)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in params of useResponseError.");const f=i.i18next.t||u||(w=>w),{unknownErrorTranslationKey:v="error.unknownError"}=n||{},d=f(v),c=m.useCallback(w=>{var x,T,A,D,k,C,N,L,M;const{response:a}=w||{};return a!=null&&a.reason?String(a.reason):(x=a==null?void 0:a.data)!=null&&x.reason?String(a.data.reason):(T=a==null?void 0:a.data)!=null&&T.message?String(a.data.message):(D=(A=a==null?void 0:a.data)==null?void 0:A.detail)!=null&&D.length&&Array.isArray((k=a==null?void 0:a.data)==null?void 0:k.detail)&&((N=(C=a==null?void 0:a.data)==null?void 0:C.detail[0])!=null&&N.msg)&&typeof((M=(L=a==null?void 0:a.data)==null?void 0:L.detail[0])==null?void 0:M.msg)=="string"?String(a.data.detail[0].msg):d},[d]);return{getErrorCode:m.useCallback(w=>{var x,T,A;const{response:a}=w||{};return a!=null&&a.error_code?String(a==null?void 0:a.error_code):(x=a==null?void 0:a.data)!=null&&x.error_code?String((T=a==null?void 0:a.data)==null?void 0:T.error_code):a!=null&&a.error_code?String(a==null?void 0:a.error_code):(A=a==null?void 0:a.data)!=null&&A.error_code?String(a.data.error_code):"unknown_error_code"},[]),printError:c}},Ze=({data:n,fetchNextPage:r,isFetchingNextPage:i,isInitialLoading:u,isLoading:f,enabled:v=!0})=>{const d=m.useCallback(async l=>{i||!v||await r({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[v,r,i]),c=m.useMemo(()=>{if(n)return n.pages.reduce((l,y)=>[...l,...y],[])},[n]);return{fetchNextPageOnRowsScrollEnd:d,isLoading:i||f,loadingVariant:u?"skeleton":"linear",rows:c}},$e=n=>{const{libraries:r}=m.useContext(O),i=(n==null?void 0:n.axios)||(r==null?void 0:r.axios);if(i===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");return{clearAuthenticationToken:()=>{i.defaults.headers.common.Authorization=null},setAuthenticationToken:({tokenType:v,accessToken:d})=>{i.defaults.headers.common.Authorization=`${v} ${d}`}}},fe=(n,r="km")=>{const i=Number(n);return Number.isNaN(i)?`0 ${r}`:`${i.toFixed(2)} ${r}`},qe=n=>{const r=n&&typeof n=="object"&&"pathname"in n&&n.pathname?n.pathname:n;return typeof r=="string"?r!=null&&r.startsWith("/")?r!=null&&r.startsWith("/files")?r:`/files${r}`:r!=null&&r.startsWith("files")?`/${r}`:r!=null&&r.startsWith("files")?`/${r}`:`/files/${r}`:r},de=(n,r)=>{if(!n)return"";const i=qe(n),u=typeof n=="object"&&"pathname"in n?`${n.origin}${i}`:n;return typeof r=="number"?`${u.replace("/files",`/thumbs/${r}`)}`:u},et=n=>{const{apiURL:r,libraries:i}=m.useContext(O),u=(n==null?void 0:n.dayjs)||(i==null?void 0:i.dayjs);return{dateAdapter:(d,c="ll")=>{if(u===void 0)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return u(d).format(c)},distanceAdapter:fe,filePathAdapter:(d,c)=>de(r&&typeof d=="string"?{origin:r,pathname:d}:d,c)}},tt=n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase(),rt=n=>{const u=n.split("/").filter(f=>f.length>0).map(f=>f.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return u.charAt(0).toLowerCase()+u.slice(1)},nt=(n,r,i)=>{const u=rt(r),f=tt(i);return`${u}${f}`},ot=n=>{if(n)return(n==null?void 0:n.reduce((r,i)=>(r[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},r),{}))||{}},it=n=>{const{input:r="./openapi.json",operationsToGenerateInfiniteQueryHook:i=void 0}=n||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:r,output:{client:"react-query",mode:"tags-split",override:{header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:nt,...(i==null?void 0:i.length)&&{operations:ot(i)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}},at=(n,r,i="ll")=>String(n(r).format(i));_.GTMSendPageView=Ve,_.InitializeAxiosConfig=Ue,_.InitializeDaysJSConfig=Xe,_.InitializeI18nConfig=Be,_.InitializeMapBoxConfig=Qe,_.InitializeSentryConfig=Ge,_.InjectDependenciesContext=O,_.InjectDependenciesProvider=Me,_.MaskTextField=Je,_.QueryClientProviderWithConfig=He,_.RequireAuth=ze,_.dateAdapter=at,_.distanceAdapter=fe,_.getOrvalConfig=it,_.useAdapter=et,_.useAuth=$e,_.useInfiniteDataGrid=Ze,_.useResponseError=Ke,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|