@databrainhq/plugin 0.10.8 → 0.10.9

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.
package/dist/index.es.js CHANGED
@@ -5784,8 +5784,8 @@ const Ut = (r, t, e) => async () => {
5784
5784
  Ut(t7, r),
5785
5785
  t
5786
5786
  ), n7 = `
5787
- query MetricAccess($companyId: uuid = "") {
5788
- companySubsetTables(where: {companyId: {_eq: $companyId}}) {
5787
+ query MetricAccess($workspaceId: uuid = "") {
5788
+ companySubsetTables(where: {workspaceId: {_eq: $workspaceId}}) {
5789
5789
  isAllowMetricCreation
5790
5790
  isAllowMetricDeletion
5791
5791
  isAllowMetricUpdation
@@ -6235,9 +6235,9 @@ const Ut = (r, t, e) => async () => {
6235
6235
  refetchOnWindowFocus: !1
6236
6236
  }
6237
6237
  ), m = d == null ? void 0 : d.externalDashboardMetrics, { data: y, isLoading: b } = i7(
6238
- { companyId: s },
6238
+ { workspaceId: c == null ? void 0 : c.id },
6239
6239
  {
6240
- enabled: !!s,
6240
+ enabled: !!(c != null && c.id),
6241
6241
  refetchOnWindowFocus: !1
6242
6242
  }
6243
6243
  ), { data: _, isLoading: w } = c7(
package/dist/index.umd.js CHANGED
@@ -235,8 +235,8 @@ Check the top-level render call using <`+_e+">.")}return ue}}function Lo(q,ue){{
235
235
  }
236
236
  }
237
237
  `,a8=(r,t)=>ni(r===void 0?["GuestTokenParams"]:["GuestTokenParams",r],Bt(i8,r),t),o8=`
238
- query MetricAccess($companyId: uuid = "") {
239
- companySubsetTables(where: {companyId: {_eq: $companyId}}) {
238
+ query MetricAccess($workspaceId: uuid = "") {
239
+ companySubsetTables(where: {workspaceId: {_eq: $workspaceId}}) {
240
240
  isAllowMetricCreation
241
241
  isAllowMetricDeletion
242
242
  isAllowMetricUpdation
@@ -451,7 +451,7 @@ Check the top-level render call using <`+_e+">.")}return ue}}function Lo(q,ue){{
451
451
  id
452
452
  }
453
453
  }
454
- `,F8=r=>qr(["UpdateExternalMetric"],t=>Bt(z8,t)(),r),Xw=({onSubmit:r,defaultValues:t,onCancel:e,isEmbedded:n=!0,dashboardIds:i,onDashboardChange:a,companyId:o,error:s})=>{const{register:l,handleSubmit:c,setValue:u}=Uv(),[h,f]=j.useState((t==null?void 0:t.isLive)??!1),d=c(m=>{r({...m,isLive:h})}),{data:p}=t8({companyId:o}),v=p==null?void 0:p.externalDashboards,g=n?(v==null?void 0:v.filter(m=>m.id===i[0]).map(m=>({value:m.id,label:m.name})))??[]:(v==null?void 0:v.map(m=>({value:m.id,label:m.name})))??[];return j.useEffect(()=>{t&&(u("name",t.name),u("description",t.description),u("metricId",t.metricId))},[t]),A.jsxs("form",{onSubmit:d,children:[A.jsxs("div",{className:Rl.container,children:[A.jsx(Oo,{label:"Dashboards",options:g,name:"dashboards",value:i,onChange:a}),A.jsx(He,{name:"name",type:"text",placeholder:"What is the name of metric?",label:"Metric Name",register:l("name",{required:!0}),defaultValue:t==null?void 0:t.name}),A.jsx(He,{name:"name",type:"text",placeholder:"Unique Id to identify metric",label:"Metric ID",register:l("metricId",{required:!0}),defaultValue:t==null?void 0:t.metricId}),A.jsx(SL,{className:Rl.field,id:"desc",placeholder:"What is the name of metric?",label:"Description",rows:5,register:l("description"),defaultValue:t==null?void 0:t.description}),!n&&A.jsx(ML,{className:Rl.field,labelClassName:Rl.fieldLabel,enabled:h,onChange:f,label:"Publish Type",placeholder:h?"LIVE MODE":"TEST MODE",defaultEnabled:t==null?void 0:t.isLive})]}),!!s&&A.jsx(ye,{variant:"p",styleClass:"font-14",className:Rl.error,children:s}),A.jsxs(Tc,{children:[A.jsx(Me,{type:"reset",variant:"secondary",className:Rl.cancel,onClick:e,size:"default",children:"Cancel"}),A.jsx(Me,{type:"submit",variant:"primary",size:"small",className:Rl.save,isDisabled:!g.length||!i.length,children:"Save"})]})]})},Dt={container:"_container_1u0lb_1",wrapper:"_wrapper_1u0lb_5",label:"_label_1u0lb_9",noOptions:"_noOptions_1u0lb_13",floatingLabel:"_floatingLabel_1u0lb_17",floatingLabel2:"_floatingLabel2_1u0lb_21",floating2:"_floating2_1u0lb_26",floatingText:"_floatingText_1u0lb_31",staticText:"_staticText_1u0lb_36",staticLabel:"_staticLabel_1u0lb_36",InnerText:"_InnerText_1u0lb_36",normalText:"_normalText_1u0lb_41",dropdown:"_dropdown_1u0lb_45",options:"_options_1u0lb_49",checkedOption:"_checkedOption_1u0lb_53",option:"_option_1u0lb_49",icon:"_icon_1u0lb_61",text:"_text_1u0lb_65",search:"_search_1u0lb_69",loadMore:"_loadMore_1u0lb_73",loadMoreIcon:"_loadMoreIcon_1u0lb_77",aboveList:"_aboveList_1u0lb_81"},WL=({token:r,dashboardId:t})=>{var S,M;const{data:e,isLoading:n}=a8({id:r},{enabled:!!r,refetchOnWindowFocus:!1}),i=e==null?void 0:e.guestTokens_by_pk,a=i!=null&&i.params?JSON.parse(i.params):{},o=t||((S=a.dashboard)==null?void 0:S.id),s=i==null?void 0:i.companyId,l=i==null?void 0:i.clientId,c=a==null?void 0:a.workspace,u=(M=a==null?void 0:a.dashboard)==null?void 0:M.isLive,h=a==null?void 0:a.rlsSettings,f=a==null?void 0:a.companyTenancyType,{data:d,isLoading:p}=ZY({externalDashboardId:o,clientId:l},{enabled:!!o&&!!l,refetchOnWindowFocus:!1}),{data:v,isLoading:g}=XY({externalDashboardId:o},{enabled:!!o,refetchOnWindowFocus:!1}),m=d==null?void 0:d.externalDashboardMetrics,{data:y,isLoading:b}=s8({companyId:s},{enabled:!!s,refetchOnWindowFocus:!1}),{data:_,isLoading:w}=d8({companyId:s},{enabled:!!s,refetchOnWindowFocus:!1}),[x,D,I,C]=j.useMemo(()=>{var O,R,$,F;const L=!!((O=y==null?void 0:y.companySubsetTables[0])!=null&&O.isAllowMetricCreation),E=!!((R=y==null?void 0:y.companySubsetTables[0])!=null&&R.isAllowMetricUpdation),N=!!(($=y==null?void 0:y.companySubsetTables[0])!=null&&$.isAllowMetricDeletion),k=!!((F=y==null?void 0:y.companySubsetTables[0])!=null&&F.isAllowChangeLayout);return[L,E,N,k]},[y==null?void 0:y.companySubsetTables[0]]),T=j.useMemo(()=>_!=null&&_.sharingSettings.length?_.sharingSettings[0].id:void 0,[_]);return{isLoading:n||p||g||b||w,data:{clientId:l,companyId:s,isLiveMode:u,externalDashboardMetrics:m,externalDashboard:v==null?void 0:v.externalDashboards[0],externalDashboardId:o,rlsSettings:h,companyTenancyType:f||"TABLE",isAllowedToCreateMetrics:x,isAllowedToDeleteMetrics:D,isAllowedToUpdateMetrics:I,isAllowedToChangeLayout:C,workspace:c,sharingSettingsId:T}}},Kw=({onSuccess:r,companyIntegrationId:t,selectedColumns:e,query:n,metricQuery:i,integrationName:a,outputColumns:o,chartSettings:s,clientId:l,companyId:c,isLiveMode:u,timeGrain:h,dashboardIds:f,isEnableGroupBy:d,groupBy:p,selectedGroupBy:v,userProvidedDashboardId:g,metric:m})=>{const[y,b]=j.useState(""),_=Ac(),{mutate:w,isLoading:x}=kY(),D=L=>{b(""),w({companyId:c,companyIntegrationId:t,description:L.description,inputFields:e,metricId:L.metricId,name:L.name,query:n,metricQuery:i,integrationName:a,outputColumns:o,createdBy:l||"external user",isLive:u||L.isLive,chartOptions:s,clientId:l||null,isCreatedByClient:!!l,timeGrain:h||null,externalDashboardIds:f.map(E=>({externalDashboardId:E})),isEnableGroupBy:d,groupBy:p??{},selectedGroupBy:v},{onSuccess:(E,N)=>{var k,O;if((k=E.insert_externalMetrics_one)!=null&&k.id){const R=(O=E.insert_externalMetrics_one)==null?void 0:O.id;_.setQueryData(["EmbeddedDashboardMetrics",{externalDashboardId:g,clientId:l}],$=>{const F=$==null?void 0:$.externalDashboardMetrics;return F==null||F.push({externalDashboardId:f[0],externalMetricId:R,externalMetric:{...N,id:R}}),{...$,externalDashboardMetrics:F}})}},onError:()=>{b&&b("Metric Id already exists")}})},{mutateAsync:I,isLoading:C}=P8({onSuccess:L=>{var N;if(!L.insert_clientDeletedMetrics_one||!L.insert_externalMetrics_one)return;const E=(N=L.insert_externalMetrics_one)==null?void 0:N.id;_.setQueryData(["EmbeddedDashboardMetrics",{externalDashboardId:g,clientId:l}],k=>{var R;const O=(R=k==null?void 0:k.externalDashboardMetrics)==null?void 0:R.filter($=>$.externalMetricId!==(m==null?void 0:m.id));return O==null||O.push({externalDashboardId:f[0],externalMetricId:E,externalMetric:L.insert_externalMetrics_one}),{...k,externalDashboardMetrics:O}}),b(""),r()},onError:()=>{b("Something went wrong! Please try again later.")}}),{mutateAsync:T,isLoading:S}=F8({onSuccess:(L,E)=>{var N;(N=L.update_externalMetrics_by_pk)!=null&&N.id&&(_.setQueryData(["EmbeddedDashboardMetrics",{externalDashboardId:g,clientId:l}],k=>{const O=k==null?void 0:k.externalDashboardMetrics,R=O==null?void 0:O.findIndex($=>$.externalMetricId===(m==null?void 0:m.id));return R===-1?k:(O[R].externalMetric={...O[R].externalMetric,...E.set},{...k,externalDashboardMetrics:O})}),b(""),r())},onError:()=>{b("Something went wrong! Please try again later.")}}),M=j.useCallback(L=>{if(b(""),!(m!=null&&m.isCreatedByClient))I({externalMetricId:m==null?void 0:m.id,clientId:l,object:{companyId:c,companyIntegrationId:t||(m==null?void 0:m.companyIntegrationId),description:L.description,inputFields:e,metricId:L.metricId===(m==null?void 0:m.metricId)?`update_${L.metricId}_by_${l}_${Date.now()}`:L.metricId,name:L.name,query:n,metricQuery:i,integrationName:a,outputColumns:o,createdBy:l||"external user",clientId:l,isCreatedByClient:!!l,resizeAttributes:m==null?void 0:m.resizeAttributes,externalDashboardMetrics:{data:f.map(E=>({externalDashboardId:E}))},isLive:u||L.isLive,chartOptions:s}});else{const E={chartOptions:s};L.description&&(E.description=L.description),L.metricId&&(E.metricId=L.metricId),L.name&&(E.name=L.name),T({externalMetricId:m==null?void 0:m.id,set:E})}},[s,m,T,I,l,c,t,a,u,f,n,e,o,i]);return{createExternalMetric:D,updateExternalMetric:M,error:y,isLoading:x||C||S}},dg=()=>{const{mutate:r,isLoading:t,error:e}=BY(),{mutate:n}=zY();return{generateDatasetMetric:r,isGeneratingDataset:t,generateError:e,fetchColumnValues:n}},B8=({clientId:r,companyId:t,setData:e,setError:n,setLoading:i,setQuery:a,setMetricQuery:o})=>{const s=HY();return{generateEmbeddedMetric:c=>{i(!0),a(""),n(""),e(void 0),s.mutate({clientId:r,companyId:t,queryPrompt:c.queryPrompt,timeGrain:c.timeGrain},{onSuccess:u=>{var h,f,d;(h=u.generateEmbeddedMetic)!=null&&h.error?(i(!1),a(""),e(void 0),n(u.generateEmbeddedMetic.error.message)):(o(c.queryPrompt),n(""),i(!1),a(((f=u.generateEmbeddedMetic)==null?void 0:f.query)||""),e((d=u.generateEmbeddedMetic)==null?void 0:d.result))},onError:()=>{i(!1),a(""),e(void 0),n(nn)}})}}},$f=({onOutsideClick:r,wrapRef:t})=>{j.useEffect(()=>{const e=n=>{t.current&&!t.current.contains(n.target)&&r()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[t,r])},Jw=r=>{j.useEffect(()=>{var n,i,a,o,s,l,c,u,h,f;if(!r){const d=document.querySelector("#dbn-admin-styles");d&&document.head.removeChild(d);return}const t=document.getElementById("dbn-admin-styles")||document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("id","dbn-admin-styles");let e="";(n=r.general.fontFamily)!=null&&n.trim()&&(e=`
454
+ `,F8=r=>qr(["UpdateExternalMetric"],t=>Bt(z8,t)(),r),Xw=({onSubmit:r,defaultValues:t,onCancel:e,isEmbedded:n=!0,dashboardIds:i,onDashboardChange:a,companyId:o,error:s})=>{const{register:l,handleSubmit:c,setValue:u}=Uv(),[h,f]=j.useState((t==null?void 0:t.isLive)??!1),d=c(m=>{r({...m,isLive:h})}),{data:p}=t8({companyId:o}),v=p==null?void 0:p.externalDashboards,g=n?(v==null?void 0:v.filter(m=>m.id===i[0]).map(m=>({value:m.id,label:m.name})))??[]:(v==null?void 0:v.map(m=>({value:m.id,label:m.name})))??[];return j.useEffect(()=>{t&&(u("name",t.name),u("description",t.description),u("metricId",t.metricId))},[t]),A.jsxs("form",{onSubmit:d,children:[A.jsxs("div",{className:Rl.container,children:[A.jsx(Oo,{label:"Dashboards",options:g,name:"dashboards",value:i,onChange:a}),A.jsx(He,{name:"name",type:"text",placeholder:"What is the name of metric?",label:"Metric Name",register:l("name",{required:!0}),defaultValue:t==null?void 0:t.name}),A.jsx(He,{name:"name",type:"text",placeholder:"Unique Id to identify metric",label:"Metric ID",register:l("metricId",{required:!0}),defaultValue:t==null?void 0:t.metricId}),A.jsx(SL,{className:Rl.field,id:"desc",placeholder:"What is the name of metric?",label:"Description",rows:5,register:l("description"),defaultValue:t==null?void 0:t.description}),!n&&A.jsx(ML,{className:Rl.field,labelClassName:Rl.fieldLabel,enabled:h,onChange:f,label:"Publish Type",placeholder:h?"LIVE MODE":"TEST MODE",defaultEnabled:t==null?void 0:t.isLive})]}),!!s&&A.jsx(ye,{variant:"p",styleClass:"font-14",className:Rl.error,children:s}),A.jsxs(Tc,{children:[A.jsx(Me,{type:"reset",variant:"secondary",className:Rl.cancel,onClick:e,size:"default",children:"Cancel"}),A.jsx(Me,{type:"submit",variant:"primary",size:"small",className:Rl.save,isDisabled:!g.length||!i.length,children:"Save"})]})]})},Dt={container:"_container_1u0lb_1",wrapper:"_wrapper_1u0lb_5",label:"_label_1u0lb_9",noOptions:"_noOptions_1u0lb_13",floatingLabel:"_floatingLabel_1u0lb_17",floatingLabel2:"_floatingLabel2_1u0lb_21",floating2:"_floating2_1u0lb_26",floatingText:"_floatingText_1u0lb_31",staticText:"_staticText_1u0lb_36",staticLabel:"_staticLabel_1u0lb_36",InnerText:"_InnerText_1u0lb_36",normalText:"_normalText_1u0lb_41",dropdown:"_dropdown_1u0lb_45",options:"_options_1u0lb_49",checkedOption:"_checkedOption_1u0lb_53",option:"_option_1u0lb_49",icon:"_icon_1u0lb_61",text:"_text_1u0lb_65",search:"_search_1u0lb_69",loadMore:"_loadMore_1u0lb_73",loadMoreIcon:"_loadMoreIcon_1u0lb_77",aboveList:"_aboveList_1u0lb_81"},WL=({token:r,dashboardId:t})=>{var S,M;const{data:e,isLoading:n}=a8({id:r},{enabled:!!r,refetchOnWindowFocus:!1}),i=e==null?void 0:e.guestTokens_by_pk,a=i!=null&&i.params?JSON.parse(i.params):{},o=t||((S=a.dashboard)==null?void 0:S.id),s=i==null?void 0:i.companyId,l=i==null?void 0:i.clientId,c=a==null?void 0:a.workspace,u=(M=a==null?void 0:a.dashboard)==null?void 0:M.isLive,h=a==null?void 0:a.rlsSettings,f=a==null?void 0:a.companyTenancyType,{data:d,isLoading:p}=ZY({externalDashboardId:o,clientId:l},{enabled:!!o&&!!l,refetchOnWindowFocus:!1}),{data:v,isLoading:g}=XY({externalDashboardId:o},{enabled:!!o,refetchOnWindowFocus:!1}),m=d==null?void 0:d.externalDashboardMetrics,{data:y,isLoading:b}=s8({workspaceId:c==null?void 0:c.id},{enabled:!!(c!=null&&c.id),refetchOnWindowFocus:!1}),{data:_,isLoading:w}=d8({companyId:s},{enabled:!!s,refetchOnWindowFocus:!1}),[x,D,I,C]=j.useMemo(()=>{var O,R,$,F;const L=!!((O=y==null?void 0:y.companySubsetTables[0])!=null&&O.isAllowMetricCreation),E=!!((R=y==null?void 0:y.companySubsetTables[0])!=null&&R.isAllowMetricUpdation),N=!!(($=y==null?void 0:y.companySubsetTables[0])!=null&&$.isAllowMetricDeletion),k=!!((F=y==null?void 0:y.companySubsetTables[0])!=null&&F.isAllowChangeLayout);return[L,E,N,k]},[y==null?void 0:y.companySubsetTables[0]]),T=j.useMemo(()=>_!=null&&_.sharingSettings.length?_.sharingSettings[0].id:void 0,[_]);return{isLoading:n||p||g||b||w,data:{clientId:l,companyId:s,isLiveMode:u,externalDashboardMetrics:m,externalDashboard:v==null?void 0:v.externalDashboards[0],externalDashboardId:o,rlsSettings:h,companyTenancyType:f||"TABLE",isAllowedToCreateMetrics:x,isAllowedToDeleteMetrics:D,isAllowedToUpdateMetrics:I,isAllowedToChangeLayout:C,workspace:c,sharingSettingsId:T}}},Kw=({onSuccess:r,companyIntegrationId:t,selectedColumns:e,query:n,metricQuery:i,integrationName:a,outputColumns:o,chartSettings:s,clientId:l,companyId:c,isLiveMode:u,timeGrain:h,dashboardIds:f,isEnableGroupBy:d,groupBy:p,selectedGroupBy:v,userProvidedDashboardId:g,metric:m})=>{const[y,b]=j.useState(""),_=Ac(),{mutate:w,isLoading:x}=kY(),D=L=>{b(""),w({companyId:c,companyIntegrationId:t,description:L.description,inputFields:e,metricId:L.metricId,name:L.name,query:n,metricQuery:i,integrationName:a,outputColumns:o,createdBy:l||"external user",isLive:u||L.isLive,chartOptions:s,clientId:l||null,isCreatedByClient:!!l,timeGrain:h||null,externalDashboardIds:f.map(E=>({externalDashboardId:E})),isEnableGroupBy:d,groupBy:p??{},selectedGroupBy:v},{onSuccess:(E,N)=>{var k,O;if((k=E.insert_externalMetrics_one)!=null&&k.id){const R=(O=E.insert_externalMetrics_one)==null?void 0:O.id;_.setQueryData(["EmbeddedDashboardMetrics",{externalDashboardId:g,clientId:l}],$=>{const F=$==null?void 0:$.externalDashboardMetrics;return F==null||F.push({externalDashboardId:f[0],externalMetricId:R,externalMetric:{...N,id:R}}),{...$,externalDashboardMetrics:F}})}},onError:()=>{b&&b("Metric Id already exists")}})},{mutateAsync:I,isLoading:C}=P8({onSuccess:L=>{var N;if(!L.insert_clientDeletedMetrics_one||!L.insert_externalMetrics_one)return;const E=(N=L.insert_externalMetrics_one)==null?void 0:N.id;_.setQueryData(["EmbeddedDashboardMetrics",{externalDashboardId:g,clientId:l}],k=>{var R;const O=(R=k==null?void 0:k.externalDashboardMetrics)==null?void 0:R.filter($=>$.externalMetricId!==(m==null?void 0:m.id));return O==null||O.push({externalDashboardId:f[0],externalMetricId:E,externalMetric:L.insert_externalMetrics_one}),{...k,externalDashboardMetrics:O}}),b(""),r()},onError:()=>{b("Something went wrong! Please try again later.")}}),{mutateAsync:T,isLoading:S}=F8({onSuccess:(L,E)=>{var N;(N=L.update_externalMetrics_by_pk)!=null&&N.id&&(_.setQueryData(["EmbeddedDashboardMetrics",{externalDashboardId:g,clientId:l}],k=>{const O=k==null?void 0:k.externalDashboardMetrics,R=O==null?void 0:O.findIndex($=>$.externalMetricId===(m==null?void 0:m.id));return R===-1?k:(O[R].externalMetric={...O[R].externalMetric,...E.set},{...k,externalDashboardMetrics:O})}),b(""),r())},onError:()=>{b("Something went wrong! Please try again later.")}}),M=j.useCallback(L=>{if(b(""),!(m!=null&&m.isCreatedByClient))I({externalMetricId:m==null?void 0:m.id,clientId:l,object:{companyId:c,companyIntegrationId:t||(m==null?void 0:m.companyIntegrationId),description:L.description,inputFields:e,metricId:L.metricId===(m==null?void 0:m.metricId)?`update_${L.metricId}_by_${l}_${Date.now()}`:L.metricId,name:L.name,query:n,metricQuery:i,integrationName:a,outputColumns:o,createdBy:l||"external user",clientId:l,isCreatedByClient:!!l,resizeAttributes:m==null?void 0:m.resizeAttributes,externalDashboardMetrics:{data:f.map(E=>({externalDashboardId:E}))},isLive:u||L.isLive,chartOptions:s}});else{const E={chartOptions:s};L.description&&(E.description=L.description),L.metricId&&(E.metricId=L.metricId),L.name&&(E.name=L.name),T({externalMetricId:m==null?void 0:m.id,set:E})}},[s,m,T,I,l,c,t,a,u,f,n,e,o,i]);return{createExternalMetric:D,updateExternalMetric:M,error:y,isLoading:x||C||S}},dg=()=>{const{mutate:r,isLoading:t,error:e}=BY(),{mutate:n}=zY();return{generateDatasetMetric:r,isGeneratingDataset:t,generateError:e,fetchColumnValues:n}},B8=({clientId:r,companyId:t,setData:e,setError:n,setLoading:i,setQuery:a,setMetricQuery:o})=>{const s=HY();return{generateEmbeddedMetric:c=>{i(!0),a(""),n(""),e(void 0),s.mutate({clientId:r,companyId:t,queryPrompt:c.queryPrompt,timeGrain:c.timeGrain},{onSuccess:u=>{var h,f,d;(h=u.generateEmbeddedMetic)!=null&&h.error?(i(!1),a(""),e(void 0),n(u.generateEmbeddedMetic.error.message)):(o(c.queryPrompt),n(""),i(!1),a(((f=u.generateEmbeddedMetic)==null?void 0:f.query)||""),e((d=u.generateEmbeddedMetic)==null?void 0:d.result))},onError:()=>{i(!1),a(""),e(void 0),n(nn)}})}}},$f=({onOutsideClick:r,wrapRef:t})=>{j.useEffect(()=>{const e=n=>{t.current&&!t.current.contains(n.target)&&r()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[t,r])},Jw=r=>{j.useEffect(()=>{var n,i,a,o,s,l,c,u,h,f;if(!r){const d=document.querySelector("#dbn-admin-styles");d&&document.head.removeChild(d);return}const t=document.getElementById("dbn-admin-styles")||document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("id","dbn-admin-styles");let e="";(n=r.general.fontFamily)!=null&&n.trim()&&(e=`
455
455
  #dbn-dashboard {
456
456
  font-family: ${r.general.fontFamily} !important;
457
457
  }`),(i=r.dashboard.backgroundColor)!=null&&i.trim()&&(e=`${e}
@@ -688,6 +688,7 @@ export type CompanySubsetTables = {
688
688
  isAllowMetricDeletion: Scalars['Boolean'];
689
689
  isAllowMetricUpdation: Scalars['Boolean'];
690
690
  tableList: Scalars['jsonb'];
691
+ workspaceId: Scalars['uuid'];
691
692
  };
692
693
  /** subset of tables of user database */
693
694
  export type CompanySubsetTablesTableListArgs = {
@@ -705,6 +706,7 @@ export type CompanySubsetTables_Bool_Exp = {
705
706
  isAllowMetricDeletion?: InputMaybe<Boolean_Comparison_Exp>;
706
707
  isAllowMetricUpdation?: InputMaybe<Boolean_Comparison_Exp>;
707
708
  tableList?: InputMaybe<Jsonb_Comparison_Exp>;
709
+ workspaceId?: InputMaybe<Uuid_Comparison_Exp>;
708
710
  };
709
711
  /** Ordering options when selecting data from "companySubsetTables". */
710
712
  export type CompanySubsetTables_Order_By = {
@@ -715,6 +717,7 @@ export type CompanySubsetTables_Order_By = {
715
717
  isAllowMetricDeletion?: InputMaybe<Order_By>;
716
718
  isAllowMetricUpdation?: InputMaybe<Order_By>;
717
719
  tableList?: InputMaybe<Order_By>;
720
+ workspaceId?: InputMaybe<Order_By>;
718
721
  };
719
722
  /** select columns of table "companySubsetTables" */
720
723
  export declare enum CompanySubsetTables_Select_Column {
@@ -729,7 +732,9 @@ export declare enum CompanySubsetTables_Select_Column {
729
732
  /** column name */
730
733
  IsAllowMetricUpdation = "isAllowMetricUpdation",
731
734
  /** column name */
732
- TableList = "tableList"
735
+ TableList = "tableList",
736
+ /** column name */
737
+ WorkspaceId = "workspaceId"
733
738
  }
734
739
  /** columns and relationships of "companyWorkspaces" */
735
740
  export type CompanyWorkspaces = {
@@ -912,6 +917,57 @@ export declare enum CustomSqlColumns_Update_Column {
912
917
  /** column name */
913
918
  SqlColumns = "sqlColumns"
914
919
  }
920
+ /** Demo app theme customization */
921
+ export type DemoTheme = {
922
+ __typename?: 'demoTheme';
923
+ dashboardTitle?: Maybe<Scalars['String']>;
924
+ highlightColor?: Maybe<Scalars['String']>;
925
+ id: Scalars['uuid'];
926
+ logoUrl?: Maybe<Scalars['String']>;
927
+ navbarColor?: Maybe<Scalars['String']>;
928
+ primaryColor?: Maybe<Scalars['String']>;
929
+ textColor?: Maybe<Scalars['String']>;
930
+ };
931
+ /** Boolean expression to filter rows from the table "demoTheme". All fields are combined with a logical 'AND'. */
932
+ export type DemoTheme_Bool_Exp = {
933
+ _and?: InputMaybe<Array<DemoTheme_Bool_Exp>>;
934
+ _not?: InputMaybe<DemoTheme_Bool_Exp>;
935
+ _or?: InputMaybe<Array<DemoTheme_Bool_Exp>>;
936
+ dashboardTitle?: InputMaybe<String_Comparison_Exp>;
937
+ highlightColor?: InputMaybe<String_Comparison_Exp>;
938
+ id?: InputMaybe<Uuid_Comparison_Exp>;
939
+ logoUrl?: InputMaybe<String_Comparison_Exp>;
940
+ navbarColor?: InputMaybe<String_Comparison_Exp>;
941
+ primaryColor?: InputMaybe<String_Comparison_Exp>;
942
+ textColor?: InputMaybe<String_Comparison_Exp>;
943
+ };
944
+ /** Ordering options when selecting data from "demoTheme". */
945
+ export type DemoTheme_Order_By = {
946
+ dashboardTitle?: InputMaybe<Order_By>;
947
+ highlightColor?: InputMaybe<Order_By>;
948
+ id?: InputMaybe<Order_By>;
949
+ logoUrl?: InputMaybe<Order_By>;
950
+ navbarColor?: InputMaybe<Order_By>;
951
+ primaryColor?: InputMaybe<Order_By>;
952
+ textColor?: InputMaybe<Order_By>;
953
+ };
954
+ /** select columns of table "demoTheme" */
955
+ export declare enum DemoTheme_Select_Column {
956
+ /** column name */
957
+ DashboardTitle = "dashboardTitle",
958
+ /** column name */
959
+ HighlightColor = "highlightColor",
960
+ /** column name */
961
+ Id = "id",
962
+ /** column name */
963
+ LogoUrl = "logoUrl",
964
+ /** column name */
965
+ NavbarColor = "navbarColor",
966
+ /** column name */
967
+ PrimaryColor = "primaryColor",
968
+ /** column name */
969
+ TextColor = "textColor"
970
+ }
915
971
  /** columns and relationships of "externalDashboardMetrics" */
916
972
  export type ExternalDashboardMetrics = {
917
973
  __typename?: 'externalDashboardMetrics';
@@ -2411,6 +2467,10 @@ export type Query_Root = {
2411
2467
  customSqlColumns: Array<CustomSqlColumns>;
2412
2468
  /** fetch data from the table: "customSqlColumns" using primary key columns */
2413
2469
  customSqlColumns_by_pk?: Maybe<CustomSqlColumns>;
2470
+ /** fetch data from the table: "demoTheme" */
2471
+ demoTheme: Array<DemoTheme>;
2472
+ /** fetch data from the table: "demoTheme" using primary key columns */
2473
+ demoTheme_by_pk?: Maybe<DemoTheme>;
2414
2474
  /** Gets the required data to embed individual metrics. */
2415
2475
  embeddedMetricData?: Maybe<EmbeddedMetricDataOutput>;
2416
2476
  /** An array relationship */
@@ -2534,6 +2594,16 @@ export type Query_RootCustomSqlColumnsArgs = {
2534
2594
  export type Query_RootCustomSqlColumns_By_PkArgs = {
2535
2595
  id: Scalars['uuid'];
2536
2596
  };
2597
+ export type Query_RootDemoThemeArgs = {
2598
+ distinct_on?: InputMaybe<Array<DemoTheme_Select_Column>>;
2599
+ limit?: InputMaybe<Scalars['Int']>;
2600
+ offset?: InputMaybe<Scalars['Int']>;
2601
+ order_by?: InputMaybe<Array<DemoTheme_Order_By>>;
2602
+ where?: InputMaybe<DemoTheme_Bool_Exp>;
2603
+ };
2604
+ export type Query_RootDemoTheme_By_PkArgs = {
2605
+ id: Scalars['uuid'];
2606
+ };
2537
2607
  export type Query_RootEmbeddedMetricDataArgs = {
2538
2608
  input: EmbeddedMetricDataInput;
2539
2609
  };
@@ -2701,9 +2771,7 @@ export type ScheduleEmailReportCharts_Bool_Exp = {
2701
2771
  /** unique or primary key constraints on table "scheduleEmailReportCharts" */
2702
2772
  export declare enum ScheduleEmailReportCharts_Constraint {
2703
2773
  /** unique or primary key constraint on columns "id" */
2704
- ScheduleEmailReportChartsPkey = "scheduleEmailReportCharts_pkey",
2705
- /** unique or primary key constraint on columns "externalMetricId", "scheduleEmailReportId" */
2706
- ScheduleEmailReportChartsUniqueKey = "scheduleEmailReportCharts_unique_key"
2774
+ ScheduleEmailReportChartsPkey = "scheduleEmailReportCharts_pkey"
2707
2775
  }
2708
2776
  /** input type for inserting data into table "scheduleEmailReportCharts" */
2709
2777
  export type ScheduleEmailReportCharts_Insert_Input = {
@@ -3038,6 +3106,10 @@ export type Subscription_Root = {
3038
3106
  customSqlColumns: Array<CustomSqlColumns>;
3039
3107
  /** fetch data from the table: "customSqlColumns" using primary key columns */
3040
3108
  customSqlColumns_by_pk?: Maybe<CustomSqlColumns>;
3109
+ /** fetch data from the table: "demoTheme" */
3110
+ demoTheme: Array<DemoTheme>;
3111
+ /** fetch data from the table: "demoTheme" using primary key columns */
3112
+ demoTheme_by_pk?: Maybe<DemoTheme>;
3041
3113
  /** An array relationship */
3042
3114
  externalDashboardMetrics: Array<ExternalDashboardMetrics>;
3043
3115
  /** fetch data from the table: "externalDashboardMetrics" using primary key columns */
@@ -3158,6 +3230,16 @@ export type Subscription_RootCustomSqlColumnsArgs = {
3158
3230
  export type Subscription_RootCustomSqlColumns_By_PkArgs = {
3159
3231
  id: Scalars['uuid'];
3160
3232
  };
3233
+ export type Subscription_RootDemoThemeArgs = {
3234
+ distinct_on?: InputMaybe<Array<DemoTheme_Select_Column>>;
3235
+ limit?: InputMaybe<Scalars['Int']>;
3236
+ offset?: InputMaybe<Scalars['Int']>;
3237
+ order_by?: InputMaybe<Array<DemoTheme_Order_By>>;
3238
+ where?: InputMaybe<DemoTheme_Bool_Exp>;
3239
+ };
3240
+ export type Subscription_RootDemoTheme_By_PkArgs = {
3241
+ id: Scalars['uuid'];
3242
+ };
3161
3243
  export type Subscription_RootExternalDashboardMetricsArgs = {
3162
3244
  distinct_on?: InputMaybe<Array<ExternalDashboardMetrics_Select_Column>>;
3163
3245
  limit?: InputMaybe<Scalars['Int']>;
@@ -3675,7 +3757,7 @@ export type GuestTokenParamsQuery = {
3675
3757
  } | null;
3676
3758
  };
3677
3759
  export type MetricAccessQueryVariables = Exact<{
3678
- companyId?: InputMaybe<Scalars['uuid']>;
3760
+ workspaceId?: InputMaybe<Scalars['uuid']>;
3679
3761
  }>;
3680
3762
  export type MetricAccessQuery = {
3681
3763
  __typename?: 'query_root';
@@ -4118,7 +4200,7 @@ export declare const ExternalMetricRawCsvUrlsDocument = "\n query ExternalMet
4118
4200
  export declare const useExternalMetricRawCsvUrlsQuery: <TData = ExternalMetricRawCsvUrlsQuery, TError = unknown>(variables?: ExternalMetricRawCsvUrlsQueryVariables, options?: UseQueryOptions<ExternalMetricRawCsvUrlsQuery, TError, TData, import("react-query").QueryKey> | undefined) => import("react-query").UseQueryResult<TData, TError>;
4119
4201
  export declare const GuestTokenParamsDocument = "\n query GuestTokenParams($id: uuid = \"\") {\n guestTokens_by_pk(id: $id) {\n clientId\n companyId\n id\n params\n }\n}\n ";
4120
4202
  export declare const useGuestTokenParamsQuery: <TData = GuestTokenParamsQuery, TError = unknown>(variables?: GuestTokenParamsQueryVariables, options?: UseQueryOptions<GuestTokenParamsQuery, TError, TData, import("react-query").QueryKey> | undefined) => import("react-query").UseQueryResult<TData, TError>;
4121
- export declare const MetricAccessDocument = "\n query MetricAccess($companyId: uuid = \"\") {\n companySubsetTables(where: {companyId: {_eq: $companyId}}) {\n isAllowMetricCreation\n isAllowMetricDeletion\n isAllowMetricUpdation\n isAllowChangeLayout\n }\n}\n ";
4203
+ export declare const MetricAccessDocument = "\n query MetricAccess($workspaceId: uuid = \"\") {\n companySubsetTables(where: {workspaceId: {_eq: $workspaceId}}) {\n isAllowMetricCreation\n isAllowMetricDeletion\n isAllowMetricUpdation\n isAllowChangeLayout\n }\n}\n ";
4122
4204
  export declare const useMetricAccessQuery: <TData = MetricAccessQuery, TError = unknown>(variables?: MetricAccessQueryVariables, options?: UseQueryOptions<MetricAccessQuery, TError, TData, import("react-query").QueryKey> | undefined) => import("react-query").UseQueryResult<TData, TError>;
4123
4205
  export declare const RawCsvSettingsDocument = "\n query RawCsvSettings($id: uuid = \"\") {\n companyWorkspaces_by_pk(id: $id) {\n rawCsvSettings\n id\n }\n}\n ";
4124
4206
  export declare const useRawCsvSettingsQuery: <TData = RawCsvSettingsQuery, TError = unknown>(variables?: RawCsvSettingsQueryVariables, options?: UseQueryOptions<RawCsvSettingsQuery, TError, TData, import("react-query").QueryKey> | undefined) => import("react-query").UseQueryResult<TData, TError>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databrainhq/plugin",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Databrain app dashboard ui plugin.",
5
5
  "author": "",
6
6
  "license": "MIT",