@corva/dc-platform-shared 0.0.0-e60767 → 0.0.0-f1f9034

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.
Files changed (28) hide show
  1. package/CLI/components/App/App.css.js +1 -1
  2. package/CLI/components/App/App.js +1 -1
  3. package/CLI/context/auth.js +1 -1
  4. package/CLI/hocs/effects/useProvideAuth/api.js +1 -0
  5. package/CLI/hocs/effects/useProvideAuth/constants.js +1 -0
  6. package/CLI/hocs/effects/useProvideAuth/useProvideAuth.js +1 -0
  7. package/CLI/hocs/withCLIAppSettingsHOC.js +1 -1
  8. package/CLI/hocs/withCorvaMagicHOC.js +1 -1
  9. package/CLI/hocs/withGridLayoutHOC/withGridLayoutHOC.js +1 -1
  10. package/CLI/screens/LoginScreen/LoginScreen.js +1 -1
  11. package/CLI/screens/LoginScreen/components/Auth.js +1 -1
  12. package/CLI/screens/LoginScreen/components/AuthStep.js +1 -1
  13. package/CLI/screens/LoginScreen/components/EmailStep.js +1 -1
  14. package/CLI/screens/LoginScreen/components/SSOButton.js +1 -1
  15. package/CLI/screens/OAuthCallbackScreen/index.js +1 -1
  16. package/README.md +64 -15
  17. package/cjs/devcenter/webpack/DevServerIsolatedAppEntryPoint.js +1 -1
  18. package/cjs/devcenter/webpack/constants.js +1 -1
  19. package/cjs/devcenter/webpack/webpack.config.common.js +1 -1
  20. package/cjs/devcenter/webpack/webpack.config.dev.js +1 -1
  21. package/cjs/devcenter/webpack/webpack.config.prod.js +1 -1
  22. package/components/AppsGridDragHandle/AppsGridDragHandle.scss.js +1 -1
  23. package/components/GridLockButton/index.js +1 -1
  24. package/components/Login/components/EmailField.js +1 -1
  25. package/components/Login/components/VerificationStep.js +1 -0
  26. package/components/Login/index.js +1 -1
  27. package/package.json +1 -166
  28. package/CLI/hocs/effects/useProvideAuth.js +0 -1
@@ -1 +1 @@
1
- import p from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var t={app:"App_app__szh89",appContent:"App_appContent__ig-1i",pdfAppContent:"App_pdfAppContent__MCvHU",lightAppContent:"App_lightAppContent__7PeHo"};p(".App_app__szh89{display:flex;flex-direction:column;min-height:100%;touch-action:manipulation}.App_appContent__ig-1i{flex-grow:1;padding:10px;position:relative}.App_pdfAppContent__MCvHU{background-color:#fff;padding:30px 0}.App_lightAppContent__7PeHo{background-color:#fff;color:#000}");export{t as default};
1
+ import p from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var t={app:"App_app__szh89",appContent:"App_appContent__ig-1i",pdfAppContent:"App_pdfAppContent__MCvHU",lightAppContent:"App_lightAppContent__7PeHo"};p(".App_app__szh89{background-color:#141414;display:flex;flex-direction:column;min-height:100%;touch-action:manipulation}.App_appContent__ig-1i{flex-grow:1;padding:10px;position:relative}.App_pdfAppContent__MCvHU{background-color:#fff;padding:30px 0}.App_lightAppContent__7PeHo{background-color:#fff;color:#000}");export{t as default};
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/slicedToArray";import{useReducer as o,useEffect as t}from"react";import e from"classnames";import{MuiThemeProvider as i}from"@material-ui/core";import{MuiPickersUtilsProvider as m}from"@material-ui/pickers";import n from"@date-io/moment";import a from"moment";import{isPDFReportView as p}from"@corva/ui/utils/reports";import{LOCAL_STORAGE_APP_THEME_KEY as c}from"@corva/ui/constants/localStorageKeys";import{NotificationsContainer as s}from"@corva/ui/components";import{THEMES as l}from"@corva/ui/constants/theme";import{darkTheme as f,lightTheme as u}from"@corva/ui/config/theme";import{setThemeVariables as d}from"@corva/ui/utils/themeVariables";import{LOGIN_ROUTE_REG_EXP as h}from"../../constants/index.js";import v from"./components/AppBar/AppBar.js";import{AuthContext as A}from"../../context/auth.js";import g from"../../hocs/effects/useProvideAuth.js";import j from"./App.css.js";import{jsx as b,jsxs as x,Fragment as I}from"react/jsx-runtime";function K(K){var C,D=K.children,R=K.router,S=g(R),T=!h.test(R.location.pathname)&&!S.loading,y=o((function(r){return r+1}),0),B=r(y,2)[1],N=null!==(C=localStorage.getItem(c))&&void 0!==C?C:l.DARK,P=!T||!p&&N===l.DARK;t((function(){return d(P)}),[P]);return b(A.Provider,{value:S,children:b(i,{theme:P?f:u,children:b(m,{libInstance:a,utils:n,children:x(I,{children:[!T&&D,T&&x("div",{className:j.app,children:[b(s,{}),b(v,{toggleTheme:function(){localStorage.setItem(c,P?l.LIGHT:l.DARK),B()}}),b("div",{className:e(j.appContent,p&&j.pdfAppContent,!P&&j.lightAppContent),children:D})]})]})})})})}export{K as default};
1
+ import r from"@babel/runtime/helpers/slicedToArray";import{useReducer as o,useEffect as t}from"react";import e from"classnames";import{MuiThemeProvider as i}from"@material-ui/core";import{MuiPickersUtilsProvider as m}from"@material-ui/pickers";import n from"@date-io/moment";import a from"moment";import{isPDFReportView as p}from"@corva/ui/utils/reports";import{LOCAL_STORAGE_APP_THEME_KEY as c}from"@corva/ui/constants/localStorageKeys";import{NotificationsContainer as s}from"@corva/ui/components";import{THEMES as l}from"@corva/ui/constants/theme";import{darkTheme as u,lightTheme as f}from"@corva/ui/config/theme";import{setThemeVariables as d}from"@corva/ui/utils/themeVariables";import{LOGIN_ROUTE_REG_EXP as h}from"../../constants/index.js";import v from"./components/AppBar/AppBar.js";import{AuthContext as A}from"../../context/auth.js";import g from"../../hocs/effects/useProvideAuth/useProvideAuth.js";import j from"./App.css.js";import{jsx as b,jsxs as x,Fragment as I}from"react/jsx-runtime";function K(K){var C,D=K.children,P=K.router,R=g(P),S=!h.test(P.location.pathname)&&!R.loading,T=o((function(r){return r+1}),0),y=r(T,2)[1],B=null!==(C=localStorage.getItem(c))&&void 0!==C?C:l.DARK,N=!S||!p&&B===l.DARK;t((function(){return d(N)}),[N]);return b(A.Provider,{value:R,children:b(i,{theme:N?u:f,children:b(m,{libInstance:a,utils:n,children:x(I,{children:[!S&&D,S&&x("div",{className:j.app,children:[b(s,{}),b(v,{toggleTheme:function(){localStorage.setItem(c,N?l.LIGHT:l.DARK),y()}}),b("div",{className:e(j.appContent,p&&j.pdfAppContent,!N&&j.lightAppContent),children:D})]})]})})})})}export{K as default};
@@ -1 +1 @@
1
- import{createContext as r,useContext as t}from"react";var o=r(),e=function(){return t(o)};export{o as AuthContext,e as useAuth};
1
+ import{createContext as r,useContext as t}from"react";var n=r(null),o=function(){return t(n)};export{n as AuthContext,o as useAuth};
@@ -0,0 +1 @@
1
+ import{post as r}from"@corva/ui/clients/api/apiCore";var e=function(e){return r("/v1/user_token",e)},i=function(e){return r("/v1/sessions/verification/request",e)};export{e as getUserToken,i as requestVerification};
@@ -0,0 +1 @@
1
+ var i={wrongEmailOrPassword:"Wrong user name or password",missingVerificationCode:'"Missing verification code',invalidVerificationCode:"Invalid verification code"};export{i as ERRORS};
@@ -0,0 +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 +1 @@
1
- import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as r}from"react";import{getLocalAppData as n,updateLocalAppData as o}from"./utils.js";import{useAuth as i}from"../context/auth.js";import{jsx as c}from"react/jsx-runtime";function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?s(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var a=function(s){return function(a){var f=i().user,u=a.manifest.application.key,m=r(n(u).settings||{}),b=e(m,2),O=b[0],l=b[1];return c(s,p(p({},a),{},{currentUser:f,settings:O,onSettingChange:function(e,r){var n=p(p({},O||{}),{},t({},e,r));o(u,{settings:n}),l(n)},onSettingsChange:function(t){var e=p(p({},O||{}),t);o(u,{settings:e}),l(e)}}))}};export{a as default};
1
+ import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as r,useEffect as n}from"react";import{getLocalAppData as o,updateLocalAppData as i}from"./utils.js";import{useAuth as c}from"../context/auth.js";import{jsx as u}from"react/jsx-runtime";function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?s(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var p=function(s){return function(p){var a=c().user,m=p.manifest.application.key,b=r(o(m).settings||{}),O=e(b,2),l=O[0],g=O[1];return n((function(){i(m,{settings:l})}),[m,l]),u(s,f(f({},p),{},{currentUser:a,settings:l,onSettingChange:function(e,r){g((function(n){return f(f({},n||{}),{},t({},e,r))}))},onSettingsChange:function(t){g((function(e){return f(f({},e||{}),t)}))}}))}};export{p as default};
@@ -1 +1 @@
1
- import*as o from"@corva/ui";import{ProvidePermissions as r}from"@corva/ui/permissions";import"@corva/ui/styles/index.global.css.js";import"@corva/ui/styles/reactVirtualized.global.css.js";import"@corva/ui/styles/emojiMart.global.css.js";import"@corva/ui/styles/mapbox.global.css.js";import"@corva/ui/styles/lightbox.global.css.js";import"@corva/ui/styles/generatedThemesVariables.global.css.js";import"@corva/ui/styles/customScrollbars.global.css.js";import"@corva/ui/config/initGlobalDependencies";import{isPDFReportView as t}from"@corva/ui/utils/reports";import s from"./withAppDataProviderHOC.js";import i from"./withCLIAppSettingsHOC.js";import a from"./withReactRouterHOC.js";import e from"./withGridLayoutHOC/withGridLayoutHOC.js";import m from"./withPDFLayoutHOC.js";import{withDevCenterRouterHOC as p}from"./withDevCenterRouterHOC.js";import{jsx as c}from"react/jsx-runtime";window["@corva/ui"]=o;var l=function(o){var l=o.component,n=o.settings,u=o.manifest,v=o.packageJson;return function(){var o=i(s({CLIAppComponent:l,CLIAppSettings:n,packageJson:v})),f=t?m(o):e(o),g=a(p(f));return c(r,{children:c(g,{manifest:u,dashboardProps:{}})})}};export{l as default};
1
+ import*as o from"@corva/ui";import{ProvidePermissions as r}from"@corva/ui/permissions";import"@corva/ui/styles/index.global.css.js";import"@corva/ui/styles/reactVirtualized.global.css.js";import"@corva/ui/styles/emojiMart.global.css.js";import"@corva/ui/styles/mapbox.global.css.js";import"@corva/ui/styles/lightbox.global.css.js";import"@corva/ui/styles/generatedThemesVariables.global.css.js";import"@corva/ui/styles/customScrollbars.global.css.js";import{initGlobalDependencies as t}from"@corva/ui/config/initGlobalDependencies";import{isPDFReportView as s}from"@corva/ui/utils/reports";import i from"./withAppDataProviderHOC.js";import a from"./withCLIAppSettingsHOC.js";import e from"./withReactRouterHOC.js";import m from"./withGridLayoutHOC/withGridLayoutHOC.js";import p from"./withPDFLayoutHOC.js";import{withDevCenterRouterHOC as c}from"./withDevCenterRouterHOC.js";import{jsx as l}from"react/jsx-runtime";window["@corva/ui"]=o,t();var n=function(o){var t=o.component,n=o.settings,u=o.manifest,f=o.packageJson;return function(){var o=a(i({CLIAppComponent:t,CLIAppSettings:n,packageJson:f})),v=s?p(o):m(o),g=e(c(v));return l(r,{children:l(g,{manifest:u,dashboardProps:{}})})}};export{n as default};
@@ -1 +1 @@
1
- import o from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{useState as r}from"react";import{WidthProvider as i,Responsive as n}from"react-grid-layout";import{pick as s}from"lodash";import{withSize as p}from"react-sizeme";import{isPhoneDetected as a,isNativeDetected as m,isMobileDetected as c}from"@corva/ui/utils/mobileDetect";import{getAppSize as l}from"@corva/ui/utils/apps";import{GRID_BREAKPOINTS as d,GRID_COLUMN_SIZES as g,GRID_ROW_HEIGHT as u,NON_DRAGGABLE_ELEMENT_SELECTOR as f}from"@corva/ui/constants/apps";import"../../../components/Login/components/Login.js";import"../../../components/Login/components/PasswordField.js";import"../../../components/Login/components/Chip.js";import"../../../components/Login/components/StepFooter.js";import"../../../components/Login/components/StepContent.js";import"../../../components/Login/components/StepHeader.js";import"../../../components/Login/components/Step.js";import"../../../components/Login/components/OrDivider.js";import"../../../components/Login/components/HiddenEmailField.js";import"../../../components/Login/components/EmailField.js";import{AppsGridDragHandle as b}from"../../../components/AppsGridDragHandle/AppsGridDragHandle.js";import h from"../../../components/GridLockButton/index.js";import{isAppMaximized as j}from"../../../utils/devcenter.js";import"../../../utils/recaptcha.js";import{getLocalAppData as y,getAppCoordinates as O,updateLocalAppData as v}from"../utils.js";import"./withGridLayoutHOC.global.css.js";import D from"./withGridLayoutHOC.css.js";import{jsxs as L,jsx as w}from"react/jsx-runtime";var P=["size"];function S(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.push.apply(t,r)}return t}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))}))}return e}var x=".".concat(b.GRID_LAYOUT_DRAG_HANDLE_CLASS),C=i(n),z=function(o){return p()((function(i){var n,p=i.size,S=t(i,P),z=p.width,A=S.manifest.application.key,G=r(null!==(n=y(A).isDraggable)&&void 0!==n&&n),R=e(G,2),E=R[0],k=R[1],F=m||c,M=j(S.devCenterRouter.location.query),W=r(O(S.manifest)),_=e(W,2),N=_[0],T=_[1],B=l({coordinates:N,dashboardWidth:z,isMaximized:M}),q=B.pixelHeight,I=B.pixelWidth,U=function(o){var t=e(o,1)[0],r=s(t,["x","y","w","h"]);T(r),v(A,{coordinates:r})};return L("div",{children:[w(C,{breakpoints:a?d.phone:d.general,cols:g,rowHeight:u,measureBeforeMount:!0,onResizeStop:U,onDragStop:U,isDraggable:!F&&E,isResizable:!F&&E,draggableCancel:f,useCSSTransforms:!1,draggableHandle:x,children:w("div",{"data-grid":N,children:L("div",{className:M?D.appMaximized:"",children:[w(o,H(H({},S),{},{coordinates:H(H({},N),{},{pixelHeight:q,pixelWidth:I}),layoutEnvironment:{type:"general",pdfReportMode:!1}})),!F&&E&&w(b,{})]})},"with-grid-layout-hoc")}),w(h,{isDraggableAndResizable:E,onClick:function(){k(!E),v(A,{isDraggable:!E})},pageName:"DashboardPo"})]})}))};export{z as default};
1
+ import o from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{useState as r}from"react";import{WidthProvider as i,Responsive as n}from"react-grid-layout";import{pick as s,cloneDeep as p}from"lodash";import{withSize as a}from"react-sizeme";import{isPhoneDetected as m,isNativeDetected as c,isMobileDetected as l}from"@corva/ui/utils/mobileDetect";import{getAppSize as d}from"@corva/ui/utils/apps";import{GRID_BREAKPOINTS as u,GRID_COLUMN_SIZES as g,GRID_ROW_HEIGHT as f,NON_DRAGGABLE_ELEMENT_SELECTOR as b}from"@corva/ui/constants/apps";import"../../../components/Login/components/Chip.js";import"../../../components/Login/components/EmailField.js";import"../../../components/Login/components/HiddenEmailField.js";import"../../../components/Login/components/Login.js";import"../../../components/Login/components/OrDivider.js";import"../../../components/Login/components/PasswordField.js";import"../../../components/Login/components/Step.js";import"../../../components/Login/components/StepContent.js";import"../../../components/Login/components/StepFooter.js";import"../../../components/Login/components/StepHeader.js";import"../../../components/Login/components/VerificationStep.js";import{AppsGridDragHandle as h}from"../../../components/AppsGridDragHandle/AppsGridDragHandle.js";import j from"../../../components/GridLockButton/index.js";import{isAppMaximized as y}from"../../../utils/devcenter.js";import"../../../utils/recaptcha.js";import{getLocalAppData as O,getAppCoordinates as v,updateLocalAppData as L}from"../utils.js";import"./withGridLayoutHOC.global.css.js";import D from"./withGridLayoutHOC.css.js";import{jsxs as w,jsx as S}from"react/jsx-runtime";var P=["size"];function H(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.push.apply(t,r)}return t}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))}))}return e}var C=".".concat(h.GRID_LAYOUT_DRAG_HANDLE_CLASS),z=i(n),A=function(o){return a()((function(i){var n,a=i.size,H=t(i,P),A=a.width,G=H.manifest.application.key,R=r(null!==(n=O(G).isDraggable)&&void 0!==n&&n),E=e(R,2),k=E[0],F=E[1],M=c||l,W=y(H.devCenterRouter.location.query),_=r(v(H.manifest)),N=e(_,2),T=N[0],B=N[1],q=d({coordinates:T,dashboardWidth:A,isMaximized:W}),I=q.pixelHeight,U=q.pixelWidth,V=function(o){var t=e(o,1)[0],r=s(t,["x","y","w","h"]);B(r),L(G,{coordinates:r})},Y=r({}),J=e(Y,2),K=J[0],Q=J[1];return w("div",{children:[S(z,{breakpoints:m?u.phone:u.general,cols:g,rowHeight:f,measureBeforeMount:!0,onResizeStop:V,onDragStop:V,isDraggable:!M&&k,isResizable:!M&&k,draggableCancel:b,useCSSTransforms:!1,draggableHandle:C,onLayoutChange:function(o,e){o===e.small?Q(e):Q(x(x({},K),{},{medium:p(o),large:p(o)}))},layouts:K,children:S("div",{"data-grid":T,children:w("div",{className:W?D.appMaximized:"",children:[S(o,x(x({},H),{},{coordinates:x(x({},T),{},{pixelHeight:I,pixelWidth:U}),layoutEnvironment:{type:"general",pdfReportMode:!1}})),!M&&k&&S(h,{})]})},"with-grid-layout-hoc")}),S(j,{isDraggableAndResizable:k,onClick:function(){F(!k),L(G,{isDraggable:!k})},pageName:"DashboardPo"})]})}))};export{A as default};
@@ -1 +1 @@
1
- import o from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/regenerator";import{useEffect as e}from"react";import{getCurrentUser as t}from"@corva/ui/clients/jsonApi";import r from"../../../components/Login/components/Login.js";import"../../../components/Login/components/PasswordField.js";import"../../../components/Login/components/Chip.js";import"../../../components/Login/components/StepFooter.js";import"../../../components/Login/components/StepContent.js";import"../../../components/Login/components/StepHeader.js";import"../../../components/Login/components/Step.js";import"../../../components/Login/components/OrDivider.js";import"../../../components/Login/components/HiddenEmailField.js";import"../../../components/Login/components/EmailField.js";import i from"./components/Auth.js";import p from"./components/IconLogo.js";import s from"./LoginScreen.css.js";import{jsx as m}from"react/jsx-runtime";function c(c){var a=c.router,l=c.location;return e((function(){function e(){return(e=o(n.mark((function o(){var e;return n.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return e=null,o.prev=1,o.next=4,t();case 4:e=o.sent,o.next=10;break;case 7:o.prev=7,o.t0=o.catch(1),console.error(o.t0);case 10:e&&a.replace("/");case 11:case"end":return o.stop()}}),o,null,[[1,7]])})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]),m("div",{className:s.loginScreen,children:m(r,{location:l,logoIcon:m(p,{}),promoLink:"https://youtu.be/-q6LkceqpGs",children:m(i,{router:a})})})}export{c as default};
1
+ import o from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/regenerator";import{useEffect as t}from"react";import{getCurrentUser as e}from"@corva/ui/clients/jsonApi";import"../../../components/Login/components/Chip.js";import"../../../components/Login/components/EmailField.js";import"../../../components/Login/components/HiddenEmailField.js";import r from"../../../components/Login/components/Login.js";import"../../../components/Login/components/OrDivider.js";import"../../../components/Login/components/PasswordField.js";import"../../../components/Login/components/Step.js";import"../../../components/Login/components/StepContent.js";import"../../../components/Login/components/StepFooter.js";import"../../../components/Login/components/StepHeader.js";import"../../../components/Login/components/VerificationStep.js";import i from"./components/Auth.js";import p from"./components/IconLogo.js";import s from"./LoginScreen.css.js";import{jsx as m}from"react/jsx-runtime";function c(c){var a=c.router,l=c.location;return t((function(){function t(){return(t=o(n.mark((function o(){var t;return n.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return t=null,o.prev=1,o.next=4,e();case 4:t=o.sent,o.next=10;break;case 7:o.prev=7,o.t0=o.catch(1),console.error(o.t0);case 10:t&&a.replace("/");case 11:case"end":return o.stop()}}),o,null,[[1,7]])})))).apply(this,arguments)}!function(){t.apply(this,arguments)}()}),[]),m("div",{className:s.loginScreen,children:m(r,{location:l,logoIcon:m(p,{}),promoLink:"https://youtu.be/-q6LkceqpGs",children:m(i,{router:a})})})}export{c as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as t}from"react";import r from"./EmailStep.js";import n from"./AuthStep.js";import{jsx as s}from"react/jsx-runtime";function i(i){var m=i.router,o=t({email:null,schemas:null,step:0}),u=e(o,2),a=u[0],l=u[1];return 0===a.step?s(r,{onNext:function(e,t){return l((function(r){return{step:r.step+1,email:e,schemas:t}}))}}):s(n,{email:a.email,schemas:a.schemas,onBack:function(){return l((function(e){return{step:e.step-1,email:null,schemas:null}}))},onFinishLogin:function(){return m.push("/")}})}export{i as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as t}from"react";import r from"./EmailStep.js";import i from"./AuthStep.js";import{jsx as n}from"react/jsx-runtime";function s(s){var m=s.router,o=t({email:null,schemas:{},step:0}),a=e(o,2),u=a[0],c=a[1];return 0===u.step?n(r,{onNext:function(e,t){return c((function(r){return{step:r.step+1,email:e,schemas:t}}))}}):n(i,{email:u.email,schemas:u.schemas.schemas,identityVerification:u.schemas.identity_verification,onBack:function(){return c((function(e){return{step:e.step-1,email:null,schemas:null}}))},onFinishLogin:function(){return m.push("/")}})}export{s as default};
@@ -1 +1 @@
1
- import n from"@babel/runtime/helpers/asyncToGenerator";import o from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{memo as t,useState as e,useEffect as i}from"react";import a from"prop-types";import{styled as c,Grid as m,Button as p}from"@material-ui/core";import{showErrorNotification as s}from"@corva/ui/utils";import{initializeRecaptcha as u,GOOGLE_RECAPTCHA_KEY as l}from"../../../../utils/recaptcha.js";import"../../../../components/Login/components/Login.js";import d from"../../../../components/Login/components/PasswordField.js";import f from"../../../../components/Login/components/Chip.js";import g from"../../../../components/Login/components/StepFooter.js";import h from"../../../../components/Login/components/StepContent.js";import v from"../../../../components/Login/components/StepHeader.js";import b from"../../../../components/Login/components/Step.js";import w from"../../../../components/Login/components/OrDivider.js";import j from"../../../../components/Login/components/HiddenEmailField.js";import"../../../../components/Login/components/EmailField.js";import{useAuth as L}from"../../../context/auth.js";import{NEED_HELP_EXTERNAL_LINK as y}from"../../../constants/index.js";import k from"./SSOButton.js";import{jsxs as S,jsx as x}from"react/jsx-runtime";var B=c(m)((function(n){var o=n.theme;return{marginTop:2*o.spacing(1),marginBottom:2*o.spacing(1),"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0}}})),C=c(p)((function(n){var o=n.theme;return{width:71,padding:o.spacing(),whiteSpace:"nowrap",backgroundColor:o.status.loginButton,"&:hover":{backgroundColor:"".concat(o.status.loginButtonHovered)}}}));function F(t){var a=t.email,c=t.schemas,p=t.onBack,F=t.onFinishLogin,T=L(),q=e(""),H=o(q,2),R=H[0],E=H[1],I=e(!1),O=o(I,2),P=O[0],z=O[1],A=P?T.error:null;i((function(){u()}),[]);var D,_=(D=n(r.mark((function n(o){return r.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(o.preventDefault(),window.grecaptcha){n.next=3;break}return n.abrupt("return",s("Problem with initializing recaptcha"));case 3:return n.abrupt("return",window.grecaptcha.enterprise.ready((function(){try{window.grecaptcha.enterprise.execute(l,{action:"login"}).then((function(n){T.login({email:a,password:R,recaptcha_token:n},F).then((function(){z(!0)}))})).catch((function(n){return console.error(n)}))}catch(n){console.error(n),s(n.message)}})));case 4:case"end":return n.stop()}}),n)}))),function(n){return D.apply(this,arguments)}),G=c.find((function(n){return"password"===n.provider})),M=c.filter((function(n){return"password"!==n.provider}));return S(b,{children:[x(v,{children:"Sign In"}),x(h,{children:S(m,{container:!0,direction:"column",children:[x(f,{"data-not-migrated-MuiChip":!0,label:a,onClick:p}),M.map((function(n){return x(B,{item:!0,children:x(k,{title:n.title,provider:n.provider,connection:n.connection,auth0:T.auth0})},n.title)})),G&&M.length>0&&x(m,{item:!0,children:x(w,{})}),G&&x(B,{item:!0,children:S("form",{id:"sign-in-form",onSubmit:_,children:[x(j,{email:a}),x(d,{value:R,onChange:function(n){E(n.target.value),z(!1)},disabled:T.loading,error:A})]})})]})}),x(g,{needHelpExternalLink:y,children:G&&x(C,{"data-testid":"".concat("AuthorizationPo","_signInButton"),form:"sign-in-form",type:"submit",variant:"contained",color:"primary",disabled:!R||T.loading||!!A,onClick:_,children:"Sign In"})})]})}F.propTypes={email:a.string.isRequired,schemas:a.arrayOf(a.shape({})).isRequired,onBack:a.func.isRequired,onFinishLogin:a.func.isRequired};var T=t(F);export{T as default};
1
+ import o from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{memo as e,useState as t,useRef as i,useEffect as a}from"react";import{styled as c,Grid as m,Button as s}from"@material-ui/core";import{showErrorNotification as p}from"@corva/ui/utils";import{isSSOPlatformSupported as l}from"@corva/ui/clients/sso";import{initializeRecaptcha as d,GOOGLE_RECAPTCHA_KEY as u}from"../../../../utils/recaptcha.js";import f from"../../../../components/Login/components/Chip.js";import"../../../../components/Login/components/EmailField.js";import g from"../../../../components/Login/components/HiddenEmailField.js";import"../../../../components/Login/components/Login.js";import h from"../../../../components/Login/components/OrDivider.js";import v from"../../../../components/Login/components/PasswordField.js";import w from"../../../../components/Login/components/Step.js";import b from"../../../../components/Login/components/StepContent.js";import j from"../../../../components/Login/components/StepFooter.js";import L from"../../../../components/Login/components/StepHeader.js";import{VerificationStep as y}from"../../../../components/Login/components/VerificationStep.js";import{useAuth as S}from"../../../context/auth.js";import{NEED_HELP_EXTERNAL_LINK as k}from"../../../constants/index.js";import{ERRORS as C}from"../../../hocs/effects/useProvideAuth/constants.js";import{requestVerification as x}from"../../../hocs/effects/useProvideAuth/api.js";import B from"./SSOButton.js";import{jsx as P,jsxs as _}from"react/jsx-runtime";var F=c(m)((function(o){var n=o.theme;return{marginTop:2*n.spacing(1),marginBottom:2*n.spacing(1),"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0}}})),V=c(s)((function(o){var n=o.theme;return{width:71,padding:n.spacing(),whiteSpace:"nowrap",backgroundColor:n.status.loginButton,"&:hover":{backgroundColor:"".concat(n.status.loginButtonHovered)}}}));var T=e((function(e){var c=e.email,s=e.schemas,T=e.onBack,A=e.onFinishLogin,E=e.identityVerification,H=S(),I=t(""),O=n(I,2),z=O[0],D=O[1],q=t(!1),G=n(q,2),M=G[0],J=G[1],K=t({code:null,mode:null}),N=n(K,2),Q=N[0],R=N[1],U=i(null),W=M&&H.error===C.wrongEmailOrPassword?H.error:null;a((function(){d()}),[]);var X,Y=function(o){if(!o)return p("Problem with initializing recaptcha");U.current=o;var n={email:c,password:z,recaptcha_token:o};Q.code&&(n.verification_code=Q.code,n.verification_mode=Q.mode),H.login(null,n,A).then((function(){return J(!0)}))},Z=(X=o(r.mark((function o(n){var e;return r.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(n.preventDefault(),window.grecaptcha){o.next=3;break}return o.abrupt("return",Y());case 3:return e=!1,window.grecaptcha.enterprise.ready((function(){e=!0;try{window.grecaptcha.enterprise.execute(u,{action:"login"}).then(Y).catch(console.error)}catch(o){console.error(o),p(o.message)}})),o.abrupt("return",setTimeout((function(){e||Y()}),1e3));case 6:case"end":return o.stop()}}),o)}))),function(o){return X.apply(this,arguments)});a((function(){if(Q.code){var o={email:c,password:z,recaptcha_token:U.current};Q.code&&(o.verification_code=Q.code,o.verification_mode=Q.mode),H.login(null,o,A)}}),[Q.code]);var $=s.find((function(o){return"password"===o.provider})),oo=s.filter((function(o){var n;return"password"!==o.provider&&l(null==o||null===(n=o.platform)||void 0===n?void 0:n.identifier)}));return M&&null!=E&&E.enabled&&!W?P(y,{email:c,identityVerification:E,loginVerificationFailure:H.error===C.invalidVerificationCode,onCodeProvided:R,password:z,requestVerification:x}):_(w,{children:[P(L,{children:"Sign In"}),P(b,{children:_(m,{container:!0,direction:"column",children:[P(f,{"data-not-migrated-MuiChip":!0,label:c,onClick:T}),oo.map((function(o){return P(F,{item:!0,children:P(B,{title:o.title,provider:o.provider,connection:o.connection,platform:o.platform})},o.title)})),$&&oo.length>0&&P(m,{item:!0,children:P(h,{})}),$&&P(F,{item:!0,children:_("form",{id:"sign-in-form",onSubmit:Z,children:[P(g,{email:c}),P(v,{value:z,onChange:function(o){D(o.target.value),J(!1)},disabled:H.loading,error:W})]})})]})}),P(j,{needHelpExternalLink:k,children:$&&P(V,{"data-testid":"".concat("AuthorizationPo","_signInButton"),form:"sign-in-form",type:"submit",variant:"contained",color:"primary",disabled:!z||H.loading||!!W,onClick:Z,children:"Sign In"})})]})}));export{T as default};
@@ -1 +1 @@
1
- import o from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import{memo as t,useState as r}from"react";import i from"prop-types";import{styled as m}from"@material-ui/core/styles";import p from"@material-ui/core/Button";import{getUserAuthSchemas as s}from"@corva/ui/clients/jsonApi";import"../../../../components/Login/components/Login.js";import"../../../../components/Login/components/PasswordField.js";import"../../../../components/Login/components/Chip.js";import a from"../../../../components/Login/components/StepFooter.js";import c from"../../../../components/Login/components/StepContent.js";import l from"../../../../components/Login/components/StepHeader.js";import u from"../../../../components/Login/components/Step.js";import"../../../../components/Login/components/OrDivider.js";import"../../../../components/Login/components/HiddenEmailField.js";import d from"../../../../components/Login/components/EmailField.js";import{NEED_HELP_EXTERNAL_LINK as f}from"../../../constants/index.js";import{jsxs as g,jsx as h}from"react/jsx-runtime";var v=m(p)((function(o){var n=o.theme;return{width:71,padding:n.spacing(),backgroundColor:n.status.loginButton,"&:hover":{backgroundColor:"".concat(n.status.loginButtonHovered)}}}));function b(t){var i,m=t.onNext,p=r(!1),b=n(p,2),j=b[0],L=b[1],x=r(null),y=n(x,2),C=y[0],k=y[1],S=r(""),w=n(S,2),B=w[0],E=w[1],F=(i=o(e.mark((function o(n){var t;return e.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return L(!0),o.prev=1,o.next=4,s(n);case 4:t=o.sent,L(!1),m(n,t.schemas),o.next=13;break;case 9:o.prev=9,o.t0=o.catch(1),L(!1),k("Invalid email");case 13:case"end":return o.stop()}}),o,null,[[1,9]])}))),function(o){return i.apply(this,arguments)}),H=function(o){o.preventDefault(),B?F(B):k("Required")};return g(u,{children:[h(l,{children:"Sign In"}),h(c,{children:h("form",{id:"email-form",onSubmit:H,autoComplete:"on",children:h(d,{value:B,onChange:function(o){E(o.target.value),k(null)},disabled:!!j,error:C})})}),h(a,{needHelpExternalLink:f,children:h(v,{"data-testid":"EmailPo_nextButton",form:"email-form",type:"submit",variant:"contained",color:"primary",disabled:j||!!C,onClick:H,children:"Next"})})]})}b.propTypes={onNext:i.func.isRequired};var j=t(b);export{j as default};
1
+ import o from"@babel/runtime/helpers/slicedToArray";import{memo as n,useState as t}from"react";import{styled as e}from"@material-ui/core/styles";import i from"@material-ui/core/Button";import{getUserAuthSchemas as r}from"@corva/ui/clients/jsonApi";import"../../../../components/Login/components/Chip.js";import m from"../../../../components/Login/components/EmailField.js";import"../../../../components/Login/components/HiddenEmailField.js";import"../../../../components/Login/components/Login.js";import"../../../../components/Login/components/OrDivider.js";import"../../../../components/Login/components/PasswordField.js";import p from"../../../../components/Login/components/Step.js";import s from"../../../../components/Login/components/StepContent.js";import c from"../../../../components/Login/components/StepFooter.js";import a from"../../../../components/Login/components/StepHeader.js";import"../../../../components/Login/components/VerificationStep.js";import{NEED_HELP_EXTERNAL_LINK as l}from"../../../constants/index.js";import{jsxs as u,jsx as d}from"react/jsx-runtime";var f=e(i)((function(o){var n=o.theme;return{width:71,padding:n.spacing(),backgroundColor:n.status.loginButton,"&:hover":{backgroundColor:"".concat(n.status.loginButtonHovered)}}}));var g=n((function(n){var e=n.onNext,i=t(!1),g=o(i,2),h=g[0],j=g[1],v=t(null),L=o(v,2),b=L[0],x=L[1],C=t(""),S=o(C,2),y=S[0],k=S[1],B=function(o){if(o.preventDefault(),!y)return x("Required");j(!0),r({email:y,with_provider:!0}).then((function(o){return e(y,o)})).catch((function(){return x("Invalid email")})).finally((function(){return j(!1)}))};return u(p,{children:[d(a,{children:"Sign In"}),d(s,{children:d("form",{id:"email-form",onSubmit:B,autoComplete:"on",children:d(m,{value:y,onChange:function(o){k(o.target.value),x(null)},disabled:!!h,error:b})})}),d(c,{needHelpExternalLink:l,children:d(f,{"data-testid":"EmailPo_nextButton",form:"email-form",type:"submit",variant:"contained",color:"primary",disabled:h||!!b,onClick:B,children:"Next"})})]})}));export{g as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as r}from"react";import{withStyles as t,ButtonBase as o,Grid as i,Avatar as a,Typography as n,CircularProgress as l}from"@material-ui/core";import{jsx as s,jsxs as c}from"react/jsx-runtime";var d={google:"/static/media/55de612562c712e3a9d6ea86000e18c7.svg",microsoft:"/static/media/319d9b9a39d511547cf55d1336a8eca4.svg"};var m=t((function(e){return{button:{width:"100%",height:56,fontSize:16,fontWeight:400,color:"#fff",display:"inline-flex",padding:0,alignItems:"center",justifyContent:"flex-start",whiteSpace:"nowrap",borderRadius:4,borderWidth:1,borderStyle:"solid",borderColor:"#616161",textDecoration:"none","&:hover":{borderColor:e.status.loginButton}},logo:{height:30,width:30,margin:12},avatar:{height:30,width:30,margin:12,color:"#ffffff",backgroundColor:e.status.loginButton},progressRoot:{margin:"12px 24px"},progressColor:{color:e.status.loginButton}}}))((function(t){var m=t.connection,f=t.title,g=t.provider,h=t.auth0,u=t.classes,p=r(!1),b=e(p,2),v=b[0],y=b[1],C=d[g];return s(o,{className:u.button,onClick:function(e){e.preventDefault(),v||(y(!0),h.loginWithConnection(m))},children:c(i,{container:!0,justify:"space-between",alignItems:"center",children:[s(i,{item:!0,children:c(i,{container:!0,justify:"flex-start",alignItems:"center",children:[s(i,{item:!0,children:C?s("img",{className:u.logo,src:C,alt:f}):s(a,{className:u.avatar,children:f&&f[0].toUpperCase()})}),s(i,{item:!0,children:s(n,{variant:"body2",children:f})})]})}),s(i,{item:!0,children:v&&s(l,{classes:{root:u.progressRoot,colorPrimary:u.progressColor},color:"primary",size:30})})]})})}));export{m as default};
1
+ import r from"@babel/runtime/helpers/slicedToArray";import{useState as e}from"react";import{withStyles as t,ButtonBase as o,Grid as i,Avatar as a,Typography as n,CircularProgress as s}from"@material-ui/core";import{getSSOProvider as l}from"@corva/ui/clients/sso";import{jsx as c,jsxs as d}from"react/jsx-runtime";var f={google:"/static/media/55de612562c712e3a9d6ea86000e18c7.svg",microsoft:"/static/media/319d9b9a39d511547cf55d1336a8eca4.svg"};var m=t((function(r){return{button:{width:"100%",height:56,fontSize:16,fontWeight:400,color:"#fff",display:"inline-flex",padding:0,alignItems:"center",justifyContent:"flex-start",whiteSpace:"nowrap",borderRadius:4,borderWidth:1,borderStyle:"solid",borderColor:"#616161",textDecoration:"none","&:hover":{borderColor:r.status.loginButton}},logo:{height:30,width:30,margin:12},avatar:{height:30,width:30,margin:12,color:"#ffffff",backgroundColor:r.status.loginButton},progressRoot:{margin:"12px 24px"},progressColor:{color:r.status.loginButton}}}))((function(t){var m=t.platform,g=t.connection,u=t.title,p=t.provider,h=t.classes,b=e(!1),v=r(b,2),y=v[0],x=v[1],C=f[p];return c(o,{className:h.button,onClick:function(r){if(r.preventDefault(),!y){x(!0),localStorage.setItem("ssoPlatform",m.identifier);var e=l(m.identifier);e.configure(m.options),e.authorize(g)}},children:d(i,{container:!0,justify:"space-between",alignItems:"center",children:[c(i,{item:!0,children:d(i,{container:!0,justify:"flex-start",alignItems:"center",children:[c(i,{item:!0,children:C?c("img",{className:h.logo,src:C,alt:u}):c(a,{className:h.avatar,children:u&&u[0].toUpperCase()})}),c(i,{item:!0,children:c(n,{variant:"body2",children:u})})]})}),c(i,{item:!0,children:y&&c(s,{classes:{root:h.progressRoot,colorPrimary:h.progressColor},color:"primary",size:30})})]})})}));export{m as default};
@@ -1 +1 @@
1
- import{useEffect as o}from"react";import{LoadingIndicator as t}from"@corva/ui/components";import{showErrorNotification as n}from"@corva/ui/utils";import{useAuth as r}from"../../context/auth.js";import{jsx as u}from"react/jsx-runtime";function e(e){var i=e.router,c=r(),a=c.login,s=c.auth0;return o((function(){s.handleAuthentication((function(o){return a({token:o.accessToken},(function(){return i.push("/")}))}),(function(){n("Sorry, but we couldn’t log you in. Please contact Corva support if you need assistance"),i.push("/login")}))}),[]),u(t,{fullscreen:!1})}export{e as default};
1
+ import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{useEffect as e}from"react";import{LoadingIndicator as o}from"@corva/ui/components";import{showErrorNotification as n}from"@corva/ui/utils";import{getUserAuthPlatform as i}from"@corva/ui/clients/jsonApi";import{getSSOProvider as a}from"@corva/ui/clients/sso";import{useAuth as u}from"../../context/auth.js";import{jsx as c}from"react/jsx-runtime";function s(s){var f,m=s.router,p=u().login,l=function(r,t){p(r,{token:t},(function(){return m.push("/")}))},v=function(r){console.error(r),n("Sorry, but we couldn’t log you in. Please contact Corva support if you need assistance"),m.push("/login")},b=(f=r(t.mark((function r(){var e,o,n,u,c;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e=localStorage.getItem("ssoPlatform"),localStorage.removeItem("ssoPlatform"),r.next=4,i(e);case 4:if(o=r.sent,n=o.platform,u=a(n.identifier)){r.next=9;break}return r.abrupt("return",v("No authentication platform found for ".concat(n.identifier)));case 9:return r.prev=9,u.configure(n.options),r.next=13,u.authenticate();case 13:return c=r.sent,r.abrupt("return",l(n.identifier,c));case 17:return r.prev=17,r.t0=r.catch(9),r.abrupt("return",v(r.t0));case 20:case"end":return r.stop()}}),r,null,[[9,17]])}))),function(){return f.apply(this,arguments)});return e((function(){b()}),[]),c(o,{fullscreen:!1})}export{s as default};
package/README.md CHANGED
@@ -1,27 +1,76 @@
1
1
  # corva-dc-platform-shared
2
+
2
3
  A repository to share Dev Center platform code
3
4
 
4
- ## Instalation steps
5
- Clone this repository and run `yarn` inside the directory. On postinstall git hooks would be configured for this repository.
5
+ # Contributing Guide
6
+
7
+ ## Quick Start
8
+
9
+ 1. **Branch Setup**
10
+
11
+ ```bash
12
+ git checkout develop
13
+ git pull
14
+ git checkout -b feature/your-feature # or fix/your-fix
15
+ ```
16
+
17
+ 2. **Development**
18
+
19
+ - Write code
20
+ - Add tests
21
+ - Run:
22
+ ```bash
23
+ yarn install
24
+ yarn lint
25
+ yarn test
26
+ ```
27
+
28
+ 3. **Create PR**
29
+ - Push to your branch
30
+ - Create PR to `develop`
31
+ - PR title must follow conventional commits:
32
+ ```
33
+ feat: add user authentication
34
+ fix: resolve login error
35
+ feat!: change API response format
36
+ ```
37
+
38
+ ## Branch Strategy
6
39
 
7
- ## Development flow
8
- To develop new feature or implement fix one need to create new branch from `main` one and name it properly: branch-type/JIRA_ID-jira_ticket_description i.e.
9
- * `feature/DC-1234-add-Table-component`
10
- * `fix/DR-9999-fix-broken-page`
40
+ - `develop` - main development branch
41
+ - `feature/*` - new features
42
+ - `fix/*` - bug fixes
43
+ - No direct commits to `develop`
11
44
 
12
- When changes are ready please create commit with meaningful description using [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). Commit message should have form `commit-type(JIRA_ID): commit message`. All types of commits could be found [here](./git-conventional-commits.json)
45
+ ## Release Process
13
46
 
14
- Please note that `feat` and `fix` commits messages will be used during automatic changelog creation while `chore`, `docs` and others will not.
47
+ 1. Get your PR merged to `develop`
48
+ 2. Release Please automatically:
49
+ - Creates release PR
50
+ - Updates version based on commits
51
+ - Generates changelog
52
+ 3. Merge the Release Please PR
53
+ 4. System automatically:
54
+ - Creates git tag
55
+ - Runs E2E tests
56
+ - Publishes to NPM
15
57
 
16
- Do not create 2 commits with same name and consider amending previous commit instead with `git commit --amend --no-edit`.
58
+ ## Version Bumping
17
59
 
18
- ---
19
- **⚠⚠⚠ In case commit introduces breaking changes incompatible with existing API special commit message have to be used. Just type `git commit` and [commit template](./scripts/COMMIT_TEMPLATE) will be opened to edit. The main difference with regular commit messages - such commit MUST have footer(s) BREAKING CHANGES⚠⚠⚠**
60
+ - Automatic based on PR titles:
61
+ - `fix:` → `0.0.X`
62
+ - `feat:` → `0.X.0`
63
+ - `feat!:` or `BREAKING CHANGE:` → `X.0.0`
64
+ - Never modify version manually
20
65
 
21
- ---
66
+ ## CI Checks
22
67
 
23
- On merging the PR to `main` branch an automatic release flow will be triggered. New package version will be determined based on changes introduced by commit. `fix` corresponds to `patch`, `feat` to `minor` and `breaking changes` to `major` version release.
68
+ Your PR must pass:
24
69
 
25
- More details on semantic versioning could be found in official [SemVer specification](https://semver.org/).
70
+ - Linting
71
+ - Unit tests
72
+ - E2E tests (feature/fix branches)
73
+ - PR title validation
74
+ - Code review
26
75
 
27
- Note: untill first major version is released the package is considered as under development and `breaking changes` will correspond to `minor` release.
76
+ Remember: The key is writing good code and using correct commit conventions - the release process is automated!
@@ -1 +1 @@
1
- import o from"react-dom";import t from"prop-types";import{makeStyles as n}from"@material-ui/core";import*as p from"@corva/ui";import{DevCenterIsolatedAppPage as e}from"@corva/ui/components";import{jsx as r}from"react/jsx-runtime";window["@corva/ui"]=p;var i=n((function(){return{reportsContainer:{zoom:"0.5"}}}));function m(o){var t=o.CLIAppComponent,n=o.CLIAppSettings,p=i();return r(e,{CLIAppComponent:t,CLIAppSettings:n,containerReportClassName:p.reportsContainer})}m.propTypes={CLIAppComponent:t.node,CLIAppSettings:t.node},m.defaultProps={CLIAppComponent:null,CLIAppSettings:null},import("".concat(process.env.DEV_CENTER_APP_PATH,"/src/index.js")).then((function(t){var n=t.default.component,p=t.default.settings;o.render(r(m,{CLIAppComponent:n,CLIAppSettings:p}),document.getElementById("root"))}));
1
+ import o from"react-dom";import t from"prop-types";import{makeStyles as n}from"@material-ui/core";import*as r from"@corva/ui";import{DevCenterIsolatedAppPage as p}from"@corva/ui/components";import{initGlobalDependencies as e}from"@corva/ui/config";import{jsx as i}from"react/jsx-runtime";window["@corva/ui"]=r,e();var m=n((function(){return{reportsContainer:{zoom:"0.5"}}}));function a(o){var t=o.CLIAppComponent,n=o.CLIAppSettings,r=m();return i(p,{CLIAppComponent:t,CLIAppSettings:n,containerReportClassName:r.reportsContainer})}a.propTypes={CLIAppComponent:t.func,CLIAppSettings:t.func},a.defaultProps={CLIAppComponent:null,CLIAppSettings:null},import("".concat(process.env.DEV_CENTER_APP_PATH,"/src/index.js")).then((function(t){var n=t.default.component,r=t.default.settings;o.render(i(a,{CLIAppComponent:n,CLIAppSettings:r}),document.getElementById("root"))}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require('./../../../ext-cjs/@babel/runtime/helpers/defineProperty.js');function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function a(e){for(var a=1;a<arguments.length;a++){var o=null!=arguments[a]?arguments[a]:{};a%2?r(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var o={qa:"qa",staging:"staging",production:"production"},i={REACT_APP_AUTH0_REDIRECT_URI:"/login/oauth-callback",REACT_APP_AUTH0_DOMAIN:"corva.auth0.com",REACT_APP_AUTH0_CLIENT_ID:"L1B0xGD5AuXwuTDFdFA9czDTM7Vvw464"},c=(t(e={},o.qa,a(a({},i),{},{REACT_APP_API_URL:"https://api.qa.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.qa.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.qa.corva.ai/v1"})),t(e,o.staging,a(a({},i),{},{REACT_APP_API_URL:"https://api.staging.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.staging.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.staging.corva.ai/v1"})),t(e,o.production,a(a({},i),{},{REACT_APP_API_URL:"https://api.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.corva.ai/v1"})),e);exports.CORVA_API_ENVS=o,exports.CORVA_API_ENV_VARIABLES=c,exports.CORVA_GLOBAL_DEPENDENCIES={"@corva/ui":"","@material-ui/core":"4.11.2","@material-ui/icons":"4.9.1","@material-ui/lab":"4.0.0-alpha.57","@material-ui/pickers":"3.2.10","@rollbar/react":"0.11.1",classnames:"2.2.6","corva-convert-units":"1.10.33",highcharts:"8.1.2","highcharts-react-official":"2.2.2",html2canvas:"1.0.0-alpha.12",jsona:"1.5.1",lodash:"^4.17.4","mapbox.js":"3.2.1",moment:"2.29.4","moment-timezone":"0.5.43",react:"17.0.1","react-dom":"17.0.1","react-grid-layout":"1.3.4","react-sortable-hoc":"0.6.8","react-sizeme":"2.5.2","react-redux":"5.1.1","react-virtualized":"9.21.2",redux:"3.7.2","redux-thunk":"2.3.0",reselect:"2.5.4",rollbar:"2.5.1","prop-types":"^15.6.1",uuid:"3.4.0"},exports.UNSUPPORTED_DEPENDENCIES=[{dependency:"date-fns",alternative:"moment"},{dependency:"date-fns-tz",alternative:"moment-timezone"},{dependency:"date-fns-timezone",alternative:"moment-timezone"}];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require('./../../../ext-cjs/@babel/runtime/helpers/defineProperty.js');function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function a(t){for(var a=1;a<arguments.length;a++){var o=null!=arguments[a]?arguments[a]:{};a%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var o={qa:"qa",staging:"staging",production:"production"},i={REACT_APP_AUTH0_REDIRECT_URI:"http://app.local.corva.ai:8080/login/oauth-callback",REACT_APP_AUTH0_DOMAIN:"corva.auth0.com",REACT_APP_AUTH0_CLIENT_ID:"L1B0xGD5AuXwuTDFdFA9czDTM7Vvw464"},c=(e(t={},o.qa,a(a({},i),{},{REACT_APP_API_URL:"https://api.qa.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.qa.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.qa.corva.ai/v1"})),e(t,o.staging,a(a({},i),{},{REACT_APP_API_URL:"https://api.staging.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.staging.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.staging.corva.ai/v1"})),e(t,o.production,a(a({},i),{},{REACT_APP_API_URL:"https://api.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.corva.ai/v1"})),t);exports.CORVA_API_ENVS=o,exports.CORVA_API_ENV_VARIABLES=c,exports.CORVA_GLOBAL_DEPENDENCIES={"@corva/ui":"","@material-ui/core":"4.11.2","@material-ui/icons":"4.9.1","@material-ui/lab":"4.0.0-alpha.57","@material-ui/pickers":"3.2.10","@rollbar/react":"0.11.1",classnames:"2.2.6","corva-convert-units":"1.10.33",highcharts:["8.1.2","10.3.3"],"highcharts-react-official":"2.2.2",html2canvas:"1.0.0-alpha.12","@icon-park/react":"1.4.2",jsona:"1.5.1",lodash:"^4.17.21","mapbox.js":"3.2.1",moment:"2.29.4","moment-timezone":"0.5.43",react:"17.0.1","react-dom":"17.0.1","react-grid-layout":"1.3.4","react-sortable-hoc":"0.6.8","react-sizeme":"2.5.2","react-redux":"5.1.1","react-virtualized":"9.21.2",redux:"3.7.2","redux-thunk":"2.3.0",reselect:"2.5.4",rollbar:"2.5.1","prop-types":"^15.6.1",uuid:"3.4.0"},exports.UNSUPPORTED_DEPENDENCIES=[{dependency:"date-fns",alternative:"moment"},{dependency:"date-fns-tz",alternative:"moment-timezone"},{dependency:"date-fns-timezone",alternative:"moment-timezone"}];
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./validators/index.js"),s=require("webpack"),o=require("path"),r=require("uuid/v1"),t=require("clean-webpack-plugin").CleanWebpackPlugin,a=require("fs"),n=process.cwd(),l=JSON.parse(a.readFileSync(o.resolve(n,"./package.json"),"utf-8")),p=JSON.parse(a.readFileSync(o.resolve(n,"./manifest.json"),"utf-8"));exports.APP_DIRECTORY=n,exports.default=function(a,n){return e({packageJson:l}),{entry:"./src/index.js",output:{filename:"[name].[contenthash].js",path:o.resolve(process.cwd(),"dist"),publicPath:"/"},devServer:{historyApiFallback:!0},performance:{maxAssetSize:1024e3},plugins:[new t,new s.ProvidePlugin({process:"process/browser"})],resolve:{symlinks:!1,extensions:[".js",".jsx",".json",".ts",".tsx"]},module:{rules:[{test:/\.css$/i,use:["style-loader",{loader:"css-loader",options:{modules:{localIdentName:"development"===n.mode?"[path][name]__[local]__".concat(r().substr(-5)):"[name]__[hash:base64:3]".concat(r().substr(-5))},importLoaders:1}},{loader:"postcss-loader",options:{postcssOptions:{plugins:["postcss-preset-env"]}}}]},{test:/\.(js|jsx)$/,exclude:/[\\/]node_modules[\\/]/,use:{loader:"babel-loader",options:{presets:["@babel/preset-env",["@babel/preset-react",{runtime:"automatic"}]]}}},{test:/\.ts(x?)$/,exclude:/[\\/]node_modules[\\/]/,use:[{loader:"babel-loader",options:{presets:["@babel/preset-env",["@babel/preset-react",{runtime:"automatic"}]]}},{loader:"ts-loader",options:{compilerOptions:{noEmit:!1}}}]}]}}},exports.manifestJson=p,exports.packageJson=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./validators/index.js"),s=require("webpack"),o=require("path"),r=require("uuid/v1"),t=require("clean-webpack-plugin").CleanWebpackPlugin,a=require("fs"),l=process.cwd(),n=JSON.parse(a.readFileSync(o.resolve(l,"./package.json"),"utf-8")),p=JSON.parse(a.readFileSync(o.resolve(l,"./manifest.json"),"utf-8"));exports.APP_DIRECTORY=l,exports.default=function(a,l){return e({packageJson:n}),{entry:"./src/index.js",output:{filename:"[name].[contenthash].js",path:o.resolve(process.cwd(),"dist")},devServer:{historyApiFallback:!0},performance:{maxAssetSize:1024e3},plugins:[new t,new s.ProvidePlugin({process:"process/browser"})],resolve:{symlinks:!1,extensions:[".js",".jsx",".json",".ts",".tsx"]},module:{rules:[{test:/\.css$/i,use:["style-loader",{loader:"css-loader",options:{modules:{localIdentName:"development"===l.mode?"[path][name]__[local]__".concat(r().substr(-5)):"[name]__[hash:base64:3]".concat(r().substr(-5))},importLoaders:1}},{loader:"postcss-loader",options:{postcssOptions:{plugins:["postcss-preset-env"]}}}]},{test:/\.(js|jsx)$/,exclude:/[\\/]node_modules[\\/]/,use:{loader:"babel-loader",options:{presets:["@babel/preset-env",["@babel/preset-react",{runtime:"automatic"}]]}}},{test:/\.ts(x?)$/,exclude:/[\\/]node_modules[\\/]/,use:[{loader:"babel-loader",options:{presets:["@babel/preset-env",["@babel/preset-react",{runtime:"automatic"}]]}},{loader:"ts-loader",options:{compilerOptions:{noEmit:!1}}}]},{test:/\.m?js/,resolve:{fullySpecified:!1}}]}}},exports.manifestJson=p,exports.packageJson=n;
@@ -1 +1 @@
1
- "use strict";var e=require('./../../../ext-cjs/@babel/runtime/helpers/defineProperty.js'),r=require('./../../../ext-cjs/@babel/runtime/helpers/toConsumableArray.js'),t=require("./webpack.config.common.js"),o=require("./constants.js"),n=require("./plugins/checkCorvaUIVersion.js"),s=require("./utils/middlewares.js");function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function c(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?i(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):i(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var l=require("@pmmmwh/react-refresh-webpack-plugin"),a=require("webpack-merge").merge,p=require("path"),u=require("webpack"),d=require("clean-webpack-plugin").CleanWebpackPlugin,m=require("copy-webpack-plugin"),v=require("html-webpack-plugin"),_=require("chalk");require("dotenv").config({path:p.resolve(t.APP_DIRECTORY,"./.env")});function f(e,t,o){var n=p.join("@corva","dc-platform-shared"),s="@corva/ui",i=new RegExp("(^".concat(s,"$|^").concat(s,"/)([^]+)?"));if(!e.includes(n)){var c=i.exec(t);if(null!==c){var l=c[2]||"";return o(null,["window",s].concat(r(l.split("/").filter(Boolean))))}}return o()}module.exports=function(e,r){var i,P=process.env.HOST||r.host||"localhost",O=process.env.PORT||r.port||8080;return a(t.default(e,r),{mode:"development",devtool:"inline-source-map",devServer:{static:"./dist",host:P,port:O,onBeforeSetupMiddleware:function(e){return s.onBeforeSetupMiddleware(e.app,{APP_DIRECTORY:t.APP_DIRECTORY})},hot:!0,open:!1},entry:{devApp:p.resolve(__dirname,"DevServerEntryPoint.js"),isolatedApp:p.resolve(__dirname,"DevServerIsolatedAppEntryPoint.js")},output:{filename:"[name].js"},plugins:[new d,new m({patterns:[{from:p.resolve(__dirname,"public")},{from:p.resolve(process.cwd(),"node_modules","@corva/ui/assets"),to:"static/media",noErrorOnMissing:!0},{from:p.resolve(process.cwd(),"node_modules","@corva/dc-platform-shared/assets"),to:"static/media",noErrorOnMissing:!0}]}),new v({filename:"index.html",inject:!1,template:p.resolve(__dirname,"public","index.html")}),new v({filename:"DevCenterIsolatedAppPage.html",inject:!1,template:p.resolve(__dirname,"public","DevCenterIsolatedAppPage.html")}),new u.EnvironmentPlugin(c(c({},process.env),{},{DEV_CENTER_APP_PATH:process.cwd(),REACT_APP_ENVIRONMENT:process.env.REACT_APP_ENVIRONMENT||"development"},(i=process.env.CORVA_API_ENV||o.CORVA_API_ENVS.production,i in o.CORVA_API_ENVS?o.CORVA_API_ENV_VARIABLES[i]:(console.log(_.red("CORVA_API_ENV should be one of [".concat(Object.keys(o.CORVA_API_ENVS).join(", "),"]"))),process.exit(1))))),n,new l],externals:f,module:{rules:[{test:/\.(png|jpe?g|gif)$/i,type:"asset/resource"},{test:/\.svg$/,use:[{loader:"svg-url-loader",options:{limit:1e4}}]}]}})};
1
+ "use strict";var e=require('./../../../ext-cjs/@babel/runtime/helpers/defineProperty.js'),r=require('./../../../ext-cjs/@babel/runtime/helpers/toConsumableArray.js'),t=require("./webpack.config.common.js"),o=require("./constants.js"),n=require("./plugins/checkCorvaUIVersion.js"),s=require("./utils/middlewares.js");function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function c(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?i(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):i(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var a=require("@pmmmwh/react-refresh-webpack-plugin"),l=require("webpack-merge").merge,p=require("path"),u=require("webpack"),d=require("clean-webpack-plugin").CleanWebpackPlugin,m=require("copy-webpack-plugin"),v=require("html-webpack-plugin"),_=require("chalk");require("dotenv").config({path:p.resolve(t.APP_DIRECTORY,"./.env")});function f(e,t,o){var n=p.join("@corva","dc-platform-shared"),s="@corva/ui",i=new RegExp("(^".concat(s,"$|^").concat(s,"/)([^]+)?"));if(!e.includes(n)){var c=i.exec(t);if(null!==c){var a=c[2]||"";return o(null,["window",s].concat(r(a.split("/").filter(Boolean))))}}return o()}module.exports=function(e,r){var i,P=process.env.HOST||r.host||"app.local.corva.ai",O=process.env.PORT||r.port||8080;return l(t.default(e,r),{mode:"development",devtool:"inline-source-map",devServer:{static:"./dist",host:P,port:O,onBeforeSetupMiddleware:function(e){return s.onBeforeSetupMiddleware(e.app,{APP_DIRECTORY:t.APP_DIRECTORY})},hot:!0,open:!1},entry:{devApp:p.resolve(__dirname,"DevServerEntryPoint.js"),isolatedApp:p.resolve(__dirname,"DevServerIsolatedAppEntryPoint.js")},output:{filename:"[name].js"},plugins:[new d,new m({patterns:[{from:p.resolve(__dirname,"public")},{from:p.resolve(process.cwd(),"node_modules","@corva/ui/assets"),to:"static/media",noErrorOnMissing:!0},{from:p.resolve(process.cwd(),"node_modules","@corva/dc-platform-shared/assets"),to:"static/media",noErrorOnMissing:!0}]}),new v({filename:"index.html",inject:!1,template:p.resolve(__dirname,"public","index.html")}),new v({filename:"DevCenterIsolatedAppPage.html",inject:!1,template:p.resolve(__dirname,"public","DevCenterIsolatedAppPage.html")}),new u.EnvironmentPlugin(c(c({},process.env),{},{DEV_CENTER_APP_PATH:process.cwd(),REACT_APP_ENVIRONMENT:process.env.REACT_APP_ENVIRONMENT||"development"},(i=process.env.CORVA_API_ENV||o.CORVA_API_ENVS.production,i in o.CORVA_API_ENVS?o.CORVA_API_ENV_VARIABLES[i]:(console.log(_.red("CORVA_API_ENV should be one of [".concat(Object.keys(o.CORVA_API_ENVS).join(", "),"]"))),process.exit(1))))),n,new a],externals:f,module:{rules:[{test:/\.(png|jpe?g|gif)$/i,type:"asset/resource"},{test:/\.svg$/,use:[{loader:"svg-url-loader",options:{limit:1e4}}]}]}})};
@@ -1 +1 @@
1
- "use strict";var e=require('./../../../ext-cjs/@babel/runtime/helpers/toConsumableArray.js'),r=require('./../../../ext-cjs/@babel/runtime/helpers/slicedToArray.js'),n=require("./webpack.config.common.js"),t=require("./constants.js"),i=require("webpack"),a=require("webpack-merge").merge,o=require("path"),s=require("webpack-manifest-plugin").WebpackManifestPlugin,u=require("terser-webpack-plugin"),l=n.manifestJson.application.key,c=n.packageJson.version,p=function(e){var r=l.replace(/\./g,"_");return e?r:"".concat(r,"-").concat(c)},m=Object.keys(t.CORVA_GLOBAL_DEPENDENCIES).map((function(e){return[e,new RegExp("(^".concat(e,"$|^").concat(e,"/)([^]+)?"))]})),g=new Set(["react/jsx-runtime"]);module.exports=function(t,l){var c=!(null==t||!t.local_debug);return a(n.default(t,l),{entry:"./src/index.js",output:{library:p(c),path:o.resolve(n.APP_DIRECTORY,"dist"),filename:"app.js",libraryTarget:"window"},mode:c?"development":"production",plugins:[new s,new i.EnvironmentPlugin(process.env)],optimization:{minimizer:[new u({parallel:!0})]},externals:[function(n,t,i){if(g.has(t))return i();for(var a=0;a<m.length;a+=1){var o=r(m[a],2),s=o[0],u=o[1].exec(t);if(null!==u){var l=u[2]||"";return i(null,[s].concat(e(l.split("/").filter(Boolean))))}}return i()}],module:{rules:[{test:/\.(png|jpe?g|gif)$/i,type:"asset/resource",generator:{publicPath:process.env.PACKAGE_URL_BASE}},{test:/\.svg$/,use:[{loader:"svg-url-loader",options:{limit:1e4,publicPath:process.env.PACKAGE_URL_BASE}}]}]}})};
1
+ "use strict";var e=require('./../../../ext-cjs/@babel/runtime/helpers/toConsumableArray.js'),r=require('./../../../ext-cjs/@babel/runtime/helpers/slicedToArray.js'),n=require("./webpack.config.common.js"),t=require("./constants.js"),o=require("webpack"),i=require("webpack-merge").merge,s=require("path"),a=require("terser-webpack-plugin"),l=require("copy-webpack-plugin"),u=n.manifestJson.application.key,c=n.packageJson.version,p=function(e){var r=u.replace(/\./g,"_");return e?r:"".concat(r,"-").concat(c)},m=Object.keys(t.CORVA_GLOBAL_DEPENDENCIES).map((function(e){return[e,new RegExp("(^".concat(e,"$|^").concat(e,"/)([^]+)?"))]})),f=["react/jsx-runtime","highcharts/"];module.exports=function(t,u){var c=!(null==t||!t.local_debug);return i(n.default(t,u),{entry:"./src/index.js",output:{library:p(c),path:s.resolve(n.APP_DIRECTORY,"dist"),filename:"app.js",libraryTarget:"window"},mode:c?"development":"production",plugins:[new o.EnvironmentPlugin(process.env),new l({patterns:[{from:s.resolve(process.cwd(),"manifest.json"),to:"./",noErrorOnMissing:!0}]})],optimization:{minimizer:[new a({parallel:!0})]},externals:[function(n,t,o){for(var i=0;i<f.length;i+=1)if(t.startsWith(f[i]))return o();for(var s=0;s<m.length;s+=1){var a=r(m[s],2),l=a[0],u=a[1].exec(t);if(null!==u){var c=u[2]||"";return o(null,[l].concat(e(c.split("/").filter(Boolean))))}}return o()}],module:{rules:[{test:/\.(png|jpe?g|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource"},{test:/\.svg$/,use:[{loader:"svg-url-loader",options:{limit:1e4}}]}]}})};
@@ -1 +1 @@
1
- import r from'./../../ext-esm/style-inject/dist/style-inject.es.js';var a={dragLine:"AppsGridDragHandle_dragLine__7wqiq",dragIcon:"AppsGridDragHandle_dragIcon__-GDHv",dragOverlay:"AppsGridDragHandle_dragOverlay__RiAt5",dragIconContainer:"AppsGridDragHandle_dragIconContainer__ATh0-"};r(":hover>.AppsGridDragHandle_dragLine__7wqiq{align-items:center;border:5px solid rgba(3,188,212,.32);border-radius:8px 8px 0 0;cursor:pointer;display:flex;height:0;justify-content:center;margin-left:-2px;position:absolute;top:-6px;width:calc(100% + 4px);z-index:400}:hover>.AppsGridDragHandle_dragLine__7wqiq :active{cursor:move;cursor:grabbing}:hover>.AppsGridDragHandle_dragLine__7wqiq .AppsGridDragHandle_dragIcon__-GDHv{border-radius:30px;font-size:.75rem}:hover>.AppsGridDragHandle_dragLine__7wqiq:active{cursor:move;cursor:grabbing}.AppsGridDragHandle_dragLine__7wqiq,.AppsGridDragHandle_dragOverlay__RiAt5{display:none}.AppsGridDragHandle_dragLine__7wqiq:active+.AppsGridDragHandle_dragOverlay__RiAt5{display:block;height:100%;position:absolute;width:100%}.AppsGridDragHandle_dragLine__7wqiq :active{cursor:move;cursor:grabbing}.AppsGridDragHandle_dragIconContainer__ATh0-{align-items:center;background-color:var(--palette-primary-main);border-radius:30px;display:flex;height:24px;justify-content:center;width:24px}");export{a as default};
1
+ import r from'./../../ext-esm/style-inject/dist/style-inject.es.js';var a={dragLine:"AppsGridDragHandle_dragLine__7wqiq",dragIcon:"AppsGridDragHandle_dragIcon__-GDHv",dragOverlay:"AppsGridDragHandle_dragOverlay__RiAt5",dragIconContainer:"AppsGridDragHandle_dragIconContainer__ATh0-"};r(":hover>.AppsGridDragHandle_dragLine__7wqiq{align-items:center;border:5px solid rgba(3,188,212,.32);border-radius:8px 8px 0 0;cursor:pointer;display:flex;height:0;justify-content:center;margin-left:-2px;position:absolute;top:-6px;width:calc(100% + 4px);z-index:1000}:hover>.AppsGridDragHandle_dragLine__7wqiq :active{cursor:move;cursor:grabbing}:hover>.AppsGridDragHandle_dragLine__7wqiq .AppsGridDragHandle_dragIcon__-GDHv{border-radius:30px;font-size:.75rem}:hover>.AppsGridDragHandle_dragLine__7wqiq:active{cursor:move;cursor:grabbing}.AppsGridDragHandle_dragLine__7wqiq,.AppsGridDragHandle_dragOverlay__RiAt5{display:none}.AppsGridDragHandle_dragLine__7wqiq:active+.AppsGridDragHandle_dragOverlay__RiAt5{display:block;height:100%;position:absolute;width:100%}.AppsGridDragHandle_dragLine__7wqiq :active{cursor:move;cursor:grabbing}.AppsGridDragHandle_dragIconContainer__ATh0-{align-items:center;background-color:var(--palette-primary-main);border-radius:30px;display:flex;height:24px;justify-content:center;width:24px}");export{a as default};
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/defineProperty";import{makeStyles as e,Tooltip as o,IconButton as t}from"@material-ui/core";import a from"classnames";import{UnlockIcon as c,LockIcon as n}from"@corva/ui/icons";import{jsx as i}from"react/jsx-runtime";function l(r,e){var o=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.push.apply(o,t)}return o}function s(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{};o%2?l(Object(t),!0).forEach((function(o){r(e,o,t[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var b=e((function(r){return{root:{width:36,height:36,"&:hover":{backgroundColor:r.palette.background.b7},borderRadius:"50%"},button:{width:"100%",height:"100%","&:hover":{backgroundColor:r.palette.background.b7}}}}));function d(r){var e=r.className,n=r.disabled,l=r.isDraggableAndResizable,d=r.LockIcon,p=r.lockIconClassName,u=r.onClick,m=r.pageName,f=r.tooltipProps,h=b();return i(o,s(s({title:n?"Can't unlock dashboard layout":l?"Lock Dashboard Layout":"Unlock Dashboard Layout"},f),{},{children:i("div",{className:a(h.root,e),children:i(t,{className:h.button,color:"primary","data-testid":"".concat(m,"_").concat(l?"gridUnlocked":"gridLocked"),disabled:n,onClick:u,children:l?i(c,{}):i(d,{className:p})})})}))}d.defaultProps={LockIcon:n,tooltipProps:{}};export{d as default};
1
+ import r from"@babel/runtime/helpers/defineProperty";import{makeStyles as e,Tooltip as o,IconButton as t}from"@material-ui/core";import{UnlockIcon as a,LockIcon as c}from"@corva/ui/icons";import n from"classnames";import{jsx as i}from"react/jsx-runtime";function s(r,e){var o=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.push.apply(o,t)}return o}function l(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{};o%2?s(Object(t),!0).forEach((function(o){r(e,o,t[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var b=e({root:{width:36,height:36,"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.16)"},borderRadius:8},button:{width:"100%",height:"100%","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.16)"}}});function d(r){var e=r.className,c=r.disabled,s=r.isDraggableAndResizable,d=r.LockIcon,p=r.lockIconClassName,u=r.onClick,m=r.pageName,f=r.tooltipProps,h=b();return i(o,l(l({title:c?"Can't unlock dashboard layout":s?"Lock Dashboard Layout":"Unlock Dashboard Layout"},f),{},{children:i("div",{className:n(h.root,e),children:i(t,{className:h.button,"data-testid":"".concat(m,"_").concat(s?"gridUnlocked":"gridLocked"),disabled:c,onClick:u,children:s?i(a,{}):i(d,{className:p})})})}))}d.defaultProps={LockIcon:c,tooltipProps:{}};export{d as default};
@@ -1 +1 @@
1
- import e from"prop-types";import{withStyles as l,TextField as i}from"@material-ui/core";import{jsx as o}from"react/jsx-runtime";var a=function(e){var l=e.value,a=e.onChange,r=e.disabled,t=e.error,d=e.classes;return o(i,{"data-testid":"".concat("EmailField","_emailInput"),id:"email-input",label:"Email",type:"email",name:"email",autoComplete:"email",value:l,placeholder:"Enter your email address",variant:"outlined",InputLabelProps:{classes:{root:d.emailFieldLabelRoot,focused:d.emailFieldFocused}},InputProps:{classes:{root:d.emailFieldRoot,input:d.emailInput,disabled:d.emailFieldDisabled,focused:d.emailFieldFocused,error:d.emailFieldError}},onChange:a,disabled:r,error:!!t,helperText:t,fullWidth:!0})};a.defaultProps={disabled:!1,error:null},a.propTypes={value:e.string.isRequired,onChange:e.func.isRequired,disabled:e.bool,error:e.string,classes:e.shape().isRequired};var r=l((function(e){return{emailFieldRoot:{"&:hover:not($emailFieldDisabled):not($emailFieldFocused):not($emailFieldError) $emailFieldNotchedOutline":{borderColor:e.status.loginButton},"&$emailFieldFocused $emailFieldNotchedOutline":{borderColor:e.status.loginButton}},emailInput:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #233 inset"}},emailFieldLabelRoot:{color:"#666","&$emailFieldFocused":{color:e.status.loginButton}}}}))(a);export{r as default};
1
+ import e from"prop-types";import{withStyles as l,TextField as i}from"@material-ui/core";import{jsx as o}from"react/jsx-runtime";var a=function(e){var l=e.value,a=e.onChange,r=e.disabled,t=e.error,d=e.classes;return o(i,{"data-testid":"".concat("EmailField","_emailInput"),id:"email-input",label:"Email",type:"email",name:"email",autoComplete:"email",value:l,placeholder:"Enter your email address",variant:"outlined",InputLabelProps:{classes:{root:d.emailFieldLabelRoot,focused:d.emailFieldFocused}},InputProps:{classes:{root:d.emailFieldRoot,input:d.emailInput,disabled:d.emailFieldDisabled,focused:d.emailFieldFocused,error:d.emailFieldError}},onChange:a,disabled:r,error:!!t,helperText:t,fullWidth:!0})};a.defaultProps={disabled:!1,error:null},a.propTypes={value:e.string.isRequired,onChange:e.func.isRequired,disabled:e.bool,error:e.string,classes:e.shape({}).isRequired};var r=l((function(e){return{emailFieldRoot:{"&:hover:not($emailFieldDisabled):not($emailFieldFocused):not($emailFieldError) $emailFieldNotchedOutline":{borderColor:e.status.loginButton},"&$emailFieldFocused $emailFieldNotchedOutline":{borderColor:e.status.loginButton}},emailInput:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #233 inset"}},emailFieldLabelRoot:{color:"#666","&$emailFieldFocused":{color:e.status.loginButton}}}}))(a);export{r as default};
@@ -0,0 +1 @@
1
+ import e from"@babel/runtime/helpers/toConsumableArray";import t from"@babel/runtime/helpers/slicedToArray";import{useState as r,useRef as n,useEffect as i}from"react";import{Button as o}from"@corva/ui/components";import{makeStyles as a,Grid as c,Typography as l}from"@material-ui/core";import u from"classnames";import d from"./Step.js";import s from"./StepContent.js";import{jsxs as m,jsx as p,Fragment as f}from"react/jsx-runtime";var h=a((function(e){return{stepHeader:{padding:e.spacing(4),textAlign:"center",width:"100%",display:"flex",flexDirection:"column",alignItems:"center"},subtitle:{marginTop:e.spacing(2),color:e.palette.primary.text6,fontSize:16,letterSpacing:-.01,lineHeight:"normal"},form:{display:"flex",justifyContent:"space-between"},actions:{display:"flex",justifyContent:function(e){return e.isResendButtonVisible?"space-between":"end"},width:"100%",padding:"24px 32px 40px"},input:{"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{"-webkit-appearance":"none",margin:0},padding:8,border:"1px solid ".concat(e.palette.primary.text9),borderRadius:4,backgroundColor:e.palette.background.b4,color:e.palette.primary.contrastText,fontSize:30,textAlign:"center","&:active, &:hover, &:focus-visible":{border:"1px solid ".concat(e.palette.primary.main),outline:"none"}},inputError:{border:"1px solid ".concat(e.palette.error.main," !important")},footer:{width:"100%",padding:"0 32px",fontSize:14,letterSpacing:-.01,color:e.palette.primary.text6,textAlign:"center"},divider:{borderTop:"1px solid rgba(255, 255, 255, 0.2)",width:"100%",marginBottom:40},footerButton:{cursor:"pointer",color:e.palette.primary.main}}})),b="email",v="sms",g=Array.from({length:6},(function(){return""}));function y(a){var y=a.email,x=a.identityVerification,S=a.loginVerificationFailure,C=a.onCodeProvided,N=a.requestVerification,w=r(x.enabled_modes[0]),k=t(w,2),B=k[0],T=k[1],j=r(g),V=t(j,2),A=V[0],D=V[1],E=r(S),I=t(E,2),R=I[0],z=I[1],H=r(!1),M=t(H,2),P=M[0],_=M[1],q=h({isResendButtonVisible:P}),F=n(null),W=n(null);i((function(){z(S),S&&(_(!0),W.current=null)}),[S]),i((function(){return N({email:y,mode:B}).then((function(){W.current=setTimeout((function(){_(!0),W.current=null}),15e3)})).catch(console.error),function(){W.current&&clearTimeout(W.current)}}),[]);var Y=function(){A.every(Boolean)&&C({code:A.join(""),mode:B})},G=A.every(Boolean);i((function(){G&&Y()}),[A.join(),G]);var J=function(e){e.preventDefault(),Y()},K=function(r){return function(n){var i=t(n.target.value,2),o=i[0],a=i[1],c=A[r],l=o;a&&a!==c&&(l=a);var u=e(A);u[r]=l,D(u),z(!1),void 0===l&&r>0?F.current.childNodes[r-1].focus():l&&r<5&&F.current.childNodes[r+1].focus()}},L=function(e){return function(){T(e),N({email:y,mode:e}).catch(console.error),_(!1),z(!1),D(g),W.current&&clearTimeout(W.current),W.current=setTimeout((function(){_(!0),W.current=null}),15e3)}};return m(d,{children:[m(c,{item:!0,className:q.stepHeader,children:[p(l,{variant:"h6",children:R?"Invalid Verification Code":"Verify Your Identity"}),p("div",{className:q.subtitle,children:B===b?"Enter a 6-digit code which was set to ".concat(y):"We have sent an SMS with one time verification code to your phone number"})]}),p(s,{children:p("form",{className:q.form,id:"verification-form",onSubmit:J,autoComplete:"on",ref:F,onPaste:function(e){var t=String(e.clipboardData.getData("text")).trim().slice(0,6).split("");t.every((function(e){return Number.isInteger(Number(e))}))&&6===t.length&&D(t)},children:A.map((function(e,t){return p("input",{type:"number",min:0,max:9,onChange:K(t),className:u(q.input,R&&q.inputError),value:e},t)}))})}),m("div",{className:q.actions,children:[P&&p(o,{onClick:L(B),variation:"secondary",children:"Resend Code"}),p(o,{disabled:!G||R,form:"verification-form",onClick:J,type:"submit",variation:"primary",children:"Next"})]}),x.enabled_modes.length>1&&m("div",{className:q.footer,children:[p("div",{className:q.divider}),m(f,B===b?{children:["Send a code via"," ",p("span",{className:q.footerButton,onClick:L(v),children:"SMS"})]}:{children:["Send a code to"," ",p("span",{className:q.footerButton,onClick:L(b),children:"Email"})]})]})]})}export{y as VerificationStep};
@@ -1 +1 @@
1
- export{default as Login}from"./components/Login.js";export{default as PasswordField}from"./components/PasswordField.js";export{default as Chip}from"./components/Chip.js";export{default as StepFooter}from"./components/StepFooter.js";export{default as StepContent}from"./components/StepContent.js";export{default as StepHeader}from"./components/StepHeader.js";export{default as Step}from"./components/Step.js";export{default as OrDivider}from"./components/OrDivider.js";export{default as HiddenEmailField}from"./components/HiddenEmailField.js";export{default as EmailField}from"./components/EmailField.js";
1
+ export{default as Chip}from"./components/Chip.js";export{default as EmailField}from"./components/EmailField.js";export{default as HiddenEmailField}from"./components/HiddenEmailField.js";export{default as Login}from"./components/Login.js";export{default as OrDivider}from"./components/OrDivider.js";export{default as PasswordField}from"./components/PasswordField.js";export{default as Step}from"./components/Step.js";export{default as StepContent}from"./components/StepContent.js";export{default as StepFooter}from"./components/StepFooter.js";export{default as StepHeader}from"./components/StepHeader.js";export{VerificationStep}from"./components/VerificationStep.js";
package/package.json CHANGED
@@ -1,166 +1 @@
1
- {
2
- "name": "@corva/dc-platform-shared",
3
- "version": "0.0.0-e60767",
4
- "description": "A library to share internal DC platform specific code",
5
- "main": "./dist",
6
- "module": "./src/index.js",
7
- "repository": "git@github.com:corva-ai/corva-dc-platform-shared.git",
8
- "author": "Oleksandr Krupko <oleksandr.krupko@corva.ai>",
9
- "license": "MIT",
10
- "scripts": {
11
- "lint": "eslint --cache ./src/",
12
- "lint-staged": "lint-staged",
13
- "build": "./scripts/build.sh production",
14
- "build-watch": "./scripts/build.sh development -w",
15
- "get-changelog": "conventional-changelog -r 2 -p angular",
16
- "release": "git fetch --tags && git add -A && standard-version -a",
17
- "start": "yarn generate-css-themes && cross-env NODE_ENV=local rollup -c -w",
18
- "test": "jest",
19
- "test-coverage": "jest --watchAll --coverage && http-serve coverage",
20
- "test-watch": "jest --watch"
21
- },
22
- "lint-staged": {
23
- "*.js": [
24
- "eslint --fix"
25
- ]
26
- },
27
- "standard-version": {
28
- "skip": {
29
- "tag": true
30
- }
31
- },
32
- "jest": {
33
- "collectCoverageFrom": [
34
- "./**/*.{js,jsx,mjs}"
35
- ],
36
- "coverageReporters": [
37
- "html",
38
- "text-summary"
39
- ],
40
- "moduleNameMapper": {
41
- "~(.*)": "<rootDir>/src/$1",
42
- "\\.(css|less|scss)$": "identity-obj-proxy"
43
- },
44
- "setupFiles": [
45
- "<rootDir>/jest/setEnvVars.js"
46
- ],
47
- "testMatch": [
48
- "**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)"
49
- ],
50
- "transform": {
51
- "^.+\\.jsx?$": "babel-jest",
52
- "^.+\\.mjs$": "babel-jest",
53
- "^.+\\.svg$": "<rootDir>/jest/svgTransform.js"
54
- },
55
- "transformIgnorePatterns": [
56
- "node_modules/(?!@ngrx|(?!deck.gl)|ng-dynamic)"
57
- ],
58
- "moduleFileExtensions": [
59
- "js",
60
- "jsx",
61
- "json",
62
- "mjs",
63
- "node"
64
- ]
65
- },
66
- "dependencies": {
67
- "@babel/core": "^7.12.10",
68
- "@babel/plugin-transform-react-jsx": "^7.12.11",
69
- "@babel/plugin-transform-runtime": "^7.12.10",
70
- "@babel/preset-env": "^7.12.11",
71
- "@babel/preset-react": "^7.12.10",
72
- "@corva/eslint-config-browser": "^0.0.4",
73
- "@date-io/moment": "1.3.13",
74
- "@material-ui/core": "4.11.2",
75
- "@material-ui/icons": "4.9.1",
76
- "@material-ui/lab": "4.0.0-alpha.57",
77
- "@material-ui/pickers": "3.2.10",
78
- "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
79
- "babel-eslint": "10.0.3",
80
- "babel-jest": "^26.3.0",
81
- "babel-loader": "8.1.0",
82
- "babel-plugin-file-loader": "^2.0.0",
83
- "babel-plugin-root-import": "^6.5.0",
84
- "chalk": "4.1.1",
85
- "classnames": "2.2.6",
86
- "clean-webpack-plugin": "3.0.0",
87
- "copy-webpack-plugin": "6.1.1",
88
- "css-loader": "3.4.2",
89
- "dotenv": "^10.0.0",
90
- "eslint-config-airbnb": "17.1.0",
91
- "eslint-plugin-jest-dom": "^3.2.3",
92
- "eslint-plugin-prettier": "3.1.1",
93
- "eslint-plugin-testing-library": "^3.9.2",
94
- "express": "4.17.1",
95
- "fs": "0.0.1-security",
96
- "html-webpack-plugin": "4.5.2",
97
- "jest": "^26.4.1",
98
- "jsona": "1.5.1",
99
- "lodash": "4.17.20",
100
- "mini-css-extract-plugin": "0.9.0",
101
- "moment": "2.29.4",
102
- "node-fetch": "^2.6.1",
103
- "optimize-css-assets-webpack-plugin": "5.0.3",
104
- "path": "0.12.7",
105
- "postcss": "8.4.11",
106
- "postcss-import": "12.0.1",
107
- "postcss-loader": "4.2.0",
108
- "postcss-preset-env": "6.7.0",
109
- "prettier": "^2.1.2",
110
- "process": "^0.11.10",
111
- "prop-types": "15.7.2",
112
- "react": "17.0.1",
113
- "react-dom": "17.0.1",
114
- "react-grid-layout": "1.3.4",
115
- "react-router": "3.2.1",
116
- "react-sizeme": "2.5.2",
117
- "rollup-plugin-copy": "^3.4.0",
118
- "sass": "^1.51.0",
119
- "semver": "7.2.1",
120
- "style-loader": "1.0.0",
121
- "svg-url-loader": "6.0.0",
122
- "terser-webpack-plugin": "4.2.3",
123
- "uuid": "3.4.0",
124
- "webpack": "5.88.2",
125
- "webpack-cli": "5.1.4",
126
- "webpack-dev-server": "4.15.1",
127
- "webpack-manifest-plugin": "5.0.0",
128
- "webpack-merge": "5.9.0"
129
- },
130
- "peerDependencies": {
131
- "@corva/ui": "*"
132
- },
133
- "devDependencies": {
134
- "@corva/ui": "0.73.0-7",
135
- "@rollup/plugin-babel": "^5.2.1",
136
- "@rollup/plugin-commonjs": "^15.0.0",
137
- "@rollup/plugin-image": "^2.0.6",
138
- "@rollup/plugin-json": "^4.1.0",
139
- "@rollup/plugin-node-resolve": "^9.0.0",
140
- "@testing-library/jest-dom": "5.16.5",
141
- "@testing-library/react": "^11.1.0",
142
- "@testing-library/react-hooks": "^8.0.1",
143
- "babel-plugin-external-helpers": "^6.22.0",
144
- "conventional-changelog-cli": "^2.1.0",
145
- "cross-env": "^7.0.3",
146
- "git-conventional-commits": "^1.1.0",
147
- "identity-obj-proxy": "^3.0.0",
148
- "lint-staged": "^10.5.4",
149
- "postcss-url": "9.0.0",
150
- "pre-commit": "1.2.2",
151
- "rollup": "^2.28.2",
152
- "rollup-plugin-cleanup": "^3.2.1",
153
- "rollup-plugin-css-bundle": "^1.0.4",
154
- "rollup-plugin-css-only": "^2.1.0",
155
- "rollup-plugin-node-externals": "^2.2.0",
156
- "rollup-plugin-postcss": "^4.0.2",
157
- "rollup-plugin-rename-node-modules": "^1.0.1",
158
- "rollup-plugin-terser": "^7.0.2",
159
- "rollup-plugin-visualizer": "^4.1.1",
160
- "sass-loader": "10.1.1",
161
- "standard-version": "^9.0.0"
162
- },
163
- "engines": {
164
- "node": ">=16"
165
- }
166
- }
1
+ {"name":"@corva/dc-platform-shared","version":"0.0.0-f1f9034","description":"A library to share internal DC platform specific code","main":"./dist","module":"./src/index.js","repository":"git@github.com:corva-ai/corva-dc-platform-shared.git","author":"Oleksandr Krupko <oleksandr.krupko@corva.ai>","license":"MIT","scripts":{"helper-cli":"npx @corva/fe-dev-helper-cli@latest","lint":"eslint --cache ./src/","lint-staged":"lint-staged","build":"./scripts/build.sh production","build-watch":"./scripts/build.sh development -w","get-changelog":"conventional-changelog -r 2 -p angular","release":"git fetch --tags && git add -A && standard-version -a","start":"yarn generate-css-themes && cross-env NODE_ENV=local rollup -c -w","test":"jest","test-coverage":"jest --watchAll --coverage && http-serve coverage","test-watch":"jest --watch"},"lint-staged":{"*.js":["eslint --fix"]},"standard-version":{"skip":{"tag":true}},"jest":{"collectCoverageFrom":["./**/*.{js,jsx,mjs}"],"coverageReporters":["html","text-summary"],"moduleNameMapper":{"~(.*)":"<rootDir>/src/$1","\\.(css|less|scss)$":"identity-obj-proxy"},"setupFiles":["<rootDir>/jest/setEnvVars.js"],"testMatch":["**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)"],"transform":{"^.+\\.jsx?$":"babel-jest","^.+\\.mjs$":"babel-jest","^.+\\.svg$":"<rootDir>/jest/svgTransform.js"},"transformIgnorePatterns":["node_modules/(?!@ngrx|(?!deck.gl)|ng-dynamic)"],"moduleFileExtensions":["js","jsx","json","mjs","node"]},"dependencies":{"@babel/core":"^7.12.10","@babel/plugin-transform-react-jsx":"^7.12.11","@babel/plugin-transform-runtime":"^7.12.10","@babel/preset-env":"^7.12.11","@babel/preset-react":"^7.12.10","@corva/eslint-config-browser":"^0.0.4","@date-io/moment":"1.3.13","@icon-park/react":"1.4.2","@material-ui/core":"4.11.2","@material-ui/icons":"4.9.1","@material-ui/lab":"4.0.0-alpha.57","@material-ui/pickers":"3.2.10","@pmmmwh/react-refresh-webpack-plugin":"0.5.10","babel-eslint":"10.0.3","babel-jest":"^26.3.0","babel-loader":"8.1.0","babel-plugin-file-loader":"^2.0.0","babel-plugin-root-import":"^6.5.0","chalk":"4.1.1","classnames":"2.2.6","clean-webpack-plugin":"3.0.0","copy-webpack-plugin":"6.1.1","css-loader":"3.4.2","dotenv":"^10.0.0","eslint-config-airbnb":"17.1.0","eslint-plugin-jest-dom":"3.9.4","eslint-plugin-prettier":"3.1.1","eslint-plugin-testing-library":"^3.9.2","express":"4.21.2","fs":"0.0.1-security","html-webpack-plugin":"4.5.2","jest":"^26.4.1","jsona":"1.5.1","lodash":"4.17.21","mini-css-extract-plugin":"0.9.0","moment":"2.29.4","node-fetch":"^2.6.1","path":"0.12.7","postcss":"8.4.31","postcss-import":"12.0.1","postcss-loader":"4.2.0","postcss-preset-env":"6.7.0","prettier":"^2.1.2","process":"^0.11.10","prop-types":"15.7.2","react":"17.0.1","react-dom":"17.0.1","react-grid-layout":"1.3.4","react-router":"3.2.1","react-sizeme":"2.5.2","rollup-plugin-copy":"^3.4.0","sass":"^1.51.0","semver":"7.5.2","style-loader":"1.0.0","svg-url-loader":"6.0.0","terser-webpack-plugin":"4.2.3","uuid":"3.4.0","webpack":"5.94.0","webpack-cli":"5.1.4","webpack-dev-server":"4.15.2","webpack-merge":"5.9.0"},"peerDependencies":{"@corva/ui":"*"},"devDependencies":{"@corva/ui":"3.14.1","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-commonjs":"^15.0.0","@rollup/plugin-image":"^2.0.6","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^9.0.0","@testing-library/jest-dom":"5.16.5","@testing-library/react":"^11.1.0","@testing-library/react-hooks":"^8.0.1","babel-plugin-external-helpers":"^6.22.0","conventional-changelog-cli":"^2.1.0","cross-env":"^7.0.3","git-conventional-commits":"^1.1.0","identity-obj-proxy":"^3.0.0","lint-staged":"^10.5.4","postcss-url":"9.0.0","pre-commit":"1.2.2","rollup":"^2.28.2","rollup-plugin-cleanup":"^3.2.1","rollup-plugin-css-bundle":"^1.0.4","rollup-plugin-css-only":"^2.1.0","rollup-plugin-node-externals":"^2.2.0","rollup-plugin-postcss":"^4.0.2","rollup-plugin-rename-node-modules":"^1.0.1","rollup-plugin-terser":"^7.0.2","rollup-plugin-visualizer":"^4.1.1","sass-loader":"10.1.1","standard-version":"^9.0.0"},"engines":{"node":">=18"},"resolutions":{"braces":"3.0.3"}}
@@ -1 +0,0 @@
1
- import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import{useState as n,useRef as o,useEffect as a}from"react";import{get as s}from"lodash";import{post as u}from"@corva/ui/clients/api/apiCore";import*as i from"@corva/ui/clients/jsonApi";import{updateUserUnits as c}from"@corva/ui/utils/convert";import p from"../../../clients/auth0/index.js";import{LOGIN_ROUTE_REG_EXP as l}from"../../constants/index.js";var m=function(r){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})};function f(f){var h=n(null),v=t(h,2),d=v[0],y=v[1],g=n(!0),x=t(g,2),b=x[0],w=x[1],T=n(null),j=t(T,2),k=j[0],A=j[1],U=o();function _(){return C.apply(this,arguments)}function C(){return(C=r(e.mark((function r(){var t;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return w(!0),r.next=3,i.getCurrentUser();case 3:(t=r.sent)?(y(t),c({userUnits:t.unit_system,companyUnits:s(t,"company.unit_system")})):f.push("/login"),w(!1);case 6:case"end":return r.stop()}}),r)})))).apply(this,arguments)}U.current||(U.current=new p);var H,N,O=(H=r(e.mark((function r(t,n){var o;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,A(null),w(!0),r.next=5,u("/v1/user_token",{auth:t});case 5:o=r.sent,m({AUTH_TOKEN:o.jwt}),r.next=14;break;case 9:return r.prev=9,r.t0=r.catch(0),console.error(r.t0),w(!1),r.abrupt("return",A("Wrong user name or password"));case 14:_().then(n);case 15:case"end":return r.stop()}}),r,null,[[0,9]])}))),function(r,t){return H.apply(this,arguments)}),E=(N=r(e.mark((function r(){return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return m({AUTH_TOKEN:""}),r.next=3,i.logout();case 3:f.push("/login");case 4:case"end":return r.stop()}}),r)}))),function(){return N.apply(this,arguments)});return a((function(){if(l.test(f.location.pathname))return w(!1);_()}),[]),{user:d,loading:b,error:k,login:O,logout:E,auth0:U.current}}export{f as default};