@corva/dc-platform-shared 0.0.0-6e84283 → 0.0.0-761ed8d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLI/components/App/App.js +1 -1
- package/CLI/components/App/components/AppBar/AppBar.js +1 -1
- package/CLI/constants/index.js +1 -1
- package/CLI/context/auth.js +1 -1
- package/CLI/hocs/effects/useProvideAuth/api.js +1 -1
- package/CLI/hocs/effects/useProvideAuth/constants.js +1 -1
- package/CLI/hocs/effects/useProvideAuth/useProvideAuth.js +1 -1
- package/CLI/hocs/utils.js +1 -1
- package/CLI/hocs/withAppDataProviderHOC.js +1 -1
- package/CLI/hocs/withCLIAppSettingsHOC.js +1 -1
- package/CLI/hocs/withCorvaMagicHOC.js +1 -1
- package/CLI/hocs/withDevCenterRouterHOC.js +1 -1
- package/CLI/hocs/withGridLayoutHOC/withGridLayoutHOC.js +1 -1
- package/CLI/hocs/withPDFLayoutHOC.js +1 -1
- package/CLI/hocs/withReactRouterHOC.js +1 -1
- package/CLI/screens/LoginScreen/LoginScreen.js +1 -1
- package/CLI/screens/LoginScreen/components/Auth.js +1 -1
- package/CLI/screens/LoginScreen/components/AuthStep.js +1 -1
- package/CLI/screens/LoginScreen/components/EmailStep.js +1 -1
- package/CLI/screens/LoginScreen/components/SSOButton.js +1 -1
- package/CLI/screens/OAuthCallbackScreen/index.js +1 -1
- package/README.md +63 -15
- package/cjs/devcenter/webpack/DevServerEntryPoint.js +1 -1
- package/cjs/devcenter/webpack/DevServerIsolatedAppEntryPoint.js +1 -1
- package/cjs/devcenter/webpack/MapboxGlDevSetupEntryPoint.js +1 -0
- package/cjs/devcenter/webpack/constants.js +1 -1
- package/cjs/devcenter/webpack/createAdaptiveRoot.js +1 -0
- package/cjs/devcenter/webpack/plugins/checkCorvaUIVersion.js +11 -1
- package/cjs/devcenter/webpack/utils/middlewares.js +1 -1
- package/cjs/devcenter/webpack/utils/serializeDotEnv.js +1 -1
- package/cjs/devcenter/webpack/validators/dependencies.js +1 -1
- package/cjs/devcenter/webpack/validators/index.js +1 -1
- package/cjs/devcenter/webpack/webpack.config.common.js +1 -1
- package/cjs/devcenter/webpack/webpack.config.dev.js +1 -1
- package/cjs/devcenter/webpack/webpack.config.prod.js +1 -1
- package/clients/auth0/index.js +1 -1
- package/components/GridLockButton/index.js +1 -1
- package/components/Login/components/Chip.js +1 -1
- package/components/Login/components/EmailField.js +1 -1
- package/components/Login/components/HiddenEmailField.js +1 -1
- package/components/Login/components/Login.js +1 -1
- package/components/Login/components/OrDivider.js +1 -1
- package/components/Login/components/PasswordField.js +1 -1
- package/components/Login/components/StepContent.js +1 -1
- package/components/Login/components/StepFooter.js +1 -1
- package/components/Login/components/StepHeader.js +1 -1
- package/components/Login/components/VerificationStep.js +1 -1
- package/ext-esm/auth0-js/dist/auth0.min.esm.js +1 -1
- package/package.json +1 -1
- package/utils/devcenter.js +1 -1
- package/utils/recaptcha.js +1 -1
- package/vite/corva-vite-config.mjs +872 -0
- package/_virtual/_commonjsHelpers.js +0 -1
- package/_virtual/arrayLikeToArray.js +0 -1
- package/_virtual/arrayWithHoles.js +0 -1
- package/_virtual/arrayWithoutHoles.js +0 -1
- package/_virtual/iterableToArray.js +0 -1
- package/_virtual/iterableToArrayLimit.js +0 -1
- package/_virtual/nonIterableRest.js +0 -1
- package/_virtual/nonIterableSpread.js +0 -1
- package/_virtual/regeneratorRuntime.js +0 -1
- package/_virtual/typeof.js +0 -1
- package/_virtual/unsupportedIterableToArray.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/arrayLikeToArray.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/arrayWithHoles.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/arrayWithoutHoles.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/asyncToGenerator.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/defineProperty.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/iterableToArray.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/iterableToArrayLimit.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/nonIterableRest.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/nonIterableSpread.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/regeneratorRuntime.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/slicedToArray.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/toConsumableArray.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/typeof.js +0 -1
- package/ext-cjs/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -1
- package/ext-cjs/@babel/runtime/regenerator/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useReducer as o,useEffect as t}from"react";import r from"classnames";import{MuiThemeProvider as e}from"@material-ui/core";import{MuiPickersUtilsProvider as m}from"@material-ui/pickers";import i from"@date-io/moment";import a from"moment";import{isPDFReportView as n}from"@corva/ui/utils/reports";import{LOCAL_STORAGE_APP_THEME_KEY as p}from"@corva/ui/constants/localStorageKeys";import{NotificationsContainer as s}from"@corva/ui/components";import{THEMES as c}from"@corva/ui/constants/theme";import{darkTheme as l,lightTheme as f}from"@corva/ui/config/theme";import{setThemeVariables as u}from"@corva/ui/utils/themeVariables";import{LOGIN_ROUTE_REG_EXP as h}from"../../constants/index.js";import d from"./components/AppBar/AppBar.js";import{AuthContext as v}from"../../context/auth.js";import A from"../../hocs/effects/useProvideAuth/useProvideAuth.js";import g from"./App.css.js";import{jsx as j,jsxs as x,Fragment as I}from"react/jsx-runtime";function K({children:K,router:C}){const D=A(C),P=!h.test(C.location.pathname)&&!D.loading,[,R]=o((o=>o+1),0),S=localStorage.getItem(p)??c.DARK,b=!P||!n&&S===c.DARK;t((()=>u(b)),[b]);return j(v.Provider,{value:D,children:j(e,{theme:b?l:f,children:j(m,{libInstance:a,utils:i,children:x(I,{children:[!P&&K,P&&x("div",{className:g.app,children:[j(s,{}),j(d,{toggleTheme:()=>{localStorage.setItem(p,b?c.LIGHT:c.DARK),R()}}),j("div",{className:r(g.appContent,n&&g.pdfAppContent,!b&&g.lightAppContent),children:K})]})]})})})})}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useState as e}from"react";import o from"prop-types";import{makeStyles as r,useTheme as t,AppBar as a,Toolbar as l,FormControlLabel as i,Checkbox as n,Tooltip as c,IconButton as s,Typography as p,Menu as m,MenuItem as d}from"@material-ui/core";import h from"@material-ui/icons/AccountCircle";import u 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 f}from"@corva/ui/constants/localStorageKeys";import{isPDFReportView as C}from"@corva/ui/utils/reports";import b from"../../../../assets/DevCenterLogo.js";import{useAuth as v}from"../../../../context/auth.js";import{jsxs as w,jsx as B}from"react/jsx-runtime";const k=r((e=>({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 S({toggleTheme:o}){const r=k(),{user:S,logout:L}=v(),A=t(),[I,N]=e(null),x=Boolean(I),T=()=>N(null),_=`${S?.first_name?.[0]}${S?.last_name?.[0]}`.toUpperCase();return w("div",{children:[B(a,{position:"static",className:r.appBar,children:w(l,{children:[B(b,{}),B("div",{className:r.grow}),B(i,{control:B(n,{checked:"false"!==localStorage.getItem(g),size:"small",onChange:e=>{localStorage.setItem(g,e.target.checked),window.location.reload()}}),label:"App Isolation",classes:{label:r.formControlLabel},className:r.headerControl}),B(i,{control:B(n,{"data-testid":"AppBar_pdfReport",checked:C,size:"small",onChange:e=>{localStorage.setItem(f,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:r.formControlLabel},className:r.headerControl}),!C&&B(c,{title:"Switch to light theme to tune your app for PDF reports",placement:"bottom",children:B("div",{children:B(u,{"data-testid":"AppBar_themeSwitch",className:r.headerControl,leftLabel:"Dark Theme",rightLabel:"Light Theme",onChange:o,checked:A.isLightTheme,size:"small",title:""})})}),B("div",{children:B(s,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:e=>N(e.currentTarget),color:"inherit",className:r.iconButtonRoot,children:w("div",{className:r.flex,children:[B(p,{"data-testid":"AppBar_userInitials",children:_}),B(h,{className:r.userProfileIcon})]})})})]})}),B(m,{"data-testid":"AppBar_userDropdown",anchorEl:I,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:x,onClose:T,children:B(d,{"data-testid":"AppBar_signOutMenuItem",onClick:()=>{L(),T()},children:"Sign Out"})})]})}S.propTypes={toggleTheme:o.func.isRequired};export{S as default};
|
package/CLI/constants/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const p=new RegExp("^/login.*$"),o="https://app.corva.ai/login/help";export{p as LOGIN_ROUTE_REG_EXP,o as NEED_HELP_EXTERNAL_LINK};
|
package/CLI/context/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as
|
|
1
|
+
import{createContext as o,useContext as r}from"react";const t=o(null),c=()=>r(t);export{t as AuthContext,c as useAuth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{post as
|
|
1
|
+
import{post as e}from"@corva/ui/clients/api/apiCore";const i=i=>e("/v1/user_token",i),o=i=>e("/v1/sessions/verification/request",i);export{i as getUserToken,o as requestVerification};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const i={wrongEmailOrPassword:"Wrong user name or password",missingVerificationCode:'"Missing verification code',invalidVerificationCode:"Invalid verification code"};export{i as ERRORS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useState as t,useRef as n,useEffect as o}from"react";import{get as i}from"lodash";import*as s from"@corva/ui/clients/jsonApi";import{updateUserUnits as r}from"@corva/ui/utils/convert";import a from"../../../../clients/auth0/index.js";import{LOGIN_ROUTE_REG_EXP as e}from"../../../constants/index.js";import{ERRORS as c}from"./constants.js";import{getUserToken as m}from"./api.js";const u=t=>fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});function l(l){const[p,f]=t(null),[y,d]=t(!0),[h,g]=t(null),C=n(null);async function _(){d(!0);const t=await s.getCurrentUser();t?(f(t),r({userUnits:t.unit_system,companyUnits:i(t,"company.unit_system"),companyCustomUnitSystem:i(t,"company.custom_unit_system"),userCustomUnitSystem:i(t,"custom_unit_system"),companyCustomUnits:i(t,"company.custom_units")})):l.push("/login"),d(!1)}C.current||(C.current=new a);return o((()=>{if(e.test(l.location.pathname))return d(!1);_()}),[l.location.pathname]),{user:p,loading:y,error:h,login:async(t="",n,o)=>{g(null),d(!0);const i={auth:n};t&&(i.platform=t);try{const t=await m(i);u({AUTH_TOKEN:t.jwt}),_().then(o)}catch(t){t.isInvalidVerificationCode?.()?g(c.invalidVerificationCode):t.isMissingVerificationCode?.()?g(c.missingVerificationCode):g(c.wrongEmailOrPassword)}d(!1)},logout:async()=>{u({AUTH_TOKEN:""}),await s.logout(),l.push("/login")},auth0:C.current}}export{l as default};
|
package/CLI/hocs/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{DEFAULT_APP_SIZE as t}from"@corva/ui/constants/apps";function o(t){return JSON.parse(localStorage.getItem(t))||{}}function i(t,i){const n=o(t)||{};localStorage.setItem(t,JSON.stringify({...n,...i}))}const n=i=>{const n=i?.application?.ui?.initial_size??t;return o(i?.application?.key).coordinates||{...n,x:0,y:0}};export{n as getAppCoordinates,o as getLocalAppData,i as updateLocalAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{DEV_CENTER_CLI_APP_ID as t}from"@corva/ui/constants";import{getFeatureFlagAppsIsolation as e}from"@corva/ui/clients/clientStorage";import{AppsDataProvider as o,DevCenterIsolatedApp as s}from"@corva/ui/components";import{jsx as a}from"react/jsx-runtime";const n=e(),p=({CLIAppComponent:e,CLIAppSettings:p,packageJson:i})=>({manifest:r,dashboardProps:c,coordinates:m,...d})=>{const l=r.application.key,{version:g}=i,f={app:{app_key:l,platform:"dev_center"},id:t,package:{manifest:r,build:`${l}-${g}`,version:g},segment:r.application.segments,settings:d.settings};return a(o,{dashboardAssetId:c.assetId,apps:[f],children:a(s,{...d,isIsolationFeatureEnabled:n,app:f,coordinates:m,CLIAppComponent:e,CLIAppSettings:p})})};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useState as t}from"react";import{getLocalAppData as s,updateLocalAppData as e}from"./utils.js";import{useAuth as n}from"../context/auth.js";import{jsx as r}from"react/jsx-runtime";const o=o=>i=>{const{user:a}=n(),m=i.manifest.application.key,[c,g]=t(s(m).settings||{});return r(o,{...i,currentUser:a,settings:c,onSettingChange:(t,s)=>{const n={...c||{},[t]:s};e(m,{settings:n}),g(n)},onSettingsChange:t=>{const s={...c||{},...t};e(m,{settings:s}),g(s)}})};export{o 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
|
|
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 s}from"@corva/ui/config/initGlobalDependencies";import{isPDFReportView as t}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,s();const n=({component:o,settings:s,manifest:n,packageJson:u})=>()=>{const f=a(i({CLIAppComponent:o,CLIAppSettings:s,packageJson:u})),g=t?p(f):m(f),j=e(c(g));return l(r,{children:l(j,{manifest:n,dashboardProps:{}})})};export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useMemo as t}from"react";import{createDevCenterRouter as r}from"../../utils/devcenter.js";import"../../utils/recaptcha.js";import{jsx as e}from"react/jsx-runtime";const o=o=>({router:c,...i})=>{const m=t((()=>r(c)),[c.location]);return e(o,{...i,devCenterRouter:m})};export{o as default,o as withDevCenterRouterHOC};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useState as o}from"react";import{WidthProvider as e,Responsive as i}from"react-grid-layout";import{pick as t,cloneDeep as n}from"lodash";import{withSize as r}from"react-sizeme";import{isPhoneDetected as s,isNativeDetected as p,isMobileDetected as m}from"@corva/ui/utils/mobileDetect";import{getAppSize as a}from"@corva/ui/utils/apps";import{GRID_BREAKPOINTS as c,GRID_COLUMN_SIZES as d,GRID_ROW_HEIGHT as l,NON_DRAGGABLE_ELEMENT_SELECTOR as g}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 u}from"../../../components/AppsGridDragHandle/AppsGridDragHandle.js";import h from"../../../components/GridLockButton/index.js";import{isAppMaximized as f}from"../../../utils/devcenter.js";import"../../../utils/recaptcha.js";import{getLocalAppData as j,getAppCoordinates as L,updateLocalAppData as b}from"../utils.js";import"./withGridLayoutHOC.global.css.js";import D from"./withGridLayoutHOC.css.js";import{jsxs as y,jsx as H}from"react/jsx-runtime";const S=`.${u.GRID_LAYOUT_DRAG_HANDLE_CLASS}`,v=e(i),x=e=>r()((({size:i,...r})=>{const x=i.width,C=r.manifest.application.key,[w,z]=o(j(C).isDraggable??!1),A=p||m,G=f(r.devCenterRouter.location.query),[R,k]=o(L(r.manifest)),{pixelHeight:E,pixelWidth:F}=a({coordinates:R,dashboardWidth:x,isMaximized:G}),M=([o])=>{const e=t(o,["x","y","w","h"]);k(e),b(C,{coordinates:e})},[O,_]=o({});return y("div",{children:[H(v,{breakpoints:s?c.phone:c.general,cols:d,rowHeight:l,measureBeforeMount:!0,onResizeStop:M,onDragStop:M,isDraggable:!A&&w,isResizable:!A&&w,draggableCancel:g,useCSSTransforms:!1,draggableHandle:S,onLayoutChange:(o,e)=>{o===e.small?_(e):_({...O,medium:n(o),large:n(o)})},layouts:O,children:H("div",{"data-grid":R,children:y("div",{className:G?D.appMaximized:"",children:[H(e,{...r,coordinates:{...R,pixelHeight:E,pixelWidth:F},layoutEnvironment:{type:"general",pdfReportMode:!1}}),!A&&w&&H(u,{})]})},"with-grid-layout-hoc")}),H(h,{isDraggableAndResizable:w,onClick:()=>{z(!w),b(C,{isDraggable:!w})},pageName:"DashboardPo"})]})}));export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{makeStyles as e}from"@material-ui/core";import{getAppType as o,getPDFAppPixelSize as i}from"@corva/ui/utils/dashboardReports";import{getAppCoordinates as r}from"./utils.js";import{jsx as t}from"react/jsx-runtime";const p=e({page:{backgroundColor:"#fff",width:"21cm",height:"29.7cm",margin:"auto",overflow:"hidden",position:"relative",pageBreakAfter:"always",boxShadow:"#ccc 0px 1px 3px 0px, #ccc 0px 0px 0px 1px",paddingTop:2},pdfReportApp:{display:"inline-block",overflow:"hidden",position:"relative",zoom:"0.5",margin:"0 0.1cm",pointerEvents:"none"}}),a=e=>a=>{const n=p(),c=r(a.manifest),d=!!a.manifest.application.ui?.full_screen_report,l=o({coordinates:c,isFullScreenReport:d});return t("div",{className:n.page,children:t("div",{className:n.pdfReportApp,style:{width:`${l.width}cm`,height:`${l.height}cm`},children:t(e,{...a,coordinates:{...c,...i(l)},layoutEnvironment:{type:"general",pdfReportMode:!0}})})})};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useMemo as o}from"react";import{BrowserRouter as r,useHistory as n,useLocation as t,Switch as e,Redirect as c,Route as p}from"react-router-dom";import{LoadingIndicator as a}from"@corva/ui/components";import i from"../screens/LoginScreen/LoginScreen.js";import m from"../screens/OAuthCallbackScreen/index.js";import{useAuth as s}from"../context/auth.js";import u from"../components/App/App.js";import{jsx as l,jsxs as h}from"react/jsx-runtime";function f(o){const r=new URLSearchParams(o),n={};return r.forEach(((o,r)=>{n[r]=o})),n}function d({WrappedComponent:o,componentProps:r,router:n,location:t}){const{loading:e}=s();return e?l(a,{fullscreen:!0}):l(o,{location:t,router:n,...r})}function g({WrappedComponent:r,componentProps:a}){const s=n(),g=t(),P=o((()=>function(o,r){const n=o=>{if("string"==typeof o)return o;const{pathname:r,query:n}=o;return{pathname:r,search:n?`?${new URLSearchParams(n).toString()}`:""}};return{push:r=>o.push(n(r)),replace:r=>o.replace(n(r)),location:{...r,query:f(r.search)}}}(s,g)),[s,g]);return l(u,{router:P,children:h(e,{children:[l(c,{exact:!0,from:"/",to:"/app"}),l(p,{path:"/login/oauth-callback",children:l(m,{router:P})}),l(p,{path:"/login",children:l(i,{router:P,location:P.location})}),l(p,{path:"/app",children:l(d,{WrappedComponent:r,componentProps:a,router:P,location:P.location})})]})})}const P=o=>n=>l(r,{children:l(g,{WrappedComponent:o,componentProps:n})});export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useEffect as o}from"react";import{getCurrentUser as n}from"@corva/ui/clients/jsonApi";import"../../../components/Login/components/Chip.js";import"../../../components/Login/components/EmailField.js";import"../../../components/Login/components/HiddenEmailField.js";import t 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 e from"./components/Auth.js";import i from"./components/IconLogo.js";import m from"./LoginScreen.css.js";import{jsx as p}from"react/jsx-runtime";function s({router:s,location:r}){return o((()=>{!async function(){let o=null;try{o=await n()}catch(o){console.error(o)}o&&s.replace("/")}()}),[]),p("div",{className:m.loginScreen,children:p(t,{location:r,logoIcon:p(i,{}),promoLink:"https://youtu.be/-q6LkceqpGs",children:p(e,{router:s})})})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useState as e}from"react";import t from"./EmailStep.js";import s from"./AuthStep.js";import{jsx as i}from"react/jsx-runtime";function m({router:m}){const[a,o]=e({email:null,schemas:{},step:0});return 0===a.step?i(t,{onNext:(e,t)=>o((s=>({step:s.step+1,email:e,schemas:t})))}):i(s,{email:a.email,schemas:a.schemas.schemas,identityVerification:a.schemas.identity_verification,onBack:()=>o((e=>({step:e.step-1,email:null,schemas:null}))),onFinishLogin:()=>m.push("/")})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{memo as o,useState as e,useRef as n,useEffect as i}from"react";import{styled as t,Grid as r,Button as c}from"@material-ui/core";import{showErrorNotification as m}from"@corva/ui/utils";import{isSSOPlatformSupported as a}from"@corva/ui/clients/sso";import{initializeRecaptcha as s,GOOGLE_RECAPTCHA_KEY as p}from"../../../../utils/recaptcha.js";import d from"../../../../components/Login/components/Chip.js";import"../../../../components/Login/components/EmailField.js";import l from"../../../../components/Login/components/HiddenEmailField.js";import"../../../../components/Login/components/Login.js";import f from"../../../../components/Login/components/OrDivider.js";import g from"../../../../components/Login/components/PasswordField.js";import u from"../../../../components/Login/components/Step.js";import h from"../../../../components/Login/components/StepContent.js";import v from"../../../../components/Login/components/StepFooter.js";import j from"../../../../components/Login/components/StepHeader.js";import{VerificationStep as w}from"../../../../components/Login/components/VerificationStep.js";import{useAuth as L}from"../../../context/auth.js";import{NEED_HELP_EXTERNAL_LINK as S}from"../../../constants/index.js";import{ERRORS as C}from"../../../hocs/effects/useProvideAuth/constants.js";import{requestVerification as b}from"../../../hocs/effects/useProvideAuth/api.js";import y from"./SSOButton.js";import{jsx as k,jsxs as B}from"react/jsx-runtime";const P=t(r)((({theme:o})=>({marginTop:2*o.spacing(1),marginBottom:2*o.spacing(1),"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0}}))),_=t(c)((({theme:o})=>({width:71,padding:o.spacing(),whiteSpace:"nowrap",backgroundColor:o.status.loginButton,"&:hover":{backgroundColor:`${o.status.loginButtonHovered}`}})));var x=o((function({email:o,schemas:t,onBack:c,onFinishLogin:x,identityVerification:F}){const V=L(),[E,H]=e(""),[A,I]=e(!1),[O,T]=e({code:null,mode:null}),z=n(null),D=A&&V.error===C.wrongEmailOrPassword?V.error:null;i((()=>{s()}),[]);const q=e=>{if(!e)return m("Problem with initializing recaptcha");z.current=e;const n={email:o,password:E,recaptcha_token:e};O.code&&(n.verification_code=O.code,n.verification_mode=O.mode),V.login(null,n,x).then((()=>I(!0)))},M=async o=>{if(o.preventDefault(),!window.grecaptcha)return q();let e=!1;return window.grecaptcha.enterprise.ready((()=>{e=!0;try{window.grecaptcha.enterprise.execute(p,{action:"login"}).then(q).catch(console.error)}catch(o){console.error(o),m(o.message)}})),setTimeout((()=>{e||q()}),1e3)};i((()=>{if(!O.code)return;const e={email:o,password:E,recaptcha_token:z.current};O.code&&(e.verification_code=O.code,e.verification_mode=O.mode),V.login(null,e,x)}),[O.code]);const $=t.find((o=>"password"===o.provider)),G=t.filter((o=>"password"!==o.provider&&a(o?.platform?.identifier)));return A&&F?.enabled&&!D?k(w,{email:o,identityVerification:F,loginVerificationFailure:V.error===C.invalidVerificationCode,onCodeProvided:T,password:E,requestVerification:b}):B(u,{children:[k(j,{children:"Sign In"}),k(h,{children:B(r,{container:!0,direction:"column",children:[k(d,{"data-not-migrated-MuiChip":!0,label:o,onClick:c}),G.map((o=>k(P,{item:!0,children:k(y,{title:o.title,provider:o.provider,connection:o.connection,platform:o.platform})},o.title))),$&&G.length>0&&k(r,{item:!0,children:k(f,{})}),$&&k(P,{item:!0,children:B("form",{id:"sign-in-form",onSubmit:M,children:[k(l,{email:o}),k(g,{value:E,onChange:o=>{H(o.target.value),I(!1)},disabled:V.loading,error:D})]})})]})}),k(v,{needHelpExternalLink:S,children:$&&k(_,{"data-testid":"AuthorizationPo_signInButton",form:"sign-in-form",type:"submit",variant:"contained",color:"primary",disabled:!E||V.loading||!!D,onClick:M,children:"Sign In"})})]})}));export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{memo as o,useState as n}from"react";import{styled as t}from"@material-ui/core/styles";import e from"@material-ui/core/Button";import{getUserAuthSchemas as i}from"@corva/ui/clients/jsonApi";import"../../../../components/Login/components/Chip.js";import r 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 m from"../../../../components/Login/components/Step.js";import p from"../../../../components/Login/components/StepContent.js";import s from"../../../../components/Login/components/StepFooter.js";import c from"../../../../components/Login/components/StepHeader.js";import"../../../../components/Login/components/VerificationStep.js";import{NEED_HELP_EXTERNAL_LINK as a}from"../../../constants/index.js";import{jsxs as l,jsx as d}from"react/jsx-runtime";const u=t(e)((({theme:o})=>({width:71,padding:o.spacing(),backgroundColor:o.status.loginButton,"&:hover":{backgroundColor:`${o.status.loginButtonHovered}`}})));var f=o((function({onNext:o}){const[t,e]=n(!1),[f,g]=n(null),[h,j]=n(""),L=n=>{if(n.preventDefault(),!h)return g("Required");e(!0),i({email:h,with_provider:!0}).then((n=>o(h,n))).catch((()=>g("Invalid email"))).finally((()=>e(!1)))};return l(m,{children:[d(c,{children:"Sign In"}),d(p,{children:d("form",{id:"email-form",onSubmit:L,autoComplete:"on",children:d(r,{value:h,onChange:o=>{j(o.target.value),g(null)},disabled:!!t,error:f})})}),d(s,{needHelpExternalLink:a,children:d(u,{"data-testid":"EmailPo_nextButton",form:"email-form",type:"submit",variant:"contained",color:"primary",disabled:t||!!f,onClick:L,children:"Next"})})]})}));export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useState as t}from"react";import{withStyles as e,ButtonBase as o,Grid as r,Avatar as i,Typography as a,CircularProgress as n}from"@material-ui/core";import{getSSOProvider as s}from"@corva/ui/clients/sso";import{jsx as l,jsxs as c}from"react/jsx-runtime";const d={google:"/static/media/55de612562c712e3a9d6ea86000e18c7.svg",microsoft:"/static/media/319d9b9a39d511547cf55d1336a8eca4.svg"};var f=e((t=>({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:t.status.loginButton}},logo:{height:30,width:30,margin:12},avatar:{height:30,width:30,margin:12,color:"#ffffff",backgroundColor:t.status.loginButton},progressRoot:{margin:"12px 24px"},progressColor:{color:t.status.loginButton}})))((function({platform:e,connection:f,title:m,provider:g,classes:h}){const[p,u]=t(!1),b=d[g];return l(o,{className:h.button,onClick:t=>{if(t.preventDefault(),!p){u(!0),localStorage.setItem("ssoPlatform",e.identifier);const t=s(e.identifier);t.configure(e.options),t.authorize(f)}},children:c(r,{container:!0,justify:"space-between",alignItems:"center",children:[l(r,{item:!0,children:c(r,{container:!0,justify:"flex-start",alignItems:"center",children:[l(r,{item:!0,children:b?l("img",{className:h.logo,src:b,alt:m}):l(i,{className:h.avatar,children:m&&m[0].toUpperCase()})}),l(r,{item:!0,children:l(a,{variant:"body2",children:m})})]})}),l(r,{item:!0,children:p&&l(n,{classes:{root:h.progressRoot,colorPrimary:h.progressColor},color:"primary",size:30})})]})})}));export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useEffect as o}from"react";import{LoadingIndicator as t}from"@corva/ui/components";import{showErrorNotification as r}from"@corva/ui/utils";import{getUserAuthPlatform as e}from"@corva/ui/clients/jsonApi";import{getSSOProvider as i}from"@corva/ui/clients/sso";import{useAuth as n}from"../../context/auth.js";import{jsx as a}from"react/jsx-runtime";function c({router:c}){const{login:s}=n(),u=o=>{console.error(o),r("Sorry, but we couldn’t log you in. Please contact Corva support if you need assistance"),c.push("/login")},m=async()=>{const o=localStorage.getItem("ssoPlatform");localStorage.removeItem("ssoPlatform");const{platform:t}=await e(o),r=i(t.identifier);if(!r)return u(`No authentication platform found for ${t.identifier}`);try{r.configure(t.options);const o=await r.authenticate();return((o,t)=>{s(o,{token:t},(()=>c.push("/")))})(t.identifier,o)}catch(o){return u(o)}};return o((()=>{m()}),[]),a(t,{fullscreen:!1})}export{c as default};
|
package/README.md
CHANGED
|
@@ -1,28 +1,76 @@
|
|
|
1
1
|
# corva-dc-platform-shared
|
|
2
|
+
|
|
2
3
|
A repository to share Dev Center platform code
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
```
|
|
6
37
|
|
|
7
|
-
##
|
|
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`
|
|
38
|
+
## Branch Strategy
|
|
11
39
|
|
|
12
|
-
|
|
40
|
+
- `develop` - main development branch
|
|
41
|
+
- `feature/*` - new features
|
|
42
|
+
- `fix/*` - bug fixes
|
|
43
|
+
- No direct commits to `develop`
|
|
13
44
|
|
|
14
|
-
|
|
45
|
+
## Release Process
|
|
15
46
|
|
|
16
|
-
|
|
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
|
|
17
57
|
|
|
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⚠⚠⚠**
|
|
58
|
+
## Version Bumping
|
|
20
59
|
|
|
21
|
-
|
|
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
|
|
22
65
|
|
|
23
|
-
|
|
66
|
+
## CI Checks
|
|
24
67
|
|
|
25
|
-
|
|
68
|
+
Your PR must pass:
|
|
26
69
|
|
|
27
|
-
|
|
70
|
+
- Linting
|
|
71
|
+
- Unit tests
|
|
72
|
+
- E2E tests (feature/fix branches)
|
|
73
|
+
- PR title validation
|
|
74
|
+
- Code review
|
|
28
75
|
|
|
76
|
+
Remember: The key is writing good code and using correct commit conventions - the release process is automated!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"../../../CLI/hocs/withCorvaMagicHOC.js";import{createAdaptiveRoot as t}from"./createAdaptiveRoot.js";import{jsx as o}from"react/jsx-runtime";Promise.all([import(`${process.env.DEV_CENTER_APP_PATH}/src/index.js`),import(`${process.env.DEV_CENTER_APP_PATH}/manifest.json`),import(`${process.env.DEV_CENTER_APP_PATH}/package.json`)]).then((([s,n,r])=>{const m=e({component:s.default.component,settings:s.default.settings,manifest:n.default,packageJson:r.default});t(document.getElementById("root")).render(o(m,{}))}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"prop-types";import{makeStyles as t}from"@material-ui/core";import*as n from"@corva/ui";import{DevCenterIsolatedAppPage as p}from"@corva/ui/components";import{initGlobalDependencies as r}from"@corva/ui/config";import{createAdaptiveRoot as e}from"./createAdaptiveRoot.js";import{jsx as i}from"react/jsx-runtime";window["@corva/ui"]=n,r();const m=t((()=>({reportsContainer:{zoom:"0.5"}})));function s({CLIAppComponent:o=null,CLIAppSettings:t=null}){const n=m();return i(p,{CLIAppComponent:o,CLIAppSettings:t,containerReportClassName:n.reportsContainer})}s.propTypes={CLIAppComponent:o.func,CLIAppSettings:o.func},import(`${process.env.DEV_CENTER_APP_PATH}/src/index.js`).then((o=>{const t=o.default.component,n=o.default.settings;e(document.getElementById("root")).render(i(s,{CLIAppComponent:t,CLIAppSettings:n}))}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"mapbox-gl";try{const i=window["@corva/ui"],n=i&&i.config&&i.config.initMapbox,c=i&&i.config&&i.config.MAP_BOX_ACCESS_TOKEN,a="function"==typeof n?n(o):o;a&&!a.accessToken&&c&&(a.accessToken=c),window["mapbox-gl"]=a}catch(o){console.warn("Failed to initialize mapbox-gl for local development:",o)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const a={qa:"qa",staging:"staging",production:"production"},e={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"},t={[a.qa]:{...e,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"},[a.staging]:{...e,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"},[a.production]:{...e,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"}};exports.CORVA_API_ENVS=a,exports.CORVA_API_ENV_VARIABLES=t,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",classnames:"2.2.6","corva-convert-units":"1.10.33",highcharts:"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","^4.18.1"],"mapbox-gl":"3.16.0",moment:"2.29.4","moment-timezone":"0.5.43",react:["17.0.1","18.3.1"],"react-dom":["17.0.1","18.3.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","prop-types":"^15.6.1",uuid:"3.4.0"},exports.DEPRECATED_DEPENDENCIES=[{dependency:"mapbox.js",message:'mapbox.js is deprecated and is no longer provided to Dev Center apps as a shared dependency. Use mapbox-gl 3.16.0 instead (provided by the platform as the window["mapbox-gl"] shared dependency). Remove mapbox.js from your package.json and migrate any L.mapbox usage to mapbox-gl.'}],exports.UNSUPPORTED_DEPENDENCIES=[{dependency:"date-fns",alternative:"moment"},{dependency:"date-fns-tz",alternative:"moment-timezone"},{dependency:"date-fns-timezone",alternative:"moment-timezone"}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react-dom";function o(o){return"function"==typeof e.createRoot?e.createRoot(o):(console.info("[dc-platform-shared] React 17 detected — mounting via legacy ReactDOM.render"),{render(t){e.render(t,o)},unmount(){e.unmountComponentAtNode(o)}})}export{o as createAdaptiveRoot};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const e=require("node-fetch"),r=require("chalk"),o=require("semver/functions/gt"),t=require("path"),n=require("fs"),s=process.cwd(),a=JSON.parse(n.readFileSync(t.resolve(s,"./node_modules/@corva/ui/package.json"),"utf-8"));let i=null;module.exports=function(t){t.hooks.afterCompile.tapPromise("checkCorvaUIVersion",(async t=>{const n=t.getLogger("checkCorvaUIVersion"),s=a.version;i||(i=await function(r){return e("https://registry.npmjs.org/@corva/ui/latest").then((e=>e.ok?e.json().then((e=>e.version)):r.warn("Could not fetch latest @corva/ui version"))).catch((e=>r.warn("Connection error",e)))}(n)),i&&o(i,s)&&n.warn(r`
|
|
2
|
+
****************************************************************
|
|
3
|
+
|
|
4
|
+
You are using outdated version of @corva/ui {grey (${s})}.
|
|
5
|
+
Current latest version is {green.bold (${i})}.
|
|
6
|
+
This may lead to problems once the app is published.
|
|
7
|
+
Please update the @corva/ui with the following command:
|
|
8
|
+
|
|
9
|
+
{green.bold yarn add @corva/ui@latest}
|
|
10
|
+
|
|
11
|
+
****************************************************************`)}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./serializeDotEnv.js");const r=require("fs").promises,t=require("path"),o=require("express");exports.onBeforeSetupMiddleware=function(s,{APP_DIRECTORY:i}){s.use(o.json()),s.patch("/dotenv",(async function(o,s){let n="";try{n=await r.readFile(t.resolve(i,"./.env"),"utf8")}catch(e){}try{await r.writeFile(t.resolve(i,"./.env"),e.updateDotEnv(n,o.body))}catch(e){console.error("Could not write to .env file"),console.error(e)}s.sendStatus(200)}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=(e,t)=>`${e}=${(e=>{let t=e.replace(/\n/g,"\\n");return(t.includes(" ")||t.includes("\t"))&&(t=`"${t.replace(/"/g,'\\"')}"`),t})(t)}`;exports.updateDotEnv=(t="",n)=>{const r=n||{};return t.split("\n").map((t=>{if(!t.length||t.startsWith("#"))return t;const[n]=t.split("=");if(Object.keys(r).includes(n)){const t=r[n];return delete r[n],e(n,t)}return t})).concat(Object.entries(r).map((([t,n])=>e(t,n)))).join("\n")};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../constants.js");exports.default=function({dependencies:n={}}){const s=[];return Object.entries(e.CORVA_GLOBAL_DEPENDENCIES).forEach((([e,t])=>{if(t&&e in n){const r=n[e];Array.isArray(t)?t.includes(r)||s.push(`${e} version must be one of [${t.join(", ")}]`):r!==t&&s.push(`${e} version must be ${t}`)}})),e.UNSUPPORTED_DEPENDENCIES.forEach((({dependency:e,alternative:t=""})=>{e in n&&s.push(`${e} is not supported.${t?` Please use ${t} instead.`:""}`)})),s},exports.getDependenciesWarnings=function({dependencies:n={}}){const s=[];return e.DEPRECATED_DEPENDENCIES.forEach((({dependency:e,message:t})=>{e in n&&s.push(t)})),s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./dependencies.js")
|
|
1
|
+
"use strict";var e=require("./dependencies.js");const o=require("chalk");module.exports=function({packageJson:n}){const s=e.default(n);e.getDependenciesWarnings(n).forEach((e=>console.log(o.yellow(e)))),s.forEach((e=>console.log(o.red(e)))),s.length&&process.exit(1)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./validators/index.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./validators/index.js");const s=require("webpack"),o=require("path"),r=require("uuid/v1"),{CleanWebpackPlugin:t}=require("clean-webpack-plugin"),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:/\.(s[ac]|c)ss$/i,use:["style-loader",{loader:"css-loader",options:{modules:{localIdentName:"development"===l.mode?`[path][name]__[local]__[hash:base64:10]__${r().substr(-5)}`:`[name]--[local]__[hash:base64:10]__${r().substr(-5)}`,namedExport:!1},importLoaders:2}},{loader:"postcss-loader",options:{postcssOptions:{plugins:["postcss-preset-env"]}}},{loader:"sass-loader",options:{sourceMap:!0}}]},{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(
|
|
1
|
+
"use strict";var e=require("./webpack.config.common.js"),r=require("./constants.js"),o=require("./plugins/checkCorvaUIVersion.js"),n=require("./utils/middlewares.js");const s=require("@pmmmwh/react-refresh-webpack-plugin"),{merge:t}=require("webpack-merge"),i=require("path"),a=require("webpack"),{CleanWebpackPlugin:l}=require("clean-webpack-plugin"),p=require("copy-webpack-plugin"),c=require("html-webpack-plugin"),u=require("chalk");require("dotenv").config({path:i.resolve(e.APP_DIRECTORY,"./.env")});const d=()=>{const e=process.env.CORVA_API_ENV||r.CORVA_API_ENVS.production;return e in r.CORVA_API_ENVS?r.CORVA_API_ENV_VARIABLES[e]:(console.log(u.red(`CORVA_API_ENV should be one of [${Object.keys(r.CORVA_API_ENVS).join(", ")}]`)),process.exit(1))};function m(e,r,o){const n=i.join("@corva","dc-platform-shared"),s="@corva/ui",t=new RegExp("(^@corva/ui$|^@corva/ui/)([^]+)?");if(!e.includes(n)){const e=t.exec(r);if(null!==e){return o(null,["window",s,...(e[2]||"").split("/").filter(Boolean)])}}return o()}const v=r=>i.dirname(require.resolve(`${r}/package.json`,{paths:[e.APP_DIRECTORY]}));module.exports=function(r,u){const _=process.env.HOST||u.host||"app.local.corva.ai",A=process.env.PORT||u.port||8080,P="mapbox-gl"in(e.packageJson.dependencies||{})?[i.resolve(__dirname,"MapboxGlDevSetupEntryPoint.js")]:[];return t(e.default(r,u),{mode:"development",devtool:"inline-source-map",resolve:{alias:{react:v("react"),"react-dom":v("react-dom")}},devServer:{static:"./dist",host:_,port:A,setupMiddlewares:(r,o)=>(n.onBeforeSetupMiddleware(o.app,{APP_DIRECTORY:e.APP_DIRECTORY}),r),hot:!0,open:!1},entry:{devApp:[i.resolve(__dirname,"DevServerEntryPoint.js"),...P],isolatedApp:[i.resolve(__dirname,"DevServerIsolatedAppEntryPoint.js"),...P]},output:{filename:"[name].js"},plugins:[new l,new p({patterns:[{from:i.resolve(__dirname,"public")},{from:i.resolve(process.cwd(),"node_modules","@corva/ui/assets"),to:"static/media",noErrorOnMissing:!0},{from:i.resolve(process.cwd(),"node_modules","@corva/dc-platform-shared/assets"),to:"static/media",noErrorOnMissing:!0}]}),new c({filename:"index.html",inject:!1,template:i.resolve(__dirname,"public","index.html")}),new c({filename:"DevCenterIsolatedAppPage.html",inject:!1,template:i.resolve(__dirname,"public","DevCenterIsolatedAppPage.html")}),new a.EnvironmentPlugin({...process.env,DEV_CENTER_APP_PATH:process.cwd(),REACT_APP_ENVIRONMENT:process.env.REACT_APP_ENVIRONMENT||"development",...d()}),o,new s],externals:m,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(
|
|
1
|
+
"use strict";var e=require("./webpack.config.common.js"),r=require("./constants.js");const t=require("webpack"),{merge:n}=require("webpack-merge"),s=require("path"),i=require("terser-webpack-plugin"),o=require("copy-webpack-plugin"),{application:{key:l}}=e.manifestJson,{version:a}=e.packageJson,u=e=>{const r=l.replace(/\./g,"_");return e?r:`${r}-${a}`},p=Object.keys(r.CORVA_GLOBAL_DEPENDENCIES).map((e=>[e,new RegExp(`(^${e}$|^${e}/)([^]+)?`)])),c=["react/jsx-runtime","highcharts/"];module.exports=function(r,l){const a=!!r?.local_debug;return n(e.default(r,l),{entry:"./src/index.js",output:{library:u(a),path:s.resolve(e.APP_DIRECTORY,"dist"),filename:"app.js",libraryTarget:"window"},mode:a?"development":"production",plugins:[new t.EnvironmentPlugin(process.env),new o({patterns:[{from:s.resolve(process.cwd(),"manifest.json"),to:"./",noErrorOnMissing:!0}]})],optimization:{minimizer:[new i({parallel:!0})]},externals:[function(e,r,t){if(r.endsWith(".css"))return t();for(let e=0;e<c.length;e+=1)if(r.startsWith(c[e]))return t();for(let e=0;e<p.length;e+=1){const[n,s]=p[e],i=s.exec(r);if(null!==i){return t(null,[n,...(i[2]||"").split("/").filter(Boolean)])}}return t()}],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}}]}]}})};
|
package/clients/auth0/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import o from'./../../ext-esm/auth0-js/dist/auth0.min.esm.js';class t{constructor(){e(this,"handleAuthentication",((e,o)=>this.webAuth.parseHash(((t,i)=>{i&&i.accessToken?e(i):t&&o(t)})))),e(this,"loginWithConnection",(e=>this.webAuth.authorize({connection:e}))),this.webAuth=new o.WebAuth({domain:process.env.REACT_APP_AUTH0_DOMAIN,clientID:process.env.REACT_APP_AUTH0_CLIENT_ID,redirectUri:`${window.location.origin}/login/oauth-callback`,audience:process.env.REACT_APP_AUTH0_AUDIENCE,responseType:"token",scope:"openid profile email"})}}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{makeStyles as o,Tooltip as a,IconButton as r}from"@material-ui/core";import{UnlockIcon as t,LockIcon as e}from"@corva/ui/icons";import i from"classnames";import{jsx as c}from"react/jsx-runtime";const s=o({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({className:o,disabled:d,isDraggableAndResizable:l,LockIcon:n=e,lockIconClassName:m,onClick:u,pageName:b,tooltipProps:h={}}){const g=s();return c(a,{title:d?"Can't unlock dashboard layout":l?"Lock Dashboard Layout":"Unlock Dashboard Layout",...h,children:c("div",{className:i(g.root,o),children:c(r,{className:g.button,"data-testid":`${b}_${l?"gridUnlocked":"gridLocked"}`,disabled:d,onClick:u,children:l?c(t,{}):c(n,{className:m})})})})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"prop-types";import{styled as t,withStyles as i,Grid as r,Chip as a}from"@material-ui/core";import o from"@material-ui/icons/ArrowBack";import{jsx as n}from"react/jsx-runtime";const p=t(o)((({theme:e})=>({color:e.palette.primary.text6,fontSize:16}))),s=({label:e,onClick:t,classes:i,dataTestid:o=null})=>n(r,{item:!0,className:i.chip,children:n(a,{label:e,className:i.chipContent,icon:n(p,{}),variant:"outlined",onClick:t,"data-testid":o})});s.propTypes={label:e.string.isRequired,dataTestid:e.string,onClick:e.func.isRequired,classes:e.shape({}).isRequired};var l=i((e=>({chip:{marginTop:"-25px",marginBottom:20,textAlign:"center"},chipContent:{color:e.palette.primary.text6,fontSize:13,border:"none",background:"#2C2C2C",padding:"0 5px 0 10px"}})))(s);export{l as default};
|