@corva/dc-platform-shared 0.59.0 → 0.60.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{useState as e,useRef as o,useEffect as i}from"react";import{get as s}from"lodash";import*as a from"@corva/ui/clients/jsonApi";import{updateUserUnits as u}from"@corva/ui/utils/convert";import c from"../../../../clients/auth0/index.js";import{LOGIN_ROUTE_REG_EXP as m}from"../../../constants/index.js";import{ERRORS as l}from"./constants.js";import{getUserToken as p}from"./api.js";var f=function(t){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})};function d(d){var h=e(null),v=n(h,2),y=v[0],g=v[1],w=e(!0),x=n(w,2),C=x[0],_=x[1],b=e(null),T=n(b,2),U=T[0],j=T[1],A=o(null);function k(){return O.apply(this,arguments)}function O(){return(O=t(r.mark((function t(){var n;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return _(!0),t.next=3,a.getCurrentUser();case 3:(n=t.sent)?(g(n),u({userUnits:n.unit_system,companyUnits:s(n,"company.unit_system"),companyCustomUnitSystem:s(n,"company.custom_unit_system"),userCustomUnitSystem:s(n,"custom_unit_system"),companyCustomUnits:s(n,"company.custom_units")})):d.push("/login"),_(!1);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}A.current||(A.current=new c);var V,E,H=(V=t(r.mark((function t(){var n,e,o,i,s,a,u,c=arguments;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.length>0&&void 0!==c[0]?c[0]:"",e=c.length>1?c[1]:void 0,o=c.length>2?c[2]:void 0,j(null),_(!0),i={auth:e},n&&(i.platform=n),t.prev=7,t.next=10,p(i);case 10:s=t.sent,f({AUTH_TOKEN:s.jwt}),k().then(o),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(7),null!==(a=t.t0.isInvalidVerificationCode)&&void 0!==a&&a.call(t.t0)?j(l.invalidVerificationCode):null!==(u=t.t0.isMissingVerificationCode)&&void 0!==u&&u.call(t.t0)?j(l.missingVerificationCode):j(l.wrongEmailOrPassword);case 18:_(!1);case 19:case"end":return t.stop()}}),t,null,[[7,15]])}))),function(){return V.apply(this,arguments)}),N=(E=t(r.mark((function t(){return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return f({AUTH_TOKEN:""}),t.next=3,a.logout();case 3:d.push("/login");case 4:case"end":return t.stop()}}),t)}))),function(){return E.apply(this,arguments)});return i((function(){if(m.test(d.location.pathname))return _(!1);k()}),[]),{user:y,loading:C,error:U,login:H,logout:N,auth0:A.current}}export{d as default};
|
|
1
|
+
import t from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{useState as e,useRef as o,useEffect as i}from"react";import{get as s}from"lodash";import*as a from"@corva/ui/clients/jsonApi";import{updateUserUnits as u}from"@corva/ui/utils/convert";import c from"../../../../clients/auth0/index.js";import{LOGIN_ROUTE_REG_EXP as m}from"../../../constants/index.js";import{ERRORS as l}from"./constants.js";import{getUserToken as p}from"./api.js";var f=function(t){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})};function d(d){var h=e(null),v=n(h,2),y=v[0],g=v[1],w=e(!0),x=n(w,2),C=x[0],_=x[1],b=e(null),T=n(b,2),U=T[0],j=T[1],A=o(null);function k(){return O.apply(this,arguments)}function O(){return(O=t(r.mark((function t(){var n;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return _(!0),t.next=3,a.getCurrentUser();case 3:(n=t.sent)?(g(n),u({userUnits:n.unit_system,companyUnits:s(n,"company.unit_system"),companyCustomUnitSystem:s(n,"company.custom_unit_system"),userCustomUnitSystem:s(n,"custom_unit_system"),companyCustomUnits:s(n,"company.custom_units")})):d.push("/login"),_(!1);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}A.current||(A.current=new c);var V,E,H=(V=t(r.mark((function t(){var n,e,o,i,s,a,u,c=arguments;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.length>0&&void 0!==c[0]?c[0]:"",e=c.length>1?c[1]:void 0,o=c.length>2?c[2]:void 0,j(null),_(!0),i={auth:e},n&&(i.platform=n),t.prev=7,t.next=10,p(i);case 10:s=t.sent,f({AUTH_TOKEN:s.jwt}),k().then(o),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(7),null!==(a=t.t0.isInvalidVerificationCode)&&void 0!==a&&a.call(t.t0)?j(l.invalidVerificationCode):null!==(u=t.t0.isMissingVerificationCode)&&void 0!==u&&u.call(t.t0)?j(l.missingVerificationCode):j(l.wrongEmailOrPassword);case 18:_(!1);case 19:case"end":return t.stop()}}),t,null,[[7,15]])}))),function(){return V.apply(this,arguments)}),N=(E=t(r.mark((function t(){return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return f({AUTH_TOKEN:""}),t.next=3,a.logout();case 3:d.push("/login");case 4:case"end":return t.stop()}}),t)}))),function(){return E.apply(this,arguments)});return i((function(){if(m.test(d.location.pathname))return _(!1);k()}),[d.location.pathname]),{user:y,loading:C,error:U,login:H,logout:N,auth0:A.current}}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"@babel/runtime/helpers/defineProperty";import e
|
|
1
|
+
import r from"@babel/runtime/helpers/defineProperty";import{useMemo as e}from"react";import{BrowserRouter as t,useHistory as o,useLocation as n,Switch as c,Redirect as p,Route as a}from"react-router-dom";import{LoadingIndicator as i}from"@corva/ui/components";import u from"../screens/LoginScreen/LoginScreen.js";import m from"../screens/OAuthCallbackScreen/index.js";import{useAuth as f}from"../context/auth.js";import s from"../components/App/App.js";import{jsx as l,jsxs as h}from"react/jsx-runtime";function b(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,o)}return t}function O(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?b(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):b(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function d(r){var e=r.WrappedComponent,t=r.componentProps,o=r.router,n=r.location;return f().loading?l(i,{fullscreen:!0}):l(e,O({location:n,router:o},t))}function j(r){var t=r.WrappedComponent,i=r.componentProps,f=o(),b=n(),j=e((function(){return function(r,e){var t,o,n,c=function(r){if("string"==typeof r)return r;var e=r.pathname,t=r.query;return{pathname:e,search:t?"?".concat(new URLSearchParams(t).toString()):""}};return{push:function(e){return r.push(c(e))},replace:function(e){return r.replace(c(e))},location:O(O({},e),{},{query:(t=e.search,o=new URLSearchParams(t),n={},o.forEach((function(r,e){n[e]=r})),n)})}}(f,b)}),[f,b]);return l(s,{router:j,children:h(c,{children:[l(p,{exact:!0,from:"/",to:"/app"}),l(a,{path:"/login/oauth-callback",children:l(m,{router:j})}),l(a,{path:"/login",children:l(u,{router:j,location:j.location})}),l(a,{path:"/app",children:l(d,{WrappedComponent:t,componentProps:i,router:j,location:j.location})})]})})}var y=function(r){return function(e){return l(t,{children:l(j,{WrappedComponent:r,componentProps:e})})}};export{y as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corva/dc-platform-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "A library to share internal DC platform specific code",
|
|
5
5
|
"main": "./dist",
|
|
6
6
|
"module": "./src/index.js",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"build-watch": "./scripts/build.sh development -w",
|
|
16
16
|
"get-changelog": "conventional-changelog -r 2 -p angular",
|
|
17
17
|
"release": "git fetch --tags && git add -A && standard-version -a",
|
|
18
|
+
"generate-css-themes": "echo 'skip: css themes generated by @corva/ui build'",
|
|
18
19
|
"start": "yarn generate-css-themes && cross-env NODE_ENV=local rollup -c -w",
|
|
19
20
|
"test": "jest",
|
|
20
21
|
"test-coverage": "jest --watchAll --coverage && http-serve coverage",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
"react": "17.0.1",
|
|
115
116
|
"react-dom": "17.0.1",
|
|
116
117
|
"react-grid-layout": "1.3.4",
|
|
117
|
-
"react-router": "3.
|
|
118
|
+
"react-router-dom": "^5.3.4",
|
|
118
119
|
"react-sizeme": "2.5.2",
|
|
119
120
|
"rollup-plugin-copy": "^3.4.0",
|
|
120
121
|
"sass": "^1.89.2",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"@corva/ui": "*"
|
|
134
135
|
},
|
|
135
136
|
"devDependencies": {
|
|
136
|
-
"@corva/ui": "3.
|
|
137
|
+
"@corva/ui": "3.53.0-7",
|
|
137
138
|
"@rollup/plugin-babel": "^5.2.1",
|
|
138
139
|
"@rollup/plugin-commonjs": "^15.0.0",
|
|
139
140
|
"@rollup/plugin-image": "^2.0.6",
|