Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vizzly/components

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vizzly/components - npm Package Compare versions

Comparing version 0.0.100 to 0.0.101

4

dist/components.cjs.development.js

@@ -1324,5 +1324,3 @@ 'use strict';

componentId: component.id,
apiConfig: {
host: 'http://0.0.0.0:7080'
}
apiConfig: apiConfig
}, React__default.createElement(Component, {

@@ -1329,0 +1327,0 @@ type: latestVersion$1 == null ? void 0 : latestVersion$1.type,

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=e(t),n=require("lodash"),o=require("@vizzly/puppet"),i=e(require("isomorphic-fetch")),u=require("node-jose");function a(){a=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",u=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=b(u,r);if(a){if(a===p)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,i),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var p={};function f(){}function h(){}function d(){}var m={};s(m,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(L([])));y&&y!==t&&r.call(y,o)&&(m=y);var g=d.prototype=f.prototype=Object.create(m);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,i){function u(){return new t((function(n,u){!function n(o,i,u,a){var s=l(e[o],e,i);if("throw"!==s.type){var c=s.arg,p=c.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,u,a)}),(function(e){n("throw",e,u,a)})):t.resolve(p).then((function(e){c.value=e,u(c)}),(function(e){return n("throw",e,u,a)}))}a(s.arg)}(o,i,n,u)}))}return n=n?n.then(u,u):u()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=d,s(g,"constructor",d),s(d,"constructor",h),h.displayName=s(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},x(w.prototype),s(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new w(c(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},x(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=L,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return u.type="throw",u.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function s(e,t,r,n,o,i,u){try{var a=e[i](u),s=a.value}catch(e){return void r(e)}a.done?t(s):Promise.resolve(s).then(n,o)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){s(i,n,o,u,a,"next",e)}function a(e){s(i,n,o,u,a,"throw",e)}u(void 0)}))}}function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var p=function(e){return{id:e.id,dataType:e.type,title:e.title}},f=function(e){return n.replace(e,"_"," ")},h=function(e){return{fields:[].concat(e.fields).map(p)}},d=function(e){var t=e.versions.map((function(e){return{type:e.frontend_context.type,title:e.title,description:e.description,props:e.frontend_context.props,libraryVersion:e.frontend_context.libraryVersion,secureFilters:e.secure_filters.map((function(e){return{field:e.field,op:e.operator,exampleValue:e.example_value}})),savedAt:e.inserted_at}}));return{id:e.id,dataSets:e.data_sets.map(h),versions:t}},m=function(e){return n.last(e.versions)},v=function(e,t){return n.flatMap([].concat(e),(function(e){var r;return(null==(r=m(e))?void 0:r.libraryVersion)==t?[e]:[]}))},y=function(e){return function(){var t=c(a().mark((function t(r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/component/"+r,method:"get"});case 2:if(o=(n=t.sent).body,200!=n.status){t.next=7;break}return t.abrupt("return",d(o));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},g=function(e){return e.content=e.content.map((function(t){return t.map((function(t,r){return function(e,t){if(null===e)return null;switch(t){case"date_time":return new Date(e);case"number":case"string":return e;case"boolean":return!!e}throw"Cannot parse value of unrecognised type."}(t,e.fields[r].dataType)}))})),e},x=function(e){return function(){var t=c(a().mark((function t(r,n,o){var i,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/create-result",method:"post",body:{queries:n.map((function(e){return w(e,r)}))},abortSignal:o});case 2:if(u=(i=t.sent).body,200!=i.status){t.next=7;break}return t.abrupt("return",u.results.map(g));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()},w=function(e,t){var r,n=e.timeDimension;return n&&(n=l({},n,{timeZone:null!=(r=n.timeZone)?r:o.Utils.DateTime.currentTimezone()})),l({},e,{componentId:t,timeDimension:n})},b=function(e){return function(){var t=c(a().mark((function t(r,n){var o,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/organisation/"+r+"/studio-components/"+n,method:"get"});case 2:if(i=(o=t.sent).body,200!=o.status){t.next=7;break}return t.abrupt("return",i.components.map(d));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},C=function(e){return function(){var t=c(a().mark((function t(r,n,o){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/dashboard/"+r+"/studio-component",method:"post",body:{component_id:n,position:o}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()},E=function(e){return function(){var t=c(a().mark((function t(r){var n,o,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.authToken?{auth:"Bearer "+e.authToken}:{},o=r.headers||{},t.next=4,i(""+e.host+r.path,{method:r.method,headers:l({"Content-Type":"application/json",Accept:"application/json"},n,o),redirect:"follow",referrerPolicy:"no-referrer",body:r.body?JSON.stringify(r.body):null,signal:r.abortSignal});case 4:return u=t.sent,t.next=7,u.json();case 7:return t.abrupt("return",{body:t.sent,status:u.status});case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},S=function(e,t,r,n,o,i,u){var a={measure:e,order:t,filter:r,dimension:n,timeDimension:o,limit:i,secureFilter:u||[]};return L(a)?a:null},L=function(e){return null!==e&&!n.isEmpty(e.measure)},P=function(e,t){return l({},e,{secureFilter:t})},O=function(e,r,o,i,u,s){r=r.map((function(e){return function(e,t){return n.isEmpty(e.filter)&&(e.filter=[[]]),l({},e,{filter:[].concat(e.filter).map((function(e){return[].concat(e,t.map((function(e){return{field:e.field,op:e.op,value:e.exampleValue}})))}))})}(e,s||[])})),t.useEffect((function(){var t=new AbortController,s=function(){var n=c(a().mark((function n(){var s,c,l;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=[],!u){n.next=6;break}return n.next=4,u();case 4:(c=n.sent)&&(s=[].concat(c));case 6:return r=r.map((function(e){return P(e,s)})),n.next=9,e.createQueryResult(o,r,t.signal);case 9:(l=n.sent)&&i(l,r);case 11:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();return o&&!n.isEmpty(r)&&s(),function(){t.abort()}}),[JSON.stringify(o),JSON.stringify(r)])},k=function(e){if(!e)return null;var t=E(e);return{config:e,getComponent:y(t),createQueryResult:x(t),getStudioComponents:b(t),addComponentToDashboard:C(t)}},j=require("../package.json").version,q=function(){throw"Function not initialised."},_=r.createContext({component:null,version:null,apiConfig:null,results:[],queries:[],setResults:q,setProps:q,setStyleProps:q,setTitle:q,setChartType:q,setDescription:q,setLibraryVersion:q,setVersion:q,setSavedAt:q,setSecureFilters:q}),V=function(e){var o=e.children,i=e.apiConfig,u=e.componentId,s=r.useState({apiConfig:i,results:[],queries:[],component:null,version:null}),p=s[0],f=s[1];t.useEffect((function(){!function(){var e=c(a().mark((function e(){var t,r,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(t=k(i))?void 0:t.getComponent(u);case 2:(r=e.sent)&&(o=m(r),n.isEmpty(null==o?void 0:o.secureFilters),f(l({},p,{queries:[],results:[],component:r,version:o||null})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[u]);var h=l({},p,{setChartType:function(e){return function(e,t,r){t(l({},e,{results:[],queries:[],version:l({},e.version,{type:r})}))}(p,f,e)},setDescription:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{description:r})}))}(p,f,e)},setTitle:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{title:r})}))}(p,f,e)},setLibraryVersion:function(e){return function(e,t,r){t(l({},e,{results:[],queries:[],version:l({},e.version,{libraryVersion:r})}))}(p,f,e)},setProps:function(e){return function(e,t,r){t(l({},e,{results:[],queries:[],version:l({},e.version,{props:l({},r)})}))}(p,f,e)},setStyleProps:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{props:l({},r)})}))}(p,f,e)},setResults:function(e,t){return function(e,t,r,n){t(l({},e,{results:r,queries:n}))}(p,f,e,t)},setVersion:function(e){return function(e,t,r){t(l({},e,{version:r,results:[],queries:[]}))}(p,f,e)},setSavedAt:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{savedAt:r})}))}(p,f,e)},setSecureFilters:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{secureFilters:r}),results:[],queries:[]}))}(p,f,e)}});return r.createElement(_.Provider,{value:h},o)},F=function(){return r.useContext(_)},T=function(){return r.useContext(_)},D=function(){return r.useContext(_)},A=function(){return r.useContext(_)},I=function(){return r.useContext(_)},N=function(e,t,r,n,o,i){var u=[];r.xMeasure&&u.push(r.xMeasure),r.yMeasure&&u.push(r.yMeasure);var a=S(u,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(a)?[a]:[],t,n,o,i)},R=function(e){var t=A(),i=t.apiConfig,u=t.setResults,a=t.component,s=t.results,c=t.queries,l=t.version,p=o.mergeProps(e,null==l?void 0:l.props,o.Components.LineChartView.defaultProps);return N(i,null==a?void 0:a.id,p,u,e.secureFilterCallback),n.isEmpty(s)?null:r.createElement(o.Components.ScatterChartView,Object.assign({},p,{result:s[0],query:c[0]}))},M=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},G=function(e){var t=T(),i=t.apiConfig,u=t.results,a=t.component,s=t.queries,c=t.version,l=t.setResults,p=o.mergeProps(e,null==c?void 0:c.props,o.Components.LineChartView.defaultProps);return M(i,null==a?void 0:a.id,p,l,e.secureFilterCallback),n.isEmpty(u)?null:r.createElement(o.Components.BarChartView,Object.assign({},p,{result:u[0],query:s[0]}))},Q=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},J=function(e){var t=F(),i=t.apiConfig,u=t.results,a=t.queries,s=t.version,c=t.component,l=t.setResults,p=o.mergeProps(e,null==s?void 0:s.props,o.Components.LineChartView.defaultProps);return Q(i,null==c?void 0:c.id,p,l,e.secureFilterCallback),n.isEmpty(u)?null:r.createElement(o.Components.LineChartView,Object.assign({},p,{result:u[0],query:a[0]}))},z=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,null,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},B=function(e){var t=I(),i=t.apiConfig,u=t.component,a=t.setResults,s=t.results,c=t.queries,l=t.version,p=o.mergeProps(e,null==l?void 0:l.props,o.Components.LineChartView.defaultProps);return z(i,null==u?void 0:u.id,p,a,e.secureFilterCallback),n.isEmpty(s)?null:r.createElement(o.Components.PieChartView,Object.assign({},p,{result:s[0],query:c[0]}))},K=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},U=function(e){var t=D(),i=t.apiConfig,u=t.component,a=t.setResults,s=t.results,c=t.queries,l=t.version,p=o.mergeProps(e,null==l?void 0:l.props,o.Components.LineChartView.defaultProps);return K(i,null==u?void 0:u.id,p,a,e.secureFilterCallback),n.isEmpty(s)?null:r.createElement(o.Components.AreaChartView,Object.assign({},p,{result:s[0],query:c[0]}))},W=function(e){if("scatterChart"==e.type)return r.createElement(R,Object.assign({},e.componentProps));if("barChart"==e.type)return r.createElement(G,Object.assign({},e.componentProps));if("areaChart"==e.type)return r.createElement(U,Object.assign({},e.componentProps));if("lineChart"==e.type)return r.createElement(J,Object.assign({},e.componentProps));if("pieChart"==e.type)return r.createElement(B,Object.assign({},e.componentProps));throw"Unsupported component in generic component."},Y=["lineChart","barChart","areaChart"],Z=function(e,t){return Y.includes(e)?function(e,t){var r="",o=t.measure,i=t.dimension,u=t.timeDimension;return o[0]&&i&&(r=n.capitalize(o[0].aggregate)+" of '"+f(o[0].field)+"'",i&&(r+=", grouped by '"+i+"'"),u&&(r+=", on a "+function(e){if("day"==e)return"daily";if("month"==e)return"monthly";if("year"==e)return"annually";if("second"==e)return"per second";if("hour"==e)return"per hour";if("minute"==e)return"per minute";throw"Unsupported titme truncate value."}(u.truncate)+" basis.")),r}(0,t):"scatterChart"==e?function(e){var t="",r=e.xMeasure,o=e.yMeasure,i=e.dimension;return r&&o&&(t=n.capitalize(r.aggregate)+" of '"+f(r.field)+"' by "+o.aggregate+" of '"+f(o.field)+"'",i&&(t+=", grouped by '"+i+"'.")),t}(t):(console.warn("Summary requested for unsupported component "+e+"."),"")};function H(e,t){return new Date(e.getTime()+6e4*t)}var X=function(e){return function(){var t=c(a().mark((function t(r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.privateKey,t.next=3,u.JWK.asKey(n,"pem");case 3:return o=t.sent,t.next=6,u.JWS.createSign({alg:"ES256",format:"compact"},o).update(JSON.stringify(r),"utf8").final();case 6:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},$=function(e){return c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,X(e)({expires:H(new Date,e.ttlInMinutes).toISOString()});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))},ee=function(e){return function(){var t=c(a().mark((function t(r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,X(e)({filter:r,expires:H(new Date,e.ttlInMinutes).toISOString()});case 2:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};exports.AreaChart=U,exports.BarChart=G,exports.ComponentContextProvider=V,exports.LineChart=J,exports.ScatterChart=R,exports.Studio=function(e){var n=e.organisationId,i=e.studioComponentsTag,u=function(e,n,o){var i=t.useState(null),u=i[0],s=i[1];return r.useEffect((function(){u||function(){var t=c(a().mark((function t(){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getStudioComponents(n,o);case 2:(r=v(r=t.sent,j))&&s(r);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[n,o]),u}(k(e.apiConfig),n,i),s=t.useState(null),p=s[0],f=s[1],h=t.useState({}),d=h[0],y=h[1],g=null!=p;return u?r.createElement(o.Components.StudioView,{onSelectComponent:function(e){if(p){var t,n=u[e],o=m(n);y(l({},d,((t={})[p]=function(){return r.createElement(r.Fragment,null,r.createElement(V,{componentId:n.id,apiConfig:{host:"http://0.0.0.0:7080"}},r.createElement(W,{type:null==o?void 0:o.type,componentProps:null==o?void 0:o.props})))},t))),f(null)}},onSelectComponentPlaceholder:f,componentOptions:[].concat(u).map((function(e){var t=m(e);return{title:null==t?void 0:t.title,summary:Z(null==t?void 0:t.type,null==t?void 0:t.props),type:null==t?void 0:t.type}})),templateRenderCallbacks:d,showDrawer:g,onCloseDrawer:function(){return f(null)},templateId:"demo"}):r.createElement("p",null,"loading studio components")},exports.auth=function(e){return{accessToken:$(e),signFilter:ee(e)}},exports.componentSummary=Z,exports.createQueryResult=x,exports.httpClient=E,exports.useAreaChart=D,exports.useAreaChartQueryEffect=K,exports.useBarChart=T,exports.useBarChartQueryEffect=M,exports.useComponentContext=function(){return r.useContext(_)},exports.useLineChart=F,exports.useLineChartQueryEffect=Q,exports.usePieChart=I,exports.usePieChartQueryEffect=z,exports.useScatterChart=A,exports.useScatterChartQueryEffect=N;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=e(t),n=require("lodash"),o=require("@vizzly/puppet"),i=e(require("isomorphic-fetch")),u=require("node-jose");function a(){a=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",u=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=b(u,r);if(a){if(a===p)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,i),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var p={};function f(){}function h(){}function d(){}var m={};s(m,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(L([])));y&&y!==t&&r.call(y,o)&&(m=y);var g=d.prototype=f.prototype=Object.create(m);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,i){function u(){return new t((function(n,u){!function n(o,i,u,a){var s=l(e[o],e,i);if("throw"!==s.type){var c=s.arg,p=c.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,u,a)}),(function(e){n("throw",e,u,a)})):t.resolve(p).then((function(e){c.value=e,u(c)}),(function(e){return n("throw",e,u,a)}))}a(s.arg)}(o,i,n,u)}))}return n=n?n.then(u,u):u()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=d,s(g,"constructor",d),s(d,"constructor",h),h.displayName=s(d,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},x(w.prototype),s(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new w(c(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},x(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=L,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return u.type="throw",u.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function s(e,t,r,n,o,i,u){try{var a=e[i](u),s=a.value}catch(e){return void r(e)}a.done?t(s):Promise.resolve(s).then(n,o)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){s(i,n,o,u,a,"next",e)}function a(e){s(i,n,o,u,a,"throw",e)}u(void 0)}))}}function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var p=function(e){return{id:e.id,dataType:e.type,title:e.title}},f=function(e){return n.replace(e,"_"," ")},h=function(e){return{fields:[].concat(e.fields).map(p)}},d=function(e){var t=e.versions.map((function(e){return{type:e.frontend_context.type,title:e.title,description:e.description,props:e.frontend_context.props,libraryVersion:e.frontend_context.libraryVersion,secureFilters:e.secure_filters.map((function(e){return{field:e.field,op:e.operator,exampleValue:e.example_value}})),savedAt:e.inserted_at}}));return{id:e.id,dataSets:e.data_sets.map(h),versions:t}},m=function(e){return n.last(e.versions)},v=function(e,t){return n.flatMap([].concat(e),(function(e){var r;return(null==(r=m(e))?void 0:r.libraryVersion)==t?[e]:[]}))},y=function(e){return function(){var t=c(a().mark((function t(r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/component/"+r,method:"get"});case 2:if(o=(n=t.sent).body,200!=n.status){t.next=7;break}return t.abrupt("return",d(o));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},g=function(e){return e.content=e.content.map((function(t){return t.map((function(t,r){return function(e,t){if(null===e)return null;switch(t){case"date_time":return new Date(e);case"number":case"string":return e;case"boolean":return!!e}throw"Cannot parse value of unrecognised type."}(t,e.fields[r].dataType)}))})),e},x=function(e){return function(){var t=c(a().mark((function t(r,n,o){var i,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/create-result",method:"post",body:{queries:n.map((function(e){return w(e,r)}))},abortSignal:o});case 2:if(u=(i=t.sent).body,200!=i.status){t.next=7;break}return t.abrupt("return",u.results.map(g));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()},w=function(e,t){var r,n=e.timeDimension;return n&&(n=l({},n,{timeZone:null!=(r=n.timeZone)?r:o.Utils.DateTime.currentTimezone()})),l({},e,{componentId:t,timeDimension:n})},b=function(e){return function(){var t=c(a().mark((function t(r,n){var o,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/organisation/"+r+"/studio-components/"+n,method:"get"});case 2:if(i=(o=t.sent).body,200!=o.status){t.next=7;break}return t.abrupt("return",i.components.map(d));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},C=function(e){return function(){var t=c(a().mark((function t(r,n,o){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/dashboard/"+r+"/studio-component",method:"post",body:{component_id:n,position:o}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()},E=function(e){return function(){var t=c(a().mark((function t(r){var n,o,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.authToken?{auth:"Bearer "+e.authToken}:{},o=r.headers||{},t.next=4,i(""+e.host+r.path,{method:r.method,headers:l({"Content-Type":"application/json",Accept:"application/json"},n,o),redirect:"follow",referrerPolicy:"no-referrer",body:r.body?JSON.stringify(r.body):null,signal:r.abortSignal});case 4:return u=t.sent,t.next=7,u.json();case 7:return t.abrupt("return",{body:t.sent,status:u.status});case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},S=function(e,t,r,n,o,i,u){var a={measure:e,order:t,filter:r,dimension:n,timeDimension:o,limit:i,secureFilter:u||[]};return L(a)?a:null},L=function(e){return null!==e&&!n.isEmpty(e.measure)},P=function(e,t){return l({},e,{secureFilter:t})},O=function(e,r,o,i,u,s){r=r.map((function(e){return function(e,t){return n.isEmpty(e.filter)&&(e.filter=[[]]),l({},e,{filter:[].concat(e.filter).map((function(e){return[].concat(e,t.map((function(e){return{field:e.field,op:e.op,value:e.exampleValue}})))}))})}(e,s||[])})),t.useEffect((function(){var t=new AbortController,s=function(){var n=c(a().mark((function n(){var s,c,l;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=[],!u){n.next=6;break}return n.next=4,u();case 4:(c=n.sent)&&(s=[].concat(c));case 6:return r=r.map((function(e){return P(e,s)})),n.next=9,e.createQueryResult(o,r,t.signal);case 9:(l=n.sent)&&i(l,r);case 11:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();return o&&!n.isEmpty(r)&&s(),function(){t.abort()}}),[JSON.stringify(o),JSON.stringify(r)])},k=function(e){if(!e)return null;var t=E(e);return{config:e,getComponent:y(t),createQueryResult:x(t),getStudioComponents:b(t),addComponentToDashboard:C(t)}},j=require("../package.json").version,q=function(){throw"Function not initialised."},_=r.createContext({component:null,version:null,apiConfig:null,results:[],queries:[],setResults:q,setProps:q,setStyleProps:q,setTitle:q,setChartType:q,setDescription:q,setLibraryVersion:q,setVersion:q,setSavedAt:q,setSecureFilters:q}),V=function(e){var o=e.children,i=e.apiConfig,u=e.componentId,s=r.useState({apiConfig:i,results:[],queries:[],component:null,version:null}),p=s[0],f=s[1];t.useEffect((function(){!function(){var e=c(a().mark((function e(){var t,r,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(t=k(i))?void 0:t.getComponent(u);case 2:(r=e.sent)&&(o=m(r),n.isEmpty(null==o?void 0:o.secureFilters),f(l({},p,{queries:[],results:[],component:r,version:o||null})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[u]);var h=l({},p,{setChartType:function(e){return function(e,t,r){t(l({},e,{results:[],queries:[],version:l({},e.version,{type:r})}))}(p,f,e)},setDescription:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{description:r})}))}(p,f,e)},setTitle:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{title:r})}))}(p,f,e)},setLibraryVersion:function(e){return function(e,t,r){t(l({},e,{results:[],queries:[],version:l({},e.version,{libraryVersion:r})}))}(p,f,e)},setProps:function(e){return function(e,t,r){t(l({},e,{results:[],queries:[],version:l({},e.version,{props:l({},r)})}))}(p,f,e)},setStyleProps:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{props:l({},r)})}))}(p,f,e)},setResults:function(e,t){return function(e,t,r,n){t(l({},e,{results:r,queries:n}))}(p,f,e,t)},setVersion:function(e){return function(e,t,r){t(l({},e,{version:r,results:[],queries:[]}))}(p,f,e)},setSavedAt:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{savedAt:r})}))}(p,f,e)},setSecureFilters:function(e){return function(e,t,r){t(l({},e,{version:l({},e.version,{secureFilters:r}),results:[],queries:[]}))}(p,f,e)}});return r.createElement(_.Provider,{value:h},o)},F=function(){return r.useContext(_)},T=function(){return r.useContext(_)},D=function(){return r.useContext(_)},A=function(){return r.useContext(_)},I=function(){return r.useContext(_)},N=function(e,t,r,n,o,i){var u=[];r.xMeasure&&u.push(r.xMeasure),r.yMeasure&&u.push(r.yMeasure);var a=S(u,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(a)?[a]:[],t,n,o,i)},R=function(e){var t=A(),i=t.apiConfig,u=t.setResults,a=t.component,s=t.results,c=t.queries,l=t.version,p=o.mergeProps(e,null==l?void 0:l.props,o.Components.LineChartView.defaultProps);return N(i,null==a?void 0:a.id,p,u,e.secureFilterCallback),n.isEmpty(s)?null:r.createElement(o.Components.ScatterChartView,Object.assign({},p,{result:s[0],query:c[0]}))},M=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},G=function(e){var t=T(),i=t.apiConfig,u=t.results,a=t.component,s=t.queries,c=t.version,l=t.setResults,p=o.mergeProps(e,null==c?void 0:c.props,o.Components.LineChartView.defaultProps);return M(i,null==a?void 0:a.id,p,l,e.secureFilterCallback),n.isEmpty(u)?null:r.createElement(o.Components.BarChartView,Object.assign({},p,{result:u[0],query:s[0]}))},Q=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},J=function(e){var t=F(),i=t.apiConfig,u=t.results,a=t.queries,s=t.version,c=t.component,l=t.setResults,p=o.mergeProps(e,null==s?void 0:s.props,o.Components.LineChartView.defaultProps);return Q(i,null==c?void 0:c.id,p,l,e.secureFilterCallback),n.isEmpty(u)?null:r.createElement(o.Components.LineChartView,Object.assign({},p,{result:u[0],query:a[0]}))},z=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,null,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},B=function(e){var t=I(),i=t.apiConfig,u=t.component,a=t.setResults,s=t.results,c=t.queries,l=t.version,p=o.mergeProps(e,null==l?void 0:l.props,o.Components.LineChartView.defaultProps);return z(i,null==u?void 0:u.id,p,a,e.secureFilterCallback),n.isEmpty(s)?null:r.createElement(o.Components.PieChartView,Object.assign({},p,{result:s[0],query:c[0]}))},K=function(e,t,r,n,o,i){var u=S(r.measure,r.order,r.filter,r.dimension,r.timeDimension,r.limit);O(k(e),L(u)?[u]:[],t,n,o,i)},U=function(e){var t=D(),i=t.apiConfig,u=t.component,a=t.setResults,s=t.results,c=t.queries,l=t.version,p=o.mergeProps(e,null==l?void 0:l.props,o.Components.LineChartView.defaultProps);return K(i,null==u?void 0:u.id,p,a,e.secureFilterCallback),n.isEmpty(s)?null:r.createElement(o.Components.AreaChartView,Object.assign({},p,{result:s[0],query:c[0]}))},W=function(e){if("scatterChart"==e.type)return r.createElement(R,Object.assign({},e.componentProps));if("barChart"==e.type)return r.createElement(G,Object.assign({},e.componentProps));if("areaChart"==e.type)return r.createElement(U,Object.assign({},e.componentProps));if("lineChart"==e.type)return r.createElement(J,Object.assign({},e.componentProps));if("pieChart"==e.type)return r.createElement(B,Object.assign({},e.componentProps));throw"Unsupported component in generic component."},Y=["lineChart","barChart","areaChart"],Z=function(e,t){return Y.includes(e)?function(e,t){var r="",o=t.measure,i=t.dimension,u=t.timeDimension;return o[0]&&i&&(r=n.capitalize(o[0].aggregate)+" of '"+f(o[0].field)+"'",i&&(r+=", grouped by '"+i+"'"),u&&(r+=", on a "+function(e){if("day"==e)return"daily";if("month"==e)return"monthly";if("year"==e)return"annually";if("second"==e)return"per second";if("hour"==e)return"per hour";if("minute"==e)return"per minute";throw"Unsupported titme truncate value."}(u.truncate)+" basis.")),r}(0,t):"scatterChart"==e?function(e){var t="",r=e.xMeasure,o=e.yMeasure,i=e.dimension;return r&&o&&(t=n.capitalize(r.aggregate)+" of '"+f(r.field)+"' by "+o.aggregate+" of '"+f(o.field)+"'",i&&(t+=", grouped by '"+i+"'.")),t}(t):(console.warn("Summary requested for unsupported component "+e+"."),"")};function H(e,t){return new Date(e.getTime()+6e4*t)}var X=function(e){return function(){var t=c(a().mark((function t(r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.privateKey,t.next=3,u.JWK.asKey(n,"pem");case 3:return o=t.sent,t.next=6,u.JWS.createSign({alg:"ES256",format:"compact"},o).update(JSON.stringify(r),"utf8").final();case 6:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},$=function(e){return c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,X(e)({expires:H(new Date,e.ttlInMinutes).toISOString()});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))},ee=function(e){return function(){var t=c(a().mark((function t(r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,X(e)({filter:r,expires:H(new Date,e.ttlInMinutes).toISOString()});case 2:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};exports.AreaChart=U,exports.BarChart=G,exports.ComponentContextProvider=V,exports.LineChart=J,exports.ScatterChart=R,exports.Studio=function(e){var n=e.organisationId,i=e.studioComponentsTag,u=e.apiConfig,s=function(e,n,o){var i=t.useState(null),u=i[0],s=i[1];return r.useEffect((function(){u||function(){var t=c(a().mark((function t(){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getStudioComponents(n,o);case 2:(r=v(r=t.sent,j))&&s(r);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[n,o]),u}(k(u),n,i),p=t.useState(null),f=p[0],h=p[1],d=t.useState({}),y=d[0],g=d[1],x=null!=f;return s?r.createElement(o.Components.StudioView,{onSelectComponent:function(e){if(f){var t,n=s[e],o=m(n);g(l({},y,((t={})[f]=function(){return r.createElement(r.Fragment,null,r.createElement(V,{componentId:n.id,apiConfig:u},r.createElement(W,{type:null==o?void 0:o.type,componentProps:null==o?void 0:o.props})))},t))),h(null)}},onSelectComponentPlaceholder:h,componentOptions:[].concat(s).map((function(e){var t=m(e);return{title:null==t?void 0:t.title,summary:Z(null==t?void 0:t.type,null==t?void 0:t.props),type:null==t?void 0:t.type}})),templateRenderCallbacks:y,showDrawer:x,onCloseDrawer:function(){return h(null)},templateId:"demo"}):r.createElement("p",null,"loading studio components")},exports.auth=function(e){return{accessToken:$(e),signFilter:ee(e)}},exports.componentSummary=Z,exports.createQueryResult=x,exports.httpClient=E,exports.useAreaChart=D,exports.useAreaChartQueryEffect=K,exports.useBarChart=T,exports.useBarChartQueryEffect=M,exports.useComponentContext=function(){return r.useContext(_)},exports.useLineChart=F,exports.useLineChartQueryEffect=Q,exports.usePieChart=I,exports.usePieChartQueryEffect=z,exports.useScatterChart=A,exports.useScatterChartQueryEffect=N;
//# sourceMappingURL=components.cjs.production.min.js.map

@@ -1317,5 +1317,3 @@ import React, { useEffect, useState } from 'react';

componentId: component.id,
apiConfig: {
host: 'http://0.0.0.0:7080'
}
apiConfig: apiConfig
}, React.createElement(Component, {

@@ -1322,0 +1320,0 @@ type: latestVersion$1 == null ? void 0 : latestVersion$1.type,

{
"name": "@vizzly/components",
"author": "James Bowers",
"version": "0.0.100",
"version": "0.0.101",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc