@corva/ui 0.33.0-5 → 0.33.0-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/regenerator";import a from"@babel/runtime/helpers/asyncToGenerator";import{parse as o,stringify as s}from"query-string";import{getDCAppKey as i}from"../utils.js";import c from"@babel/runtime/helpers/createClass";import{DISPLAY_HTTP_MESSAGES as p}from"./httpMessages.js";function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?u(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var h={400:"Request Failed",403:"No Permission",404:"Not Found"},f=["POST","PUT","PATCH","DELETE"],d=function(){function e(t,n){r(this,e),this.status=t.status,this.statusText=t.statusText,this.message=n.message||"No Message"}return c(e,[{key:"isAuthenticationProblem",value:function(){return 401===this.status||"Invalid authentication token"===this.message}},{key:"isTermsProblem",value:function(){return 401===this.status&&"Please accept the latest terms of service"===this.message}}]),e}(),m=o(window.location.search).api_url||process.env.REACT_APP_API_URL||"https://api.qa.corva.ai",y={"Content-Type":"application/json",Accept:"application/json"};function v(e){var t=e.config,r=e.appKey;return l(l({},t),{},{headers:l(l({},t.headers||{}),{},{"X-Corva-App":r})})}function b(e){e.isAuthenticationProblem&&e.isAuthenticationProblem()&&!e.isTermsProblem()&&(console.error("Problem with user"),"/login"!==window.location.pathname&&(window.location.href="/login"))}var g=/^\/v1\/assets.*/;function w(){return(w=a(n.mark((function e(t){var r,a,o,s,i,c=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=c.length>1&&void 0!==c[1]?c[1]:{},a=c.length>2&&void 0!==c[2]?c[2]:{},o=a.apiUrl,s=void 0===o?m:o,i=a.appKey,g.test(t)&&(r.cache="reload"),r.credentials="include",e.abrupt("return",fetch("".concat(s).concat(t),v({config:r,appKey:i})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var P,x,O=(P=function(e){return w.apply(this,arguments)},x=a(n.mark((function e(t,r,a){var o,s,i,c,u,l,m;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P(t,r,a);case 2:if(o=e.sent,s=o.status,!o.ok){e.next=6;break}return e.abrupt("return",204===s?null:o);case 6:return e.prev=6,e.next=9,o.json();case 9:i=e.sent,e.next=15;break;case 12:e.prev=12,e.t0=e.catch(6),i={};case 15:throw c=r.method,u=f.includes(c),l=p[i.message]||h[s],u&&l&&console.error("ERROR"),b(m=new d(o,i)),m;case 22:case"end":return e.stop()}}),e,null,[[6,12]])}))),function(e,t,r){return x.apply(this,arguments)});function j(e,t){return k.apply(this,arguments)}function k(){return(k=a(n.mark((function e(t,r){var a,o,s,c=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=c.length>2&&void 0!==c[2]?c[2]:{},o=a.apiUrl,e.next=4,O(t,{method:"POST",headers:y,body:JSON.stringify(r)},{apiUrl:o,appKey:i()});case 4:return s=e.sent,e.abrupt("return",s&&s.json());case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function T(e){return A.apply(this,arguments)}function A(){return(A=a(n.mark((function e(t){var r,a,o,i,c,p,u=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},a=u.length>2&&void 0!==u[2]?u[2]:{},o=a.apiUrl,i=a.appKey,c=s(r,{arrayFormat:"bracket"}),e.next=6,O("".concat(t).concat(c?"?":"").concat(c),{method:"GET"},{apiUrl:o,appKey:i});case 6:if(p=e.sent,e.t0=p,!e.t0){e.next=12;break}return e.next=11,p.json();case 11:e.t0=e.sent;case 12:return e.t1=e.t0,e.t2=p&&p.headers,e.abrupt("return",{data:e.t1,headers:e.t2});case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(e){return E.apply(this,arguments)}function E(){return(E=a(n.mark((function e(t){var r,a,o,s=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},a=s.length>2&&void 0!==s[2]?s[2]:{},e.next=4,T(t,r,l(l({},a),{},{appKey:a.appKey||i()}));case 4:return o=e.sent,e.abrupt("return",o.data);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(e,t){return C.apply(this,arguments)}function C(){return(C=a(n.mark((function e(t,r){var a,o,c,p,u,l=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=l.length>2&&void 0!==l[2]?l[2]:{},o=l.length>3&&void 0!==l[3]?l[3]:{},c=o.apiUrl,p=s(a),e.next=6,O("".concat(t).concat(p?"?":"").concat(p),{method:"PUT",headers:y,body:JSON.stringify(r)},{apiUrl:c,appKey:i()});case 6:return u=e.sent,e.abrupt("return",u&&u.json());case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e,t){return D.apply(this,arguments)}function D(){return(D=a(n.mark((function e(t,r){var a,o,c,p,u,l=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=l.length>2&&void 0!==l[2]?l[2]:{},o=l.length>3&&void 0!==l[3]?l[3]:{},c=o.apiUrl,p=s(a),e.next=6,O("".concat(t).concat(p?"?":"").concat(p),{method:"PATCH",headers:y,body:JSON.stringify(r)},{apiUrl:c,appKey:i()});case 6:return u=e.sent,e.abrupt("return",u&&u.json());case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(e){return R.apply(this,arguments)}function R(){return(R=a(n.mark((function e(t){var r,a,o,c,p,u=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},a=u.length>2&&void 0!==u[2]?u[2]:{},o=a.apiUrl,c=s(r),e.next=6,O(c?"".concat(t,"?").concat(c):t,{method:"DELETE",headers:y},{apiUrl:o,appKey:i()});case 6:return p=e.sent,e.abrupt("return",p&&p.json());case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t){return _.apply(this,arguments)}function _(){return(_=a(n.mark((function e(r,a){var o,c,p,u,l,h,f,d=arguments;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=d.length>2&&void 0!==d[2]?d[2]:{},c=d.length>3&&void 0!==d[3]?d[3]:{},p=s(o),u=c.method,l=void 0===u?"POST":u,h=new FormData,Object.entries(a).forEach((function(e){var r=t(e,2),n=r[0],a=r[1];Array.isArray(a)?a.forEach((function(e){h.append(n,e)})):h.append(n,a)})),e.next=8,O(p?"".concat(r,"?").concat(p):r,{method:l,headers:{Accept:"application/json"},body:h},{appKey:i()});case 8:return f=e.sent,e.abrupt("return",f&&f.json());case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}export{m as baseUrl,N as del,U as get,T as getWithHeaders,b as handleAuthenticationProblem,S as patch,j as post,K as put,F as sendFormData};
1
+ import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/regenerator";import a from"@babel/runtime/helpers/asyncToGenerator";import{parse as o,stringify as s}from"query-string";import{getAppKeyFromStackTrace as i,attachHTTPHeaders as c}from"../utils.js";import u from"@babel/runtime/helpers/createClass";import{DISPLAY_HTTP_MESSAGES as p}from"./httpMessages.js";function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?l(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f={400:"Request Failed",403:"No Permission",404:"Not Found"},d=["POST","PUT","PATCH","DELETE"],m=function(){function t(e,n){r(this,t),this.status=e.status,this.statusText=e.statusText,this.message=n.message||"No Message"}return u(t,[{key:"isAuthenticationProblem",value:function(){return 401===this.status||"Invalid authentication token"===this.message}},{key:"isTermsProblem",value:function(){return 401===this.status&&"Please accept the latest terms of service"===this.message}}]),t}(),y=o(window.location.search).api_url||process.env.REACT_APP_API_URL||"https://api.qa.corva.ai",v={"Content-Type":"application/json",Accept:"application/json"};function b(t){t.isAuthenticationProblem&&t.isAuthenticationProblem()&&!t.isTermsProblem()&&(console.error("Problem with user"),"/login"!==window.location.pathname&&(window.location.href="/login"))}var g=/^\/v1\/assets.*/;function w(){return(w=a(n.mark((function t(e){var r,a,o,s,i,u=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},a=u.length>2&&void 0!==u[2]?u[2]:{},o=a.apiUrl,s=void 0===o?y:o,i=a.appKey,g.test(e)&&(r.cache="reload"),r.credentials="include",t.abrupt("return",fetch("".concat(s).concat(e),c({config:r,appKey:i})));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var P,x,O=(P=function(t){return w.apply(this,arguments)},x=a(n.mark((function t(e,r,a){var o,s,i,c,u,l,h;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P(e,r,a);case 2:if(o=t.sent,s=o.status,!o.ok){t.next=6;break}return t.abrupt("return",204===s?null:o);case 6:return t.prev=6,t.next=9,o.json();case 9:i=t.sent,t.next=15;break;case 12:t.prev=12,t.t0=t.catch(6),i={};case 15:throw c=r.method,u=d.includes(c),l=p[i.message]||f[s],u&&l&&console.error("ERROR"),b(h=new m(o,i)),h;case 22:case"end":return t.stop()}}),t,null,[[6,12]])}))),function(t,e,r){return x.apply(this,arguments)});function j(t,e){return k.apply(this,arguments)}function k(){return(k=a(n.mark((function t(e,r){var a,o,s,c=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=c.length>2&&void 0!==c[2]?c[2]:{},o=a.apiUrl,t.next=4,O(e,{method:"POST",headers:v,body:JSON.stringify(r)},{apiUrl:o,appKey:i()});case 4:return s=t.sent,t.abrupt("return",s&&s.json());case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function T(t){return U.apply(this,arguments)}function U(){return(U=a(n.mark((function t(e){var r,a,o,c,u,p,l=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=l.length>1&&void 0!==l[1]?l[1]:{},a=l.length>2&&void 0!==l[2]?l[2]:{},o=a.apiUrl,c=a.appKey,u=s(r,{arrayFormat:"bracket"}),t.next=6,O("".concat(e).concat(u?"?":"").concat(u),{method:"GET"},{apiUrl:o,appKey:c||i()});case 6:if(p=t.sent,t.t0=p,!t.t0){t.next=12;break}return t.next=11,p.json();case 11:t.t0=t.sent;case 12:return t.t1=t.t0,t.t2=p&&p.headers,t.abrupt("return",{data:t.t1,headers:t.t2});case 15:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function A(t){return E.apply(this,arguments)}function E(){return(E=a(n.mark((function t(e){var r,a,o,s=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},a=s.length>2&&void 0!==s[2]?s[2]:{},t.next=4,T(e,r,h(h({},a),{},{appKey:a.appKey||i()}));case 4:return o=t.sent,t.abrupt("return",o.data);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function K(t,e){return S.apply(this,arguments)}function S(){return(S=a(n.mark((function t(e,r){var a,o,c,u,p,l=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=l.length>2&&void 0!==l[2]?l[2]:{},o=l.length>3&&void 0!==l[3]?l[3]:{},c=o.apiUrl,u=s(a),t.next=6,O("".concat(e).concat(u?"?":"").concat(u),{method:"PUT",headers:v,body:JSON.stringify(r)},{apiUrl:c,appKey:i()});case 6:return p=t.sent,t.abrupt("return",p&&p.json());case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function C(t,e){return D.apply(this,arguments)}function D(){return(D=a(n.mark((function t(e,r){var a,o,c,u,p,l=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=l.length>2&&void 0!==l[2]?l[2]:{},o=l.length>3&&void 0!==l[3]?l[3]:{},c=o.apiUrl,u=s(a),t.next=6,O("".concat(e).concat(u?"?":"").concat(u),{method:"PATCH",headers:v,body:JSON.stringify(r)},{apiUrl:c,appKey:i()});case 6:return p=t.sent,t.abrupt("return",p&&p.json());case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function N(t){return R.apply(this,arguments)}function R(){return(R=a(n.mark((function t(e){var r,a,o,c,u,p=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=p.length>1&&void 0!==p[1]?p[1]:{},a=p.length>2&&void 0!==p[2]?p[2]:{},o=a.apiUrl,c=s(r),t.next=6,O(c?"".concat(e,"?").concat(c):e,{method:"DELETE",headers:v},{apiUrl:o,appKey:i()});case 6:return u=t.sent,t.abrupt("return",u&&u.json());case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function F(t,e){return _.apply(this,arguments)}function _(){return(_=a(n.mark((function t(r,a){var o,c,u,p,l,h,f,d=arguments;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=d.length>2&&void 0!==d[2]?d[2]:{},c=d.length>3&&void 0!==d[3]?d[3]:{},u=s(o),p=c.method,l=void 0===p?"POST":p,h=new FormData,Object.entries(a).forEach((function(t){var r=e(t,2),n=r[0],a=r[1];Array.isArray(a)?a.forEach((function(t){h.append(n,t)})):h.append(n,a)})),t.next=8,O(u?"".concat(r,"?").concat(u):r,{method:l,headers:{Accept:"application/json"},body:h},{appKey:i()});case 8:return f=t.sent,t.abrupt("return",f&&f.json());case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export{y as baseUrl,N as del,A as get,T as getWithHeaders,b as handleAuthenticationProblem,C as patch,j as post,K as put,F as sendFormData};
package/clients/utils.js CHANGED
@@ -1 +1 @@
1
- var r=/corva\.ai\/(.+?)\/packages/;function a(){var a=Error.stackTraceLimit;Error.stackTraceLimit=30;var c=(new Error).stack.match(r);return Error.stackTraceLimit=a,c?c[1].replace("/app/","."):null}export{a as getDCAppKey};
1
+ import r from"@babel/runtime/helpers/defineProperty";function e(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(r);e&&(c=c.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,c)}return t}function t(t){for(var c=1;c<arguments.length;c++){var n=null!=arguments[c]?arguments[c]:{};c%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}var c=/corva\.ai\/(.+?)\/packages/,n=/app\/(.+?)\.chunk\.js/;function a(){var r=Error.stackTraceLimit;Error.stackTraceLimit=300;var e=new Error,t=e.stack.match(c)||e.stack.match(n);return Error.stackTraceLimit=r,t?t[1].replace("/app/","."):null}function o(r){var e=r.config,c=r.appKey,n=t({},e.headers||{});return c&&(n["x-corva-app"]=c),t(t({},e),{},{headers:n})}export{o as attachHTTPHeaders,a as getAppKeyFromStackTrace};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{noop as t}from"lodash";import o from"@babel/runtime/helpers/slicedToArray";import{FEED_ITEM_TYPES_BY_KEY as r,FEED_ITEM_TYPES as n}from"../../constants/feed.js";import i from"@babel/runtime/regenerator";import a from"@babel/runtime/helpers/asyncToGenerator";import s from"@material-ui/core/colors/grey";import m from"../../utils/main.js";import{isNativeDetected as p}from"../../utils/mobileDetect.js";import{jsxs as c,jsx as l}from"react/jsx-runtime";import{makeStyles as d,Paper as u,Divider as f}from"@material-ui/core";import{useState as v}from"react";import{deleteFeedItem as I,toggleFeedItemLike as h}from"../../clients/jsonApi/index.js";import y from"prop-types";import b from"classnames";import T from"../LoadingIndicator/LoadingIndicator.js";import C from"../ConfirmationDialog.js";import g from"./components/Actions.js";import F from"./components/Comments.js";import j from"./components/Content.js";import k from"./components/CreatedAt.js";import x from"./components/Icon.js";import D from"./components/Reactions.js";import N from"./components/RigAndWell.js";import R from"./components/TypeAndAssetTitle.js";import w from"./FeedItem.css.js";var P=d((function(e){return{paperRoot:{position:"relative",marginBottom:10,paddingBottom:5,backgroundColor:e.palette.background.b8},clickablePaperRoot:{"&:hover":{filter:"brightness(90%)",transition:"filter 0.3s"}},headerDividerRoot:{margin:"10px 0"}}}));function A(t){var n,d,y,A,M,O,E,_,L=t.feedItem,U=t.editebleFeedItemTypes,q=t.removeFeedItem,S=t.enterEditMode,B=t.router,G=t.currentUser,W=t.canDeleteFeedItem,z=t.appData,H=t.customFeedItemTypeTemplates,J=P(),K=v(!1),Q=o(K,2),V=Q[0],X=Q[1],Y=v(!0),Z=o(Y,2),$=Z[0],ee=Z[1],te=v(!1),oe=o(te,2),re=oe[0],ne=oe[1],ie=L.type===r.post.type,ae=U.includes(L.type),se=r[L.type].label,me=m.getUserFullName(L.user),pe=L.type===r.alert.type&&"/alerts/".concat(null===(n=L.context)||void 0===n||null===(d=n.alert)||void 0===d?void 0:d.id),ce=L.type===r.alert.type&&pe,le=(E=a(i.mark((function e(){return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return X(!0),e.prev=1,e.next=4,I(L.id);case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return");case 9:return e.prev=9,X(!1),e.finish(9);case 12:m.showSuccessNotification("Item was deleted"),q(L.id);case 14:case"end":return e.stop()}}),e,null,[[1,6,9,12]])}))),function(){return E.apply(this,arguments)}),de=(_=a(i.mark((function e(){var t;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=L.id,e.prev=1,e.next=4,h(t);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,null,[[1,6]])}))),function(){return _.apply(this,arguments)});return c(u,{"data-testid":"".concat("FeedPo","_post_").concat(null===(y=L.context)||void 0===y||null===(A=y.post)||void 0===A?void 0:A.body,"_rigName_").concat(function(e){var t,o,r;return!!e.rig?null===(t=e.rig)||void 0===t?void 0:t.name:null===(o=e.well)||void 0===o||null===(r=o.parent_asset)||void 0===r?void 0:r.name}(L)),className:b(J.paperRoot,(M={},e(M,J.clickablePaperRoot,ce),e(M,w.hideOverflow,V),M)),elevation:0,children:[c("div",{onClick:function(){ce&&B.push(pe)},className:b(w.mainContainer,(O={},e(O,w.mainContainerClickable,ce),e(O,w.mainContainerNative,p),O)),children:[l(x,{feedItem:L,classes:J,displayName:me}),c("div",{className:b(w.mainContainerTop,e({},w.mainContainerTopNative,p)),children:[l(R,{feedItem:L,userFullName:me,typeLabel:se,classes:J,isPost:ie}),c("div",{className:w.mainContainerTopMenu,children:[l(k,{feedItem:L,classes:J}),l(g,{"data-testid":"".concat("FeedPo","_actionsDropdown"),isPost:ie,isEditableItem:ae,canDeleteFeedItem:W,handleEditMenuItem:function(){S(L)},handleDeleteMenuItem:function(){ne(!0)},copyFeedItemLink:function(){var e=L.id,t="".concat(window.location.host,"/feed/").concat(e);m.copyToClipboard(t)},feedItem:L,currentUser:G})]}),l(N,{feedItem:L,isPost:ie})]}),l(f,{className:J.headerDividerRoot}),l(j,{feedItem:L,appData:z,customFeedItemTypeTemplates:H})]}),l(D,{feedItem:L,handleToggleLike:de,setOpenCommentInput:ee,openCommentInput:$,currentUser:G}),l(F,{openCommentInput:$,feedItem:L,setOpenCommentInput:ee}),V&&l("div",{className:w.loadingContainer,style:{backgroundColor:s[800]},children:l(T,{})}),re&&l(C,{open:re,title:"Delete post",text:"Are you sure you want to delete post and all attachments?",handleClose:function(){return ne(!1)},handleOk:function(){le()},okText:"Delete"})]})}A.propTypes={feedItem:y.shape().isRequired,enterEditMode:y.func,removeFeedItem:y.func,editebleFeedItemTypes:y.oneOf([n.TRACES_MEMO,n.POST]),currentUser:y.shape().isRequired,canDeleteFeedItem:y.bool.isRequired,appData:y.shape().isRequired,customFeedItemTypeTemplates:y.shape()},A.defaultProps={enterEditMode:t,removeFeedItem:t,editebleFeedItemTypes:[n.POST],customFeedItemTypeTemplates:{}};export default A;
1
+ import e from"@babel/runtime/helpers/defineProperty";import{noop as t}from"lodash";import o from"@babel/runtime/helpers/slicedToArray";import{FEED_ITEM_TYPES_BY_KEY as r,FEED_ITEM_TYPES as n}from"../../constants/feed.js";import i from"@babel/runtime/regenerator";import a from"@babel/runtime/helpers/asyncToGenerator";import s from"@material-ui/core/colors/grey";import m from"../../utils/main.js";import{isNativeDetected as p}from"../../utils/mobileDetect.js";import{jsxs as c,jsx as l}from"react/jsx-runtime";import{makeStyles as d,Paper as u,Divider as f}from"@material-ui/core";import{useState as v}from"react";import{deleteFeedItem as I,toggleFeedItemLike as h}from"../../clients/jsonApi/index.js";import y from"prop-types";import b from"classnames";import T from"../LoadingIndicator/LoadingIndicator.js";import C from"../ConfirmationDialog.js";import g from"./components/Actions.js";import F from"./components/Comments.js";import j from"./components/Content.js";import k from"./components/CreatedAt.js";import x from"./components/Icon.js";import D from"./components/Reactions.js";import N from"./components/RigAndWell.js";import R from"./components/TypeAndAssetTitle.js";import w from"./FeedItem.css.js";var P=d((function(e){return{paperRoot:{position:"relative",marginBottom:10,paddingBottom:5,backgroundColor:e.palette.background.b8},clickablePaperRoot:{"&:hover":{filter:"brightness(90%)",transition:"filter 0.3s"}},headerDividerRoot:{margin:"10px 0"}}}));function A(t){var n,d,y,A,M,O,E,_,L=t.feedItem,U=t.editebleFeedItemTypes,q=t.removeFeedItem,S=t.enterEditMode,B=t.router,G=t.currentUser,W=t.canDeleteFeedItem,z=t.appData,H=t.customFeedItemTypeTemplates,J=P(),K=v(!1),Q=o(K,2),V=Q[0],X=Q[1],Y=v(!0),Z=o(Y,2),$=Z[0],ee=Z[1],te=v(!1),oe=o(te,2),re=oe[0],ne=oe[1],ie=L.type===r.post.type,ae=U.includes(L.type),se=r[L.type].label,me=m.getUserFullName(L.user),pe=L.type===r.alert.type&&"/alerts/".concat(null===(n=L.context)||void 0===n||null===(d=n.alert)||void 0===d?void 0:d.id),ce=L.type===r.alert.type&&pe,le=(E=a(i.mark((function e(){return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return X(!0),e.prev=1,e.next=4,I(L.id);case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return");case 9:return e.prev=9,X(!1),e.finish(9);case 12:m.showSuccessNotification("Item was deleted"),q(L.id);case 14:case"end":return e.stop()}}),e,null,[[1,6,9,12]])}))),function(){return E.apply(this,arguments)}),de=(_=a(i.mark((function e(){var t;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=L.id,e.prev=1,e.next=4,h(t);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,null,[[1,6]])}))),function(){return _.apply(this,arguments)});return c(u,{"data-testid":"".concat("FeedPo","_post_").concat(null===(y=L.context)||void 0===y||null===(A=y.post)||void 0===A?void 0:A.body,"_rigName_").concat(function(e){var t,o,r;return!!e.rig?null===(t=e.rig)||void 0===t?void 0:t.name:null===(o=e.well)||void 0===o||null===(r=o.parent_asset)||void 0===r?void 0:r.name}(L)),className:b(J.paperRoot,(M={},e(M,J.clickablePaperRoot,ce),e(M,w.hideOverflow,V),M)),elevation:0,children:[c("div",{onClick:function(){ce&&B.push(pe)},className:b(w.mainContainer,(O={},e(O,w.mainContainerClickable,ce),e(O,w.mainContainerNative,p),O)),children:[l(x,{feedItem:L,classes:J,displayName:me}),c("div",{className:b(w.mainContainerTop,e({},w.mainContainerTopNative,p)),children:[l(R,{feedItem:L,userFullName:me,typeLabel:se,classes:J,isPost:ie}),c("div",{className:w.mainContainerTopMenu,children:[l(k,{feedItem:L,classes:J}),l(g,{"data-testid":"".concat("FeedPo","_actionsDropdown"),isPost:ie,isEditableItem:ae,canDeleteFeedItem:W,handleEditMenuItem:function(){S(L)},handleDeleteMenuItem:function(){ne(!0)},copyFeedItemLink:function(){var e=L.id,t="".concat(window.location.host,"/feed/").concat(e);m.copyToClipboard(t)},feedItem:L,currentUser:G})]}),l(N,{feedItem:L,isPost:ie})]}),l(f,{className:J.headerDividerRoot}),l(j,{feedItem:L,appData:z,customFeedItemTypeTemplates:H})]}),l(D,{feedItem:L,handleToggleLike:de,setOpenCommentInput:ee,openCommentInput:$,currentUser:G}),l(F,{openCommentInput:$,feedItem:L,setOpenCommentInput:ee,user:G}),V&&l("div",{className:w.loadingContainer,style:{backgroundColor:s[800]},children:l(T,{})}),re&&l(C,{open:re,title:"Delete post",text:"Are you sure you want to delete post and all attachments?",handleClose:function(){return ne(!1)},handleOk:function(){le()},okText:"Delete"})]})}A.propTypes={feedItem:y.shape().isRequired,enterEditMode:y.func,removeFeedItem:y.func,editebleFeedItemTypes:y.oneOf([n.TRACES_MEMO,n.POST]),currentUser:y.shape().isRequired,canDeleteFeedItem:y.bool.isRequired,appData:y.shape().isRequired,customFeedItemTypeTemplates:y.shape()},A.defaultProps={enterEditMode:t,removeFeedItem:t,editebleFeedItemTypes:[n.POST],customFeedItemTypeTemplates:{}};export default A;
@@ -1 +1 @@
1
- import{isNativeDetected as e}from"../../../utils/mobileDetect.js";import{jsxs as t,jsx as m}from"react/jsx-runtime";import{makeStyles as o,Divider as i}from"@material-ui/core";import r from"./FeedComments.js";var n=o({commentsDividerRoot:{margin:"5px 16px 10px 33px"},commentsDividerRootNative:{margin:"5px 16px 10px 16px"}});export default function(o){var p=o.feedItem,a=o.openCommentInput,s=n(),c=p.comments.length;return t("div",{children:[(!!c||a)&&m(i,{className:e?s.commentsDividerRootNative:s.commentsDividerRoot}),m(r,{openCommentInput:a,feedItem:p,isNative:e})]})}
1
+ import{isNativeDetected as e}from"../../../utils/mobileDetect.js";import{jsxs as t,jsx as m}from"react/jsx-runtime";import{makeStyles as o,Divider as i}from"@material-ui/core";import r from"./FeedComments.js";var n=o({commentsDividerRoot:{margin:"5px 16px 10px 33px"},commentsDividerRootNative:{margin:"5px 16px 10px 16px"}});export default function(o){var p=o.feedItem,s=o.openCommentInput,a=o.user,c=n(),d=p.comments.length;return t("div",{children:[(!!d||s)&&m(i,{className:e?c.commentsDividerRootNative:c.commentsDividerRoot}),m(r,{openCommentInput:s,feedItem:p,isNative:e,user:a})]})}
@@ -1 +1 @@
1
- import o from"moment";import e from"@babel/runtime/helpers/slicedToArray";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{makeStyles as r,Button as m,Typography as i}from"@material-ui/core";import{useState as a,useRef as s}from"react";import{postFeedItemComment as p}from"../../../clients/jsonApi/index.js";import c from"lodash/noop";import d from"prop-types";import u from"../../CommentInput/index.js";import l from"../../CommentLoader.js";import f from"../../Comment/index.js";var C=r({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 16px 0 33px"}});function h(r){var d=r.openCommentInput,h=r.feedItem,x=r.isNative,v=a(!1),y=e(v,2),I=y[0],b=y[1],j=a(3),R=e(j,2),g=R[0],k=R[1],w=s(),_=C(),q=h.comments.length,M=q>g;return t("div",{className:(d||!!q)&&_.feedCommentsContainer,children:[d&&!x&&n(u,{inputRef:w,postComment:function(o){p(h.id,o)},setIsPosting:b,companyId:h.company_id,autoFocus:!1}),M&&n(m,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:_.showMoreButtonRoot,onClick:function(){k((function(o){return 3===o?o+7:o+10}))},children:n(i,{variant:"caption",color:"primary",children:"View more comments"})}),h.comments.sort((function(e){return-o(e.created_at).unix()})).slice(0,g).reverse().map((function(o){return n(f,{comment:o,handleDeleteCallback:c,patchCommentCallback:c,companyId:h.company_id},o.id)})),I&&n(l,{})]})}h.propTypes={openCommentInput:d.bool.isRequired,feedItem:d.shape().isRequired,isNative:d.bool.isRequired};export default h;
1
+ import e from"moment";import o from"@babel/runtime/helpers/slicedToArray";import{jsxs as t,jsx as r}from"react/jsx-runtime";import{makeStyles as n,Button as m,Typography as i}from"@material-ui/core";import{useState as s,useRef as a}from"react";import{postFeedItemComment as p}from"../../../clients/jsonApi/index.js";import c from"lodash/noop";import d from"prop-types";import u from"../../CommentInput/index.js";import l from"../../CommentLoader.js";import f from"../../Comment/index.js";var C=n({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 16px 0 33px"}});function h(n){var d=n.openCommentInput,h=n.feedItem,x=n.isNative,v=n.user,y=s(!1),I=o(y,2),b=I[0],R=I[1],j=s(3),g=o(j,2),k=g[0],q=g[1],w=a(),_=C(),M=h.comments.length,N=M>k;return t("div",{className:(d||!!M)&&_.feedCommentsContainer,children:[d&&!x&&r(u,{inputRef:w,postComment:function(e){p(h.id,e)},setIsPosting:R,companyId:h.company_id,autoFocus:!1}),N&&r(m,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:_.showMoreButtonRoot,onClick:function(){q((function(e){return 3===e?e+7:e+10}))},children:r(i,{variant:"caption",color:"primary",children:"View more comments"})}),h.comments.sort((function(o){return-e(o.created_at).unix()})).slice(0,k).reverse().map((function(e){return r(f,{comment:e,handleDeleteCallback:c,patchCommentCallback:c,companyId:h.company_id,user:v},e.id)})),b&&r(l,{})]})}h.propTypes={openCommentInput:d.bool.isRequired,feedItem:d.shape().isRequired,user:d.shape().isRequired,isNative:d.bool.isRequired};export default h;
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/toConsumableArray";import t from"@babel/runtime/helpers/slicedToArray";import{jsxs as n,jsx as i}from"react/jsx-runtime";import{Table as l,TableHead as o,TableRow as c,TableCell as u,TableBody as p}from"@material-ui/core";import{useState as d}from"react";import a from"@babel/runtime/helpers/objectWithoutProperties";import s from"prop-types";import{withSize as m}from"react-sizeme";import h from"./ResizableTableHeaderCell.js";import f from"./ResizableTableCell.js";function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function v(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}var y=function(s){var m,b,y,O,j,w=s.children,P=s.size,g=a(s,["children","size"]),z=t(w,2),R=z[0],k=z[1],W=null==k||null===(m=k.props)||void 0===m?void 0:m.children,A=null==R||null===(b=R.props)||void 0===b||null===(y=b.children)||void 0===y||null===(O=y.props)||void 0===O||null===(j=O.children)||void 0===j?void 0:j.reduce((function(e,t){return Array.isArray(t)?e.push.apply(e,r(t)):e.push(t),e}),[]),C=1/((null==A?void 0:A.length)||1),D=null==A?void 0:A.map((function(e,r){return"cell".concat(r)})),T=d((function(){return null==D?void 0:D.reduce((function(r,t){return v(v({},r),{},e({},t,C))}),{})})),q=t(T,2),x=q[0],E=q[1],N=function(e){return E(e)};return n(l,v(v({},g),{},{children:[i(o,{children:i(c,{children:null==A?void 0:A.map((function(e,r){var t;return e?r===A.length-1?i(u,{children:null===(t=e.props)||void 0===t?void 0:t.children},e.key||r):i(h,{totalWidth:P.width,columnWidths:x,updateWidth:N,cellName:"cell".concat(r),nextCellName:"cell".concat(r+1),children:e},e.key||r):null}))})}),i(p,{children:null==W?void 0:W.map((function(e){var r,t;return i(c,{children:null==e||null===(r=e.props)||void 0===r||null===(t=r.children)||void 0===t?void 0:t.map((function(e,r){return e&&i(f,{totalWidth:P.width,widthRatio:x["cell".concat(r)],children:e},e.key||r)}))},e.key)}))})]}))};y.propTypes={children:s.node.isRequired,size:s.shape({width:s.number.isRequired}).isRequired};var O=m()(y);export default O;
1
+ import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/slicedToArray";import{jsxs as l,jsx as o}from"react/jsx-runtime";import{Table as t,TableHead as i,TableRow as p,TableCell as c,TableBody as u}from"@material-ui/core";import d from"@babel/runtime/helpers/objectWithoutProperties";import a from"prop-types";import s from"./ResizableTableHeaderCell.js";import m from"./ResizableTableCell.js";function b(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(r);e&&(l=l.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.push.apply(n,l)}return n}function f(e){for(var n=1;n<arguments.length;n++){var l=null!=arguments[n]?arguments[n]:{};n%2?b(Object(l),!0).forEach((function(n){r(e,n,l[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):b(Object(l)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(l,r))}))}return e}var h=function(r){var a,b,h,y,v,O=r.children,j=d(r,["children"]),P=n(O,2),g=P[0],w=P[1],k=null==w||null===(a=w.props)||void 0===a?void 0:a.children,A=null==g||null===(b=g.props)||void 0===b||null===(h=b.children)||void 0===h||null===(y=h.props)||void 0===y||null===(v=y.children)||void 0===v?void 0:v.reduce((function(r,n){return Array.isArray(n)?r.push.apply(r,e(n)):r.push(n),r}),[]);return l(t,f(f({},j),{},{children:[o(i,{children:o(p,{children:null==A?void 0:A.map((function(r,e){var n;return r?e===A.length-1?o(c,f(f({},r.props),{},{children:null===(n=r.props)||void 0===n?void 0:n.children}),r.key||e):o(s,{cellName:"cell".concat(e),children:r},r.key||e):null}))})}),o(u,{children:null==k?void 0:k.map((function(r){var e,n;return o(p,{children:null==r||null===(e=r.props)||void 0===e||null===(n=e.children)||void 0===n?void 0:n.map((function(r,e){return r&&o(m,{children:r},r.key||e)}))},r.key)}))})]}))};h.propTypes={children:a.node.isRequired};export default h;
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{jsx as r}from"react/jsx-runtime";import{makeStyles as t}from"@material-ui/core";import i from"prop-types";function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function n(r){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}var l=t({tableCellText:function(e){return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:e.width}}});function p(e){var t,i,o=e.children,p=e.widthRatio,c=e.totalWidth,u=l({width:p*c});return o?r(o.type,n(n({},o.props),{},{children:r("div",{className:u.tableCellText,children:null!==(t=null==o||null===(i=o.props)||void 0===i?void 0:i.children)&&void 0!==t?t:null})})):null}p.propTypes={children:i.node.isRequired,widthRatio:i.number.isRequired,totalWidth:i.number.isRequired};export default p;
1
+ import e from"@babel/runtime/helpers/defineProperty";import{jsx as r}from"react/jsx-runtime";import t from"prop-types";function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function i(e){var t,n,i=e.children;return i?r(i.type,o(o({},i.props),{},{children:r("div",{children:null!==(t=null==i||null===(n=i.props)||void 0===n?void 0:n.children)&&void 0!==t?t:null})})):null}i.propTypes={children:t.node.isRequired};export default i;
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as n}from"react";import o from"prop-types";import a from"classnames";import{makeStyles as l}from"@material-ui/core/styles";import d from"react-draggable";function s(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function u(r){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}var c=l((function(e){return{resizableColumnHeader:{display:"flex",paddingRight:0,justifyContent:"space-between"},tableHeaderText:function(e){return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:0,maxWidth:e.width}},tableResizer:{width:6,borderRadius:10,opacity:.7,cursor:"col-resize",marginRight:-4,marginTop:-16,marginBottom:-16},hovered:{backgroundColor:e.palette.primary.main}}}));function p(o){var l,s,p=o.children,m=o.columnWidths,f=o.updateWidth,h=o.cellName,b=o.nextCellName,g=o.totalWidth,y=o.minWidth,v=c({width:m[h]*g}),O=n(!1),w=r(O,2),x=w[0],j=w[1];if(!p)return null;return t(p.type,u(u({width:m[h]*g},p.props),{},{children:i("div",{className:v.resizableColumnHeader,children:[t("div",{className:a(v.tableHeaderText),children:null!==(l=null==p||null===(s=p.props)||void 0===s?void 0:s.children)&&void 0!==l?l:null}),t(d,{axis:"x",defaultClassName:"DragHandle",defaultClassNameDragging:"DragHandleActive",onDrag:function(r,t){!function(r){var t,i=r/g,n=(m[h]+i)*g;n===Math.max(n,y)&&f(u(u({},m),{},(e(t={},h,m[h]+i),e(t,b,m[b]-i),t)))}(t.deltaX)},position:{x:0},zIndex:999,children:t("div",{className:a(v.tableResizer,x&&v.hovered),onMouseEnter:function(){return j(!0)},onMouseLeave:function(){return j(!1)}})})]})}))}p.propTypes={children:o.node.isRequired,columnWidths:o.shape({}).isRequired,updateWidth:o.func.isRequired,cellName:o.string.isRequired,nextCellName:o.string.isRequired,minWidth:o.number,totalWidth:o.number.isRequired},p.defaultProps={minWidth:50};export default p;
1
+ import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{TableCell as n}from"@material-ui/core";import{useState as i,useEffect as l}from"react";import a from"prop-types";import c from"classnames";import{makeStyles as u}from"@material-ui/core/styles";import p from"react-draggable";function s(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function d(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var m=u((function(e){return{resizableColumnHeader:{display:"flex",paddingRight:0,justifyContent:"space-between"},tableResizer:{width:6,borderRadius:10,opacity:.7,cursor:"col-resize",marginRight:-19,marginTop:-16,marginBottom:-16},hovered:{backgroundColor:e.palette.primary.main}}}));function f(e){var a,u,s=e.children,f=e.cellName,b=m(),y=i(!1),h=r(y,2),g=h[0],v=h[1],O=i(),j=r(O,2),w=j[0],P=j[1];if(l((function(){var e;P(null===(e=document.getElementById(f))||void 0===e?void 0:e.offsetWidth)})),!s)return null;return t(n,d(d({width:w,id:f},s.props),{},{children:o("div",{className:b.resizableColumnHeader,children:[t("div",{children:null!==(a=null==s||null===(u=s.props)||void 0===u?void 0:u.children)&&void 0!==a?a:null}),t(p,{axis:"x",onDrag:function(e,r){var t=r.deltaX;r.x,r.lastX;!function(e){P(w+e)}(t)},position:{x:0},zIndex:999,onStart:function(){P(w),v(!0)},onStop:function(){v(!1)},children:t("div",{className:c(b.tableResizer,g&&b.hovered),onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)}})})]})}))}f.propTypes={children:a.node.isRequired,cellName:a.string.isRequired};export default f;
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/defineProperty";import{castArray as t,differenceBy as e,omit as n,merge as u,concat as a,mapValues as i}from"lodash";import o from"@babel/runtime/helpers/slicedToArray";import c from"@babel/runtime/regenerator";import s from"@babel/runtime/helpers/asyncToGenerator";import{useState as p,useRef as f,useMemo as l,useEffect as m}from"react";import{parse as b}from"querystring";import d from"uuid/v1";import{getDCAppKey as y}from"../clients/utils.js";import{getAppStorage as v,getDataAppStorage as h,getDataAppStorageAggregate as O}from"../clients/jsonApi/index.js";import{getSubscriptionId as w}from"../clients/subscriptions.js";function g(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function j(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}function I(r,t,e){var n=w(r,t);return j(j({},r),{},{hookId:t,subId:n,appInstanceId:n,app_key:e})}function k(r,t){return x.apply(this,arguments)}function x(){return(x=s(c.mark((function r(t,e){var n,u,a;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.timeQuery,u=e.appKey,a=t.map(function(){var r=s(c.mark((function r(t){var e,a,i,o,s,p,f,l,m;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.provider,a=t.collection,i=t.assetId,o=t.subscribeOnly,s=t.params,!o){r.next=3;break}return r.abrupt("return",null);case 3:return p=s.query,f=n?"{timestamp#lte#".concat(n.timestamp.$lte):"",l=p&&f?"AND":"",m="".concat(p).concat(l).concat(f),r.prev=7,r.next=10,v(e,a,i,j(j(j({},s),m?{query:m}:{}),{},{appKey:u}));case 10:return r.abrupt("return",r.sent);case 13:return r.prev=13,r.t0=r.catch(7),r.abrupt("return",[]);case 16:case"end":return r.stop()}}),r,null,[[7,13]])})));return function(t){return r.apply(this,arguments)}}()),r.abrupt("return",Promise.all(a));case 3:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function P(r,t){return E.apply(this,arguments)}function E(){return(E=s(c.mark((function r(t,e){var n,a,o;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.timeQuery,a=e.appKey,o=t.map(function(){var r=s(c.mark((function r(t){var e,o,s,p,f,l,m,b,d,y,v,w;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.provider,o=t.collection,s=t.assetId,p=t.subscribeOnly,f=t.params,l=void 0===f?{}:f,!p){r.next=3;break}return r.abrupt("return",null);case 3:if(!l.aggregate){r.next=5;break}return r.abrupt("return",O(e,o,j({},i(l.aggregate,JSON.stringify))));case 5:return m=JSON.stringify(u({asset_id:s},l.query,n)),b=l.limit,d=void 0===b?1:b,y=l.sort,v=void 0===y?'{"timestamp": 1}':y,r.prev=7,w=j(j({},l),{},{limit:d,sort:v,query:m,appKey:a}),r.next=11,h(e,o,w);case 11:return r.abrupt("return",r.sent);case 14:return r.prev=14,r.t0=r.catch(7),r.abrupt("return",[]);case 17:case"end":return r.stop()}}),r,null,[[7,14]])})));return function(t){return r.apply(this,arguments)}}()),r.abrupt("return",Promise.all(o));case 3:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function D(u){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=i.timestamp,s=i.isOldApiUsed,v=p({}),h=o(v,2),O=h[0],w=h[1],g=f();g.current||(g.current=d());var x=window[Symbol.for("socket")],E=x.subscribe,D=x.unsubscribe,S=x.socket,q=l((function(){return y()}),[]),A=f([]),K=t(u).map((function(r){return I(r,g.current,q)})),N=K.map((function(r){return r.subId})).join(),Q=l((function(){if(c)return{timestamp:{$lte:c}};var r=b(window.location.search).time;return r?{timestamp:{$lte:new Date(r)/1e3}}:null}),[window.location.search,c]);return m((function(){var t=function(t){t.hookId===g.current&&w((function(e){var n=t.data;return t.subId in e&&!t.subscribeOnly&&(n=a(e[t.subId],t.data)),t.params&&t.params.limit&&(n=n.slice(-t.params.limit)),j(j({},e),{},r({},t.subId,n))}))};return S&&S.on("data",t),function(){return S&&S.off("data",t)}}),[]),m((function(){A.current.forEach(D),A.current=[]}),[Q]),m((function(){var r=A.current,t=e(K,r,"subId"),u=e(r,K,"subId");t.forEach((function(r){Q&&!r.alwaysSubscribe||E(r)})),u.forEach(D),A.current=K,(s?k:P)(t,{timeQuery:Q,appKey:q,isOldApiUsed:s}).then((function(r){return w((function(e){var a=n(e,u.map((function(r){return r.subId})));return t.forEach((function(t,e){null!==r[e]&&(a[t.subId]=r[e])})),a}))}))}),[N,Q]),m((function(){return function(){return A.current.forEach(D)}}),[]),l((function(){return K.map((function(r){var t=r.subId;return{loading:!(t in O),data:O[t]}}))}),[O,N])}export default D;
1
+ import r from"@babel/runtime/helpers/defineProperty";import{castArray as t,differenceBy as e,omit as n,merge as u,concat as a,mapValues as i}from"lodash";import o from"@babel/runtime/helpers/slicedToArray";import c from"@babel/runtime/regenerator";import s from"@babel/runtime/helpers/asyncToGenerator";import{useState as p,useRef as f,useMemo as l,useEffect as m}from"react";import{parse as b}from"querystring";import d from"uuid/v1";import{getAppKeyFromStackTrace as y}from"../clients/utils.js";import{getAppStorage as v,getDataAppStorage as h,getDataAppStorageAggregate as O}from"../clients/jsonApi/index.js";import{getSubscriptionId as w}from"../clients/subscriptions.js";function g(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function j(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}function I(r,t,e){var n=w(r,t);return j(j({},r),{},{hookId:t,subId:n,appInstanceId:n,app_key:e})}function k(r,t){return x.apply(this,arguments)}function x(){return(x=s(c.mark((function r(t,e){var n,u,a;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.timeQuery,u=e.appKey,a=t.map(function(){var r=s(c.mark((function r(t){var e,a,i,o,s,p,f,l,m;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.provider,a=t.collection,i=t.assetId,o=t.subscribeOnly,s=t.params,!o){r.next=3;break}return r.abrupt("return",null);case 3:return p=s.query,f=n?"{timestamp#lte#".concat(n.timestamp.$lte):"",l=p&&f?"AND":"",m="".concat(p).concat(l).concat(f),r.prev=7,r.next=10,v(e,a,i,j(j(j({},s),m?{query:m}:{}),{},{appKey:u}));case 10:return r.abrupt("return",r.sent);case 13:return r.prev=13,r.t0=r.catch(7),r.abrupt("return",[]);case 16:case"end":return r.stop()}}),r,null,[[7,13]])})));return function(t){return r.apply(this,arguments)}}()),r.abrupt("return",Promise.all(a));case 3:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function P(r,t){return E.apply(this,arguments)}function E(){return(E=s(c.mark((function r(t,e){var n,a,o;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.timeQuery,a=e.appKey,o=t.map(function(){var r=s(c.mark((function r(t){var e,o,s,p,f,l,m,b,d,y,v,w;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.provider,o=t.collection,s=t.assetId,p=t.subscribeOnly,f=t.params,l=void 0===f?{}:f,!p){r.next=3;break}return r.abrupt("return",null);case 3:if(!l.aggregate){r.next=5;break}return r.abrupt("return",O(e,o,j({},i(l.aggregate,JSON.stringify))));case 5:return m=JSON.stringify(u({asset_id:s},l.query,n)),b=l.limit,d=void 0===b?1:b,y=l.sort,v=void 0===y?'{"timestamp": 1}':y,r.prev=7,w=j(j({},l),{},{limit:d,sort:v,query:m,appKey:a}),r.next=11,h(e,o,w);case 11:return r.abrupt("return",r.sent);case 14:return r.prev=14,r.t0=r.catch(7),r.abrupt("return",[]);case 17:case"end":return r.stop()}}),r,null,[[7,14]])})));return function(t){return r.apply(this,arguments)}}()),r.abrupt("return",Promise.all(o));case 3:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function D(u){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=i.timestamp,s=i.isOldApiUsed,v=p({}),h=o(v,2),O=h[0],w=h[1],g=f();g.current||(g.current=d());var x=window[Symbol.for("socket")],E=x.subscribe,D=x.unsubscribe,S=x.socket,q=l((function(){return y()}),[]),A=f([]),K=t(u).map((function(r){return I(r,g.current,q)})),N=K.map((function(r){return r.subId})).join(),Q=l((function(){if(c)return{timestamp:{$lte:c}};var r=b(window.location.search).time;return r?{timestamp:{$lte:new Date(r)/1e3}}:null}),[window.location.search,c]);return m((function(){var t=function(t){t.hookId===g.current&&w((function(e){var n=t.data;return t.subId in e&&!t.subscribeOnly&&(n=a(e[t.subId],t.data)),t.params&&t.params.limit&&(n=n.slice(-t.params.limit)),j(j({},e),{},r({},t.subId,n))}))};return S&&S.on("data",t),function(){return S&&S.off("data",t)}}),[]),m((function(){A.current.forEach(D),A.current=[]}),[Q]),m((function(){var r=A.current,t=e(K,r,"subId"),u=e(r,K,"subId");t.forEach((function(r){Q&&!r.alwaysSubscribe||E(r)})),u.forEach(D),A.current=K,(s?k:P)(t,{timeQuery:Q,appKey:q,isOldApiUsed:s}).then((function(r){return w((function(e){var a=n(e,u.map((function(r){return r.subId})));return t.forEach((function(t,e){null!==r[e]&&(a[t.subId]=r[e])})),a}))}))}),[N,Q]),m((function(){return function(){return A.current.forEach(D)}}),[]),l((function(){return K.map((function(r){var t=r.subId;return{loading:!(t in O),data:O[t]}}))}),[O,N])}export default D;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.33.0-5",
3
+ "version": "0.33.0-8",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"