@corva/dc-platform-shared 0.59.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{useState as e,useRef as o,useEffect as i}from"react";import{get as s}from"lodash";import*as a from"@corva/ui/clients/jsonApi";import{updateUserUnits as u}from"@corva/ui/utils/convert";import c from"../../../../clients/auth0/index.js";import{LOGIN_ROUTE_REG_EXP as m}from"../../../constants/index.js";import{ERRORS as l}from"./constants.js";import{getUserToken as p}from"./api.js";var f=function(t){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})};function d(d){var h=e(null),v=n(h,2),y=v[0],g=v[1],w=e(!0),x=n(w,2),C=x[0],_=x[1],b=e(null),T=n(b,2),U=T[0],j=T[1],A=o(null);function k(){return O.apply(this,arguments)}function O(){return(O=t(r.mark((function t(){var n;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return _(!0),t.next=3,a.getCurrentUser();case 3:(n=t.sent)?(g(n),u({userUnits:n.unit_system,companyUnits:s(n,"company.unit_system"),companyCustomUnitSystem:s(n,"company.custom_unit_system"),userCustomUnitSystem:s(n,"custom_unit_system"),companyCustomUnits:s(n,"company.custom_units")})):d.push("/login"),_(!1);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}A.current||(A.current=new c);var V,E,H=(V=t(r.mark((function t(){var n,e,o,i,s,a,u,c=arguments;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.length>0&&void 0!==c[0]?c[0]:"",e=c.length>1?c[1]:void 0,o=c.length>2?c[2]:void 0,j(null),_(!0),i={auth:e},n&&(i.platform=n),t.prev=7,t.next=10,p(i);case 10:s=t.sent,f({AUTH_TOKEN:s.jwt}),k().then(o),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(7),null!==(a=t.t0.isInvalidVerificationCode)&&void 0!==a&&a.call(t.t0)?j(l.invalidVerificationCode):null!==(u=t.t0.isMissingVerificationCode)&&void 0!==u&&u.call(t.t0)?j(l.missingVerificationCode):j(l.wrongEmailOrPassword);case 18:_(!1);case 19:case"end":return t.stop()}}),t,null,[[7,15]])}))),function(){return V.apply(this,arguments)}),N=(E=t(r.mark((function t(){return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return f({AUTH_TOKEN:""}),t.next=3,a.logout();case 3:d.push("/login");case 4:case"end":return t.stop()}}),t)}))),function(){return E.apply(this,arguments)});return i((function(){if(m.test(d.location.pathname))return _(!1);k()}),[]),{user:y,loading:C,error:U,login:H,logout:N,auth0:A.current}}export{d as default};
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{useState as e,useRef as o,useEffect as i}from"react";import{get as s}from"lodash";import*as a from"@corva/ui/clients/jsonApi";import{updateUserUnits as u}from"@corva/ui/utils/convert";import c from"../../../../clients/auth0/index.js";import{LOGIN_ROUTE_REG_EXP as m}from"../../../constants/index.js";import{ERRORS as l}from"./constants.js";import{getUserToken as p}from"./api.js";var f=function(t){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})};function d(d){var h=e(null),v=n(h,2),y=v[0],g=v[1],w=e(!0),x=n(w,2),C=x[0],_=x[1],b=e(null),T=n(b,2),U=T[0],j=T[1],A=o(null);function k(){return O.apply(this,arguments)}function O(){return(O=t(r.mark((function t(){var n;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return _(!0),t.next=3,a.getCurrentUser();case 3:(n=t.sent)?(g(n),u({userUnits:n.unit_system,companyUnits:s(n,"company.unit_system"),companyCustomUnitSystem:s(n,"company.custom_unit_system"),userCustomUnitSystem:s(n,"custom_unit_system"),companyCustomUnits:s(n,"company.custom_units")})):d.push("/login"),_(!1);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}A.current||(A.current=new c);var V,E,H=(V=t(r.mark((function t(){var n,e,o,i,s,a,u,c=arguments;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.length>0&&void 0!==c[0]?c[0]:"",e=c.length>1?c[1]:void 0,o=c.length>2?c[2]:void 0,j(null),_(!0),i={auth:e},n&&(i.platform=n),t.prev=7,t.next=10,p(i);case 10:s=t.sent,f({AUTH_TOKEN:s.jwt}),k().then(o),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(7),null!==(a=t.t0.isInvalidVerificationCode)&&void 0!==a&&a.call(t.t0)?j(l.invalidVerificationCode):null!==(u=t.t0.isMissingVerificationCode)&&void 0!==u&&u.call(t.t0)?j(l.missingVerificationCode):j(l.wrongEmailOrPassword);case 18:_(!1);case 19:case"end":return t.stop()}}),t,null,[[7,15]])}))),function(){return V.apply(this,arguments)}),N=(E=t(r.mark((function t(){return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return f({AUTH_TOKEN:""}),t.next=3,a.logout();case 3:d.push("/login");case 4:case"end":return t.stop()}}),t)}))),function(){return E.apply(this,arguments)});return i((function(){if(m.test(d.location.pathname))return _(!1);k()}),[d.location.pathname]),{user:y,loading:C,error:U,login:H,logout:N,auth0:A.current}}export{d as default};
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{Route as n,IndexRedirect as o,Router as c,browserHistory as p}from"react-router";import{LoadingIndicator as i}from"@corva/ui/components";import{getCurrentUser as a}from"@corva/ui/clients/jsonApi";import s from"../screens/LoginScreen/LoginScreen.js";import u from"../screens/OAuthCallbackScreen/index.js";import{useAuth as m}from"../context/auth.js";import l from"../components/App/App.js";import{jsxs as f,jsx as b}from"react/jsx-runtime";function h(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}var O,j=(O=e(t.mark((function r(e,n,o){var c;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return c=null,r.prev=1,r.next=4,a();case 4:c=r.sent,r.next=10;break;case 7:r.prev=7,r.t0=r.catch(1),console.error(r.t0);case 10:if(!e.location.pathname.startsWith("/login")){r.next=15;break}return c&&n("/"),o(),r.abrupt("return");case 15:c||n("/login"),o();case 17:case"end":return r.stop()}}),r,null,[[1,7]])}))),function(r,e,t){return O.apply(this,arguments)}),g=function(e){return function(t){var n=t.route,o=t.location,c=t.router;return m().loading?b(i,{fullscreen:!0}):b(e,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}({location:o,router:c},n.componentProps||{}))}},y=function(r){return function(e){var t=f(n,{path:"/",component:l,onEnter:j,children:[b(o,{to:"app"}),b(n,{path:"app",component:g(r),componentProps:e}),b(n,{path:"login",component:s}),b(n,{path:"login/oauth-callback",component:u})]});return b(c,{history:p,routes:t})}};export{y as default};
1
+ import r from"@babel/runtime/helpers/defineProperty";import{useMemo as e}from"react";import{BrowserRouter as t,useHistory as o,useLocation as n,Switch as c,Redirect as p,Route as a}from"react-router-dom";import{LoadingIndicator as i}from"@corva/ui/components";import u from"../screens/LoginScreen/LoginScreen.js";import m from"../screens/OAuthCallbackScreen/index.js";import{useAuth as f}from"../context/auth.js";import s from"../components/App/App.js";import{jsx as l,jsxs as h}from"react/jsx-runtime";function b(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,o)}return t}function O(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?b(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):b(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function d(r){var e=r.WrappedComponent,t=r.componentProps,o=r.router,n=r.location;return f().loading?l(i,{fullscreen:!0}):l(e,O({location:n,router:o},t))}function j(r){var t=r.WrappedComponent,i=r.componentProps,f=o(),b=n(),j=e((function(){return function(r,e){var t,o,n,c=function(r){if("string"==typeof r)return r;var e=r.pathname,t=r.query;return{pathname:e,search:t?"?".concat(new URLSearchParams(t).toString()):""}};return{push:function(e){return r.push(c(e))},replace:function(e){return r.replace(c(e))},location:O(O({},e),{},{query:(t=e.search,o=new URLSearchParams(t),n={},o.forEach((function(r,e){n[e]=r})),n)})}}(f,b)}),[f,b]);return l(s,{router:j,children:h(c,{children:[l(p,{exact:!0,from:"/",to:"/app"}),l(a,{path:"/login/oauth-callback",children:l(m,{router:j})}),l(a,{path:"/login",children:l(u,{router:j,location:j.location})}),l(a,{path:"/app",children:l(d,{WrappedComponent:t,componentProps:i,router:j,location:j.location})})]})})}var y=function(r){return function(e){return l(t,{children:l(j,{WrappedComponent:r,componentProps:e})})}};export{y as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./validators/index.js"),s=require("webpack"),o=require("path"),r=require("uuid/v1"),t=require("clean-webpack-plugin").CleanWebpackPlugin,a=require("fs"),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]__".concat(r().substr(-5)):"[name]--[local]__[hash:base64:10]__".concat(r().substr(-5))},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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./validators/index.js"),s=require("webpack"),o=require("path"),r=require("uuid/v1"),t=require("clean-webpack-plugin").CleanWebpackPlugin,a=require("fs"),l=process.cwd(),n=JSON.parse(a.readFileSync(o.resolve(l,"./package.json"),"utf-8")),i=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]__".concat(r().substr(-5)):"[name]--[local]__[hash:base64:10]__".concat(r().substr(-5)),namedExport:!1},importLoaders:2}},{loader:"postcss-loader",options:{postcssOptions:{plugins:["postcss-preset-env"]}}},{loader:"sass-loader",options:{sourceMap:!0,sassOptions:{silenceDeprecations:["import","global-builtin"]}}}]},{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=i,exports.packageJson=n;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@corva/dc-platform-shared",
3
- "version": "0.59.0",
3
+ "version": "0.61.0",
4
4
  "description": "A library to share internal DC platform specific code",
5
5
  "main": "./dist",
6
6
  "module": "./src/index.js",
7
7
  "repository": "git@github.com:corva-ai/corva-dc-platform-shared.git",
8
8
  "author": "Oleksandr Krupko <oleksandr.krupko@corva.ai>",
9
9
  "license": "MIT",
10
+ "//sass-alias": "sass-embedded installed under the name 'sass' (see dependencies) because rollup-plugin-postcss@4.0.2 hard-requires require('sass') with no override hook (see rollup.config.js). Drop this alias when rollup-plugin-postcss is replaced.",
10
11
  "scripts": {
11
12
  "helper-cli": "npx @corva/fe-dev-helper-cli@latest",
12
13
  "lint": "eslint --cache ./src/",
@@ -15,6 +16,7 @@
15
16
  "build-watch": "./scripts/build.sh development -w",
16
17
  "get-changelog": "conventional-changelog -r 2 -p angular",
17
18
  "release": "git fetch --tags && git add -A && standard-version -a",
19
+ "generate-css-themes": "echo 'skip: css themes generated by @corva/ui build'",
18
20
  "start": "yarn generate-css-themes && cross-env NODE_ENV=local rollup -c -w",
19
21
  "test": "jest",
20
22
  "test-coverage": "jest --watchAll --coverage && http-serve coverage",
@@ -87,7 +89,7 @@
87
89
  "classnames": "2.2.6",
88
90
  "clean-webpack-plugin": "3.0.0",
89
91
  "copy-webpack-plugin": "6.1.1",
90
- "css-loader": "3.4.2",
92
+ "css-loader": "^7.1.0",
91
93
  "dotenv": "^10.0.0",
92
94
  "eslint-config-airbnb": "17.1.0",
93
95
  "eslint-plugin-jest-dom": "3.9.4",
@@ -100,27 +102,26 @@
100
102
  "jest": "^26.4.1",
101
103
  "jsona": "1.5.1",
102
104
  "lodash": "4.17.21",
103
- "mini-css-extract-plugin": "0.9.0",
104
105
  "moment": "2.29.4",
105
106
  "node-fetch": "^2.6.1",
106
107
  "path": "0.12.7",
107
108
  "postcss": "8.4.31",
108
109
  "postcss-import": "12.0.1",
109
- "postcss-loader": "4.2.0",
110
- "postcss-preset-env": "6.7.0",
110
+ "postcss-loader": "^8.1.0",
111
+ "postcss-preset-env": "^11.3.0",
111
112
  "prettier": "^2.1.2",
112
113
  "process": "^0.11.10",
113
114
  "prop-types": "15.7.2",
114
115
  "react": "17.0.1",
115
116
  "react-dom": "17.0.1",
116
117
  "react-grid-layout": "1.3.4",
117
- "react-router": "3.2.1",
118
+ "react-router-dom": "^5.3.4",
118
119
  "react-sizeme": "2.5.2",
119
120
  "rollup-plugin-copy": "^3.4.0",
120
- "sass": "^1.89.2",
121
+ "sass": "npm:sass-embedded@^1.99.0",
121
122
  "sass-loader": "^16.0.5",
122
123
  "semver": "7.5.2",
123
- "style-loader": "1.0.0",
124
+ "style-loader": "^4.0.0",
124
125
  "svg-url-loader": "6.0.0",
125
126
  "terser-webpack-plugin": "4.2.3",
126
127
  "uuid": "3.4.0",
@@ -133,7 +134,7 @@
133
134
  "@corva/ui": "*"
134
135
  },
135
136
  "devDependencies": {
136
- "@corva/ui": "3.14.1",
137
+ "@corva/ui": "3.60.0-2",
137
138
  "@rollup/plugin-babel": "^5.2.1",
138
139
  "@rollup/plugin-commonjs": "^15.0.0",
139
140
  "@rollup/plugin-image": "^2.0.6",
@@ -161,7 +162,7 @@
161
162
  "standard-version": "^9.0.0"
162
163
  },
163
164
  "engines": {
164
- "node": ">=18"
165
+ "node": ">=24.15.0"
165
166
  },
166
167
  "resolutions": {
167
168
  "braces": "3.0.3"