@corva/dc-platform-shared 0.0.0-3891cdc → 0.0.0-935e60d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import 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 e from"@babel/runtime/helpers/slicedToArray";import{useState as o}from"react";import r from"prop-types";import{makeStyles as t,useTheme as a,AppBar as i,Toolbar as n,FormControlLabel as l,Checkbox as c,Tooltip as s,IconButton as p,Typography as m,Menu as u,MenuItem as d}from"@material-ui/core";import h from"@material-ui/icons/AccountCircle";import f from"@corva/ui/components/SwitchControl";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as g}from"@corva/ui/constants/localStorageKeys";import{isPDFReportView as v}from"@corva/ui/utils/reports";import b from"../../../../assets/DevCenterLogo.js";import{useAuth as C}from"../../../../context/auth.js";import{jsxs as B,jsx as w}from"react/jsx-runtime";var k=t((function(e){return{grow:{flexGrow:1},flex:{display:"flex"},appBar:{backgroundColor:"rgb(30, 31, 31)"},iconButtonRoot:{borderRadius:"unset"},userProfileIcon:{marginLeft:4},headerControl:{marginRight:32},formControlLabel:{fontSize:14}}}));function A(r){var t,A,L=r.toggleTheme,T=k(),x=C(),N=x.user,S=x.logout,_=a(),y=o(null),R=e(y,2),z=R[0],D=R[1],I=Boolean(z),O=function(){return D(null)},P="".concat(null==N||null===(t=N.first_name)||void 0===t?void 0:t[0]).concat(null==N||null===(A=N.last_name)||void 0===A?void 0:A[0]).toUpperCase();return B("div",{children:[w(i,{position:"static",className:T.appBar,children:B(n,{children:[w(b,{}),w("div",{className:T.grow}),w(l,{control:w(c,{"data-testid":"".concat("AppBar","_pdfReport"),checked:v,size:"small",onChange:function(e){localStorage.setItem(g,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:T.formControlLabel},className:T.headerControl}),!v&&w(s,{title:"Switch to light theme to tune your app for PDF reports",placement:"bottom",children:w("div",{children:w(f,{"data-testid":"".concat("AppBar","_themeSwitch"),className:T.headerControl,leftLabel:"Dark Theme",rightLabel:"Light Theme",onChange:L,checked:_.isLightTheme,size:"small",title:""})})}),w("div",{children:w(p,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:function(e){return D(e.currentTarget)},color:"inherit",className:T.iconButtonRoot,children:B("div",{className:T.flex,children:[w(m,{"data-testid":"".concat("AppBar","_userInitials"),children:P}),w(h,{className:T.userProfileIcon})]})})})]})}),w(u,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:z,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:I,onClose:O,children:w(d,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){S(),O()},children:"Sign Out"})})]})}A.propTypes={toggleTheme:r.func.isRequired};export{A as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as o}from"react";import t from"prop-types";import{makeStyles as r,useTheme as a,AppBar as n,Toolbar as i,FormControlLabel as l,Checkbox as c,Tooltip as s,IconButton as m,Typography as p,Menu as d,MenuItem as u}from"@material-ui/core";import h from"@material-ui/icons/AccountCircle";import f from"@corva/ui/components/SwitchControl";import{FEATURE_FLAG_APPS_ISOLATION as g}from"@corva/ui/clients/clientStorage";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as v}from"@corva/ui/constants/localStorageKeys";import{isPDFReportView as b}from"@corva/ui/utils/reports";import C from"../../../../assets/DevCenterLogo.js";import{useAuth as w}from"../../../../context/auth.js";import{jsxs as B,jsx as k}from"react/jsx-runtime";var S=r((function(e){return{grow:{flexGrow:1},flex:{display:"flex"},appBar:{backgroundColor:"rgb(30, 31, 31)"},iconButtonRoot:{borderRadius:"unset"},userProfileIcon:{marginLeft:4},headerControl:{marginRight:32},formControlLabel:{fontSize:14}}}));function A(t){var r,A,L=t.toggleTheme,I=S(),N=w(),T=N.user,x=N.logout,_=a(),y=o(null),z=e(y,2),R=z[0],D=z[1],O=Boolean(R),P=function(){return D(null)},j="".concat(null==T||null===(r=T.first_name)||void 0===r?void 0:r[0]).concat(null==T||null===(A=T.last_name)||void 0===A?void 0:A[0]).toUpperCase();return B("div",{children:[k(n,{position:"static",className:I.appBar,children:B(i,{children:[k(C,{}),k("div",{className:I.grow}),k(l,{control:k(c,{checked:"false"!==localStorage.getItem(g),size:"small",onChange:function(e){localStorage.setItem(g,e.target.checked),window.location.reload()}}),label:"App Isolation",classes:{label:I.formControlLabel},className:I.headerControl}),k(l,{control:k(c,{"data-testid":"".concat("AppBar","_pdfReport"),checked:b,size:"small",onChange:function(e){localStorage.setItem(v,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:I.formControlLabel},className:I.headerControl}),!b&&k(s,{title:"Switch to light theme to tune your app for PDF reports",placement:"bottom",children:k("div",{children:k(f,{"data-testid":"".concat("AppBar","_themeSwitch"),className:I.headerControl,leftLabel:"Dark Theme",rightLabel:"Light Theme",onChange:L,checked:_.isLightTheme,size:"small",title:""})})}),k("div",{children:k(m,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:function(e){return D(e.currentTarget)},color:"inherit",className:I.iconButtonRoot,children:B("div",{className:I.flex,children:[k(p,{"data-testid":"".concat("AppBar","_userInitials"),children:j}),k(h,{className:I.userProfileIcon})]})})})]})}),k(d,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:R,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:O,onClose:P,children:k(u,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){x(),P()},children:"Sign Out"})})]})}A.propTypes={toggleTheme:t.func.isRequired};export{A as default};
@@ -0,0 +1 @@
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/slicedToArray";import n from"@babel/runtime/regenerator";import{useState as e,useRef as o,useEffect as s}from"react";import{get as u}from"lodash";import{post as a}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 m}from"../../../constants/index.js";var l=function(t){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})};function f(f){var h=e(null),y=r(h,2),v=y[0],d=y[1],g=e(!0),x=r(g,2),_=x[0],b=x[1],w=e(null),T=r(w,2),U=T[0],C=T[1],j=o();function k(){return A.apply(this,arguments)}function A(){return(A=t(n.mark((function t(){var r;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return b(!0),t.next=3,i.getCurrentUser();case 3:(r=t.sent)?(d(r),c({userUnits:r.unit_system,companyUnits:u(r,"company.unit_system"),companyCustomUnitSystem:u(r,"company.custom_unit_system"),userCustomUnitSystem:u(r,"custom_unit_system"),companyCustomUnits:u(r,"company.custom_units")})):f.push("/login"),b(!1);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}j.current||(j.current=new p);var H,N,O=(H=t(n.mark((function t(){var r,e,o,s,u,i=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i.length>0&&void 0!==i[0]?i[0]:"",e=i.length>1?i[1]:void 0,o=i.length>2?i[2]:void 0,t.prev=3,C(null),b(!0),s={auth:e},r&&(s.platform=r),t.next=10,a("/v1/user_token",s);case 10:u=t.sent,l({AUTH_TOKEN:u.jwt}),t.next=19;break;case 14:return t.prev=14,t.t0=t.catch(3),console.error(t.t0),b(!1),t.abrupt("return",C("Wrong user name or password"));case 19:k().then(o);case 20:case"end":return t.stop()}}),t,null,[[3,14]])}))),function(){return H.apply(this,arguments)}),S=(N=t(n.mark((function t(){return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l({AUTH_TOKEN:""}),t.next=3,i.logout();case 3:f.push("/login");case 4:case"end":return t.stop()}}),t)}))),function(){return N.apply(this,arguments)});return s((function(){if(m.test(f.location.pathname))return b(!1);k()}),[]),{user:v,loading:_,error:U,login:O,logout:S,auth0:j.current}}export{f as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import{DEV_CENTER_CLI_APP_ID as r}from"@corva/ui/constants";import{getFeatureFlagAppsIsolation as o}from"@corva/ui/clients/clientStorage";import{AppsDataProvider as n,DevCenterIsolatedApp as i}from"@corva/ui/components";import{jsx as p}from"react/jsx-runtime";var a=["manifest","dashboardProps","coordinates"];function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function c(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?s(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var f=o(),m=function(e){var o=e.CLIAppComponent,s=e.CLIAppSettings,m=e.packageJson;return function(e){var u=e.manifest,b=e.dashboardProps,l=e.coordinates,d=t(e,a),O=u.application.key,g=m.version,v={id:r,app:{app_key:O,platform:"dev_center"},settings:d.settings,package:{manifest:u,build:"".concat(O,"-").concat(g),version:g}};return p(n,{dashboardAssetId:b.assetId,apps:[v],children:p(i,c(c({},d),{},{isIsolationFeatureEnabled:f,app:v,coordinates:l,CLIAppComponent:o,CLIAppSettings:s}))})}};export{m as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import{DEV_CENTER_CLI_APP_ID as r}from"@corva/ui/constants";import{getFeatureFlagAppsIsolation as o}from"@corva/ui/clients/clientStorage";import{AppsDataProvider as n,DevCenterIsolatedApp as i}from"@corva/ui/components";import{jsx as p}from"react/jsx-runtime";var a=["manifest","dashboardProps","coordinates"];function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function c(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?s(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var m=o(),f=function(e){var o=e.CLIAppComponent,s=e.CLIAppSettings,f=e.packageJson;return function(e){var u=e.manifest,b=e.dashboardProps,l=e.coordinates,d=t(e,a),O=u.application.key,g=f.version,v={app:{app_key:O,platform:"dev_center"},id:r,package:{manifest:u,build:"".concat(O,"-").concat(g),version:g},segment:u.application.segments,settings:d.settings};return p(n,{dashboardAssetId:b.assetId,apps:[v],children:p(i,c(c({},d),{},{isIsolationFeatureEnabled:m,app:v,coordinates:l,CLIAppComponent:o,CLIAppSettings:s}))})}};export{f 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 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{isSSOPlatformSupported as l}from"@corva/ui/clients/sso";import{initializeRecaptcha as u,GOOGLE_RECAPTCHA_KEY as d}from"../../../../utils/recaptcha.js";import"../../../../components/Login/components/Login.js";import f from"../../../../components/Login/components/PasswordField.js";import g from"../../../../components/Login/components/Chip.js";import h from"../../../../components/Login/components/StepFooter.js";import v from"../../../../components/Login/components/StepContent.js";import b from"../../../../components/Login/components/StepHeader.js";import w from"../../../../components/Login/components/Step.js";import j from"../../../../components/Login/components/OrDivider.js";import L from"../../../../components/Login/components/HiddenEmailField.js";import"../../../../components/Login/components/EmailField.js";import{useAuth as y}from"../../../context/auth.js";import{NEED_HELP_EXTERNAL_LINK as k}from"../../../constants/index.js";import S from"./SSOButton.js";import{jsxs as x,jsx as B}from"react/jsx-runtime";var C=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}}})),F=c(p)((function(o){var n=o.theme;return{width:71,padding:n.spacing(),whiteSpace:"nowrap",backgroundColor:n.status.loginButton,"&:hover":{backgroundColor:"".concat(n.status.loginButtonHovered)}}}));function T(t){var a=t.email,c=t.schemas,p=t.onBack,T=t.onFinishLogin,q=y(),H=e(""),R=n(H,2),E=R[0],I=R[1],O=e(!1),P=n(O,2),z=P[0],A=P[1],D=z?q.error:null;i((function(){u()}),[]);var _,G=(_=o(r.mark((function o(n){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",s("Problem with initializing recaptcha"));case 3:return o.abrupt("return",window.grecaptcha.enterprise.ready((function(){try{window.grecaptcha.enterprise.execute(d,{action:"login"}).then((function(o){q.login(null,{email:a,password:E,recaptcha_token:o},T).then((function(){A(!0)}))})).catch((function(o){return console.error(o)}))}catch(o){console.error(o),s(o.message)}})));case 4:case"end":return o.stop()}}),o)}))),function(o){return _.apply(this,arguments)}),M=c.find((function(o){return"password"===o.provider})),J=c.filter((function(o){var n;return"password"!==o.provider&&l(null==o||null===(n=o.platform)||void 0===n?void 0:n.identifier)}));return x(w,{children:[B(b,{children:"Sign In"}),B(v,{children:x(m,{container:!0,direction:"column",children:[B(g,{"data-not-migrated-MuiChip":!0,label:a,onClick:p}),J.map((function(o){return B(C,{item:!0,children:B(S,{title:o.title,provider:o.provider,connection:o.connection,platform:o.platform})},o.title)})),M&&J.length>0&&B(m,{item:!0,children:B(j,{})}),M&&B(C,{item:!0,children:x("form",{id:"sign-in-form",onSubmit:G,children:[B(L,{email:a}),B(f,{value:E,onChange:function(o){I(o.target.value),A(!1)},disabled:q.loading,error:D})]})})]})}),B(h,{needHelpExternalLink:k,children:M&&B(F,{"data-testid":"".concat("AuthorizationPo","_signInButton"),form:"sign-in-form",type:"submit",variant:"contained",color:"primary",disabled:!E||q.loading||!!D,onClick:G,children:"Sign In"})})]})}T.propTypes={email:a.string.isRequired,schemas:a.arrayOf(a.shape({})).isRequired,onBack:a.func.isRequired,onFinishLogin:a.func.isRequired};var q=t(T);export{q 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/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({email:n,with_provider:!0});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 +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};
@@ -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.17",highcharts:"11.1.0","highcharts-react-official":"3.2.1",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","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.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 +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,"/)([^]+)?"))]})),g=["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<g.length;i+=1)if(t.startsWith(g[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)$/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 +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);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: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 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{makeStyles as t,Tooltip as r,IconButton as o}from"@material-ui/core";import a from"classnames";import{jsx as c}from"react/jsx-runtime";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function n(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?i(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):i(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var d=t((function(e){return{root:{width:36,height:36,"&:hover":{backgroundColor:e.palette.background.b7},borderRadius:"50%"},button:{width:"100%",height:"100%","&:hover":{backgroundColor:e.palette.background.b7}}}}));function s(e){var t=e.className,i=e.disabled,s=e.isDraggableAndResizable,l=e.lockedIcon,b=e.onClick,p=e.pageName,u=e.tooltipProps,f=d();return c(r,n(n({title:i?"Can't unlock dashboard layout":s?"Lock Dashboard Layout":"Unlock Dashboard Layout"},u),{},{children:c("div",{className:a(f.root,t),children:c(o,{className:f.button,color:"primary","data-testid":"".concat(p,"_").concat(s?"gridUnlocked":"gridLocked"),disabled:i,onClick:b,children:c("img",{src:s?"/static/media/b1dce244ca65e361a28be5801cf93d73.svg":l,alt:"Lock"})})})}))}s.defaultProps={lockedIcon:"/static/media/2d1e493e7f3afb84f4a5c8aded37a718.svg",tooltipProps:{}},s.LockedWhiteIcon="/static/media/fb9a5d3233e9e3e310d6d297e6ddcc55.svg";export{s as default};
1
+ import r from"@babel/runtime/helpers/defineProperty";import{makeStyles as e,Tooltip as t,IconButton as o}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 l(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,o)}return t}function s(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,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,c=r.disabled,l=r.isDraggableAndResizable,d=r.LockIcon,u=r.lockIconClassName,p=r.onClick,m=r.pageName,f=r.tooltipProps,h=b();return i(t,s(s({title:c?"Can't unlock dashboard layout":l?"Lock Dashboard Layout":"Unlock Dashboard Layout"},f),{},{children:i("div",{className:n(h.root,e),children:i(o,{className:h.button,"data-testid":"".concat(m,"_").concat(l?"gridUnlocked":"gridLocked"),disabled:c,onClick:p,children:l?i(a,{}):i(d,{className:u})})})}))}d.defaultProps={LockIcon:c,tooltipProps:{}};export{d as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/dc-platform-shared",
3
- "version": "0.0.0-3891cdc",
3
+ "version": "0.0.0-935e60d",
4
4
  "description": "A library to share internal DC platform specific code",
5
5
  "main": "./dist",
6
6
  "module": "./src/index.js",
@@ -71,6 +71,7 @@
71
71
  "@babel/preset-react": "^7.12.10",
72
72
  "@corva/eslint-config-browser": "^0.0.4",
73
73
  "@date-io/moment": "1.3.13",
74
+ "@icon-park/react": "1.4.2",
74
75
  "@material-ui/core": "4.11.2",
75
76
  "@material-ui/icons": "4.9.1",
76
77
  "@material-ui/lab": "4.0.0-alpha.57",
@@ -124,14 +125,13 @@
124
125
  "webpack": "5.88.2",
125
126
  "webpack-cli": "5.1.4",
126
127
  "webpack-dev-server": "4.15.1",
127
- "webpack-manifest-plugin": "5.0.0",
128
128
  "webpack-merge": "5.9.0"
129
129
  },
130
130
  "peerDependencies": {
131
131
  "@corva/ui": "*"
132
132
  },
133
133
  "devDependencies": {
134
- "@corva/ui": "0.0.0-c08cd534",
134
+ "@corva/ui": "0.77.0-4",
135
135
  "@rollup/plugin-babel": "^5.2.1",
136
136
  "@rollup/plugin-commonjs": "^15.0.0",
137
137
  "@rollup/plugin-image": "^2.0.6",
@@ -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};
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="#dadada" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M17 8H18C19.1 8 20 8.9 20 10V20C20 21.1 19.1 22 18 22H6C4.9 22 4 21.1 4 20V10C4 8.9 4.9 8 6 8H7V6C7 3.24 9.24 1 12 1C14.76 1 17 3.24 17 6V8ZM12 3C10.34 3 9 4.34 9 6V8H15V6C15 4.34 13.66 3 12 3ZM6 20V10H18V20H6ZM14 15C14 16.1 13.1 17 12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15Z" fill="#dadada"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M16 6V8H17H18C19.1 8 20 8.9 20 10V20C20 21.1 19.1 22 18 22H6C4.9 22 4 21.1 4 20V10C4 8.9 4.9 8 6 8H14V6C14 3.24 16.24 1 19 1C21.76 1 24 3.24 24 6H22C22 4.34 20.66 3 19 3C17.34 3 16 4.34 16 6ZM6 20H18V10H6V20ZM12 17C13.1 17 14 16.1 14 15C14 13.9 13.1 13 12 13C10.9 13 10 13.9 10 15C10 16.1 10.9 17 12 17Z" fill="#03BCD4"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="white" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M17 8H18C19.1 8 20 8.9 20 10V20C20 21.1 19.1 22 18 22H6C4.9 22 4 21.1 4 20V10C4 8.9 4.9 8 6 8H7V6C7 3.24 9.24 1 12 1C14.76 1 17 3.24 17 6V8ZM12 3C10.34 3 9 4.34 9 6V8H15V6C15 4.34 13.66 3 12 3ZM6 20V10H18V20H6ZM14 15C14 16.1 13.1 17 12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15Z" fill="white"/>
3
- </svg>