@tracktor/shared-module 2.18.2 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -14
- package/dist/axiosCustomInstance.ts +1 -1
- package/dist/config/orval/orval.d.ts +10 -0
- package/dist/main.d.ts +26 -26
- package/dist/main.js +357 -357
- package/dist/main.umd.cjs +4 -4
- package/dist/utils/adapter/dateAdapter.d.ts +3 -5
- package/package.json +7 -4
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(m,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],x):(m=typeof globalThis<"u"?globalThis:m||self,x(m["@tracktor/shared-module"]={},m.axios,m.React))})(this,function(m,x,f){"use strict";const ae=(e,r)=>{const o=x.CancelToken.source(),a=x({...e,...r,cancelToken:o.token}).then(({data:n})=>n);return a.cancel=()=>{o.cancel("Query was cancelled")},a};var Y={exports:{}},L={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var G;function se(){if(G)return L;G=1;var e=Symbol.for("react.transitional.element"),
|
|
9
|
+
*/var G;function se(){if(G)return L;G=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(a,n,i){var c=null;if(i!==void 0&&(c=""+i),n.key!==void 0&&(c=""+n.key),"key"in n){i={};for(var u in n)u!=="key"&&(i[u]=n[u])}else i=n;return n=i.ref,{$$typeof:e,type:a,key:c,ref:n!==void 0?n:null,props:i}}return L.Fragment=r,L.jsx=o,L.jsxs=o,L}var F={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var J;function ie(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===
|
|
17
|
+
*/var J;function ie(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Je?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case E:return"Profiler";case y:return"StrictMode";case _:return"Suspense";case Qe:return"SuspenseList";case Ge: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 I:return"Portal";case h:return(t.displayName||"Context")+".Provider";case P:return(t._context.displayName||"Context")+".Consumer";case b:var p=t.render;return t=t.displayName,t||(t=p.displayName||p.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ve:return p=t.displayName||null,p!==null?p:e(t.type)||"Memo";case q:p=t._payload,t=t._init;try{return e(t(p))}catch{}}return null}function r(t){return""+t}function o(t){try{r(t);var p=!1}catch{p=!0}if(p){p=console;var w=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),r(t)}}function a(t){if(t===j)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===q)return"<...>";try{var p=e(t);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function n(){var t=z.A;return t===null?null:t.getOwner()}function i(){return Error("react-stack-top-frame")}function c(t){if($.call(t,"key")){var p=Object.getOwnPropertyDescriptor(t,"key").get;if(p&&p.isReactWarning)return!1}return t.key!==void 0}function u(t,p){function w(){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)",p))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,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,p,w,R,O,T,M,Q){return w=T.ref,t={$$typeof:A,type:t,key:p,props:T,_owner:O},(w!==void 0?w: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:M}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function s(t,p,w,R,O,T,M,Q){var S=p.children;if(S!==void 0)if(R)if(Ke(S)){for(R=0;R<S.length;R++)v(S[R]);Object.freeze&&Object.freeze(S)}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(S);if($.call(p,"key")){S=e(t);var N=Object.keys(p).filter(function(Be){return Be!=="key"});R=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",oe[S+R]||(N=0<N.length?"{"+N.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,R,S,N,S),oe[S+R]=!0)}if(S=null,w!==void 0&&(o(w),S=""+w),c(p)&&(o(p.key),S=""+p.key),"key"in p){w={};for(var V in p)V!=="key"&&(w[V]=p[V])}else w=p;return S&&d(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),u(t,S,T,I,r(),w,M,Q)}function E(t){typeof t=="object"&&t!==null&&t.$$typeof===j&&t._store&&(t._store.validated=1)}var y=f,j=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),m=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),Qe=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Ve=Symbol.for("react.activity"),Ge=Symbol.for("react.client.reference"),z=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Je=Array.isArray,U=console.createTask?console.createTask:function(){return null};y={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=y["react-stack-bottom-frame"].bind(y,s)(),ne=U(a(s)),oe={};F.Fragment=C,F.jsx=function(t,p,w,R,I){var T=1e4>z.recentlyCreatedOwnerStacks++;return i(t,p,w,!1,R,I,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)},F.jsxs=function(t,p,w,R,I){var T=1e4>z.recentlyCreatedOwnerStacks++;return i(t,p,w,!0,R,I,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)}}()),F}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?Y.exports=se():Y.exports=ie()),Y.exports}var k=ce();const A=f.createContext({}),le=({children:e,apiURL:n,libraries:o,localStorageKeys:a})=>{const r=f.useMemo(()=>({apiURL:n,libraries:o,localStorageKeys:a}),[n,o,a]);return k.jsx(A.Provider,{value:r,children:e})},ue="user",de=({Fallback:e,isLogged:n,loginPath:o="/login",redirect401Path:a="/login",...r})=>{const{libraries:s,localStorageKeys:c}=f.useContext(A),d=r?.reactRouter||s?.reactRouter,l=r?.axios||s?.axios,u=r?.localStorageKey||c?.user||ue;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,E]=f.useState(null),{useLocation:y,Navigate:j,Outlet:x}=d,C=y(),h=f.useRef(!1),v=typeof n=="function"?n():!!n,_=typeof v=="boolean"?v:v?.isLogged;return f.useEffect(()=>{h.current||(h.current=!0,l.interceptors.response.use(m=>m,async m=>(typeof m=="object"&&m&&"response"in m&&m.response&&typeof m.response=="object"&&"status"in m.response&&m.response&&typeof m.response=="object"&&"status"in m.response&&m?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(u),E(a)),Promise.reject(m))))},[l.defaults.headers.common,l.interceptors.response,u,a]),_&&!i?k.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?k.jsx(j,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):k.jsx(x,{})}):k.jsx(j,{to:o+C.search,state:{from:C},replace:!0})},fe=({data:e,...n})=>{const{libraries:o}=f.useContext(A),a=n?.reactRouter||o?.reactRouter,r=n?.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(!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:d}=a,{pathname:l}=c(),{sendEvent:u}=s();return f.useEffect(()=>{u({event:"pageView",pathname:l,...e})},[e,l,u]),k.jsx(d,{})},D=(()=>{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:n="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:r=a.apiURL,libraries:s,localStorageKeys:c}=f.useContext(A),d=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||D)return null;if(typeof window<"u"&&window.localStorage){const u=localStorage.getItem(d),i=u?JSON.parse(u):null,E=i?.[e]?i[e]:null,y=i?.[n]?i[n]:null,j=u?`${E} ${y}`:null;j&&(l.defaults.headers.common.Authorization=j)}return l.defaults.baseURL=r,l.defaults.headers.post["Content-Type"]=o,null},me=({debug:e,resources:n,...o})=>{const{libraries:a}=f.useContext(A),r=o?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:d}=r||{};if(D)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(d).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,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:n,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:d,environment:l,release:u,...i})=>{const{libraries:E}=f.useContext(A),y=i?.sentry||E?.sentry,j=i?.reactRouter||E?.reactRouter;if(!y)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!j)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(y.isInitialized())return null;const{createRoutesFromChildren:x,matchRoutes:C,useLocation:h,useNavigationType:v}=j;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&y.init({debug:d,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:[y.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:x,matchRoutes:C,useEffect:f.useEffect,useLocation:h,useNavigationType:v}),...n||[]],release:u,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:o||1}),null},he=({IMaskMixin:e,...n})=>{const o=f.useMemo(()=>e(({TextField:a,...r})=>k.jsx(a,{...r})),[e]);return k.jsx(o,{...n})},ve=({language:e,...n})=>{const{libraries:o}=f.useContext(A),a=n?.dayjs||o?.dayjs,r=n?.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 f.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";r&&r.forEach(d=>{d&&a.extend(d)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,r,e]),null},Ee=()=>(f.useEffect(()=>{if(D)return;const e=n=>{try{n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),we=async()=>{if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(n=>caches.delete(n)))}catch(e){console.error("Failed to clear caches:",e)}},be=({autoUpdate:e,renderDialog:n,clearCachesOnReload:o})=>{const a=f.useRef(null),[r,s]=f.useState(!1),c=f.useCallback(async()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&await we(),window.location.reload()},[o]),d=f.useCallback(async()=>{window.confirm("A new version is available. The app will reload now.")&&await c()},[c]);return f.useEffect(()=>{if(!("serviceWorker"in navigator))return;let l,u;const i=y=>{y&&navigator.serviceWorker.controller&&(a.current=y,s(!0))},E=()=>{const y=l?.installing;y&&(u=()=>{y.state==="installed"&&i(y)},y.addEventListener("statechange",u))};return(async()=>{l=await navigator.serviceWorker.getRegistration(),l&&(i(l.waiting),l.addEventListener("updatefound",E))})().catch(console.error),()=>{l?.removeEventListener("updatefound",E),u&&l?.installing&&l.installing.removeEventListener("statechange",u)}},[]),f.useEffect(()=>{r&&e&&c().catch(console.error)},[e,r,c]),f.useEffect(()=>{r&&!e&&!n&&d().catch(console.error)},[n,d,r,e]),r&&!e&&n?n(c):null},Re=e=>e&&typeof e=="function",Se=e=>e&&typeof e=="function",Ae=({children:e,defaultQueriesOptions:n,defaultMutationsOptions:o,...a})=>{const{libraries:r}=f.useContext(A),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(!Re(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Se(s))throw new Error("Provided QueryClient dependencies are not valid.");const d=new s({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,u,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...n}}});return k.jsx(c,{client:d,children:e})},Ce=e=>{const{libraries:n}=f.useContext(A),o=e?.i18||n?.i18,a=e?.i18?.translateFunction||n?.i18?.translateFunction,r=o?.i18next?.t||a||(u=>u),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=r(s),d=f.useCallback(u=>{if(u&&typeof u=="object"&&"response"in u){const{response:i}=u||{};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:y}=E[0];if(typeof y=="string")return String(y)}}}return u instanceof Error?u.message:c},[c]);return{getErrorCode:f.useCallback(u=>{const{response:i}=u||{};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:d}},je=({data:e,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:a,isLoading:r,enabled:s=!0})=>{const c=f.useCallback(async l=>{o||!s||await n({pageParam:l?.pageParam||l.visibleRowsCount})},[s,n,o]),d=f.useMemo(()=>{if(e)return e.pages.reduce((l,u)=>[...l,...u],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||r,loadingVariant:a?"skeleton":"linear-progress",rows:d}},_e=e=>{const{libraries:n}=f.useContext(A),o=e?.axios||n?.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 r=f.useCallback(({tokenType:c,accessToken:d})=>{o.defaults.headers.common.Authorization=`${c} ${d}`},[o.defaults.headers.common]),s=()=>{o.defaults.headers.common.Authorization=null};return f.useEffect(()=>{if(D)return;const c=({newValue:d,key:l})=>{if(l===a&&d)try{const{accessToken:u,tokenType:i}=JSON.parse(d);r({accessToken:u,tokenType:i})}catch(u){console.error("Failed to parse newValue from localStorage:",u)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,r]),{clearAuthenticationToken:s,setAuthenticationToken:r}},B=({library:e,date:n,format:o="ll"})=>e(n).format(o),H=(e,n)=>{const{fractionDigits:o=0,metric:a="km",spacingBetween:r=!0}=n||{},s=Number(e),c=r?" ":"";return Number.isNaN(s)?`0${c}${a}`:`${s.toFixed(o)}${c}${a}`},X=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Pe=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Te=({path:e,size:n,apiURL:o})=>{if(!e)return"";const a=Pe(e),r=`${o}${a}`,s=r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&s?`${r.replace("/files",`/thumbs/${n}`)}`:r},ke=e=>{const{apiURL:n,libraries:o}=f.useContext(A),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,d)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return B({date:c,format:d,library:a})},distanceAdapter:H,filePathAdapter:(c,d)=>{if(!n)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:Te({apiURL:n,path:c,size:d})},worksiteNameAdapter:X}},W=(e,n)=>n==="short"?e.split("-")[0]:e,Ie=(e,n="full")=>{const[o,a]=f.useState(()=>{const r=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,W(r,n)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(W(e.language,n));const r=s=>{a(W(s,n))};return e?.on?.("languageChanged",r),()=>{e?.off?.("languageChanged",r)}},[e,n]),o},Oe="tracktor.filter",xe={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=(e,n,o)=>`${o}_${e}=>${n}`,Ne=e=>e.reduce((n,o)=>{const a=localStorage.getItem(o);if(a)try{const r=JSON.parse(a),s=Object.keys(r)?.[0];s&&(n[s]=Object.values(r)?.[0])}catch{}return n},{}),Le=e=>{const{libraries:n,localStorageKeys:o}=f.useContext(A),a=e?.reactRouter||n?.reactRouter,{pathname:r}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,l]=f.useState({}),u=o?.filter||Oe,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(D)return xe;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const E=()=>Object.keys(localStorage).filter(h=>h.startsWith(u)&&h.endsWith(e?.pathname||r)),y=(h,v,_=!0)=>{const m=Z(h,e?.pathname||r,u);if(!v||Array.isArray(v)&&!v.length){i?(s.delete(h),c(s)):l(b=>{const P={...b};return delete P[h],P}),localStorage.removeItem(m);return}_&&v&&localStorage.setItem(m,JSON.stringify({...s,[h]:v})),i&&v?(s.set(h,JSON.stringify(v)),c(s)):!i&&v&&l(b=>({...b,[h]:v}))};return{getFilter:(h,v)=>{if(!i){const b=d[h];if(b!==void 0)return b}if(i){const b=s.get(h);if(b)try{return JSON.parse(b)}catch{return b}}const _=Z(h,e?.pathname||r,u),m=localStorage.getItem(_);if(m)try{const b=JSON.parse(m)[h];return!i&&b!==void 0&&l(P=>({...P,[h]:b})),b}catch{}return v},getFilters:()=>{const h=E(),v=Ne(h);if(i){const _=Object.fromEntries(s.entries());return{...v,..._}}return{...v,...d}},handleFilter:(h,v)=>(_,m)=>{if(m||Array.isArray(m)&&m.length===0){const b=v||"value",P=typeof m=="object"&&b in m?m[b]:m;y(h,P);return}y(h,void 0)},setFilter:y}},Fe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),De=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)},Ye=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),We=(e,n,o,a)=>{const r=De(n),s=Fe(o),c=`${r}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},ze=(e,n)=>{const o={};return e?.forEach(a=>{o[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),n?.filter(a=>!o[a]).forEach(a=>{o[a]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Ue=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:r,useInfiniteIds:s,useQueryIds:c,input:d="./openapi.json"}=a||{},l=Ye(d);return{...o,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:d,output:{baseUrl:r?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:ze(s,c)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:a?.customAxiosInstancePath||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(u,i,E)=>We(u,i,E,c),query:{useQuery:!0}},schemas:r?.schemas||`src/api/${l}/model`,target:r?.target||`src/api/${l}/services/api.ts`,...r}}}},{});g.GTMSendPageView=fe,g.InitializeAxiosConfig=ge,g.InitializeDaysJSConfig=ve,g.InitializeI18nConfig=me,g.InitializeSentryConfig=ye,g.InjectDependenciesContext=A,g.InjectDependenciesProvider=le,g.MaskTextField=he,g.PreloadErrorHandler=Ee,g.QueryClientProviderWithConfig=Ae,g.RequireAuth=de,g.UpdateNotifier=be,g.axiosCustomInstance=ae,g.dateAdapter=B,g.distanceAdapter=H,g.getOrvalConfig=Ue,g.useAdapter=ke,g.useAuth=_e,g.useCurrentLanguage=Ie,g.useFilters=Le,g.useInfiniteDataGrid=je,g.useResponseError=Ce,g.worksiteNameAdapter=X,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
<%s key={someKey} {...props} />`,R,S,N,S),oe[S+R]=!0)}if(S=null,w!==void 0&&(o(w),S=""+w),c(p)&&(o(p.key),S=""+p.key),"key"in p){w={};for(var V in p)V!=="key"&&(w[V]=p[V])}else w=p;return S&&u(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,S,T,O,n(),w,M,Q)}function v(t){typeof t=="object"&&t!==null&&t.$$typeof===A&&t._store&&(t._store.validated=1)}var g=f,A=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),h=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),Qe=Symbol.for("react.suspense_list"),Ve=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Ge=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),z=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Ke=Array.isArray,U=console.createTask?console.createTask:function(){return null};g={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=g["react-stack-bottom-frame"].bind(g,i)(),ne=U(a(i)),oe={};F.Fragment=j,F.jsx=function(t,p,w,R,O){var T=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,w,!1,R,O,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)},F.jsxs=function(t,p,w,R,O){var T=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,w,!0,R,O,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)}}()),F}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?Y.exports=se():Y.exports=ie()),Y.exports}var k=ce();const le=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>k.jsx(a,{...n})),[e]);return k.jsx(o,{...r})},C=f.createContext({}),ue=({children:e,apiURL:r,libraries:o,localStorageKeys:a})=>{const n=f.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:a}),[r,o,a]);return k.jsx(C.Provider,{value:n,children:e})},de=({data:e,...r})=>{const{libraries:o}=f.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:i}=n,{useLocation:c,Outlet:u}=a,{pathname:l}=c(),{sendEvent:d}=i();return f.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),k.jsx(u,{})},D=(()=>{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}})(),fe="user",pe=({tokenTypeKey:e="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:n=a.apiURL,libraries:i,localStorageKeys:c}=f.useContext(C),u=a?.userLocalStorageKey||c?.user||fe,l=a?.axios||i?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||D)return null;if(typeof window<"u"&&window.localStorage){const d=localStorage.getItem(u),s=d?JSON.parse(d):null,v=s?.[e]?s[e]:null,g=s?.[r]?s[r]:null,A=d?`${v} ${g}`:null;A&&(l.defaults.headers.common.Authorization=A)}return l.defaults.baseURL=n,l.defaults.headers.post["Content-Type"]=o,null},ge=({language:e,...r})=>{const{libraries:o}=f.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 f.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},me=({debug:e,resources:r,...o})=>{const{libraries:a}=f.useContext(C),n=o?.i18||a?.i18,{i18next:i,initReactI18next:c,languageDetector:u}=n||{};if(D)return null;if(!n)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return i?.isInitialized||(i.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!==i.resolvedLanguage&&i.resolvedLanguage&&document.documentElement.setAttribute("lang",i.resolvedLanguage)}),i.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},he=({dsn:e,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:n,tracePropagationTargets:i,ignoreErrors:c,debug:u,environment:l,release:d,...s})=>{const{libraries:v}=f.useContext(C),g=s?.sentry||v?.sentry,A=s?.reactRouter||v?.reactRouter;if(!g)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!A)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(g.isInitialized())return null;const{createRoutesFromChildren:I,matchRoutes:j,useLocation:y,useNavigationType:E}=A;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&g.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:[g.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:I,matchRoutes:j,useEffect:f.useEffect,useLocation:y,useNavigationType:E}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},ye=()=>(f.useEffect(()=>{if(D)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),ve="user",Ee=({Fallback:e,isLogged:r,loginPath:o="/login",redirect401Path:a="/login",...n})=>{const{libraries:i,localStorageKeys:c}=f.useContext(C),u=n?.reactRouter||i?.reactRouter,l=n?.axios||i?.axios,d=n?.localStorageKey||c?.user||ve;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[s,v]=f.useState(null),{useLocation:g,Navigate:A,Outlet:I}=u,j=g(),y=f.useRef(!1),E=typeof r=="function"?r():!!r,P=typeof E=="boolean"?E:E?.isLogged;return f.useEffect(()=>{y.current||(y.current=!0,l.interceptors.response.use(h=>h,async h=>(typeof h=="object"&&h&&"response"in h&&h.response&&typeof h.response=="object"&&"status"in h.response&&h.response&&typeof h.response=="object"&&"status"in h.response&&h?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),v(a)),Promise.reject(h))))},[l.defaults.headers.common,l.interceptors.response,d,a]),P&&!s?k.jsx(f.Suspense,{fallback:e,children:j.state?.from?.state&&j.state?.from?.pathname===o?k.jsx(A,{to:j.state.from.state.from.pathname+j.state.from.state.from.search,replace:!0}):k.jsx(I,{})}):k.jsx(A,{to:o+j.search,state:{from:j},replace:!0})},we=async()=>{if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(r=>caches.delete(r)))}catch(e){console.error("Failed to clear caches:",e)}},be=({autoUpdate:e,renderDialog:r,clearCachesOnReload:o})=>{const a=f.useRef(null),[n,i]=f.useState(!1),c=f.useCallback(async()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&await we(),window.location.reload()},[o]),u=f.useCallback(async()=>{window.confirm("A new version is available. The app will reload now.")&&await c()},[c]);return f.useEffect(()=>{if(!("serviceWorker"in navigator))return;let l,d;const s=g=>{g&&navigator.serviceWorker.controller&&(a.current=g,i(!0))},v=()=>{const g=l?.installing;g&&(d=()=>{g.state==="installed"&&s(g)},g.addEventListener("statechange",d))};return(async()=>{l=await navigator.serviceWorker.getRegistration(),l&&(s(l.waiting),l.addEventListener("updatefound",v))})().catch(console.error),()=>{l?.removeEventListener("updatefound",v),d&&l?.installing&&l.installing.removeEventListener("statechange",d)}},[]),f.useEffect(()=>{n&&e&&c().catch(console.error)},[e,n,c]),f.useEffect(()=>{n&&!e&&!r&&u().catch(console.error)},[r,u,n,e]),n&&!e&&r?r(c):null},Re=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Se=e=>{const r=e.split(/[/\\]/).pop()||"";return r.substring(0,r.lastIndexOf("."))},Ae=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)},Ce=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),je=(e,r,o,a)=>{const n=Ae(r),i=Re(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Pe=(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},_e=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:n,useInfiniteIds:i,useQueryIds:c,input:u="./openapi.json",customAxiosInstancePath:l,overrideApiName:d}=a||{},s=d||Ce(u),v=l||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...o,[s]:{input:u,output:{baseUrl:n?.baseUrl,client:"react-query",mode:"tags-split",override:{...(i?.length||c?.length)&&{operations:Pe(i,c)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:Se(v),path:v},operationName:(g,A,I)=>je(g,A,I,c),query:{useQuery:!0}},schemas:n?.schemas||`src/api/${s}/model`,target:n?.target||`src/api/${s}/services/api.ts`,...n}}}},{}),Te=e=>e&&typeof e=="function",ke=e=>e&&typeof e=="function",Ie=({children:e,defaultQueriesOptions:r,defaultMutationsOptions:o,...a})=>{const{libraries:n}=f.useContext(C),i=a?.QueryClient||n?.reactQuery?.QueryClient,c=a?.QueryClientProvider||n?.reactQuery?.QueryClientProvider;if(!i)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(!Te(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!ke(i))throw new Error("Provided QueryClient dependencies are not valid.");const u=new i({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,d,s)=>l.length+(s||0),refetchOnWindowFocus:!1,retry:3,...r}}});return k.jsx(c,{client:u,children:e})},B=({library:e,date:r,format:o="ll"})=>e(r).format(o),H=(e,r)=>{const{fractionDigits:o=0,metric:a="km",spacingBetween:n=!0}=r||{},i=Number(e),c=n?" ":"";return Number.isNaN(i)?`0${c}${a}`:`${i.toFixed(o)}${c}${a}`},X=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Oe=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,xe=({path:e,size:r,apiURL:o})=>{if(!e)return"";const a=Oe(e),n=`${o}${a}`,i=n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&i?`${n.replace("/files",`/thumbs/${r}`)}`:n},Ne=e=>{const{apiURL:r,libraries:o}=f.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 B({date:c,format:u,library:a})},distanceAdapter:H,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:xe({apiURL:r,path:c,size:u})},worksiteNameAdapter:X}},Le=e=>{const{libraries:r}=f.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=f.useCallback(({tokenType:c,accessToken:u})=>{o.defaults.headers.common.Authorization=`${c} ${u}`},[o.defaults.headers.common]),i=()=>{o.defaults.headers.common.Authorization=null};return f.useEffect(()=>{if(D)return;const c=({newValue:u,key:l})=>{if(l===a&&u)try{const{accessToken:d,tokenType:s}=JSON.parse(u);n({accessToken:d,tokenType:s})}catch(d){console.error("Failed to parse newValue from localStorage:",d)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,n]),{clearAuthenticationToken:i,setAuthenticationToken:n}},W=(e,r)=>r==="short"?e.split("-")[0]:e,Fe=(e,r="full")=>{const[o,a]=f.useState(()=>{const n=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,W(n,r)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(W(e.language,r));const n=i=>{a(W(i,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},De="tracktor.filter",Ye={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=(e,r,o)=>`${o}_${e}=>${r}`,We=e=>e.reduce((r,o)=>{const a=localStorage.getItem(o);if(a)try{const n=JSON.parse(a),i=Object.keys(n)?.[0];i&&(r[i]=Object.values(n)?.[0])}catch{}return r},{}),ze=e=>{const{libraries:r,localStorageKeys:o}=f.useContext(C),a=e?.reactRouter||r?.reactRouter,{pathname:n}=a?.useLocation?.()??{pathname:"/"},[i,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[u,l]=f.useState({}),d=o?.filter||De,s=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(D)return Ye;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const v=()=>Object.keys(localStorage).filter(y=>y.startsWith(d)&&y.endsWith(e?.pathname||n)),g=(y,E,P=!0)=>{const h=Z(y,e?.pathname||n,d);if(!E||Array.isArray(E)&&!E.length){s?(i.delete(y),c(i)):l(b=>{const _={...b};return delete _[y],_}),localStorage.removeItem(h);return}P&&E&&localStorage.setItem(h,JSON.stringify({...i,[y]:E})),s&&E?(i.set(y,JSON.stringify(E)),c(i)):!s&&E&&l(b=>({...b,[y]:E}))};return{getFilter:(y,E)=>{if(!s){const b=u[y];if(b!==void 0)return b}if(s){const b=i.get(y);if(b)try{return JSON.parse(b)}catch{return b}}const P=Z(y,e?.pathname||n,d),h=localStorage.getItem(P);if(h)try{const b=JSON.parse(h)[y];return!s&&b!==void 0&&l(_=>({..._,[y]:b})),b}catch{}return E},getFilters:()=>{const y=v(),E=We(y);if(s){const P=Object.fromEntries(i.entries());return{...E,...P}}return{...E,...u}},handleFilter:(y,E)=>(P,h)=>{if(h||Array.isArray(h)&&h.length===0){const b=E||"value",_=typeof h=="object"&&b in h?h[b]:h;g(y,_);return}g(y,void 0)},setFilter:g}},Ue=({data:e,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:a,isLoading:n,enabled:i=!0})=>{const c=f.useCallback(async l=>{o||!i||await r({pageParam:l?.pageParam||l.visibleRowsCount})},[i,r,o]),u=f.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}},Me=e=>{const{libraries:r}=f.useContext(C),o=e?.i18||r?.i18,a=e?.i18?.translateFunction||r?.i18?.translateFunction,n=o?.i18next?.t||a||(d=>d),{unknownErrorTranslationKey:i="error.unknownError"}=e||{},c=n(i),u=f.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:s}=d||{};if(s&&typeof s=="object"&&"reason"in s)return String(s.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"reason"in s.data)return String(s.data.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data)return String(s.data.message);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"detail"in s.data){const{detail:v}=s.data;if(Array.isArray(v)&&v.length>0&&typeof v[0]=="object"&&v[0]!==null&&"msg"in v[0]){const{msg:g}=v[0];if(typeof g=="string")return String(g)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:f.useCallback(d=>{const{response:s}=d||{};return s?.error_code?String(s?.error_code):s?.data?.error_code?String(s?.data?.error_code):s?.error_code?String(s?.error_code):s?.data?.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:u}};m.GTMSendPageView=de,m.InitializeAxiosConfig=pe,m.InitializeDaysJSConfig=ge,m.InitializeI18nConfig=me,m.InitializeSentryConfig=he,m.InjectDependenciesContext=C,m.InjectDependenciesProvider=ue,m.MaskTextField=le,m.PreloadErrorHandler=ye,m.QueryClientProviderWithConfig=Ie,m.RequireAuth=Ee,m.UpdateNotifier=be,m.axiosCustomInstance=ae,m.dateAdapter=B,m.distanceAdapter=H,m.getOrvalConfig=_e,m.useAdapter=Ne,m.useAuth=Le,m.useCurrentLanguage=Fe,m.useFilters=ze,m.useInfiniteDataGrid=Ue,m.useResponseError=Me,m.worksiteNameAdapter=X,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
type DateType = string | number | Date | null | undefined;
|
|
2
|
-
|
|
3
|
-
(
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
}
|
|
2
|
+
type Library = (date: DateType) => {
|
|
3
|
+
format: (format: string) => string;
|
|
4
|
+
};
|
|
7
5
|
interface DateAdapterParams<T> {
|
|
8
6
|
library: T;
|
|
9
7
|
date: DateType;
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracktor/shared-module",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
7
7
|
"main": "./dist/main.umd.cjs",
|
|
8
8
|
"module": "./dist/main.js",
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
10
12
|
"exports": {
|
|
11
13
|
".": {
|
|
12
14
|
"types": "./dist/main.d.ts",
|
|
@@ -26,7 +28,8 @@
|
|
|
26
28
|
"scripts": {
|
|
27
29
|
"dev": "vite",
|
|
28
30
|
"build": "vite build",
|
|
29
|
-
"lint": "
|
|
31
|
+
"lint": "biome check --diagnostic-level=error . && tsc --noEmit --incremental",
|
|
32
|
+
"lint:fix": "biome check . --write",
|
|
30
33
|
"preview": "vite preview",
|
|
31
34
|
"test": "yarn lint && vitest",
|
|
32
35
|
"prepare": "yarn run build && husky install"
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
"@types/react": "^19.0.0",
|
|
42
45
|
"@types/react-dom": "^19.0.0",
|
|
43
46
|
"@vitejs/plugin-react": "^4.6.0",
|
|
44
|
-
"
|
|
47
|
+
"@tracktor/biome-config-react": "^1.0.5",
|
|
45
48
|
"husky": "^8.0.3",
|
|
46
49
|
"jsdom": "^22.1.0",
|
|
47
50
|
"react": "^19.0.0",
|