@bygd/nc-report-ui 0.1.40 → 0.1.41

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,6 +1,6 @@
1
1
  var n,l$1,u$2,i$1,r$2,o$1,e$1,f$2,c$1,a$1,s$1,h$1,p$1,v$1,y$1,d$1={},w$2=[],_$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g$2=Array.isArray;function m$1(n,l){for(var u in l)n[u]=l[u];return n}function b$1(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function k$2(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) void 0===e[o]&&(e[o]=l.defaultProps[o]);return x$2(l,e,i,r,null)}function x$2(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$2:o,__i:-1,__u:0};return null==o&&null!=l$1.vnode&&l$1.vnode(e),e}function M$1(){return {current:null}}function S(n){return n.children}function C$2(n,l){this.props=n,this.context=l;}function $$1(n,l){if(null==l)return n.__?$$1(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?$$1(n):null}function I$1(n){if(n.__P&&n.__d){var u=n.__v,t=u.__e,i=[],r=[],o=m$1({},u);o.__v=u.__v+1,l$1.vnode&&l$1.vnode(o),q$2(n.__P,o,u,n.__n,n.__P.namespaceURI,32&u.__u?[t]:null,i,null==t?$$1(u):t,!!(32&u.__u),r),o.__v=u.__v,o.__.__k[o.__i]=o,D$2(i,o,r),u.__e=u.__=null,o.__e!=t&&P$2(o);}}function P$2(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(l){if(null!=l&&null!=l.__e)return n.__e=n.__c.base=l.__e}),P$2(n)}function A$2(n){(!n.__d&&(n.__d=true)&&i$1.push(n)&&!H$1.__r++||r$2!=l$1.debounceRendering)&&((r$2=l$1.debounceRendering)||o$1)(H$1);}function H$1(){try{for(var n,l=1;i$1.length;)i$1.length>l&&i$1.sort(e$1),n=i$1.shift(),l=i$1.length,I$1(n);}finally{i$1.length=H$1.__r=0;}}function L$1(n,l,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,_,g,m=t&&t.__k||w$2,b=l.length;for(f=T$2(u,l,m,f,b),s=0;s<b;s++)null!=(p=u.__k[s])&&(h=-1!=p.__i&&m[p.__i]||d$1,p.__i=s,_=q$2(n,p,h,i,r,o,e,f,c,a),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&J$1(h.ref,null,p),a.push(p.ref,p.__c||v,p)),null==y&&null!=v&&(y=v),(g=!!(4&p.__u))||h.__k===p.__k?(f=j$2(p,f,n,g),g&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==_?f=_:v&&(f=v.nextSibling),p.__u&=-7);return u.__e=y,f}function T$2(n,l,u,t,i){var r,o,e,f,c,a=u.length,s=a,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=n.__k[r]=x$2(null,o,null,null,null):g$2(o)?o=n.__k[r]=x$2(S,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=n.__k[r]=x$2(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=O$1(o,u,f,s))&&(s--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>a?h--:i<a&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(s)for(r=0;r<a;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=$$1(e)),K$1(e,e));return t}function j$2(n,l,u,t){var i,r;if("function"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=j$2(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=$$1(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function F$2(n,l){return l=l||[],null==n||"boolean"==typeof n||(g$2(n)?n.some(function(n){F$2(n,l);}):l.push(n)),l}function O$1(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],a=null!=c&&0==(2&c.__u);if(null===c&&null==e||a&&e==c.key&&f==c.type)return u;if(t>(a?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return -1}function z$2(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||_$1.test(l)?u:u+"px";}function N$1(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||z$2(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||z$2(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(s$1,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u[a$1]=t[a$1]:(u[a$1]=h$1,n.addEventListener(l,r?v$1:p$1,r)):n.removeEventListener(l,r?v$1:p$1,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function V$1(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u[c$1])u[c$1]=h$1++;else if(u[c$1]<t[a$1])return;return t(l$1.event?l$1.event(u):u)}}}function q$2(n,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,d,_,k,x,M,$,I,P,A,H,T,j=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(s=l$1.__b)&&s(u);n:if("function"==typeof j){h=e.length;try{if(x=u.props,M=j.prototype&&j.prototype.render,$=(s=j.contextType)&&i[s.__c],I=s?$?$.props.value:s.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(M?u.__c=p=new j(x,I):(u.__c=p=new C$2(x,I),p.constructor=j,p.render=Q$1),$&&$.sub(p),p.state||(p.state={}),p.__n=i,v=p.__d=!0,p.__h=[],p._sb=[]),M&&null==p.__s&&(p.__s=p.state),M&&null!=j.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=m$1({},p.__s)),m$1(p.__s,j.getDerivedStateFromProps(x,p.__s))),y=p.props,d=p.state,p.__v=u,v)M&&null==j.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),M&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else {if(M&&null==j.getDerivedStateFromProps&&x!==y&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(x,I),u.__v==t.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(x,p.__s,I)){u.__v!=t.__v&&(p.props=x,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),w$2.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&e.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(x,p.__s,I),M&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(y,d,_);});}if(p.context=I,p.props=x,p.__P=n,p.__e=!1,P=l$1.__r,A=0,M)p.state=p.__s,p.__d=!1,P&&P(u),s=p.render(p.props,p.state,p.context),w$2.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,P&&P(u),s=p.render(p.props,p.state,p.context),p.state=p.__s;}while(p.__d&&++A<25);p.state=p.__s,null!=p.getChildContext&&(i=m$1(m$1({},i),p.getChildContext())),M&&!v&&null!=p.getSnapshotBeforeUpdate&&(_=p.getSnapshotBeforeUpdate(y,d)),H=null!=s&&s.type===S&&null==s.key?E$1(s.props.children):s,f=L$1(n,g$2(H)?H:[H],u,t,i,r,o,e,f,c,a),p.base=u.__e,u.__u&=-161,p.__h.length&&e.push(p),k&&(p.__E=p.__=null);}catch(n){if(e.length=h,u.__v=null,c||null!=o){if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;null!=o&&(o[o.indexOf(f)]=null),u.__e=f;}else if(null!=o)for(T=o.length;T--;)b$1(o[T]);}else u.__e=t.__e;null==u.__k&&(u.__k=t.__k||[]),n.then||B$2(u),l$1.__e(n,u,t);}}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=G$1(t.__e,u,t,i,r,o,e,c,a);return (s=l$1.diffed)&&s(u),128&u.__u?void 0:f}function B$2(n){n&&(n.__c&&(n.__c.__e=true),n.__k&&n.__k.some(B$2));}function D$2(n,u,t){for(var i=0;i<t.length;i++)J$1(t[i],t[++i],t[++i]);l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function E$1(n){return "object"!=typeof n||null==n||n.__b>0?n:g$2(n)?n.map(E$1):void 0!==n.constructor?null:m$1({},n)}function G$1(u,t,i,r,o,e,f,c,a){var s,h,p,v,y,w,_,m=i.props||d$1,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(s=0;s<e.length;s++)if((y=e[s])&&"setAttribute"in y==!!x&&(x?y.localName==x:3==y.nodeType)){u=y,e[s]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l$1.__m&&l$1.__m(t,e),c=false),e=null;}if(null==x)m===k||c&&u.data==k||(u.data=k);else {if(e="textarea"==x&&null!=k.defaultValue?null:e&&n.call(u.childNodes),!c&&null!=e)for(m={},s=0;s<u.attributes.length;s++)m[(y=u.attributes[s]).name]=y.value;for(s in m)y=m[s],"dangerouslySetInnerHTML"==s?p=y:"children"==s||s in k||"value"==s&&"defaultValue"in k||"checked"==s&&"defaultChecked"in k||N$1(u,s,null,y,o);for(s in k)y=k[s],"children"==s?v=y:"dangerouslySetInnerHTML"==s?h=y:"value"==s?w=y:"checked"==s?_=y:c&&"function"!=typeof y||m[s]===y||N$1(u,s,y,m[s],o);if(h)c||p&&(h.__html==p.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(p&&(u.innerHTML=""),L$1("template"==t.type?u.content:u,g$2(v)?v:[v],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&$$1(i,0),c,a),null!=e)for(s=e.length;s--;)b$1(e[s]);c&&"textarea"!=x||(s="value","progress"==x&&null==w?u.removeAttribute("value"):null!=w&&(w!==u[s]||"progress"==x&&!w||"option"==x&&w!=m[s])&&N$1(u,s,w,m[s],o),s="checked",null!=_&&_!=u[s]&&N$1(u,s,_,m[s],o));}return u}function J$1(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l$1.__e(n,t);}}function K$1(n,u,t){var i,r;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||J$1(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,u);}i.base=i.__P=i.__n=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&K$1(i[r],u,t||"function"!=typeof n.type);t||b$1(n.__e),n.__c=n.__=n.__e=void 0;}function Q$1(n,l,u){return this.constructor(n,u)}function R$1(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l$1.__&&l$1.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],q$2(t,u=(!r&&i||t).__k=k$2(S,null,[u]),o||d$1,d$1,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),D$2(e,u,f),u.props.children=null;}function U$1(n,l){R$1(n,l,U$1);}function W$1(l,u,t){var i,r,o,e,f=m$1({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),x$2(l.type,f,i||l.key,r||l.ref,null)}function X$1(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null;},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=true,A$2(n);});},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n);};}),n.children}return l.__c="__cC"+y$1++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n=w$2.slice,l$1={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u$2=0,C$2.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m$1({},this.state),"function"==typeof n&&(n=n(m$1({},u),this.props)),n&&m$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),A$2(this));},C$2.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),A$2(this));},C$2.prototype.render=S,i$1=[],o$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},H$1.__r=0,f$2=Math.random().toString(8),c$1="__d"+f$2,a$1="__a"+f$2,s$1=/(PointerCapture)$|Capture$/i,h$1=0,p$1=V$1(false),v$1=V$1(true),y$1=0;
2
2
 
3
- var t,r$1,u$1,i,o=0,f$1=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,p=c.__;function s(n,t){c.__h&&c.__h(r$1,n,o||t),o=0;var u=r$1.__H||(r$1.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,y(D$1,n)}function y(n,u,i){var o=s(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$1,!r$1.__f)){var f=function(n,t,r){if(!o.__c.__H)return true;var u=false,i=o.__c.props!==n;if(o.__c.__H.__.some(function(n){if(n.__N){u=true;var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=true);}}),c){var f=c.call(this,n,t,r);return u?f||i:f}return !u||i};r$1.__f=true;var c=r$1.shouldComponentUpdate,e=r$1.componentWillUpdate;r$1.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r$1.shouldComponentUpdate=f;}return o.__N||o.__}function h(n,u){var i=s(t++,3);!c.__s&&C$1(i.__H,u)&&(i.__=n,i.u=u,r$1.__H.__h.push(i));}function _(n,u){var i=s(t++,4);!c.__s&&C$1(i.__H,u)&&(i.__=n,i.u=u,r$1.__h.push(i));}function A$1(n){return o=5,T$1(function(){return {current:n}},[])}function F$1(n,t,r){o=6,_(function(){if("function"==typeof n){var r=n(t());return function(){n(null),r&&"function"==typeof r&&r();}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n));}function T$1(n,r){var u=s(t++,7);return C$1(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q$1(n,t){return o=8,T$1(function(){return n},t)}function x$1(n){var u=r$1.context[n.__c],i=s(t++,9);return i.c=n,u?(null==i.__&&(i.__=true,u.sub(r$1)),u.props.value):n.__}function P$1(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n);}function b(n){var u=s(t++,10),i=d();return u.__=n,r$1.componentDidCatch||(r$1.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n);}),[i[0],function(){i[1](void 0);}]}function g$1(){var n=s(t++,11);if(!n.__){for(var u=r$1.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++;}return n.__}function j$1(){for(var n;n=f$1.shift();){var t=n.__H;if(n.__P&&t)try{t.__h.some(z$1),t.__h.some(B$1),t.__h=[];}catch(r){t.__h=[],c.__e(r,n.__v);}}}c.__b=function(n){r$1=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),p&&p(n,t);},c.__r=function(n){a&&a(n),t=0;var i=(r$1=n.__c).__H;i&&(u$1===r$1?(i.__h=[],r$1.__h=[],i.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(i.__h.length&&j$1(),t=0)),u$1=r$1;},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f$1.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w$1)(j$1)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0);})),u$1=r$1=null;},c.__c=function(n,t){t.some(function(n){try{n.__h.some(z$1),n.__h=n.__h.filter(function(n){return !n.__||B$1(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.some(function(n){try{z$1(n);}catch(n){t=n;}}),r.__H=void 0,t&&c.__e(t,r.__v));};var k$1="function"==typeof requestAnimationFrame;function w$1(n){var t,r=function(){clearTimeout(u),k$1&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,35);k$1&&(t=requestAnimationFrame(r));}function z$1(n){var t=r$1,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$1=t;}function B$1(n){var t=r$1;n.__c=n.__(),r$1=t;}function C$1(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D$1(n,t){return "function"==typeof t?t(n):t}
3
+ var t,r$1,u$1,i,o=0,f$1=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,p=c.__;function s(n,t){c.__h&&c.__h(r$1,n,o||t),o=0;var u=r$1.__H||(r$1.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,y(D$1,n)}function y(n,u,i){var o=s(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$1,!r$1.__f)){var f=function(n,t,r){if(!o.__c.__H)return true;var u=false,i=o.__c.props!==n;if(o.__c.__H.__.some(function(n){if(n.__N){u=true;var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=true);}}),c){var f=c.call(this,n,t,r);return u?f||i:f}return !u||i};r$1.__f=true;var c=r$1.shouldComponentUpdate,e=r$1.componentWillUpdate;r$1.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r$1.shouldComponentUpdate=f;}return o.__N||o.__}function h(n,u){var i=s(t++,3);!c.__s&&C$1(i.__H,u)&&(i.__=n,i.u=u,r$1.__H.__h.push(i));}function _(n,u){var i=s(t++,4);!c.__s&&C$1(i.__H,u)&&(i.__=n,i.u=u,r$1.__h.push(i));}function A$1(n){return o=5,T$1(function(){return {current:n}},[])}function F$1(n,t,r){o=6,_(function(){if("function"==typeof n){var r=n(t());return function(){n(null),r&&"function"==typeof r&&r();}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n));}function T$1(n,r){var u=s(t++,7);return C$1(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q$1(n,t){return o=8,T$1(function(){return n},t)}function x$1(n){var u=r$1.context[n.__c],i=s(t++,9);return i.c=n,u?(null==i.__&&(i.__=true,u.sub(r$1)),u.props.value):n.__}function P$1(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n);}function b(n){var u=s(t++,10),i=d();return u.__=n,r$1.componentDidCatch||(r$1.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n);}),[i[0],function(){i[1](void 0);}]}function g$1(){var n=s(t++,11);if(!n.__){for(var u=r$1.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++;}return n.__}function j$1(){for(var n;n=f$1.shift();){var t=n.__H;if(n.__P&&t)try{t.__h.some(z$1),t.__h.some(B$1),t.__h=[];}catch(r){t.__h=[],c.__e(r,n.__v);}}}c.__b=function(n){r$1=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),p&&p(n,t);},c.__r=function(n){a&&a(n),t=0;var i=(r$1=n.__c).__H;i&&(u$1===r$1?(i.__h=[],r$1.__h=[],i.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(i.__h.some(z$1),i.__h.some(B$1),i.__h=[],t=0)),u$1=r$1;},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f$1.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w$1)(j$1)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0);})),u$1=r$1=null;},c.__c=function(n,t){t.some(function(n){try{n.__h.some(z$1),n.__h=n.__h.filter(function(n){return !n.__||B$1(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.some(function(n){try{z$1(n);}catch(n){t=n;}}),r.__H=void 0,t&&c.__e(t,r.__v));};var k$1="function"==typeof requestAnimationFrame;function w$1(n){var t,r=function(){clearTimeout(u),k$1&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,35);k$1&&(t=requestAnimationFrame(r));}function z$1(n){var t=r$1,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$1=t;}function B$1(n){var t=r$1;n.__c=n.__(),r$1=t;}function C$1(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D$1(n,t){return "function"==typeof t?t(n):t}
4
4
 
5
5
  function g(n,t){for(var e in t)n[e]=t[e];return n}function E(n,t){for(var e in n)if("__source"!==e&&!(e in t))return true;for(var r in t)if("__source"!==r&&n[r]!==t[r])return true;return false}function C(n,t){var e=t(),r=d({t:{__:e,u:t}}),u=r[0].t,o=r[1];return _(function(){u.__=e,u.u=t,R(u)&&o({t:u});},[n,e,t]),h(function(){return R(u)&&o({t:u}),n(function(){R(u)&&o({t:u});})},[n]),e}function R(n){try{return !((t=n.__)===(e=n.u())&&(0!==t||1/t==1/e)||t!=t&&e!=e)}catch(n){return true}var t,e;}function x(n){n();}function w(n){return n}function k(){return [false,x]}var I=_;function M(n,t){this.props=n,this.context=t;}function N(n,e){function r(n){var t=this.props.ref;return t!=n.ref&&t&&("function"==typeof t?t(null):t.current=null),e?!e(this.props,n)||t!=n.ref:E(this.props,n)}function u(e){return this.shouldComponentUpdate=r,k$2(n,e)}return u.displayName="Memo("+(n.displayName||n.name)+")",u.__f=u.prototype.isReactComponent=true,u.type=n,u}(M.prototype=new C$2).isPureReactComponent=true,M.prototype.shouldComponentUpdate=function(n,t){return E(this.props,n)||E(this.state,t)};var T=l$1.__b;l$1.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),T&&T(n);};var A="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function D(n){function t(t){var e=g({},t);return delete e.ref,n(e,t.ref||null)}return t.$$typeof=A,t.render=n,t.prototype.isReactComponent=t.__f=true,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var F=function(n,t){return null==n?null:F$2(F$2(n).map(t))},L={map:F,forEach:F,count:function(n){return n?F$2(n).length:0},only:function(n){var t=F$2(n);if(1!==t.length)throw "Children.only";return t[0]},toArray:F$2},O=l$1.__e;l$1.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k||[]),u.__c(n,t);O(n,t,e,r);};var U=l$1.unmount;function V(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c.__e=true,n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return V(n,t,e)})),n}function W(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return W(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=true,n.__c.__P=e)),n}function P(){this.__u=0,this.o=null,this.__b=null;}function j(n){var t=n.__&&n.__.__c;return t&&t.__a&&t.__a(n)}function z(n){var e,r,u,o=null;function i(i){if(e||(e=n()).then(function(n){n&&(o=n.default||n),u=true;},function(n){r=n,u=true;}),r)throw r;if(!u)throw e;return o?k$2(o,i):null}return i.displayName="Lazy",i.__f=true,i}function B(){this.i=null,this.l=null;}l$1.unmount=function(n){var t=n.__c;t&&(t.__z=true),t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),U&&U(n);},(P.prototype=new C$2).__c=function(n,t){var e=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(e);var u=j(r.__v),o=false,i=function(){o||r.__z||(o=true,e.__R=null,u?u(c):c());};e.__R=i;var l=e.__P;e.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=W(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=l,t.forceUpdate();}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i);},P.prototype.componentWillUnmount=function(){this.o=[];},P.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=V(this.__b,r,o.__O=o.__P);}this.__b=null;}var i=e.__a&&k$2(S,null,n.fallback);return i&&(i.__u&=-33),[k$2(S,null,e.__a?null:n.children),i]};var H=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2];}};function Z(n){return this.getChildContext=function(){return n.context},n.children}function Y(n){var e=this,r=n.h;if(e.componentWillUnmount=function(){R$1(null,e.v),e.v=null,e.h=null;},e.h&&e.h!==r&&e.componentWillUnmount(),!e.v){for(var u=e.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;e.h=r,e.v={nodeType:1,parentNode:r,childNodes:[],__k:{__m:u.__m},contains:function(){return true},namespaceURI:r.namespaceURI,insertBefore:function(n,t){this.childNodes.push(n),e.h.insertBefore(n,t);},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.h.removeChild(n);}};}R$1(k$2(Z,{context:e.context},n.__v),e.v);}function $(n,e){var r=k$2(Y,{__v:n,h:e});return r.containerInfo=e,r}(B.prototype=new C$2).__a=function(n){var t=this,e=j(t.__v),r=t.l.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),H(t,n,r)):u();};e?e(o):o();}},B.prototype.render=function(n){this.i=null,this.l=new Map;var t=F$2(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},B.prototype.componentDidUpdate=B.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){H(n,e,t);});};var q="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,G=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,J=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,K=/[A-Z0-9]/g,Q="undefined"!=typeof document,X=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function nn(n,t,e){return null==t.__k&&(t.textContent=""),R$1(n,t),"function"==typeof e&&e(),n?n.__c:null}function tn(n,t,e){return U$1(n,t),"function"==typeof e&&e(),n?n.__c:null}C$2.prototype.isReactComponent=true,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(C$2.prototype,t,{configurable:true,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:true,writable:true,value:n});}});});var en=l$1.event;l$1.event=function(n){return en&&(n=en(n)),n.persist=function(){},n.isPropagationStopped=function(){return this.cancelBubble},n.isDefaultPrevented=function(){return this.defaultPrevented},n.nativeEvent=n};var rn,un={configurable:true,get:function(){return this.class}},on$1=l$1.vnode;l$1.vnode=function(n){"string"==typeof n.type&&function(n){var t=n.props,e=n.type,u={},o=-1==e.indexOf("-");for(var i in t){var l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||Q&&"children"===i&&"noscript"===e||"class"===i||"className"===i)){var c=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&true===l?l="":"translate"===c&&"no"===l?l=false:"o"===c[0]&&"n"===c[1]?"ondoubleclick"===c?i="ondblclick":"onchange"!==c||"input"!==e&&"textarea"!==e||X(t.type)?"onfocus"===c?i="onfocusin":"onblur"===c?i="onfocusout":J.test(i)&&(i=c):c=i="oninput":o&&G.test(i)?i=i.replace(K,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===c&&u[i=c]&&(i="oninputCapture"),u[i]=l;}}"select"==e&&(u.multiple&&Array.isArray(u.value)&&(u.value=F$2(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value);})),null!=u.defaultValue&&(u.value=F$2(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value;}))),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,"className",un)):t.className&&(u.class=u.className=t.className),n.props=u;}(n),n.$$typeof=q,on$1&&on$1(n);};var ln=l$1.__r;l$1.__r=function(n){ln&&ln(n),rn=n.__c;};var cn=l$1.diffed;l$1.diffed=function(n){cn&&cn(n);var t=n.props,e=n.__e;null!=e&&"textarea"===n.type&&"value"in t&&t.value!==e.value&&(e.value=null==t.value?"":t.value),rn=null;};var fn={ReactCurrentDispatcher:{current:{readContext:function(n){return rn.__n[n.__c].props.value},useCallback:q$1,useContext:x$1,useDebugValue:P$1,useDeferredValue:w,useEffect:h,useId:g$1,useImperativeHandle:F$1,useInsertionEffect:I,useLayoutEffect:_,useMemo:T$1,useReducer:y,useRef:A$1,useState:d,useSyncExternalStore:C,useTransition:k}}},an="18.3.1";function sn(n){return k$2.bind(null,n)}function hn(n){return !!n&&n.$$typeof===q}function vn(n){return hn(n)&&n.type===S}function dn(n){return !!n&&"string"==typeof n.displayName&&0==n.displayName.indexOf("Memo(")}function mn(n){return hn(n)?W$1.apply(null,arguments):n}function pn(n){return !!n.__k&&(R$1(null,n),true)}function yn(n){return n&&(n.base||1===n.nodeType&&n)||null}var _n=function(n,t){return n(t)},bn=function(n,t){var r=l$1.debounceRendering;l$1.debounceRendering=function(n){return n()};var u=n(t);return l$1.debounceRendering=r,u},Sn=hn,gn={useState:d,useId:g$1,useReducer:y,useEffect:h,useLayoutEffect:_,useInsertionEffect:I,useTransition:k,useDeferredValue:w,useSyncExternalStore:C,startTransition:x,useRef:A$1,useImperativeHandle:F$1,useMemo:T$1,useCallback:q$1,useContext:x$1,useDebugValue:P$1,version:"18.3.1",Children:L,render:nn,hydrate:tn,unmountComponentAtNode:pn,createPortal:$,createElement:k$2,createContext:X$1,createFactory:sn,cloneElement:mn,createRef:M$1,Fragment:S,isValidElement:hn,isElement:Sn,isFragment:vn,isMemo:dn,findDOMNode:yn,Component:C$2,PureComponent:M,memo:N,forwardRef:D,flushSync:bn,unstable_batchedUpdates:_n,StrictMode:S,Suspense:P,SuspenseList:B,lazy:z,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:fn};
6
6
 
@@ -44182,6 +44182,39 @@ const ReportingProvider = ({
44182
44182
  }, children);
44183
44183
  };
44184
44184
 
44185
+ /**
44186
+ * useReportingContext - Hook to access reporting context
44187
+ *
44188
+ * @returns {Object} Context value with parameters, api, and setter functions
44189
+ * @returns {Object} return.parameters - Current parameters object
44190
+ * @returns {Function} return.setParameters - Function to update parameters
44191
+ * @returns {Object} return.api - Current API configuration
44192
+ * @returns {Function} return.setApi - Function to update API configuration
44193
+ * @returns {Function} return.setReportingContext - Function to update both parameters and api
44194
+ *
44195
+ * @example
44196
+ * const { parameters, setParameters, api, setApi, setReportingContext } = useReportingContext();
44197
+ *
44198
+ * // Update parameters only
44199
+ * setParameters({ base_currency: 'USD', merchants: [...] });
44200
+ *
44201
+ * // Update API only
44202
+ * setApi({ token: 'new-token', base_url: 'https://api.example.com' });
44203
+ *
44204
+ * // Update both at once
44205
+ * setReportingContext({
44206
+ * parameters: { base_currency: 'EUR' },
44207
+ * api: { token: 'token', base_url: 'https://api.example.com' }
44208
+ * });
44209
+ */
44210
+ const useReportingContext = () => {
44211
+ const context = x$1(ReportingContext);
44212
+ if (context === undefined) {
44213
+ throw new Error('useReportingContext must be used within a ReportingProvider');
44214
+ }
44215
+ return context;
44216
+ };
44217
+
44185
44218
  /**
44186
44219
  * useReportingContextOptional - Hook to optionally access reporting context
44187
44220
  * Returns null if used outside of ReportingProvider (useful for optional fallback)
@@ -77481,7 +77514,6 @@ const SortableChip$1 = ({
77481
77514
  // the top-of-page Add form, so it stays visible regardless of scroll position.
77482
77515
  const SortableComputedChip = ({
77483
77516
  id,
77484
- index,
77485
77517
  name,
77486
77518
  value,
77487
77519
  onDelete,
@@ -77534,13 +77566,13 @@ const SortableComputedChip = ({
77534
77566
  setEditValue(value);
77535
77567
  setIsEditing(true);
77536
77568
  };
77537
- const nameError = editName.trim() !== "" && isNameTaken(editName.trim(), index);
77569
+ const nameError = editName.trim() !== "" && isNameTaken(editName.trim(), name);
77538
77570
  const handleSave = () => {
77539
77571
  const trimmedName = editName.trim();
77540
77572
  const trimmedValue = editValue.trim();
77541
77573
  if (!trimmedName || !trimmedValue) return;
77542
- if (isNameTaken(trimmedName, index)) return;
77543
- onUpdate(index, {
77574
+ if (isNameTaken(trimmedName, name)) return;
77575
+ onUpdate(name, {
77544
77576
  name: trimmedName,
77545
77577
  value: trimmedValue
77546
77578
  });
@@ -77738,7 +77770,7 @@ const Dimensions = ({
77738
77770
  savedDimensions = [],
77739
77771
  onSaveDimension,
77740
77772
  onRemoveDimension,
77741
- onReorderDimensions,
77773
+ onUpdateDimensionSortOrder,
77742
77774
  titleOverrides = {},
77743
77775
  onUpdateTitle,
77744
77776
  onResetTitle,
@@ -77748,7 +77780,8 @@ const Dimensions = ({
77748
77780
  onSaveComputedDimension,
77749
77781
  onUpdateComputedDimension,
77750
77782
  onRemoveComputedDimension,
77751
- onReorderComputedDimensions
77783
+ dimensionOrder = [],
77784
+ onReorderDimensionItems
77752
77785
  }) => {
77753
77786
  const reportingContext = useReportingContextOptional();
77754
77787
  const parameters = reportingContext?.parameters;
@@ -77764,49 +77797,56 @@ const Dimensions = ({
77764
77797
  coordinateGetter: sortableKeyboardCoordinates
77765
77798
  }));
77766
77799
 
77767
- // Handle drag end
77800
+ // Resolve the unified dimensionOrder into the actual dimension / computed
77801
+ // dimension objects, so dimensions and computed dimensions can be shown
77802
+ // (and dragged) as a single list while staying stored in their own arrays.
77803
+ const dimensionByFullPath = Object.fromEntries(savedDimensions.map(d => [d.fullPath, d]));
77804
+ const computedDimensionByName = Object.fromEntries(savedComputedDimensions.map(cd => [cd.name, cd]));
77805
+ const orderedItems = dimensionOrder.map(entry => entry.type === "dimension" ? {
77806
+ kind: "dimension",
77807
+ key: entry.key,
77808
+ data: dimensionByFullPath[entry.key]
77809
+ } : {
77810
+ kind: "computed",
77811
+ key: entry.key,
77812
+ data: computedDimensionByName[entry.key]
77813
+ }).filter(item => item.data);
77814
+
77815
+ // Handle drag end for the unified list
77768
77816
  const handleDragEnd = event => {
77769
77817
  const {
77770
77818
  active,
77771
77819
  over
77772
77820
  } = event;
77773
77821
  if (over && active.id !== over.id) {
77774
- const oldIndex = savedDimensions.findIndex((_, i) => i === active.id);
77775
- const newIndex = savedDimensions.findIndex((_, i) => i === over.id);
77776
- const newOrder = arrayMove(savedDimensions, oldIndex, newIndex);
77777
- onReorderDimensions(newOrder);
77822
+ const oldIndex = dimensionOrder.findIndex((_, i) => i === active.id);
77823
+ const newIndex = dimensionOrder.findIndex((_, i) => i === over.id);
77824
+ onReorderDimensionItems(arrayMove(dimensionOrder, oldIndex, newIndex));
77778
77825
  }
77779
77826
  };
77780
77827
 
77781
77828
  // Handle move up
77782
77829
  const handleMoveUp = index => {
77783
77830
  if (index > 0) {
77784
- const newOrder = arrayMove(savedDimensions, index, index - 1);
77785
- onReorderDimensions(newOrder);
77831
+ onReorderDimensionItems(arrayMove(dimensionOrder, index, index - 1));
77786
77832
  }
77787
77833
  };
77788
77834
 
77789
77835
  // Handle move down
77790
77836
  const handleMoveDown = index => {
77791
- if (index < savedDimensions.length - 1) {
77792
- const newOrder = arrayMove(savedDimensions, index, index + 1);
77793
- onReorderDimensions(newOrder);
77837
+ if (index < dimensionOrder.length - 1) {
77838
+ onReorderDimensionItems(arrayMove(dimensionOrder, index, index + 1));
77794
77839
  }
77795
77840
  };
77796
77841
 
77797
- // Handle sort order change
77798
- const handleSortOrderChange = (index, sortOrder) => {
77799
- const newDimensions = [...savedDimensions];
77800
- newDimensions[index] = {
77801
- ...newDimensions[index],
77802
- sortOrder
77803
- };
77804
- onReorderDimensions(newDimensions);
77842
+ // Handle sort order change (dimensions only - computed dimensions have no order_by)
77843
+ const handleSortOrderChange = (fullPath, sortOrder) => {
77844
+ onUpdateDimensionSortOrder(fullPath, sortOrder);
77805
77845
  };
77806
77846
 
77807
77847
  // Computed Dimensions: { name, value } pairs independent of any provider.
77808
77848
  // Their `value` is a raw SQL literal/expression sent to the API as-is.
77809
- const isComputedNameTaken = (name, excludeIndex = null) => savedComputedDimensions.some((cd, i) => cd.name === name && i !== excludeIndex);
77849
+ const isComputedNameTaken = (name, excludeName = null) => savedComputedDimensions.some(cd => cd.name === name) && name !== excludeName;
77810
77850
  const computedNameError = computedName.trim() !== "" && isComputedNameTaken(computedName.trim());
77811
77851
  const handleAddComputedClick = () => {
77812
77852
  setIsAddingComputed(true);
@@ -77830,27 +77870,6 @@ const Dimensions = ({
77830
77870
  });
77831
77871
  handleCancelComputed();
77832
77872
  };
77833
- const handleComputedDragEnd = event => {
77834
- const {
77835
- active,
77836
- over
77837
- } = event;
77838
- if (over && active.id !== over.id) {
77839
- const oldIndex = savedComputedDimensions.findIndex((_, i) => i === active.id);
77840
- const newIndex = savedComputedDimensions.findIndex((_, i) => i === over.id);
77841
- onReorderComputedDimensions(arrayMove(savedComputedDimensions, oldIndex, newIndex));
77842
- }
77843
- };
77844
- const handleMoveComputedUp = index => {
77845
- if (index > 0) {
77846
- onReorderComputedDimensions(arrayMove(savedComputedDimensions, index, index - 1));
77847
- }
77848
- };
77849
- const handleMoveComputedDown = index => {
77850
- if (index < savedComputedDimensions.length - 1) {
77851
- onReorderComputedDimensions(arrayMove(savedComputedDimensions, index, index + 1));
77852
- }
77853
- };
77854
77873
 
77855
77874
  // Get the current provider based on selection chain
77856
77875
  const getCurrentProvider = () => {
@@ -78293,7 +78312,7 @@ const Dimensions = ({
78293
78312
  boxShadow: "none"
78294
78313
  }
78295
78314
  }
78296
- }, "Save Dimension"))), savedDimensions.length > 0 && /*#__PURE__*/gn.createElement(Box, {
78315
+ }, "Save Dimension"))), orderedItems.length > 0 && /*#__PURE__*/gn.createElement(Box, {
78297
78316
  sx: {
78298
78317
  marginTop: 0
78299
78318
  }
@@ -78316,7 +78335,7 @@ const Dimensions = ({
78316
78335
  collisionDetection: closestCenter,
78317
78336
  onDragEnd: handleDragEnd
78318
78337
  }, /*#__PURE__*/gn.createElement(SortableContext, {
78319
- items: savedDimensions.map((_, index) => index),
78338
+ items: orderedItems.map((_, index) => index),
78320
78339
  strategy: verticalListSortingStrategy
78321
78340
  }, /*#__PURE__*/gn.createElement(Box, {
78322
78341
  sx: {
@@ -78324,67 +78343,35 @@ const Dimensions = ({
78324
78343
  flexDirection: "column",
78325
78344
  gap: 1
78326
78345
  }
78327
- }, savedDimensions.map((dim, index) => /*#__PURE__*/gn.createElement(SortableChip$1, {
78328
- key: index,
78346
+ }, orderedItems.map((item, index) => item.kind === "dimension" ? /*#__PURE__*/gn.createElement(SortableChip$1, {
78347
+ key: `dim-${item.key}`,
78329
78348
  id: index,
78330
- label: dim.dimensionTitle,
78331
- fullLabel: `${formatProviderPath(dim)} → ${dim.dimensionTitle} (${dim.fullPath})`,
78332
- onDelete: () => onRemoveDimension(index),
78349
+ label: item.data.dimensionTitle,
78350
+ fullLabel: `${formatProviderPath(item.data)} → ${item.data.dimensionTitle} (${item.data.fullPath})`,
78351
+ onDelete: () => onRemoveDimension(item.key),
78333
78352
  onMoveUp: () => handleMoveUp(index),
78334
78353
  onMoveDown: () => handleMoveDown(index),
78335
78354
  isFirst: index === 0,
78336
- isLast: index === savedDimensions.length - 1,
78337
- sortOrder: dim.sortOrder || null,
78338
- onSortOrderChange: sortOrder => handleSortOrderChange(index, sortOrder),
78339
- fullPath: dim.fullPath,
78340
- defaultTitle: dim.dimensionTitle,
78341
- customTitle: titleOverrides[dim.fullPath],
78355
+ isLast: index === orderedItems.length - 1,
78356
+ sortOrder: item.data.sortOrder || null,
78357
+ onSortOrderChange: sortOrder => handleSortOrderChange(item.key, sortOrder),
78358
+ fullPath: item.data.fullPath,
78359
+ defaultTitle: item.data.dimensionTitle,
78360
+ customTitle: titleOverrides[item.data.fullPath],
78342
78361
  onUpdateTitle: onUpdateTitle,
78343
78362
  onResetTitle: onResetTitle
78344
- })))))), savedComputedDimensions.length > 0 && /*#__PURE__*/gn.createElement(Box, {
78345
- sx: {
78346
- marginTop: 2
78347
- }
78348
- }, /*#__PURE__*/gn.createElement(Typography, {
78349
- variant: "h6",
78350
- sx: {
78351
- fontSize: "16px",
78352
- fontWeight: 600,
78353
- marginTop: 2,
78354
- color: "rgb(37, 37, 37)"
78355
- }
78356
- }, "Saved Computed Dimensions"), /*#__PURE__*/gn.createElement(Typography, {
78357
- sx: {
78358
- fontSize: "13px",
78359
- color: "#666",
78360
- marginBottom: 2
78361
- }
78362
- }, "Drag to reorder or use arrows"), /*#__PURE__*/gn.createElement(DndContext, {
78363
- sensors: sensors,
78364
- collisionDetection: closestCenter,
78365
- onDragEnd: handleComputedDragEnd
78366
- }, /*#__PURE__*/gn.createElement(SortableContext, {
78367
- items: savedComputedDimensions.map((_, index) => index),
78368
- strategy: verticalListSortingStrategy
78369
- }, /*#__PURE__*/gn.createElement(Box, {
78370
- sx: {
78371
- display: "flex",
78372
- flexDirection: "column",
78373
- gap: 1
78374
- }
78375
- }, savedComputedDimensions.map((cd, index) => /*#__PURE__*/gn.createElement(SortableComputedChip, {
78376
- key: index,
78363
+ }) : /*#__PURE__*/gn.createElement(SortableComputedChip, {
78364
+ key: `comp-${item.key}`,
78377
78365
  id: index,
78378
- index: index,
78379
- name: cd.name,
78380
- value: cd.value,
78366
+ name: item.data.name,
78367
+ value: item.data.value,
78381
78368
  onUpdate: onUpdateComputedDimension,
78382
78369
  isNameTaken: isComputedNameTaken,
78383
- onDelete: () => onRemoveComputedDimension(index),
78384
- onMoveUp: () => handleMoveComputedUp(index),
78385
- onMoveDown: () => handleMoveComputedDown(index),
78370
+ onDelete: () => onRemoveComputedDimension(item.key),
78371
+ onMoveUp: () => handleMoveUp(index),
78372
+ onMoveDown: () => handleMoveDown(index),
78386
78373
  isFirst: index === 0,
78387
- isLast: index === savedComputedDimensions.length - 1
78374
+ isLast: index === orderedItems.length - 1
78388
78375
  })))))));
78389
78376
  };
78390
78377
 
@@ -91715,9 +91702,8 @@ const formatValue = (value, def) => {
91715
91702
  const isNumericType = type => type === 'integer' || type === 'currency';
91716
91703
  const ReportDataGrid = ({
91717
91704
  reportData,
91718
- dimensions,
91705
+ orderedDimensionItems = [],
91719
91706
  metrics,
91720
- computedDimensions = [],
91721
91707
  loading,
91722
91708
  onPageChange,
91723
91709
  totalRows = 0,
@@ -91737,11 +91723,26 @@ const ReportDataGrid = ({
91737
91723
  const columns = gn.useMemo(() => {
91738
91724
  const cols = [];
91739
91725
 
91740
- // Add dimension columns
91741
- // Field naming logic:
91726
+ // Add dimension + computed-dimension columns, in the single unified
91727
+ // order the user arranged them in on the Dimensions tab.
91728
+ // Field naming logic (dimensions):
91742
91729
  // - If from base provider: baseAlias.field -> baseAlias_field
91743
91730
  // - If from nested provider: baseAlias_rel1_rel2.field -> rel1_rel2_field (drops base alias)
91744
- dimensions.forEach(dim => {
91731
+ // Computed dimensions have no provider/relations chain, so the API
91732
+ // returns each row keyed by the computed dimension's own `name`.
91733
+ orderedDimensionItems.forEach(item => {
91734
+ if (item.kind === 'computed') {
91735
+ const cd = item.data;
91736
+ cols.push({
91737
+ field: cd.name,
91738
+ headerName: cd.name,
91739
+ flex: 1,
91740
+ minWidth: 150,
91741
+ type: 'string'
91742
+ });
91743
+ return;
91744
+ }
91745
+ const dim = item.data;
91745
91746
  let fieldName;
91746
91747
  let headerName;
91747
91748
 
@@ -91779,18 +91780,6 @@ const ReportDataGrid = ({
91779
91780
  });
91780
91781
  });
91781
91782
 
91782
- // Add computed dimension columns. These have no provider/relations chain,
91783
- // so the API returns each row keyed by the computed dimension's own `name`.
91784
- computedDimensions.forEach(cd => {
91785
- cols.push({
91786
- field: cd.name,
91787
- headerName: cd.name,
91788
- flex: 1,
91789
- minWidth: 150,
91790
- type: 'string'
91791
- });
91792
- });
91793
-
91794
91783
  // Add metric columns
91795
91784
  // The API returns metric keys in two different forms depending on the path depth:
91796
91785
  //
@@ -91850,7 +91839,7 @@ const ReportDataGrid = ({
91850
91839
  });
91851
91840
  });
91852
91841
  return cols;
91853
- }, [dimensions, metrics, computedDimensions, titleOverrides, parameters]);
91842
+ }, [orderedDimensionItems, metrics, titleOverrides, parameters]);
91854
91843
 
91855
91844
  // Transform report data to rows with unique IDs.
91856
91845
  // Keys are normalised by replacing dots with underscores so that MUI DataGrid
@@ -91957,7 +91946,10 @@ const ReportBuilder = ({
91957
91946
  dimensions: [],
91958
91947
  metrics: [],
91959
91948
  filters: {},
91960
- computedDimensions: []
91949
+ computedDimensions: [],
91950
+ // Unified display/execution order across dimensions + computedDimensions.
91951
+ // Entries: { type: 'dimension', key: fullPath } | { type: 'computed', key: name }
91952
+ dimensionOrder: []
91961
91953
  });
91962
91954
  const [titleOverrides, setTitleOverrides] = d({
91963
91955
  dimensions: {},
@@ -92003,6 +91995,16 @@ const ReportBuilder = ({
92003
91995
  }
92004
91996
  }, [autoRun, reportLoaded]);
92005
91997
 
91998
+ // Re-run the currently displayed report when base_currency changes in context
91999
+ const currentBaseCurrency = reportingContext?.parameters?.base_currency;
92000
+ const prevBaseCurrencyRef = A$1(currentBaseCurrency);
92001
+ h(() => {
92002
+ if (reportData && prevBaseCurrencyRef.current !== undefined && prevBaseCurrencyRef.current !== currentBaseCurrency) {
92003
+ runReportWithPagination(currentPage, pageSize);
92004
+ }
92005
+ prevBaseCurrencyRef.current = currentBaseCurrency;
92006
+ }, [currentBaseCurrency]);
92007
+
92006
92008
  // Utility function to reconstruct dimension object from fullPath
92007
92009
  const reconstructDimensionFromPath = (fullPath, providersData, rootProvider) => {
92008
92010
  try {
@@ -92132,6 +92134,52 @@ const ReportBuilder = ({
92132
92134
  return null;
92133
92135
  }
92134
92136
  };
92137
+
92138
+ // Build the unified display/execution order for dimensions + computed
92139
+ // dimensions. Prefers the persisted `ordered_dimensions` field; falls back
92140
+ // to "dimensions first, then computed dimensions" for report definitions
92141
+ // saved before this field existed.
92142
+ const buildDimensionOrder = (rawOrderedDimensions, dimensions, computedDimensions) => {
92143
+ const dimensionOrder = [];
92144
+ const seenDimensionKeys = new Set();
92145
+ const seenComputedKeys = new Set();
92146
+ if (Array.isArray(rawOrderedDimensions)) {
92147
+ rawOrderedDimensions.forEach(entry => {
92148
+ if (entry.type === "dimension" && dimensions.some(d => d.fullPath === entry.ref)) {
92149
+ dimensionOrder.push({
92150
+ type: "dimension",
92151
+ key: entry.ref
92152
+ });
92153
+ seenDimensionKeys.add(entry.ref);
92154
+ } else if (entry.type === "computed" && computedDimensions.some(cd => cd.name === entry.ref)) {
92155
+ dimensionOrder.push({
92156
+ type: "computed",
92157
+ key: entry.ref
92158
+ });
92159
+ seenComputedKeys.add(entry.ref);
92160
+ }
92161
+ });
92162
+ }
92163
+
92164
+ // Append anything not covered by ordered_dimensions (older reports, or drift)
92165
+ dimensions.forEach(d => {
92166
+ if (!seenDimensionKeys.has(d.fullPath)) {
92167
+ dimensionOrder.push({
92168
+ type: "dimension",
92169
+ key: d.fullPath
92170
+ });
92171
+ }
92172
+ });
92173
+ computedDimensions.forEach(cd => {
92174
+ if (!seenComputedKeys.has(cd.name)) {
92175
+ dimensionOrder.push({
92176
+ type: "computed",
92177
+ key: cd.name
92178
+ });
92179
+ }
92180
+ });
92181
+ return dimensionOrder;
92182
+ };
92135
92183
  const loadReportDefinition = async id => {
92136
92184
  try {
92137
92185
  console.log("Loading report definition:", id);
@@ -92227,13 +92275,15 @@ const ReportBuilder = ({
92227
92275
  // Computed dimensions are self-contained { name, value } pairs with no
92228
92276
  // provider/relation chain, so they're loaded as-is (no reconstruction needed)
92229
92277
  const computedDimensions = reportDef.definition?.doc?.query?.computed_dimensions || [];
92278
+ const dimensionOrder = buildDimensionOrder(reportDef.definition?.doc?.query?.ordered_dimensions, reconstructedDimensions, computedDimensions);
92230
92279
 
92231
92280
  // Set the report state
92232
92281
  setReport({
92233
92282
  dimensions: reconstructedDimensions,
92234
92283
  metrics: reconstructedMetrics,
92235
92284
  filters: loadedFilters,
92236
- computedDimensions
92285
+ computedDimensions,
92286
+ dimensionOrder
92237
92287
  });
92238
92288
 
92239
92289
  // Set title overrides
@@ -92342,13 +92392,15 @@ const ReportBuilder = ({
92342
92392
  // Computed dimensions are self-contained { name, value } pairs with no
92343
92393
  // provider/relation chain, so they're loaded as-is (no reconstruction needed)
92344
92394
  const computedDimensions = reportDef.definition?.doc?.query?.computed_dimensions || [];
92395
+ const dimensionOrder = buildDimensionOrder(reportDef.definition?.doc?.query?.ordered_dimensions, reconstructedDimensions, computedDimensions);
92345
92396
 
92346
92397
  // Set the report state
92347
92398
  setReport({
92348
92399
  dimensions: reconstructedDimensions,
92349
92400
  metrics: reconstructedMetrics,
92350
92401
  filters: loadedFilters,
92351
- computedDimensions
92402
+ computedDimensions,
92403
+ dimensionOrder
92352
92404
  });
92353
92405
 
92354
92406
  // Set title overrides
@@ -92381,7 +92433,8 @@ const ReportBuilder = ({
92381
92433
  dimensions: [],
92382
92434
  metrics: [],
92383
92435
  filters: {},
92384
- computedDimensions: []
92436
+ computedDimensions: [],
92437
+ dimensionOrder: []
92385
92438
  });
92386
92439
  // Reset title overrides
92387
92440
  setTitleOverrides({
@@ -92458,51 +92511,68 @@ const ReportBuilder = ({
92458
92511
  setReport(prev => {
92459
92512
  const newReport = {
92460
92513
  ...prev,
92461
- dimensions: [...prev.dimensions, dimensionData]
92514
+ dimensions: [...prev.dimensions, dimensionData],
92515
+ dimensionOrder: [...prev.dimensionOrder, {
92516
+ type: "dimension",
92517
+ key: dimensionData.fullPath
92518
+ }]
92462
92519
  };
92463
92520
  console.log("Dimension saved:", dimensionData);
92464
92521
  console.log("Complete report:", newReport);
92465
92522
  return newReport;
92466
92523
  });
92467
92524
  };
92468
- const handleRemoveDimension = index => {
92525
+ const handleRemoveDimension = fullPath => {
92469
92526
  setReport(prev => ({
92470
92527
  ...prev,
92471
- dimensions: prev.dimensions.filter((_, i) => i !== index)
92528
+ dimensions: prev.dimensions.filter(d => d.fullPath !== fullPath),
92529
+ dimensionOrder: prev.dimensionOrder.filter(entry => !(entry.type === "dimension" && entry.key === fullPath))
92472
92530
  }));
92473
92531
  };
92474
- const handleReorderDimensions = newOrder => {
92532
+ const handleUpdateDimensionSortOrder = (fullPath, sortOrder) => {
92475
92533
  setReport(prev => ({
92476
92534
  ...prev,
92477
- dimensions: newOrder
92535
+ dimensions: prev.dimensions.map(d => d.fullPath === fullPath ? {
92536
+ ...d,
92537
+ sortOrder
92538
+ } : d)
92478
92539
  }));
92479
92540
  };
92480
- const handleSaveComputedDimension = computedDimensionData => {
92541
+
92542
+ // Reorders the single unified dimensions + computed-dimensions list;
92543
+ // `dimensions`/`computedDimensions` arrays themselves are unordered from
92544
+ // this perspective, so only `dimensionOrder` needs to change.
92545
+ const handleReorderDimensionItems = newDimensionOrder => {
92481
92546
  setReport(prev => ({
92482
92547
  ...prev,
92483
- computedDimensions: [...prev.computedDimensions, computedDimensionData]
92548
+ dimensionOrder: newDimensionOrder
92484
92549
  }));
92485
92550
  };
92486
- const handleUpdateComputedDimension = (index, computedDimensionData) => {
92487
- setReport(prev => {
92488
- const newComputedDimensions = [...prev.computedDimensions];
92489
- newComputedDimensions[index] = computedDimensionData;
92490
- return {
92491
- ...prev,
92492
- computedDimensions: newComputedDimensions
92493
- };
92494
- });
92551
+ const handleSaveComputedDimension = computedDimensionData => {
92552
+ setReport(prev => ({
92553
+ ...prev,
92554
+ computedDimensions: [...prev.computedDimensions, computedDimensionData],
92555
+ dimensionOrder: [...prev.dimensionOrder, {
92556
+ type: "computed",
92557
+ key: computedDimensionData.name
92558
+ }]
92559
+ }));
92495
92560
  };
92496
- const handleRemoveComputedDimension = index => {
92561
+ const handleUpdateComputedDimension = (name, computedDimensionData) => {
92497
92562
  setReport(prev => ({
92498
92563
  ...prev,
92499
- computedDimensions: prev.computedDimensions.filter((_, i) => i !== index)
92564
+ computedDimensions: prev.computedDimensions.map(cd => cd.name === name ? computedDimensionData : cd),
92565
+ dimensionOrder: prev.dimensionOrder.map(entry => entry.type === "computed" && entry.key === name ? {
92566
+ ...entry,
92567
+ key: computedDimensionData.name
92568
+ } : entry)
92500
92569
  }));
92501
92570
  };
92502
- const handleReorderComputedDimensions = newOrder => {
92571
+ const handleRemoveComputedDimension = name => {
92503
92572
  setReport(prev => ({
92504
92573
  ...prev,
92505
- computedDimensions: newOrder
92574
+ computedDimensions: prev.computedDimensions.filter(cd => cd.name !== name),
92575
+ dimensionOrder: prev.dimensionOrder.filter(entry => !(entry.type === "computed" && entry.key === name))
92506
92576
  }));
92507
92577
  };
92508
92578
  const handleSaveMetric = metricData => {
@@ -92558,10 +92628,20 @@ const ReportBuilder = ({
92558
92628
  });
92559
92629
  };
92560
92630
 
92561
- // Convert internal report structure to API format
92562
- const convertReportToApiFormat = (page = 0, size = 50) => {
92631
+ // Builds the query object shared between running (paginated) and saving
92632
+ // (unpaginated) a report. Dimension and computed-dimension order both
92633
+ // derive from the single unified `report.dimensionOrder` list, so the
92634
+ // saved `dimensions`/`computed_dimensions` arrays, `order_by`, and the
92635
+ // persisted `ordered_dimensions` field all stay consistent with whatever
92636
+ // order the user arranged on screen.
92637
+ const buildQueryObject = () => {
92638
+ const dimensionByPath = Object.fromEntries(report.dimensions.map(d => [d.fullPath, d]));
92639
+ const computedByName = Object.fromEntries(report.computedDimensions.map(cd => [cd.name, cd]));
92640
+ const orderedDimensionsOnly = report.dimensionOrder.filter(entry => entry.type === "dimension").map(entry => dimensionByPath[entry.key]).filter(Boolean);
92641
+ const orderedComputedOnly = report.dimensionOrder.filter(entry => entry.type === "computed").map(entry => computedByName[entry.key]).filter(Boolean);
92642
+
92563
92643
  // Build order_by array - include all dimensions, add desc property only when needed
92564
- const orderBy = report.dimensions.map(dim => {
92644
+ const orderBy = orderedDimensionsOnly.map(dim => {
92565
92645
  const orderItem = {
92566
92646
  name: dim.fullPath
92567
92647
  };
@@ -92617,21 +92697,29 @@ const ReportBuilder = ({
92617
92697
  titles.filters = titleOverrides.filters;
92618
92698
  }
92619
92699
  const queryObj = {
92620
- dimensions: report.dimensions.map(dim => dim.fullPath),
92700
+ dimensions: orderedDimensionsOnly.map(dim => dim.fullPath),
92621
92701
  metrics: report.metrics.map(metric => metric.fullPath),
92622
- order_by: orderBy,
92623
- limit: size,
92624
- offset: page * size
92702
+ order_by: orderBy
92625
92703
  };
92626
92704
 
92627
92705
  // Only add computed_dimensions if there are any
92628
- if (report.computedDimensions && report.computedDimensions.length > 0) {
92629
- queryObj.computed_dimensions = report.computedDimensions.map(cd => ({
92706
+ if (orderedComputedOnly.length > 0) {
92707
+ queryObj.computed_dimensions = orderedComputedOnly.map(cd => ({
92630
92708
  name: cd.name,
92631
92709
  value: cd.value
92632
92710
  }));
92633
92711
  }
92634
92712
 
92713
+ // Persist the unified dimension + computed-dimension order so it can be
92714
+ // reconstructed on reload and so executed reports render columns in the
92715
+ // same order they were arranged in the builder.
92716
+ if (report.dimensionOrder.length > 0) {
92717
+ queryObj.ordered_dimensions = report.dimensionOrder.map(entry => ({
92718
+ type: entry.type,
92719
+ ref: entry.key
92720
+ }));
92721
+ }
92722
+
92635
92723
  // Only add titles if there are any overrides
92636
92724
  if (Object.keys(titles).length > 0) {
92637
92725
  queryObj.titles = titles;
@@ -92641,6 +92729,14 @@ const ReportBuilder = ({
92641
92729
  if (filter) {
92642
92730
  queryObj.filter = filter;
92643
92731
  }
92732
+ return queryObj;
92733
+ };
92734
+
92735
+ // Convert internal report structure to API format
92736
+ const convertReportToApiFormat = (page = 0, size = 50) => {
92737
+ const queryObj = buildQueryObject();
92738
+ queryObj.limit = size;
92739
+ queryObj.offset = page * size;
92644
92740
 
92645
92741
  // Get parameters from context if available, otherwise use default
92646
92742
  const parameters = reportingContext?.parameters || {
@@ -92734,77 +92830,7 @@ const ReportBuilder = ({
92734
92830
  }
92735
92831
  try {
92736
92832
  setSaving(true);
92737
-
92738
- // Build order_by array - include all dimensions, add desc property only when needed
92739
- const orderBy = report.dimensions.map(dim => {
92740
- const orderItem = {
92741
- name: dim.fullPath
92742
- };
92743
- if (dim.sortOrder === "desc") {
92744
- orderItem.desc = true;
92745
- }
92746
- // For 'asc' or null, just include { name: fullPath } without desc property
92747
- return orderItem;
92748
- });
92749
-
92750
- // Build titles object - only include overridden titles
92751
- const titles = {};
92752
- if (Object.keys(titleOverrides.dimensions).length > 0) {
92753
- titles.dimensions = titleOverrides.dimensions;
92754
- }
92755
- if (Object.keys(titleOverrides.metrics).length > 0) {
92756
- titles.metrics = titleOverrides.metrics;
92757
- }
92758
- if (Object.keys(titleOverrides.filters).length > 0) {
92759
- titles.filters = titleOverrides.filters;
92760
- }
92761
- const queryObj = {
92762
- dimensions: report.dimensions.map(dim => dim.fullPath),
92763
- metrics: report.metrics.map(metric => metric.fullPath),
92764
- order_by: orderBy
92765
- };
92766
-
92767
- // Only add computed_dimensions if there are any
92768
- if (report.computedDimensions && report.computedDimensions.length > 0) {
92769
- queryObj.computed_dimensions = report.computedDimensions.map(cd => ({
92770
- name: cd.name,
92771
- value: cd.value
92772
- }));
92773
- }
92774
-
92775
- // Only add titles if there are any overrides
92776
- if (Object.keys(titles).length > 0) {
92777
- queryObj.titles = titles;
92778
- }
92779
-
92780
- // Add filter if there are any - NEW API format with top-level 'and' operator
92781
- // NEW format: { and: [ { "ft.currency": ["USD", "EUR"] }, { "ft_ba.created_at": {gte: "2025-05-01", lte: "2025-12-31"} } ] }
92782
- if (Object.keys(report.filters).length > 0) {
92783
- const conditions = [];
92784
- Object.entries(report.filters).forEach(([fullPath, filterData]) => {
92785
- if (filterData.values) {
92786
- // Check if values is an object (date range) or array (regular filter)
92787
- if (Array.isArray(filterData.values)) {
92788
- // Regular filter - only add if array has values
92789
- if (filterData.values.length > 0) {
92790
- conditions.push({
92791
- [fullPath]: filterData.values
92792
- });
92793
- }
92794
- } else if (typeof filterData.values === "object") {
92795
- // Date range filter - add the object as-is
92796
- conditions.push({
92797
- [fullPath]: filterData.values
92798
- });
92799
- }
92800
- }
92801
- });
92802
- if (conditions.length > 0) {
92803
- queryObj.filter = {
92804
- and: conditions
92805
- };
92806
- }
92807
- }
92833
+ const queryObj = buildQueryObject();
92808
92834
 
92809
92835
  // Build the doc object
92810
92836
  const docObj = {
@@ -92849,6 +92875,18 @@ const ReportBuilder = ({
92849
92875
  }
92850
92876
  };
92851
92877
  const canSaveReport = selectedProvider && reportTitle.trim() && (report.dimensions.length > 0 || report.metrics.length > 0 || report.computedDimensions.length > 0);
92878
+
92879
+ // Resolve the unified dimensionOrder into actual dimension/computed-dimension
92880
+ // objects so the results grid can render columns in that same order.
92881
+ const dimensionByFullPath = Object.fromEntries(report.dimensions.map(d => [d.fullPath, d]));
92882
+ const computedDimensionByName = Object.fromEntries(report.computedDimensions.map(cd => [cd.name, cd]));
92883
+ const orderedDimensionItems = report.dimensionOrder.map(entry => entry.type === "dimension" ? {
92884
+ kind: "dimension",
92885
+ data: dimensionByFullPath[entry.key]
92886
+ } : {
92887
+ kind: "computed",
92888
+ data: computedDimensionByName[entry.key]
92889
+ }).filter(item => item.data);
92852
92890
  return /*#__PURE__*/gn.createElement(Box, {
92853
92891
  sx: {
92854
92892
  p: 3,
@@ -93127,7 +93165,7 @@ const ReportBuilder = ({
93127
93165
  savedDimensions: report.dimensions,
93128
93166
  onSaveDimension: handleSaveDimension,
93129
93167
  onRemoveDimension: handleRemoveDimension,
93130
- onReorderDimensions: handleReorderDimensions,
93168
+ onUpdateDimensionSortOrder: handleUpdateDimensionSortOrder,
93131
93169
  titleOverrides: titleOverrides.dimensions,
93132
93170
  onUpdateTitle: handleUpdateDimensionTitle,
93133
93171
  onResetTitle: handleResetDimensionTitle,
@@ -93137,7 +93175,8 @@ const ReportBuilder = ({
93137
93175
  onSaveComputedDimension: handleSaveComputedDimension,
93138
93176
  onUpdateComputedDimension: handleUpdateComputedDimension,
93139
93177
  onRemoveComputedDimension: handleRemoveComputedDimension,
93140
- onReorderComputedDimensions: handleReorderComputedDimensions
93178
+ dimensionOrder: report.dimensionOrder,
93179
+ onReorderDimensionItems: handleReorderDimensionItems
93141
93180
  })), /*#__PURE__*/gn.createElement(TabPanel, {
93142
93181
  value: activeTab,
93143
93182
  index: 1
@@ -93173,9 +93212,8 @@ const ReportBuilder = ({
93173
93212
  index: 3
93174
93213
  }, reportData && /*#__PURE__*/gn.createElement(ReportDataGrid, {
93175
93214
  reportData: reportData,
93176
- dimensions: report.dimensions,
93215
+ orderedDimensionItems: orderedDimensionItems,
93177
93216
  metrics: report.metrics,
93178
- computedDimensions: report.computedDimensions,
93179
93217
  loading: loading,
93180
93218
  onPageChange: handlePageChange,
93181
93219
  totalRows: totalRows,
@@ -93238,6 +93276,44 @@ const ReportDefinitionsManager = () => {
93238
93276
  });
93239
93277
  };
93240
93278
 
93279
+ // TODO: replace with currencies fetched from the API once that's available.
93280
+ const CURRENCY_OPTIONS = [{
93281
+ key: "USD",
93282
+ value: "USD"
93283
+ }, {
93284
+ key: "EUR",
93285
+ value: "EUR"
93286
+ }, {
93287
+ key: "SEK",
93288
+ value: "SEK"
93289
+ }, {
93290
+ key: "GBP",
93291
+ value: "GBP"
93292
+ }, {
93293
+ key: "DKK",
93294
+ value: "DKK"
93295
+ }, {
93296
+ key: "NOK",
93297
+ value: "NOK"
93298
+ }];
93299
+ const CurrencySelector = () => {
93300
+ const {
93301
+ parameters,
93302
+ setParameters
93303
+ } = useReportingContext();
93304
+ return /*#__PURE__*/gn.createElement(SingleSelect, {
93305
+ items: CURRENCY_OPTIONS,
93306
+ value: parameters.base_currency,
93307
+ label: "Currency",
93308
+ onChange: e => setParameters({
93309
+ ...parameters,
93310
+ base_currency: e.target.value
93311
+ }),
93312
+ sx: {
93313
+ width: 110
93314
+ }
93315
+ });
93316
+ };
93241
93317
  const ReportApp = ({
93242
93318
  params,
93243
93319
  api
@@ -93304,7 +93380,13 @@ const ReportApp = ({
93304
93380
  }
93305
93381
  }
93306
93382
  })
93307
- }, /*#__PURE__*/gn.createElement(ReportDefinitionsManager, null))));
93383
+ }, /*#__PURE__*/gn.createElement(Box, {
93384
+ sx: {
93385
+ display: "flex",
93386
+ justifyContent: "flex-end",
93387
+ p: 1
93388
+ }
93389
+ }, /*#__PURE__*/gn.createElement(CurrencySelector, null)), /*#__PURE__*/gn.createElement(ReportDefinitionsManager, null))));
93308
93390
  };
93309
93391
 
93310
93392
  const Root = () => {