@tracktor/shared-module 0.9.3 → 0.9.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
CHANGED
|
@@ -7,6 +7,12 @@ interface MaskTextFieldProps<T> {
|
|
|
7
7
|
* @see https://imask.js.org/guide.html#masked-pattern
|
|
8
8
|
*/
|
|
9
9
|
mask?: unknown;
|
|
10
|
+
/**
|
|
11
|
+
* On accept callback. Should be used to get the value from the mask instead onChange for controlled components.
|
|
12
|
+
* @param value
|
|
13
|
+
* @param maskRef
|
|
14
|
+
*/
|
|
15
|
+
onAccept?: (value: unknown, maskRef: unknown) => void;
|
|
10
16
|
/**
|
|
11
17
|
* Definitions.
|
|
12
18
|
*/
|
package/dist/main.js
CHANGED
|
@@ -738,9 +738,8 @@ const H = pr({
|
|
|
738
738
|
}), n.on("languageChanged", (o) => {
|
|
739
739
|
document.documentElement.setAttribute("lang", o);
|
|
740
740
|
}), null), jr = ({ dsn: n, sentry: i }) => (J(() => {
|
|
741
|
-
i.init({
|
|
741
|
+
process.env.NODE_ENV === "production" && i.init({
|
|
742
742
|
dsn: n,
|
|
743
|
-
environment: "production",
|
|
744
743
|
integrations: [new i.BrowserTracing()],
|
|
745
744
|
tracesSampleRate: 1
|
|
746
745
|
});
|
package/dist/main.umd.cjs
CHANGED
|
@@ -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 se;function Ie(){if(se)return W;se=1;var n=m,i=Symbol.for("react.element"),d=Symbol.for("react.fragment"),v=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(
|
|
9
|
+
*/var se;function Ie(){if(se)return W;se=1;var n=m,i=Symbol.for("react.element"),d=Symbol.for("react.fragment"),v=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(E,c,T){var _,C={},S=null,O=null;T!==void 0&&(S=""+T),c.key!==void 0&&(S=""+c.key),c.ref!==void 0&&(O=c.ref);for(_ in c)v.call(c,_)&&!s.hasOwnProperty(_)&&(C[_]=c[_]);if(E&&E.defaultProps)for(_ in c=E.defaultProps,c)C[_]===void 0&&(C[_]=c[_]);return{$$typeof:i,type:E,key:S,ref:O,props:C,_owner:o.current}}return W.Fragment=d,W.jsx=u,W.jsxs=u,W}var N={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
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 ue;function Le(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&function(){var n=m,i=Symbol.for("react.element"),d=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),
|
|
17
|
+
*/var ue;function Le(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&function(){var n=m,i=Symbol.for("react.element"),d=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),E=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),D=Symbol.iterator,F="@@iterator";function G(e){if(e===null||typeof e!="object")return null;var r=D&&e[D]||e[F];return typeof r=="function"?r:null}var k=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];ce("error",e,t)}}function ce(e,r,t){{var a=k.ReactDebugCurrentFrame,g=a.getStackAddendum();g!==""&&(r+="%s",t=t.concat([g]));var h=t.map(function(f){return String(f)});h.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,h)}}var le=!1,z=!1,Ze=!1,qe=!1,$e=!1,fe;fe=Symbol.for("react.module.reference");function er(e){return!!(typeof e=="string"||typeof e=="function"||e===v||e===s||$e||e===o||e===T||e===_||qe||e===O||le||z||Ze||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===C||e.$$typeof===u||e.$$typeof===E||e.$$typeof===c||e.$$typeof===fe||e.getModuleId!==void 0))}function rr(e,r,t){var a=e.displayName;if(a)return a;var g=r.displayName||r.name||"";return g!==""?t+"("+g+")":t}function de(e){return e.displayName||"Context"}function x(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case v:return"Fragment";case d:return"Portal";case s:return"Profiler";case o:return"StrictMode";case T:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var r=e;return de(r)+".Consumer";case u:var t=e;return de(t._context)+".Provider";case c:return rr(e,e.render,"ForwardRef");case C:var a=e.displayName||null;return a!==null?a:x(e.type)||"Memo";case S:{var g=e,h=g._payload,f=g._init;try{return x(f(h))}catch{return null}}}return null}var I=Object.assign,V=0,ve,pe,ge,he,me,Ee,ye;function be(){}be.__reactDisabledLog=!0;function tr(){{if(V===0){ve=console.log,pe=console.info,ge=console.warn,he=console.error,me=console.group,Ee=console.groupCollapsed,ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function nr(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:ve}),info:I({},e,{value:pe}),warn:I({},e,{value:ge}),error:I({},e,{value:he}),group:I({},e,{value:me}),groupCollapsed:I({},e,{value:Ee}),groupEnd:I({},e,{value:ye})})}V<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=k.ReactCurrentDispatcher,ee;function J(e,r,t){{if(ee===void 0)try{throw Error()}catch(g){var a=g.stack.trim().match(/\n( *(at )?)/);ee=a&&a[1]||""}return`
|
|
18
18
|
`+ee+e}}var re=!1,H;{var ar=typeof WeakMap=="function"?WeakMap:Map;H=new ar}function Re(e,r){if(!e||re)return"";{var t=H.get(e);if(t!==void 0)return t}var a;re=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=$.current,$.current=null,tr();try{if(r){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(A){a=A}Reflect.construct(e,[],f)}else{try{f.call()}catch(A){a=A}e.call(f.prototype)}}else{try{throw Error()}catch(A){a=A}e()}}catch(A){if(A&&a&&typeof A.stack=="string"){for(var l=A.stack.split(`
|
|
19
19
|
`),w=a.stack.split(`
|
|
20
|
-
`),
|
|
21
|
-
`+l[
|
|
20
|
+
`),y=l.length-1,b=w.length-1;y>=1&&b>=0&&l[y]!==w[b];)b--;for(;y>=1&&b>=0;y--,b--)if(l[y]!==w[b]){if(y!==1||b!==1)do if(y--,b--,b<0||l[y]!==w[b]){var j=`
|
|
21
|
+
`+l[y].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,j),j}while(y>=1&&b>=0);break}}}finally{re=!1,$.current=h,nr(),Error.prepareStackTrace=g}var M=e?e.displayName||e.name:"",Fe=M?J(M):"";return typeof e=="function"&&H.set(e,Fe),Fe}function or(e,r,t){return Re(e,!1)}function ir(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,ir(e));if(typeof e=="string")return J(e);switch(e){case T:return J("Suspense");case _:return J("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return or(e.render);case C:return K(e.type,r,t);case S:{var a=e,g=a._payload,h=a._init;try{return K(h(g),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,_e={},Te=k.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,t=K(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(t)}else Te.setExtraStackFrame(null)}function sr(e,r,t,a,g){{var h=Function.call.bind(X);for(var f in e)if(h(e,f)){var l=void 0;try{if(typeof e[f]!="function"){var w=Error((a||"React class")+": "+t+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}l=e[f](r,f,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){l=y}l&&!(l instanceof Error)&&(Q(g),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",t,f,typeof l),Q(null)),l instanceof Error&&!(l.message in _e)&&(_e[l.message]=!0,Q(g),p("Failed %s type: %s",t,l.message),Q(null))}}}var ur=Array.isArray;function te(e){return ur(e)}function cr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function lr(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function Ce(e){if(lr(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",cr(e)),we(e)}var U=k.ReactCurrentOwner,fr={key:!0,ref:!0,__self:!0,__source:!0},Oe,Se,ne;ne={};function dr(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function vr(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function pr(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=x(U.current.type);ne[t]||(p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(U.current.type),e.ref),ne[t]=!0)}}function gr(e,r){{var t=function(){Oe||(Oe=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function hr(e,r){{var t=function(){Se||(Se=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var mr=function(e,r,t,a,g,h,f){var l={$$typeof:i,type:e,key:r,ref:t,props:f,_owner:h};return l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l};function Er(e,r,t,a,g){{var h,f={},l=null,w=null;t!==void 0&&(Ce(t),l=""+t),vr(r)&&(Ce(r.key),l=""+r.key),dr(r)&&(w=r.ref,pr(r,g));for(h in r)X.call(r,h)&&!fr.hasOwnProperty(h)&&(f[h]=r[h]);if(e&&e.defaultProps){var y=e.defaultProps;for(h in y)f[h]===void 0&&(f[h]=y[h])}if(l||w){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;l&&gr(f,b),w&&hr(f,b)}return mr(e,l,w,g,a,U.current,f)}}var ae=k.ReactCurrentOwner,je=k.ReactDebugCurrentFrame;function L(e){if(e){var r=e._owner,t=K(e.type,e._source,r?r.type:null);je.setExtraStackFrame(t)}else je.setExtraStackFrame(null)}var oe;oe=!1;function ie(e){return typeof e=="object"&&e!==null&&e.$$typeof===i}function Pe(){{if(ae.current){var e=x(ae.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function yr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+r+":"+t+"."}return""}}var ke={};function br(e){{var r=Pe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+t+">.")}return r}}function xe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=br(r);if(ke[t])return;ke[t]=!0;var a="";e&&e._owner&&e._owner!==ae.current&&(a=" It was passed a child from "+x(e._owner.type)+"."),L(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),L(null)}}function Ae(e,r){{if(typeof e!="object")return;if(te(e))for(var t=0;t<e.length;t++){var a=e[t];ie(a)&&xe(a,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var g=G(e);if(typeof g=="function"&&g!==e.entries)for(var h=g.call(e),f;!(f=h.next()).done;)ie(f.value)&&xe(f.value,r)}}}function Rr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===c||r.$$typeof===C))t=r.propTypes;else return;if(t){var a=x(r);sr(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!oe){oe=!0;var g=x(r);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function _r(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){L(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),L(null);break}}e.ref!==null&&(L(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}function De(e,r,t,a,g,h){{var f=er(e);if(!f){var l="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(l+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var w=
|
|
27
|
+
Check the top-level render call using <`+t+">.")}return r}}function xe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=br(r);if(ke[t])return;ke[t]=!0;var a="";e&&e._owner&&e._owner!==ae.current&&(a=" It was passed a child from "+x(e._owner.type)+"."),L(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),L(null)}}function Ae(e,r){{if(typeof e!="object")return;if(te(e))for(var t=0;t<e.length;t++){var a=e[t];ie(a)&&xe(a,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var g=G(e);if(typeof g=="function"&&g!==e.entries)for(var h=g.call(e),f;!(f=h.next()).done;)ie(f.value)&&xe(f.value,r)}}}function Rr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===c||r.$$typeof===C))t=r.propTypes;else return;if(t){var a=x(r);sr(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!oe){oe=!0;var g=x(r);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function _r(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){L(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),L(null);break}}e.ref!==null&&(L(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}function De(e,r,t,a,g,h){{var f=er(e);if(!f){var l="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(l+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var w=yr(g);w?l+=w:l+=Pe();var y;e===null?y="null":te(e)?y="array":e!==void 0&&e.$$typeof===i?(y="<"+(x(e.type)||"Unknown")+" />",l=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,l)}var b=Er(e,r,t,g,h);if(b==null)return b;if(f){var j=r.children;if(j!==void 0)if(a)if(te(j)){for(var M=0;M<j.length;M++)Ae(j[M],e);Object.freeze&&Object.freeze(j)}else p("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 Ae(j,e)}return e===v?_r(b):Rr(b),b}}function Tr(e,r,t){return De(e,r,t,!0)}function wr(e,r,t){return De(e,r,t,!1)}var Cr=wr,Or=Tr;N.Fragment=v,N.jsx=Cr,N.jsxs=Or}()),N}process.env.NODE_ENV==="production"?Z.exports=Ie():Z.exports=Le();var P=Z.exports;const Y=m.createContext({axios:void 0,children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),Me=({axios:n,children:i,translate:d,useAuth:v,Outlet:o,Navigate:s,useLocation:u,useGoogleTagManager:E})=>{const c=m.useMemo(()=>({axios:n,Navigate:s,Outlet:o,translate:d,useAuth:v,useGoogleTagManager:E,useLocation:u}),[s,o,n,d,v,E,u]);return P.jsx(Y.Provider,{value:c,children:i})},B=n=>`RequireAuth require « ${n} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,We=({Fallback:n,loginPath:i="/login",localStorageKey:d="user",redirect401Path:v="/login",...o})=>{var D,F,G,k;const{axios:s=o.axios,useLocation:u=o.useLocation,useAuth:E=o.useAuth,Outlet:c=o.Outlet,Navigate:T=o.Navigate}=m.useContext(Y);if(E===void 0)throw new Error(B("useAuth"));if(u===void 0)throw new Error(B("useLocation"));if(c===void 0)throw new Error(B("Outlet"));if(T===void 0)throw new Error(B("Navigate"));const[_,C]=m.useState(null),{isLogged:S}=E(),O=u();return m.useLayoutEffect(()=>{s==null||s.interceptors.response.use(p=>p,async p=>{var z;return typeof p=="object"&&p&&"response"in p&&p.response&&typeof p.response=="object"&&"status"in p.response&&p.response&&typeof p.response=="object"&&"status"in p.response&&((z=p==null?void 0:p.response)==null?void 0:z.status)===401&&(s.defaults.headers.common.Authorization=null,localStorage.removeItem(d),C(v)),Promise.reject(p)})},[s==null?void 0:s.defaults,s==null?void 0:s.interceptors.response,d,v]),S&&!_?P.jsx(m.Suspense,{fallback:n,children:(F=(D=O.state)==null?void 0:D.from)!=null&&F.state&&((k=(G=O.state)==null?void 0:G.from)==null?void 0:k.pathname)===i?P.jsx(T,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):P.jsx(c,{})}):P.jsx(T,{to:i,state:{from:O},replace:!0})},q=n=>`GTMSendPageView require « ${n} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ne=({...n})=>{const{useLocation:i=n.useLocation,Outlet:d=n.Outlet,useGoogleTagManager:v=n.useGoogleTagManager}=m.useContext(Y);if(i===void 0)throw new Error(q("useLocation"));if(d===void 0)throw new Error(q("Outlet"));if(v===void 0)throw new Error(q("useGoogleTagManager"));const{pathname:o}=i(),{sendEvent:s}=v();return m.useEffect(()=>{s({event:"pageView",pathname:o})},[o,s]),P.jsx(d,{})},Ye=({axios:n,baseURL:i,userLocalStorageKey:d="user",postContentType:v="application/json"})=>(m.useLayoutEffect(()=>{if(!n.defaults)return;const o=localStorage.getItem(d),s=o?JSON.parse(o):null,u=s&&typeof s=="object"&&"tokenType"in s&&s.tokenType?s.tokenType:null,E=s&&typeof s=="object"&&"accessToken"in s&&s.accessToken?s.accessToken:null,c=o?`${u} ${E}`:null;n.defaults.baseURL=i,n.defaults.headers.post["Content-Type"]=v,c&&(n.defaults.headers.common.Authorization=c)},[n.defaults,i,v,d]),null),Ve=({i18n:n,initReactI18next:i,resources:d,LanguageDetector:v})=>(n.use(v).use(i).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{useSuspense:!0},resources:d,returnNull:!1}).then(()=>{document.documentElement.lang!==n.resolvedLanguage&&n.resolvedLanguage&&document.documentElement.setAttribute("lang",n.resolvedLanguage)}),n.on("languageChanged",o=>{document.documentElement.setAttribute("lang",o)}),null),Ue=({dsn:n,sentry:i})=>(m.useLayoutEffect(()=>{process.env.NODE_ENV==="production"&&i.init({dsn:n,integrations:[new i.BrowserTracing],tracesSampleRate:1})},[n,i]),null),Be=({IMaskMixin:n,...i})=>{const d=m.useMemo(()=>n(({TextField:v,...o})=>P.jsx(v,{...o})),[n]);return P.jsx(d,{...i})},Ge=({mapbox:n,accessToken:i})=>(m.useLayoutEffect(()=>{n&&i&&(n.accessToken=i)},[i,n]),null),ze=({children:n,defaultOptions:i,QueryClient:d,QueryClientProvider:v})=>{const o=new d({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,...i}}});return P.jsx(v,{client:o,children:n})},Je=n=>{const{unknownErrorTranslationKey:i="error.unknownError"}=n||{},{translate:d=n==null?void 0:n.translate}=m.useContext(Y);return{printError:m.useCallback(o=>{var E,c,T,_,C,S,O,D,F;const s=d?d(i):"Unknown error",{response:u}=o||{};return o!=null&&o.reason?String(o.reason):(E=u==null?void 0:u.data)!=null&&E.reason?String(u.data.reason):(c=u==null?void 0:u.data)!=null&&c.message?String(u.data.message):(_=(T=u==null?void 0:u.data)==null?void 0:T.detail)!=null&&_.length&&Array.isArray((C=u==null?void 0:u.data)==null?void 0:C.detail)&&((O=(S=u==null?void 0:u.data)==null?void 0:S.detail[0])!=null&&O.msg)&&typeof((F=(D=u==null?void 0:u.data)==null?void 0:D.detail[0])==null?void 0:F.msg)=="string"?String(u.data.detail[0].msg):s},[d,i])}},He=({data:n,fetchNextPage:i,isFetchingNextPage:d,isInitialLoading:v,isLoading:o,enabled:s=!0})=>{const u=m.useCallback(async c=>{d||!s||await i({pageParam:(c==null?void 0:c.pageParam)||c.visibleRowsCount})},[s,i,d]),E=m.useMemo(()=>{if(n)return n.pages.reduce((c,T)=>[...c,...T],[])},[n]);return{fetchNextPageOnRowsScrollEnd:u,isLoading:d||o,loadingVariant:v?"skeleton":"linear",rows:E}},Ke=n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase(),Xe=n=>{const v=n.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("")).join("");return v.charAt(0).toLowerCase()+v.slice(1)},Qe=(n,i,d)=>{const v=Xe(i),o=Ke(d);return`${v}${o}`};R.AxiosConfig=Ye,R.GTMSendPageView=Ne,R.I18nConfig=Ve,R.InjectDependenciesContext=Y,R.InjectDependenciesProvider=Me,R.MapBoxConfig=Ge,R.MaskTextField=Be,R.QueryClientConfigProvider=ze,R.RequireAuth=We,R.SentryConfig=Ue,R.getOrvalOperationName=Qe,R.useInfiniteDataGrid=He,R.useResponseError=Je,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracktor/shared-module",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/react": "^18.2.18",
|
|
43
43
|
"@types/react-dom": "^18.2.7",
|
|
44
44
|
"@vitejs/plugin-react": "^4.0.4",
|
|
45
|
-
"eslint-config-react-tracktor": "^1.
|
|
45
|
+
"eslint-config-react-tracktor": "^1.5.0",
|
|
46
46
|
"husky": "^8.0.3",
|
|
47
47
|
"jsdom": "^21.1.2",
|
|
48
48
|
"typescript": "^4.9.5",
|