@tracktor/shared-module 0.18.3 → 0.19.1
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/{src/context → context}/InjectDependenciesProvider.d.ts +6 -1
- package/dist/hooks/useAdapter/index.d.ts +3 -0
- package/dist/hooks/useAdapter/useAdapter.d.ts +8 -0
- package/dist/{src/main.d.ts → main.d.ts} +2 -0
- package/dist/main.js +450 -460
- package/dist/main.umd.cjs +10 -10
- package/dist/utils/adapter/filePathAdapter.d.ts +10 -0
- package/dist/utils/adapter/index.d.ts +7 -0
- package/package.json +3 -3
- package/dist/src/utils/adapter/filePathAdapter.d.ts +0 -7
- package/dist/src/utils/adapter/index.d.ts +0 -4
- /package/dist/{src/components → components}/Inputs/MaskTextField.d.ts +0 -0
- /package/dist/{src/components → components}/Utils/AxiosConfig.d.ts +0 -0
- /package/dist/{src/components → components}/Utils/GTMSendPageView.d.ts +0 -0
- /package/dist/{src/components → components}/Utils/I18nConfig.d.ts +0 -0
- /package/dist/{src/components → components}/Utils/MapBoxConfig.d.ts +0 -0
- /package/dist/{src/components → components}/Utils/RequireAuth.d.ts +0 -0
- /package/dist/{src/components → components}/Utils/SentryConfig.d.ts +0 -0
- /package/dist/{src/config → config}/orval/index.d.ts +0 -0
- /package/dist/{src/config → config}/orval/mutator/axiosCustomInstance.d.ts +0 -0
- /package/dist/{src/config → config}/orval/orval.d.ts +0 -0
- /package/dist/{src/config → config}/orval/orval.test.d.ts +0 -0
- /package/dist/{src/context → context}/QueryClientConfigProvider.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useAuth/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useAuth/useAuth.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useInfiniteDataGrid/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useInfiniteDataGrid/useInfiniteDataGrid.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useResponseError/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useResponseError/useResponseError.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useResponseError/useResponseError.test.d.ts +0 -0
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(b,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],h):(b=typeof globalThis<"u"?globalThis:b||self,h(b["@tracktor/shared-module"]={},b.React))})(this,function(b,h){"use strict";var q={exports:{}},Y={};/**
|
|
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 ce;function
|
|
10
|
-
`+te+e}}var ne=!1,
|
|
11
|
-
`),T=
|
|
12
|
-
`),
|
|
13
|
-
`+
|
|
9
|
+
*/var ce;function Ne(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var t=h,u=Symbol.for("react.element"),i=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),n=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),F=Symbol.iterator,I="@@iterator";function L(e){if(e===null||typeof e!="object")return null;var r=F&&e[F]||e[I];return typeof r=="function"?r:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(e){{for(var r=arguments.length,a=new Array(r>1?r-1:0),c=1;c<r;c++)a[c-1]=arguments[c];w("error",e,a)}}function w(e,r,a){{var c=k.ReactDebugCurrentFrame,p=c.getStackAddendum();p!==""&&(r+="%s",a=a.concat([p]));var g=a.map(function(v){return String(v)});g.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,g)}}var fe=!1,de=!1,$=!1,nr=!1,ar=!1,ve;ve=Symbol.for("react.module.reference");function or(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===f||ar||e===s||e===m||e===y||nr||e===S||fe||de||$||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===O||e.$$typeof===E||e.$$typeof===n||e.$$typeof===l||e.$$typeof===ve||e.getModuleId!==void 0))}function ir(e,r,a){var c=e.displayName;if(c)return c;var p=r.displayName||r.name||"";return p!==""?a+"("+p+")":a}function pe(e){return e.displayName||"Context"}function x(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 o:return"Fragment";case i:return"Portal";case f:return"Profiler";case s:return"StrictMode";case m:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n:var r=e;return pe(r)+".Consumer";case E:var a=e;return pe(a._context)+".Provider";case l:return ir(e,e.render,"ForwardRef");case O:var c=e.displayName||null;return c!==null?c:x(e.type)||"Memo";case j:{var p=e,g=p._payload,v=p._init;try{return x(v(g))}catch{return null}}}return null}var N=Object.assign,z=0,ge,me,he,Ee,ye,be,Re;function _e(){}_e.__reactDisabledLog=!0;function ur(){{if(z===0){ge=console.log,me=console.info,he=console.warn,Ee=console.error,ye=console.group,be=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function sr(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:ge}),info:N({},e,{value:me}),warn:N({},e,{value:he}),error:N({},e,{value:Ee}),group:N({},e,{value:ye}),groupCollapsed:N({},e,{value:be}),groupEnd:N({},e,{value:Re})})}z<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=k.ReactCurrentDispatcher,te;function J(e,r,a){{if(te===void 0)try{throw Error()}catch(p){var c=p.stack.trim().match(/\n( *(at )?)/);te=c&&c[1]||""}return`
|
|
10
|
+
`+te+e}}var ne=!1,X;{var cr=typeof WeakMap=="function"?WeakMap:Map;X=new cr}function Ce(e,r){if(!e||ne)return"";{var a=X.get(e);if(a!==void 0)return a}var c;ne=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var g;g=re.current,re.current=null,ur();try{if(r){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(D){c=D}Reflect.construct(e,[],v)}else{try{v.call()}catch(D){c=D}e.call(v.prototype)}}else{try{throw Error()}catch(D){c=D}e()}}catch(D){if(D&&c&&typeof D.stack=="string"){for(var d=D.stack.split(`
|
|
11
|
+
`),T=c.stack.split(`
|
|
12
|
+
`),R=d.length-1,_=T.length-1;R>=1&&_>=0&&d[R]!==T[_];)_--;for(;R>=1&&_>=0;R--,_--)if(d[R]!==T[_]){if(R!==1||_!==1)do if(R--,_--,_<0||d[R]!==T[_]){var P=`
|
|
13
|
+
`+d[R].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&X.set(e,P),P}while(R>=1&&_>=0);break}}}finally{ne=!1,re.current=g,sr(),Error.prepareStackTrace=p}var V=e?e.displayName||e.name:"",Le=V?J(V):"";return typeof e=="function"&&X.set(e,Le),Le}function lr(e,r,a){return Ce(e,!1)}function fr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,a){if(e==null)return"";if(typeof e=="function")return Ce(e,fr(e));if(typeof e=="string")return J(e);switch(e){case m:return J("Suspense");case y:return J("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return lr(e.render);case O:return H(e.type,r,a);case j:{var c=e,p=c._payload,g=c._init;try{return H(g(p),r,a)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,we={},Te=k.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(a)}else Te.setExtraStackFrame(null)}function dr(e,r,a,c,p){{var g=Function.call.bind(K);for(var v in e)if(g(e,v)){var d=void 0;try{if(typeof e[v]!="function"){var T=Error((c||"React class")+": "+a+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}d=e[v](r,v,c,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){d=R}d&&!(d instanceof Error)&&(Z(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).",c||"React class",a,v,typeof d),Z(null)),d instanceof Error&&!(d.message in we)&&(we[d.message]=!0,Z(p),C("Failed %s type: %s",a,d.message),Z(null))}}}var vr=Array.isArray;function ae(e){return vr(e)}function pr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function gr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function Se(e){if(gr(e))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",pr(e)),Oe(e)}var B=k.ReactCurrentOwner,mr={key:!0,ref:!0,__self:!0,__source:!0},je,Pe,oe;oe={};function hr(e){if(K.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Er(e){if(K.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function yr(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var a=x(B.current.type);oe[a]||(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',x(B.current.type),e.ref),oe[a]=!0)}}function br(e,r){{var a=function(){je||(je=!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))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function Rr(e,r){{var a=function(){Pe||(Pe=!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))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var _r=function(e,r,a,c,p,g,v){var d={$$typeof:u,type:e,key:r,ref:a,props:v,_owner:g};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function Cr(e,r,a,c,p){{var g,v={},d=null,T=null;a!==void 0&&(Se(a),d=""+a),Er(r)&&(Se(r.key),d=""+r.key),hr(r)&&(T=r.ref,yr(r,p));for(g in r)K.call(r,g)&&!mr.hasOwnProperty(g)&&(v[g]=r[g]);if(e&&e.defaultProps){var R=e.defaultProps;for(g in R)v[g]===void 0&&(v[g]=R[g])}if(d||T){var _=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&br(v,_),T&&Rr(v,_)}return _r(e,d,T,p,c,B.current,v)}}var ie=k.ReactCurrentOwner,Ae=k.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(a)}else Ae.setExtraStackFrame(null)}var ue;ue=!1;function se(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function ke(){{if(ie.current){var e=x(ie.current.type);if(e)return`
|
|
14
14
|
|
|
15
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
15
|
+
Check the render method of \``+e+"`."}return""}}function wr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return`
|
|
16
16
|
|
|
17
|
-
Check your code at `+r+":"+
|
|
17
|
+
Check your code at `+r+":"+a+"."}return""}}var xe={};function Tr(e){{var r=ke();if(!r){var a=typeof e=="string"?e:e.displayName||e.name;a&&(r=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+
|
|
19
|
+
Check the top-level render call using <`+a+">.")}return r}}function De(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Tr(r);if(xe[a])return;xe[a]=!0;var c="";e&&e._owner&&e._owner!==ie.current&&(c=" It was passed a child from "+x(e._owner.type)+"."),W(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.',a,c),W(null)}}function Fe(e,r){{if(typeof e!="object")return;if(ae(e))for(var a=0;a<e.length;a++){var c=e[a];se(c)&&De(c,r)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var p=L(e);if(typeof p=="function"&&p!==e.entries)for(var g=p.call(e),v;!(v=g.next()).done;)se(v.value)&&De(v.value,r)}}}function Or(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===O))a=r.propTypes;else return;if(a){var c=x(r);dr(a,e.props,"prop",c,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var p=x(r);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Sr(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var c=r[a];if(c!=="children"&&c!=="key"){W(e),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),W(null);break}}e.ref!==null&&(W(e),C("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}function Ie(e,r,a,c,p,g){{var v=or(e);if(!v){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var T=wr(p);T?d+=T:d+=ke();var R;e===null?R="null":ae(e)?R="array":e!==void 0&&e.$$typeof===u?(R="<"+(x(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):R=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",R,d)}var _=Cr(e,r,a,p,g);if(_==null)return _;if(v){var P=r.children;if(P!==void 0)if(c)if(ae(P)){for(var V=0;V<P.length;V++)Fe(P[V],e);Object.freeze&&Object.freeze(P)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(P,e)}return e===o?Sr(_):Or(_),_}}function jr(e,r,a){return Ie(e,r,a,!0)}function Pr(e,r,a){return Ie(e,r,a,!1)}var Ar=Pr,kr=jr;Y.Fragment=o,Y.jsx=Ar,Y.jsxs=kr}()),Y}var U={};/**
|
|
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 <`+n+">.")}return r}}function Ie(e,r){{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
|
|
27
|
+
*/var le;function Me(){if(le)return U;le=1;var t=h,u=Symbol.for("react.element"),i=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function E(n,l,m){var y,O={},j=null,S=null;m!==void 0&&(j=""+m),l.key!==void 0&&(j=""+l.key),l.ref!==void 0&&(S=l.ref);for(y in l)o.call(l,y)&&!f.hasOwnProperty(y)&&(O[y]=l[y]);if(n&&n.defaultProps)for(y in l=n.defaultProps,l)O[y]===void 0&&(O[y]=l[y]);return{$$typeof:u,type:n,key:j,ref:S,props:O,_owner:s.current}}return U.Fragment=i,U.jsx=E,U.jsxs=E,U}process.env.NODE_ENV==="production"?q.exports=Me():q.exports=Ne();var A=q.exports;const M=h.createContext({apiURL:void 0,axios:void 0,children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),We=({axios:t,children:u,translate:i,useAuth:o,Outlet:s,Navigate:f,useLocation:E,useGoogleTagManager:n,apiURL:l})=>{const m=h.useMemo(()=>({apiURL:l,axios:t,Navigate:f,Outlet:s,translate:i,useAuth:o,useGoogleTagManager:n,useLocation:E}),[f,s,l,t,i,o,n,E]);return A.jsx(M.Provider,{value:m,children:u})},G=t=>`RequireAuth require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ve=({Fallback:t,loginPath:u="/login",localStorageKey:i="user",redirect401Path:o="/login",...s})=>{var I,L,k,C;const{axios:f=s.axios,useLocation:E=s.useLocation,useAuth:n=s.useAuth,Outlet:l=s.Outlet,Navigate:m=s.Navigate}=h.useContext(M);if(n===void 0)throw new Error(G("useAuth"));if(E===void 0)throw new Error(G("useLocation"));if(l===void 0)throw new Error(G("Outlet"));if(m===void 0)throw new Error(G("Navigate"));const[y,O]=h.useState(null),{isLogged:j}=n(),S=E(),F=h.useRef(!1);return h.useLayoutEffect(()=>{F.current||(F.current=!0,f==null||f.interceptors.response.use(w=>w,async w=>{var $;return typeof w=="object"&&w&&"response"in w&&w.response&&typeof w.response=="object"&&"status"in w.response&&w.response&&typeof w.response=="object"&&"status"in w.response&&(($=w==null?void 0:w.response)==null?void 0:$.status)===401&&(f.defaults.headers.common.Authorization=null,localStorage.removeItem(i),O(o)),Promise.reject(w)}))},[f==null?void 0:f.defaults.headers.common,f==null?void 0:f.interceptors.response,i,o]),j&&!y?A.jsx(h.Suspense,{fallback:t,children:(L=(I=S.state)==null?void 0:I.from)!=null&&L.state&&((C=(k=S.state)==null?void 0:k.from)==null?void 0:C.pathname)===u?A.jsx(m,{to:S.state.from.state.from.pathname+S.state.from.state.from.search,replace:!0}):A.jsx(l,{})}):A.jsx(m,{to:u,state:{from:S},replace:!0})},Q=t=>`GTMSendPageView require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ye=({...t})=>{const{useLocation:u=t.useLocation,Outlet:i=t.Outlet,useGoogleTagManager:o=t.useGoogleTagManager}=h.useContext(M);if(u===void 0)throw new Error(Q("useLocation"));if(i===void 0)throw new Error(Q("Outlet"));if(o===void 0)throw new Error(Q("useGoogleTagManager"));const{pathname:s}=u(),{sendEvent:f}=o();return h.useEffect(()=>{f({event:"pageView",pathname:s})},[s,f]),A.jsx(i,{})},Ue=({axios:t,baseURL:u,tokenTypeKey:i="tokenType",userLocalStorageKey:o="user",tokenKey:s="accessToken",postContentType:f="application/json"})=>{if(!t.defaults)return null;const E=localStorage.getItem(o),n=E?JSON.parse(E):null,l=n!=null&&n[i]?n[i]:null,m=n!=null&&n[s]?n[s]:null,y=E?`${l} ${m}`:null;return t.defaults.baseURL=u,t.defaults.headers.post["Content-Type"]=f,y&&(t.defaults.headers.common.Authorization=y),null},ze=({i18n:t,debug:u,initReactI18next:i,resources:o,LanguageDetector:s})=>(t!=null&&t.isInitialized||(t.use(s).use(i).init({debug:u,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:o,returnNull:!1}).then(()=>{document.documentElement.lang!==t.resolvedLanguage&&t.resolvedLanguage&&document.documentElement.setAttribute("lang",t.resolvedLanguage)}),t.on("languageChanged",f=>{document.documentElement.setAttribute("lang",f)})),null),Be=({dsn:t,sentry:u,integrations:i,tracesSampleRate:o,routingInstrumentationDependencies:s,replaysSessionSampleRate:f,replaysOnErrorSampleRate:E,tracePropagationTargets:n,ignoreErrors:l,debug:m})=>(u.isInitialized()||(m||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&u.init({debug:m,dsn:t,ignoreErrors:l||[/Failed to fetch dynamically imported module/],integrations:[new u.BrowserTracing({routingInstrumentation:u.reactRouterV6Instrumentation(s.useEffect,s.useLocation,s.useNavigationType,s.createRoutesFromChildren,s.matchRoutes)}),u.replayIntegration(),...i||[]],replaysOnErrorSampleRate:E||1,replaysSessionSampleRate:f||.1,tracePropagationTargets:n,tracesSampleRate:o||1}),null),Ge=({IMaskMixin:t,...u})=>{const i=h.useMemo(()=>t(({TextField:o,...s})=>A.jsx(o,{...s})),[t]);return A.jsx(i,{...u})},$e=({mapbox:t,accessToken:u})=>(t&&u&&(t.accessToken=u),null),Je=({children:t,defaultOptions:u,QueryClient:i,QueryClientProvider:o})=>{const s=new i({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,...u}}});return A.jsx(o,{client:s,children:t})},Xe=t=>{const{unknownErrorTranslationKey:u="error.unknownError"}=t||{},{translate:i=t==null?void 0:t.translate}=h.useContext(M),o=i?i(u):"Unknown error",s=h.useCallback(E=>{var l,m,y,O,j,S,F,I,L;const{response:n}=E||{};return n!=null&&n.reason?String(n.reason):(l=n==null?void 0:n.data)!=null&&l.reason?String(n.data.reason):(m=n==null?void 0:n.data)!=null&&m.message?String(n.data.message):(O=(y=n==null?void 0:n.data)==null?void 0:y.detail)!=null&&O.length&&Array.isArray((j=n==null?void 0:n.data)==null?void 0:j.detail)&&((F=(S=n==null?void 0:n.data)==null?void 0:S.detail[0])!=null&&F.msg)&&typeof((L=(I=n==null?void 0:n.data)==null?void 0:I.detail[0])==null?void 0:L.msg)=="string"?String(n.data.detail[0].msg):o},[o]),f=h.useCallback(E=>{var l,m,y;const{response:n}=E||{};return i&&(n!=null&&n.error_code)?i(n==null?void 0:n.error_code):i&&((l=n==null?void 0:n.data)!=null&&l.error_code)?i((m=n==null?void 0:n.data)==null?void 0:m.error_code):n!=null&&n.error_code?String(n==null?void 0:n.error_code):(y=n==null?void 0:n.data)!=null&&y.error_code?String(n.data.error_code):o},[o,i]);return{printError:s,printErrorCode:f}},He=({data:t,fetchNextPage:u,isFetchingNextPage:i,isInitialLoading:o,isLoading:s,enabled:f=!0})=>{const E=h.useCallback(async l=>{i||!f||await u({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[f,u,i]),n=h.useMemo(()=>{if(t)return t.pages.reduce((l,m)=>[...l,...m],[])},[t]);return{fetchNextPageOnRowsScrollEnd:E,isLoading:i||s,loadingVariant:o?"skeleton":"linear",rows:n}},Ke=t=>{const u=h.useCallback(({tokenType:o,accessToken:s})=>{t.defaults.headers.common.Authorization=`${o} ${s}`},[t.defaults.headers.common]);return{clearAuthenticationToken:h.useCallback(()=>{t.defaults.headers.common.Authorization=null},[t.defaults.headers.common]),setAuthenticationToken:u}},ee=(t,u)=>{if(!t)return"";const i=typeof t=="object"&&"pathname"in t?`${t.origin}${t.pathname}`:t,o=i.startsWith("/")?i:`/${i}`;return typeof u=="number"?`${t}${o.replace("/files",`/thumbs/${u}`)}`:`${t}${o}`},Ze=()=>{const{apiURL:t}=h.useContext(M);return{distanceAdapter:(o,s="km")=>{const f=Number(o);return Number.isNaN(f)?`0 ${s}`:`${f.toFixed(2)} ${s}`},filePathAdapter:(o,s)=>ee(t&&typeof o=="string"?{origin:t,pathname:o}:o,s)}},qe=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Qe=t=>{const o=t.split("/").filter(s=>s.length>0).map(s=>s.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return o.charAt(0).toLowerCase()+o.slice(1)},er=(t,u,i)=>{const o=Qe(u),s=qe(i);return`${o}${s}`},rr=t=>{if(t)return(t==null?void 0:t.reduce((u,i)=>(u[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset"}},u),{}))||{}},tr=t=>{const{input:u="./openapi.json",operationsToGenerateInfiniteQueryHook:i=void 0}=t||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:u,output:{client:"react-query",mode:"tags-split",override:{header:o=>["Generated by orval 🍺",...o.title?[o.title]:[],...o.description?[o.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:er,...(i==null?void 0:i.length)&&{operations:rr(i)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}};b.AxiosConfig=Ue,b.GTMSendPageView=Ye,b.I18nConfig=ze,b.InjectDependenciesContext=M,b.InjectDependenciesProvider=We,b.MapBoxConfig=$e,b.MaskTextField=Ge,b.QueryClientConfigProvider=Je,b.RequireAuth=Ve,b.SentryConfig=Be,b.filePathAdapter=ee,b.getOrvalConfig=tr,b.useAdapter=Ze,b.useAuth=Ke,b.useInfiniteDataGrid=He,b.useResponseError=Xe,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapt file path from server to display file on client
|
|
3
|
+
* @param href
|
|
4
|
+
* @param size - full or number for thumbs
|
|
5
|
+
*/
|
|
6
|
+
declare const filePathAdapter: (href?: string | null | {
|
|
7
|
+
pathname: string;
|
|
8
|
+
origin: string;
|
|
9
|
+
}, size?: number | "full") => string;
|
|
10
|
+
export default filePathAdapter;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracktor/shared-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
-
"types": "./dist/
|
|
6
|
+
"types": "./dist/main.d.ts",
|
|
7
7
|
"main": "./dist/main.umd.cjs",
|
|
8
8
|
"module": "./dist/main.js",
|
|
9
9
|
"engines": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"import": "./dist/main.js",
|
|
18
18
|
"require": "./dist/main.umd.cjs",
|
|
19
|
-
"types": "./dist/
|
|
19
|
+
"types": "./dist/main.d.ts"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|