@sisense/sdk-ui 1.18.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/ai.cjs +1 -1
  2. package/dist/ai.js +32 -32
  3. package/dist/analytics-composer.cjs +1 -1
  4. package/dist/analytics-composer.js +1 -1
  5. package/dist/app/settings/settings.d.ts +1 -1
  6. package/dist/chart-data/cartesian-data.d.ts +6 -0
  7. package/dist/chart-data-options/utils.d.ts +3 -0
  8. package/dist/chart-options-processor/apply-event-handlers.d.ts +2 -1
  9. package/dist/chart-options-processor/data-points.d.ts +10 -0
  10. package/dist/charts/map-charts/areamap/areamap-utils.d.ts +11 -0
  11. package/dist/charts/map-charts/scattermap/utils/location.d.ts +2 -2
  12. package/dist/common/components/loading-indicator.d.ts +1 -150
  13. package/dist/common-filters/selection-utils.d.ts +3 -3
  14. package/dist/dashboard/utils.d.ts +0 -1
  15. package/dist/dashboard-widget/translate-dashboard-filters.d.ts +446 -450
  16. package/dist/dashboard-widget/translate-widget-filters.d.ts +53 -53
  17. package/dist/dashboard-widget/translate-widget-style-options.d.ts +3 -3
  18. package/dist/dashboard-widget/types.d.ts +55 -5
  19. package/dist/dashboard-widget/utils.d.ts +3 -1
  20. package/dist/{get-widget-options-DJexR5_Z.js → get-widget-options-ClnEbAD8.js} +3700 -3685
  21. package/dist/{get-widget-options-CDWzHX-s.cjs → get-widget-options-CzFDw_pX.cjs} +76 -76
  22. package/dist/index.cjs +184 -172
  23. package/dist/index.d.ts +4 -1
  24. package/dist/index.js +12483 -11919
  25. package/dist/models/widget/widget-model.d.ts +18 -2
  26. package/dist/plugins-provider/custom-plugins-provider.d.ts +24 -0
  27. package/dist/plugins-provider/index.d.ts +2 -0
  28. package/dist/plugins-provider/plugins-context.d.ts +9 -0
  29. package/dist/plugins-provider/plugins-provider.d.ts +15 -0
  30. package/dist/plugins-provider/types.d.ts +8 -0
  31. package/dist/props.d.ts +10 -1
  32. package/dist/sisense-chart/types.d.ts +1 -2
  33. package/dist/theme-provider/fonts-loader/fonts-loader.d.ts +5 -0
  34. package/dist/theme-provider/fonts-loader/use-fonts-loader.d.ts +2 -0
  35. package/dist/themes/legacy-design-settings.d.ts +1 -1
  36. package/dist/themes/theme-loader.d.ts +1 -1
  37. package/dist/translation/resources/en.d.ts +2 -1
  38. package/dist/translation/resources/index.d.ts +4 -2
  39. package/dist/types.d.ts +145 -13
  40. package/dist/{useQuery-CvKBErf7.js → useQuery-CHAg2bkd.js} +10626 -10286
  41. package/dist/useQuery-CV4-tm99.cjs +440 -0
  42. package/dist/utils/filters.d.ts +1 -3
  43. package/dist/utils/utility-types.d.ts +4 -0
  44. package/dist/widgets/text-widget.d.ts +4 -0
  45. package/package.json +9 -7
  46. package/dist/dashboard/components/plugin-service.d.ts +0 -21
  47. package/dist/useQuery-Jw0_qpdz.cjs +0 -433
package/dist/ai.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ne=Object.defineProperty,Ie=Object.defineProperties;var Oe=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var X=(e,t,o)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))de.call(t,o)&&X(e,o,t[o]);if(Z)for(var o of Z(t))ue.call(t,o)&&X(e,o,t[o]);return e},M=(e,t)=>Ie(e,Oe(t));var he=(e,t)=>{var o={};for(var s in e)de.call(e,s)&&t.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&Z)for(var s of Z(e))t.indexOf(s)<0&&ue.call(e,s)&&(o[s]=e[s]);return o};var S=(e,t,o)=>(X(e,typeof t!="symbol"?t+"":t,o),o);var I=(e,t,o)=>new Promise((s,i)=>{var a=d=>{try{u(o.next(d))}catch(h){i(h)}},l=d=>{try{u(o.throw(d))}catch(h){i(h)}},u=d=>d.done?s(d.value):Promise.resolve(d.value).then(a,l);u((o=o.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./useQuery-Jw0_qpdz.cjs"),n=require("react/jsx-runtime"),c=require("react"),k=require("./get-widget-options-CDWzHX-s.cjs");function We(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const B=We(c);class Ae extends r.Subscribable{constructor(t,o){super(),this.client=t,this.setOptions(o),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var o;const s=this.options;this.options=this.client.defaultMutationOptions(t),r.shallowEqualObjects(s,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(o=this.currentMutation)==null||o.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.currentMutation)==null||t.removeObserver(this)}}onMutationUpdate(t){this.updateResult();const o={listeners:!0};t.type==="success"?o.onSuccess=!0:t.type==="error"&&(o.onError=!0),this.notify(o)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(t,o){return this.mutateOptions=o,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,M(w({},this.options),{variables:typeof t!="undefined"?t:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const t=this.currentMutation?this.currentMutation.state:r.getDefaultState(),o=M(w({},t),{isLoading:t.status==="loading",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=o}notify(t){r.notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(t.onSuccess){var o,s,i,a;(o=(s=this.mutateOptions).onSuccess)==null||o.call(s,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(i=(a=this.mutateOptions).onSettled)==null||i.call(a,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(t.onError){var l,u,d,h;(l=(u=this.mutateOptions).onError)==null||l.call(u,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(d=(h=this.mutateOptions).onSettled)==null||d.call(h,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}t.listeners&&this.listeners.forEach(({listener:g})=>{g(this.currentResult)})})}}function oe(e,t,o){const s=r.parseMutationArgs(e,t),i=r.useQueryClient({context:s.context}),[a]=B.useState(()=>new Ae(i,s));B.useEffect(()=>{a.setOptions(s)},[a,s]);const l=r.useSyncExternalStore(B.useCallback(d=>a.subscribe(r.notifyManager.batchCalls(d)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u=B.useCallback((d,h)=>{a.mutate(d,h).catch(qe)},[a]);if(l.error&&r.shouldThrowError(a.options.useErrorBoundary,[l.error]))throw l.error;return M(w({},l),{mutate:u,mutateAsync:l.mutate})}function qe(){}class ze{constructor(t){S(this,"httpClient");S(this,"getChatContexts",()=>I(this,null,function*(){return(yield this.httpClient.get("api/datasources?sharedWith=r,w"))||[]}));S(this,"getNlgQueryResult",t=>this.httpClient.post("api/v2/ai/nlg/queryResult",t));S(this,"getQueryRecommendations",(t,o)=>this.httpClient.get(`api/v2/ai/recommendations/query/${t}/${o.numOfRecommendations}`));S(this,"setLlmConfig",t=>this.httpClient.post("api/v2/settings/ai/llmProvider",t).catch(o=>{console.error("Unable to set llm config",o)}));S(this,"getAllChats",()=>this.httpClient.get("api/v2/ai/chats"));S(this,"getChatById",t=>this.httpClient.get(`api/v2/ai/chats/${t}`));S(this,"createChat",t=>this.httpClient.post("api/v2/ai/chats",{sourceId:t}));S(this,"postChat",(t,o)=>this.httpClient.post(`api/v2/ai/chats/${t}`,o));S(this,"deleteChatHistory",t=>this.httpClient.delete(`api/v2/ai/chats/${t}/history`));S(this,"sendFeedback",t=>this.httpClient.post("api/v2/ai/feedback",t));S(this,"getDataSourceFields",t=>this.httpClient.post(`api/datasources/${encodeURIComponent(t)}/fields/search`,{offset:0,count:9999}));S(this,"ai",{getNlgQueryResult:this.getNlgQueryResult,getQueryRecommendations:this.getQueryRecommendations,setLlmConfig:this.setLlmConfig,sendFeedback:this.sendFeedback,getDataSourceFields:this.getDataSourceFields,chat:{getAll:this.getAllChats,getById:this.getChatById,create:this.createChat,post:this.postChat,clearHistory:this.deleteChatHistory}});this.httpClient=t}}const Qe=new r.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1}}}),fe=c.createContext(void 0),H=()=>c.useContext(fe),Ve=({children:e})=>{const{app:t}=r.useSisenseContext(),o=c.useMemo(()=>t?new ze(t.httpClient):void 0,[t]);return n.jsx(fe.Provider,{value:o,children:n.jsx(r.QueryClientProvider,{client:Qe,children:e})})};function Ze({children:e}){return n.jsx(Ve,{children:e})}const re=(e,t=!0)=>{const o=c.useMemo(()=>{var g,p;if("jaql"in e)return e;{let C;k.isDataSourceInfo(e.dataSource)?C={title:e.dataSource.title,live:e.dataSource.type==="live"}:C=e.dataSource;const{filters:v=[],relations:y}=k.getFilterListAndRelations(e.filters),{metadata:x,filterRelations:f}=r.getJaqlQueryPayload({dataSource:e.dataSource,attributes:(g=e.dimensions)!=null?g:[],measures:(p=e.measures)!=null?p:[],filters:v,filterRelations:y,highlights:[]},!0);return{jaql:{datasource:C,metadata:x,filterRelations:f}}}},[e]),s=H(),{data:i,error:a,isError:l,isLoading:u,isSuccess:d,refetch:h}=r.useQuery({queryKey:["getNlgQueryResult",o,s],queryFn:()=>s==null?void 0:s.ai.getNlgQueryResult(o),select:g=>{var p;return(p=g==null?void 0:g.data)==null?void 0:p.answer},enabled:!!s&&t});return{isLoading:u,isError:l,isSuccess:d,data:i,error:a,refetch:c.useCallback(()=>{h()},[h])}},Ge=e=>{const s=e,{enabled:t}=s,o=he(s,["enabled"]);return re(o,t)},_e=r.withTracking("useGetNlgQueryResult")(Ge),me=Object.freeze({enableFollowupQuestions:!1,enableHeader:!0,enableInsights:!0,numOfRecommendations:4,numOfRecentPrompts:5,inputPromptText:'Ask a question or type "/" for ideas',welcomeText:"Welcome to the Analytics Assistant! I can help you explore and gain insights from your data.",suggestionsWelcomeText:"Some questions you may have:"}),be=c.createContext(w({},me)),P=()=>c.useContext(be),Ue=({children:e,value:t})=>{const o=Object.entries(t).reduce((s,[i,a])=>(a!==void 0&&(s[i]=a),s),w({},me));return n.jsx(be.Provider,{value:o,children:e})},ye=e=>{const{contextTitle:t,count:o}=e,s=H(),{numOfRecommendations:i}=P(),a=o!=null?o:i,{isLoading:l,isError:u,isSuccess:d,data:h,error:g,refetch:p}=r.useQuery({queryKey:["getQueryRecommendations",t,a,s],queryFn:()=>s==null?void 0:s.ai.getQueryRecommendations(t,{numOfRecommendations:a}),enabled:!!s});return{isLoading:l,isError:u,isSuccess:d,data:h!=null?h:[],error:g,refetch:c.useCallback(()=>{p()},[p])}},Ke=r.withTracking("useGetQueryRecommendations")(ye),se="Oh snap, something went wrong. Please try again later.",Ye="Oh snap, something went wrong. Please try again later or try asking a different question.",Je="Something went wrong and we were unable to retrieve the chat thread. Let's start over!",ve="Chat unavailable. Please try again later.",ie="chatHistory",Xe=e=>{const t=H(),{hideHistory:o}=P();return r.useQuery({queryKey:[ie,e,t],queryFn:()=>I(exports,null,function*(){if(!t||!e)return;if(o)return[];const s=yield t.ai.chat.getById(e);return s==null?void 0:s.chatHistory}),enabled:!!t&&!!e})},we=e=>{const t=H(),o=r.useQueryClient();return oe({mutationFn:()=>I(exports,null,function*(){if(!(!t||!e))return t.ai.chat.clearHistory(e)}),onError:s=>{console.error("Error when clearing history:",s)},onSettled:()=>{e&&o.setQueriesData([ie,e],[])}})},ke=e=>{const{data:t,isLoading:o,isError:s}=Xe(e),{mutate:i}=we(e);return c.useEffect(()=>{s&&i()},[s,i]),{history:t,isLoading:o,isError:s}},je=()=>{const e=H(),{data:t,isLoading:o,fetchStatus:s}=r.useQuery({queryKey:["getDataTopics",e],queryFn:()=>I(exports,null,function*(){if(e)return e.getChatContexts()}),enabled:!!e});return{data:t,isLoading:o,fetchStatus:s}},Se=()=>{const e=H(),{data:t,isLoading:o}=r.useQuery({queryKey:["getAllChats",e],queryFn:()=>e==null?void 0:e.ai.chat.getAll(),enabled:!!e});return{data:t!=null?t:[],isLoading:o}},et=(e,t)=>{const o=r.useQueryClient(),s=H(),i=oe({mutationFn:()=>I(exports,null,function*(){if(!(!s||!e))return s.ai.chat.create(e)}),onSuccess:()=>o.invalidateQueries(["getAllChats"])});return c.useEffect(()=>{t&&i.isIdle&&i.mutate()},[t,i]),i},tt=e=>{switch(e.responseType=e.responseType.toLowerCase(),e.responseType){case"nlq":return{content:JSON.stringify(e.data),role:"assistant",type:"nlq"};case"text":case"error":return{content:e.data.answer,role:"assistant"};default:throw Error(`Received unknown responseType, raw response=${JSON.stringify(e)}`)}},nt=e=>{const t=r.useQueryClient(),o=c.useCallback(u=>{e&&t.setQueriesData([ie,e],d=>d&&[...d,u])},[t,e]),{enableFollowupQuestions:s}=P(),i=H(),{mutate:a,isLoading:l}=oe({mutationFn:u=>I(exports,null,function*(){if(!(!i||!e))return i.ai.chat.post(e,{text:u,options:{enableFollowup:s}})}),onMutate:u=>{o({content:u,role:"user"})},onError:u=>{u instanceof Error&&(console.error("Error when sending message:",u.message),o({content:Ye,role:"assistant"}))},onSuccess:u=>{u&&o(tt(u))}});return{mutate:a,isLoading:l}},ae=e=>!!e&&"type"in e&&e.type==="nlq",Te=e=>{var T,L;const{data:t,isLoading:o}=je(),{data:s,isLoading:i}=Se(),a=(T=t==null?void 0:t.find(j=>j.title===e))==null?void 0:T.title,l=(L=s.find(j=>j.contextTitle===a))==null?void 0:L.chatId,u=o||!!a,d=i||!!l,[h,g]=c.useState(null),{isError:p}=et(a,u&&!d),{history:C,isLoading:v,isError:y}=ke(l);c.useEffect(()=>{p?g(new Error(ve)):y&&g(new Error(Je))},[p,y]);const{mutate:x,isLoading:f}=nt(l),m=c.useMemo(()=>{if(C!=null&&C.length){const j=C[C.length-1];if(ae(j))return JSON.parse(j.content)}return null},[C]);return{chatId:l,history:C!=null?C:[],lastNlqResponse:m,sendMessage:x,isAwaitingResponse:f,isLoading:v,lastError:h}},ot=({contextTitle:e})=>{var i;const{data:t}=Se(),o=(i=t.find(a=>a.contextTitle===e))==null?void 0:i.chatId,{history:s}=ke(o);return c.useMemo(()=>{if(s!=null&&s.length){const a=s[s.length-1];if(ae(a))return JSON.parse(a.content)}return null},[s])},rt=e=>{const t=H(),{data:o,isLoading:s}=r.useQuery({queryKey:["getDataSourceFields",e,t],queryFn:()=>e?t==null?void 0:t.ai.getDataSourceFields(e):void 0,select:i=>i,enabled:!!t&&!!e});return{data:o,isLoading:s}},st=500,it=500,at=500,lt=900,ct=r.newStyled.div`
1
+ "use strict";var Ne=Object.defineProperty,Ie=Object.defineProperties;var Oe=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var X=(e,t,o)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))de.call(t,o)&&X(e,o,t[o]);if(Z)for(var o of Z(t))ue.call(t,o)&&X(e,o,t[o]);return e},M=(e,t)=>Ie(e,Oe(t));var he=(e,t)=>{var o={};for(var s in e)de.call(e,s)&&t.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&Z)for(var s of Z(e))t.indexOf(s)<0&&ue.call(e,s)&&(o[s]=e[s]);return o};var S=(e,t,o)=>(X(e,typeof t!="symbol"?t+"":t,o),o);var I=(e,t,o)=>new Promise((s,i)=>{var a=d=>{try{u(o.next(d))}catch(h){i(h)}},l=d=>{try{u(o.throw(d))}catch(h){i(h)}},u=d=>d.done?s(d.value):Promise.resolve(d.value).then(a,l);u((o=o.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./useQuery-CV4-tm99.cjs"),n=require("react/jsx-runtime"),c=require("react"),k=require("./get-widget-options-CzFDw_pX.cjs");function We(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const B=We(c);class Ae extends r.Subscribable{constructor(t,o){super(),this.client=t,this.setOptions(o),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var o;const s=this.options;this.options=this.client.defaultMutationOptions(t),r.shallowEqualObjects(s,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(o=this.currentMutation)==null||o.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.currentMutation)==null||t.removeObserver(this)}}onMutationUpdate(t){this.updateResult();const o={listeners:!0};t.type==="success"?o.onSuccess=!0:t.type==="error"&&(o.onError=!0),this.notify(o)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(t,o){return this.mutateOptions=o,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,M(w({},this.options),{variables:typeof t!="undefined"?t:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const t=this.currentMutation?this.currentMutation.state:r.getDefaultState(),o=M(w({},t),{isLoading:t.status==="loading",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=o}notify(t){r.notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(t.onSuccess){var o,s,i,a;(o=(s=this.mutateOptions).onSuccess)==null||o.call(s,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(i=(a=this.mutateOptions).onSettled)==null||i.call(a,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(t.onError){var l,u,d,h;(l=(u=this.mutateOptions).onError)==null||l.call(u,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(d=(h=this.mutateOptions).onSettled)==null||d.call(h,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}t.listeners&&this.listeners.forEach(({listener:g})=>{g(this.currentResult)})})}}function oe(e,t,o){const s=r.parseMutationArgs(e,t),i=r.useQueryClient({context:s.context}),[a]=B.useState(()=>new Ae(i,s));B.useEffect(()=>{a.setOptions(s)},[a,s]);const l=r.useSyncExternalStore(B.useCallback(d=>a.subscribe(r.notifyManager.batchCalls(d)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u=B.useCallback((d,h)=>{a.mutate(d,h).catch(qe)},[a]);if(l.error&&r.shouldThrowError(a.options.useErrorBoundary,[l.error]))throw l.error;return M(w({},l),{mutate:u,mutateAsync:l.mutate})}function qe(){}class ze{constructor(t){S(this,"httpClient");S(this,"getChatContexts",()=>I(this,null,function*(){return(yield this.httpClient.get("api/datasources?sharedWith=r,w"))||[]}));S(this,"getNlgQueryResult",t=>this.httpClient.post("api/v2/ai/nlg/queryResult",t));S(this,"getQueryRecommendations",(t,o)=>this.httpClient.get(`api/v2/ai/recommendations/query/${t}/${o.numOfRecommendations}`));S(this,"setLlmConfig",t=>this.httpClient.post("api/v2/settings/ai/llmProvider",t).catch(o=>{console.error("Unable to set llm config",o)}));S(this,"getAllChats",()=>this.httpClient.get("api/v2/ai/chats"));S(this,"getChatById",t=>this.httpClient.get(`api/v2/ai/chats/${t}`));S(this,"createChat",t=>this.httpClient.post("api/v2/ai/chats",{sourceId:t}));S(this,"postChat",(t,o)=>this.httpClient.post(`api/v2/ai/chats/${t}`,o));S(this,"deleteChatHistory",t=>this.httpClient.delete(`api/v2/ai/chats/${t}/history`));S(this,"sendFeedback",t=>this.httpClient.post("api/v2/ai/feedback",t));S(this,"getDataSourceFields",t=>this.httpClient.post(`api/datasources/${encodeURIComponent(t)}/fields/search`,{offset:0,count:9999}));S(this,"ai",{getNlgQueryResult:this.getNlgQueryResult,getQueryRecommendations:this.getQueryRecommendations,setLlmConfig:this.setLlmConfig,sendFeedback:this.sendFeedback,getDataSourceFields:this.getDataSourceFields,chat:{getAll:this.getAllChats,getById:this.getChatById,create:this.createChat,post:this.postChat,clearHistory:this.deleteChatHistory}});this.httpClient=t}}const Qe=new r.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1}}}),fe=c.createContext(void 0),H=()=>c.useContext(fe),Ve=({children:e})=>{const{app:t}=r.useSisenseContext(),o=c.useMemo(()=>t?new ze(t.httpClient):void 0,[t]);return n.jsx(fe.Provider,{value:o,children:n.jsx(r.QueryClientProvider,{client:Qe,children:e})})};function Ze({children:e}){return n.jsx(Ve,{children:e})}const re=(e,t=!0)=>{const o=c.useMemo(()=>{var g,p;if("jaql"in e)return e;{let C;k.isDataSourceInfo(e.dataSource)?C={title:e.dataSource.title,live:e.dataSource.type==="live"}:C=e.dataSource;const{filters:v=[],relations:y}=k.getFilterListAndRelations(e.filters),{metadata:x,filterRelations:f}=r.getJaqlQueryPayload({dataSource:e.dataSource,attributes:(g=e.dimensions)!=null?g:[],measures:(p=e.measures)!=null?p:[],filters:v,filterRelations:y,highlights:[]},!0);return{jaql:{datasource:C,metadata:x,filterRelations:f}}}},[e]),s=H(),{data:i,error:a,isError:l,isLoading:u,isSuccess:d,refetch:h}=r.useQuery({queryKey:["getNlgQueryResult",o,s],queryFn:()=>s==null?void 0:s.ai.getNlgQueryResult(o),select:g=>{var p;return(p=g==null?void 0:g.data)==null?void 0:p.answer},enabled:!!s&&t});return{isLoading:u,isError:l,isSuccess:d,data:i,error:a,refetch:c.useCallback(()=>{h()},[h])}},Ge=e=>{const s=e,{enabled:t}=s,o=he(s,["enabled"]);return re(o,t)},_e=r.withTracking("useGetNlgQueryResult")(Ge),me=Object.freeze({enableFollowupQuestions:!1,enableHeader:!0,enableInsights:!0,numOfRecommendations:4,numOfRecentPrompts:5,inputPromptText:'Ask a question or type "/" for ideas',welcomeText:"Welcome to the Analytics Assistant! I can help you explore and gain insights from your data.",suggestionsWelcomeText:"Some questions you may have:"}),be=c.createContext(w({},me)),P=()=>c.useContext(be),Ue=({children:e,value:t})=>{const o=Object.entries(t).reduce((s,[i,a])=>(a!==void 0&&(s[i]=a),s),w({},me));return n.jsx(be.Provider,{value:o,children:e})},ye=e=>{const{contextTitle:t,count:o}=e,s=H(),{numOfRecommendations:i}=P(),a=o!=null?o:i,{isLoading:l,isError:u,isSuccess:d,data:h,error:g,refetch:p}=r.useQuery({queryKey:["getQueryRecommendations",t,a,s],queryFn:()=>s==null?void 0:s.ai.getQueryRecommendations(t,{numOfRecommendations:a}),enabled:!!s});return{isLoading:l,isError:u,isSuccess:d,data:h!=null?h:[],error:g,refetch:c.useCallback(()=>{p()},[p])}},Ke=r.withTracking("useGetQueryRecommendations")(ye),se="Oh snap, something went wrong. Please try again later.",Ye="Oh snap, something went wrong. Please try again later or try asking a different question.",Je="Something went wrong and we were unable to retrieve the chat thread. Let's start over!",ve="Chat unavailable. Please try again later.",ie="chatHistory",Xe=e=>{const t=H(),{hideHistory:o}=P();return r.useQuery({queryKey:[ie,e,t],queryFn:()=>I(exports,null,function*(){if(!t||!e)return;if(o)return[];const s=yield t.ai.chat.getById(e);return s==null?void 0:s.chatHistory}),enabled:!!t&&!!e})},we=e=>{const t=H(),o=r.useQueryClient();return oe({mutationFn:()=>I(exports,null,function*(){if(!(!t||!e))return t.ai.chat.clearHistory(e)}),onError:s=>{console.error("Error when clearing history:",s)},onSettled:()=>{e&&o.setQueriesData([ie,e],[])}})},ke=e=>{const{data:t,isLoading:o,isError:s}=Xe(e),{mutate:i}=we(e);return c.useEffect(()=>{s&&i()},[s,i]),{history:t,isLoading:o,isError:s}},je=()=>{const e=H(),{data:t,isLoading:o,fetchStatus:s}=r.useQuery({queryKey:["getDataTopics",e],queryFn:()=>I(exports,null,function*(){if(e)return e.getChatContexts()}),enabled:!!e});return{data:t,isLoading:o,fetchStatus:s}},Se=()=>{const e=H(),{data:t,isLoading:o}=r.useQuery({queryKey:["getAllChats",e],queryFn:()=>e==null?void 0:e.ai.chat.getAll(),enabled:!!e});return{data:t!=null?t:[],isLoading:o}},et=(e,t)=>{const o=r.useQueryClient(),s=H(),i=oe({mutationFn:()=>I(exports,null,function*(){if(!(!s||!e))return s.ai.chat.create(e)}),onSuccess:()=>o.invalidateQueries(["getAllChats"])});return c.useEffect(()=>{t&&i.isIdle&&i.mutate()},[t,i]),i},tt=e=>{switch(e.responseType=e.responseType.toLowerCase(),e.responseType){case"nlq":return{content:JSON.stringify(e.data),role:"assistant",type:"nlq"};case"text":case"error":return{content:e.data.answer,role:"assistant"};default:throw Error(`Received unknown responseType, raw response=${JSON.stringify(e)}`)}},nt=e=>{const t=r.useQueryClient(),o=c.useCallback(u=>{e&&t.setQueriesData([ie,e],d=>d&&[...d,u])},[t,e]),{enableFollowupQuestions:s}=P(),i=H(),{mutate:a,isLoading:l}=oe({mutationFn:u=>I(exports,null,function*(){if(!(!i||!e))return i.ai.chat.post(e,{text:u,options:{enableFollowup:s}})}),onMutate:u=>{o({content:u,role:"user"})},onError:u=>{u instanceof Error&&(console.error("Error when sending message:",u.message),o({content:Ye,role:"assistant"}))},onSuccess:u=>{u&&o(tt(u))}});return{mutate:a,isLoading:l}},ae=e=>!!e&&"type"in e&&e.type==="nlq",Te=e=>{var T,L;const{data:t,isLoading:o}=je(),{data:s,isLoading:i}=Se(),a=(T=t==null?void 0:t.find(j=>j.title===e))==null?void 0:T.title,l=(L=s.find(j=>j.contextTitle===a))==null?void 0:L.chatId,u=o||!!a,d=i||!!l,[h,g]=c.useState(null),{isError:p}=et(a,u&&!d),{history:C,isLoading:v,isError:y}=ke(l);c.useEffect(()=>{p?g(new Error(ve)):y&&g(new Error(Je))},[p,y]);const{mutate:x,isLoading:f}=nt(l),m=c.useMemo(()=>{if(C!=null&&C.length){const j=C[C.length-1];if(ae(j))return JSON.parse(j.content)}return null},[C]);return{chatId:l,history:C!=null?C:[],lastNlqResponse:m,sendMessage:x,isAwaitingResponse:f,isLoading:v,lastError:h}},ot=({contextTitle:e})=>{var i;const{data:t}=Se(),o=(i=t.find(a=>a.contextTitle===e))==null?void 0:i.chatId,{history:s}=ke(o);return c.useMemo(()=>{if(s!=null&&s.length){const a=s[s.length-1];if(ae(a))return JSON.parse(a.content)}return null},[s])},rt=e=>{const t=H(),{data:o,isLoading:s}=r.useQuery({queryKey:["getDataSourceFields",e,t],queryFn:()=>e?t==null?void 0:t.ai.getDataSourceFields(e):void 0,select:i=>i,enabled:!!t&&!!e});return{data:o,isLoading:s}},st=500,it=500,at=500,lt=900,ct=r.newStyled.div`
2
2
  box-sizing: border-box;
3
3
  position: relative;
4
4
  display: flex;
package/dist/ai.js CHANGED
@@ -20,7 +20,7 @@ var Ee = (e, t) => {
20
20
  return n;
21
21
  };
22
22
  var $ = (e, t, n) => (pe(e, typeof t != "symbol" ? t + "" : t, n), n);
23
- var Q = (e, t, n) => new Promise((r, i) => {
23
+ var Z = (e, t, n) => new Promise((r, i) => {
24
24
  var s = (l) => {
25
25
  try {
26
26
  c(n.next(l));
@@ -36,12 +36,12 @@ var Q = (e, t, n) => new Promise((r, i) => {
36
36
  }, c = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(s, a);
37
37
  c((n = n.apply(e, t)).next());
38
38
  });
39
- import { aV as ht, aW as pt, aX as Ie, aY as gt, aZ as K, a_ as Ct, a$ as ft, b0 as mt, aC as bt, l as xt, aD as yt, g as vt, aK as _, w as Oe, n as u, c as L, m as b, am as We, Y as wt, b1 as kt, $ as St, _ as Rt, a0 as ae, b2 as Lt, b3 as Mt, a9 as j, a2 as Z, b4 as Pe, ab as $t, b5 as Et, a4 as Tt, b6 as Ht, a6 as ge, a7 as g, aa as Bt, b7 as Dt, b8 as Ae, b9 as Ft, ak as Nt, Q as Te, S as He, ap as It, I as qe } from "./useQuery-CvKBErf7.js";
39
+ import { b0 as ht, b1 as pt, b2 as Ie, b3 as gt, b4 as K, b5 as Ct, b6 as ft, b7 as mt, aJ as bt, l as xt, aK as yt, g as vt, aR as _, w as Oe, n as u, c as L, m as b, an as We, Z as wt, b8 as kt, a0 as St, $ as Rt, a1 as ae, b9 as Lt, ba as Mt, aa as j, a3 as Q, bb as Pe, ac as $t, bc as Et, a5 as Tt, bd as Ht, a7 as ge, a8 as g, ab as Bt, be as Dt, bf as Ae, bg as Ft, al as Nt, S as Te, U as He, aq as It, I as qe } from "./useQuery-CHAg2bkd.js";
40
40
  import { jsx as o, jsxs as p, Fragment as H } from "react/jsx-runtime";
41
41
  import * as q from "react";
42
42
  import { createContext as xe, useMemo as F, useContext as ze, useCallback as E, useEffect as le, useState as k, useRef as U, useLayoutEffect as ie, Component as Ot, createElement as me, isValidElement as Wt, memo as Pt, forwardRef as At } from "react";
43
- import { p as qt, b5 as zt, X as Ve, b6 as Vt, b7 as Qt, b8 as Zt, b9 as Gt, ba as jt, V as Ut, W as _t } from "./get-widget-options-DJexR5_Z.js";
44
- import { bc as Mr, bb as $r } from "./get-widget-options-DJexR5_Z.js";
43
+ import { p as qt, b2 as zt, Z as Ve, b3 as Vt, b4 as Zt, b5 as Qt, b6 as Gt, b7 as jt, X as Ut, Y as _t } from "./get-widget-options-ClnEbAD8.js";
44
+ import { b9 as Mr, b8 as $r } from "./get-widget-options-ClnEbAD8.js";
45
45
  class Kt extends ht {
46
46
  constructor(t, n) {
47
47
  super(), this.client = t, this.setOptions(n), this.bindMethods(), this.updateResult();
@@ -136,7 +136,7 @@ function Yt() {
136
136
  class Xt {
137
137
  constructor(t) {
138
138
  $(this, "httpClient");
139
- $(this, "getChatContexts", () => Q(this, null, function* () {
139
+ $(this, "getChatContexts", () => Z(this, null, function* () {
140
140
  return (yield this.httpClient.get("api/datasources?sharedWith=r,w")) || [];
141
141
  }));
142
142
  // ==== /v2/ai endpoints ====
@@ -186,9 +186,9 @@ const Jt = new bt({
186
186
  refetchOnMount: !1
187
187
  }
188
188
  }
189
- }), Qe = xe(void 0), W = () => ze(Qe), en = ({ children: e }) => {
189
+ }), Ze = xe(void 0), W = () => ze(Ze), en = ({ children: e }) => {
190
190
  const { app: t } = xt(), n = F(() => t ? new Xt(t.httpClient) : void 0, [t]);
191
- return /* @__PURE__ */ o(Qe.Provider, { value: n, children: /* @__PURE__ */ o(yt, { client: Jt, children: e }) });
191
+ return /* @__PURE__ */ o(Ze.Provider, { value: n, children: /* @__PURE__ */ o(yt, { client: Jt, children: e }) });
192
192
  };
193
193
  function br({ children: e }) {
194
194
  return /* @__PURE__ */ o(en, { children: e });
@@ -244,7 +244,7 @@ const ve = (e, t = !0) => {
244
244
  return ve(n, t);
245
245
  }, xr = Oe("useGetNlgQueryResult")(
246
246
  tn
247
- ), Ze = Object.freeze({
247
+ ), Qe = Object.freeze({
248
248
  enableFollowupQuestions: !1,
249
249
  enableHeader: !0,
250
250
  enableInsights: !0,
@@ -253,10 +253,10 @@ const ve = (e, t = !0) => {
253
253
  inputPromptText: 'Ask a question or type "/" for ideas',
254
254
  welcomeText: "Welcome to the Analytics Assistant! I can help you explore and gain insights from your data.",
255
255
  suggestionsWelcomeText: "Some questions you may have:"
256
- }), Ge = xe(R({}, Ze)), P = () => ze(Ge), nn = ({ children: e, value: t }) => {
256
+ }), Ge = xe(R({}, Qe)), P = () => ze(Ge), nn = ({ children: e, value: t }) => {
257
257
  const n = Object.entries(t).reduce(
258
258
  (r, [i, s]) => (s !== void 0 && (r[i] = s), r),
259
- R({}, Ze)
259
+ R({}, Qe)
260
260
  );
261
261
  return /* @__PURE__ */ o(Ge.Provider, { value: n, children: e });
262
262
  }, je = (e) => {
@@ -283,7 +283,7 @@ const ve = (e, t = !0) => {
283
283
  const t = W(), { hideHistory: n } = P();
284
284
  return _({
285
285
  queryKey: [ke, e, t],
286
- queryFn: () => Q(void 0, null, function* () {
286
+ queryFn: () => Z(void 0, null, function* () {
287
287
  if (!t || !e)
288
288
  return;
289
289
  if (n)
@@ -296,7 +296,7 @@ const ve = (e, t = !0) => {
296
296
  }, _e = (e) => {
297
297
  const t = W(), n = K();
298
298
  return ye({
299
- mutationFn: () => Q(void 0, null, function* () {
299
+ mutationFn: () => Z(void 0, null, function* () {
300
300
  if (!(!t || !e))
301
301
  return t.ai.chat.clearHistory(e);
302
302
  }),
@@ -319,7 +319,7 @@ const ve = (e, t = !0) => {
319
319
  }, Ye = () => {
320
320
  const e = W(), { data: t, isLoading: n, fetchStatus: r } = _({
321
321
  queryKey: ["getDataTopics", e],
322
- queryFn: () => Q(void 0, null, function* () {
322
+ queryFn: () => Z(void 0, null, function* () {
323
323
  if (e)
324
324
  return e.getChatContexts();
325
325
  }),
@@ -338,7 +338,7 @@ const ve = (e, t = !0) => {
338
338
  };
339
339
  }, an = (e, t) => {
340
340
  const n = K(), r = W(), i = ye({
341
- mutationFn: () => Q(void 0, null, function* () {
341
+ mutationFn: () => Z(void 0, null, function* () {
342
342
  if (!(!r || !e))
343
343
  return r.ai.chat.create(e);
344
344
  }),
@@ -371,7 +371,7 @@ const ve = (e, t = !0) => {
371
371
  },
372
372
  [t, e]
373
373
  ), { enableFollowupQuestions: r } = P(), i = W(), { mutate: s, isLoading: a } = ye({
374
- mutationFn: (c) => Q(void 0, null, function* () {
374
+ mutationFn: (c) => Z(void 0, null, function* () {
375
375
  if (!(!i || !e))
376
376
  return i.ai.chat.post(e, {
377
377
  text: c,
@@ -1103,12 +1103,12 @@ function Vn() {
1103
1103
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
1104
1104
  return e.length !== t.length || e.some((n, r) => !Object.is(n, t[r]));
1105
1105
  }
1106
- function Qn(e) {
1106
+ function Zn(e) {
1107
1107
  return Rt("MuiDialog", e);
1108
1108
  }
1109
1109
  const fe = St("MuiDialog", ["root", "scrollPaper", "scrollBody", "container", "paper", "paperScrollPaper", "paperScrollBody", "paperWidthFalse", "paperWidthXs", "paperWidthSm", "paperWidthMd", "paperWidthLg", "paperWidthXl", "paperFullWidth", "paperFullScreen"]), nt = /* @__PURE__ */ q.createContext({});
1110
1110
  process.env.NODE_ENV !== "production" && (nt.displayName = "DialogContext");
1111
- const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "BackdropProps", "children", "className", "disableEscapeKeyDown", "fullScreen", "fullWidth", "maxWidth", "onBackdropClick", "onClick", "onClose", "open", "PaperComponent", "PaperProps", "scroll", "TransitionComponent", "transitionDuration", "TransitionProps"], Gn = ae(Lt, {
1111
+ const Qn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "BackdropProps", "children", "className", "disableEscapeKeyDown", "fullScreen", "fullWidth", "maxWidth", "onBackdropClick", "onClick", "onClose", "open", "PaperComponent", "PaperProps", "scroll", "TransitionComponent", "transitionDuration", "TransitionProps"], Gn = ae(Lt, {
1112
1112
  name: "MuiDialog",
1113
1113
  slot: "Backdrop",
1114
1114
  overrides: (e, t) => t.backdrop
@@ -1127,7 +1127,7 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1127
1127
  container: ["container", `scroll${j(n)}`],
1128
1128
  paper: ["paper", `paperScroll${j(n)}`, `paperWidth${j(String(r))}`, i && "paperFullWidth", s && "paperFullScreen"]
1129
1129
  };
1130
- return Bt(a, Qn, t);
1130
+ return Bt(a, Zn, t);
1131
1131
  }, Un = ae(Mt, {
1132
1132
  name: "MuiDialog",
1133
1133
  slot: "Root",
@@ -1148,7 +1148,7 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1148
1148
  }
1149
1149
  })(({
1150
1150
  ownerState: e
1151
- }) => Z({
1151
+ }) => Q({
1152
1152
  height: "100%",
1153
1153
  "@media print": {
1154
1154
  height: "auto"
@@ -1182,7 +1182,7 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1182
1182
  })(({
1183
1183
  theme: e,
1184
1184
  ownerState: t
1185
- }) => Z({
1185
+ }) => Q({
1186
1186
  margin: 32,
1187
1187
  position: "relative",
1188
1188
  overflowY: "auto",
@@ -1257,7 +1257,7 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1257
1257
  TransitionComponent: ee = Dt,
1258
1258
  transitionDuration: te = s,
1259
1259
  TransitionProps: de
1260
- } = r, ue = Tt(r, Zn), V = Z({}, r, {
1260
+ } = r, ue = Tt(r, Qn), V = Q({}, r, {
1261
1261
  disableEscapeKeyDown: f,
1262
1262
  fullScreen: S,
1263
1263
  fullWidth: w,
@@ -1270,14 +1270,14 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1270
1270
  }, v = Ht(c), O = q.useMemo(() => ({
1271
1271
  titleId: v
1272
1272
  }), [v]);
1273
- return /* @__PURE__ */ o(Un, Z({
1273
+ return /* @__PURE__ */ o(Un, Q({
1274
1274
  className: ge(G.root, h),
1275
1275
  closeAfterTransition: !0,
1276
1276
  components: {
1277
1277
  Backdrop: Gn
1278
1278
  },
1279
1279
  componentsProps: {
1280
- backdrop: Z({
1280
+ backdrop: Q({
1281
1281
  transitionDuration: te,
1282
1282
  as: l
1283
1283
  }, d)
@@ -1289,7 +1289,7 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1289
1289
  onClick: he,
1290
1290
  ownerState: V
1291
1291
  }, ue, {
1292
- children: /* @__PURE__ */ o(ee, Z({
1292
+ children: /* @__PURE__ */ o(ee, Q({
1293
1293
  appear: !0,
1294
1294
  in: N,
1295
1295
  timeout: te,
@@ -1299,7 +1299,7 @@ const Zn = ["aria-describedby", "aria-labelledby", "BackdropComponent", "Backdro
1299
1299
  className: ge(G.container),
1300
1300
  onMouseDown: ne,
1301
1301
  ownerState: V,
1302
- children: /* @__PURE__ */ o(Kn, Z({
1302
+ children: /* @__PURE__ */ o(Kn, Q({
1303
1303
  as: M,
1304
1304
  elevation: 24,
1305
1305
  role: "dialog",
@@ -1705,14 +1705,14 @@ function lo({ content: e, dataSource: t }) {
1705
1705
  }, h = c.metadata.filter((m) => m.panel === "scope").map(Vt), f = c.metadata.filter((m) => m.panel !== "scope");
1706
1706
  let S, w;
1707
1707
  if (d === "table") {
1708
- const { dataOptions: m } = Qt(f), x = {
1708
+ const { dataOptions: m } = Zt(f), x = {
1709
1709
  dataOptions: m,
1710
1710
  dataSource: t,
1711
1711
  filters: h
1712
1712
  };
1713
1713
  S = /* @__PURE__ */ o("div", { className: "csdk-h-[245px]", children: /* @__PURE__ */ o(Te, D(R({}, x), { styleOptions: C })) }), w = /* @__PURE__ */ o(Te, D(R({}, x), { styleOptions: { header: { hidden: !0 } } }));
1714
1714
  } else {
1715
- const { dataOptions: m, chartStyleOptions: x, expandedChartStyleOptions: y } = Zt(
1715
+ const { dataOptions: m, chartStyleOptions: x, expandedChartStyleOptions: y } = Qt(
1716
1716
  f,
1717
1717
  l
1718
1718
  ), T = R(R({}, x), C), N = {
@@ -2180,7 +2180,7 @@ const qo = (e, t) => {
2180
2180
  `, Vo = ({ onClick: e }) => {
2181
2181
  const { themeSettings: t } = b();
2182
2182
  return /* @__PURE__ */ o(zo, { theme: t, onClick: e, children: /* @__PURE__ */ o(Ao, {}) });
2183
- }, Qo = ({ isVisible: e, onClick: t, anchorElement: n }) => /* @__PURE__ */ o(We, { anchorEl: n, open: e, placement: "top", sx: { zIndex: 2 }, children: /* @__PURE__ */ o(Vo, { onClick: t }) }), Zo = u.div`
2183
+ }, Zo = ({ isVisible: e, onClick: t, anchorElement: n }) => /* @__PURE__ */ o(We, { anchorEl: n, open: e, placement: "top", sx: { zIndex: 2 }, children: /* @__PURE__ */ o(Vo, { onClick: t }) }), Qo = u.div`
2184
2184
  display: flex;
2185
2185
  flex-direction: column;
2186
2186
  row-gap: ${({ theme: e }) => e.aiChat.body.gapBetweenMessages};
@@ -2258,9 +2258,9 @@ function Uo({ contextTitle: e, onGoBack: t }) {
2258
2258
  /* @__PURE__ */ o(et, { text: f.message })
2259
2259
  ] }) : /* @__PURE__ */ p(H, { children: [
2260
2260
  ne,
2261
- /* @__PURE__ */ p(Zo, { ref: B, theme: I, onScroll: te, children: [
2261
+ /* @__PURE__ */ p(Qo, { ref: B, theme: I, onScroll: te, children: [
2262
2262
  /* @__PURE__ */ o(
2263
- Qo,
2263
+ Zo,
2264
2264
  {
2265
2265
  isVisible: y,
2266
2266
  anchorElement: ee.current,
@@ -2499,8 +2499,8 @@ export {
2499
2499
  Sr as GetNlgQueryResult,
2500
2500
  Mr as JaqlElement,
2501
2501
  $r as deriveChartFamily,
2502
- Zt as getChartOptions,
2503
- Qt as getTableOptions,
2502
+ Qt as getChartOptions,
2503
+ Zt as getTableOptions,
2504
2504
  dn as useChatSession,
2505
2505
  wr as useGetDataSourceFields,
2506
2506
  xr as useGetNlgQueryResult,
@@ -1,4 +1,4 @@
1
- "use strict";var xs=Object.defineProperty,Zs=Object.defineProperties;var en=Object.getOwnPropertyDescriptors;var qe=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var ct=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var ft=(s,e,t)=>e in s?xs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,K=(s,e)=>{for(var t in e||(e={}))Ut.call(e,t)&&ft(s,t,e[t]);if(qe)for(var t of qe(e))Vt.call(e,t)&&ft(s,t,e[t]);return s},H=(s,e)=>Zs(s,en(e));var Jt=(s,e)=>{var t={};for(var n in s)Ut.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&qe)for(var n of qe(s))e.indexOf(n)<0&&Vt.call(s,n)&&(t[n]=s[n]);return t};var F=(s,e,t)=>(ft(s,typeof e!="symbol"?e+"":e,t),t);var ut=(s,e,t)=>new Promise((n,i)=>{var r=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,o);a((t=t.apply(s,e)).next())}),tn=function(s,e){this[0]=s,this[1]=e};var d=s=>{var e=s[ct("asyncIterator")],t=!1,n,i={};return e==null?(e=s[ct("iterator")](),n=r=>i[r]=o=>e[r](o)):(e=e.call(s),n=r=>i[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new tn(new Promise(a=>{var l=e[r](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[ct("iterator")]=()=>i,n("next"),"throw"in e?n("throw"):i.throw=r=>{throw r},"return"in e&&n("return"),i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./get-widget-options-CDWzHX-s.cjs"),sn={jaql:{datasource:{title:""},metadata:[]},queryTitle:"",chartRecommendations:{}},wt={model:"",metadata:[],chart:{},queryTitle:""};function nn(s){return s.replace(/\s+/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function rn(s){return s.charAt(0).toUpperCase()+s.slice(1)}function on(s){const e=/\[(.+?)\s\(Calendar\)\]/;return s.replace(e,"[$1]").trim()}function an(s){if(s)if(s.metadata){if(!s.model)throw Error("Missing model title")}else throw Error("Missing metadata");else throw Error("Empty model");return s}function ln(s){return!s||!s.jaql.datasource.title||!s.jaql.metadata.length}function Ie(s){return s&&s.replace(new RegExp("(?<!\\\\)'","g"),"\\'")}const cn={react:{baseChartTmpl:`import { {{componentString}} } from '@sisense/sdk-ui';
1
+ "use strict";var xs=Object.defineProperty,Zs=Object.defineProperties;var en=Object.getOwnPropertyDescriptors;var qe=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var ct=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var ft=(s,e,t)=>e in s?xs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,K=(s,e)=>{for(var t in e||(e={}))Ut.call(e,t)&&ft(s,t,e[t]);if(qe)for(var t of qe(e))Vt.call(e,t)&&ft(s,t,e[t]);return s},H=(s,e)=>Zs(s,en(e));var Jt=(s,e)=>{var t={};for(var n in s)Ut.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&qe)for(var n of qe(s))e.indexOf(n)<0&&Vt.call(s,n)&&(t[n]=s[n]);return t};var F=(s,e,t)=>(ft(s,typeof e!="symbol"?e+"":e,t),t);var ut=(s,e,t)=>new Promise((n,i)=>{var r=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,o);a((t=t.apply(s,e)).next())}),tn=function(s,e){this[0]=s,this[1]=e};var d=s=>{var e=s[ct("asyncIterator")],t=!1,n,i={};return e==null?(e=s[ct("iterator")](),n=r=>i[r]=o=>e[r](o)):(e=e.call(s),n=r=>i[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new tn(new Promise(a=>{var l=e[r](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[ct("iterator")]=()=>i,n("next"),"throw"in e?n("throw"):i.throw=r=>{throw r},"return"in e&&n("return"),i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./get-widget-options-CzFDw_pX.cjs"),sn={jaql:{datasource:{title:""},metadata:[]},queryTitle:"",chartRecommendations:{}},wt={model:"",metadata:[],chart:{},queryTitle:""};function nn(s){return s.replace(/\s+/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function rn(s){return s.charAt(0).toUpperCase()+s.slice(1)}function on(s){const e=/\[(.+?)\s\(Calendar\)\]/;return s.replace(e,"[$1]").trim()}function an(s){if(s)if(s.metadata){if(!s.model)throw Error("Missing model title")}else throw Error("Missing metadata");else throw Error("Empty model");return s}function ln(s){return!s||!s.jaql.datasource.title||!s.jaql.metadata.length}function Ie(s){return s&&s.replace(new RegExp("(?<!\\\\)'","g"),"\\'")}const cn={react:{baseChartTmpl:`import { {{componentString}} } from '@sisense/sdk-ui';
2
2
  {{extraImportsString}}
3
3
  import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
4
4
 
@@ -60,7 +60,7 @@ var d = (s) => {
60
60
  throw r;
61
61
  }, "return" in e && n("return"), i;
62
62
  };
63
- import { bc as rn, cJ as is, y as rs, o as on, h as an, aS as Je, b8 as ln, bb as cn, cK as fn } from "./get-widget-options-DJexR5_Z.js";
63
+ import { b9 as rn, cH as is, y as rs, o as on, h as an, aS as Je, b5 as ln, b8 as cn, cI as fn } from "./get-widget-options-ClnEbAD8.js";
64
64
  const qi = {
65
65
  jaql: { datasource: { title: "" }, metadata: [] },
66
66
  queryTitle: "",
@@ -26,5 +26,5 @@ type ServerSettings = {
26
26
  * @param isWat - Whether the application is running with WAT authentication
27
27
  * @returns - Application settings
28
28
  */
29
- export declare function getSettings(customConfig: ConfigurableAppSettings, httpClient: Pick<HttpClient, 'get'>, useDefaultPalette?: boolean): Promise<AppSettings>;
29
+ export declare function getSettings(customConfig: ConfigurableAppSettings, httpClient: Pick<HttpClient, 'get' | 'url'>, useDefaultPalette?: boolean): Promise<AppSettings>;
30
30
  export {};
@@ -3,6 +3,12 @@ import { Column, DataTable } from '../chart-data-processor/table-processor';
3
3
  import { CartesianChartData, CategoricalXValues } from './types';
4
4
  import { CartesianChartDataOptionsInternal, Value } from '../chart-data-options/types';
5
5
  export declare const validateCartesianChartDataOptions: (chartDataOptions: CartesianChartDataOptionsInternal) => CartesianChartDataOptionsInternal;
6
+ /**
7
+ * Creates cartesian data for chart like line/area/bar and others given table of data and options
8
+ * @param chartDataOptions - Internal cartesian chart data options
9
+ * @param dataTable - Data table
10
+ * @returns Cartesian chart data
11
+ */
6
12
  export declare const cartesianData: (chartDataOptions: CartesianChartDataOptionsInternal, dataTable: DataTable) => CartesianChartData;
7
13
  export declare const sortDirection: (sortType: SortDirection | undefined) => 1 | -1 | 0;
8
14
  export declare const getOrderedXValues: (dataTable: DataTable, sortedMeasures: Value[], xColumns: Column[], rownumColumnName?: string) => CategoricalXValues[];
@@ -23,4 +23,7 @@ export declare const translateCategoryToAttribute: (category: Category) => Attri
23
23
  export declare const getDataOptionTitle: (option: Category | Value) => string;
24
24
  export declare const translateColumnToAttribure: (c: StyledColumn | Column) => Attribute;
25
25
  export declare const translateColumnToMeasure: (c: MeasureColumn | CalculatedMeasureColumn | StyledMeasureColumn) => Measure;
26
+ export declare const translateCategoryOrValueToColumn: <Source extends Value | Category, Target extends AnyColumn>(option: Source) => Target;
27
+ export declare const translateCategoryToColumn: (option: Category) => Column | StyledColumn;
28
+ export declare const translateValueToColumn: (option: Value) => MeasureColumn | CalculatedMeasureColumn | StyledMeasureColumn;
26
29
  export {};
@@ -1,6 +1,7 @@
1
1
  import { HighchartsPointerEvent, HighchartsSelectEvent } from '../types';
2
2
  import { HighchartsOptionsInternal } from '../chart-options-processor/chart-options-service';
3
3
  import { SisenseChartDataPointEventHandler, SisenseChartDataPointsEventHandler } from '../sisense-chart/types';
4
+ import { ChartDataOptionsInternal } from '..';
4
5
  export type HighchartsEventOptions = {
5
6
  chart: {
6
7
  zoomType?: string;
@@ -19,7 +20,7 @@ export type HighchartsEventOptions = {
19
20
  };
20
21
  };
21
22
  };
22
- export declare const applyEventHandlersToChart: (chartOptions: HighchartsOptionsInternal, { onDataPointClick, onDataPointContextMenu, onDataPointsSelected, }?: {
23
+ export declare const applyEventHandlersToChart: (chartOptions: HighchartsOptionsInternal, dataOptions: ChartDataOptionsInternal, { onDataPointClick, onDataPointContextMenu, onDataPointsSelected, }?: {
23
24
  onDataPointClick?: SisenseChartDataPointEventHandler | undefined;
24
25
  onDataPointContextMenu?: SisenseChartDataPointEventHandler | undefined;
25
26
  onDataPointsSelected?: SisenseChartDataPointsEventHandler | undefined;
@@ -0,0 +1,10 @@
1
+ import { HighchartsPoint } from '../types';
2
+ import { SisenseChartDataPoint } from '../sisense-chart/types';
3
+ import { Category, ChartDataOptionsInternal, Value } from '..';
4
+ export declare function getDataPointMetadata(dataOptionPath: string, dataOption: Category | Value): {
5
+ measure?: import("@sisense/sdk-data").Measure | undefined;
6
+ attribute?: import("@sisense/sdk-data").Attribute | undefined;
7
+ id: string;
8
+ dataOption: import("..").AnyColumn;
9
+ };
10
+ export declare function getDataPoint(point: HighchartsPoint, dataOptions: ChartDataOptionsInternal): SisenseChartDataPoint;
@@ -0,0 +1,11 @@
1
+ import { AreamapChartDataOptionsInternal, GeoDataElement } from '../../../index';
2
+ export declare function getAreamapDataPoint(geoDataElement: GeoDataElement, dataOptions: AreamapChartDataOptionsInternal): {
3
+ entries: {
4
+ geo: import('../../../index').DataPointEntry[];
5
+ color: import('../../../index').DataPointEntry[];
6
+ };
7
+ geoName: string;
8
+ originalValue: number;
9
+ formattedOriginalValue: string;
10
+ color?: import('../../../index').Color | undefined;
11
+ };
@@ -1,8 +1,8 @@
1
- import { ScattermapLocationLevel } from '../../../../chart-data-options/types';
1
+ import { ScattermapLocationLevel, ScattermapChartDataOptionsInternal } from '../../../../chart-data-options/types';
2
2
  import { ScattermapDataPoint } from '../../../../types';
3
3
  import { ScattermapChartLocation } from '../../../../chart-data/types';
4
4
  export declare const LOCATION_DELIMITER = ",";
5
5
  export declare function combineLocationNames(names: string[]): string;
6
6
  export declare function splitLocationName(combinedLocation: string): string[];
7
7
  export declare function getLocationGeoLevel(level: ScattermapLocationLevel): "country" | "city" | "adm" | undefined;
8
- export declare function locationToScattermapDataPoint(location: ScattermapChartLocation): ScattermapDataPoint;
8
+ export declare function getScattermapDataPoint(location: ScattermapChartLocation, dataOptions: ScattermapChartDataOptionsInternal): ScattermapDataPoint;
@@ -8,155 +8,6 @@ import { CompleteThemeSettings } from '../../types';
8
8
  * @internal
9
9
  */
10
10
  export declare const LoadingIndicator: ({ themeSettings, onCancel, }: {
11
- themeSettings?: {
12
- chart: {
13
- textColor: string;
14
- secondaryTextColor: string;
15
- backgroundColor: string;
16
- panelBackgroundColor: string;
17
- animation: {
18
- init: {
19
- duration: number | "auto";
20
- };
21
- redraw: {
22
- duration: number | "auto";
23
- };
24
- };
25
- };
26
- palette: {
27
- variantColors: import("../../types").Color[];
28
- };
29
- typography: {
30
- fontFamily: string;
31
- primaryTextColor: string;
32
- secondaryTextColor: string;
33
- };
34
- general: {
35
- brandColor: string;
36
- backgroundColor: string;
37
- primaryButtonTextColor: string;
38
- primaryButtonHoverColor: string;
39
- };
40
- widget: {
41
- spaceAround: import("../../types").SpaceSizes;
42
- cornerRadius: import("../../types").RadiusSizes;
43
- shadow: import("../../types").ShadowsTypes;
44
- border: boolean;
45
- borderColor: string;
46
- header: {
47
- titleTextColor: string;
48
- titleAlignment: import("../../types").AlignmentTypes;
49
- dividerLine: boolean;
50
- dividerLineColor: string;
51
- backgroundColor: string;
52
- };
53
- };
54
- dashboard: {
55
- backgroundColor: string;
56
- dividerLineWidth: number;
57
- dividerLineColor: string;
58
- };
59
- filter: {
60
- panel: {
61
- titleColor: string;
62
- backgroundColor: string;
63
- };
64
- };
65
- aiChat: {
66
- backgroundColor: string;
67
- primaryTextColor: string;
68
- secondaryTextColor: string;
69
- primaryFontSize: [fontSize: string, lineHeight: string];
70
- border: string | false;
71
- borderRadius: string | false;
72
- body: {
73
- paddingLeft: string;
74
- paddingRight: string;
75
- paddingTop: string;
76
- paddingBottom: string;
77
- gapBetweenMessages: string;
78
- };
79
- footer: {
80
- paddingLeft: string;
81
- paddingRight: string;
82
- paddingTop: string;
83
- paddingBottom: string;
84
- };
85
- userMessages: {
86
- backgroundColor: string;
87
- };
88
- systemMessages: {
89
- backgroundColor: string;
90
- };
91
- input: {
92
- backgroundColor: string;
93
- focus: {
94
- outlineColor: string;
95
- };
96
- };
97
- header: {
98
- backgroundColor: string;
99
- textColor: string;
100
- };
101
- dropup: {
102
- backgroundColor: string;
103
- boxShadow: string;
104
- borderRadius: string;
105
- headers: {
106
- textColor: string;
107
- hover: {
108
- backgroundColor: string;
109
- };
110
- };
111
- items: {
112
- textColor: string;
113
- hover: {
114
- backgroundColor: string;
115
- };
116
- };
117
- };
118
- suggestions: {
119
- textColor: string;
120
- backgroundColor: string;
121
- border: string;
122
- borderGradient: [string, string] | null;
123
- borderRadius: string;
124
- hover: {
125
- textColor: string;
126
- backgroundColor: string;
127
- };
128
- loadingGradient: [string, string];
129
- gap: string;
130
- };
131
- clickableMessages: {
132
- textColor: string;
133
- backgroundColor: string;
134
- border: string | false;
135
- borderGradient: [string, string] | null;
136
- hover: {
137
- textColor: string;
138
- backgroundColor: string;
139
- };
140
- };
141
- dataTopics: {
142
- backgroundColor: string;
143
- items: {
144
- textColor: string;
145
- backgroundColor: string;
146
- };
147
- };
148
- icons: {
149
- color: string;
150
- feedbackIcons: {
151
- hoverColor: string;
152
- };
153
- };
154
- tooltips: {
155
- backgroundColor: string;
156
- textColor: string;
157
- boxShadow: string;
158
- };
159
- };
160
- } | undefined;
11
+ themeSettings?: CompleteThemeSettings | undefined;
161
12
  onCancel?: (() => void) | undefined;
162
13
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { Attribute, Filter } from '@sisense/sdk-data';
2
2
  import { AreamapDataPoint, ChartDataOptions, DataPoint, PivotTableDataOptions, ScatterDataPoint, ScattermapDataPoint } from '../index.js';
3
3
  import { WidgetTypeInternal } from '../models/widget/types.js';
4
- type WidgetSelection = {
4
+ type DataSelection = {
5
5
  attribute: Attribute;
6
6
  values: (string | number)[];
7
7
  };
8
- export declare function getWidgetSelections(widgetType: WidgetTypeInternal, dataOptions: ChartDataOptions | PivotTableDataOptions, points: Array<DataPoint | ScatterDataPoint | ScattermapDataPoint | AreamapDataPoint>, nativeEvent: MouseEvent | PointerEvent): WidgetSelection[];
8
+ export declare function getWidgetSelections(widgetType: WidgetTypeInternal, dataOptions: ChartDataOptions | PivotTableDataOptions, points: Array<DataPoint | ScatterDataPoint | ScattermapDataPoint | AreamapDataPoint>): DataSelection[];
9
9
  export declare function getSelectableWidgetAttributes(widgetType: WidgetTypeInternal, dataOptions: ChartDataOptions | PivotTableDataOptions): Attribute[];
10
- export declare function createCommonFiltersOverSelections(selections: WidgetSelection[], existingCommonFilters: Filter[]): Filter[];
10
+ export declare function createCommonFiltersOverSelections(selections: DataSelection[], existingCommonFilters: Filter[]): Filter[];
11
11
  export {};
@@ -1,2 +1 @@
1
- export declare function isSupportedWidgetTypeByDashboard(widgetType: string): boolean;
2
1
  export declare const getDividerStyle: (color: string, width: number) => string;