@corva/dc-platform-shared 0.57.1 → 0.57.3
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(){m.test(d.location.pathname)
|
|
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};
|
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"@babel/runtime/helpers/slicedToArray";import
|
|
1
|
+
import e from"@babel/runtime/helpers/slicedToArray";import o from"react-dom";import t from"../../../CLI/hocs/withCorvaMagicHOC.js";import{jsx as r}from"react/jsx-runtime";Promise.all([import("".concat(process.env.DEV_CENTER_APP_PATH,"/src/index.js")),import("".concat(process.env.DEV_CENTER_APP_PATH,"/manifest.json")),import("".concat(process.env.DEV_CENTER_APP_PATH,"/package.json"))]).then((function(n){var s=e(n,3),a=s[0],c=s[1],m=s[2],i=t({component:a.default.component,settings:a.default.settings,manifest:c.default,packageJson:m.default});o.render(r(i,{}),document.getElementById("root"))}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"react-dom";import t from"prop-types";import{makeStyles as n}from"@material-ui/core";import*as p from"@corva/ui";import{DevCenterIsolatedAppPage as r}from"@corva/ui/components";import{jsx as e}from"react/jsx-runtime";window["@corva/ui"]=p;var i=n((function(){return{reportsContainer:{zoom:"0.5"}}}));function m(o){var t=o.CLIAppComponent,n=o.CLIAppSettings,p=i();return e(r,{CLIAppComponent:t,CLIAppSettings:n,containerReportClassName:p.reportsContainer})}m.propTypes={CLIAppComponent:t.func,CLIAppSettings:t.func},m.defaultProps={CLIAppComponent:null,CLIAppSettings:null},import("".concat(process.env.DEV_CENTER_APP_PATH,"/src/index.js")).then((function(t){var n=t.default.component,p=t.default.settings;o.render(e(m,{CLIAppComponent:n,CLIAppSettings:p}),document.getElementById("root"))}));
|
|
@@ -1 +1 @@
|
|
|
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.21","mapbox.js":"3.2.1",moment:"2.29.4","moment-timezone":"0.5.43",react:"
|
|
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.21","mapbox.js":"3.2.1",moment:"2.29.4","moment-timezone":"0.5.43",react:"17.0.1","react-dom":"17.0.1","react-grid-layout":"1.3.4","react-sortable-hoc":"0.6.8","react-sizeme":"2.5.2","react-redux":"5.1.1","react-virtualized":"9.21.2",redux:"3.7.2","redux-thunk":"2.3.0",reselect:"2.5.4",rollbar:"2.5.1","prop-types":"^15.6.1",uuid:"3.4.0"},exports.UNSUPPORTED_DEPENDENCIES=[{dependency:"date-fns",alternative:"moment"},{dependency:"date-fns-tz",alternative:"moment-timezone"},{dependency:"date-fns-timezone",alternative:"moment-timezone"}];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corva/dc-platform-shared",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.3",
|
|
4
4
|
"description": "A library to share internal DC platform specific code",
|
|
5
5
|
"main": "./dist",
|
|
6
6
|
"module": "./src/index.js",
|
|
@@ -54,9 +54,7 @@
|
|
|
54
54
|
"^.+\\.svg$": "<rootDir>/jest/svgTransform.js"
|
|
55
55
|
},
|
|
56
56
|
"transformIgnorePatterns": [
|
|
57
|
-
"node_modules/(?!@ngrx|(?!deck.gl)|ng-dynamic)"
|
|
58
|
-
"node_modules/@babel/runtime/.*",
|
|
59
|
-
"node_modules/@babel/runtime-corejs3/.*"
|
|
57
|
+
"node_modules/(?!@ngrx|(?!deck.gl)|ng-dynamic)"
|
|
60
58
|
],
|
|
61
59
|
"moduleFileExtensions": [
|
|
62
60
|
"js",
|
|
@@ -95,7 +93,7 @@
|
|
|
95
93
|
"eslint-plugin-jest-dom": "^3.2.3",
|
|
96
94
|
"eslint-plugin-prettier": "3.1.1",
|
|
97
95
|
"eslint-plugin-testing-library": "^3.9.2",
|
|
98
|
-
"express": "4.
|
|
96
|
+
"express": "4.21.2",
|
|
99
97
|
"fs": "0.0.1-security",
|
|
100
98
|
"html-webpack-plugin": "4.5.2",
|
|
101
99
|
"jest": "^26.4.1",
|
|
@@ -112,14 +110,14 @@
|
|
|
112
110
|
"prettier": "^2.1.2",
|
|
113
111
|
"process": "^0.11.10",
|
|
114
112
|
"prop-types": "15.7.2",
|
|
115
|
-
"react": "
|
|
116
|
-
"react-dom": "
|
|
113
|
+
"react": "17.0.1",
|
|
114
|
+
"react-dom": "17.0.1",
|
|
117
115
|
"react-grid-layout": "1.3.4",
|
|
118
116
|
"react-router": "3.2.1",
|
|
119
117
|
"react-sizeme": "2.5.2",
|
|
120
118
|
"rollup-plugin-copy": "^3.4.0",
|
|
121
119
|
"sass": "^1.51.0",
|
|
122
|
-
"semver": "7.2
|
|
120
|
+
"semver": "7.5.2",
|
|
123
121
|
"style-loader": "1.0.0",
|
|
124
122
|
"svg-url-loader": "6.0.0",
|
|
125
123
|
"terser-webpack-plugin": "4.2.3",
|
|
@@ -164,5 +162,8 @@
|
|
|
164
162
|
},
|
|
165
163
|
"engines": {
|
|
166
164
|
"node": ">=18"
|
|
165
|
+
},
|
|
166
|
+
"resolutions": {
|
|
167
|
+
"braces": "3.0.3"
|
|
167
168
|
}
|
|
168
169
|
}
|