@tracktor/shared-module 2.15.10 → 2.15.12
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/axios/index.d.ts +1 -0
- package/dist/axios.cjs +1 -0
- package/dist/axios.js +4 -0
- package/dist/axiosCustomInstance-D3EHo-4p.cjs +1 -0
- package/dist/axiosCustomInstance-DCYX8iR2.js +14 -0
- package/dist/main.cjs +22 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +152 -162
- package/package.json +6 -4
- package/dist/main.umd.cjs +0 -22
- /package/dist/{axiosCustomInstance.d.ts → axios/axiosCustomInstance.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { axiosCustomInstance, type ErrorType, type BodyType } from './axiosCustomInstance';
|
package/dist/axios.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./axiosCustomInstance-D3EHo-4p.cjs");exports.axiosCustomInstance=t.axiosCustomInstance;
|
package/dist/axios.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("axios"),a=(s,o)=>{const e=n.CancelToken.source(),c=n({...s,...o,cancelToken:e.token}).then(({data:t})=>t);return c.cancel=()=>{e.cancel("Query was cancelled")},c};exports.axiosCustomInstance=a;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import n from "axios";
|
|
2
|
+
const r = (o, s) => {
|
|
3
|
+
const e = n.CancelToken.source(), c = n({
|
|
4
|
+
...o,
|
|
5
|
+
...s,
|
|
6
|
+
cancelToken: e.token
|
|
7
|
+
}).then(({ data: a }) => a);
|
|
8
|
+
return c.cancel = () => {
|
|
9
|
+
e.cancel("Query was cancelled");
|
|
10
|
+
}, c;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
r as a
|
|
14
|
+
};
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";var de=Object.create;var B=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ye=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of pe(r))!me.call(e,n)&&n!==o&&B(e,n,{get:()=>r[n],enumerable:!(a=fe(r,n))||a.enumerable});return e};var X=(e,r,o)=>(o=e!=null?de(ge(e)):{},ye(r||!e||!e.__esModule?B(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("./axiosCustomInstance-D3EHo-4p.cjs"),g=require("react");var N={exports:{}},I={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var H;function ve(){if(H)return I;H=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(a,n,s){var c=null;if(s!==void 0&&(c=""+s),n.key!==void 0&&(c=""+n.key),"key"in n){s={};for(var u in n)u!=="key"&&(s[u]=n[u])}else s=n;return n=s.ref,{$$typeof:e,type:a,key:c,ref:n!==void 0?n:null,props:s}}return I.Fragment=r,I.jsx=o,I.jsxs=o,I}var k={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Z;function Ee(){return Z||(Z=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ce?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case p:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case M:return"Suspense";case ae:return"SuspenseList";case ie:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case R:return"Portal";case E:return(t.displayName||"Context")+".Provider";case T:return(t._context.displayName||"Context")+".Consumer";case U:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case se:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case W:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function r(t){return""+t}function o(t){try{r(t);var f=!1}catch{f=!0}if(f){f=console;var h=f.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return h.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",w),r(t)}}function a(t){if(t===p)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===W)return"<...>";try{var f=e(t);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function n(){var t=F.A;return t===null?null:t.getOwner()}function s(){return Error("react-stack-top-frame")}function c(t){if(Q.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function u(t,f){function h(){V||(V=!0,console.error("%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://react.dev/link/special-props)",f))}h.isReactWarning=!0,Object.defineProperty(t,"key",{get:h,configurable:!0})}function l(){var t=e(this.type);return G[t]||(G[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function d(t,f,h,w,P,j,$,Y){return h=j.ref,t={$$typeof:y,type:t,key:f,props:j,_owner:P},(h!==void 0?h:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:l}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function i(t,f,h,w,P,j,$,Y){var b=f.children;if(b!==void 0)if(w)if(ue(b)){for(w=0;w<b.length;w++)v(b[w]);Object.freeze&&Object.freeze(b)}else console.error("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 v(b);if(Q.call(f,"key")){b=e(t);var x=Object.keys(f).filter(function(le){return le!=="key"});w=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",K[b+w]||(x=0<x.length?"{"+x.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,w,b,x,b),K[b+w]=!0)}if(b=null,h!==void 0&&(o(h),b=""+h),c(f)&&(o(f.key),b=""+f.key),"key"in f){h={};for(var z in f)z!=="key"&&(h[z]=f[z])}else h=f;return b&&u(h,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,b,j,P,n(),h,$,Y)}function v(t){typeof t=="object"&&t!==null&&t.$$typeof===y&&t._store&&(t._store.validated=1)}var m=g,y=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),E=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,ue=Array.isArray,D=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(t){return t()}};var V,G={},J=m["react-stack-bottom-frame"].bind(m,s)(),q=D(a(s)),K={};k.Fragment=p,k.jsx=function(t,f,h,w,P){var j=1e4>F.recentlyCreatedOwnerStacks++;return i(t,f,h,!1,w,P,j?Error("react-stack-top-frame"):J,j?D(a(t)):q)},k.jsxs=function(t,f,h,w,P){var j=1e4>F.recentlyCreatedOwnerStacks++;return i(t,f,h,!0,w,P,j?Error("react-stack-top-frame"):J,j?D(a(t)):q)}}()),k}var ee;function we(){return ee||(ee=1,process.env.NODE_ENV==="production"?N.exports=ve():N.exports=Ee()),N.exports}var _=we();const C=g.createContext({}),be=({children:e,apiURL:r,libraries:o,localStorageKeys:a})=>{const n=g.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:a}),[r,o,a]);return _.jsx(C.Provider,{value:n,children:e})},Re="user",Se=({Fallback:e,isLogged:r,loginPath:o="/login",redirect401Path:a="/login",...n})=>{const{libraries:s,localStorageKeys:c}=g.useContext(C),u=n?.reactRouter||s?.reactRouter,l=n?.axios||s?.axios,d=n?.localStorageKey||c?.user||Re;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,v]=g.useState(null),{useLocation:m,Navigate:y,Outlet:R}=u,p=m(),S=g.useRef(!1),A=typeof r=="function"?r():!!r,T=typeof A=="boolean"?A:A?.isLogged;return g.useEffect(()=>{S.current||(S.current=!0,l.interceptors.response.use(E=>E,async E=>(typeof E=="object"&&E&&"response"in E&&E.response&&typeof E.response=="object"&&"status"in E.response&&E.response&&typeof E.response=="object"&&"status"in E.response&&E?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),v(a)),Promise.reject(E))))},[l.defaults.headers.common,l.interceptors.response,d,a]),T&&!i?_.jsx(g.Suspense,{fallback:e,children:p.state?.from?.state&&p.state?.from?.pathname===o?_.jsx(y,{to:p.state.from.state.from.pathname+p.state.from.state.from.search,replace:!0}):_.jsx(R,{})}):_.jsx(y,{to:o+p.search,state:{from:p},replace:!0})},Ae=({data:e,...r})=>{const{libraries:o}=g.useContext(C),a=r?.reactRouter||o?.reactRouter,n=r?.gtm||o?.gtm;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!n)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:s}=n,{useLocation:c,Outlet:u}=a,{pathname:l}=c(),{sendEvent:d}=s();return g.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),_.jsx(u,{})},O=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),Ce="user",je=({tokenTypeKey:e="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:n=a.apiURL,libraries:s,localStorageKeys:c}=g.useContext(C),u=a?.userLocalStorageKey||c?.user||Ce,l=a?.axios||s?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||O)return null;if(typeof window<"u"&&window.localStorage){const d=localStorage.getItem(u),i=d?JSON.parse(d):null,v=i?.[e]?i[e]:null,m=i?.[r]?i[r]:null,y=d?`${v} ${m}`:null;y&&(l.defaults.headers.common.Authorization=y)}return l.defaults.baseURL=n,l.defaults.headers.post["Content-Type"]=o,null},_e=({debug:e,resources:r,...o})=>{const{libraries:a}=g.useContext(C),n=o?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:u}=n||{};if(O)return null;if(!n)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return s?.isInitialized||(s.use(u).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==s.resolvedLanguage&&s.resolvedLanguage&&document.documentElement.setAttribute("lang",s.resolvedLanguage)}),s.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},Pe=({dsn:e,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:n,tracePropagationTargets:s,ignoreErrors:c,debug:u,environment:l,release:d,...i})=>{const{libraries:v}=g.useContext(C),m=i?.sentry||v?.sentry,y=i?.reactRouter||v?.reactRouter;if(!m)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!y)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(m.isInitialized())return null;const{createRoutesFromChildren:R,matchRoutes:p,useLocation:S,useNavigationType:A}=y;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&m.init({debug:u,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[m.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:R,matchRoutes:p,useEffect:g.useEffect,useLocation:S,useNavigationType:A}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:o||1}),null},Te=({IMaskMixin:e,...r})=>{const o=g.useMemo(()=>e(({TextField:a,...n})=>_.jsx(a,{...n})),[e]);return _.jsx(o,{...r})},xe=({language:e,...r})=>{const{libraries:o}=g.useContext(C),a=r?.dayjs||o?.dayjs,n=r?.plugin||o?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return g.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";n&&n.forEach(u=>{u&&a.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,n,e]),null},Ie=()=>(g.useEffect(()=>{if(O)return;const e=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),ke=e=>e&&typeof e=="function",Oe=e=>e&&typeof e=="function",Ne=({children:e,defaultQueriesOptions:r,defaultMutationsOptions:o,...a})=>{const{libraries:n}=g.useContext(C),s=a?.QueryClient||n?.reactQuery?.QueryClient,c=a?.QueryClientProvider||n?.reactQuery?.QueryClientProvider;if(!s)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!ke(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Oe(s))throw new Error("Provided QueryClient dependencies are not valid.");const u=new s({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,d,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...r}}});return _.jsx(c,{client:u,children:e})},Le=e=>{const{libraries:r}=g.useContext(C),o=e?.i18||r?.i18,a=e?.i18?.translateFunction||r?.i18?.translateFunction,n=o?.i18next?.t||a||(d=>d),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=n(s),u=g.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:i}=d||{};if(i&&typeof i=="object"&&"reason"in i)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:v}=i.data;if(Array.isArray(v)&&v.length>0&&typeof v[0]=="object"&&v[0]!==null&&"msg"in v[0]){const{msg:m}=v[0];if(typeof m=="string")return String(m)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:g.useCallback(d=>{const{response:i}=d||{};return i?.error_code?String(i?.error_code):i?.data?.error_code?String(i?.data?.error_code):i?.error_code?String(i?.error_code):i?.data?.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:u}},Fe=({data:e,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:a,isLoading:n,enabled:s=!0})=>{const c=g.useCallback(async l=>{o||!s||await r({pageParam:l?.pageParam||l.visibleRowsCount})},[s,r,o]),u=g.useMemo(()=>{if(e)return e.pages.reduce((l,d)=>[...l,...d],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||n,loadingVariant:a?"skeleton":"linear-progress",rows:u}},De=e=>{const{libraries:r}=g.useContext(C),o=e?.axios||r?.axios,a=e?.localStorageKey||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const n=g.useCallback(({tokenType:c,accessToken:u})=>{o.defaults.headers.common.Authorization=`${c} ${u}`},[o.defaults.headers.common]),s=()=>{o.defaults.headers.common.Authorization=null};return g.useEffect(()=>{if(O)return;const c=({newValue:u,key:l})=>{if(l===a&&u)try{const{accessToken:d,tokenType:i}=JSON.parse(u);n({accessToken:d,tokenType:i})}catch(d){console.error("Failed to parse newValue from localStorage:",d)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,n]),{clearAuthenticationToken:s,setAuthenticationToken:n}},re=({library:e,date:r,format:o="ll"})=>e(r).format(o),ne=(e,r)=>{const{fractionDigits:o=0,metric:a="km"}=r||{},n=Number(e);return Number.isNaN(n)?`0${a}`:`${n.toFixed(o)}${a}`},oe=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),$e=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Ye=({path:e,size:r,apiURL:o})=>{if(!e)return"";const a=$e(e),n=`${o}${a}`,s=n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&s?`${n.replace("/files",`/thumbs/${r}`)}`:n},ze=e=>{const{apiURL:r,libraries:o}=g.useContext(C),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,u)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return re({date:c,format:u,library:a})},distanceAdapter:ne,filePathAdapter:(c,u)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Ye({apiURL:r,path:c,size:u})},worksiteNameAdapter:oe}},L=(e,r)=>r==="short"?e.split("-")[0]:e,Ue=(e,r="full")=>{const[o,a]=g.useState(()=>{const n=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,L(n,r)});return g.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(L(e.language,r));const n=s=>{a(L(s,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},Me="tracktor.filter",We={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},te=(e,r,o)=>`${o}_${e}=>${r}`,Qe=e=>{const{libraries:r,localStorageKeys:o}=g.useContext(C),a=e?.reactRouter||r?.reactRouter,{pathname:n}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],u=o?.filter||Me;if(O)return We;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const l=(m,y,R=!0)=>{const p=te(m,e?.pathname||n,u);if(!y||Array.isArray(y)&&!y.length){s.delete(m),c(s),localStorage.removeItem(p);return}R&&y&&localStorage.setItem(p,JSON.stringify({...s,[m]:y})),y&&(s.set(m,JSON.stringify(y)),c(s))};return{getFilter:(m,y)=>{const R=s.get(m);if(R)try{return JSON.parse(R)}catch{return R}const p=te(m,e?.pathname||n,u),S=localStorage.getItem(p);if(S)try{return JSON.parse(S)[m]}catch{}return y},getFilters:()=>{const m=Object.fromEntries(s.entries()),R=Object.keys(localStorage).filter(p=>p.startsWith(u)&&p.endsWith(e?.pathname||n)).reduce((p,S)=>{const A=localStorage.getItem(S);if(A){const T=JSON.parse(A),E=Object.keys(T)?.[0];p[E]=Object.values(T)?.[0]}return p},{});return{...m,...R}},handleFilter:(m,y)=>(R,p)=>{if(p||Array.isArray(p)&&p.length===0){const S=y||"value",A=typeof p=="object"&&S in p?p[S]:p;l(m,A);return}l(m,void 0)},setFilter:l}},Ve=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Ge=e=>{const a=e.split("/").filter(n=>n.length>0).map(n=>n.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},Je=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),qe=(e,r,o,a)=>{const n=Ge(r),s=Ve(o),c=`${n}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Ke=(e,r)=>{const o={};return e?.forEach(a=>{o[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),r?.filter(a=>!o[a]).forEach(a=>{o[a]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Be=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:n,useInfiniteIds:s,useQueryIds:c,input:u="./openapi.json"}=a||{},l=Je(u);return{...o,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:u,output:{baseUrl:n?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:Ke(s,c)},header:d=>["Generated by orval 🍺",...d.title?[d.title]:[],...d.description?[d.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(d,i,v)=>qe(d,i,v,c),query:{useQuery:!0}},schemas:n?.schemas||`src/api/${l}/model`,target:n?.target||`src/api/${l}/services/api.ts`,...n}}}},{});exports.axiosCustomInstance=he.axiosCustomInstance;exports.GTMSendPageView=Ae;exports.InitializeAxiosConfig=je;exports.InitializeDaysJSConfig=xe;exports.InitializeI18nConfig=_e;exports.InitializeSentryConfig=Pe;exports.InjectDependenciesContext=C;exports.InjectDependenciesProvider=be;exports.MaskTextField=Te;exports.PreloadErrorHandler=Ie;exports.QueryClientProviderWithConfig=Ne;exports.RequireAuth=Se;exports.dateAdapter=re;exports.distanceAdapter=ne;exports.getOrvalConfig=Be;exports.useAdapter=ze;exports.useAuth=De;exports.useCurrentLanguage=Ue;exports.useFilters=Qe;exports.useInfiniteDataGrid=Fe;exports.useResponseError=Le;exports.worksiteNameAdapter=oe;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { axiosCustomInstance, type ErrorType, type BodyType } from './axiosCustomInstance';
|
|
1
|
+
export { axiosCustomInstance, type ErrorType, type BodyType } from './axios/axiosCustomInstance';
|
|
2
2
|
export { default as RequireAuth } from './components/Utils/RequireAuth';
|
|
3
3
|
export * from './components/Utils/RequireAuth';
|
|
4
4
|
export { default as GTMSendPageView } from './components/Utils/GTMSendPageView';
|
package/dist/main.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const n = Z.CancelToken.source(), a = Z({
|
|
5
|
-
...e,
|
|
6
|
-
...o,
|
|
7
|
-
cancelToken: n.token
|
|
8
|
-
}).then(({ data: r }) => r);
|
|
9
|
-
return a.cancel = () => {
|
|
10
|
-
n.cancel("Query was cancelled");
|
|
11
|
-
}, a;
|
|
12
|
-
};
|
|
13
|
-
var L = { exports: {} }, x = {};
|
|
1
|
+
import { a as Ze } from "./axiosCustomInstance-DCYX8iR2.js";
|
|
2
|
+
import le, { createContext as de, useMemo as Q, useContext as j, useState as ne, useRef as fe, useEffect as C, Suspense as pe, useCallback as $ } from "react";
|
|
3
|
+
var L = { exports: {} }, k = {};
|
|
14
4
|
/**
|
|
15
5
|
* @license React
|
|
16
6
|
* react-jsx-runtime.production.js
|
|
@@ -20,12 +10,12 @@ var L = { exports: {} }, x = {};
|
|
|
20
10
|
* This source code is licensed under the MIT license found in the
|
|
21
11
|
* LICENSE file in the root directory of this source tree.
|
|
22
12
|
*/
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
var e = Symbol.for("react.transitional.element"),
|
|
28
|
-
function
|
|
13
|
+
var Z;
|
|
14
|
+
function ge() {
|
|
15
|
+
if (Z) return k;
|
|
16
|
+
Z = 1;
|
|
17
|
+
var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
18
|
+
function o(a, r, s) {
|
|
29
19
|
var c = null;
|
|
30
20
|
if (s !== void 0 && (c = "" + s), r.key !== void 0 && (c = "" + r.key), "key" in r) {
|
|
31
21
|
s = {};
|
|
@@ -40,7 +30,7 @@ function me() {
|
|
|
40
30
|
props: s
|
|
41
31
|
};
|
|
42
32
|
}
|
|
43
|
-
return
|
|
33
|
+
return k.Fragment = n, k.jsx = o, k.jsxs = o, k;
|
|
44
34
|
}
|
|
45
35
|
var I = {};
|
|
46
36
|
/**
|
|
@@ -52,13 +42,13 @@ var I = {};
|
|
|
52
42
|
* This source code is licensed under the MIT license found in the
|
|
53
43
|
* LICENSE file in the root directory of this source tree.
|
|
54
44
|
*/
|
|
55
|
-
var
|
|
56
|
-
function
|
|
57
|
-
return
|
|
45
|
+
var ee;
|
|
46
|
+
function me() {
|
|
47
|
+
return ee || (ee = 1, process.env.NODE_ENV !== "production" && function() {
|
|
58
48
|
function e(t) {
|
|
59
49
|
if (t == null) return null;
|
|
60
50
|
if (typeof t == "function")
|
|
61
|
-
return t.$$typeof ===
|
|
51
|
+
return t.$$typeof === ie ? null : t.displayName || t.name || null;
|
|
62
52
|
if (typeof t == "string") return t;
|
|
63
53
|
switch (t) {
|
|
64
54
|
case p:
|
|
@@ -69,9 +59,9 @@ function ye() {
|
|
|
69
59
|
return "StrictMode";
|
|
70
60
|
case M:
|
|
71
61
|
return "Suspense";
|
|
72
|
-
case
|
|
62
|
+
case oe:
|
|
73
63
|
return "SuspenseList";
|
|
74
|
-
case
|
|
64
|
+
case se:
|
|
75
65
|
return "Activity";
|
|
76
66
|
}
|
|
77
67
|
if (typeof t == "object")
|
|
@@ -82,12 +72,12 @@ function ye() {
|
|
|
82
72
|
return "Portal";
|
|
83
73
|
case v:
|
|
84
74
|
return (t.displayName || "Context") + ".Provider";
|
|
85
|
-
case
|
|
75
|
+
case O:
|
|
86
76
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
87
77
|
case V:
|
|
88
78
|
var f = t.render;
|
|
89
79
|
return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
90
|
-
case
|
|
80
|
+
case ae:
|
|
91
81
|
return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
|
|
92
82
|
case G:
|
|
93
83
|
f = t._payload, t = t._init;
|
|
@@ -98,12 +88,12 @@ function ye() {
|
|
|
98
88
|
}
|
|
99
89
|
return null;
|
|
100
90
|
}
|
|
101
|
-
function
|
|
91
|
+
function n(t) {
|
|
102
92
|
return "" + t;
|
|
103
93
|
}
|
|
104
|
-
function
|
|
94
|
+
function o(t) {
|
|
105
95
|
try {
|
|
106
|
-
|
|
96
|
+
n(t);
|
|
107
97
|
var f = !1;
|
|
108
98
|
} catch {
|
|
109
99
|
f = !0;
|
|
@@ -115,7 +105,7 @@ function ye() {
|
|
|
115
105
|
f,
|
|
116
106
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
117
107
|
E
|
|
118
|
-
),
|
|
108
|
+
), n(t);
|
|
119
109
|
}
|
|
120
110
|
}
|
|
121
111
|
function a(t) {
|
|
@@ -197,7 +187,7 @@ function ye() {
|
|
|
197
187
|
var w = f.children;
|
|
198
188
|
if (w !== void 0)
|
|
199
189
|
if (E)
|
|
200
|
-
if (
|
|
190
|
+
if (ce(w)) {
|
|
201
191
|
for (E = 0; E < w.length; E++)
|
|
202
192
|
h(w[E]);
|
|
203
193
|
Object.freeze && Object.freeze(w);
|
|
@@ -208,10 +198,10 @@ function ye() {
|
|
|
208
198
|
else h(w);
|
|
209
199
|
if (J.call(f, "key")) {
|
|
210
200
|
w = e(t);
|
|
211
|
-
var
|
|
212
|
-
return
|
|
201
|
+
var x = Object.keys(f).filter(function(ue) {
|
|
202
|
+
return ue !== "key";
|
|
213
203
|
});
|
|
214
|
-
E = 0 <
|
|
204
|
+
E = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", H[w + E] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
215
205
|
`A props object containing a "key" prop is being spread into JSX:
|
|
216
206
|
let props = %s;
|
|
217
207
|
<%s {...props} />
|
|
@@ -220,14 +210,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
220
210
|
<%s key={someKey} {...props} />`,
|
|
221
211
|
E,
|
|
222
212
|
w,
|
|
223
|
-
|
|
213
|
+
x,
|
|
224
214
|
w
|
|
225
215
|
), H[w + E] = !0);
|
|
226
216
|
}
|
|
227
|
-
if (w = null, y !== void 0 && (
|
|
217
|
+
if (w = null, y !== void 0 && (o(y), w = "" + y), c(f) && (o(f.key), w = "" + f.key), "key" in f) {
|
|
228
218
|
y = {};
|
|
229
|
-
for (var
|
|
230
|
-
|
|
219
|
+
for (var W in f)
|
|
220
|
+
W !== "key" && (y[W] = f[W]);
|
|
231
221
|
} else y = f;
|
|
232
222
|
return w && u(
|
|
233
223
|
y,
|
|
@@ -246,7 +236,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
236
|
function h(t) {
|
|
247
237
|
typeof t == "object" && t !== null && t.$$typeof === m && t._store && (t._store.validated = 1);
|
|
248
238
|
}
|
|
249
|
-
var g =
|
|
239
|
+
var g = le, m = Symbol.for("react.transitional.element"), b = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), O = Symbol.for("react.consumer"), v = Symbol.for("react.context"), V = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), se = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), D = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ce = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
250
240
|
return null;
|
|
251
241
|
};
|
|
252
242
|
g = {
|
|
@@ -285,34 +275,34 @@ React keys must be passed directly to JSX without using spread:
|
|
|
285
275
|
};
|
|
286
276
|
}()), I;
|
|
287
277
|
}
|
|
288
|
-
var
|
|
289
|
-
function
|
|
290
|
-
return
|
|
278
|
+
var te;
|
|
279
|
+
function ye() {
|
|
280
|
+
return te || (te = 1, process.env.NODE_ENV === "production" ? L.exports = ge() : L.exports = me()), L.exports;
|
|
291
281
|
}
|
|
292
|
-
var P =
|
|
293
|
-
const A =
|
|
294
|
-
const r =
|
|
282
|
+
var P = ye();
|
|
283
|
+
const A = de({}), Ne = ({ children: e, apiURL: n, libraries: o, localStorageKeys: a }) => {
|
|
284
|
+
const r = Q(
|
|
295
285
|
() => ({
|
|
296
|
-
apiURL:
|
|
297
|
-
libraries:
|
|
286
|
+
apiURL: n,
|
|
287
|
+
libraries: o,
|
|
298
288
|
localStorageKeys: a
|
|
299
289
|
}),
|
|
300
|
-
[
|
|
290
|
+
[n, o, a]
|
|
301
291
|
);
|
|
302
292
|
return /* @__PURE__ */ P.jsx(A.Provider, { value: r, children: e });
|
|
303
|
-
},
|
|
304
|
-
const { libraries: s, localStorageKeys: c } = j(A), u = r?.reactRouter || s?.reactRouter, l = r?.axios || s?.axios, d = r?.localStorageKey || c?.user ||
|
|
293
|
+
}, he = "user", Le = ({ Fallback: e, isLogged: n, loginPath: o = "/login", redirect401Path: a = "/login", ...r }) => {
|
|
294
|
+
const { libraries: s, localStorageKeys: c } = j(A), u = r?.reactRouter || s?.reactRouter, l = r?.axios || s?.axios, d = r?.localStorageKey || c?.user || he;
|
|
305
295
|
if (!u)
|
|
306
296
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
307
|
-
const [i, h] =
|
|
297
|
+
const [i, h] = ne(null), { useLocation: g, Navigate: m, Outlet: b } = u, p = g(), R = fe(!1), S = typeof n == "function" ? n() : !!n, O = typeof S == "boolean" ? S : S?.isLogged;
|
|
308
298
|
return C(() => {
|
|
309
299
|
R.current || (R.current = !0, l.interceptors.response.use(
|
|
310
300
|
(v) => v,
|
|
311
301
|
async (v) => (typeof v == "object" && v && "response" in v && v.response && typeof v.response == "object" && "status" in v.response && v.response && typeof v.response == "object" && "status" in v.response && v?.response?.status === 401 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(d), h(a)), Promise.reject(v))
|
|
312
302
|
));
|
|
313
|
-
}, [l.defaults.headers.common, l.interceptors.response, d, a]),
|
|
314
|
-
},
|
|
315
|
-
const { libraries:
|
|
303
|
+
}, [l.defaults.headers.common, l.interceptors.response, d, a]), O && !i ? /* @__PURE__ */ P.jsx(pe, { fallback: e, children: p.state?.from?.state && p.state?.from?.pathname === o ? /* @__PURE__ */ P.jsx(m, { to: p.state.from.state.from.pathname + p.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ P.jsx(b, {}) }) : /* @__PURE__ */ P.jsx(m, { to: o + p.search, state: { from: p }, replace: !0 });
|
|
304
|
+
}, Fe = ({ data: e, ...n }) => {
|
|
305
|
+
const { libraries: o } = j(A), a = n?.reactRouter || o?.reactRouter, r = n?.gtm || o?.gtm;
|
|
316
306
|
if (!a)
|
|
317
307
|
throw new Error(
|
|
318
308
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
@@ -335,24 +325,24 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
335
325
|
} catch {
|
|
336
326
|
return !1;
|
|
337
327
|
}
|
|
338
|
-
})(),
|
|
328
|
+
})(), ve = "user", $e = ({
|
|
339
329
|
tokenTypeKey: e = "tokenType",
|
|
340
|
-
tokenKey:
|
|
341
|
-
postContentType:
|
|
330
|
+
tokenKey: n = "accessToken",
|
|
331
|
+
postContentType: o = "application/json",
|
|
342
332
|
...a
|
|
343
333
|
}) => {
|
|
344
|
-
const { apiURL: r = a.apiURL, libraries: s, localStorageKeys: c } = j(A), u = a?.userLocalStorageKey || c?.user ||
|
|
334
|
+
const { apiURL: r = a.apiURL, libraries: s, localStorageKeys: c } = j(A), u = a?.userLocalStorageKey || c?.user || ve, l = a?.axios || s?.axios;
|
|
345
335
|
if (!l)
|
|
346
336
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
347
337
|
if (!l?.defaults || N)
|
|
348
338
|
return null;
|
|
349
339
|
if (typeof window < "u" && window.localStorage) {
|
|
350
|
-
const d = localStorage.getItem(u), i = d ? JSON.parse(d) : null, h = i?.[e] ? i[e] : null, g = i?.[
|
|
340
|
+
const d = localStorage.getItem(u), i = d ? JSON.parse(d) : null, h = i?.[e] ? i[e] : null, g = i?.[n] ? i[n] : null, m = d ? `${h} ${g}` : null;
|
|
351
341
|
m && (l.defaults.headers.common.Authorization = m);
|
|
352
342
|
}
|
|
353
|
-
return l.defaults.baseURL = r, l.defaults.headers.post["Content-Type"] =
|
|
354
|
-
},
|
|
355
|
-
const { libraries: a } = j(A), r =
|
|
343
|
+
return l.defaults.baseURL = r, l.defaults.headers.post["Content-Type"] = o, null;
|
|
344
|
+
}, De = ({ debug: e, resources: n, ...o }) => {
|
|
345
|
+
const { libraries: a } = j(A), r = o?.i18 || a?.i18, { i18next: s, initReactI18next: c, languageDetector: u } = r || {};
|
|
356
346
|
if (N)
|
|
357
347
|
return null;
|
|
358
348
|
if (!r)
|
|
@@ -368,17 +358,17 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
368
358
|
bindI18n: "languageChanged loaded",
|
|
369
359
|
useSuspense: !0
|
|
370
360
|
},
|
|
371
|
-
resources:
|
|
361
|
+
resources: n,
|
|
372
362
|
returnNull: !1
|
|
373
363
|
}).then(() => {
|
|
374
364
|
document.documentElement.lang !== s.resolvedLanguage && s.resolvedLanguage && document.documentElement.setAttribute("lang", s.resolvedLanguage);
|
|
375
365
|
}), s.on("languageChanged", (l) => {
|
|
376
366
|
document.documentElement.setAttribute("lang", l);
|
|
377
367
|
})), null;
|
|
378
|
-
},
|
|
368
|
+
}, Ye = ({
|
|
379
369
|
dsn: e,
|
|
380
|
-
integrations:
|
|
381
|
-
tracesSampleRate:
|
|
370
|
+
integrations: n,
|
|
371
|
+
tracesSampleRate: o,
|
|
382
372
|
replaysSessionSampleRate: a,
|
|
383
373
|
replaysOnErrorSampleRate: r,
|
|
384
374
|
tracePropagationTargets: s,
|
|
@@ -417,23 +407,23 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
417
407
|
useLocation: R,
|
|
418
408
|
useNavigationType: S
|
|
419
409
|
}),
|
|
420
|
-
...
|
|
410
|
+
...n || []
|
|
421
411
|
],
|
|
422
412
|
release: d,
|
|
423
413
|
replaysOnErrorSampleRate: r || 1,
|
|
424
414
|
replaysSessionSampleRate: a || 0.1,
|
|
425
415
|
tracePropagationTargets: s,
|
|
426
|
-
tracesSampleRate:
|
|
416
|
+
tracesSampleRate: o || 1
|
|
427
417
|
}), null;
|
|
428
|
-
},
|
|
429
|
-
const
|
|
418
|
+
}, ze = ({ IMaskMixin: e, ...n }) => {
|
|
419
|
+
const o = Q(
|
|
430
420
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
431
421
|
() => e(({ TextField: a, ...r }) => /* @__PURE__ */ P.jsx(a, { ...r })),
|
|
432
422
|
[e]
|
|
433
423
|
);
|
|
434
|
-
return /* @__PURE__ */ P.jsx(
|
|
435
|
-
},
|
|
436
|
-
const { libraries:
|
|
424
|
+
return /* @__PURE__ */ P.jsx(o, { ...n });
|
|
425
|
+
}, Ue = ({ language: e, ...n }) => {
|
|
426
|
+
const { libraries: o } = j(A), a = n?.dayjs || o?.dayjs, r = n?.plugin || o?.dayjsPlugin;
|
|
437
427
|
if (!a)
|
|
438
428
|
throw new Error(
|
|
439
429
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
@@ -446,22 +436,22 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
446
436
|
}), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), a.locale(c);
|
|
447
437
|
})().then();
|
|
448
438
|
}, [a, r, e]), null;
|
|
449
|
-
},
|
|
439
|
+
}, We = () => (C(() => {
|
|
450
440
|
if (N)
|
|
451
441
|
return;
|
|
452
|
-
const e = (
|
|
442
|
+
const e = (n) => {
|
|
453
443
|
try {
|
|
454
|
-
|
|
444
|
+
n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation(), window.location.reload();
|
|
455
445
|
} catch {
|
|
456
446
|
}
|
|
457
447
|
};
|
|
458
448
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
459
449
|
window.removeEventListener("vite:preloadError", e);
|
|
460
450
|
};
|
|
461
|
-
}, []), null),
|
|
451
|
+
}, []), null), Ee = (e) => e && typeof e == "function", we = (e) => e && typeof e == "function", Qe = ({
|
|
462
452
|
children: e,
|
|
463
|
-
defaultQueriesOptions:
|
|
464
|
-
defaultMutationsOptions:
|
|
453
|
+
defaultQueriesOptions: n,
|
|
454
|
+
defaultMutationsOptions: o,
|
|
465
455
|
...a
|
|
466
456
|
}) => {
|
|
467
457
|
const { libraries: r } = j(A), s = a?.QueryClient || r?.reactQuery?.QueryClient, c = a?.QueryClientProvider || r?.reactQuery?.QueryClientProvider;
|
|
@@ -469,26 +459,26 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
469
459
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
470
460
|
if (!c)
|
|
471
461
|
throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
472
|
-
if (!
|
|
462
|
+
if (!Ee(c))
|
|
473
463
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
474
|
-
if (!
|
|
464
|
+
if (!we(s))
|
|
475
465
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
476
466
|
const u = new s({
|
|
477
467
|
defaultOptions: {
|
|
478
468
|
mutations: {
|
|
479
|
-
...
|
|
469
|
+
...o
|
|
480
470
|
},
|
|
481
471
|
queries: {
|
|
482
472
|
getNextPageParam: (l, d, i) => l.length + (i || 0),
|
|
483
473
|
refetchOnWindowFocus: !1,
|
|
484
474
|
retry: 3,
|
|
485
|
-
...
|
|
475
|
+
...n
|
|
486
476
|
}
|
|
487
477
|
}
|
|
488
478
|
});
|
|
489
479
|
return /* @__PURE__ */ P.jsx(c, { client: u, children: e });
|
|
490
|
-
},
|
|
491
|
-
const { libraries:
|
|
480
|
+
}, Ve = (e) => {
|
|
481
|
+
const { libraries: n } = j(A), o = e?.i18 || n?.i18, a = e?.i18?.translateFunction || n?.i18?.translateFunction, r = o?.i18next?.t || a || ((d) => d), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = r(s), u = $(
|
|
492
482
|
(d) => {
|
|
493
483
|
if (d && typeof d == "object" && "response" in d) {
|
|
494
484
|
const { response: i } = d || {};
|
|
@@ -515,40 +505,40 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
515
505
|
const { response: i } = d || {};
|
|
516
506
|
return i?.error_code ? String(i?.error_code) : i?.data?.error_code ? String(i?.data?.error_code) : i?.error_code ? String(i?.error_code) : i?.data?.error_code ? String(i.data.error_code) : "unknown_error_code";
|
|
517
507
|
}, []), printError: u };
|
|
518
|
-
},
|
|
508
|
+
}, Me = ({
|
|
519
509
|
data: e,
|
|
520
|
-
fetchNextPage:
|
|
521
|
-
isFetchingNextPage:
|
|
510
|
+
fetchNextPage: n,
|
|
511
|
+
isFetchingNextPage: o,
|
|
522
512
|
isInitialLoading: a,
|
|
523
513
|
isLoading: r,
|
|
524
514
|
enabled: s = !0
|
|
525
515
|
}) => {
|
|
526
516
|
const c = $(
|
|
527
517
|
async (l) => {
|
|
528
|
-
|
|
518
|
+
o || !s || await n({ pageParam: l?.pageParam || l.visibleRowsCount });
|
|
529
519
|
},
|
|
530
|
-
[s,
|
|
531
|
-
), u =
|
|
520
|
+
[s, n, o]
|
|
521
|
+
), u = Q(() => {
|
|
532
522
|
if (e)
|
|
533
523
|
return e.pages.reduce((l, d) => [...l, ...d], []);
|
|
534
524
|
}, [e]);
|
|
535
525
|
return {
|
|
536
526
|
fetchNextPageOnRowsScrollEnd: c,
|
|
537
|
-
isLoading:
|
|
527
|
+
isLoading: o || r,
|
|
538
528
|
loadingVariant: a ? "skeleton" : "linear-progress",
|
|
539
529
|
rows: u
|
|
540
530
|
};
|
|
541
|
-
},
|
|
542
|
-
const { libraries:
|
|
543
|
-
if (!
|
|
531
|
+
}, Ge = (e) => {
|
|
532
|
+
const { libraries: n } = j(A), o = e?.axios || n?.axios, a = e?.localStorageKey || "user";
|
|
533
|
+
if (!o)
|
|
544
534
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
545
535
|
const r = $(
|
|
546
536
|
({ tokenType: c, accessToken: u }) => {
|
|
547
|
-
|
|
537
|
+
o.defaults.headers.common.Authorization = `${c} ${u}`;
|
|
548
538
|
},
|
|
549
|
-
[
|
|
539
|
+
[o.defaults.headers.common]
|
|
550
540
|
), s = () => {
|
|
551
|
-
|
|
541
|
+
o.defaults.headers.common.Authorization = null;
|
|
552
542
|
};
|
|
553
543
|
return C(() => {
|
|
554
544
|
if (N)
|
|
@@ -569,55 +559,55 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
569
559
|
clearAuthenticationToken: s,
|
|
570
560
|
setAuthenticationToken: r
|
|
571
561
|
};
|
|
572
|
-
},
|
|
573
|
-
const { fractionDigits:
|
|
574
|
-
return Number.isNaN(r) ? `0${a}` : `${r.toFixed(
|
|
575
|
-
},
|
|
562
|
+
}, be = ({ library: e, date: n, format: o = "ll" }) => e(n).format(o), Re = (e, n) => {
|
|
563
|
+
const { fractionDigits: o = 0, metric: a = "km" } = n || {}, r = Number(e);
|
|
564
|
+
return Number.isNaN(r) ? `0${a}` : `${r.toFixed(o)}${a}`;
|
|
565
|
+
}, Se = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), Ae = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, je = ({ path: e, size: n, apiURL: o }) => {
|
|
576
566
|
if (!e)
|
|
577
567
|
return "";
|
|
578
|
-
const a =
|
|
579
|
-
return typeof
|
|
580
|
-
},
|
|
581
|
-
const { apiURL:
|
|
568
|
+
const a = Ae(e), r = `${o}${a}`, s = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
569
|
+
return typeof n == "number" && s ? `${r.replace("/files", `/thumbs/${n}`)}` : r;
|
|
570
|
+
}, Je = (e) => {
|
|
571
|
+
const { apiURL: n, libraries: o } = j(A), a = e?.dayjs || o?.dayjs;
|
|
582
572
|
return {
|
|
583
573
|
dateAdapter: (c, u) => {
|
|
584
574
|
if (!a)
|
|
585
575
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
586
|
-
return
|
|
576
|
+
return be({
|
|
587
577
|
date: c,
|
|
588
578
|
format: u,
|
|
589
579
|
library: a
|
|
590
580
|
});
|
|
591
581
|
},
|
|
592
|
-
distanceAdapter:
|
|
582
|
+
distanceAdapter: Re,
|
|
593
583
|
filePathAdapter: (c, u) => {
|
|
594
|
-
if (!
|
|
584
|
+
if (!n)
|
|
595
585
|
throw new Error(
|
|
596
586
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
597
587
|
);
|
|
598
|
-
return typeof c == "string" && /^https?:\/\//.test(c) ? c :
|
|
599
|
-
apiURL:
|
|
588
|
+
return typeof c == "string" && /^https?:\/\//.test(c) ? c : je({
|
|
589
|
+
apiURL: n,
|
|
600
590
|
path: c,
|
|
601
591
|
size: u
|
|
602
592
|
});
|
|
603
593
|
},
|
|
604
|
-
worksiteNameAdapter:
|
|
594
|
+
worksiteNameAdapter: Se
|
|
605
595
|
};
|
|
606
|
-
}, F = (e,
|
|
607
|
-
const [
|
|
596
|
+
}, F = (e, n) => n === "short" ? e.split("-")[0] : e, Ke = (e, n = "full") => {
|
|
597
|
+
const [o, a] = ne(() => {
|
|
608
598
|
const r = e?.language || navigator.language;
|
|
609
|
-
return e && "isInitialized" in e && e.isInitialized, F(r,
|
|
599
|
+
return e && "isInitialized" in e && e.isInitialized, F(r, n);
|
|
610
600
|
});
|
|
611
601
|
return C(() => {
|
|
612
|
-
e && "isInitialized" in e && e.isInitialized && e.language && a(F(e.language,
|
|
602
|
+
e && "isInitialized" in e && e.isInitialized && e.language && a(F(e.language, n));
|
|
613
603
|
const r = (s) => {
|
|
614
|
-
a(F(s,
|
|
604
|
+
a(F(s, n));
|
|
615
605
|
};
|
|
616
606
|
return e?.on?.("languageChanged", r), () => {
|
|
617
607
|
e?.off?.("languageChanged", r);
|
|
618
608
|
};
|
|
619
|
-
}, [e,
|
|
620
|
-
},
|
|
609
|
+
}, [e, n]), o;
|
|
610
|
+
}, _e = "tracktor.filter", Pe = {
|
|
621
611
|
getFilter: () => {
|
|
622
612
|
},
|
|
623
613
|
getFilters: () => ({}),
|
|
@@ -625,17 +615,17 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
625
615
|
},
|
|
626
616
|
setFilter: () => {
|
|
627
617
|
}
|
|
628
|
-
},
|
|
629
|
-
const { libraries:
|
|
630
|
-
}], u =
|
|
618
|
+
}, re = (e, n, o) => `${o}_${e}=>${n}`, qe = (e) => {
|
|
619
|
+
const { libraries: n, localStorageKeys: o } = j(A), a = e?.reactRouter || n?.reactRouter, { pathname: r } = a?.useLocation?.() ?? { pathname: "/" }, [s, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
620
|
+
}], u = o?.filter || _e;
|
|
631
621
|
if (N)
|
|
632
|
-
return
|
|
622
|
+
return Pe;
|
|
633
623
|
if (!a)
|
|
634
624
|
throw new Error(
|
|
635
625
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
636
626
|
);
|
|
637
627
|
const l = (g, m, b = !0) => {
|
|
638
|
-
const p =
|
|
628
|
+
const p = re(g, e?.pathname || r, u);
|
|
639
629
|
if (!m || Array.isArray(m) && !m.length) {
|
|
640
630
|
s.delete(g), c(s), localStorage.removeItem(p);
|
|
641
631
|
return;
|
|
@@ -651,7 +641,7 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
651
641
|
} catch {
|
|
652
642
|
return b;
|
|
653
643
|
}
|
|
654
|
-
const p =
|
|
644
|
+
const p = re(g, e?.pathname || r, u), R = localStorage.getItem(p);
|
|
655
645
|
if (R)
|
|
656
646
|
try {
|
|
657
647
|
return JSON.parse(R)[g];
|
|
@@ -665,8 +655,8 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
665
655
|
).reduce((p, R) => {
|
|
666
656
|
const S = localStorage.getItem(R);
|
|
667
657
|
if (S) {
|
|
668
|
-
const
|
|
669
|
-
p[v] = Object.values(
|
|
658
|
+
const O = JSON.parse(S), v = Object.keys(O)?.[0];
|
|
659
|
+
p[v] = Object.values(O)?.[0];
|
|
670
660
|
}
|
|
671
661
|
return p;
|
|
672
662
|
}, {});
|
|
@@ -685,33 +675,33 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
685
675
|
},
|
|
686
676
|
setFilter: l
|
|
687
677
|
};
|
|
688
|
-
},
|
|
678
|
+
}, Te = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Ce = (e) => {
|
|
689
679
|
const a = e.split("/").filter((r) => r.length > 0).map((r) => r.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
|
|
690
680
|
return a.charAt(0).toLowerCase() + a.slice(1);
|
|
691
|
-
}, Oe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), xe = (e,
|
|
692
|
-
const r =
|
|
681
|
+
}, Oe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), xe = (e, n, o, a) => {
|
|
682
|
+
const r = Ce(n), s = Te(o), c = `${r}${s}`;
|
|
693
683
|
return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
|
|
694
|
-
},
|
|
695
|
-
const
|
|
684
|
+
}, ke = (e, n) => {
|
|
685
|
+
const o = {};
|
|
696
686
|
return e?.forEach((a) => {
|
|
697
|
-
|
|
687
|
+
o[a] = {
|
|
698
688
|
query: {
|
|
699
689
|
useInfinite: !0,
|
|
700
690
|
useInfiniteQueryParam: "offset",
|
|
701
691
|
useQuery: !0
|
|
702
692
|
}
|
|
703
693
|
};
|
|
704
|
-
}),
|
|
705
|
-
|
|
694
|
+
}), n?.filter((a) => !o[a]).forEach((a) => {
|
|
695
|
+
o[a] = {
|
|
706
696
|
query: {
|
|
707
697
|
useQuery: !0
|
|
708
698
|
}
|
|
709
699
|
};
|
|
710
|
-
}), Object.keys(
|
|
711
|
-
},
|
|
700
|
+
}), Object.keys(o).length ? o : void 0;
|
|
701
|
+
}, Be = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
|
|
712
702
|
const { output: r, useInfiniteIds: s, useQueryIds: c, input: u = "./openapi.json" } = a || {}, l = Oe(u);
|
|
713
703
|
return {
|
|
714
|
-
...
|
|
704
|
+
...o,
|
|
715
705
|
[l]: {
|
|
716
706
|
hooks: {
|
|
717
707
|
afterAllFilesWrite: "prettier src/api/ --write"
|
|
@@ -723,7 +713,7 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
723
713
|
mode: "tags-split",
|
|
724
714
|
override: {
|
|
725
715
|
...(s?.length || c?.length) && {
|
|
726
|
-
operations:
|
|
716
|
+
operations: ke(s, c)
|
|
727
717
|
},
|
|
728
718
|
header: (d) => [
|
|
729
719
|
"Generated by orval 🍺",
|
|
@@ -747,26 +737,26 @@ const A = fe({}), $e = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
747
737
|
};
|
|
748
738
|
}, {});
|
|
749
739
|
export {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
740
|
+
Fe as GTMSendPageView,
|
|
741
|
+
$e as InitializeAxiosConfig,
|
|
742
|
+
Ue as InitializeDaysJSConfig,
|
|
743
|
+
De as InitializeI18nConfig,
|
|
744
|
+
Ye as InitializeSentryConfig,
|
|
755
745
|
A as InjectDependenciesContext,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
746
|
+
Ne as InjectDependenciesProvider,
|
|
747
|
+
ze as MaskTextField,
|
|
748
|
+
We as PreloadErrorHandler,
|
|
749
|
+
Qe as QueryClientProviderWithConfig,
|
|
750
|
+
Le as RequireAuth,
|
|
751
|
+
Ze as axiosCustomInstance,
|
|
752
|
+
be as dateAdapter,
|
|
753
|
+
Re as distanceAdapter,
|
|
754
|
+
Be as getOrvalConfig,
|
|
755
|
+
Je as useAdapter,
|
|
756
|
+
Ge as useAuth,
|
|
757
|
+
Ke as useCurrentLanguage,
|
|
758
|
+
qe as useFilters,
|
|
759
|
+
Me as useInfiniteDataGrid,
|
|
760
|
+
Ve as useResponseError,
|
|
761
|
+
Se as worksiteNameAdapter
|
|
772
762
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracktor/shared-module",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
"import": "./dist/main.js",
|
|
15
15
|
"default": "./dist/main.umd.cjs"
|
|
16
16
|
},
|
|
17
|
-
"./
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"
|
|
17
|
+
"./axios": {
|
|
18
|
+
"types": "./dist/axios/index.d.ts",
|
|
19
|
+
"require": "./dist/axios.cjs",
|
|
20
|
+
"import": "./dist/axios.js",
|
|
21
|
+
"default": "./dist/axios.cjs"
|
|
20
22
|
}
|
|
21
23
|
},
|
|
22
24
|
"repository": {
|
package/dist/main.umd.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(function(y,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],k):(y=typeof globalThis<"u"?globalThis:y||self,k(y["@tracktor/shared-module"]={},y.axios,y.React))})(this,function(y,k,p){"use strict";const ae=(e,o)=>{const n=k.CancelToken.source(),a=k({...e,...o,cancelToken:n.token}).then(({data:r})=>r);return a.cancel=()=>{n.cancel("Query was cancelled")},a};var F={exports:{}},x={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var W;function se(){if(W)return x;W=1;var e=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(a,r,s){var c=null;if(s!==void 0&&(c=""+s),r.key!==void 0&&(c=""+r.key),"key"in r){s={};for(var u in r)u!=="key"&&(s[u]=r[u])}else s=r;return r=s.ref,{$$typeof:e,type:a,key:c,ref:r!==void 0?r:null,props:s}}return x.Fragment=o,x.jsx=n,x.jsxs=n,x}var N={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var V;function ie(){return V||(V=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Qe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case g:return"Fragment";case C:return"Profiler";case A:return"StrictMode";case Z:return"Suspense";case ze:return"SuspenseList";case Me:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case S:return"Portal";case w:return(t.displayName||"Context")+".Provider";case I:return(t._context.displayName||"Context")+".Consumer";case H:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ue:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case q:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function o(t){return""+t}function n(t){try{o(t);var f=!1}catch{f=!0}if(f){f=console;var v=f.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return v.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),o(t)}}function a(t){if(t===g)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===q)return"<...>";try{var f=e(t);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function r(){var t=Y.A;return t===null?null:t.getOwner()}function s(){return Error("react-stack-top-frame")}function c(t){if($.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function u(t,f){function v(){ee||(ee=!0,console.error("%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://react.dev/link/special-props)",f))}v.isReactWarning=!0,Object.defineProperty(t,"key",{get:v,configurable:!0})}function l(){var t=e(this.type);return te[t]||(te[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function d(t,f,v,b,T,_,U,M){return v=_.ref,t={$$typeof:h,type:t,key:f,props:_,_owner:T},(v!==void 0?v:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:l}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function i(t,f,v,b,T,_,U,M){var R=f.children;if(R!==void 0)if(b)if(We(R)){for(b=0;b<R.length;b++)E(R[b]);Object.freeze&&Object.freeze(R)}else console.error("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 E(R);if($.call(f,"key")){R=e(t);var O=Object.keys(f).filter(function(Ve){return Ve!=="key"});b=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",oe[R+b]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
-
let props = %s;
|
|
19
|
-
<%s {...props} />
|
|
20
|
-
React keys must be passed directly to JSX without using spread:
|
|
21
|
-
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,b,R,O,R),oe[R+b]=!0)}if(R=null,v!==void 0&&(n(v),R=""+v),c(f)&&(n(f.key),R=""+f.key),"key"in f){v={};for(var Q in f)Q!=="key"&&(v[Q]=f[Q])}else v=f;return R&&u(v,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,R,_,T,r(),v,U,M)}function E(t){typeof t=="object"&&t!==null&&t.$$typeof===h&&t._store&&(t._store.validated=1)}var m=p,h=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),w=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),ze=Symbol.for("react.suspense_list"),Ue=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Me=Symbol.for("react.activity"),Qe=Symbol.for("react.client.reference"),Y=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,We=Array.isArray,z=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=m["react-stack-bottom-frame"].bind(m,s)(),ne=z(a(s)),oe={};N.Fragment=g,N.jsx=function(t,f,v,b,T){var _=1e4>Y.recentlyCreatedOwnerStacks++;return i(t,f,v,!1,b,T,_?Error("react-stack-top-frame"):re,_?z(a(t)):ne)},N.jsxs=function(t,f,v,b,T){var _=1e4>Y.recentlyCreatedOwnerStacks++;return i(t,f,v,!0,b,T,_?Error("react-stack-top-frame"):re,_?z(a(t)):ne)}}()),N}var G;function ce(){return G||(G=1,process.env.NODE_ENV==="production"?F.exports=se():F.exports=ie()),F.exports}var P=ce();const j=p.createContext({}),ue=({children:e,apiURL:o,libraries:n,localStorageKeys:a})=>{const r=p.useMemo(()=>({apiURL:o,libraries:n,localStorageKeys:a}),[o,n,a]);return P.jsx(j.Provider,{value:r,children:e})},le="user",de=({Fallback:e,isLogged:o,loginPath:n="/login",redirect401Path:a="/login",...r})=>{const{libraries:s,localStorageKeys:c}=p.useContext(j),u=r?.reactRouter||s?.reactRouter,l=r?.axios||s?.axios,d=r?.localStorageKey||c?.user||le;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,E]=p.useState(null),{useLocation:m,Navigate:h,Outlet:S}=u,g=m(),A=p.useRef(!1),C=typeof o=="function"?o():!!o,I=typeof C=="boolean"?C:C?.isLogged;return p.useEffect(()=>{A.current||(A.current=!0,l.interceptors.response.use(w=>w,async w=>(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?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),E(a)),Promise.reject(w))))},[l.defaults.headers.common,l.interceptors.response,d,a]),I&&!i?P.jsx(p.Suspense,{fallback:e,children:g.state?.from?.state&&g.state?.from?.pathname===n?P.jsx(h,{to:g.state.from.state.from.pathname+g.state.from.state.from.search,replace:!0}):P.jsx(S,{})}):P.jsx(h,{to:n+g.search,state:{from:g},replace:!0})},fe=({data:e,...o})=>{const{libraries:n}=p.useContext(j),a=o?.reactRouter||n?.reactRouter,r=o?.gtm||n?.gtm;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!r)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:s}=r,{useLocation:c,Outlet:u}=a,{pathname:l}=c(),{sendEvent:d}=s();return p.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),P.jsx(u,{})},L=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),pe="user",ge=({tokenTypeKey:e="tokenType",tokenKey:o="accessToken",postContentType:n="application/json",...a})=>{const{apiURL:r=a.apiURL,libraries:s,localStorageKeys:c}=p.useContext(j),u=a?.userLocalStorageKey||c?.user||pe,l=a?.axios||s?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||L)return null;if(typeof window<"u"&&window.localStorage){const d=localStorage.getItem(u),i=d?JSON.parse(d):null,E=i?.[e]?i[e]:null,m=i?.[o]?i[o]:null,h=d?`${E} ${m}`:null;h&&(l.defaults.headers.common.Authorization=h)}return l.defaults.baseURL=r,l.defaults.headers.post["Content-Type"]=n,null},me=({debug:e,resources:o,...n})=>{const{libraries:a}=p.useContext(j),r=n?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:u}=r||{};if(L)return null;if(!r)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return s?.isInitialized||(s.use(u).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:o,returnNull:!1}).then(()=>{document.documentElement.lang!==s.resolvedLanguage&&s.resolvedLanguage&&document.documentElement.setAttribute("lang",s.resolvedLanguage)}),s.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},ye=({dsn:e,integrations:o,tracesSampleRate:n,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:u,environment:l,release:d,...i})=>{const{libraries:E}=p.useContext(j),m=i?.sentry||E?.sentry,h=i?.reactRouter||E?.reactRouter;if(!m)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!h)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(m.isInitialized())return null;const{createRoutesFromChildren:S,matchRoutes:g,useLocation:A,useNavigationType:C}=h;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&m.init({debug:u,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[m.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:S,matchRoutes:g,useEffect:p.useEffect,useLocation:A,useNavigationType:C}),...o||[]],release:d,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:n||1}),null},he=({IMaskMixin:e,...o})=>{const n=p.useMemo(()=>e(({TextField:a,...r})=>P.jsx(a,{...r})),[e]);return P.jsx(n,{...o})},ve=({language:e,...o})=>{const{libraries:n}=p.useContext(j),a=o?.dayjs||n?.dayjs,r=o?.plugin||n?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return p.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";r&&r.forEach(u=>{u&&a.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,r,e]),null},Ee=()=>(p.useEffect(()=>{if(L)return;const e=o=>{try{o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),we=e=>e&&typeof e=="function",be=e=>e&&typeof e=="function",Re=({children:e,defaultQueriesOptions:o,defaultMutationsOptions:n,...a})=>{const{libraries:r}=p.useContext(j),s=a?.QueryClient||r?.reactQuery?.QueryClient,c=a?.QueryClientProvider||r?.reactQuery?.QueryClientProvider;if(!s)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!we(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!be(s))throw new Error("Provided QueryClient dependencies are not valid.");const u=new s({defaultOptions:{mutations:{...n},queries:{getNextPageParam:(l,d,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...o}}});return P.jsx(c,{client:u,children:e})},Se=e=>{const{libraries:o}=p.useContext(j),n=e?.i18||o?.i18,a=e?.i18?.translateFunction||o?.i18?.translateFunction,r=n?.i18next?.t||a||(d=>d),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=r(s),u=p.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:i}=d||{};if(i&&typeof i=="object"&&"reason"in i)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:E}=i.data;if(Array.isArray(E)&&E.length>0&&typeof E[0]=="object"&&E[0]!==null&&"msg"in E[0]){const{msg:m}=E[0];if(typeof m=="string")return String(m)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:p.useCallback(d=>{const{response:i}=d||{};return i?.error_code?String(i?.error_code):i?.data?.error_code?String(i?.data?.error_code):i?.error_code?String(i?.error_code):i?.data?.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:u}},Ae=({data:e,fetchNextPage:o,isFetchingNextPage:n,isInitialLoading:a,isLoading:r,enabled:s=!0})=>{const c=p.useCallback(async l=>{n||!s||await o({pageParam:l?.pageParam||l.visibleRowsCount})},[s,o,n]),u=p.useMemo(()=>{if(e)return e.pages.reduce((l,d)=>[...l,...d],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:n||r,loadingVariant:a?"skeleton":"linear-progress",rows:u}},Ce=e=>{const{libraries:o}=p.useContext(j),n=e?.axios||o?.axios,a=e?.localStorageKey||"user";if(!n)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const r=p.useCallback(({tokenType:c,accessToken:u})=>{n.defaults.headers.common.Authorization=`${c} ${u}`},[n.defaults.headers.common]),s=()=>{n.defaults.headers.common.Authorization=null};return p.useEffect(()=>{if(L)return;const c=({newValue:u,key:l})=>{if(l===a&&u)try{const{accessToken:d,tokenType:i}=JSON.parse(u);r({accessToken:d,tokenType:i})}catch(d){console.error("Failed to parse newValue from localStorage:",d)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,r]),{clearAuthenticationToken:s,setAuthenticationToken:r}},J=({library:e,date:o,format:n="ll"})=>e(o).format(n),K=(e,o)=>{const{fractionDigits:n=0,metric:a="km"}=o||{},r=Number(e);return Number.isNaN(r)?`0${a}`:`${r.toFixed(n)}${a}`},B=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(n=>n.length>0?n.charAt(0).toUpperCase()+n.slice(1):n).join(" "),je=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,_e=({path:e,size:o,apiURL:n})=>{if(!e)return"";const a=je(e),r=`${n}${a}`,s=r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof o=="number"&&s?`${r.replace("/files",`/thumbs/${o}`)}`:r},Pe=e=>{const{apiURL:o,libraries:n}=p.useContext(j),a=e?.dayjs||n?.dayjs;return{dateAdapter:(c,u)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return J({date:c,format:u,library:a})},distanceAdapter:K,filePathAdapter:(c,u)=>{if(!o)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:_e({apiURL:o,path:c,size:u})},worksiteNameAdapter:B}},D=(e,o)=>o==="short"?e.split("-")[0]:e,Te=(e,o="full")=>{const[n,a]=p.useState(()=>{const r=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,D(r,o)});return p.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(D(e.language,o));const r=s=>{a(D(s,o))};return e?.on?.("languageChanged",r),()=>{e?.off?.("languageChanged",r)}},[e,o]),n},ke="tracktor.filter",Ie={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},X=(e,o,n)=>`${n}_${e}=>${o}`,Oe=e=>{const{libraries:o,localStorageKeys:n}=p.useContext(j),a=e?.reactRouter||o?.reactRouter,{pathname:r}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],u=n?.filter||ke;if(L)return Ie;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const l=(m,h,S=!0)=>{const g=X(m,e?.pathname||r,u);if(!h||Array.isArray(h)&&!h.length){s.delete(m),c(s),localStorage.removeItem(g);return}S&&h&&localStorage.setItem(g,JSON.stringify({...s,[m]:h})),h&&(s.set(m,JSON.stringify(h)),c(s))};return{getFilter:(m,h)=>{const S=s.get(m);if(S)try{return JSON.parse(S)}catch{return S}const g=X(m,e?.pathname||r,u),A=localStorage.getItem(g);if(A)try{return JSON.parse(A)[m]}catch{}return h},getFilters:()=>{const m=Object.fromEntries(s.entries()),S=Object.keys(localStorage).filter(g=>g.startsWith(u)&&g.endsWith(e?.pathname||r)).reduce((g,A)=>{const C=localStorage.getItem(A);if(C){const I=JSON.parse(C),w=Object.keys(I)?.[0];g[w]=Object.values(I)?.[0]}return g},{});return{...m,...S}},handleFilter:(m,h)=>(S,g)=>{if(g||Array.isArray(g)&&g.length===0){const A=h||"value",C=typeof g=="object"&&A in g?g[A]:g;l(m,C);return}l(m,void 0)},setFilter:l}},xe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Ne=e=>{const a=e.split("/").filter(r=>r.length>0).map(r=>r.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},Le=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Fe=(e,o,n,a)=>{const r=Ne(o),s=xe(n),c=`${r}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},De=(e,o)=>{const n={};return e?.forEach(a=>{n[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),o?.filter(a=>!n[a]).forEach(a=>{n[a]={query:{useQuery:!0}}}),Object.keys(n).length?n:void 0},Ye=e=>(Array.isArray(e)?e:[e]).reduce((n,a)=>{const{output:r,useInfiniteIds:s,useQueryIds:c,input:u="./openapi.json"}=a||{},l=Le(u);return{...n,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:u,output:{baseUrl:r?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:De(s,c)},header:d=>["Generated by orval 🍺",...d.title?[d.title]:[],...d.description?[d.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(d,i,E)=>Fe(d,i,E,c),query:{useQuery:!0}},schemas:r?.schemas||`src/api/${l}/model`,target:r?.target||`src/api/${l}/services/api.ts`,...r}}}},{});y.GTMSendPageView=fe,y.InitializeAxiosConfig=ge,y.InitializeDaysJSConfig=ve,y.InitializeI18nConfig=me,y.InitializeSentryConfig=ye,y.InjectDependenciesContext=j,y.InjectDependenciesProvider=ue,y.MaskTextField=he,y.PreloadErrorHandler=Ee,y.QueryClientProviderWithConfig=Re,y.RequireAuth=de,y.axiosCustomInstance=ae,y.dateAdapter=J,y.distanceAdapter=K,y.getOrvalConfig=Ye,y.useAdapter=Pe,y.useAuth=Ce,y.useCurrentLanguage=Te,y.useFilters=Oe,y.useInfiniteDataGrid=Ae,y.useResponseError=Se,y.worksiteNameAdapter=B,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
File without changes
|