@tracktor/shared-module 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/dist/main.d.ts +5 -5
- package/dist/main.js +18 -18
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ export { default as RequireAuth } from './components/Utils/RequireAuth';
|
|
|
2
2
|
export * from './components/Utils/RequireAuth';
|
|
3
3
|
export { default as GTMSendPageView } from './components/Utils/GTMSendPageView';
|
|
4
4
|
export * from './components/Utils/GTMSendPageView';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as InitializeAxiosConfig } from './components/Utils/InitializeAxiosConfig';
|
|
6
6
|
export * from './components/Utils/InitializeAxiosConfig';
|
|
7
|
-
export { default as
|
|
7
|
+
export { default as InitializeI18nConfig } from './components/Utils/InitializeI18nConfig';
|
|
8
8
|
export * from './components/Utils/InitializeI18nConfig';
|
|
9
|
-
export { default as
|
|
9
|
+
export { default as InitializeSentryConfig } from './components/Utils/InitializeSentryConfig';
|
|
10
10
|
export * from './components/Utils/InitializeSentryConfig';
|
|
11
11
|
export { default as MaskTextField } from './components/Inputs/MaskTextField';
|
|
12
12
|
export * from './components/Inputs/MaskTextField';
|
|
13
|
-
export { default as
|
|
13
|
+
export { default as InitializeMapBoxConfig } from './components/Utils/InitializeMapBoxConfig';
|
|
14
14
|
export * from './components/Utils/InitializeMapBoxConfig';
|
|
15
|
-
export { default as
|
|
15
|
+
export { default as InitializeDaysJSConfig } from './components/Utils/InitializeDaysJSConfig';
|
|
16
16
|
export * from './components/Utils/InitializeDaysJSConfig';
|
|
17
17
|
export { default as InjectDependenciesProvider } from './context/InjectDependenciesProvider';
|
|
18
18
|
export * from './context/InjectDependenciesProvider';
|
package/dist/main.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as i, I as s, e as n, a as t, d as r, b as o, m as d, f, M as g, Q as I, R as l, k as u, l as C, j as p, i as A, h as c, g as x, u as z } from "./main-EkPM5n5x.js";
|
|
2
2
|
export {
|
|
3
|
-
s as AxiosConfig,
|
|
4
|
-
n as DaysJSConfig,
|
|
5
3
|
i as GTMSendPageView,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
s as InitializeAxiosConfig,
|
|
5
|
+
n as InitializeDaysJSConfig,
|
|
6
|
+
t as InitializeI18nConfig,
|
|
7
|
+
r as InitializeMapBoxConfig,
|
|
8
|
+
o as InitializeSentryConfig,
|
|
9
|
+
d as InjectDependenciesContext,
|
|
10
|
+
f as InjectDependenciesProvider,
|
|
11
|
+
g as MaskTextField,
|
|
12
|
+
I as QueryClientConfigProvider,
|
|
13
|
+
l as RequireAuth,
|
|
14
|
+
u as dateAdapter,
|
|
15
|
+
C as distanceAdapter,
|
|
16
|
+
p as getOrvalConfig,
|
|
17
|
+
A as useAdapter,
|
|
18
|
+
c as useAuth,
|
|
19
|
+
x as useInfiniteDataGrid,
|
|
20
|
+
z as useResponseError
|
|
21
21
|
};
|
package/dist/main.umd.cjs
CHANGED
|
@@ -24,4 +24,4 @@ Check the top-level render call using <`+o+">.")}return r}}function Ue(e,r){{if(
|
|
|
24
24
|
*
|
|
25
25
|
* This source code is licensed under the MIT license found in the
|
|
26
26
|
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/var he;function Qe(){if(he)return G;he=1;var t=_,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,d=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function s(l,f,i){var b,C={},j=null,D=null;i!==void 0&&(j=""+i),f.key!==void 0&&(j=""+f.key),f.ref!==void 0&&(D=f.ref);for(b in f)u.call(f,b)&&!p.hasOwnProperty(b)&&(C[b]=f[b]);if(l&&l.defaultProps)for(b in f=l.defaultProps,f)C[b]===void 0&&(C[b]=f[b]);return{$$typeof:n,type:l,key:j,ref:D,props:C,_owner:d.current}}return G.Fragment=a,G.jsx=s,G.jsxs=s,G}process.env.NODE_ENV==="production"?ie.exports=Qe():ie.exports=Ze();var k=ie.exports;const F=_.createContext({}),et=({children:t,apiURL:n,libraries:a})=>{const u=_.useMemo(()=>({apiURL:n,libraries:a}),[n,a]);return k.jsx(F.Provider,{value:u,children:t})},tt=({Fallback:t,isLogged:n,loginPath:a="/login",localStorageKey:u="user",redirect401Path:d="/login",...p})=>{var E,W,K,Z;const{libraries:s}=_.useContext(F),l=(p==null?void 0:p.axios)||(s==null?void 0:s.axios),f=(p==null?void 0:p.reactRouter)||(s==null?void 0:s.reactRouter);if(f===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(l===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,b]=_.useState(null),{useLocation:C,Navigate:j,Outlet:D}=f,O=C(),P=_.useRef(!1),x=typeof n=="function"?n():!!n,A=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return _.useLayoutEffect(()=>{P.current||(P.current=!0,l==null||l.interceptors.response.use(S=>S,async S=>{var J;return typeof S=="object"&&S&&"response"in S&&S.response&&typeof S.response=="object"&&"status"in S.response&&S.response&&typeof S.response=="object"&&"status"in S.response&&((J=S==null?void 0:S.response)==null?void 0:J.status)===401&&(l.defaults.headers.common.Authorization=null,localStorage.removeItem(u),b(d)),Promise.reject(S)}))},[l==null?void 0:l.defaults.headers.common,l==null?void 0:l.interceptors.response,u,d]),A&&!i?k.jsx(_.Suspense,{fallback:t,children:(W=(E=O.state)==null?void 0:E.from)!=null&&W.state&&((Z=(K=O.state)==null?void 0:K.from)==null?void 0:Z.pathname)===a?k.jsx(j,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):k.jsx(D,{})}):k.jsx(j,{to:a,state:{from:O},replace:!0})},rt=({...t})=>{const{libraries:n}=_.useContext(F),a=(t==null?void 0:t.reactRouter)||(n==null?void 0:n.reactRouter),u=(t==null?void 0:t.gtm)||(n==null?void 0:n.gtm);if(a===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(u===void 0)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const{useGoogleTagManager:d}=u,{useLocation:p,Outlet:s}=a,{pathname:l}=p(),{sendEvent:f}=d();return _.useEffect(()=>{f({event:"pageView",pathname:l})},[l,f]),k.jsx(s,{})},nt=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:a="accessToken",postContentType:u="application/json",...d})=>{const{apiURL:p=d.apiURL}=_.useContext(F);if(!q.defaults)return null;const s=localStorage.getItem(n),l=s?JSON.parse(s):null,f=l!=null&&l[t]?l[t]:null,i=l!=null&&l[a]?l[a]:null,b=s?`${f} ${i}`:null;return q.defaults.baseURL=p,q.defaults.headers.post["Content-Type"]=u,b&&(q.defaults.headers.common.Authorization=b),null},at=({debug:t,resources:n})=>(I!=null&&I.isInitialized||(I.use(He).use($e.initReactI18next).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==I.resolvedLanguage&&I.resolvedLanguage&&document.documentElement.setAttribute("lang",I.resolvedLanguage)}),I.on("languageChanged",a=>{document.documentElement.setAttribute("lang",a)})),null),ot=({dsn:t,integrations:n,tracesSampleRate:a,replaysSessionSampleRate:u,replaysOnErrorSampleRate:d,tracePropagationTargets:p,ignoreErrors:s,debug:l,environment:f})=>(ae.isInitialized()||(l||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&ae.init({debug:l,dsn:t,environment:f||"production",ignoreErrors:[...s||[],/dynamically imported module/],integrations:[ae.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:X.createRoutesFromChildren,matchRoutes:X.matchRoutes,useEffect:_.useEffect,useLocation:X.useLocation,useNavigationType:X.useNavigationType}),...n||[]],replaysOnErrorSampleRate:d||1,replaysSessionSampleRate:u||.1,tracePropagationTargets:p,tracesSampleRate:a||1}),null),it=({IMaskMixin:t,...n})=>{const a=_.useMemo(()=>t(({TextField:u,...d})=>k.jsx(u,{...d})),[t]);return k.jsx(a,{...n})},ut=({accessToken:t})=>(_.useEffect(()=>{if(!t)return;(async()=>{try{const a=await import("mapbox-gl");a.default.accessToken=t}catch(a){console.error(a)}})().then()},[t]),null);var _e={exports:{}};(function(t,n){(function(a,u){t.exports=u()})(oe,function(){var a={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(u,d,p){var s=d.prototype,l=s.format;p.en.formats=a,s.format=function(f){f===void 0&&(f="YYYY-MM-DDTHH:mm:ssZ");var i=this.$locale().formats,b=function(C,j){return C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(D,O,P){var x=P&&P.toUpperCase();return O||j[P]||a[P]||j[x].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(A,E,W){return E||W.slice(1)})})}(f,i===void 0?{}:i);return l.call(this,b)}}})})(_e);var st=_e.exports;const ct=Ke(st);U.extend(ct);const lt=({language:t})=>(_.useLayoutEffect(()=>{var a;const n=t||((a=navigator.language)==null?void 0:a.slice(0,2))||"en";if(n==="en"){Promise.resolve().then(()=>Ee).then(()=>{U.locale(n)});return}n==="fr"&&Promise.resolve().then(()=>jt).then(()=>{U.locale(n)}).catch(()=>{Promise.resolve().then(()=>Ee).then(()=>{U.locale("en")})})},[t]),null),ft=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:a})=>{const u=new pe.QueryClient({defaultOptions:{mutations:{...a},queries:{getNextPageParam:(d,p,s)=>d.length+(s||0),refetchOnWindowFocus:!1,retry:3,...n}}});return k.jsx(pe.QueryClientProvider,{client:u,children:t})},dt=t=>{const{libraries:n}=_.useContext(F),a=(t==null?void 0:t.i18)||(n==null?void 0:n.i18);if(a===void 0)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in params of useResponseError.");const{t:u}=a.i18next,{unknownErrorTranslationKey:d="error.unknownError"}=t||{},p=u(d),s=_.useCallback(f=>{var b,C,j,D,O,P,x,A,E;const{response:i}=f||{};return i!=null&&i.reason?String(i.reason):(b=i==null?void 0:i.data)!=null&&b.reason?String(i.data.reason):(C=i==null?void 0:i.data)!=null&&C.message?String(i.data.message):(D=(j=i==null?void 0:i.data)==null?void 0:j.detail)!=null&&D.length&&Array.isArray((O=i==null?void 0:i.data)==null?void 0:O.detail)&&((x=(P=i==null?void 0:i.data)==null?void 0:P.detail[0])!=null&&x.msg)&&typeof((E=(A=i==null?void 0:i.data)==null?void 0:A.detail[0])==null?void 0:E.msg)=="string"?String(i.data.detail[0].msg):p},[p]);return{getErrorCode:_.useCallback(f=>{var b,C,j;const{response:i}=f||{};return i!=null&&i.error_code?String(i==null?void 0:i.error_code):(b=i==null?void 0:i.data)!=null&&b.error_code?String((C=i==null?void 0:i.data)==null?void 0:C.error_code):i!=null&&i.error_code?String(i==null?void 0:i.error_code):(j=i==null?void 0:i.data)!=null&&j.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:s}},vt=({data:t,fetchNextPage:n,isFetchingNextPage:a,isInitialLoading:u,isLoading:d,enabled:p=!0})=>{const s=_.useCallback(async f=>{a||!p||await n({pageParam:(f==null?void 0:f.pageParam)||f.visibleRowsCount})},[p,n,a]),l=_.useMemo(()=>{if(t)return t.pages.reduce((f,i)=>[...f,...i],[])},[t]);return{fetchNextPageOnRowsScrollEnd:s,isLoading:a||d,loadingVariant:u?"skeleton":"linear",rows:l}},mt=t=>{const{libraries:n}=_.useContext(F),a=(t==null?void 0:t.axios)||(n==null?void 0:n.axios);if(a===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");return{clearAuthenticationToken:()=>{a.defaults.headers.common.Authorization=null},setAuthenticationToken:({tokenType:p,accessToken:s})=>{a.defaults.headers.common.Authorization=`${p} ${s}`}}},ye=(t,n="km")=>{const a=Number(t);return Number.isNaN(a)?`0 ${n}`:`${a.toFixed(2)} ${n}`},pt=t=>{const n=t&&typeof t=="object"&&"pathname"in t&&t.pathname?t.pathname:t;return typeof n=="string"?n!=null&&n.startsWith("/")?n!=null&&n.startsWith("/files")?n:`/files${n}`:n!=null&&n.startsWith("files")?`/${n}`:n!=null&&n.startsWith("files")?`/${n}`:`/files/${n}`:n},be=(t,n)=>{if(!t)return"";const a=pt(t),u=typeof t=="object"&&"pathname"in t?`${t.origin}${a}`:t;return typeof n=="number"?`${u.replace("/files",`/thumbs/${n}`)}`:u},gt=t=>{const{apiURL:n,libraries:a}=_.useContext(F),u=(t==null?void 0:t.dayjs)||(a==null?void 0:a.dayjs);return{dateAdapter:(s,l="ll")=>{if(u===void 0)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return u(s).format(l)},distanceAdapter:ye,filePathAdapter:(s,l)=>be(n&&typeof s=="string"?{origin:n,pathname:s}:s,l)}},ht=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),_t=t=>{const u=t.split("/").filter(d=>d.length>0).map(d=>d.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(f=>f.charAt(0).toUpperCase()+f.slice(1)).join("")).join("");return u.charAt(0).toLowerCase()+u.slice(1)},yt=(t,n,a)=>{const u=_t(n),d=ht(a);return`${u}${d}`},bt=t=>{if(t)return(t==null?void 0:t.reduce((n,a)=>(n[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},Et=t=>{const{input:n="./openapi.json",operationsToGenerateInfiniteQueryHook:a=void 0}=t||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:n,output:{client:"react-query",mode:"tags-split",override:{header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:yt,...(a==null?void 0:a.length)&&{operations:bt(a)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}},Rt=(t,n,a="ll")=>String(t(n).format(a));var wt={exports:{}};(function(t,n){(function(a,u){t.exports=u()})(oe,function(){return{name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(a){var u=["th","st","nd","rd"],d=a%100;return"["+a+(u[(d-20)%10]||u[d]||u[0])+"]"}}})})(wt);const Ee=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Ct={exports:{}};(function(t,n){(function(a,u){t.exports=u(U)})(oe,function(a){function u(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var d=u(a),p={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(s){return""+s+(s===1?"er":"")}};return d.default.locale(p,null,!0),p})})(Ct);const jt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));g.AxiosConfig=nt,g.DaysJSConfig=lt,g.GTMSendPageView=rt,g.I18nConfig=at,g.InjectDependenciesContext=F,g.InjectDependenciesProvider=et,g.MapBoxConfig=ut,g.MaskTextField=it,g.QueryClientConfigProvider=ft,g.RequireAuth=tt,g.SentryConfig=ot,g.dateAdapter=Rt,g.distanceAdapter=ye,g.getOrvalConfig=Et,g.useAdapter=gt,g.useAuth=mt,g.useInfiniteDataGrid=vt,g.useResponseError=dt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
27
|
+
*/var he;function Qe(){if(he)return G;he=1;var t=_,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,d=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function s(l,f,i){var b,C={},j=null,D=null;i!==void 0&&(j=""+i),f.key!==void 0&&(j=""+f.key),f.ref!==void 0&&(D=f.ref);for(b in f)u.call(f,b)&&!p.hasOwnProperty(b)&&(C[b]=f[b]);if(l&&l.defaultProps)for(b in f=l.defaultProps,f)C[b]===void 0&&(C[b]=f[b]);return{$$typeof:n,type:l,key:j,ref:D,props:C,_owner:d.current}}return G.Fragment=a,G.jsx=s,G.jsxs=s,G}process.env.NODE_ENV==="production"?ie.exports=Qe():ie.exports=Ze();var k=ie.exports;const F=_.createContext({}),et=({children:t,apiURL:n,libraries:a})=>{const u=_.useMemo(()=>({apiURL:n,libraries:a}),[n,a]);return k.jsx(F.Provider,{value:u,children:t})},tt=({Fallback:t,isLogged:n,loginPath:a="/login",localStorageKey:u="user",redirect401Path:d="/login",...p})=>{var E,W,K,Z;const{libraries:s}=_.useContext(F),l=(p==null?void 0:p.axios)||(s==null?void 0:s.axios),f=(p==null?void 0:p.reactRouter)||(s==null?void 0:s.reactRouter);if(f===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(l===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,b]=_.useState(null),{useLocation:C,Navigate:j,Outlet:D}=f,O=C(),P=_.useRef(!1),x=typeof n=="function"?n():!!n,A=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return _.useLayoutEffect(()=>{P.current||(P.current=!0,l==null||l.interceptors.response.use(S=>S,async S=>{var J;return typeof S=="object"&&S&&"response"in S&&S.response&&typeof S.response=="object"&&"status"in S.response&&S.response&&typeof S.response=="object"&&"status"in S.response&&((J=S==null?void 0:S.response)==null?void 0:J.status)===401&&(l.defaults.headers.common.Authorization=null,localStorage.removeItem(u),b(d)),Promise.reject(S)}))},[l==null?void 0:l.defaults.headers.common,l==null?void 0:l.interceptors.response,u,d]),A&&!i?k.jsx(_.Suspense,{fallback:t,children:(W=(E=O.state)==null?void 0:E.from)!=null&&W.state&&((Z=(K=O.state)==null?void 0:K.from)==null?void 0:Z.pathname)===a?k.jsx(j,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):k.jsx(D,{})}):k.jsx(j,{to:a,state:{from:O},replace:!0})},rt=({...t})=>{const{libraries:n}=_.useContext(F),a=(t==null?void 0:t.reactRouter)||(n==null?void 0:n.reactRouter),u=(t==null?void 0:t.gtm)||(n==null?void 0:n.gtm);if(a===void 0)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(u===void 0)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const{useGoogleTagManager:d}=u,{useLocation:p,Outlet:s}=a,{pathname:l}=p(),{sendEvent:f}=d();return _.useEffect(()=>{f({event:"pageView",pathname:l})},[l,f]),k.jsx(s,{})},nt=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:a="accessToken",postContentType:u="application/json",...d})=>{const{apiURL:p=d.apiURL}=_.useContext(F);if(!q.defaults)return null;const s=localStorage.getItem(n),l=s?JSON.parse(s):null,f=l!=null&&l[t]?l[t]:null,i=l!=null&&l[a]?l[a]:null,b=s?`${f} ${i}`:null;return q.defaults.baseURL=p,q.defaults.headers.post["Content-Type"]=u,b&&(q.defaults.headers.common.Authorization=b),null},at=({debug:t,resources:n})=>(I!=null&&I.isInitialized||(I.use(He).use($e.initReactI18next).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==I.resolvedLanguage&&I.resolvedLanguage&&document.documentElement.setAttribute("lang",I.resolvedLanguage)}),I.on("languageChanged",a=>{document.documentElement.setAttribute("lang",a)})),null),ot=({dsn:t,integrations:n,tracesSampleRate:a,replaysSessionSampleRate:u,replaysOnErrorSampleRate:d,tracePropagationTargets:p,ignoreErrors:s,debug:l,environment:f})=>(ae.isInitialized()||(l||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&ae.init({debug:l,dsn:t,environment:f||"production",ignoreErrors:[...s||[],/dynamically imported module/],integrations:[ae.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:X.createRoutesFromChildren,matchRoutes:X.matchRoutes,useEffect:_.useEffect,useLocation:X.useLocation,useNavigationType:X.useNavigationType}),...n||[]],replaysOnErrorSampleRate:d||1,replaysSessionSampleRate:u||.1,tracePropagationTargets:p,tracesSampleRate:a||1}),null),it=({IMaskMixin:t,...n})=>{const a=_.useMemo(()=>t(({TextField:u,...d})=>k.jsx(u,{...d})),[t]);return k.jsx(a,{...n})},ut=({accessToken:t})=>(_.useEffect(()=>{if(!t)return;(async()=>{try{const a=await import("mapbox-gl");a.default.accessToken=t}catch(a){console.error(a)}})().then()},[t]),null);var _e={exports:{}};(function(t,n){(function(a,u){t.exports=u()})(oe,function(){var a={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(u,d,p){var s=d.prototype,l=s.format;p.en.formats=a,s.format=function(f){f===void 0&&(f="YYYY-MM-DDTHH:mm:ssZ");var i=this.$locale().formats,b=function(C,j){return C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(D,O,P){var x=P&&P.toUpperCase();return O||j[P]||a[P]||j[x].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(A,E,W){return E||W.slice(1)})})}(f,i===void 0?{}:i);return l.call(this,b)}}})})(_e);var st=_e.exports;const ct=Ke(st);U.extend(ct);const lt=({language:t})=>(_.useLayoutEffect(()=>{var a;const n=t||((a=navigator.language)==null?void 0:a.slice(0,2))||"en";if(n==="en"){Promise.resolve().then(()=>Ee).then(()=>{U.locale(n)});return}n==="fr"&&Promise.resolve().then(()=>jt).then(()=>{U.locale(n)}).catch(()=>{Promise.resolve().then(()=>Ee).then(()=>{U.locale("en")})})},[t]),null),ft=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:a})=>{const u=new pe.QueryClient({defaultOptions:{mutations:{...a},queries:{getNextPageParam:(d,p,s)=>d.length+(s||0),refetchOnWindowFocus:!1,retry:3,...n}}});return k.jsx(pe.QueryClientProvider,{client:u,children:t})},dt=t=>{const{libraries:n}=_.useContext(F),a=(t==null?void 0:t.i18)||(n==null?void 0:n.i18);if(a===void 0)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in params of useResponseError.");const{t:u}=a.i18next,{unknownErrorTranslationKey:d="error.unknownError"}=t||{},p=u(d),s=_.useCallback(f=>{var b,C,j,D,O,P,x,A,E;const{response:i}=f||{};return i!=null&&i.reason?String(i.reason):(b=i==null?void 0:i.data)!=null&&b.reason?String(i.data.reason):(C=i==null?void 0:i.data)!=null&&C.message?String(i.data.message):(D=(j=i==null?void 0:i.data)==null?void 0:j.detail)!=null&&D.length&&Array.isArray((O=i==null?void 0:i.data)==null?void 0:O.detail)&&((x=(P=i==null?void 0:i.data)==null?void 0:P.detail[0])!=null&&x.msg)&&typeof((E=(A=i==null?void 0:i.data)==null?void 0:A.detail[0])==null?void 0:E.msg)=="string"?String(i.data.detail[0].msg):p},[p]);return{getErrorCode:_.useCallback(f=>{var b,C,j;const{response:i}=f||{};return i!=null&&i.error_code?String(i==null?void 0:i.error_code):(b=i==null?void 0:i.data)!=null&&b.error_code?String((C=i==null?void 0:i.data)==null?void 0:C.error_code):i!=null&&i.error_code?String(i==null?void 0:i.error_code):(j=i==null?void 0:i.data)!=null&&j.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:s}},vt=({data:t,fetchNextPage:n,isFetchingNextPage:a,isInitialLoading:u,isLoading:d,enabled:p=!0})=>{const s=_.useCallback(async f=>{a||!p||await n({pageParam:(f==null?void 0:f.pageParam)||f.visibleRowsCount})},[p,n,a]),l=_.useMemo(()=>{if(t)return t.pages.reduce((f,i)=>[...f,...i],[])},[t]);return{fetchNextPageOnRowsScrollEnd:s,isLoading:a||d,loadingVariant:u?"skeleton":"linear",rows:l}},mt=t=>{const{libraries:n}=_.useContext(F),a=(t==null?void 0:t.axios)||(n==null?void 0:n.axios);if(a===void 0)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");return{clearAuthenticationToken:()=>{a.defaults.headers.common.Authorization=null},setAuthenticationToken:({tokenType:p,accessToken:s})=>{a.defaults.headers.common.Authorization=`${p} ${s}`}}},ye=(t,n="km")=>{const a=Number(t);return Number.isNaN(a)?`0 ${n}`:`${a.toFixed(2)} ${n}`},pt=t=>{const n=t&&typeof t=="object"&&"pathname"in t&&t.pathname?t.pathname:t;return typeof n=="string"?n!=null&&n.startsWith("/")?n!=null&&n.startsWith("/files")?n:`/files${n}`:n!=null&&n.startsWith("files")?`/${n}`:n!=null&&n.startsWith("files")?`/${n}`:`/files/${n}`:n},be=(t,n)=>{if(!t)return"";const a=pt(t),u=typeof t=="object"&&"pathname"in t?`${t.origin}${a}`:t;return typeof n=="number"?`${u.replace("/files",`/thumbs/${n}`)}`:u},gt=t=>{const{apiURL:n,libraries:a}=_.useContext(F),u=(t==null?void 0:t.dayjs)||(a==null?void 0:a.dayjs);return{dateAdapter:(s,l="ll")=>{if(u===void 0)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return u(s).format(l)},distanceAdapter:ye,filePathAdapter:(s,l)=>be(n&&typeof s=="string"?{origin:n,pathname:s}:s,l)}},ht=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),_t=t=>{const u=t.split("/").filter(d=>d.length>0).map(d=>d.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(f=>f.charAt(0).toUpperCase()+f.slice(1)).join("")).join("");return u.charAt(0).toLowerCase()+u.slice(1)},yt=(t,n,a)=>{const u=_t(n),d=ht(a);return`${u}${d}`},bt=t=>{if(t)return(t==null?void 0:t.reduce((n,a)=>(n[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},Et=t=>{const{input:n="./openapi.json",operationsToGenerateInfiniteQueryHook:a=void 0}=t||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:n,output:{client:"react-query",mode:"tags-split",override:{header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:yt,...(a==null?void 0:a.length)&&{operations:bt(a)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}},Rt=(t,n,a="ll")=>String(t(n).format(a));var wt={exports:{}};(function(t,n){(function(a,u){t.exports=u()})(oe,function(){return{name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(a){var u=["th","st","nd","rd"],d=a%100;return"["+a+(u[(d-20)%10]||u[d]||u[0])+"]"}}})})(wt);const Ee=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Ct={exports:{}};(function(t,n){(function(a,u){t.exports=u(U)})(oe,function(a){function u(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var d=u(a),p={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(s){return""+s+(s===1?"er":"")}};return d.default.locale(p,null,!0),p})})(Ct);const jt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));g.GTMSendPageView=rt,g.InitializeAxiosConfig=nt,g.InitializeDaysJSConfig=lt,g.InitializeI18nConfig=at,g.InitializeMapBoxConfig=ut,g.InitializeSentryConfig=ot,g.InjectDependenciesContext=F,g.InjectDependenciesProvider=et,g.MaskTextField=it,g.QueryClientConfigProvider=ft,g.RequireAuth=tt,g.dateAdapter=Rt,g.distanceAdapter=ye,g.getOrvalConfig=Et,g.useAdapter=gt,g.useAuth=mt,g.useInfiniteDataGrid=vt,g.useResponseError=dt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|