@corva/dc-platform-shared 0.0.0-75948fe → 0.0.0-8809599

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 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
+ 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 a from"@date-io/moment";import n 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 h}from"@corva/ui/utils/themeVariables";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 b,Fragment as I}from"react/jsx-runtime";function K(K){var x,C=K.children;K.router;var D=A(),P=o((function(r){return r+1}),0),R=r(P,2)[1],S=null!==(x=localStorage.getItem(c))&&void 0!==x?x:l.DARK,T=!p&&S===l.DARK;t((function(){return h(T)}),[T]);return j(v.Provider,{value:D,children:j(i,{theme:T?u:f,children:j(m,{libInstance:n,utils:a,children:b(I,{children:[!1,b("div",{className:g.app,children:[j(s,{}),j(d,{toggleTheme:function(){localStorage.setItem(c,T?l.LIGHT:l.DARK),R()}}),j("div",{className:e(g.appContent,p&&g.pdfAppContent,!T&&g.lightAppContent),children:C})]})]})})})})}export{K as default};
@@ -1 +1 @@
1
- import{post as r}from"@corva/ui/clients/api/apiCore";var e=function(e){return r("/v1/user_token",e)},i=function(e){return r("/v1/sessions/verification/request",e)};export{e as getUserToken,i as requestVerification};
1
+ import{post as r}from"@corva/ui/clients/api/apiCore";var o=function(o){return r("/v1/user_token",o)};export{o as getUserToken};
@@ -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):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 i,useEffect as o}from"react";import{get as s}from"lodash";import"@corva/ui/clients/jsonApi";import{updateUserUnits as a}from"@corva/ui/utils/convert";import u from"../../../../clients/auth0/index.js";import{ERRORS as c}from"./constants.js";import{getUserToken as m}from"./api.js";var p=function(t){return fetch("/dotenv",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},l={id:1,name:"POC User",unit_system:"imperial",company:{unit_system:"metric"}};function f(f){var d=e(l),y=n(d,2),h=y[0],v=y[1],g=e(!1),_=n(g,2),w=_[0],C=_[1],b=e(null),T=n(b,2),U=T[0],x=T[1],j=i(null);function A(){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:v(n=l),a({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")}),C(!1);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}j.current||(j.current=new u);var k,V,E=(k=t(r.mark((function t(){var n,e,i,o,s,a,u,l=arguments;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=l.length>0&&void 0!==l[0]?l[0]:"",e=l.length>1?l[1]:void 0,i=l.length>2?l[2]:void 0,x(null),C(!0),o={auth:e},n&&(o.platform=n),t.prev=7,t.next=10,m(o);case 10:s=t.sent,p({AUTH_TOKEN:s.jwt}),A().then(i),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)?x(c.invalidVerificationCode):null!==(u=t.t0.isMissingVerificationCode)&&void 0!==u&&u.call(t.t0)?x(c.missingVerificationCode):x(c.wrongEmailOrPassword);case 18:C(!1);case 19:case"end":return t.stop()}}),t,null,[[7,15]])}))),function(){return k.apply(this,arguments)}),H=(V=t(r.mark((function t(){return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:p({AUTH_TOKEN:""});case 1:case"end":return t.stop()}}),t)}))),function(){return V.apply(this,arguments)});return o((function(){A()}),[]),{user:h,loading:w,error:U,login:E,logout:H,auth0:j.current}}export{f as default};
@@ -1 +1 @@
1
- import*as o from"@corva/ui";import{ProvidePermissions as r}from"@corva/ui/permissions";import"@corva/ui/styles/index.global.css.js";import"@corva/ui/styles/reactVirtualized.global.css.js";import"@corva/ui/styles/emojiMart.global.css.js";import"@corva/ui/styles/mapbox.global.css.js";import"@corva/ui/styles/lightbox.global.css.js";import"@corva/ui/styles/generatedThemesVariables.global.css.js";import"@corva/ui/styles/customScrollbars.global.css.js";import"@corva/ui/config/initGlobalDependencies";import{isPDFReportView as t}from"@corva/ui/utils/reports";import s from"./withAppDataProviderHOC.js";import i from"./withCLIAppSettingsHOC.js";import a from"./withReactRouterHOC.js";import e from"./withGridLayoutHOC/withGridLayoutHOC.js";import m from"./withPDFLayoutHOC.js";import{withDevCenterRouterHOC as p}from"./withDevCenterRouterHOC.js";import{jsx as c}from"react/jsx-runtime";window["@corva/ui"]=o;var l=function(o){var l=o.component,n=o.settings,u=o.manifest,v=o.packageJson;return function(){var o=i(s({CLIAppComponent:l,CLIAppSettings:n,packageJson:v})),f=t?m(o):e(o),g=a(p(f));return c(r,{children:c(g,{manifest:u,dashboardProps:{}})})}};export{l as default};
1
+ import*as o from"@corva/ui";import{ProvidePermissions as t}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 i}from"@corva/ui/config/initGlobalDependencies";import{isPDFReportView as r}from"@corva/ui/utils/reports";import s from"./withAppDataProviderHOC.js";import e from"./withCLIAppSettingsHOC.js";import a from"./withReactRouterHOC.js";import n from"./withGridLayoutHOC/withGridLayoutHOC.js";import p from"./withPDFLayoutHOC.js";import{withDevCenterRouterHOC as l}from"./withDevCenterRouterHOC.js";import{jsx as c}from"react/jsx-runtime";if("undefined"!=typeof window){var m=window.history.pushState.bind(window.history);window.history.pushState=function(o,t,i){return i&&"string"==typeof i&&i.includes("/login")?(console.warn("[POC] Blocked history.pushState to /login:",i),m(o,t,i.replace(/\/login.*/,"/app"))):m(o,t,i)};var u=window.history.replaceState.bind(window.history);window.history.replaceState=function(o,t,i){return i&&"string"==typeof i&&i.includes("/login")?(console.warn("[POC] Blocked history.replaceState to /login:",i),u(o,t,i.replace(/\/login.*/,"/app"))):u(o,t,i)}}window["@corva/ui"]=o,i();var d=function(o){var i=o.component,m=o.settings,u=o.manifest,d=o.packageJson;return function(){var o=e(s({CLIAppComponent:i,CLIAppSettings:m,packageJson:d})),w=r?p(o):n(o),f=a(l(w));return c(t,{children:c(f,{manifest:u,dashboardProps:{}})})}};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{browserHistory as o,Route as t,IndexRedirect as e,Redirect as n,Router as p}from"react-router";import{LoadingIndicator as c}from"@corva/ui/components";import{useAuth as i}from"../context/auth.js";import a from"../components/App/App.js";import{jsxs as u,jsx as l}from"react/jsx-runtime";function f(r,o){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);o&&(e=e.filter((function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable}))),t.push.apply(t,e)}return t}var s=function(r){var o="string"==typeof r?r:null==r?void 0:r.pathname;return o&&o.includes("/login")},m=o.push.bind(o);o.push=function(r){if(!s(r)){for(var o=arguments.length,t=new Array(o>1?o-1:0),e=1;e<o;e++)t[e-1]=arguments[e];return m.apply(void 0,[r].concat(t))}console.warn("[POC] Blocked browserHistory.push to /login")};var b=o.replace.bind(o);o.replace=function(r){if(!s(r)){for(var o=arguments.length,t=new Array(o>1?o-1:0),e=1;e<o;e++)t[e-1]=arguments[e];return b.apply(void 0,[r].concat(t))}console.warn("[POC] Blocked browserHistory.replace to /login")};var y=function(r,o,t){r.location.pathname.includes("/login")&&o("/app"),t()},O=function(o){return function(t){var e=t.route,n=t.location,p=t.router;return i().loading?l(c,{fullscreen:!0}):l(o,function(o){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?f(Object(e),!0).forEach((function(t){r(o,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(e)):f(Object(e)).forEach((function(r){Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(e,r))}))}return o}({location:n,router:p},e.componentProps||{}))}},g=function(r){return function(c){var i=u(t,{path:"/",component:a,onEnter:y,children:[l(e,{to:"app"}),l(t,{path:"app",component:O(r),componentProps:c}),l(n,{from:"login",to:"app"}),l(n,{from:"login/*",to:"app"})]});return l(p,{history:o,routes:i})}};export{g 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
- ## Instalation steps
5
- Clone this repository and run `yarn` inside the directory. On postinstall git hooks would be configured for this repository.
5
+ # Contributing Guide
6
+
7
+ ## Quick Start
8
+
9
+ 1. **Branch Setup**
10
+
11
+ ```bash
12
+ git checkout develop
13
+ git pull
14
+ git checkout -b feature/your-feature # or fix/your-fix
15
+ ```
16
+
17
+ 2. **Development**
18
+
19
+ - Write code
20
+ - Add tests
21
+ - Run:
22
+ ```bash
23
+ yarn install
24
+ yarn lint
25
+ yarn test
26
+ ```
27
+
28
+ 3. **Create PR**
29
+ - Push to your branch
30
+ - Create PR to `develop`
31
+ - PR title must follow conventional commits:
32
+ ```
33
+ feat: add user authentication
34
+ fix: resolve login error
35
+ feat!: change API response format
36
+ ```
6
37
 
7
- ## Development flow
8
- To develop new feature or implement fix one need to create new branch from `main` one and name it properly: branch-type/JIRA_ID-jira_ticket_description i.e.
9
- * `feature/DC-1234-add-Table-component`
10
- * `fix/DR-9999-fix-broken-page`
38
+ ## Branch Strategy
11
39
 
12
- When changes are ready please create commit with meaningful description using [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). Commit message should have form `commit-type(JIRA_ID): commit message`. All types of commits could be found [here](./git-conventional-commits.json)
40
+ - `develop` - main development branch
41
+ - `feature/*` - new features
42
+ - `fix/*` - bug fixes
43
+ - No direct commits to `develop`
13
44
 
14
- Please note that `feat` and `fix` commits messages will be used during automatic changelog creation while `chore`, `docs` and others will not.
45
+ ## Release Process
15
46
 
16
- Do not create 2 commits with same name and consider amending previous commit instead with `git commit --amend --no-edit`.
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
- On merging the PR to `main` branch an automatic release flow will be triggered. New package version will be determined based on changes introduced by commit. `fix` corresponds to `patch`, `feat` to `minor` and `breaking changes` to `major` version release.
66
+ ## CI Checks
24
67
 
25
- More details on semantic versioning could be found in official [SemVer specification](https://semver.org/).
68
+ Your PR must pass:
26
69
 
27
- Note: untill first major version is released the package is considered as under development and `breaking changes` will correspond to `minor` release.
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 t from"react";import r from"react-dom";import o from"../../../CLI/hocs/withCorvaMagicHOC.js";import{jsx as n}from"react/jsx-runtime";var a;try{a=require("react-dom/client").createRoot}catch(e){}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(c){var s=e(c,3),i=s[0],m=s[1],p=s[2],d=o({component:i.default.component,settings:i.default.settings,manifest:m.default,packageJson:p.default}),f=document.getElementById("root");parseInt(t.version.split(".")[0],10)>=18?a(f).render(n(d,{})):r.render(n(d,{}),f)}));
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{requestMockResponses as t}from"./requestMockResponses.js";import n from"react-dom";import r from"../../../CLI/hocs/withCorvaMagicHOC.js";import{jsx as o}from"react/jsx-runtime";if(function(){if("undefined"!=typeof window){var e,n=window.self!==window.top,r=n?window.parent:null,o=(e=window.fetch,function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(window,n)}),s=window.fetch;s=s&&s._originalFetch?s._originalFetch:o;var i=Object.keys(t||{}).length;i>0?console.log("[POC] Loaded ".concat(i," request mock responses")):console.warn("[POC] No request mock responses found. Regenerate using: node scripts/generate-request-mock-map.js");var a=function(e){try{var t=new URL(e);return t.pathname+t.search}catch(t){return e}},c=function(e){if(!e||!/\.corva\.ai/.test(e))return!1;var n=a(e),r=t&&n in t;return!r&&t&&console.log("[POC] Not intercepting (not in map):",n),r},l=function(e){if(!t)return null;var n=a(e),r=t[n];return r?{status:r.status||200,statusText:r.statusText||"OK",body:r.body,contentType:r.contentType||"application/json"}:null},u=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?e:e.url,o=n.method||"GET";if(r&&/\.corva\.ai/.test(r)){var i=a(r),u=t&&i in t,f=(new Error).stack;console.log("[POC] Fetch CALLED: ".concat(o," ").concat(i.substring(0,80)," - ").concat(u?"IN MAP":"NOT IN MAP"),f?f.split("\n").slice(1,4).join("\n"):"")}if(c(r)){var p=l(r);if(p){console.log("[POC] Mocking API request:",o,r);var d=p.body,h=p.contentType;return Promise.resolve({ok:p.status>=200&&p.status<300,status:p.status,statusText:p.statusText,headers:new Headers({"Content-Type":h}),json:function(){if("string"==typeof d)try{return Promise.resolve(JSON.parse(d))}catch(e){return Promise.reject(new Error("Invalid JSON in mock response"))}return Promise.resolve(d)},text:function(){return"string"==typeof d?Promise.resolve(d):Promise.resolve(JSON.stringify(d))},blob:function(){var e="string"==typeof d?d:JSON.stringify(d);return Promise.resolve(new Blob([e],{type:h}))}})}}return s.apply(this,arguments)};u._originalFetch=s,u._isPOCInterceptor=!0;var f=function(){try{try{Object.defineProperty(window,"fetch",{get:function(){return u},set:function(e){e===u||null!=e&&e._isPOCInterceptor?e:(console.warn("[POC] Attempted to overwrite fetch:",e),u)},configurable:!0,enumerable:!0})}catch(e){console.warn("[POC] Could not use getter for fetch:",e)}if(window.fetch=u,"undefined"!=typeof globalThis)try{Object.defineProperty(globalThis,"fetch",{get:function(){return u},set:function(e){e===u||null!=e&&e._isPOCInterceptor||console.warn("[POC] Attempted to overwrite globalThis.fetch, keeping interceptor")},configurable:!0,enumerable:!0}),globalThis.fetch=u}catch(e){globalThis.fetch=u}if("undefined"!=typeof self&&self!==window)try{Object.defineProperty(self,"fetch",{get:function(){return u},set:function(e){e===u||null!=e&&e._isPOCInterceptor||console.warn("[POC] Attempted to overwrite self.fetch, keeping interceptor")},configurable:!0,enumerable:!0}),self.fetch=u}catch(e){self.fetch=u}}catch(e){console.warn("[POC] Failed to use defineProperty, using direct assignment:",e),window.fetch=u,"undefined"!=typeof globalThis&&(globalThis.fetch=u),"undefined"!=typeof self&&self!==window&&(self.fetch=u)}};if(f(),console.log("[POC] Fetch interceptor installed"+(n?" (iframe context)":"")),n){var p=!1,d=function(){return p||(p=function(){try{if(!r||r===window)return!1;if(r.fetch&&r.fetch._isPOCInterceptor)return!0;var e=r.fetch,n=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o="string"==typeof n?n:n.url,s=r.method||"GET";if(o&&/\.corva\.ai/.test(o)){var i=a(o),u=t&&i in t;console.log("[POC] Parent Fetch: ".concat(s," ").concat(i.substring(0,80)," - ").concat(u?"IN MAP":"NOT IN MAP"))}if(c(o)){var f=l(o);if(f){console.log("[POC] Mocking Parent API request:",s,o);var p=f.body,d=f.contentType;return Promise.resolve({ok:f.status>=200&&f.status<300,status:f.status,statusText:f.statusText,headers:new Headers({"Content-Type":d}),json:function(){if("string"==typeof p)try{return Promise.resolve(JSON.parse(p))}catch(e){return Promise.reject(new Error("Invalid JSON in mock response"))}return Promise.resolve(p)},text:function(){return"string"==typeof p?Promise.resolve(p):Promise.resolve(JSON.stringify(p))},blob:function(){var e="string"==typeof p?p:JSON.stringify(p);return Promise.resolve(new Blob([e],{type:d}))}})}}return e.apply(this,arguments)};n._originalFetch=e,n._isPOCInterceptor=!0,r.fetch=n;try{Object.defineProperty(r,"fetch",{get:function(){return n},set:function(e){e===n||null!=e&&e._isPOCInterceptor||console.warn("[POC] Attempted to overwrite parent fetch, keeping interceptor")},configurable:!0,enumerable:!0}),console.log("[POC] Fetch interceptor installed in parent window (via defineProperty)")}catch(e){r.fetch=n,console.log("[POC] Fetch interceptor installed in parent window (via direct assignment)")}return!0}catch(e){return"SecurityError"===e.name||e.message.includes("cross-origin")||console.warn("[POC] Could not intercept parent window fetch:",e.message),!1}}(),p&&console.log("[POC] Successfully set up parent window interceptor")),p};d();var h=null;!function(){if(!h){var e=0;h=setInterval((function(){if(e++,p)try{var t=r.fetch;t&&!t._isPOCInterceptor&&(console.warn("[POC] Parent fetch was overwritten, re-applying interceptor"),p=!1,d())}catch(e){"SecurityError"===e.name&&(clearInterval(h),h=null)}else d();e>=300&&!p&&(console.warn("[POC] Could not set up parent window interceptor after",e,"attempts. Parent might be cross-origin or not accessible."),clearInterval(h),h=null)}),100)}}()}window.addEventListener("message",(function(e){if(e.data&&"POC_FETCH_REQUEST"===e.data.type&&e.data.url){var t=e.data.url;if(c(t)){var n=l(t);n&&window.parent.postMessage({type:"POC_FETCH_RESPONSE",requestId:e.data.requestId,response:n},"*")}}}));var g=null;g||(g=setInterval((function(){var e=window.fetch;e===u||null!=e&&e._isPOCInterceptor||(console.warn("[POC] Fetch was overwritten, re-applying interceptor. Current:",e),f())}),50)),"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",f),window.addEventListener("load",f);var y=new MutationObserver((function(){f()}));y.observe(document.head,{childList:!0,subtree:!0}),y.observe(document.body,{childList:!0,subtree:!0});var w=XMLHttpRequest.prototype.open,v=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(e,t){this._mockUrl=t,this._mockMethod=e;for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return w.apply(this,[e,t].concat(r))},XMLHttpRequest.prototype.send=function(){var e=this._mockUrl,n=this._mockMethod||"GET";if(e&&/\.corva\.ai/.test(e)){var r=a(e),o=t&&r in t;console.log("[POC] XHR: ".concat(n," ").concat(r.substring(0,80)," - ").concat(o?"IN MAP":"NOT IN MAP"))}if(c(e)){var s=l(e);if(s)return console.log("[POC] Mocking XHR request:",n,e),Object.defineProperty(this,"status",{value:s.status,writable:!1}),Object.defineProperty(this,"statusText",{value:s.statusText,writable:!1}),Object.defineProperty(this,"responseText",{value:"string"==typeof s.body?s.body:JSON.stringify(s.body),writable:!1}),Object.defineProperty(this,"response",{value:"string"==typeof s.body?s.body:JSON.stringify(s.body),writable:!1}),Object.defineProperty(this,"readyState",{value:XMLHttpRequest.DONE,writable:!1}),this.onreadystatechange&&(this.readyState=XMLHttpRequest.LOADING,this.onreadystatechange&&this.onreadystatechange(),this.readyState=XMLHttpRequest.DONE,this.onreadystatechange&&this.onreadystatechange()),void(this.onload&&this.onload())}for(var i=arguments.length,u=new Array(i),f=0;f<i;f++)u[f]=arguments[f];return v.apply(this,u)}}}(),"undefined"!=typeof window&&window.localStorage)try{window.localStorage.setItem("corva.formation_evaluation.ui",JSON.stringify({settings:{package:"3.189.0",rigId:3787,wellId:105756,settingsByAsset:{13217521:{savedRanges:{timestamp:{from:173965206e4,to:174148064e4}},mode:"live",indexCurve:"timestamp",witsCommentFormat:null}}},isDraggable:!1,coordinates:{x:0,y:0,w:12,h:13}}))}catch(e){console.warn("[POC] Failed to set localStorage:",e)}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(t){var s=e(t,3),i=s[0],a=s[1],c=s[2],l=r({component:i.default.component,settings:i.default.settings,manifest:a.default,packageJson:c.default});n.render(o(l,{}),document.getElementById("root"))}));
@@ -1 +1 @@
1
- import t from"react";import o from"react-dom";import r from"prop-types";import{makeStyles as e}from"@material-ui/core";import*as n from"@corva/ui";import{DevCenterIsolatedAppPage as p}from"@corva/ui/components";import{jsx as i}from"react/jsx-runtime";var m;try{m=require("react-dom/client").createRoot}catch(t){}window["@corva/ui"]=n;var a=e((function(){return{reportsContainer:{zoom:"0.5"}}}));function c(t){var o=t.CLIAppComponent,r=t.CLIAppSettings,e=a();return i(p,{CLIAppComponent:o,CLIAppSettings:r,containerReportClassName:e.reportsContainer})}c.propTypes={CLIAppComponent:r.func,CLIAppSettings:r.func},c.defaultProps={CLIAppComponent:null,CLIAppSettings:null},import("".concat(process.env.DEV_CENTER_APP_PATH,"/src/index.js")).then((function(r){var e=r.default.component,n=r.default.settings,p=document.getElementById("root");parseInt(t.version.split(".")[0],10)>=18?m(p).render(i(c,{CLIAppComponent:e,CLIAppSettings:n})):o.render(i(c,{CLIAppComponent:e,CLIAppSettings:n}),p)}));
1
+ import t from"@babel/runtime/helpers/slicedToArray";import{requestMockResponses as e}from"./requestMockResponses.js";import{jsx as n}from"react/jsx-runtime";!function(){if("undefined"!=typeof window){var t=window.fetch,n=Object.keys(e||{}).length;console.log("[POC-Isolated] Loaded ".concat(n," request mock responses"));var o=function(t){try{var e=new URL(t);return e.pathname+e.search}catch(e){return t}},r=function(t){if(!t||!/\.corva\.ai/.test(t))return!1;var n=o(t);return e&&n in e},s=function(t){if(!e)return null;var n=o(t),r=e[n];return r?{status:r.status||200,statusText:r.statusText||"OK",body:r.body,contentType:r.contentType||"application/json"}:null},i=function(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a="string"==typeof n?n:n.url,c=i.method||"GET";if(a&&/\.corva\.ai/.test(a)){var p=o(a),u=e&&p in e;console.log("[POC-Isolated] Fetch: ".concat(c," ").concat(p.substring(0,80)," - ").concat(u?"IN MAP":"NOT IN MAP"))}if(r(a)){var l=s(a);if(l){console.log("[POC-Isolated] Mocking API request:",c,a);var f=l.body,m=l.contentType;return Promise.resolve({ok:l.status>=200&&l.status<300,status:l.status,statusText:l.statusText,headers:new Headers({"Content-Type":m}),json:function(){if("string"==typeof f)try{return Promise.resolve(JSON.parse(f))}catch(t){return Promise.reject(new Error("Invalid JSON"))}return Promise.resolve(f)},text:function(){return Promise.resolve("string"==typeof f?f:JSON.stringify(f))},blob:function(){return Promise.resolve(new Blob(["string"==typeof f?f:JSON.stringify(f)],{type:m}))}})}}return t.apply(this,arguments)};i._originalFetch=t,i._isPOCInterceptor=!0,window.fetch=i;try{Object.defineProperty(window,"fetch",{get:function(){return i},set:function(t){t===i||null!=t&&t._isPOCInterceptor||console.warn("[POC-Isolated] Attempted to overwrite fetch, keeping interceptor")},configurable:!0,enumerable:!0})}catch(t){}"undefined"!=typeof globalThis&&(globalThis.fetch=i),console.log("[POC-Isolated] Fetch interceptor installed")}}(),Promise.all([import("react-dom"),import("prop-types"),import("@material-ui/core"),import("@corva/ui"),import("@corva/ui/components"),import("@corva/ui/config")]).then((function(e){var o=t(e,6),r=o[0],s=o[1],i=o[2],a=o[3],c=o[4],p=o[5],u=r.default,l=s.default,f=i.makeStyles,m=a,d=c.DevCenterIsolatedAppPage,g=p.initGlobalDependencies;window["@corva/ui"]=m,g();var v=f((function(){return{reportsContainer:{zoom:"0.5"}}}));function C(t){var e=t.CLIAppComponent,o=t.CLIAppSettings,r=v();return n(d,{CLIAppComponent:e,CLIAppSettings:o,containerReportClassName:r.reportsContainer})}C.propTypes={CLIAppComponent:l.func,CLIAppSettings:l.func},C.defaultProps={CLIAppComponent:null,CLIAppSettings:null},import("".concat(process.env.DEV_CENTER_APP_PATH,"/src/index.js")).then((function(t){var e=t.default.component,o=t.default.settings;u.render(n(C,{CLIAppComponent:e,CLIAppSettings:o}),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:["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",rollbar:"2.5.1","prop-types":"^15.6.1",uuid:"3.4.0"},exports.UNSUPPORTED_DEPENDENCIES=[{dependency:"date-fns",alternative:"moment"},{dependency:"date-fns-tz",alternative:"moment-timezone"},{dependency:"date-fns-timezone",alternative:"moment-timezone"}];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require('./../../../ext-cjs/@babel/runtime/helpers/defineProperty.js');function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function a(t){for(var a=1;a<arguments.length;a++){var o=null!=arguments[a]?arguments[a]:{};a%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var o={qa:"qa",staging:"staging",production:"production"},i={REACT_APP_AUTH0_REDIRECT_URI:"http://app.local.corva.ai:8080/login/oauth-callback",REACT_APP_AUTH0_DOMAIN:"corva.auth0.com",REACT_APP_AUTH0_CLIENT_ID:"L1B0xGD5AuXwuTDFdFA9czDTM7Vvw464"},c=(e(t={},o.qa,a(a({},i),{},{REACT_APP_API_URL:"https://api.qa.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.qa.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.qa.corva.ai/v1"})),e(t,o.staging,a(a({},i),{},{REACT_APP_API_URL:"https://api.staging.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.staging.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.staging.corva.ai/v1"})),e(t,o.production,a(a({},i),{},{REACT_APP_API_URL:"https://api.corva.ai",REACT_APP_SUBSCRIPTIONS_URL:"https://subscriptions.corva.ai",REACT_APP_AUTH0_AUDIENCE:"https://api.corva.ai/v1"})),t);exports.CORVA_API_ENVS=o,exports.CORVA_API_ENV_VARIABLES=c,exports.CORVA_GLOBAL_DEPENDENCIES={"@corva/ui":"","@material-ui/core":"4.11.2","@material-ui/icons":"4.9.1","@material-ui/lab":"4.0.0-alpha.57","@material-ui/pickers":"3.2.10","@rollbar/react":"0.11.1",classnames:"2.2.6","corva-convert-units":"1.10.33",highcharts:["8.1.2","10.3.3"],"highcharts-react-official":"2.2.2",html2canvas:"1.0.0-alpha.12","@icon-park/react":"1.4.2",jsona:"1.5.1",lodash:"^4.17.21","mapbox.js":"3.2.1",moment:"2.29.4","moment-timezone":"0.5.43",react:"17.0.1","react-dom":"17.0.1","react-grid-layout":"1.3.4","react-sortable-hoc":"0.6.8","react-sizeme":"2.5.2","react-redux":"5.1.1","react-virtualized":"9.21.2",redux:"3.7.2","redux-thunk":"2.3.0",reselect:"2.5.4",rollbar:"2.5.1","prop-types":"^15.6.1",uuid:"3.4.0"},exports.UNSUPPORTED_DEPENDENCIES=[{dependency:"date-fns",alternative:"moment"},{dependency:"date-fns-tz",alternative:"moment-timezone"},{dependency:"date-fns-timezone",alternative:"moment-timezone"}];