@corva/ui 3.80.0-9 → 3.80.0-rc.1

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.
Files changed (25) hide show
  1. package/cjs-bundle/components/Chart/effects/useKeyboardControl.js +1 -1
  2. package/cjs-bundle/components/Chart/effects/useKeyboardControl.js.map +1 -1
  3. package/cjs-bundle/components/DevCenter/AppsDataProvider/effects/utils.js +1 -1
  4. package/cjs-bundle/components/DevCenter/AppsDataProvider/effects/utils.js.map +1 -1
  5. package/cjs-bundle/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js +1 -1
  6. package/cjs-bundle/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js.map +1 -1
  7. package/cjs-bundle/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.module.scss.js +1 -1
  8. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.js +1 -1
  9. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.js.map +1 -1
  10. package/components/Chart/effects/useKeyboardControl.d.ts.map +1 -1
  11. package/components/Chart/effects/useKeyboardControl.js +1 -1
  12. package/components/Chart/effects/useKeyboardControl.js.map +1 -1
  13. package/components/DevCenter/AppsDataProvider/effects/utils.d.ts.map +1 -1
  14. package/components/DevCenter/AppsDataProvider/effects/utils.js +1 -1
  15. package/components/DevCenter/AppsDataProvider/effects/utils.js.map +1 -1
  16. package/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.d.ts.map +1 -1
  17. package/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js +1 -1
  18. package/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js.map +1 -1
  19. package/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.module.scss.js +1 -1
  20. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.d.ts.map +1 -1
  21. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.js +1 -1
  22. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.js.map +1 -1
  23. package/mcp-server/server.mjs +3 -3
  24. package/package.json +1 -1
  25. package/tsconfig.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/toConsumableArray";import i from"@babel/runtime/regenerator";import u from"jsona";import{getWells as a,getRigs as l,getFracFleets as o,getInterventionUnits as c,getFracFleetWells as s,getPadWells as p,getResolvedAssets as d}from"../../../../clients/jsonApi/index.js";import{DEV_CENTER_CLI_APP_ID as f}from"../../../../constants/devcenter.js";import"../../../../constants/goals.js";import"../../../../constants/segment.js";import"../../../../constants/alerts.js";import"../../../../constants/apps.js";import"../../../../constants/drillstring.js";import"../../../../constants/completion.js";import"../../../../constants/appPackages.js";import"../../../../constants/notifications.js";import"../../../../constants/feed.js";import"../../../../constants/bha.js";import{ASSET_TYPES as v}from"../../../../constants/assetTypes.js";import"../../../../constants/corvaCompanyId.js";import"lodash";import"../../../GradientManager/configuration/constants.js";import{getAppSegment as m}from"../../../../utils/devcenter.js";function w(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function b(r){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?w(Object(t),!0).forEach((function(n){e(r,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var g=new u,_=function(e){var r=g.deserialize(e);if(!Array.isArray(r))throw new TypeError("Expected a JSON:API collection response");return r},h=function(e,r){var n,t,i=null==e||null===(n=e.relationships)||void 0===n||null===(t=n[r])||void 0===t?void 0:t.data;return i&&!Array.isArray(i)?i.id:void 0},y=function(e,r,n){return e.included.find((function(e){return e.type===r&&e.id===n}))},j=function(e){return"well"===(null==e?void 0:e.type)},k=function(e){return e.reduce((function(e,r){return e[r.id]=r,e}),{})},x=function(e,r){var n;return Number(null===(n=e.settings)||void 0===n?void 0:n[r])},O=function(e,r){return t(new Set(e.map((function(e){var r=n(e,2);return r[0],r[1]})).filter((function(e){return Number.isFinite(e)&&!r.includes(String(e))}))))},I=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,a({ids:r,fields:["well.name","well.settings","well.custom_properties","well.company","well.asset_id","well.last_active_at","well.program","well.pad","well.frac_fleet","well.id","well.rig","rig.name","rig.asset_id","company.id","well.status","well.archivation","well.lon_lat"],include_arhivation_data:!0});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),F=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,l({ids:r,fields:["rig.name","rig.settings","rig.asset_id","rig.active_well","rig.last_active_well","well.name","well.settings","well.custom_properties","well.company","rig.program","well.asset_id","well.last_active_at","well.id","well.company.id","well.lon_lat"]});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),P=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,d({assets:r});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),A=function(e,r,n){var t,i,u,a,l,o,c,s,p,d,f,v=e?b(b({},e.attributes),{},{id:e.id,companyId:h(e,"company")}):void 0,m=n?{id:Number(n.id),name:n.name,active_well:n.active_well}:void 0;return b(b({well:v,rig:{name:null==r||null===(t=r.attributes)||void 0===t?void 0:t.name,id:null==r?void 0:r.id,asset_id:null==r||null===(i=r.attributes)||void 0===i?void 0:i.asset_id},program:{id:(null==r||null===(u=r.program)||void 0===u?void 0:u.id)||null,name:(null==r||null===(a=r.program)||void 0===a||null===(l=a.attributes)||void 0===l?void 0:l.name)||null}},m&&{interventionUnit:m}),{},{completionWellInfo:{pad:{id:(null==e||null===(o=e.pad)||void 0===o?void 0:o.id)||null,name:(null==e||null===(c=e.pad)||void 0===c||null===(s=c.attributes)||void 0===s?void 0:s.name)||null},fracFleet:{id:(null==e||null===(p=e.fracFleet)||void 0===p?void 0:p.id)||null,name:(null==e||null===(d=e.fracFleet)||void 0===d||null===(f=d.attributes)||void 0===f?void 0:f.name)||null}}})},B=function(e,r){return Object.keys(r).length?e.reduce((function(e,t){var i=n(t,2),u=i[0],a=i[1],l=r[a];return l?(e[u]=A(l,l.rig),e):e}),{}):{}},E=function(e,r){return Object.keys(r).length?e.reduce((function(e,t){var i=n(t,2),u=i[0],a=i[1],l=r[a];return e[u]=A(null==l?void 0:l.well,l),e}),{}):{}},S=function(e,r,t){return Object.keys(r).length||t?e.reduce((function(e,i){var u=n(i,2),a=u[0],l=u[1],o=r[l],c=t?t[a]:void 0,s=null==o?void 0:o.program;return e[a]={fracFleet:o,wells:c,program:{id:(null==s?void 0:s.id)||null,name:(null==s?void 0:s.name)||null}},e}),{}):{}},T=function(e,r){return e.length||r?e.reduce((function(e,t){var i=n(t,1)[0];return e[i]={wells:r?r[i]:void 0},e}),{}):{}},U=function(e,r,t,i){return Object.keys(r).length?e.reduce((function(e,u){var a,l=n(u,2),o=l[0],c=l[1],s=r[c],p=null===(a=t.find((function(e){return n(e,1)[0]===o})))||void 0===a?void 0:a[1],d=p&&i[p]||s.well;return e[o]=A(d,null==d?void 0:d.rig,b(b({},s),s.well&&{active_well:b({id:s.well.id},s.well.attributes)})),e}),{}):{}},W=function(){var e=r(i.mark((function e(r){var n,t;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,o({ids:r,fields:["frac_fleet.name","frac_fleet.pads","frac_fleet.program","frac_fleet.current_pad_id","frac_fleet.pad_frac_fleets","frac_fleet.pad_frac_fleet.frac_fleet_lines"]});case 5:if(n=e.sent){e.next=8;break}return e.abrupt("return",[]);case 8:return t=_(n),e.abrupt("return",t);case 12:return e.prev=12,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",[]);case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(r){return e.apply(this,arguments)}}(),q=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,c({ids:r,fields:["intervention_unit.name","intervention_unit.type","intervention_unit.active_well"]});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),D=function(){var e=r(i.mark((function e(t,u){var a,l,o;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=k(u),l=t.map(function(){var e=r(i.mark((function e(r){var t,u,l,o,c,p,d,v,m;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=n(r,2),o=l[0],c=l[1],p=a[o],d={fields:"all",frac_fleet_id:c},o===f?d.app_key=null==p||null===(t=p.app)||void 0===t?void 0:t.app_key:d.app_id=null==p||null===(u=p.app)||void 0===u?void 0:u.id,e.prev=4,e.next=7,s(d);case 7:if(v=e.sent){e.next=10;break}return e.abrupt("return",[]);case 10:return m=_(v),e.abrupt("return",m);case 14:return e.prev=14,e.t0=e.catch(4),console.error(e.t0),e.abrupt("return",[]);case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(r){return e.apply(this,arguments)}}()),e.next=4,Promise.all(l);case 4:return o=e.sent,e.abrupt("return",o.reduce((function(e,r,n){return e[t[n][0]]=r,e}),{}));case 6:case"end":return e.stop()}}),e)})));return function(r,n){return e.apply(this,arguments)}}(),N=function(){var e=r(i.mark((function e(t,u){var a,l,o;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=k(u),l=t.map(function(){var e=r(i.mark((function e(r){var t,u,l,o,c,s,d,v,m;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=n(r,2),o=l[0],c=l[1],s=a[o],d={fields:"all"},o===f?d.app_key=null==s||null===(t=s.app)||void 0===t?void 0:t.app_key:d.app_id=null==s||null===(u=s.app)||void 0===u?void 0:u.id,e.prev=4,e.next=7,p(c,d);case 7:if(v=e.sent){e.next=10;break}return e.abrupt("return",[]);case 10:return m=_(v),e.abrupt("return",m);case 14:return e.prev=14,e.t0=e.catch(4),console.error(e.t0),e.abrupt("return",[]);case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(r){return e.apply(this,arguments)}}()),e.next=4,Promise.all(l);case 4:return o=e.sent,e.abrupt("return",o.reduce((function(e,r,n){return e[t[n][0]]=r,e}),{}));case 6:case"end":return e.stop()}}),e)})));return function(r,n){return e.apply(this,arguments)}}(),C=function(e){return[e.id,x(e,v.well.id),x(e,v.rig.id),x(e,v.frac_fleet.id),x(e,v.pad.id),x(e,v.intervention_unit.id),x(e,"deprecatedAssetId"),m(e)].join("-")},G=function(e){return Boolean(x(e,v.well.id)||x(e,v.rig.id)||x(e,v.frac_fleet.id)||x(e,v.pad.id)||x(e,v.intervention_unit.id))},R=function(e){return{id:e.id,rig:null,well:null,fracFleet:null,interventionUnit:null,program:{id:null,name:null},completionWellInfo:{fracFleet:{id:null,name:null},pad:{id:null,name:null}},wells:null,isLoading:!0,appHash:C(e)}},z=function(e){return e.reduce((function(e,r){return e[r.id]=R(r),e}),{})},H=function(e){var r=x(e,v.intervention_unit.id),n=x(e,v.well.id);return Boolean(r&&!n)},J=function(e,r){var n=[],t=[],i=[],u=[],a=[],l=[],o=[];e.forEach((function(e){var r=x(e,v.well.id),c=x(e,v.rig.id),s=x(e,v.frac_fleet.id),p=x(e,v.pad.id),d=x(e,v.intervention_unit.id),f=e.id;o.push([f]),d?(u.push([f,d]),r&&n.push([f,r])):r?n.push([f,r]):c?t.push([f,c]):s&&(i.push([f,s]),p?l.push([f,p]):a.push([f,s]))}));var c=r.current,s=c.rigsById,p=c.wellsById,d=c.fracFleetsById,f=c.interventionUnitsById;return{appsWellIds:n,appsRigIds:t,appsFracFleetIds:i,appsPadIds:l,appIds:o,appsFracFleetToFetchWellsIds:a,appsInterventionUnitIds:u,uniqueWellIds:O(n,Object.keys(p)),uniqueRigIds:O(t,Object.keys(s)),uniqueFFIds:O(i,Object.keys(d)),uniqueInterventionUnitIds:O(u,Object.keys(f))}},L=function(e){return k(e.data.map((function(r){var n=y(e,"rig",h(r,"rig")),t=y(e,"program",h(r,"program")),i=y(e,"frac_fleet",h(r,"frac_fleet")),u=y(e,"pad",h(r,"pad")),a=b(b({},n),{},{program:t});return b(b({},r),{},{rig:a,fracFleet:i,pad:u})})))},M=function(e){return k(e.data.map((function(r){var n=h(r,"active_well")||h(r,"last_active_well"),t=y(e,"well",n),i=y(e,"program",h(r,"program")),u=j(t)?t:void 0;return b(b({},r),{},{well:u,program:i})})))},K=function(e){return k(e.data.map((function(r){var n,t=y(e,"well",h(r,"active_well")),i=j(t)?t:void 0;return b(b({},r),{},{name:null===(n=r.attributes)||void 0===n?void 0:n.name,well:i})})))},Q=function(e){return e.reduce((function(e,r){return void 0!==r.id&&(e[r.id]=r),e}),{})};export{Q as buildFracFleetCache,K as buildInterventionUnitCache,M as buildRigCache,L as buildWellCache,P as fetchAssetEntitiesByAssetIds,D as fetchFracFleetWells,W as fetchFracFleets,q as fetchInterventionUnits,N as fetchPadWells,F as fetchRigs,I as fetchWells,x as getAppAssetSpecificTypeId,C as getAppHash,S as getAppsDataByFFs,U as getAppsDataByInterventionUnits,T as getAppsDataByPads,E as getAppsDataByRigs,B as getAppsDataByWells,R as getInitialAppData,z as getInitialAppsDataState,O as getUniqAssetIds,H as isAppNeedingInterventionUnitWellRefresh,G as isAppWithSettings,J as prepareDataForResolver};
1
+ import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/toConsumableArray";import i from"@babel/runtime/regenerator";import u from"jsona";import{getWells as l,getRigs as a,getFracFleets as o,getInterventionUnits as c,getFracFleetWells as s,getPadWells as p,getResolvedAssets as d}from"../../../../clients/jsonApi/index.js";import{DEV_CENTER_CLI_APP_ID as f}from"../../../../constants/devcenter.js";import"../../../../constants/goals.js";import"../../../../constants/segment.js";import"../../../../constants/alerts.js";import"../../../../constants/apps.js";import"../../../../constants/drillstring.js";import"../../../../constants/completion.js";import"../../../../constants/appPackages.js";import"../../../../constants/notifications.js";import"../../../../constants/feed.js";import"../../../../constants/bha.js";import{ASSET_TYPES as v}from"../../../../constants/assetTypes.js";import"../../../../constants/corvaCompanyId.js";import"lodash";import"../../../GradientManager/configuration/constants.js";import{getAppSegment as m}from"../../../../utils/devcenter.js";function w(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function b(r){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?w(Object(t),!0).forEach((function(n){e(r,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var g=new u,_=function(e){var r=g.deserialize(e);if(!Array.isArray(r))throw new TypeError("Expected a JSON:API collection response");return r},h=function(e,r){var n,t,i=null==e||null===(n=e.relationships)||void 0===n||null===(t=n[r])||void 0===t?void 0:t.data;return i&&!Array.isArray(i)?i.id:void 0},y=function(e,r,n){return e.included.find((function(e){return e.type===r&&e.id===n}))},j=function(e){return"well"===(null==e?void 0:e.type)},k=function(e){return e.reduce((function(e,r){return e[r.id]=r,e}),{})},x=function(e,r){var n;return Number(null===(n=e.settings)||void 0===n?void 0:n[r])},O=function(e,r){return t(new Set(e.map((function(e){var r=n(e,2);return r[0],r[1]})).filter((function(e){return Number.isFinite(e)&&!r.includes(String(e))}))))},I=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,l({ids:r,fields:["well.name","well.settings","well.custom_properties","well.company","well.asset_id","well.last_active_at","well.program","well.pad","well.frac_fleet","well.id","well.rig","rig.name","rig.asset_id","company.id","well.status","well.archivation","well.lon_lat"],include_arhivation_data:!0});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),F=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,a({ids:r,fields:["rig.name","rig.settings","rig.asset_id","rig.active_well","rig.last_active_well","well.name","well.settings","well.custom_properties","well.company","rig.program","well.asset_id","well.last_active_at","well.id","well.company.id","well.lon_lat"]});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),P=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,d({assets:r});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),A=function(e,r,n){var t,i,u,l,a,o,c,s,p,d,f,v=e?b(b({},e.attributes),{},{id:e.id,companyId:h(e,"company")}):void 0,m=n?{id:Number(n.id),name:n.name,active_well:n.active_well}:void 0;return b(b({well:v,rig:{name:null==r||null===(t=r.attributes)||void 0===t?void 0:t.name,id:null==r?void 0:r.id,asset_id:null==r||null===(i=r.attributes)||void 0===i?void 0:i.asset_id},program:{id:(null==r||null===(u=r.program)||void 0===u?void 0:u.id)||null,name:(null==r||null===(l=r.program)||void 0===l||null===(a=l.attributes)||void 0===a?void 0:a.name)||null}},m&&{interventionUnit:m}),{},{completionWellInfo:{pad:{id:(null==e||null===(o=e.pad)||void 0===o?void 0:o.id)||null,name:(null==e||null===(c=e.pad)||void 0===c||null===(s=c.attributes)||void 0===s?void 0:s.name)||null},fracFleet:{id:(null==e||null===(p=e.fracFleet)||void 0===p?void 0:p.id)||null,name:(null==e||null===(d=e.fracFleet)||void 0===d||null===(f=d.attributes)||void 0===f?void 0:f.name)||null}}})},B=function(e,r){return Object.keys(r).length?e.reduce((function(e,t){var i=n(t,2),u=i[0],l=i[1],a=r[l];return a?(e[u]=A(a,a.rig),e):e}),{}):{}},E=function(e,r){return Object.keys(r).length?e.reduce((function(e,t){var i=n(t,2),u=i[0],l=i[1],a=r[l];return e[u]=A(null==a?void 0:a.well,a),e}),{}):{}},S=function(e,r,t){return Object.keys(r).length||t?e.reduce((function(e,i){var u=n(i,2),l=u[0],a=u[1],o=r[a],c=t?t[l]:void 0,s=null==o?void 0:o.program;return e[l]={fracFleet:o,wells:c,program:{id:(null==s?void 0:s.id)||null,name:(null==s?void 0:s.name)||null}},e}),{}):{}},T=function(e,r){return e.length||r?e.reduce((function(e,t){var i=n(t,1)[0];return e[i]={wells:r?r[i]:void 0},e}),{}):{}},U=function(e,r,t,i){return Object.keys(r).length?e.reduce((function(e,u){var l,a=n(u,2),o=a[0],c=a[1],s=r[c],p=null===(l=t.find((function(e){return n(e,1)[0]===o})))||void 0===l?void 0:l[1],d=p&&i[p]||(null==s?void 0:s.well);return s||d?(e[o]=A(d,null==d?void 0:d.rig,s&&b(b({},s),s.well&&{active_well:b({id:s.well.id},s.well.attributes)})),e):e}),{}):{}},W=function(){var e=r(i.mark((function e(r){var n,t;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,o({ids:r,fields:["frac_fleet.name","frac_fleet.pads","frac_fleet.program","frac_fleet.current_pad_id","frac_fleet.pad_frac_fleets","frac_fleet.pad_frac_fleet.frac_fleet_lines"]});case 5:if(n=e.sent){e.next=8;break}return e.abrupt("return",[]);case 8:return t=_(n),e.abrupt("return",t);case 12:return e.prev=12,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",[]);case 16:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(r){return e.apply(this,arguments)}}(),q=function(){var e=r(i.mark((function e(r){var n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,c({ids:r,fields:["intervention_unit.name","intervention_unit.type","intervention_unit.active_well"]});case 5:return n=e.sent,e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(2),console.error(e.t0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),D=function(){var e=r(i.mark((function e(t,u){var l,a,o;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=k(u),a=t.map(function(){var e=r(i.mark((function e(r){var t,u,a,o,c,p,d,v,m;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n(r,2),o=a[0],c=a[1],p=l[o],d={fields:"all",frac_fleet_id:c},o===f?d.app_key=null==p||null===(t=p.app)||void 0===t?void 0:t.app_key:d.app_id=null==p||null===(u=p.app)||void 0===u?void 0:u.id,e.prev=4,e.next=7,s(d);case 7:if(v=e.sent){e.next=10;break}return e.abrupt("return",[]);case 10:return m=_(v),e.abrupt("return",m);case 14:return e.prev=14,e.t0=e.catch(4),console.error(e.t0),e.abrupt("return",[]);case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(r){return e.apply(this,arguments)}}()),e.next=4,Promise.all(a);case 4:return o=e.sent,e.abrupt("return",o.reduce((function(e,r,n){return e[t[n][0]]=r,e}),{}));case 6:case"end":return e.stop()}}),e)})));return function(r,n){return e.apply(this,arguments)}}(),N=function(){var e=r(i.mark((function e(t,u){var l,a,o;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=k(u),a=t.map(function(){var e=r(i.mark((function e(r){var t,u,a,o,c,s,d,v,m;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n(r,2),o=a[0],c=a[1],s=l[o],d={fields:"all"},o===f?d.app_key=null==s||null===(t=s.app)||void 0===t?void 0:t.app_key:d.app_id=null==s||null===(u=s.app)||void 0===u?void 0:u.id,e.prev=4,e.next=7,p(c,d);case 7:if(v=e.sent){e.next=10;break}return e.abrupt("return",[]);case 10:return m=_(v),e.abrupt("return",m);case 14:return e.prev=14,e.t0=e.catch(4),console.error(e.t0),e.abrupt("return",[]);case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(r){return e.apply(this,arguments)}}()),e.next=4,Promise.all(a);case 4:return o=e.sent,e.abrupt("return",o.reduce((function(e,r,n){return e[t[n][0]]=r,e}),{}));case 6:case"end":return e.stop()}}),e)})));return function(r,n){return e.apply(this,arguments)}}(),C=function(e){return[e.id,x(e,v.well.id),x(e,v.rig.id),x(e,v.frac_fleet.id),x(e,v.pad.id),x(e,v.intervention_unit.id),x(e,"deprecatedAssetId"),m(e)].join("-")},G=function(e){return Boolean(x(e,v.well.id)||x(e,v.rig.id)||x(e,v.frac_fleet.id)||x(e,v.pad.id)||x(e,v.intervention_unit.id))},R=function(e){return{id:e.id,rig:null,well:null,fracFleet:null,interventionUnit:null,program:{id:null,name:null},completionWellInfo:{fracFleet:{id:null,name:null},pad:{id:null,name:null}},wells:null,isLoading:!0,appHash:C(e)}},z=function(e){return e.reduce((function(e,r){return e[r.id]=R(r),e}),{})},H=function(e){var r=x(e,v.intervention_unit.id),n=x(e,v.well.id);return Boolean(r&&!n)},J=function(e,r){var n=[],t=[],i=[],u=[],l=[],a=[],o=[];e.forEach((function(e){var r=x(e,v.well.id),c=x(e,v.rig.id),s=x(e,v.frac_fleet.id),p=x(e,v.pad.id),d=x(e,v.intervention_unit.id),f=e.id;o.push([f]),d?(u.push([f,d]),r&&n.push([f,r])):r?n.push([f,r]):c?t.push([f,c]):s&&(i.push([f,s]),p?a.push([f,p]):l.push([f,s]))}));var c=r.current,s=c.rigsById,p=c.wellsById,d=c.fracFleetsById,f=c.interventionUnitsById;return{appsWellIds:n,appsRigIds:t,appsFracFleetIds:i,appsPadIds:a,appIds:o,appsFracFleetToFetchWellsIds:l,appsInterventionUnitIds:u,uniqueWellIds:O(n,Object.keys(p)),uniqueRigIds:O(t,Object.keys(s)),uniqueFFIds:O(i,Object.keys(d)),uniqueInterventionUnitIds:O(u,Object.keys(f))}},L=function(e){return k(e.data.map((function(r){var n=y(e,"rig",h(r,"rig")),t=y(e,"program",h(r,"program")),i=y(e,"frac_fleet",h(r,"frac_fleet")),u=y(e,"pad",h(r,"pad")),l=b(b({},n),{},{program:t});return b(b({},r),{},{rig:l,fracFleet:i,pad:u})})))},M=function(e){return k(e.data.map((function(r){var n=h(r,"active_well")||h(r,"last_active_well"),t=y(e,"well",n),i=y(e,"program",h(r,"program")),u=j(t)?t:void 0;return b(b({},r),{},{well:u,program:i})})))},K=function(e){return k(e.data.map((function(r){var n,t=y(e,"well",h(r,"active_well")),i=j(t)?t:void 0;return b(b({},r),{},{name:null===(n=r.attributes)||void 0===n?void 0:n.name,well:i})})))},Q=function(e){return e.reduce((function(e,r){return void 0!==r.id&&(e[r.id]=r),e}),{})};export{Q as buildFracFleetCache,K as buildInterventionUnitCache,M as buildRigCache,L as buildWellCache,P as fetchAssetEntitiesByAssetIds,D as fetchFracFleetWells,W as fetchFracFleets,q as fetchInterventionUnits,N as fetchPadWells,F as fetchRigs,I as fetchWells,x as getAppAssetSpecificTypeId,C as getAppHash,S as getAppsDataByFFs,U as getAppsDataByInterventionUnits,T as getAppsDataByPads,E as getAppsDataByRigs,B as getAppsDataByWells,R as getInitialAppData,z as getInitialAppsDataState,O as getUniqAssetIds,H as isAppNeedingInterventionUnitWellRefresh,G as isAppWithSettings,J as prepareDataForResolver};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/components/DevCenter/AppsDataProvider/effects/utils.ts"],"sourcesContent":["import Jsona from 'jsona';\n\nimport {\n getFracFleets,\n getFracFleetWells,\n getInterventionUnits,\n getPadWells,\n getResolvedAssets,\n getRigs,\n getWells,\n} from '~/clients/jsonApi';\nimport { DEV_CENTER_CLI_APP_ID } from '~/constants';\nimport { ASSET_TYPES } from '~/constants/assetTypes';\nimport { getAppSegment } from '~/utils/devcenter';\n\nimport type {\n AppAssetIdPair,\n AppDataCompletionWell,\n AppDataFracFleet,\n AppDataInterventionUnit,\n AppDataPatch,\n AppDataPatches,\n AppsDataCacheRef,\n AssetId,\n InitializedAppDataDictionary,\n InitializedAppDataEntry,\n InterventionUnitResource,\n JsonApiCollectionResponse,\n JsonApiResource,\n LinkedRigResource,\n PreparedProviderApp,\n PreparedResolverData,\n ProviderApp,\n RigResource,\n WellResource,\n} from '../types';\n\nconst dataFormatter = new Jsona();\n\ntype ResolvedAssetResource = JsonApiResource & {\n attributes: { asset_id: AssetId } & Record<string, unknown>;\n};\n\nexport type ResolvedAssetResponse = Record<string, Array<{ data: ResolvedAssetResource }>>;\n\ntype JsonaInput = Parameters<typeof dataFormatter.deserialize>[0];\n\nconst deserializeCollection = (response: JsonaInput) => {\n const deserialized = dataFormatter.deserialize(response);\n\n if (!Array.isArray(deserialized)) {\n throw new TypeError('Expected a JSON:API collection response');\n }\n\n return deserialized;\n};\n\nconst getRelationshipId = (resource: JsonApiResource | undefined, name: string) => {\n const data = resource?.relationships?.[name]?.data;\n\n return data && !Array.isArray(data) ? data.id : undefined;\n};\n\nconst findIncludedResource = (\n response: JsonApiCollectionResponse,\n type: string,\n id: AssetId | undefined\n) => response.included.find(item => item.type === type && item.id === id);\n\nconst isWellResource = (resource: JsonApiResource | undefined): resource is WellResource =>\n resource?.type === 'well';\n\nconst keyResourcesById = <Resource extends { id: AssetId }>(resources: Resource[]) =>\n resources.reduce<Record<string, Resource>>((acc, resource) => {\n acc[resource.id] = resource;\n\n return acc;\n }, {});\n\nexport const getAppAssetSpecificTypeId = (app: ProviderApp, typeId: string): number =>\n Number(app.settings?.[typeId]);\n\nexport const getUniqAssetIds = (assetIds: AppAssetIdPair[], cachedAssetIds: string[]): number[] => [\n ...new Set(\n assetIds\n .map(([_appId, assetId]) => assetId)\n .filter(assetId => Number.isFinite(assetId) && !cachedAssetIds.includes(String(assetId)))\n ),\n];\n\nexport const fetchWells = async (\n ids: number[]\n): Promise<JsonApiCollectionResponse<WellResource> | null> => {\n if (!ids.length) return null;\n\n try {\n const response: JsonApiCollectionResponse<WellResource> = await getWells({\n ids,\n fields: [\n 'well.name',\n 'well.settings',\n 'well.custom_properties',\n 'well.company',\n 'well.asset_id',\n 'well.last_active_at',\n 'well.program',\n 'well.pad',\n 'well.frac_fleet',\n 'well.id',\n 'well.rig',\n 'rig.name',\n 'rig.asset_id',\n 'company.id',\n 'well.status',\n 'well.archivation',\n 'well.lon_lat',\n ],\n include_arhivation_data: true,\n });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nexport const fetchRigs = async (\n ids: number[]\n): Promise<JsonApiCollectionResponse<RigResource> | null> => {\n if (!ids.length) return null;\n\n try {\n const response: JsonApiCollectionResponse<RigResource> = await getRigs({\n ids,\n fields: [\n 'rig.name',\n 'rig.settings',\n 'rig.asset_id',\n 'rig.active_well',\n 'rig.last_active_well',\n 'well.name',\n 'well.settings',\n 'well.custom_properties',\n 'well.company',\n 'rig.program',\n 'well.asset_id',\n 'well.last_active_at',\n 'well.id',\n 'well.company.id',\n 'well.lon_lat',\n ],\n });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nexport const fetchAssetEntitiesByAssetIds = async (\n assetIds: Array<AssetId | null | undefined>\n): Promise<ResolvedAssetResponse | null> => {\n if (!assetIds.length) return null;\n\n try {\n const response: ResolvedAssetResponse = await getResolvedAssets({ assets: assetIds });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nconst getWellObjectFromWellData = (\n well: WellResource | undefined,\n rig: RigResource | LinkedRigResource | undefined,\n interventionUnit?: InterventionUnitResource\n): AppDataPatch => {\n const appDataWell = well\n ? {\n ...well.attributes,\n id: well.id,\n // NOTE: API doesn't return active child company id\n companyId: getRelationshipId(well, 'company'),\n }\n : undefined;\n\n const appDataInterventionUnit: AppDataInterventionUnit | undefined = interventionUnit\n ? {\n id: Number(interventionUnit.id),\n name: interventionUnit.name,\n active_well: interventionUnit.active_well,\n }\n : undefined;\n\n return {\n well: appDataWell,\n rig: {\n name: rig?.attributes?.name,\n id: rig?.id,\n asset_id: rig?.attributes?.asset_id,\n },\n program: {\n id: rig?.program?.id || null,\n name: rig?.program?.attributes?.name || null,\n },\n ...(appDataInterventionUnit && { interventionUnit: appDataInterventionUnit }),\n // NOTE: Support ff/pad in mixpanel for Asset Dashboards\n completionWellInfo: {\n pad: {\n id: well?.pad?.id || null,\n name: well?.pad?.attributes?.name || null,\n },\n fracFleet: {\n id: well?.fracFleet?.id || null,\n name: well?.fracFleet?.attributes?.name || null,\n },\n },\n };\n};\n\nexport const getAppsDataByWells = (\n appsWellIds: AppAssetIdPair[],\n wellsById: Record<string, WellResource>\n): AppDataPatches => {\n if (!Object.keys(wellsById).length) return {};\n\n return appsWellIds.reduce<AppDataPatches>((acc, [appId, wellId]) => {\n const well = wellsById[wellId];\n if (!well) return acc;\n\n acc[appId] = getWellObjectFromWellData(well, well.rig);\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByRigs = (\n appsRigIds: AppAssetIdPair[],\n rigsById: Record<string, RigResource>\n): AppDataPatches => {\n if (!Object.keys(rigsById).length) return {};\n\n return appsRigIds.reduce<AppDataPatches>((acc, [appId, rigId]) => {\n const rig = rigsById[rigId];\n acc[appId] = getWellObjectFromWellData(rig?.well, rig);\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByFFs = (\n appsFracFleetIds: AppAssetIdPair[],\n ffsById: Record<string, AppDataFracFleet>,\n ffWellsData: Record<string, AppDataCompletionWell[]> | null | false\n): AppDataPatches => {\n if (!Object.keys(ffsById).length && !ffWellsData) return {};\n\n return appsFracFleetIds.reduce<AppDataPatches>((acc, [appId, ffId]) => {\n const fracFleet = ffsById[ffId];\n const wells = ffWellsData ? ffWellsData[appId] : undefined;\n const program = fracFleet?.program;\n\n acc[appId] = {\n fracFleet,\n wells,\n program: {\n id: program?.id || null,\n name: program?.name || null,\n },\n };\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByPads = (\n appsPadIds: AppAssetIdPair[],\n padWellsData: Record<string, AppDataCompletionWell[]> | null | false\n): AppDataPatches => {\n if (!appsPadIds.length && !padWellsData) return {};\n\n return appsPadIds.reduce<AppDataPatches>((acc, [appId]) => {\n acc[appId] = { wells: padWellsData ? padWellsData[appId] : undefined };\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByInterventionUnits = (\n appsInterventionUnitIds: AppAssetIdPair[],\n interventionUnitsById: Record<string, InterventionUnitResource>,\n appsWellIds: AppAssetIdPair[],\n wellsById: Record<string, WellResource>\n): AppDataPatches => {\n if (!Object.keys(interventionUnitsById).length) return {};\n\n return appsInterventionUnitIds.reduce<AppDataPatches>((acc, [appId, interventionUnitId]) => {\n const interventionUnit = interventionUnitsById[interventionUnitId];\n const appWellId = appsWellIds.find(([wellAppId]) => wellAppId === appId)?.[1];\n const well = (appWellId && wellsById[appWellId]) || interventionUnit.well;\n\n acc[appId] = getWellObjectFromWellData(well, well?.rig, {\n ...interventionUnit,\n ...(interventionUnit.well && {\n active_well: { id: interventionUnit.well.id, ...interventionUnit.well.attributes },\n }),\n });\n\n return acc;\n }, {});\n};\n\nexport const fetchFracFleets = async (ids: number[]): Promise<AppDataFracFleet[] | null> => {\n if (!ids.length) return null;\n\n try {\n const response = await getFracFleets({\n ids,\n fields: [\n 'frac_fleet.name',\n 'frac_fleet.pads',\n 'frac_fleet.program',\n 'frac_fleet.current_pad_id',\n 'frac_fleet.pad_frac_fleets',\n 'frac_fleet.pad_frac_fleet.frac_fleet_lines',\n ],\n });\n if (!response) return [];\n\n const fracFleets: AppDataFracFleet[] = deserializeCollection(response);\n\n return fracFleets;\n } catch (error) {\n console.error(error);\n return [];\n }\n};\n\nexport const fetchInterventionUnits = async (\n ids: number[]\n): Promise<JsonApiCollectionResponse | null> => {\n if (!ids.length) return null;\n\n try {\n const response: JsonApiCollectionResponse = await getInterventionUnits({\n ids,\n fields: ['intervention_unit.name', 'intervention_unit.type', 'intervention_unit.active_well'],\n });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nexport const fetchFracFleetWells = async (\n appsFFIds: AppAssetIdPair[],\n apps: ProviderApp[]\n): Promise<Record<string, AppDataCompletionWell[]>> => {\n const appsById = keyResourcesById(apps);\n const requests = appsFFIds.map(async ([appId, fracFleetId]) => {\n const app = appsById[appId];\n const options: Record<string, unknown> = { fields: 'all', frac_fleet_id: fracFleetId };\n\n if (appId === DEV_CENTER_CLI_APP_ID) options.app_key = app?.app?.app_key;\n else options.app_id = app?.app?.id;\n\n try {\n const response = await getFracFleetWells(options);\n if (!response) return [];\n\n const wells: AppDataCompletionWell[] = deserializeCollection(response);\n\n return wells;\n } catch (error) {\n console.error(error);\n return [];\n }\n });\n\n const responses = await Promise.all(requests);\n\n return responses.reduce<Record<string, AppDataCompletionWell[]>>((acc, wells, index) => {\n acc[appsFFIds[index][0]] = wells;\n\n return acc;\n }, {});\n};\n\nexport const fetchPadWells = async (\n appsPadIds: AppAssetIdPair[],\n apps: ProviderApp[]\n): Promise<Record<string, AppDataCompletionWell[]>> => {\n const appsById = keyResourcesById(apps);\n const requests = appsPadIds.map(async ([appId, padId]) => {\n const app = appsById[appId];\n const options: Record<string, unknown> = { fields: 'all' };\n\n if (appId === DEV_CENTER_CLI_APP_ID) options.app_key = app?.app?.app_key;\n else options.app_id = app?.app?.id;\n\n try {\n const response = await getPadWells(padId, options);\n if (!response) return [];\n\n const wells: AppDataCompletionWell[] = deserializeCollection(response);\n\n return wells;\n } catch (error) {\n console.error(error);\n return [];\n }\n });\n\n const responses = await Promise.all(requests);\n\n return responses.reduce<Record<string, AppDataCompletionWell[]>>((acc, wells, index) => {\n acc[appsPadIds[index][0]] = wells;\n\n return acc;\n }, {});\n};\n\nexport const getAppHash = (app: ProviderApp): string =>\n [\n app.id,\n getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.rig.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.frac_fleet.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.pad.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id),\n getAppAssetSpecificTypeId(app, 'deprecatedAssetId'),\n getAppSegment(app),\n ].join('-');\n\nexport const isAppWithSettings = (app: ProviderApp): boolean =>\n Boolean(\n getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.rig.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.frac_fleet.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.pad.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id)\n );\n\nexport const getInitialAppData = (app: ProviderApp): InitializedAppDataEntry => ({\n id: app.id,\n rig: null,\n well: null,\n fracFleet: null,\n interventionUnit: null,\n program: { id: null, name: null },\n completionWellInfo: {\n fracFleet: { id: null, name: null },\n pad: { id: null, name: null },\n },\n wells: null,\n isLoading: true,\n appHash: getAppHash(app),\n});\n\nexport const getInitialAppsDataState = (apps: ProviderApp[]): InitializedAppDataDictionary =>\n apps.reduce<InitializedAppDataDictionary>((acc, app) => {\n acc[app.id] = getInitialAppData(app);\n\n return acc;\n }, {});\n\nexport const isAppNeedingInterventionUnitWellRefresh = (app: ProviderApp): boolean => {\n const interventionUnitId = getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id);\n const wellId = getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id);\n\n return Boolean(interventionUnitId && !wellId);\n};\n\nexport const prepareDataForResolver = (\n apps: PreparedProviderApp[],\n cache: AppsDataCacheRef\n): PreparedResolverData => {\n const appsWellIds: AppAssetIdPair[] = [];\n const appsRigIds: AppAssetIdPair[] = [];\n const appsFracFleetIds: AppAssetIdPair[] = [];\n const appsInterventionUnitIds: AppAssetIdPair[] = [];\n const appsFracFleetToFetchWellsIds: AppAssetIdPair[] = [];\n const appsPadIds: AppAssetIdPair[] = [];\n const appIds: [ProviderApp['id']][] = [];\n\n apps.forEach(app => {\n const appWellId = getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id);\n const appRigId = getAppAssetSpecificTypeId(app, ASSET_TYPES.rig.id);\n const appFracFleetId = getAppAssetSpecificTypeId(app, ASSET_TYPES.frac_fleet.id);\n const appPadId = getAppAssetSpecificTypeId(app, ASSET_TYPES.pad.id);\n const appInterventionUnitId = getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id);\n const appId = app.id;\n\n appIds.push([appId]);\n\n if (appInterventionUnitId) {\n appsInterventionUnitIds.push([appId, appInterventionUnitId]);\n // NOTE: we need to fetch well for intervention unit as there is no well in intervention unit\n if (appWellId) appsWellIds.push([appId, appWellId]);\n } else if (appWellId) {\n appsWellIds.push([appId, appWellId]);\n } else if (appRigId) {\n appsRigIds.push([appId, appRigId]);\n } else if (appFracFleetId) {\n appsFracFleetIds.push([appId, appFracFleetId]);\n if (appPadId) appsPadIds.push([appId, appPadId]);\n else appsFracFleetToFetchWellsIds.push([appId, appFracFleetId]);\n }\n });\n\n const { rigsById, wellsById, fracFleetsById, interventionUnitsById } = cache.current;\n\n return {\n appsWellIds,\n appsRigIds,\n appsFracFleetIds,\n appsPadIds,\n appIds,\n appsFracFleetToFetchWellsIds,\n appsInterventionUnitIds,\n uniqueWellIds: getUniqAssetIds(appsWellIds, Object.keys(wellsById)),\n uniqueRigIds: getUniqAssetIds(appsRigIds, Object.keys(rigsById)),\n uniqueFFIds: getUniqAssetIds(appsFracFleetIds, Object.keys(fracFleetsById)),\n uniqueInterventionUnitIds: getUniqAssetIds(\n appsInterventionUnitIds,\n Object.keys(interventionUnitsById)\n ),\n };\n};\n\nexport const buildWellCache = (\n response: JsonApiCollectionResponse<WellResource>\n): Record<string, WellResource> =>\n keyResourcesById(\n response.data.map(well => {\n const rigResource = findIncludedResource(response, 'rig', getRelationshipId(well, 'rig'));\n const program = findIncludedResource(response, 'program', getRelationshipId(well, 'program'));\n const fracFleet = findIncludedResource(\n response,\n 'frac_fleet',\n getRelationshipId(well, 'frac_fleet')\n );\n const pad = findIncludedResource(response, 'pad', getRelationshipId(well, 'pad'));\n const rig = { ...rigResource, program };\n\n return { ...well, rig, fracFleet, pad };\n })\n );\n\nexport const buildRigCache = (\n response: JsonApiCollectionResponse<RigResource>\n): Record<string, RigResource> =>\n keyResourcesById(\n response.data.map(rig => {\n const wellId =\n getRelationshipId(rig, 'active_well') || getRelationshipId(rig, 'last_active_well');\n const wellResource = findIncludedResource(response, 'well', wellId);\n const program = findIncludedResource(response, 'program', getRelationshipId(rig, 'program'));\n const well = isWellResource(wellResource) ? wellResource : undefined;\n\n return { ...rig, well, program };\n })\n );\n\nexport const buildInterventionUnitCache = (\n response: JsonApiCollectionResponse\n): Record<string, InterventionUnitResource> =>\n keyResourcesById(\n response.data.map(interventionUnit => {\n const wellResource = findIncludedResource(\n response,\n 'well',\n getRelationshipId(interventionUnit, 'active_well')\n );\n const well = isWellResource(wellResource) ? wellResource : undefined;\n\n return {\n ...interventionUnit,\n name: interventionUnit.attributes?.name,\n well,\n };\n })\n );\n\nexport const buildFracFleetCache = (\n fracFleets: AppDataFracFleet[]\n): Record<string, AppDataFracFleet> =>\n fracFleets.reduce<Record<string, AppDataFracFleet>>((acc, fracFleet) => {\n if (fracFleet.id !== undefined) acc[fracFleet.id] = fracFleet;\n\n return acc;\n }, {});\n"],"names":["dataFormatter","Jsona","deserializeCollection","response","deserialized","deserialize","Array","isArray","TypeError","getRelationshipId","resource","name","_resource$relationshi","_resource$relationshi2","data","relationships","id","undefined","findIncludedResource","type","included","find","item","isWellResource","keyResourcesById","resources","reduce","acc","getAppAssetSpecificTypeId","app","typeId","_app$settings","Number","settings","getUniqAssetIds","assetIds","cachedAssetIds","_toConsumableArray","Set","map","_ref","_ref2","_slicedToArray","filter","assetId","isFinite","includes","String","fetchWells","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","ids","wrap","_context","prev","next","length","abrupt","getWells","fields","include_arhivation_data","sent","t0","console","error","stop","_callee","_x","apply","this","arguments","fetchRigs","_ref4","_context2","getRigs","_callee2","_x2","fetchAssetEntitiesByAssetIds","_ref5","_context3","getResolvedAssets","assets","_callee3","_x3","getWellObjectFromWellData","well","rig","interventionUnit","_rig$attributes","_rig$attributes2","_rig$program","_rig$program2","_rig$program2$attribu","_well$pad","_well$pad2","_well$pad2$attributes","_well$fracFleet","_well$fracFleet2","_well$fracFleet2$attr","appDataWell","attributes","companyId","appDataInterventionUnit","active_well","_objectSpread","asset_id","program","completionWellInfo","pad","fracFleet","getAppsDataByWells","appsWellIds","wellsById","Object","keys","_ref6","_ref7","appId","wellId","getAppsDataByRigs","appsRigIds","rigsById","_ref8","_ref9","rigId","getAppsDataByFFs","appsFracFleetIds","ffsById","ffWellsData","_ref10","_ref11","ffId","wells","getAppsDataByPads","appsPadIds","padWellsData","_ref12","getAppsDataByInterventionUnits","appsInterventionUnitIds","interventionUnitsById","_ref14","_appsWellIds$find","_ref15","interventionUnitId","appWellId","_ref16","fetchFracFleets","_ref18","fracFleets","_context4","getFracFleets","_callee4","_x4","fetchInterventionUnits","_ref19","_context5","getInterventionUnits","_callee5","_x5","fetchFracFleetWells","_ref20","_callee7","appsFFIds","apps","appsById","requests","responses","_context7","_ref22","_callee6","_ref21","_app$app","_app$app2","_ref23","fracFleetId","options","_context6","frac_fleet_id","DEV_CENTER_CLI_APP_ID","app_key","app_id","getFracFleetWells","_x8","Promise","all","index","_x6","_x7","fetchPadWells","_ref24","_callee9","_context9","_ref26","_callee8","_ref25","_app$app3","_app$app4","_ref27","padId","_context8","getPadWells","_x11","_x9","_x10","getAppHash","ASSET_TYPES","frac_fleet","intervention_unit","getAppSegment","join","isAppWithSettings","Boolean","getInitialAppData","isLoading","appHash","getInitialAppsDataState","isAppNeedingInterventionUnitWellRefresh","prepareDataForResolver","cache","appsFracFleetToFetchWellsIds","appIds","forEach","appRigId","appFracFleetId","appPadId","appInterventionUnitId","push","current","fracFleetsById","uniqueWellIds","uniqueRigIds","uniqueFFIds","uniqueInterventionUnitIds","buildWellCache","r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1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/components/DevCenter/AppsDataProvider/effects/utils.ts"],"sourcesContent":["import Jsona from 'jsona';\n\nimport {\n getFracFleets,\n getFracFleetWells,\n getInterventionUnits,\n getPadWells,\n getResolvedAssets,\n getRigs,\n getWells,\n} from '~/clients/jsonApi';\nimport { DEV_CENTER_CLI_APP_ID } from '~/constants';\nimport { ASSET_TYPES } from '~/constants/assetTypes';\nimport { getAppSegment } from '~/utils/devcenter';\n\nimport type {\n AppAssetIdPair,\n AppDataCompletionWell,\n AppDataFracFleet,\n AppDataInterventionUnit,\n AppDataPatch,\n AppDataPatches,\n AppsDataCacheRef,\n AssetId,\n InitializedAppDataDictionary,\n InitializedAppDataEntry,\n InterventionUnitResource,\n JsonApiCollectionResponse,\n JsonApiResource,\n LinkedRigResource,\n PreparedProviderApp,\n PreparedResolverData,\n ProviderApp,\n RigResource,\n WellResource,\n} from '../types';\n\nconst dataFormatter = new Jsona();\n\ntype ResolvedAssetResource = JsonApiResource & {\n attributes: { asset_id: AssetId } & Record<string, unknown>;\n};\n\nexport type ResolvedAssetResponse = Record<string, Array<{ data: ResolvedAssetResource }>>;\n\ntype JsonaInput = Parameters<typeof dataFormatter.deserialize>[0];\n\nconst deserializeCollection = (response: JsonaInput) => {\n const deserialized = dataFormatter.deserialize(response);\n\n if (!Array.isArray(deserialized)) {\n throw new TypeError('Expected a JSON:API collection response');\n }\n\n return deserialized;\n};\n\nconst getRelationshipId = (resource: JsonApiResource | undefined, name: string) => {\n const data = resource?.relationships?.[name]?.data;\n\n return data && !Array.isArray(data) ? data.id : undefined;\n};\n\nconst findIncludedResource = (\n response: JsonApiCollectionResponse,\n type: string,\n id: AssetId | undefined\n) => response.included.find(item => item.type === type && item.id === id);\n\nconst isWellResource = (resource: JsonApiResource | undefined): resource is WellResource =>\n resource?.type === 'well';\n\nconst keyResourcesById = <Resource extends { id: AssetId }>(resources: Resource[]) =>\n resources.reduce<Record<string, Resource>>((acc, resource) => {\n acc[resource.id] = resource;\n\n return acc;\n }, {});\n\nexport const getAppAssetSpecificTypeId = (app: ProviderApp, typeId: string): number =>\n Number(app.settings?.[typeId]);\n\nexport const getUniqAssetIds = (assetIds: AppAssetIdPair[], cachedAssetIds: string[]): number[] => [\n ...new Set(\n assetIds\n .map(([_appId, assetId]) => assetId)\n .filter(assetId => Number.isFinite(assetId) && !cachedAssetIds.includes(String(assetId)))\n ),\n];\n\nexport const fetchWells = async (\n ids: number[]\n): Promise<JsonApiCollectionResponse<WellResource> | null> => {\n if (!ids.length) return null;\n\n try {\n const response: JsonApiCollectionResponse<WellResource> = await getWells({\n ids,\n fields: [\n 'well.name',\n 'well.settings',\n 'well.custom_properties',\n 'well.company',\n 'well.asset_id',\n 'well.last_active_at',\n 'well.program',\n 'well.pad',\n 'well.frac_fleet',\n 'well.id',\n 'well.rig',\n 'rig.name',\n 'rig.asset_id',\n 'company.id',\n 'well.status',\n 'well.archivation',\n 'well.lon_lat',\n ],\n include_arhivation_data: true,\n });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nexport const fetchRigs = async (\n ids: number[]\n): Promise<JsonApiCollectionResponse<RigResource> | null> => {\n if (!ids.length) return null;\n\n try {\n const response: JsonApiCollectionResponse<RigResource> = await getRigs({\n ids,\n fields: [\n 'rig.name',\n 'rig.settings',\n 'rig.asset_id',\n 'rig.active_well',\n 'rig.last_active_well',\n 'well.name',\n 'well.settings',\n 'well.custom_properties',\n 'well.company',\n 'rig.program',\n 'well.asset_id',\n 'well.last_active_at',\n 'well.id',\n 'well.company.id',\n 'well.lon_lat',\n ],\n });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nexport const fetchAssetEntitiesByAssetIds = async (\n assetIds: Array<AssetId | null | undefined>\n): Promise<ResolvedAssetResponse | null> => {\n if (!assetIds.length) return null;\n\n try {\n const response: ResolvedAssetResponse = await getResolvedAssets({ assets: assetIds });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nconst getWellObjectFromWellData = (\n well: WellResource | undefined,\n rig: RigResource | LinkedRigResource | undefined,\n interventionUnit?: InterventionUnitResource\n): AppDataPatch => {\n const appDataWell = well\n ? {\n ...well.attributes,\n id: well.id,\n // NOTE: API doesn't return active child company id\n companyId: getRelationshipId(well, 'company'),\n }\n : undefined;\n\n const appDataInterventionUnit: AppDataInterventionUnit | undefined = interventionUnit\n ? {\n id: Number(interventionUnit.id),\n name: interventionUnit.name,\n active_well: interventionUnit.active_well,\n }\n : undefined;\n\n return {\n well: appDataWell,\n rig: {\n name: rig?.attributes?.name,\n id: rig?.id,\n asset_id: rig?.attributes?.asset_id,\n },\n program: {\n id: rig?.program?.id || null,\n name: rig?.program?.attributes?.name || null,\n },\n ...(appDataInterventionUnit && { interventionUnit: appDataInterventionUnit }),\n // NOTE: Support ff/pad in mixpanel for Asset Dashboards\n completionWellInfo: {\n pad: {\n id: well?.pad?.id || null,\n name: well?.pad?.attributes?.name || null,\n },\n fracFleet: {\n id: well?.fracFleet?.id || null,\n name: well?.fracFleet?.attributes?.name || null,\n },\n },\n };\n};\n\nexport const getAppsDataByWells = (\n appsWellIds: AppAssetIdPair[],\n wellsById: Record<string, WellResource>\n): AppDataPatches => {\n if (!Object.keys(wellsById).length) return {};\n\n return appsWellIds.reduce<AppDataPatches>((acc, [appId, wellId]) => {\n const well = wellsById[wellId];\n if (!well) return acc;\n\n acc[appId] = getWellObjectFromWellData(well, well.rig);\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByRigs = (\n appsRigIds: AppAssetIdPair[],\n rigsById: Record<string, RigResource>\n): AppDataPatches => {\n if (!Object.keys(rigsById).length) return {};\n\n return appsRigIds.reduce<AppDataPatches>((acc, [appId, rigId]) => {\n const rig = rigsById[rigId];\n acc[appId] = getWellObjectFromWellData(rig?.well, rig);\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByFFs = (\n appsFracFleetIds: AppAssetIdPair[],\n ffsById: Record<string, AppDataFracFleet>,\n ffWellsData: Record<string, AppDataCompletionWell[]> | null | false\n): AppDataPatches => {\n if (!Object.keys(ffsById).length && !ffWellsData) return {};\n\n return appsFracFleetIds.reduce<AppDataPatches>((acc, [appId, ffId]) => {\n const fracFleet = ffsById[ffId];\n const wells = ffWellsData ? ffWellsData[appId] : undefined;\n const program = fracFleet?.program;\n\n acc[appId] = {\n fracFleet,\n wells,\n program: {\n id: program?.id || null,\n name: program?.name || null,\n },\n };\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByPads = (\n appsPadIds: AppAssetIdPair[],\n padWellsData: Record<string, AppDataCompletionWell[]> | null | false\n): AppDataPatches => {\n if (!appsPadIds.length && !padWellsData) return {};\n\n return appsPadIds.reduce<AppDataPatches>((acc, [appId]) => {\n acc[appId] = { wells: padWellsData ? padWellsData[appId] : undefined };\n\n return acc;\n }, {});\n};\n\nexport const getAppsDataByInterventionUnits = (\n appsInterventionUnitIds: AppAssetIdPair[],\n interventionUnitsById: Record<string, InterventionUnitResource>,\n appsWellIds: AppAssetIdPair[],\n wellsById: Record<string, WellResource>\n): AppDataPatches => {\n if (!Object.keys(interventionUnitsById).length) return {};\n\n return appsInterventionUnitIds.reduce<AppDataPatches>((acc, [appId, interventionUnitId]) => {\n const interventionUnit = interventionUnitsById[interventionUnitId];\n const appWellId = appsWellIds.find(([wellAppId]) => wellAppId === appId)?.[1];\n const well = (appWellId && wellsById[appWellId]) || interventionUnit?.well;\n\n if (!interventionUnit && !well) return acc;\n\n acc[appId] = getWellObjectFromWellData(\n well,\n well?.rig,\n interventionUnit && {\n ...interventionUnit,\n ...(interventionUnit.well && {\n active_well: { id: interventionUnit.well.id, ...interventionUnit.well.attributes },\n }),\n }\n );\n\n return acc;\n }, {});\n};\n\nexport const fetchFracFleets = async (ids: number[]): Promise<AppDataFracFleet[] | null> => {\n if (!ids.length) return null;\n\n try {\n const response = await getFracFleets({\n ids,\n fields: [\n 'frac_fleet.name',\n 'frac_fleet.pads',\n 'frac_fleet.program',\n 'frac_fleet.current_pad_id',\n 'frac_fleet.pad_frac_fleets',\n 'frac_fleet.pad_frac_fleet.frac_fleet_lines',\n ],\n });\n if (!response) return [];\n\n const fracFleets: AppDataFracFleet[] = deserializeCollection(response);\n\n return fracFleets;\n } catch (error) {\n console.error(error);\n return [];\n }\n};\n\nexport const fetchInterventionUnits = async (\n ids: number[]\n): Promise<JsonApiCollectionResponse | null> => {\n if (!ids.length) return null;\n\n try {\n const response: JsonApiCollectionResponse = await getInterventionUnits({\n ids,\n fields: ['intervention_unit.name', 'intervention_unit.type', 'intervention_unit.active_well'],\n });\n\n return response;\n } catch (error) {\n console.error(error);\n return null;\n }\n};\n\nexport const fetchFracFleetWells = async (\n appsFFIds: AppAssetIdPair[],\n apps: ProviderApp[]\n): Promise<Record<string, AppDataCompletionWell[]>> => {\n const appsById = keyResourcesById(apps);\n const requests = appsFFIds.map(async ([appId, fracFleetId]) => {\n const app = appsById[appId];\n const options: Record<string, unknown> = { fields: 'all', frac_fleet_id: fracFleetId };\n\n if (appId === DEV_CENTER_CLI_APP_ID) options.app_key = app?.app?.app_key;\n else options.app_id = app?.app?.id;\n\n try {\n const response = await getFracFleetWells(options);\n if (!response) return [];\n\n const wells: AppDataCompletionWell[] = deserializeCollection(response);\n\n return wells;\n } catch (error) {\n console.error(error);\n return [];\n }\n });\n\n const responses = await Promise.all(requests);\n\n return responses.reduce<Record<string, AppDataCompletionWell[]>>((acc, wells, index) => {\n acc[appsFFIds[index][0]] = wells;\n\n return acc;\n }, {});\n};\n\nexport const fetchPadWells = async (\n appsPadIds: AppAssetIdPair[],\n apps: ProviderApp[]\n): Promise<Record<string, AppDataCompletionWell[]>> => {\n const appsById = keyResourcesById(apps);\n const requests = appsPadIds.map(async ([appId, padId]) => {\n const app = appsById[appId];\n const options: Record<string, unknown> = { fields: 'all' };\n\n if (appId === DEV_CENTER_CLI_APP_ID) options.app_key = app?.app?.app_key;\n else options.app_id = app?.app?.id;\n\n try {\n const response = await getPadWells(padId, options);\n if (!response) return [];\n\n const wells: AppDataCompletionWell[] = deserializeCollection(response);\n\n return wells;\n } catch (error) {\n console.error(error);\n return [];\n }\n });\n\n const responses = await Promise.all(requests);\n\n return responses.reduce<Record<string, AppDataCompletionWell[]>>((acc, wells, index) => {\n acc[appsPadIds[index][0]] = wells;\n\n return acc;\n }, {});\n};\n\nexport const getAppHash = (app: ProviderApp): string =>\n [\n app.id,\n getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.rig.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.frac_fleet.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.pad.id),\n getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id),\n getAppAssetSpecificTypeId(app, 'deprecatedAssetId'),\n getAppSegment(app),\n ].join('-');\n\nexport const isAppWithSettings = (app: ProviderApp): boolean =>\n Boolean(\n getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.rig.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.frac_fleet.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.pad.id) ||\n getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id)\n );\n\nexport const getInitialAppData = (app: ProviderApp): InitializedAppDataEntry => ({\n id: app.id,\n rig: null,\n well: null,\n fracFleet: null,\n interventionUnit: null,\n program: { id: null, name: null },\n completionWellInfo: {\n fracFleet: { id: null, name: null },\n pad: { id: null, name: null },\n },\n wells: null,\n isLoading: true,\n appHash: getAppHash(app),\n});\n\nexport const getInitialAppsDataState = (apps: ProviderApp[]): InitializedAppDataDictionary =>\n apps.reduce<InitializedAppDataDictionary>((acc, app) => {\n acc[app.id] = getInitialAppData(app);\n\n return acc;\n }, {});\n\nexport const isAppNeedingInterventionUnitWellRefresh = (app: ProviderApp): boolean => {\n const interventionUnitId = getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id);\n const wellId = getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id);\n\n return Boolean(interventionUnitId && !wellId);\n};\n\nexport const prepareDataForResolver = (\n apps: PreparedProviderApp[],\n cache: AppsDataCacheRef\n): PreparedResolverData => {\n const appsWellIds: AppAssetIdPair[] = [];\n const appsRigIds: AppAssetIdPair[] = [];\n const appsFracFleetIds: AppAssetIdPair[] = [];\n const appsInterventionUnitIds: AppAssetIdPair[] = [];\n const appsFracFleetToFetchWellsIds: AppAssetIdPair[] = [];\n const appsPadIds: AppAssetIdPair[] = [];\n const appIds: [ProviderApp['id']][] = [];\n\n apps.forEach(app => {\n const appWellId = getAppAssetSpecificTypeId(app, ASSET_TYPES.well.id);\n const appRigId = getAppAssetSpecificTypeId(app, ASSET_TYPES.rig.id);\n const appFracFleetId = getAppAssetSpecificTypeId(app, ASSET_TYPES.frac_fleet.id);\n const appPadId = getAppAssetSpecificTypeId(app, ASSET_TYPES.pad.id);\n const appInterventionUnitId = getAppAssetSpecificTypeId(app, ASSET_TYPES.intervention_unit.id);\n const appId = app.id;\n\n appIds.push([appId]);\n\n if (appInterventionUnitId) {\n appsInterventionUnitIds.push([appId, appInterventionUnitId]);\n // NOTE: we need to fetch well for intervention unit as there is no well in intervention unit\n if (appWellId) appsWellIds.push([appId, appWellId]);\n } else if (appWellId) {\n appsWellIds.push([appId, appWellId]);\n } else if (appRigId) {\n appsRigIds.push([appId, appRigId]);\n } else if (appFracFleetId) {\n appsFracFleetIds.push([appId, appFracFleetId]);\n if (appPadId) appsPadIds.push([appId, appPadId]);\n else appsFracFleetToFetchWellsIds.push([appId, appFracFleetId]);\n }\n });\n\n const { rigsById, wellsById, fracFleetsById, interventionUnitsById } = cache.current;\n\n return {\n appsWellIds,\n appsRigIds,\n appsFracFleetIds,\n appsPadIds,\n appIds,\n appsFracFleetToFetchWellsIds,\n appsInterventionUnitIds,\n uniqueWellIds: getUniqAssetIds(appsWellIds, Object.keys(wellsById)),\n uniqueRigIds: getUniqAssetIds(appsRigIds, Object.keys(rigsById)),\n uniqueFFIds: getUniqAssetIds(appsFracFleetIds, Object.keys(fracFleetsById)),\n uniqueInterventionUnitIds: getUniqAssetIds(\n appsInterventionUnitIds,\n Object.keys(interventionUnitsById)\n ),\n };\n};\n\nexport const buildWellCache = (\n response: JsonApiCollectionResponse<WellResource>\n): Record<string, WellResource> =>\n keyResourcesById(\n response.data.map(well => {\n const rigResource = findIncludedResource(response, 'rig', getRelationshipId(well, 'rig'));\n const program = findIncludedResource(response, 'program', getRelationshipId(well, 'program'));\n const fracFleet = findIncludedResource(\n response,\n 'frac_fleet',\n getRelationshipId(well, 'frac_fleet')\n );\n const pad = findIncludedResource(response, 'pad', getRelationshipId(well, 'pad'));\n const rig = { ...rigResource, program };\n\n return { ...well, rig, fracFleet, pad };\n })\n );\n\nexport const buildRigCache = (\n response: JsonApiCollectionResponse<RigResource>\n): Record<string, RigResource> =>\n keyResourcesById(\n response.data.map(rig => {\n const wellId =\n getRelationshipId(rig, 'active_well') || getRelationshipId(rig, 'last_active_well');\n const wellResource = findIncludedResource(response, 'well', wellId);\n const program = findIncludedResource(response, 'program', getRelationshipId(rig, 'program'));\n const well = isWellResource(wellResource) ? wellResource : undefined;\n\n return { ...rig, well, program };\n })\n );\n\nexport const buildInterventionUnitCache = (\n response: JsonApiCollectionResponse\n): Record<string, InterventionUnitResource> =>\n keyResourcesById(\n response.data.map(interventionUnit => {\n const wellResource = findIncludedResource(\n response,\n 'well',\n getRelationshipId(interventionUnit, 'active_well')\n );\n const well = isWellResource(wellResource) ? wellResource : undefined;\n\n return {\n ...interventionUnit,\n name: interventionUnit.attributes?.name,\n well,\n };\n })\n );\n\nexport const buildFracFleetCache = (\n fracFleets: AppDataFracFleet[]\n): Record<string, AppDataFracFleet> =>\n fracFleets.reduce<Record<string, AppDataFracFleet>>((acc, fracFleet) => {\n if (fracFleet.id !== undefined) acc[fracFleet.id] = fracFleet;\n\n return acc;\n }, {});\n"],"names":["dataFormatter","Jsona","deserializeCollection","response","deserialized","deserialize","Array","isArray","TypeError","getRelationshipId","resource","name","_resource$relationshi","_resource$relationshi2","data","relationships","id","undefined","findIncludedResource","type","included","find","item","isWellResource","keyResourcesById","resources","reduce","acc","getAppAssetSpecificTypeId","app","typeId","_app$settings","Number","settings","getUniqAssetIds","assetIds","cachedAssetIds","_toConsumableArray","Set","map","_ref","_ref2","_slicedToArray","filter","assetId","isFinite","includes","String","fetchWells","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","ids","wrap","_context","prev","next","length","abrupt","getWells","fields","include_arhivation_data","sent","t0","console","error","stop","_callee","_x","apply","this","arguments","fetchRigs","_ref4","_context2","getRigs","_callee2","_x2","fetchAssetEntitiesByAssetIds","_ref5","_context3","getResolvedAssets","assets","_callee3","_x3","getWellObjectFromWellData","well","rig","interventionUnit","_rig$attributes","_rig$attributes2","_rig$program","_rig$program2","_rig$program2$attribu","_well$pad","_well$pad2","_well$pad2$attributes","_well$fracFleet","_well$fracFleet2","_well$fracFleet2$attr","appDataWell","attributes","companyId","appDataInterventionUnit","active_well","_objectSpread","asset_id","program","completionWellInfo","pad","fracFleet","getAppsDataByWells","appsWellIds","wellsById","Object","keys","_ref6","_ref7","appId","wellId","getAppsDataByRigs","appsRigIds","rigsById","_ref8","_ref9","rigId","getAppsDataByFFs","appsFracFleetIds","ffsById","ffWellsData","_ref10","_ref11","ffId","wells","getAppsDataByPads","appsPadIds","padWellsData","_ref12","getAppsDataByInterventionUnits","appsInterventionUnitIds","interventionUnitsById","_ref14","_appsWellIds$find","_ref15","interventionUnitId","appWellId","_ref16","fetchFracFleets","_ref18","fracFleets","_context4","getFracFleets","_callee4","_x4","fetchInterventionUnits","_ref19","_context5","getInterventionUnits","_callee5","_x5","fetchFracFleetWells","_ref20","_callee7","appsFFIds","apps","appsById","requests","responses","_context7","_ref22","_callee6","_ref21","_app$app","_app$app2","_ref23","fracFleetId","options","_context6","frac_fleet_id","DEV_CENTER_CLI_APP_ID","app_key","app_id","getFracFleetWells","_x8","Promise","all","index","_x6","_x7","fetchPadWells","_ref24","_callee9","_context9","_ref26","_callee8","_ref25","_app$app3","_app$app4","_ref27","padId","_context8","getPadWells","_x11","_x9","_x10","getAppHash","ASSET_TYPES","frac_fleet","intervention_unit","getAppSegment","join","isAppWithSettings","Boolean","getInitialAppData","isLoading","appHash","getInitialAppsDataState","isAppNeedingInterventionUnitWellRefresh","prepareDataForResolver","cache","appsFracFleetToFetchWellsIds","appIds","forEach","appRigId","appFracFleetId","appPadId","appInterventionUnitId","push","current","fracFleetsById","uniqueWellIds","uniqueRigIds","uniqueFFIds","uniqueInterventionUnitIds","buildWellCache","rigResource","buildRigCache","wellResource","buildInterventionUnitCache","_interventionUnit$att","buildFracFleetCache"],"mappings":"ovDAqCA,IAAMA,EAAgB,IAAIC,EAUpBC,EAAwB,SAACC,GAC7B,IAAMC,EAAeJ,EAAcK,YAAYF,GAE/C,IAAKG,MAAMC,QAAQH,GACjB,MAAM,IAAII,UAAU,2CAGtB,OAAOJ,CACT,EAEMK,EAAoB,SAACC,EAAuCC,GAAiB,IAAAC,EAAAC,EAC3EC,EAAOJ,iBAAAA,EAAAA,EAAUK,4BAAqB,UAA/BH,EAA0BD,UAAK,IAAAE,OAA/BH,EAAAG,EAAiCC,KAE9C,OAAOA,IAASR,MAAMC,QAAQO,GAAQA,EAAKE,QAAKC,CAClD,EAEMC,EAAuB,SAC3Bf,EACAgB,EACAH,GAAuB,OACpBb,EAASiB,SAASC,MAAK,SAAAC,GAAI,OAAIA,EAAKH,OAASA,GAAQG,EAAKN,KAAOA,IAAG,EAEnEO,EAAiB,SAACb,GAAqC,MACxC,UAAnBA,eAAAA,EAAUS,KAAe,EAErBK,EAAmB,SAAmCC,GAAqB,OAC/EA,EAAUC,QAAiC,SAACC,EAAKjB,GAG/C,OAFAiB,EAAIjB,EAASM,IAAMN,EAEZiB,CACR,GAAE,CAAE,EAAC,EAEKC,EAA4B,SAACC,EAAkBC,GAAc,IAAAC,EAAA,OACxEC,O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AAuJ,EAC9BF,EAAe5N,EACnBf,EACA,OACAM,EAAkBgF,EAAkB,gBAEhCF,EAAOhE,EAAeuN,GAAgBA,OAAe7N,EAE3D,OAAAyF,EAAAA,EAAA,CAAA,EACKjB,GAAgB,CAAA,EAAA,CACnB9E,KAAiC,UAA3B8E,EAAiBa,kBAAU,IAAA0I,OAAA,EAA3BA,EAA6BrO,KACnC4E,KAAAA,GAEH,IACF,EAEU0J,EAAsB,SACjC3F,GAA8B,OAE9BA,EAAW5H,QAAyC,SAACC,EAAKoF,GAGxD,YAFqB9F,IAAjB8F,EAAU/F,KAAkBW,EAAIoF,EAAU/F,IAAM+F,GAE7CpF,CACR,GAAE,CAAE,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevCenterIsolatedApp.d.ts","sourceRoot":"","sources":["../../../../src/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js"],"names":[],"mappings":"AA+SA,eAAO,MAAM,oBAAoB,KAA4C,CAAC"}
1
+ {"version":3,"file":"DevCenterIsolatedApp.d.ts","sourceRoot":"","sources":["../../../../src/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js"],"names":[],"mappings":"AAkTA,eAAO,MAAM,oBAAoB,KAA4C,CAAC"}
@@ -1,2 +1,2 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{useMemo as o,useRef as r,useState as i,useEffect as a,useContext as p,useCallback as s}from"react";import{flushSync as l}from"react-dom";import c from"classnames";import{withRouter as d}from"react-router-dom";import{noop as u}from"lodash";import m from"query-string";import v from"prop-types";import{APP_IFRAME_ATTRIBUTE as f,IsolatedPage as C}from"./IsolatedPage.js";import{ISOLATED_PAGE_APP_CONTAINER_ID as b}from"./constants.js";import{useFullscreenModes as g}from"./useFullscreenModes.js";import h from"./DevCenterIsolatedApp.module.scss.js";import A from"../AppContext.js";import j from"../../../permissions/PermissionsContext.js";import"../../../permissions/constants/index.js";import"../../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../../clients/jsonApi/index.js";import"../../../utils/shareRecentRequest.js";import"../../../permissions/ProvidePermissions.js";import{getUserUnits as y,subscribeForUserUnitsUpdates as w}from"../../../utils/index.js";import"../AppHeader/AppHeader.js";import"../AppSideBar/AppSideBar.js";import"../AppsDataProvider/effects/utils.js";import"@babel/runtime/helpers/toConsumableArray";import{createDevCenterRouter as x,isCorvaApp as M,isIsolationEnabledInPackageManifest as S,isAppMaximized as I}from"../../../utils/devcenter.js";import{jsx as L}from"react/jsx-runtime";import R from"../DevCenterAppContainer/DevCenterAppContainer.js";import"../NavigationBar/NavigationBar.js";import"../SideBar/SideBar.js";import"../AppSettingsPopover/AppSettingsPopover.js";import"../AppFilterPanelLayout/AppFilterPanelLayout.js";import"../DevCenterRouterContext/DevCenterRouterContext.js";import"../DevCenterRouterContext/UniversalLink/UniversalLink.js";import"./DevCenterIsolatedAppPage.js";import{getAppVersion as P}from"../DevCenterAppContainer/utils.js";import{isInsideNewMobileApp as D}from"../../../utils/mobileDetect.js";var F=["isIsolationFeatureEnabled","onAppFullscreenTransparentMode","onIsMaximizedChange","onInnerContainerMouseEnter","onInnerContainerMouseLeave","onAppContainerClick","setInnerContainerRefFn","onAppRemove","onSettingChange","onSettingsChange","updateCurrentDashboardAppLastAnnotation","apiRateLimiterConfig","trackApiRateLimiterException"];function O(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function E(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?O(Object(o),!0).forEach((function(t){e(n,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):O(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}))}return n}var T={};function B(e){var d,v,O,B,k,W,z,_=e.isIsolationFeatureEnabled,N=void 0!==_&&_,q=e.onAppFullscreenTransparentMode,U=void 0===q?u:q,H=e.onIsMaximizedChange,V=void 0===H?u:H,G=e.onInnerContainerMouseEnter,J=void 0===G?u:G,K=e.onInnerContainerMouseLeave,Q=void 0===K?u:K,X=e.onAppContainerClick,Y=void 0===X?u:X,Z=e.setInnerContainerRefFn,$=void 0===Z?u:Z,ee=e.onAppRemove,ne=void 0===ee?void 0:ee,te=e.onSettingChange,oe=void 0===te?u:te,re=e.onSettingsChange,ie=void 0===re?u:re,ae=e.updateCurrentDashboardAppLastAnnotation,pe=void 0===ae?u:ae,se=e.apiRateLimiterConfig,le=void 0===se?T:se,ce=e.trackApiRateLimiterException,de=t(e,F),ue=o((function(){return x(de.history)}),[null===(d=de.history)||void 0===d?void 0:d.location]),me=M(null==de||null===(v=de.app)||void 0===v?void 0:v.app)&&!S(null==de||null===(O=de.app)||void 0===O?void 0:O.package)||!N,ve=me?R:C,fe=null===(B=de.app)||void 0===B||null===(k=B.app)||void 0===k?void 0:k.app_key,Ce=P(de.app),be="".concat(fe,"-").concat(Ce),ge=r(),he=r(),Ae=r(),je=r(!1),ye=r(!1),we=I(m.parse(null===(W=de.history)||void 0===W||null===(z=W.location)||void 0===z?void 0:z.search),de.app.id),xe=r(we);xe.current=we;var Me=i(y()),Se=n(Me,2),Ie=Se[0],Le=Se[1];a((function(){var e=w((function(e){return Le(e)}));return function(){return e()}}),[]);var Re=p(A),Pe=j();function De(){U({appId:de.app.id,isModeEnabled:!1}),document.body.classList.remove("dc-isolated-app__body-overflow",h.compensateScroll)}var Fe=s((function(e){var n,t,o,r,i,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!N||me||xe.current&&!je.current||je.current===e){var p;a&&ye.current!==a&&(ye.current=a,null===(p=he.current)||void 0===p||p.classList.add(h.containerMaximizedTransparentModal))}else{var s,c=e?"add":"remove";if(null===(n=he.current)||void 0===n||n.classList[c](h.containerMaximizedTransparent),a||"remove"===c)null===(s=he.current)||void 0===s||s.classList[c](h.containerMaximizedTransparentModal);ge.current=null===(t=he.current)||void 0===t||null===(o=t.querySelector("[".concat(f,"]")))||void 0===o||null===(r=o.contentWindow)||void 0===r?void 0:r.document;var d=null===(i=ge.current)||void 0===i?void 0:i.getElementById(b);if(d){if(e){var u=Ae.current.getBoundingClientRect(),m=u.top,v=u.left,C=u.width,g=u.height,A=window.innerWidth!==document.body.clientWidth;l((function(){U({appId:de.app.id,isModeEnabled:!0})})),d.setAttribute("style","\n top: ".concat(m,"px;\n left: ").concat(v,"px;\n width: ").concat(C,"px;\n height: ").concat(g,"px;\n position: absolute;\n ")),document.body.classList.add("dc-isolated-app__body-overflow",A&&h.compensateScroll)}else l((function(){U({appId:de.app.id,isModeEnabled:!1})})),d.setAttribute("style",""),document.body.classList.remove("dc-isolated-app__body-overflow",h.compensateScroll);je.current=e,ye.current=a}}}),[N,me,xe]);a((function(){return De}),[]),a((function(){we&&je.current&&Fe(!1)}),[we]);var Oe=g({containerRef:Ae,appInstanceId:de.app.id,isMaximized:we}),Ee=Oe.isBrowserFullscreen,Te=Oe.enterBrowserFullscreen,Be=Oe.exitBrowserFullscreen,ke=Oe.isSeparateWindow,We=Oe.openSeparateWindow,ze=Oe.closeSeparateWindow,_e=Oe.setSeparateWindowTitle,Ne=s((function(e){he.current=e,$(e)}),[]);return L("div",{className:c("dc-isolated-app",h.fixedSizeContainer),ref:Ae,children:L("div",{ref:Ne,onMouseEnter:J,onMouseLeave:Q,"data-testid":"".concat("DevCenter_AppContainer","_").concat(de.app.app.name),className:c(h.container,D&&h.newMobileAppContainer,we&&h.containerMaximized),children:L(ve,E(E({},de),{},{isBrowserFullscreen:Ee,enterBrowserFullscreen:Te,exitBrowserFullscreen:Be,isSeparateWindow:ke,openSeparateWindow:We,closeSeparateWindow:ze,setSeparateWindowTitle:_e,isNonIsolatedApp:me,appContextValue:Re,devCenterRouter:ue,globalNotificationToastsAPI:window[Symbol.for("notificationToasts")],globalMixpanelEventTracker:window[Symbol.for("logToMixpanel")],onAppContainerClick:Y,onAppRemove:ne,onIsMaximizedChange:V,onSettingChange:oe,onSettingsChange:ie,permissionsContextValue:Pe,setIsFullscreenModalMode:Fe,userUnits:Ie,trackApiRateLimiterException:ce,updateCurrentDashboardAppLastAnnotation:pe,apiRateLimiterConfig:le}),be)})})}B.propTypes={app:v.shape({id:v.number,app:v.shape({name:v.string})}).isRequired,currentUser:v.shape({}).isRequired,isIsolationFeatureEnabled:v.bool,onAppContainerClick:v.func,onAppFullscreenTransparentMode:v.func,onAppRemove:v.func,onInnerContainerMouseEnter:v.func,onInnerContainerMouseLeave:v.func,onIsMaximizedChange:v.func,onSettingChange:v.func,onSettingsChange:v.func,setInnerContainerRefFn:v.func,updateCurrentDashboardAppLastAnnotation:v.func,apiRateLimiterConfig:v.object};var k=d(B);export{k as DevCenterIsolatedApp};
1
+ import e from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{useMemo as o,useRef as r,useState as i,useEffect as a,useContext as p,useCallback as s}from"react";import{flushSync as l}from"react-dom";import c from"classnames";import{withRouter as d}from"react-router-dom";import{noop as u}from"lodash";import m from"query-string";import v from"prop-types";import{APP_IFRAME_ATTRIBUTE as f,IsolatedPage as C}from"./IsolatedPage.js";import{ISOLATED_PAGE_APP_CONTAINER_ID as b}from"./constants.js";import{useFullscreenModes as g}from"./useFullscreenModes.js";import h from"./DevCenterIsolatedApp.module.scss.js";import A from"../AppContext.js";import j from"../../../permissions/PermissionsContext.js";import"../../../permissions/constants/index.js";import"../../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../../clients/jsonApi/index.js";import"../../../utils/shareRecentRequest.js";import"../../../permissions/ProvidePermissions.js";import{getUserUnits as y,subscribeForUserUnitsUpdates as w}from"../../../utils/index.js";import"../AppHeader/AppHeader.js";import"../AppSideBar/AppSideBar.js";import"../AppsDataProvider/effects/utils.js";import"@babel/runtime/helpers/toConsumableArray";import{createDevCenterRouter as x,isCorvaApp as M,isIsolationEnabledInPackageManifest as S,isAppMaximized as I}from"../../../utils/devcenter.js";import{jsx as L}from"react/jsx-runtime";import R from"../DevCenterAppContainer/DevCenterAppContainer.js";import"../NavigationBar/NavigationBar.js";import"../SideBar/SideBar.js";import"../AppSettingsPopover/AppSettingsPopover.js";import"../AppFilterPanelLayout/AppFilterPanelLayout.js";import"../DevCenterRouterContext/DevCenterRouterContext.js";import"../DevCenterRouterContext/UniversalLink/UniversalLink.js";import"./DevCenterIsolatedAppPage.js";import{getAppVersion as P}from"../DevCenterAppContainer/utils.js";import{isInsideNewMobileApp as D}from"../../../utils/mobileDetect.js";var F=["isIsolationFeatureEnabled","onAppFullscreenTransparentMode","onIsMaximizedChange","onInnerContainerMouseEnter","onInnerContainerMouseLeave","onAppContainerClick","setInnerContainerRefFn","onAppRemove","onSettingChange","onSettingsChange","updateCurrentDashboardAppLastAnnotation","apiRateLimiterConfig","trackApiRateLimiterException"];function O(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function E(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?O(Object(o),!0).forEach((function(t){e(n,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):O(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}))}return n}var T={};function B(e){var d,v,O,B,k,W,z,_=e.isIsolationFeatureEnabled,N=void 0!==_&&_,q=e.onAppFullscreenTransparentMode,U=void 0===q?u:q,H=e.onIsMaximizedChange,V=void 0===H?u:H,G=e.onInnerContainerMouseEnter,J=void 0===G?u:G,K=e.onInnerContainerMouseLeave,Q=void 0===K?u:K,X=e.onAppContainerClick,Y=void 0===X?u:X,Z=e.setInnerContainerRefFn,$=void 0===Z?u:Z,ee=e.onAppRemove,ne=void 0===ee?void 0:ee,te=e.onSettingChange,oe=void 0===te?u:te,re=e.onSettingsChange,ie=void 0===re?u:re,ae=e.updateCurrentDashboardAppLastAnnotation,pe=void 0===ae?u:ae,se=e.apiRateLimiterConfig,le=void 0===se?T:se,ce=e.trackApiRateLimiterException,de=t(e,F),ue=o((function(){return x(de.history)}),[null===(d=de.history)||void 0===d?void 0:d.location]),me=M(null==de||null===(v=de.app)||void 0===v?void 0:v.app)&&!S(null==de||null===(O=de.app)||void 0===O?void 0:O.package)||!N,ve=me?R:C,fe=null===(B=de.app)||void 0===B||null===(k=B.app)||void 0===k?void 0:k.app_key,Ce=P(de.app),be="".concat(fe,"-").concat(Ce),ge=r(),he=r(),Ae=r(),je=r(!1),ye=r(!1),we=I(m.parse(null===(W=de.history)||void 0===W||null===(z=W.location)||void 0===z?void 0:z.search),de.app.id),xe=r(we);xe.current=we;var Me=i(y()),Se=n(Me,2),Ie=Se[0],Le=Se[1];a((function(){var e=w((function(e){return Le(e)}));return function(){return e()}}),[]);var Re=p(A),Pe=j();function De(){U({appId:de.app.id,isModeEnabled:!1}),document.body.classList.remove("dc-isolated-app__body-overflow",h.compensateScroll)}var Fe=s((function(e){var n,t,o,r,i,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!N||me||xe.current&&!je.current||je.current===e){var p;a&&ye.current!==a&&(ye.current=a,null===(p=he.current)||void 0===p||p.classList.add(h.containerMaximizedTransparentModal))}else{var s,c=e?"add":"remove";if(null===(n=he.current)||void 0===n||n.classList[c](h.containerMaximizedTransparent),a||"remove"===c)null===(s=he.current)||void 0===s||s.classList[c](h.containerMaximizedTransparentModal);ge.current=null===(t=he.current)||void 0===t||null===(o=t.querySelector("[".concat(f,"]")))||void 0===o||null===(r=o.contentWindow)||void 0===r?void 0:r.document;var d=null===(i=ge.current)||void 0===i?void 0:i.getElementById(b);if(d){if(e){var u=Ae.current.getBoundingClientRect(),m=u.top,v=u.left,C=u.width,g=u.height,A=window.innerWidth!==document.body.clientWidth;l((function(){U({appId:de.app.id,isModeEnabled:!0})})),d.setAttribute("style","\n top: ".concat(m,"px;\n left: ").concat(v,"px;\n width: ").concat(C,"px;\n height: ").concat(g,"px;\n position: absolute;\n ")),document.body.classList.add("dc-isolated-app__body-overflow",A&&h.compensateScroll)}else l((function(){U({appId:de.app.id,isModeEnabled:!1})})),d.setAttribute("style",""),document.body.classList.remove("dc-isolated-app__body-overflow",h.compensateScroll);je.current=e,ye.current=a}}}),[N,me,xe]);a((function(){return De}),[]),a((function(){we&&je.current&&Fe(!1)}),[we]);var Oe=g({containerRef:Ae,appInstanceId:de.app.id,isMaximized:we}),Ee=Oe.isBrowserFullscreen,Te=Oe.enterBrowserFullscreen,Be=Oe.exitBrowserFullscreen,ke=Oe.isSeparateWindow,We=Oe.openSeparateWindow,ze=Oe.closeSeparateWindow,_e=Oe.setSeparateWindowTitle,Ne=s((function(e){he.current=e,$(e)}),[]);return L("div",{className:c("dc-isolated-app",h.fixedSizeContainer,we&&h.containerMaximized),ref:Ae,children:L("div",{ref:Ne,onMouseEnter:J,onMouseLeave:Q,"data-testid":"".concat("DevCenter_AppContainer","_").concat(de.app.app.name),className:c(h.container,D&&h.newMobileAppContainer),children:L(ve,E(E({},de),{},{isBrowserFullscreen:Ee,enterBrowserFullscreen:Te,exitBrowserFullscreen:Be,isSeparateWindow:ke,openSeparateWindow:We,closeSeparateWindow:ze,setSeparateWindowTitle:_e,isNonIsolatedApp:me,appContextValue:Re,devCenterRouter:ue,globalNotificationToastsAPI:window[Symbol.for("notificationToasts")],globalMixpanelEventTracker:window[Symbol.for("logToMixpanel")],onAppContainerClick:Y,onAppRemove:ne,onIsMaximizedChange:V,onSettingChange:oe,onSettingsChange:ie,permissionsContextValue:Pe,setIsFullscreenModalMode:Fe,userUnits:Ie,trackApiRateLimiterException:ce,updateCurrentDashboardAppLastAnnotation:pe,apiRateLimiterConfig:le}),be)})})}B.propTypes={app:v.shape({id:v.number,app:v.shape({name:v.string})}).isRequired,currentUser:v.shape({}).isRequired,isIsolationFeatureEnabled:v.bool,onAppContainerClick:v.func,onAppFullscreenTransparentMode:v.func,onAppRemove:v.func,onInnerContainerMouseEnter:v.func,onInnerContainerMouseLeave:v.func,onIsMaximizedChange:v.func,onSettingChange:v.func,onSettingsChange:v.func,setInnerContainerRefFn:v.func,updateCurrentDashboardAppLastAnnotation:v.func,apiRateLimiterConfig:v.object};var k=d(B);export{k as DevCenterIsolatedApp};
2
2
  //# sourceMappingURL=DevCenterIsolatedApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DevCenterIsolatedApp.js","sources":["../../../../src/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js"],"sourcesContent":["import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { flushSync } from 'react-dom';\nimport classNames from 'classnames';\nimport { withRouter } from 'react-router-dom';\nimport { noop } from 'lodash';\nimport queryString from 'query-string';\nimport PropTypes from 'prop-types';\n\nimport { APP_IFRAME_ATTRIBUTE, IsolatedPage } from './IsolatedPage';\nimport { ISOLATED_PAGE_APP_CONTAINER_ID } from './constants';\nimport { useFullscreenModes } from './useFullscreenModes';\n\nimport styles from './DevCenterIsolatedApp.module.scss';\n\nimport AppContext from '~/components/DevCenter/AppContext';\nimport { usePermissionsContext } from '~/permissions';\nimport { devcenter as devCenterUtils, getUserUnits, subscribeForUserUnitsUpdates } from '~/utils';\nimport { DevCenterAppContainer } from '~/components/DevCenter';\nimport { getAppVersion } from '~/components/DevCenter/DevCenterAppContainer/utils';\nimport { isInsideNewMobileApp } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'DevCenter_AppContainer';\nconst DEFAULT_API_RATE_LIMITER_CONFIG = {};\n\nfunction DevCenterIsolatedAppComponent({\n isIsolationFeatureEnabled = false,\n onAppFullscreenTransparentMode = noop,\n onIsMaximizedChange = noop,\n onInnerContainerMouseEnter = noop,\n onInnerContainerMouseLeave = noop,\n onAppContainerClick = noop,\n setInnerContainerRefFn = noop,\n onAppRemove = undefined,\n onSettingChange = noop,\n onSettingsChange = noop,\n updateCurrentDashboardAppLastAnnotation = noop,\n apiRateLimiterConfig = DEFAULT_API_RATE_LIMITER_CONFIG,\n trackApiRateLimiterException,\n ...props\n}) {\n const devCenterRouter = useMemo(\n () => devCenterUtils.createDevCenterRouter(props.history),\n [props.history?.location]\n );\n\n const isNonIsolatedApp =\n (devCenterUtils.isCorvaApp(props?.app?.app) &&\n !devCenterUtils.isIsolationEnabledInPackageManifest(props?.app?.package)) ||\n !isIsolationFeatureEnabled;\n\n const DCAppComponent = isNonIsolatedApp ? DevCenterAppContainer : IsolatedPage;\n\n // Key to force iframe recreation when app version changes.\n // This ensures global dependencies are re-initialized for the new version.\n const appKey = props.app?.app?.app_key;\n const appVersion = getAppVersion(props.app);\n const iframeKey = `${appKey}-${appVersion}`;\n\n const appIframeDocument = useRef();\n const containerRef = useRef();\n const fixedSizeContainerRef = useRef();\n const fullscreenModeRef = useRef(false);\n const fullscreenModalModeRef = useRef(false);\n\n const isAppMaximized = devCenterUtils.isAppMaximized(\n queryString.parse(props.history?.location?.search),\n props.app.id\n );\n\n // save to ref to not re-create setIsFullscreenModalMode callback on change and reduce the amoount of DC apps re-renders\n const isAppMaximizedRef = useRef(isAppMaximized);\n isAppMaximizedRef.current = isAppMaximized;\n\n const [userUnits, setUserUnits] = useState(getUserUnits());\n\n useEffect(() => {\n const unsubscribeFn = subscribeForUserUnitsUpdates(newUserUnits => setUserUnits(newUserUnits));\n\n return () => unsubscribeFn();\n }, []);\n\n const appContextValue = useContext(AppContext);\n const permissionsContextValue = usePermissionsContext();\n\n /*\n What is fullscreen modal mode?\n\n Our apps, are shown in isolated iFrames. Because of it, when an app has some modal\n and opens it - it's opened inside of its iframe, instead of opening at the center of the screen.\n\n To make app modals & other elements be opened at the center of the screen, as if they are not inside of an iframe,\n we use some hacks.\n\n When the app wants to open a fullscreen element, we make its iframe fullscreen, but with transparent background,\n and we set width/height & position of that app iframe to inner app container that is located inside of the iframe.\n So when iframe's fullscreen element is opened, it looks like it's a part of the platform, and the app which shows the element, looks like\n usual, not in fullscreen\n\n So the platform provides this setIsFullscreenModalMode function to DC apps.\n When DC app wants to open a modal that should be opened at the center of the screen - it needs to\n call setIsFullscreenModalMode(true) first. And when it closes the modal - setIsFullscreenModalMode(false)\n\n Two things are important about this\n - all these styles that make this invisible background work should be applied at once\n - enter and exit from the mode, shouldn't trigger even a single re-render, as it may impact\n some elements inside the DC app\n\n There's a second parameter to `setIsFullscreenModalMode`: `isModal`. It should be used when a fullscreen overlay is displayed\n (Modal, for instance) that should cover everything on screen.\n\n What it does - it basically sets the stretched element's z-index to a very high value, so it covers every other UI element in CWF\n */\n\n function handleAppFullscreenTransparentModeExit() {\n onAppFullscreenTransparentMode({ appId: props.app.id, isModeEnabled: false });\n document.body.classList.remove('dc-isolated-app__body-overflow', styles.compensateScroll);\n }\n\n const setIsFullscreenModalMode = useCallback(\n function setIsFullscreenModalMode(nextIsFullscreenModalModeValue, isModal = false) {\n // When an app is already in fullscreen mode, no need to use this\n // invisible fullscreen mode to make elements take the whole screen\n if (\n !isIsolationFeatureEnabled ||\n isNonIsolatedApp ||\n (isAppMaximizedRef.current && !fullscreenModeRef.current) ||\n fullscreenModeRef.current === nextIsFullscreenModalModeValue\n ) {\n // Adding modal class if modal is opened when non-modal is already open\n if (isModal && fullscreenModalModeRef.current !== isModal) {\n fullscreenModalModeRef.current = isModal;\n containerRef.current?.classList.add(styles.containerMaximizedTransparentModal);\n }\n\n return;\n }\n\n const classesEditMethod = nextIsFullscreenModalModeValue ? 'add' : 'remove';\n\n containerRef.current?.classList[classesEditMethod](styles.containerMaximizedTransparent);\n\n if (isModal || classesEditMethod === 'remove') {\n containerRef.current?.classList[classesEditMethod](\n styles.containerMaximizedTransparentModal\n );\n }\n\n appIframeDocument.current = containerRef.current?.querySelector(\n `[${APP_IFRAME_ATTRIBUTE}]`\n )?.contentWindow?.document;\n\n const isolatedPageAppContainer = appIframeDocument.current?.getElementById(\n ISOLATED_PAGE_APP_CONTAINER_ID\n );\n\n if (!isolatedPageAppContainer) {\n return;\n }\n\n if (nextIsFullscreenModalModeValue) {\n // 1. BATCH ALL READS FIRST - prevents layout thrashing\n const { top, left, width, height } = fixedSizeContainerRef.current.getBoundingClientRect();\n const isBodyScrollVisible = window.innerWidth !== document.body.clientWidth;\n\n // 2. Flush React state updates synchronously to prevent deferred renders\n flushSync(() => {\n onAppFullscreenTransparentMode({ appId: props.app.id, isModeEnabled: true });\n });\n\n // 3. BATCH ALL DOM WRITES - after reads and React flush\n isolatedPageAppContainer.setAttribute(\n 'style',\n `\n top: ${top}px;\n left: ${left}px;\n width: ${width}px;\n height: ${height}px;\n position: absolute;\n `\n );\n document.body.classList.add(\n 'dc-isolated-app__body-overflow',\n isBodyScrollVisible && styles.compensateScroll\n );\n } else {\n // Flush React state updates synchronously before DOM writes\n flushSync(() => {\n onAppFullscreenTransparentMode({ appId: props.app.id, isModeEnabled: false });\n });\n\n // DOM writes after React flush\n isolatedPageAppContainer.setAttribute('style', '');\n document.body.classList.remove('dc-isolated-app__body-overflow', styles.compensateScroll);\n }\n fullscreenModeRef.current = nextIsFullscreenModalModeValue;\n fullscreenModalModeRef.current = isModal;\n },\n [isIsolationFeatureEnabled, isNonIsolatedApp, isAppMaximizedRef]\n );\n\n useEffect(() => {\n return handleAppFullscreenTransparentModeExit;\n }, []);\n\n useEffect(() => {\n if (isAppMaximized && fullscreenModeRef.current) {\n setIsFullscreenModalMode(false);\n }\n }, [isAppMaximized]);\n\n const {\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n setSeparateWindowTitle,\n } = useFullscreenModes({\n containerRef: fixedSizeContainerRef,\n appInstanceId: props.app.id,\n isMaximized: isAppMaximized,\n });\n\n /**\n * This should be the same function as calling react-intersection-observer's ref setter actually triggers re-render.\n * Which in its turn causes infinite re-render loop.\n */\n const setContainerRefs = useCallback(node => {\n containerRef.current = node;\n setInnerContainerRefFn(node);\n }, []);\n\n return (\n <div\n className={classNames('dc-isolated-app', styles.fixedSizeContainer)}\n ref={fixedSizeContainerRef}\n >\n <div\n ref={setContainerRefs}\n onMouseEnter={onInnerContainerMouseEnter}\n onMouseLeave={onInnerContainerMouseLeave}\n data-testid={`${PAGE_NAME}_${props.app.app.name}`}\n className={classNames(\n styles.container,\n isInsideNewMobileApp && styles.newMobileAppContainer,\n isAppMaximized && styles.containerMaximized\n )}\n >\n <DCAppComponent\n key={iframeKey}\n {...props}\n isBrowserFullscreen={isBrowserFullscreen}\n enterBrowserFullscreen={enterBrowserFullscreen}\n exitBrowserFullscreen={exitBrowserFullscreen}\n isSeparateWindow={isSeparateWindow}\n openSeparateWindow={openSeparateWindow}\n closeSeparateWindow={closeSeparateWindow}\n setSeparateWindowTitle={setSeparateWindowTitle}\n isNonIsolatedApp={isNonIsolatedApp}\n appContextValue={appContextValue}\n devCenterRouter={devCenterRouter}\n globalNotificationToastsAPI={window[Symbol.for('notificationToasts')]}\n globalMixpanelEventTracker={window[Symbol.for('logToMixpanel')]}\n onAppContainerClick={onAppContainerClick}\n onAppRemove={onAppRemove}\n onIsMaximizedChange={onIsMaximizedChange}\n onSettingChange={onSettingChange}\n onSettingsChange={onSettingsChange}\n permissionsContextValue={permissionsContextValue}\n setIsFullscreenModalMode={setIsFullscreenModalMode}\n userUnits={userUnits}\n trackApiRateLimiterException={trackApiRateLimiterException}\n updateCurrentDashboardAppLastAnnotation={updateCurrentDashboardAppLastAnnotation}\n apiRateLimiterConfig={apiRateLimiterConfig}\n />\n </div>\n </div>\n );\n}\n\nDevCenterIsolatedAppComponent.propTypes = {\n app: PropTypes.shape({\n id: PropTypes.number,\n app: PropTypes.shape({\n name: PropTypes.string,\n }),\n }).isRequired,\n currentUser: PropTypes.shape({}).isRequired,\n isIsolationFeatureEnabled: PropTypes.bool,\n onAppContainerClick: PropTypes.func,\n onAppFullscreenTransparentMode: PropTypes.func,\n onAppRemove: PropTypes.func,\n onInnerContainerMouseEnter: PropTypes.func,\n onInnerContainerMouseLeave: PropTypes.func,\n onIsMaximizedChange: PropTypes.func,\n onSettingChange: PropTypes.func,\n onSettingsChange: PropTypes.func,\n setInnerContainerRefFn: PropTypes.func,\n updateCurrentDashboardAppLastAnnotation: PropTypes.func,\n apiRateLimiterConfig: PropTypes.object,\n};\n\nexport const DevCenterIsolatedApp = withRouter(DevCenterIsolatedAppComponent);\n"],"names":["DEFAULT_API_RATE_LIMITER_CONFIG","DevCenterIsolatedAppComponent","_ref","_props$history","_props$app","_props$app2","_props$app3","_props$app3$app","_props$history2","_props$history2$locat","_ref$isIsolationFeatu","isIsolationFeatureEnabled","_ref$onAppFullscreenT","onAppFullscreenTransparentMode","noop","_ref$onIsMaximizedCha","onIsMaximizedChange","_ref$onInnerContainer","onInnerContainerMouseEnter","_ref$onInnerContainer2","onInnerContainerMouseLeave","_ref$onAppContainerCl","onAppContainerClick","_ref$setInnerContaine","setInnerContainerRefFn","_ref$onAppRemove","onAppRemove","undefined","_ref$onSettingChange","onSettingChange","_ref$onSettingsChange","onSettingsChange","_ref$updateCurrentDas","updateCurrentDashboardAppLastAnnotation","_ref$apiRateLimiterCo","apiRateLimiterConfig","trackApiRateLimiterException","props","_objectWithoutProperties","_excluded","devCenterRouter","useMemo","devCenterUtils","history","location","isNonIsolatedApp","app","package","DCAppComponent","DevCenterAppContainer","IsolatedPage","appKey","app_key","appVersion","getAppVersion","iframeKey","concat","appIframeDocument","useRef","containerRef","fixedSizeContainerRef","fullscreenModeRef","fullscreenModalModeRef","isAppMaximized","queryString","parse","search","id","isAppMaximizedRef","current","_useState","useState","getUserUnits","_useState2","_slicedToArray","userUnits","setUserUnits","useEffect","unsubscribeFn","subscribeForUserUnitsUpdates","newUserUnits","appContextValue","useContext","AppContext","permissionsContextValue","usePermissionsContext","handleAppFullscreenTransparentModeExit","appId","isModeEnabled","document","body","classList","remove","styles","compensateScroll","setIsFullscreenModalMode","useCallback","nextIsFullscreenModalModeValue","_containerRef$current2","_containerRef$current4","_containerRef$current5","_containerRef$current6","_appIframeDocument$cu","isModal","_containerRef$current","add","containerMaximizedTransparentModal","_containerRef$current3","classesEditMethod","containerMaximizedTransparent","querySelector","APP_IFRAME_ATTRIBUTE","contentWindow","isolatedPageAppContainer","getElementById","ISOLATED_PAGE_APP_CONTAINER_ID","_fixedSizeContainerRe","getBoundingClientRect","top","left","width","height","isBodyScrollVisible","window","innerWidth","clientWidth","flushSync","setAttribute","_useFullscreenModes","useFullscreenModes","appInstanceId","isMaximized","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","setSeparateWindowTitle","setContainerRefs","node","_jsx","className","classNames","fixedSizeContainer","ref","children","onMouseEnter","onMouseLeave","PAGE_NAME","name","container","isInsideNewMobileApp","newMobileAppContainer","containerMaximized","_objectSpread","globalNotificationToastsAPI","Symbol","for","globalMixpanelEventTracker","propTypes","PropTypes","shape","number","string","isRequired","currentUser","bool","func","object","DevCenterIsolatedApp","withRouter"],"mappings":"s9FAqBA,IACMA,EAAkC,CAAA,EAExC,SAASC,EAeNC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAR,EAdDS,0BAAAA,cAAiCD,EAAAE,EAAAV,EACjCW,+BAAAA,aAAiCC,EAAIF,EAAAG,EAAAb,EACrCc,oBAAAA,aAAsBF,EAAIC,EAAAE,EAAAf,EAC1BgB,2BAAAA,aAA6BJ,EAAIG,EAAAE,EAAAjB,EACjCkB,2BAAAA,aAA6BN,EAAIK,EAAAE,EAAAnB,EACjCoB,oBAAAA,aAAsBR,EAAIO,EAAAE,EAAArB,EAC1BsB,uBAAAA,aAAyBV,EAA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AO6D,oBACzBR,SAEFL,EAAC7F,GAAc2G,EAAAA,EAAA,GAETtH,IAAK,GAAA,CACT+F,oBAAqBA,GACrBC,uBAAwBA,GACxBC,sBAAuBA,GACvBC,iBAAkBA,GAClBC,mBAAoBA,GACpBC,oBAAqBA,GACrBC,uBAAwBA,GACxB7F,iBAAkBA,GAClBoC,gBAAiBA,GACjBzC,gBAAiBA,GACjBoH,4BAA6BjC,OAAOkC,OAAOC,IAAI,uBAC/CC,2BAA4BpC,OAAOkC,OAAOC,IAAI,kBAC9CxI,oBAAqBA,EACrBI,YAAaA,GACbV,oBAAqBA,EACrBa,gBAAiBA,GACjBE,iBAAkBA,GAClBqD,wBAAyBA,GACzBW,yBAA0BA,GAC1BpB,UAAWA,GACXvC,6BAA8BA,GAC9BH,wCAAyCA,GACzCE,qBAAsBA,KAxBjBoB,OA6Bf,CAEAtD,EAA8B+J,UAAY,CACxClH,IAAKmH,EAAUC,MAAM,CACnB/F,GAAI8F,EAAUE,OACdrH,IAAKmH,EAAUC,MAAM,CACnBZ,KAAMW,EAAUG,WAEjBC,WACHC,YAAaL,EAAUC,MAAM,CAAA,GAAIG,WACjC1J,0BAA2BsJ,EAAUM,KACrCjJ,oBAAqB2I,EAAUO,KAC/B3J,+BAAgCoJ,EAAUO,KAC1C9I,YAAauI,EAAUO,KACvBtJ,2BAA4B+I,EAAUO,KACtCpJ,2BAA4B6I,EAAUO,KACtCxJ,oBAAqBiJ,EAAUO,KAC/B3I,gBAAiBoI,EAAUO,KAC3BzI,iBAAkBkI,EAAUO,KAC5BhJ,uBAAwByI,EAAUO,KAClCvI,wCAAyCgI,EAAUO,KACnDrI,qBAAsB8H,EAAUQ,YAGrBC,EAAuBC,EAAW1K"}
1
+ {"version":3,"file":"DevCenterIsolatedApp.js","sources":["../../../../src/components/DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js"],"sourcesContent":["import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { flushSync } from 'react-dom';\nimport classNames from 'classnames';\nimport { withRouter } from 'react-router-dom';\nimport { noop } from 'lodash';\nimport queryString from 'query-string';\nimport PropTypes from 'prop-types';\n\nimport { APP_IFRAME_ATTRIBUTE, IsolatedPage } from './IsolatedPage';\nimport { ISOLATED_PAGE_APP_CONTAINER_ID } from './constants';\nimport { useFullscreenModes } from './useFullscreenModes';\n\nimport styles from './DevCenterIsolatedApp.module.scss';\n\nimport AppContext from '~/components/DevCenter/AppContext';\nimport { usePermissionsContext } from '~/permissions';\nimport { devcenter as devCenterUtils, getUserUnits, subscribeForUserUnitsUpdates } from '~/utils';\nimport { DevCenterAppContainer } from '~/components/DevCenter';\nimport { getAppVersion } from '~/components/DevCenter/DevCenterAppContainer/utils';\nimport { isInsideNewMobileApp } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'DevCenter_AppContainer';\nconst DEFAULT_API_RATE_LIMITER_CONFIG = {};\n\nfunction DevCenterIsolatedAppComponent({\n isIsolationFeatureEnabled = false,\n onAppFullscreenTransparentMode = noop,\n onIsMaximizedChange = noop,\n onInnerContainerMouseEnter = noop,\n onInnerContainerMouseLeave = noop,\n onAppContainerClick = noop,\n setInnerContainerRefFn = noop,\n onAppRemove = undefined,\n onSettingChange = noop,\n onSettingsChange = noop,\n updateCurrentDashboardAppLastAnnotation = noop,\n apiRateLimiterConfig = DEFAULT_API_RATE_LIMITER_CONFIG,\n trackApiRateLimiterException,\n ...props\n}) {\n const devCenterRouter = useMemo(\n () => devCenterUtils.createDevCenterRouter(props.history),\n [props.history?.location]\n );\n\n const isNonIsolatedApp =\n (devCenterUtils.isCorvaApp(props?.app?.app) &&\n !devCenterUtils.isIsolationEnabledInPackageManifest(props?.app?.package)) ||\n !isIsolationFeatureEnabled;\n\n const DCAppComponent = isNonIsolatedApp ? DevCenterAppContainer : IsolatedPage;\n\n // Key to force iframe recreation when app version changes.\n // This ensures global dependencies are re-initialized for the new version.\n const appKey = props.app?.app?.app_key;\n const appVersion = getAppVersion(props.app);\n const iframeKey = `${appKey}-${appVersion}`;\n\n const appIframeDocument = useRef();\n const containerRef = useRef();\n const fixedSizeContainerRef = useRef();\n const fullscreenModeRef = useRef(false);\n const fullscreenModalModeRef = useRef(false);\n\n const isAppMaximized = devCenterUtils.isAppMaximized(\n queryString.parse(props.history?.location?.search),\n props.app.id\n );\n\n // save to ref to not re-create setIsFullscreenModalMode callback on change and reduce the amoount of DC apps re-renders\n const isAppMaximizedRef = useRef(isAppMaximized);\n isAppMaximizedRef.current = isAppMaximized;\n\n const [userUnits, setUserUnits] = useState(getUserUnits());\n\n useEffect(() => {\n const unsubscribeFn = subscribeForUserUnitsUpdates(newUserUnits => setUserUnits(newUserUnits));\n\n return () => unsubscribeFn();\n }, []);\n\n const appContextValue = useContext(AppContext);\n const permissionsContextValue = usePermissionsContext();\n\n /*\n What is fullscreen modal mode?\n\n Our apps, are shown in isolated iFrames. Because of it, when an app has some modal\n and opens it - it's opened inside of its iframe, instead of opening at the center of the screen.\n\n To make app modals & other elements be opened at the center of the screen, as if they are not inside of an iframe,\n we use some hacks.\n\n When the app wants to open a fullscreen element, we make its iframe fullscreen, but with transparent background,\n and we set width/height & position of that app iframe to inner app container that is located inside of the iframe.\n So when iframe's fullscreen element is opened, it looks like it's a part of the platform, and the app which shows the element, looks like\n usual, not in fullscreen\n\n So the platform provides this setIsFullscreenModalMode function to DC apps.\n When DC app wants to open a modal that should be opened at the center of the screen - it needs to\n call setIsFullscreenModalMode(true) first. And when it closes the modal - setIsFullscreenModalMode(false)\n\n Two things are important about this\n - all these styles that make this invisible background work should be applied at once\n - enter and exit from the mode, shouldn't trigger even a single re-render, as it may impact\n some elements inside the DC app\n\n There's a second parameter to `setIsFullscreenModalMode`: `isModal`. It should be used when a fullscreen overlay is displayed\n (Modal, for instance) that should cover everything on screen.\n\n What it does - it basically sets the stretched element's z-index to a very high value, so it covers every other UI element in CWF\n */\n\n function handleAppFullscreenTransparentModeExit() {\n onAppFullscreenTransparentMode({ appId: props.app.id, isModeEnabled: false });\n document.body.classList.remove('dc-isolated-app__body-overflow', styles.compensateScroll);\n }\n\n const setIsFullscreenModalMode = useCallback(\n function setIsFullscreenModalMode(nextIsFullscreenModalModeValue, isModal = false) {\n // When an app is already in fullscreen mode, no need to use this\n // invisible fullscreen mode to make elements take the whole screen\n if (\n !isIsolationFeatureEnabled ||\n isNonIsolatedApp ||\n (isAppMaximizedRef.current && !fullscreenModeRef.current) ||\n fullscreenModeRef.current === nextIsFullscreenModalModeValue\n ) {\n // Adding modal class if modal is opened when non-modal is already open\n if (isModal && fullscreenModalModeRef.current !== isModal) {\n fullscreenModalModeRef.current = isModal;\n containerRef.current?.classList.add(styles.containerMaximizedTransparentModal);\n }\n\n return;\n }\n\n const classesEditMethod = nextIsFullscreenModalModeValue ? 'add' : 'remove';\n\n containerRef.current?.classList[classesEditMethod](styles.containerMaximizedTransparent);\n\n if (isModal || classesEditMethod === 'remove') {\n containerRef.current?.classList[classesEditMethod](\n styles.containerMaximizedTransparentModal\n );\n }\n\n appIframeDocument.current = containerRef.current?.querySelector(\n `[${APP_IFRAME_ATTRIBUTE}]`\n )?.contentWindow?.document;\n\n const isolatedPageAppContainer = appIframeDocument.current?.getElementById(\n ISOLATED_PAGE_APP_CONTAINER_ID\n );\n\n if (!isolatedPageAppContainer) {\n return;\n }\n\n if (nextIsFullscreenModalModeValue) {\n // 1. BATCH ALL READS FIRST - prevents layout thrashing\n const { top, left, width, height } = fixedSizeContainerRef.current.getBoundingClientRect();\n const isBodyScrollVisible = window.innerWidth !== document.body.clientWidth;\n\n // 2. Flush React state updates synchronously to prevent deferred renders\n flushSync(() => {\n onAppFullscreenTransparentMode({ appId: props.app.id, isModeEnabled: true });\n });\n\n // 3. BATCH ALL DOM WRITES - after reads and React flush\n isolatedPageAppContainer.setAttribute(\n 'style',\n `\n top: ${top}px;\n left: ${left}px;\n width: ${width}px;\n height: ${height}px;\n position: absolute;\n `\n );\n document.body.classList.add(\n 'dc-isolated-app__body-overflow',\n isBodyScrollVisible && styles.compensateScroll\n );\n } else {\n // Flush React state updates synchronously before DOM writes\n flushSync(() => {\n onAppFullscreenTransparentMode({ appId: props.app.id, isModeEnabled: false });\n });\n\n // DOM writes after React flush\n isolatedPageAppContainer.setAttribute('style', '');\n document.body.classList.remove('dc-isolated-app__body-overflow', styles.compensateScroll);\n }\n fullscreenModeRef.current = nextIsFullscreenModalModeValue;\n fullscreenModalModeRef.current = isModal;\n },\n [isIsolationFeatureEnabled, isNonIsolatedApp, isAppMaximizedRef]\n );\n\n useEffect(() => {\n return handleAppFullscreenTransparentModeExit;\n }, []);\n\n useEffect(() => {\n if (isAppMaximized && fullscreenModeRef.current) {\n setIsFullscreenModalMode(false);\n }\n }, [isAppMaximized]);\n\n const {\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n setSeparateWindowTitle,\n } = useFullscreenModes({\n containerRef: fixedSizeContainerRef,\n appInstanceId: props.app.id,\n isMaximized: isAppMaximized,\n });\n\n /**\n * This should be the same function as calling react-intersection-observer's ref setter actually triggers re-render.\n * Which in its turn causes infinite re-render loop.\n */\n const setContainerRefs = useCallback(node => {\n containerRef.current = node;\n setInnerContainerRefFn(node);\n }, []);\n\n return (\n <div\n className={classNames(\n 'dc-isolated-app',\n styles.fixedSizeContainer,\n isAppMaximized && styles.containerMaximized\n )}\n ref={fixedSizeContainerRef}\n >\n <div\n ref={setContainerRefs}\n onMouseEnter={onInnerContainerMouseEnter}\n onMouseLeave={onInnerContainerMouseLeave}\n data-testid={`${PAGE_NAME}_${props.app.app.name}`}\n className={classNames(\n styles.container,\n isInsideNewMobileApp && styles.newMobileAppContainer\n )}\n >\n <DCAppComponent\n key={iframeKey}\n {...props}\n isBrowserFullscreen={isBrowserFullscreen}\n enterBrowserFullscreen={enterBrowserFullscreen}\n exitBrowserFullscreen={exitBrowserFullscreen}\n isSeparateWindow={isSeparateWindow}\n openSeparateWindow={openSeparateWindow}\n closeSeparateWindow={closeSeparateWindow}\n setSeparateWindowTitle={setSeparateWindowTitle}\n isNonIsolatedApp={isNonIsolatedApp}\n appContextValue={appContextValue}\n devCenterRouter={devCenterRouter}\n globalNotificationToastsAPI={window[Symbol.for('notificationToasts')]}\n globalMixpanelEventTracker={window[Symbol.for('logToMixpanel')]}\n onAppContainerClick={onAppContainerClick}\n onAppRemove={onAppRemove}\n onIsMaximizedChange={onIsMaximizedChange}\n onSettingChange={onSettingChange}\n onSettingsChange={onSettingsChange}\n permissionsContextValue={permissionsContextValue}\n setIsFullscreenModalMode={setIsFullscreenModalMode}\n userUnits={userUnits}\n trackApiRateLimiterException={trackApiRateLimiterException}\n updateCurrentDashboardAppLastAnnotation={updateCurrentDashboardAppLastAnnotation}\n apiRateLimiterConfig={apiRateLimiterConfig}\n />\n </div>\n </div>\n );\n}\n\nDevCenterIsolatedAppComponent.propTypes = {\n app: PropTypes.shape({\n id: PropTypes.number,\n app: PropTypes.shape({\n name: PropTypes.string,\n }),\n }).isRequired,\n currentUser: PropTypes.shape({}).isRequired,\n isIsolationFeatureEnabled: PropTypes.bool,\n onAppContainerClick: PropTypes.func,\n onAppFullscreenTransparentMode: PropTypes.func,\n onAppRemove: PropTypes.func,\n onInnerContainerMouseEnter: PropTypes.func,\n onInnerContainerMouseLeave: PropTypes.func,\n onIsMaximizedChange: PropTypes.func,\n onSettingChange: PropTypes.func,\n onSettingsChange: PropTypes.func,\n setInnerContainerRefFn: PropTypes.func,\n updateCurrentDashboardAppLastAnnotation: PropTypes.func,\n apiRateLimiterConfig: PropTypes.object,\n};\n\nexport const DevCenterIsolatedApp = withRouter(DevCenterIsolatedAppComponent);\n"],"names":["DEFAULT_API_RATE_LIMITER_CONFIG","DevCenterIsolatedAppComponent","_ref","_props$history","_props$app","_props$app2","_props$app3","_props$app3$app","_props$history2","_props$history2$locat","_ref$isIsolationFeatu","isIsolationFeatureEnabled","_ref$onAppFullscreenT","onAppFullscreenTransparentMode","noop","_ref$onIsMaximizedCha","onIsMaximizedChange","_ref$onInnerContainer","onInnerContainerMouseEnter","_ref$onInnerContainer2","onInnerContainerMouseLeave","_ref$onAppContainerCl","onAppContainerClick","_ref$setInnerContaine","setInnerContainerRefFn","_ref$onAppRemove","onAppRemove","undefined","_ref$onSettingChange","onSettingChange","_ref$onSettingsChange","onSettingsChange","_ref$updateCurrentDas","updateCurrentDashboardAppLastAnnotation","_ref$apiRateLimiterCo","apiRateLimiterConfig","trackApiRateLimiterException","props","_objectWithoutProperties","_excluded","devCenterRouter","useMemo","devCenterUtils","history","location","isNonIsolatedApp","app","package","DCAppComponent","DevCenterAppContainer","IsolatedPage","appKey","app_key","appVersion","getAppVersion","iframeKey","concat","appIframeDocument","useRef","containerRef","fixedSizeContainerRef","fullscreenModeRef","fullscreenModalModeRef","isAppMaximized","queryString","parse","search","id","isAppMaximizedRef","current","_useState","useState","getUserUnits","_useState2","_slicedToArray","userUnits","setUserUnits","useEffect","unsubscribeFn","subscribeForUserUnitsUpdates","newUserUnits","appContextValue","useContext","AppContext","permissionsContextValue","usePermissionsContext","handleAppFullscreenTransparentModeExit","appId","isModeEnabled","document","body","classList","remove","styles","compensateScroll","setIsFullscreenModalMode","useCallback","nextIsFullscreenModalModeValue","_containerRef$current2","_containerRef$current4","_containerRef$current5","_containerRef$current6","_appIframeDocument$cu","isModal","_containerRef$current","add","containerMaximizedTransparentModal","_containerRef$current3","classesEditMethod","containerMaximizedTransparent","querySelector","APP_IFRAME_ATTRIBUTE","contentWindow","isolatedPageAppContainer","getElementById","ISOLATED_PAGE_APP_CONTAINER_ID","_fixedSizeContainerRe","getBoundingClientRect","top","left","width","height","isBodyScrollVisible","window","innerWidth","clientWidth","flushSync","setAttribute","_useFullscreenModes","useFullscreenModes","appInstanceId","isMaximized","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","setSeparateWindowTitle","setContainerRefs","node","_jsx","className","classNames","fixedSizeContainer","containerMaximized","ref","children","onMouseEnter","onMouseLeave","PAGE_NAME","name","container","isInsideNewMobileApp","newMobileAppContainer","_objectSpread","globalNotificationToastsAPI","Symbol","for","globalMixpanelEventTracker","propTypes","PropTypes","shape","number","string","isRequired","currentUser","bool","func","object","DevCenterIsolatedApp","withRouter"],"mappings":"s9FAqBA,IACMA,EAAkC,CAAA,EAExC,SAASC,EAeNC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAR,EAdDS,0BAAAA,cAAiCD,EAAAE,EAAAV,EACjCW,+BAAAA,aAAiCC,EAAIF,EAAAG,EAAAb,EACrCc,oBAAAA,aAAsBF,EAAIC,EAAAE,EAAAf,EAC1BgB,2BAAAA,aAA6BJ,EAAIG,EAAAE,EAAAjB,EACjCkB,2BAAAA,aAA6BN,EAAIK,EAAAE,EAAAnB,EACjCoB,oBAAAA,aAAsBR,EAAIO,EAAAE,EAAArB,EAC1BsB,uBAAAA,aAAyBV,EAAIS,EAAAE,GAAAvB,EAC7BwB,YAAAA,oBAAcC,EAASF,GAAAG,GAAA1B,EACvB2B,gBAAAA,eAAkBf,EAAIc,GAAAE,GAAA5B,EACtB6B,iBAAAA,eAAmBjB,EAAIgB,GAAAE,GAAA9B,EACvB+B,wCAAAA,eAA0CnB,EAAIkB,GAAAE,GAAAhC,EAC9CiC,qBAAAA,eAAuBnC,EAA+BkC,GACtDE,KAAAA,6BACGC,GAAKC,EAAApC,EAAAqC,GAEFC,GAAkBC,GACtB,WAAA,OAAMC,EAAqCL,GAAMM,QACjD,GAAA,SAAAxC,EAACkC,GAAMM,4BAANxC,EAAeyC,WAGZC,GACHH,EAA0BL,UAAA,QAAKjC,EAALiC,GAAOS,WAAP,IAAA1C,OAAK,EAALA,EAAY0C,OACpCJ,EAAmDL,kBAAAA,EAAAA,GAAOS,sBAAPT,EAAAhC,EAAY0C,WACjEpC,EAEGqC,GAAiBH,GAAmBI,EAAwBC,EAI5DC,WAASd,EAAAA,GA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mH,EAAUC,MAAM,CACnBX,KAAMU,EAAUG,WAEjBC,WACHC,YAAaL,EAAUC,MAAM,CAAA,GAAIG,WACjC1J,0BAA2BsJ,EAAUM,KACrCjJ,oBAAqB2I,EAAUO,KAC/B3J,+BAAgCoJ,EAAUO,KAC1C9I,YAAauI,EAAUO,KACvBtJ,2BAA4B+I,EAAUO,KACtCpJ,2BAA4B6I,EAAUO,KACtCxJ,oBAAqBiJ,EAAUO,KAC/B3I,gBAAiBoI,EAAUO,KAC3BzI,iBAAkBkI,EAAUO,KAC5BhJ,uBAAwByI,EAAUO,KAClCvI,wCAAyCgI,EAAUO,KACnDrI,qBAAsB8H,EAAUQ,YAGrBC,EAAuBC,EAAW1K"}
@@ -1,2 +1,2 @@
1
- import e from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var o={spacing:"8",container:"DevCenterIsolatedApp-module_container__4H6mS",newMobileAppContainer:"DevCenterIsolatedApp-module_newMobileAppContainer__5Qagb",containerMaximized:"DevCenterIsolatedApp-module_containerMaximized__5N9JC",containerMaximizedTransparent:"DevCenterIsolatedApp-module_containerMaximizedTransparent__o2-O3",containerMaximizedTransparentModal:"DevCenterIsolatedApp-module_containerMaximizedTransparentModal__kSTJM",fixedSizeContainer:"DevCenterIsolatedApp-module_fixedSizeContainer__gzaBd",compensateScroll:"DevCenterIsolatedApp-module_compensateScroll__WEp7e"};e(".DevCenterIsolatedApp-module_container__4H6mS{background-color:var(--palette-app-background);border-radius:8px;bottom:0;left:0;overflow:hidden;position:absolute;right:0;top:0}.DevCenterIsolatedApp-module_newMobileAppContainer__5Qagb{background-color:transparent}.DevCenterIsolatedApp-module_container__4H6mS>div{height:100%}.DevCenterIsolatedApp-module_containerMaximized__5N9JC{bottom:10px;box-shadow:0 0 18px 3px rgba(0,0,0,.75);height:auto;left:10px;overflow:hidden;position:fixed;right:10px;top:10px;width:auto;z-index:1000}.DevCenterIsolatedApp-module_containerMaximizedTransparent__o2-O3{background-color:transparent;bottom:0;height:auto;left:0;overflow:hidden;position:fixed;right:0;top:0;width:auto;z-index:200}.DevCenterIsolatedApp-module_containerMaximizedTransparentModal__kSTJM{z-index:2000}.DevCenterIsolatedApp-module_fixedSizeContainer__gzaBd{bottom:0;left:0;position:absolute;right:0;top:0}.dc-isolated-app__body-overflow{overflow:hidden}.DevCenterIsolatedApp-module_compensateScroll__WEp7e{margin-right:15px}");export{o as default};
1
+ import e from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var o={spacing:"8",fixedSizeContainer:"DevCenterIsolatedApp-module_fixedSizeContainer__gzaBd",container:"DevCenterIsolatedApp-module_container__4H6mS",newMobileAppContainer:"DevCenterIsolatedApp-module_newMobileAppContainer__5Qagb",containerMaximized:"DevCenterIsolatedApp-module_containerMaximized__5N9JC",containerMaximizedTransparent:"DevCenterIsolatedApp-module_containerMaximizedTransparent__o2-O3",containerMaximizedTransparentModal:"DevCenterIsolatedApp-module_containerMaximizedTransparentModal__kSTJM",compensateScroll:"DevCenterIsolatedApp-module_compensateScroll__WEp7e"};e(".DevCenterIsolatedApp-module_container__4H6mS,.DevCenterIsolatedApp-module_fixedSizeContainer__gzaBd{bottom:0;left:0;position:absolute;right:0;top:0}.DevCenterIsolatedApp-module_container__4H6mS{background-color:var(--palette-app-background);border-radius:8px;overflow:hidden}.DevCenterIsolatedApp-module_newMobileAppContainer__5Qagb{background-color:transparent}.DevCenterIsolatedApp-module_container__4H6mS>div{height:100%}.DevCenterIsolatedApp-module_containerMaximized__5N9JC{height:auto;inset:0;overflow:hidden;overscroll-behavior:contain;position:fixed;width:auto;z-index:1000}.DevCenterIsolatedApp-module_containerMaximized__5N9JC .DevCenterIsolatedApp-module_container__4H6mS{box-shadow:0 0 18px 3px rgba(0,0,0,.75);inset:10px;overflow:hidden}.DevCenterIsolatedApp-module_containerMaximizedTransparent__o2-O3{background-color:transparent;bottom:0;height:auto;left:0;overflow:hidden;position:fixed;right:0;top:0;width:auto;z-index:200}.DevCenterIsolatedApp-module_containerMaximizedTransparentModal__kSTJM{z-index:2000}.dc-isolated-app__body-overflow{overflow:hidden}.DevCenterIsolatedApp-module_compensateScroll__WEp7e{margin-right:15px}");export{o as default};
2
2
  //# sourceMappingURL=DevCenterIsolatedApp.module.scss.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDrawEventHandlers.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAIrD,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACnD,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CACxE,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,YAAY,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5C,iBAAiB,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC7C,KAAK,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,oBAAoB,cACpB,kBAAkB,WACpB,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAC,KAC3C,0BAwEF,CAAC"}
1
+ {"version":3,"file":"useDrawEventHandlers.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAIrD,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACnD,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CACxE,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,YAAY,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5C,iBAAiB,EAAE,CAAC,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC7C,KAAK,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,oBAAoB,cACpB,kBAAkB,WACpB,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAC,KAC3C,0BA2EF,CAAC"}
@@ -1,2 +1,2 @@
1
- import{useRef as e,useCallback as n}from"react";import{MapConfig as t}from"../../constants.js";var r=function(r,a){var o=e({create:null,update:null,delete:null,modeChange:null,selectionChange:null}),l=n((function(e){var n=e.map.getMap();o.current.create=function(e){r.onDrawCreate(e)},o.current.update=function(e){r.onDrawUpdate(e)},o.current.delete=function(){r.onDrawDelete()},o.current.modeChange=function(e){r.onModeChange(e)},o.current.selectionChange=function(e){r.onSelectionChange(e)},n.on("draw.create",o.current.create),n.on("draw.update",o.current.update),n.on("draw.delete",o.current.delete),n.on("draw.modechange",o.current.modeChange),n.on("draw.selectionchange",o.current.selectionChange),n.once("idle",(function(){null!=n&&n.getLayer(t.LayerIds.Wells)&&n.moveLayer(t.LayerIds.Wells)}))}),[r]),c=n((function(e){var n=e.map.getMap(),t=o.current;t.create&&n.off("draw.create",t.create),t.update&&n.off("draw.update",t.update),t.delete&&n.off("draw.delete",t.delete),t.modeChange&&n.off("draw.modechange",t.modeChange),t.selectionChange&&n.off("draw.selectionchange",t.selectionChange),o.current={create:null,update:null,delete:null,modeChange:null,selectionChange:null},a.current=null}),[a]);return{handlersRef:o,onAdd:l,onRemove:c}};export{r as useDrawEventHandlers};
1
+ import{useRef as e,useCallback as n}from"react";import{unstable_batchedUpdates as t}from"react-dom";import{MapConfig as r}from"../../constants.js";var a=function(a,o){var u=e({create:null,update:null,delete:null,modeChange:null,selectionChange:null}),c=n((function(e){var n=e.map.getMap();u.current.create=function(e){t((function(){return a.onDrawCreate(e)}))},u.current.update=function(e){t((function(){return a.onDrawUpdate(e)}))},u.current.delete=function(){t((function(){return a.onDrawDelete()}))},u.current.modeChange=function(e){t((function(){return a.onModeChange(e)}))},u.current.selectionChange=function(e){t((function(){return a.onSelectionChange(e)}))},n.on("draw.create",u.current.create),n.on("draw.update",u.current.update),n.on("draw.delete",u.current.delete),n.on("draw.modechange",u.current.modeChange),n.on("draw.selectionchange",u.current.selectionChange),n.once("idle",(function(){null!=n&&n.getLayer(r.LayerIds.Wells)&&n.moveLayer(r.LayerIds.Wells)}))}),[a]),l=n((function(e){var n=e.map.getMap(),t=u.current;t.create&&n.off("draw.create",t.create),t.update&&n.off("draw.update",t.update),t.delete&&n.off("draw.delete",t.delete),t.modeChange&&n.off("draw.modechange",t.modeChange),t.selectionChange&&n.off("draw.selectionchange",t.selectionChange),u.current={create:null,update:null,delete:null,modeChange:null,selectionChange:null},o.current=null}),[o]);return{handlersRef:u,onAdd:c,onRemove:l}};export{a as useDrawEventHandlers};
2
2
  //# sourceMappingURL=useDrawEventHandlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDrawEventHandlers.js","sources":["../../../../../../../../src/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.ts"],"sourcesContent":["import { useCallback, useRef, MutableRefObject } from 'react';\nimport type { MapRef } from '@vis.gl/react-mapbox';\nimport type MapboxDraw from '@mapbox/mapbox-gl-draw';\n\nimport { MapConfig } from '../../constants';\n\ntype EventHandlers = {\n create: ((e: unknown) => void) | null;\n update: ((e: unknown) => void) | null;\n delete: (() => void) | null;\n modeChange: ((e: { mode: string }) => void) | null;\n selectionChange: ((e: { features: GeoJSON.Feature[] }) => void) | null;\n};\n\ntype DrawEventCallbacks = {\n onDrawCreate: (e: { features: GeoJSON.Feature[] }) => void;\n onDrawUpdate: (e: { features: GeoJSON.Feature[] }) => void;\n onDrawDelete: () => void;\n onModeChange: (e: { mode: string }) => void;\n onSelectionChange: (e: { features: GeoJSON.Feature[] }) => void;\n};\n\ntype UseDrawEventHandlersReturn = {\n handlersRef: MutableRefObject<EventHandlers>;\n onAdd: (params: { map: MapRef }) => void;\n onRemove: (params: { map: MapRef }) => void;\n};\n\nexport const useDrawEventHandlers = (\n callbacks: DrawEventCallbacks,\n drawRef: MutableRefObject<MapboxDraw | null>\n): UseDrawEventHandlersReturn => {\n const handlersRef = useRef<EventHandlers>({\n create: null,\n update: null,\n delete: null,\n modeChange: null,\n selectionChange: null,\n });\n\n const onAdd = useCallback(\n ({ map }: { map: MapRef }) => {\n const mapInstance = map.getMap();\n\n handlersRef.current.create = (e: unknown) => {\n callbacks.onDrawCreate(e as { features: GeoJSON.Feature[] });\n };\n handlersRef.current.update = (e: unknown) => {\n callbacks.onDrawUpdate(e as { features: GeoJSON.Feature[] });\n };\n handlersRef.current.delete = () => {\n callbacks.onDrawDelete();\n };\n handlersRef.current.modeChange = (e: { mode: string }) => {\n callbacks.onModeChange(e);\n };\n handlersRef.current.selectionChange = (e: { features: GeoJSON.Feature[] }) => {\n callbacks.onSelectionChange(e);\n };\n\n mapInstance.on('draw.create', handlersRef.current.create);\n mapInstance.on('draw.update', handlersRef.current.update);\n mapInstance.on('draw.delete', handlersRef.current.delete);\n mapInstance.on('draw.modechange', handlersRef.current.modeChange);\n mapInstance.on('draw.selectionchange', handlersRef.current.selectionChange);\n\n // Move well markers on top of draw controls\n mapInstance.once('idle', () => {\n if (!mapInstance?.getLayer(MapConfig.LayerIds.Wells)) {\n return;\n }\n\n mapInstance.moveLayer(MapConfig.LayerIds.Wells);\n });\n },\n [callbacks]\n );\n\n const onRemove = useCallback(\n ({ map }: { map: MapRef }) => {\n const mapInstance = map.getMap();\n const h = handlersRef.current;\n\n if (h.create) mapInstance.off('draw.create', h.create);\n if (h.update) mapInstance.off('draw.update', h.update);\n if (h.delete) mapInstance.off('draw.delete', h.delete);\n if (h.modeChange) mapInstance.off('draw.modechange', h.modeChange);\n if (h.selectionChange) mapInstance.off('draw.selectionchange', h.selectionChange);\n\n handlersRef.current = {\n create: null,\n update: null,\n delete: null,\n modeChange: null,\n selectionChange: null,\n };\n // eslint-disable-next-line no-param-reassign\n drawRef.current = null;\n },\n [drawRef]\n );\n\n return { handlersRef, onAdd, onRemove };\n};\n"],"names":["useDrawEventHandlers","callbacks","drawRef","handlersRef","useRef","create","update","delete","modeChange","selectionChange","onAdd","useCallback","_ref","mapInstance","map","getMap","current","e","onDrawCreate","onDrawUpdate","onDrawDelete","onModeChange","onSelectionChange","on","once","getLayer","MapConfig","LayerIds","Wells","moveLayer","onRemove","_ref2","h","off"],"mappings":"+FA4BO,IAAMA,EAAuB,SAClCC,EACAC,GAEA,IAAMC,EAAcC,EAAsB,CACxCC,OAAQ,KACRC,OAAQ,K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IAGH,MAAO,CAAEC,YAAAA,EAAaO,MAAAA,EAAOoB,SAAAA,EAC/B"}
1
+ {"version":3,"file":"useDrawEventHandlers.js","sources":["../../../../../../../../src/components/OffsetWellPickerV5/components/Map/OffsetWellMap/components/DrawControl/useDrawEventHandlers.ts"],"sourcesContent":["import { useCallback, useRef, MutableRefObject } from 'react';\nimport { unstable_batchedUpdates } from 'react-dom';\nimport type { MapRef } from '@vis.gl/react-mapbox';\nimport type MapboxDraw from '@mapbox/mapbox-gl-draw';\n\nimport { MapConfig } from '../../constants';\n\ntype EventHandlers = {\n create: ((e: unknown) => void) | null;\n update: ((e: unknown) => void) | null;\n delete: (() => void) | null;\n modeChange: ((e: { mode: string }) => void) | null;\n selectionChange: ((e: { features: GeoJSON.Feature[] }) => void) | null;\n};\n\ntype DrawEventCallbacks = {\n onDrawCreate: (e: { features: GeoJSON.Feature[] }) => void;\n onDrawUpdate: (e: { features: GeoJSON.Feature[] }) => void;\n onDrawDelete: () => void;\n onModeChange: (e: { mode: string }) => void;\n onSelectionChange: (e: { features: GeoJSON.Feature[] }) => void;\n};\n\ntype UseDrawEventHandlersReturn = {\n handlersRef: MutableRefObject<EventHandlers>;\n onAdd: (params: { map: MapRef }) => void;\n onRemove: (params: { map: MapRef }) => void;\n};\n\nexport const useDrawEventHandlers = (\n callbacks: DrawEventCallbacks,\n drawRef: MutableRefObject<MapboxDraw | null>\n): UseDrawEventHandlersReturn => {\n const handlersRef = useRef<EventHandlers>({\n create: null,\n update: null,\n delete: null,\n modeChange: null,\n selectionChange: null,\n });\n\n const onAdd = useCallback(\n ({ map }: { map: MapRef }) => {\n const mapInstance = map.getMap();\n\n // mapbox-gl-draw reads ctx.store on the line after it fires each of these, and under a\n // legacy root an unbatched setState re-renders and flushes pending passive effects before\n // the listener returns — long enough to unmount this control and null that store.\n handlersRef.current.create = (e: unknown) => {\n unstable_batchedUpdates(() => callbacks.onDrawCreate(e as { features: GeoJSON.Feature[] }));\n };\n handlersRef.current.update = (e: unknown) => {\n unstable_batchedUpdates(() => callbacks.onDrawUpdate(e as { features: GeoJSON.Feature[] }));\n };\n handlersRef.current.delete = () => {\n unstable_batchedUpdates(() => callbacks.onDrawDelete());\n };\n handlersRef.current.modeChange = (e: { mode: string }) => {\n unstable_batchedUpdates(() => callbacks.onModeChange(e));\n };\n handlersRef.current.selectionChange = (e: { features: GeoJSON.Feature[] }) => {\n unstable_batchedUpdates(() => callbacks.onSelectionChange(e));\n };\n\n mapInstance.on('draw.create', handlersRef.current.create);\n mapInstance.on('draw.update', handlersRef.current.update);\n mapInstance.on('draw.delete', handlersRef.current.delete);\n mapInstance.on('draw.modechange', handlersRef.current.modeChange);\n mapInstance.on('draw.selectionchange', handlersRef.current.selectionChange);\n\n // Move well markers on top of draw controls\n mapInstance.once('idle', () => {\n if (!mapInstance?.getLayer(MapConfig.LayerIds.Wells)) {\n return;\n }\n\n mapInstance.moveLayer(MapConfig.LayerIds.Wells);\n });\n },\n [callbacks]\n );\n\n const onRemove = useCallback(\n ({ map }: { map: MapRef }) => {\n const mapInstance = map.getMap();\n const h = handlersRef.current;\n\n if (h.create) mapInstance.off('draw.create', h.create);\n if (h.update) mapInstance.off('draw.update', h.update);\n if (h.delete) mapInstance.off('draw.delete', h.delete);\n if (h.modeChange) mapInstance.off('draw.modechange', h.modeChange);\n if (h.selectionChange) mapInstance.off('draw.selectionchange', h.selectionChange);\n\n handlersRef.current = {\n create: null,\n update: null,\n delete: null,\n modeChange: null,\n selectionChange: null,\n };\n // eslint-disable-next-line no-param-reassign\n drawRef.current = null;\n },\n [drawRef]\n );\n\n return { handlersRef, onAdd, onRemove };\n};\n"],"names":["useDrawEventHandlers","callbacks","drawRef","handlersRef","useRef","create","update","delete","modeChange","selectionChange","onAdd","useCallback","_ref","mapInstance","map","getMap","current","e","unstable_batchedUpdates","onDrawCreate","onDrawUpdate","onDrawDelete","onModeChange","onSelectionChange","on","once","getLayer","MapConfig","LayerIds","Wells","moveLayer","onRemove","_ref2","h","off"],"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