@peak-ai/canvas 1.4.20-rc.1 → 1.4.20-rc.12

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 (33) hide show
  1. package/declaration.d.js +2 -0
  2. package/declaration.d.js.map +1 -0
  3. package/helpers/filter-placeholder.js +2 -1
  4. package/helpers/filter-placeholder.js.map +1 -1
  5. package/package.json +2 -2
  6. package/plugins/grapejs-plugin.js +3 -3
  7. package/plugins/grapejs-plugin.js.map +1 -1
  8. package/plugins/helpers/query-cache-context.d.ts +18 -0
  9. package/plugins/helpers/query-cache-context.js +2 -0
  10. package/plugins/helpers/query-cache-context.js.map +1 -0
  11. package/plugins/helpers/query-cache-singleton.d.ts +22 -0
  12. package/plugins/helpers/query-cache-singleton.js +3 -0
  13. package/plugins/helpers/query-cache-singleton.js.map +1 -0
  14. package/plugins/helpers/query-cache-utils.d.ts +48 -0
  15. package/plugins/helpers/query-cache-utils.js +3 -0
  16. package/plugins/helpers/query-cache-utils.js.map +1 -0
  17. package/plugins/helpers/query-details-modal.d.ts +7 -2
  18. package/plugins/helpers/query-details-modal.js +3 -3
  19. package/plugins/helpers/query-details-modal.js.map +1 -1
  20. package/plugins/helpers/query-heading-formatter.d.ts +1 -0
  21. package/plugins/helpers/query-heading-formatter.js +5 -0
  22. package/plugins/helpers/query-heading-formatter.js.map +1 -0
  23. package/plugins/helpers/query-loading-modal.d.ts +2 -1
  24. package/plugins/helpers/query-loading-modal.js +1 -1
  25. package/plugins/helpers/query-loading-modal.js.map +1 -1
  26. package/plugins/helpers/render-components.js +8 -4
  27. package/plugins/helpers/render-components.js.map +1 -1
  28. package/plugins/helpers/styled-info-button.d.ts +2 -1
  29. package/plugins/helpers/styled-info-button.js +4 -1
  30. package/plugins/helpers/styled-info-button.js.map +1 -1
  31. package/shadcn/components/icons/thinking.gif +0 -0
  32. package/types/images.d.js +2 -0
  33. package/types/images.d.js.map +1 -0
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=declaration.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration.d.js","names":[],"sources":["../src/declaration.d.ts"],"sourcesContent":["declare module '*.gif';"],"mappings":"","ignoreList":[]}
@@ -1,2 +1,3 @@
1
- import _extends from"@babel/runtime/helpers/extends";export function filterPlaceholders(obj){if(!obj||typeof obj!=="object"){return obj}var filtered=_extends({},obj);Object.keys(filtered).forEach(function(key){var value=filtered[key];if(value&&typeof value==="object"&&value.name==="__peak_placeholder"){delete filtered[key]}});return filtered}
1
+ import _extends from"@babel/runtime/helpers/extends";// eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ export function filterPlaceholders(obj){if(!obj||typeof obj!=="object"){return obj}var filtered=_extends({},obj);Object.keys(filtered).forEach(function(key){var value=filtered[key];if(value&&typeof value==="object"&&value.name==="__peak_placeholder"){delete filtered[key]}});return filtered}
2
3
  //# sourceMappingURL=filter-placeholder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-placeholder.js","names":["filterPlaceholders","obj","filtered","_extends","Object","keys","forEach","key","value","name"],"sources":["../../src/helpers/filter-placeholder.ts"],"sourcesContent":["export function filterPlaceholders(obj: any) {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n\n const filtered = { ...obj };\n Object.keys(filtered).forEach(key => {\n const value = filtered[key];\n\n if (value && typeof value === 'object' && value.name === '__peak_placeholder') {\n delete filtered[key];\n }\n });\n\n return filtered;\n}\n"],"mappings":"qDAAA,MAAO,SAAS,CAAAA,kBAAkBA,CAACC,GAAQ,CAAE,CAC3C,GAAI,CAACA,GAAG,EAAI,MAAO,CAAAA,GAAG,GAAK,QAAQ,CAAE,CACnC,MAAO,CAAAA,GACT,CAEA,GAAM,CAAAC,QAAQ,CAAAC,QAAA,IAAQF,GAAG,CAAE,CAC3BG,MAAM,CAACC,IAAI,CAACH,QAAQ,CAAC,CAACI,OAAO,CAAC,SAAAC,GAAG,CAAI,CACnC,GAAM,CAAAC,KAAK,CAAGN,QAAQ,CAACK,GAAG,CAAC,CAE3B,GAAIC,KAAK,EAAI,MAAO,CAAAA,KAAK,GAAK,QAAQ,EAAIA,KAAK,CAACC,IAAI,GAAK,oBAAoB,CAAE,CAC7E,MAAO,CAAAP,QAAQ,CAACK,GAAG,CACrB,CACF,CAAC,CAAC,CAEF,MAAO,CAAAL,QACT","ignoreList":[]}
1
+ {"version":3,"file":"filter-placeholder.js","names":["filterPlaceholders","obj","filtered","_extends","Object","keys","forEach","key","value","name"],"sources":["../../src/helpers/filter-placeholder.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function filterPlaceholders(obj: any) {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n\n const filtered = { ...obj };\n\n Object.keys(filtered).forEach((key) => {\n const value = filtered[key];\n \n if (value && typeof value === 'object' && value.name === '__peak_placeholder') {\n delete filtered[key];\n }\n });\n\n return filtered;\n}\n"],"mappings":"qDAAA;AACA,MAAO,SAAS,CAAAA,kBAAkBA,CAACC,GAAQ,CAAE,CAC3C,GAAI,CAACA,GAAG,EAAI,MAAO,CAAAA,GAAG,GAAK,QAAQ,CAAE,CACnC,MAAO,CAAAA,GACT,CAEA,GAAM,CAAAC,QAAQ,CAAAC,QAAA,IAAQF,GAAG,CAAE,CAE3BG,MAAM,CAACC,IAAI,CAACH,QAAQ,CAAC,CAACI,OAAO,CAAC,SAACC,GAAG,CAAK,CACrC,GAAM,CAAAC,KAAK,CAAGN,QAAQ,CAACK,GAAG,CAAC,CAE3B,GAAIC,KAAK,EAAI,MAAO,CAAAA,KAAK,GAAK,QAAQ,EAAIA,KAAK,CAACC,IAAI,GAAK,oBAAoB,CAAE,CAC7E,MAAO,CAAAP,QAAQ,CAACK,GAAG,CACrB,CACF,CAAC,CAAC,CAEF,MAAO,CAAAL,QACT","ignoreList":[]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@peak-ai/canvas",
3
3
  "author": "squad-builder-experience",
4
4
  "license": "UNLICENSED",
5
- "version": "1.4.20-rc.1",
5
+ "version": "1.4.20-rc.12",
6
6
  "description": "",
7
7
  "dependencies": {
8
8
  "@emotion/react": "^11.11.4",
@@ -59,4 +59,4 @@
59
59
  "types": "index.d.ts",
60
60
  "module": "index.js",
61
61
  "sideEffects": false
62
- }
62
+ }
@@ -1,7 +1,7 @@
1
- import _extends from"@babel/runtime/helpers/extends";/* eslint-disable import/no-named-as-default-member *//* eslint-disable func-names *//* eslint-disable @typescript-eslint/no-explicit-any */import ReactDOM from"react-dom";import{getRenderers}from"./helpers/render-components";import{jsx as _jsx}from"react/jsx-runtime";export function createGrapesjsShadcnGenericPlugin(mode,performInteraction,renderedComponents,setHasChanged){if(renderedComponents===void 0){renderedComponents={}}return function grapesjsShadcnGenericPlugin(editor){editor.DomComponents.addType("shadcn-generic",{model:{defaults:{tagName:"div",droppable:false,componentName:"Card",componentProps:{},traits:[]}},view:{events:{"input [data-slot]":"handleSlotInput"},handleSlotInput:function handleSlotInput(e){var target=e.target;var slot=target.dataset.slot;var text=target.innerText;var props=this.model.get("componentProps")||{};if(!slot){return}if(slot.startsWith("table-header-")){var _props$data;var idx=parseInt(slot.split("-")[2],10);var dataKeys=Object.keys(((_props$data=props.data)==null?void 0:_props$data[0])||{});if(!props.headerMapper){props.headerMapper={}}var key=dataKeys[idx];if(key){props.headerMapper[key]=text}}else{props[slot]=text}this.model.set("componentProps",_extends({},props));if(!["search-input"].includes(slot)){setHasChanged(true)}},render:function render(){var _this=this;var compName=this.model.get("componentName");var compProps=this.model.get("componentProps");if(typeof compProps==="string"){try{compProps=JSON.parse(compProps)}catch(err){// eslint-disable-next-line no-console
2
- console.error("Invalid JSON in componentProps",err);compProps={}}}compProps.isEditable=mode==="editor";compProps.performInteraction=performInteraction;compProps.onChange=function(data){_this.model.set("componentProps",_extends({},_this.model.get("componentProps"),data))};var renderers=getRenderers();var Renderer=renderers[compName];if(Renderer){if(compName==="Tabs"){ReactDOM.render(/*#__PURE__*/_jsx(Renderer,_extends({},compProps,{gjsModel:this.model})),this.el);var children=this.model.components();var tabsContent=this.el.querySelectorAll(".tabs-content");var tabAttributes=this.model.get("attributes")||{};var hasTabsError=tabAttributes.error||compProps.error;var hasTabsMissing=tabAttributes.isMissing||compProps.isMissing;var isFallback=Array.from(tabsContent).some(function(el){return el.dataset.fallback==="true"});if(!isFallback&&tabsContent.length>0){// Helper function to sync child attributes
1
+ import _extends from"@babel/runtime/helpers/extends";/* eslint-disable import/no-named-as-default-member *//* eslint-disable func-names *//* eslint-disable @typescript-eslint/no-explicit-any */import ReactDOM from"react-dom";import{getRenderers}from"./helpers/render-components";import{QueryCacheProvider}from"./helpers/query-cache-context";import{jsx as _jsx}from"react/jsx-runtime";export function createGrapesjsShadcnGenericPlugin(mode,performInteraction,renderedComponents,setHasChanged){if(renderedComponents===void 0){renderedComponents={}}return function grapesjsShadcnGenericPlugin(editor){editor.DomComponents.addType("shadcn-generic",{model:{defaults:{tagName:"div",droppable:false,componentName:"Card",componentProps:{},traits:[]}},view:{events:{"input [data-slot]":"handleSlotInput"},handleSlotInput:function handleSlotInput(e){var target=e.target;var slot=target.dataset.slot;var text=target.innerText;var props=this.model.get("componentProps")||{};if(!slot){return}if(slot.startsWith("table-header-")){var _props$data;var idx=parseInt(slot.split("-")[2],10);var dataKeys=Object.keys(((_props$data=props.data)==null?void 0:_props$data[0])||{});if(!props.headerMapper){props.headerMapper={}}var key=dataKeys[idx];if(key){props.headerMapper[key]=text}}else{props[slot]=text}this.model.set("componentProps",_extends({},props));if(!["search-input"].includes(slot)){setHasChanged(true)}},render:function render(){var _this=this;var compName=this.model.get("componentName");var compProps=this.model.get("componentProps");if(typeof compProps==="string"){try{compProps=JSON.parse(compProps)}catch(err){// eslint-disable-next-line no-console
2
+ console.error("Invalid JSON in componentProps",err);compProps={}}}compProps.isEditable=mode==="editor";compProps.performInteraction=performInteraction;compProps.onChange=function(data){_this.model.set("componentProps",_extends({},_this.model.get("componentProps"),data))};var renderers=getRenderers();var Renderer=renderers[compName];if(Renderer){if(compName==="Tabs"){ReactDOM.render(/*#__PURE__*/_jsx(QueryCacheProvider,{maxCacheSize:100,maxCacheAge:5*60*1000,children:/*#__PURE__*/_jsx(Renderer,_extends({},compProps,{gjsModel:this.model}))}),this.el);var children=this.model.components();var tabsContent=this.el.querySelectorAll(".tabs-content");var tabAttributes=this.model.get("attributes")||{};var hasTabsError=tabAttributes.error||compProps.error;var hasTabsMissing=tabAttributes.isMissing||compProps.isMissing;var isFallback=Array.from(tabsContent).some(function(el){return el.dataset.fallback==="true"});if(!isFallback&&tabsContent.length>0){// Helper function to sync child attributes
3
3
  // eslint-disable-next-line no-inner-declarations
4
- var syncChildAttributes=function syncChildAttributes(childModel){var childAttributes=childModel.get("attributes")||{};var childProps=childModel.get("componentProps")||{};var hasError=hasTabsError||childAttributes.error||childProps.error;var hasMissing=hasTabsMissing||childAttributes.isMissing||childProps.isMissing;if(hasError||hasMissing){var newAttributes=_extends({},childAttributes,{loading:false,error:hasError,isMissing:hasMissing,inheritedFromParent:!!(hasTabsError||hasTabsMissing)});childModel.set("attributes",newAttributes,{silent:false})}};children.each(function(childModel,i){var childView=_this.createView(childModel);if(childView&&tabsContent[i]){childView.render();tabsContent[i].appendChild(childView.el);setTimeout(function(){syncChildAttributes(childModel)},100);childModel.on("change:attributes",function(){syncChildAttributes(childModel)})}})}}else{ReactDOM.render(/*#__PURE__*/_jsx(Renderer,_extends({},compProps,{gjsModel:this.model})),this.el)}}else{this.el.innerHTML="<div>Unsupported component: "+compName+"</div>"}renderedComponents[this.model.get("id")]=this.model;return this},createView:function createView(model){var _this$em$get$getType;var ComponentView=(_this$em$get$getType=this.em.get("DomComponents").getType(model.get("type")))==null?void 0:_this$em$get$getType.view;if(!ComponentView){// eslint-disable-next-line no-console
4
+ var syncChildAttributes=function syncChildAttributes(childModel){var childAttributes=childModel.get("attributes")||{};var childProps=childModel.get("componentProps")||{};var hasError=hasTabsError||childAttributes.error||childProps.error;var hasMissing=hasTabsMissing||childAttributes.isMissing||childProps.isMissing;if(hasError||hasMissing){var newAttributes=_extends({},childAttributes,{loading:false,error:hasError,isMissing:hasMissing,inheritedFromParent:!!(hasTabsError||hasTabsMissing)});childModel.set("attributes",newAttributes,{silent:false})}};children.each(function(childModel,i){var childView=_this.createView(childModel);if(childView&&tabsContent[i]){childView.render();tabsContent[i].appendChild(childView.el);setTimeout(function(){syncChildAttributes(childModel)},100);childModel.on("change:attributes",function(){syncChildAttributes(childModel)})}})}}else{ReactDOM.render(/*#__PURE__*/_jsx(QueryCacheProvider,{maxCacheSize:100,maxCacheAge:5*60*1000,children:/*#__PURE__*/_jsx(Renderer,_extends({},compProps,{gjsModel:this.model}))}),this.el)}}else{this.el.innerHTML="<div>Unsupported component: "+compName+"</div>"}renderedComponents[this.model.get("id")]=this.model;return this},createView:function createView(model){var _this$em$get$getType;var ComponentView=(_this$em$get$getType=this.em.get("DomComponents").getType(model.get("type")))==null?void 0:_this$em$get$getType.view;if(!ComponentView){// eslint-disable-next-line no-console
5
5
  console.warn("No view found for component type:",model.get("type"));return null}var view=new ComponentView({model:model,config:this.config,componentTypes:this.componentTypes});return view},remove:function remove(){// eslint-disable-next-line import/no-named-as-default-member
6
6
  ReactDOM.unmountComponentAtNode(this.el);return this}}})}}
7
7
  //# sourceMappingURL=grapejs-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grapejs-plugin.js","names":["ReactDOM","getRenderers","jsx","_jsx","createGrapesjsShadcnGenericPlugin","mode","performInteraction","renderedComponents","setHasChanged","grapesjsShadcnGenericPlugin","editor","DomComponents","addType","model","defaults","tagName","droppable","componentName","componentProps","traits","view","events","handleSlotInput","e","target","slot","dataset","text","innerText","props","get","startsWith","_props$data","idx","parseInt","split","dataKeys","Object","keys","data","headerMapper","key","set","_extends","includes","render","_this","compName","compProps","JSON","parse","err","console","error","isEditable","onChange","renderers","Renderer","gjsModel","el","children","components","tabsContent","querySelectorAll","tabAttributes","hasTabsError","hasTabsMissing","isMissing","isFallback","Array","from","some","fallback","length","syncChildAttributes","childModel","childAttributes","childProps","hasError","hasMissing","newAttributes","loading","inheritedFromParent","silent","each","i","childView","createView","appendChild","setTimeout","on","innerHTML","_this$em$get$getType","ComponentView","em","getType","warn","config","componentTypes","remove","unmountComponentAtNode"],"sources":["../../src/plugins/grapejs-plugin.tsx"],"sourcesContent":["/* eslint-disable import/no-named-as-default-member */\n/* eslint-disable func-names */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport ReactDOM from 'react-dom';\nimport { Editor, Component } from 'grapesjs';\nimport { getRenderers } from './helpers/render-components';\n\nexport function createGrapesjsShadcnGenericPlugin(\n mode: 'editor' | 'preview',\n performInteraction: (payload: Record<string, any>) => void,\n renderedComponents: Record<string, Component> = {},\n setHasChanged: (hasChanged: boolean) => void,\n) {\n return function grapesjsShadcnGenericPlugin(editor: Editor): void {\n editor.DomComponents.addType('shadcn-generic', {\n model: {\n defaults: {\n tagName: 'div',\n droppable: false,\n componentName: 'Card',\n componentProps: {},\n traits: [],\n },\n },\n view: {\n events: {\n 'input [data-slot]': 'handleSlotInput',\n } as any,\n handleSlotInput(e: Event) {\n const target = e.target as HTMLElement;\n const slot = target.dataset.slot;\n const text = target.innerText;\n\n const props = this.model.get('componentProps') || {};\n\n if (!slot) {\n return;\n }\n\n if (slot.startsWith('table-header-')) {\n const idx = parseInt(slot.split('-')[2], 10);\n const dataKeys = Object.keys(props.data?.[0] || {});\n\n if (!props.headerMapper) {\n props.headerMapper = {};\n }\n\n const key = dataKeys[idx];\n\n if (key) {\n props.headerMapper[key] = text;\n }\n } else {\n props[slot] = text;\n }\n\n this.model.set('componentProps', {\n ...props,\n });\n\n if (!['search-input'].includes(slot)) {\n setHasChanged(true);\n }\n },\n render: function () {\n const compName: string = this.model.get('componentName');\n let compProps: any = this.model.get('componentProps');\n\n if (typeof compProps === 'string') {\n try {\n compProps = JSON.parse(compProps);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('Invalid JSON in componentProps', err);\n compProps = {};\n }\n }\n\n compProps.isEditable = mode === 'editor';\n compProps.performInteraction = performInteraction;\n\n compProps.onChange = (data: Record<string, any>) => {\n this.model.set('componentProps', {\n ...this.model.get('componentProps'),\n ...data,\n });\n };\n\n const renderers = getRenderers();\n const Renderer = renderers[compName];\n\n if (Renderer) {\n if (compName === 'Tabs') {\n ReactDOM.render(<Renderer {...compProps} gjsModel={this.model} />, this.el);\n\n const children = this.model.components();\n const tabsContent = this.el.querySelectorAll('.tabs-content');\n\n const tabAttributes = this.model.get('attributes') || {};\n const hasTabsError = tabAttributes.error || compProps.error;\n const hasTabsMissing = tabAttributes.isMissing || compProps.isMissing;\n const isFallback = Array.from(tabsContent).some(\n (el: Element) => (el as HTMLElement).dataset.fallback === 'true',\n );\n\n if (!isFallback && tabsContent.length > 0) {\n // Helper function to sync child attributes\n // eslint-disable-next-line no-inner-declarations\n function syncChildAttributes(childModel: any) {\n const childAttributes = childModel.get('attributes') || {};\n const childProps = childModel.get('componentProps') || {};\n\n const hasError = hasTabsError || childAttributes.error || childProps.error;\n const hasMissing =\n hasTabsMissing || childAttributes.isMissing || childProps.isMissing;\n\n if (hasError || hasMissing) {\n const newAttributes = {\n ...childAttributes,\n loading: false,\n error: hasError,\n isMissing: hasMissing,\n inheritedFromParent: !!(hasTabsError || hasTabsMissing),\n };\n\n childModel.set('attributes', newAttributes, { silent: false });\n }\n }\n\n children.each((childModel, i) => {\n const childView = this.createView(childModel);\n\n if (childView && tabsContent[i]) {\n childView.render();\n tabsContent[i].appendChild(childView.el);\n\n setTimeout(() => {\n syncChildAttributes(childModel);\n }, 100);\n\n childModel.on('change:attributes', () => {\n syncChildAttributes(childModel);\n });\n }\n });\n }\n } else {\n ReactDOM.render(<Renderer {...compProps} gjsModel={this.model} />, this.el);\n }\n } else {\n this.el.innerHTML = `<div>Unsupported component: ${compName}</div>`;\n }\n\n renderedComponents[this.model.get('id')] = this.model;\n\n return this;\n },\n createView(model: any) {\n const ComponentView = this.em.get('DomComponents').getType(model.get('type'))?.view;\n\n if (!ComponentView) {\n // eslint-disable-next-line no-console\n console.warn('No view found for component type:', model.get('type'));\n\n return null;\n }\n\n const view = new ComponentView({\n model,\n config: this.config,\n componentTypes: this.componentTypes,\n });\n\n return view;\n },\n remove: function () {\n // eslint-disable-next-line import/no-named-as-default-member\n ReactDOM.unmountComponentAtNode(this.el);\n\n return this;\n },\n },\n });\n };\n}\n"],"mappings":"qDAAA,sDACA,+BACA,uDACA,MAAO,CAAAA,QAAQ,KAAM,WAAW,CAEhC,OAASC,YAAY,KAAQ,6BAA6B,CAAC,OAAAC,GAAA,IAAAC,IAAA,yBAE3D,MAAO,SAAS,CAAAC,iCAAiCA,CAC/CC,IAA0B,CAC1BC,kBAA0D,CAC1DC,kBAA6C,CAC7CC,aAA4C,CAC5C,IAFAD,kBAA6C,WAA7CA,kBAA6C,CAAG,CAAC,CAAC,CAGlD,MAAO,SAAS,CAAAE,2BAA2BA,CAACC,MAAc,CAAQ,CAChEA,MAAM,CAACC,aAAa,CAACC,OAAO,CAAC,gBAAgB,CAAE,CAC7CC,KAAK,CAAE,CACLC,QAAQ,CAAE,CACRC,OAAO,CAAE,KAAK,CACdC,SAAS,CAAE,KAAK,CAChBC,aAAa,CAAE,MAAM,CACrBC,cAAc,CAAE,CAAC,CAAC,CAClBC,MAAM,CAAE,EACV,CACF,CAAC,CACDC,IAAI,CAAE,CACJC,MAAM,CAAE,CACN,mBAAmB,CAAE,iBACvB,CAAQ,CACRC,eAAe,SAAf,CAAAA,eAAeA,CAACC,CAAQ,CAAE,CACxB,GAAM,CAAAC,MAAM,CAAGD,CAAC,CAACC,MAAqB,CACtC,GAAM,CAAAC,IAAI,CAAGD,MAAM,CAACE,OAAO,CAACD,IAAI,CAChC,GAAM,CAAAE,IAAI,CAAGH,MAAM,CAACI,SAAS,CAE7B,GAAM,CAAAC,KAAK,CAAG,IAAI,CAAChB,KAAK,CAACiB,GAAG,CAAC,gBAAgB,CAAC,EAAI,CAAC,CAA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nBC,cAAc,CAAE,IAAI,CAACA,cACvB,CAAC,CAAC,CAEF,MAAO,CAAA9E,IACT,CAAC,CACD+E,MAAM,CAAE,QAAR,CAAAA,MAAMA,CAAA,CAAc,CAClB;AACAnG,QAAQ,CAACoG,sBAAsB,CAAC,IAAI,CAACzC,EAAE,CAAC,CAExC,MAAO,KACT,CACF,CACF,CAAC,CACH,CACF","ignoreList":[]}
1
+ {"version":3,"file":"grapejs-plugin.js","names":["ReactDOM","getRenderers","QueryCacheProvider","jsx","_jsx","createGrapesjsShadcnGenericPlugin","mode","performInteraction","renderedComponents","setHasChanged","grapesjsShadcnGenericPlugin","editor","DomComponents","addType","model","defaults","tagName","droppable","componentName","componentProps","traits","view","events","handleSlotInput","e","target","slot","dataset","text","innerText","props","get","startsWith","_props$data","idx","parseInt","split","dataKeys","Object","keys","data","headerMapper","key","set","_extends","includes","render","_this","compName","compProps","JSON","parse","err","console","error","isEditable","onChange","renderers","Renderer","maxCacheSize","maxCacheAge","children","gjsModel","el","components","tabsContent","querySelectorAll","tabAttributes","hasTabsError","hasTabsMissing","isMissing","isFallback","Array","from","some","fallback","length","syncChildAttributes","childModel","childAttributes","childProps","hasError","hasMissing","newAttributes","loading","inheritedFromParent","silent","each","i","childView","createView","appendChild","setTimeout","on","innerHTML","_this$em$get$getType","ComponentView","em","getType","warn","config","componentTypes","remove","unmountComponentAtNode"],"sources":["../../src/plugins/grapejs-plugin.tsx"],"sourcesContent":["/* eslint-disable import/no-named-as-default-member */\n/* eslint-disable func-names */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport ReactDOM from 'react-dom';\nimport { Editor, Component } from 'grapesjs';\nimport { getRenderers } from './helpers/render-components';\nimport { QueryCacheProvider } from './helpers/query-cache-context';\n\nexport function createGrapesjsShadcnGenericPlugin(\n mode: 'editor' | 'preview',\n performInteraction: (payload: Record<string, any>) => void,\n renderedComponents: Record<string, Component> = {},\n setHasChanged: (hasChanged: boolean) => void,\n) {\n return function grapesjsShadcnGenericPlugin(editor: Editor): void {\n editor.DomComponents.addType('shadcn-generic', {\n model: {\n defaults: {\n tagName: 'div',\n droppable: false,\n componentName: 'Card',\n componentProps: {},\n traits: [],\n },\n },\n view: {\n events: {\n 'input [data-slot]': 'handleSlotInput',\n } as any,\n handleSlotInput(e: Event) {\n const target = e.target as HTMLElement;\n const slot = target.dataset.slot;\n const text = target.innerText;\n\n const props = this.model.get('componentProps') || {};\n\n if (!slot) {\n return;\n }\n\n if (slot.startsWith('table-header-')) {\n const idx = parseInt(slot.split('-')[2], 10);\n const dataKeys = Object.keys(props.data?.[0] || {});\n\n if (!props.headerMapper) {\n props.headerMapper = {};\n }\n\n const key = dataKeys[idx];\n\n if (key) {\n props.headerMapper[key] = text;\n }\n } else {\n props[slot] = text;\n }\n\n this.model.set('componentProps', {\n ...props,\n });\n\n if (!['search-input'].includes(slot)) {\n setHasChanged(true);\n }\n },\n render: function () {\n const compName: string = this.model.get('componentName');\n let compProps: any = this.model.get('componentProps');\n\n if (typeof compProps === 'string') {\n try {\n compProps = JSON.parse(compProps);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('Invalid JSON in componentProps', err);\n compProps = {};\n }\n }\n\n compProps.isEditable = mode === 'editor';\n compProps.performInteraction = performInteraction;\n\n compProps.onChange = (data: Record<string, any>) => {\n this.model.set('componentProps', {\n ...this.model.get('componentProps'),\n ...data,\n });\n };\n\n const renderers = getRenderers();\n const Renderer = renderers[compName];\n\n if (Renderer) {\n if (compName === 'Tabs') {\n ReactDOM.render(\n <QueryCacheProvider maxCacheSize={100} maxCacheAge={5 * 60 * 1000}>\n <Renderer {...compProps} gjsModel={this.model} />\n </QueryCacheProvider>,\n this.el\n );\n\n const children = this.model.components();\n const tabsContent = this.el.querySelectorAll('.tabs-content');\n\n const tabAttributes = this.model.get('attributes') || {};\n const hasTabsError = tabAttributes.error || compProps.error;\n const hasTabsMissing = tabAttributes.isMissing || compProps.isMissing;\n const isFallback = Array.from(tabsContent).some(\n (el: Element) => (el as HTMLElement).dataset.fallback === 'true',\n );\n\n if (!isFallback && tabsContent.length > 0) {\n // Helper function to sync child attributes\n // eslint-disable-next-line no-inner-declarations\n function syncChildAttributes(childModel: any) {\n const childAttributes = childModel.get('attributes') || {};\n const childProps = childModel.get('componentProps') || {};\n\n const hasError = hasTabsError || childAttributes.error || childProps.error;\n const hasMissing =\n hasTabsMissing || childAttributes.isMissing || childProps.isMissing;\n\n if (hasError || hasMissing) {\n const newAttributes = {\n ...childAttributes,\n loading: false,\n error: hasError,\n isMissing: hasMissing,\n inheritedFromParent: !!(hasTabsError || hasTabsMissing),\n };\n\n childModel.set('attributes', newAttributes, { silent: false });\n }\n }\n\n children.each((childModel, i) => {\n const childView = this.createView(childModel);\n\n if (childView && tabsContent[i]) {\n childView.render();\n tabsContent[i].appendChild(childView.el);\n\n setTimeout(() => {\n syncChildAttributes(childModel);\n }, 100);\n\n childModel.on('change:attributes', () => {\n syncChildAttributes(childModel);\n });\n }\n });\n }\n } else {\n ReactDOM.render(\n <QueryCacheProvider maxCacheSize={100} maxCacheAge={5 * 60 * 1000}>\n <Renderer {...compProps} gjsModel={this.model} />\n </QueryCacheProvider>,\n this.el\n );\n }\n } else {\n this.el.innerHTML = `<div>Unsupported component: ${compName}</div>`;\n }\n\n renderedComponents[this.model.get('id')] = this.model;\n\n return this;\n },\n createView(model: any) {\n const ComponentView = this.em.get('DomComponents').getType(model.get('type'))?.view;\n\n if (!ComponentView) {\n // eslint-disable-next-line no-console\n console.warn('No view found for component type:', model.get('type'));\n\n return null;\n }\n\n const view = new ComponentView({\n model,\n config: this.config,\n componentTypes: this.componentTypes,\n });\n\n return view;\n },\n remove: function () {\n // eslint-disable-next-line import/no-named-as-default-member\n ReactDOM.unmountComponentAtNode(this.el);\n\n return this;\n },\n },\n });\n };\n}\n"],"mappings":"qDAAA,sDACA,+BACA,uDACA,MAAO,CAAAA,QAAQ,KAAM,WAAW,CAEhC,OAASC,YAAY,KAAQ,6BAA6B,CAC1D,OAASC,kB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M,CAAE,QAAR,CAAAA,MAAMA,CAAA,CAAc,CAClB;AACAtG,QAAQ,CAACuG,sBAAsB,CAAC,IAAI,CAACxC,EAAE,CAAC,CAExC,MAAO,KACT,CACF,CACF,CAAC,CACH,CACF","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { QueryCacheEntry, InteractionType, InteractionState } from './query-cache-utils';
3
+ type QueryCacheContextValue = {
4
+ getCachedQuery: (componentId: string, interactionType: InteractionType, state: InteractionState) => QueryCacheEntry | null;
5
+ setCachedQuery: (componentId: string, interactionType: InteractionType, state: InteractionState, entry: QueryCacheEntry) => void;
6
+ invalidateComponent: (componentId: string) => void;
7
+ invalidateAll: () => void;
8
+ isCached: (componentId: string, interactionType: InteractionType, state: InteractionState) => boolean;
9
+ };
10
+ type QueryCacheProviderProps = {
11
+ children: React.ReactNode;
12
+ maxCacheSize?: number;
13
+ maxCacheAge?: number;
14
+ };
15
+ export declare function QueryCacheProvider({ children, maxCacheSize, maxCacheAge, }: QueryCacheProviderProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function useQueryCache(): QueryCacheContextValue;
17
+ export declare function useInvalidateCacheOnChange(componentId: string | undefined, dependencies: unknown[]): void;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ import React,{createContext,useContext,useCallback,useRef,useMemo}from"react";import{getGlobalQueryCache,configureGlobalQueryCache}from"./query-cache-singleton";import{jsx as _jsx}from"react/jsx-runtime";var QueryCacheContext=/*#__PURE__*/createContext(null);export function QueryCacheProvider(_ref){var children=_ref.children,_ref$maxCacheSize=_ref.maxCacheSize,maxCacheSize=_ref$maxCacheSize===void 0?100:_ref$maxCacheSize,_ref$maxCacheAge=_ref.maxCacheAge,maxCacheAge=_ref$maxCacheAge===void 0?5*60*1000:_ref$maxCacheAge;var isConfigured=useRef(false);if(!isConfigured.current){configureGlobalQueryCache(maxCacheSize,maxCacheAge);isConfigured.current=true}var cacheManager=useRef(getGlobalQueryCache()).current;var getCachedQuery=useCallback(function(componentId,interactionType,state){return cacheManager.getCachedQuery(componentId,interactionType,state)},[cacheManager]);var setCachedQuery=useCallback(function(componentId,interactionType,state,entry){cacheManager.setCachedQuery(componentId,interactionType,state,entry)},[cacheManager]);var invalidateComponent=useCallback(function(componentId){cacheManager.invalidateComponent(componentId)},[cacheManager]);var invalidateAll=useCallback(function(){cacheManager.invalidateAll()},[cacheManager]);var isCached=useCallback(function(componentId,interactionType,state){return cacheManager.isCached(componentId,interactionType,state)},[cacheManager]);var value=useMemo(function(){return{getCachedQuery:getCachedQuery,setCachedQuery:setCachedQuery,invalidateComponent:invalidateComponent,invalidateAll:invalidateAll,isCached:isCached}},[getCachedQuery,setCachedQuery,invalidateComponent,invalidateAll,isCached]);return/*#__PURE__*/_jsx(QueryCacheContext.Provider,{value:value,children:children})}export function useQueryCache(){var context=useContext(QueryCacheContext);if(!context){throw new Error("useQueryCache must be used within a QueryCacheProvider")}return context}export function useInvalidateCacheOnChange(componentId,dependencies){var _useQueryCache=useQueryCache(),invalidateComponent=_useQueryCache.invalidateComponent;var prevDepsRef=useRef([]);React.useEffect(function(){if(prevDepsRef.current.length===0){prevDepsRef.current=dependencies;return}var hasChanged=dependencies.some(function(dep,index){return dep!==prevDepsRef.current[index]});if(hasChanged&&componentId){invalidateComponent(componentId)}prevDepsRef.current=dependencies},[componentId,invalidateComponent,dependencies])}
2
+ //# sourceMappingURL=query-cache-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-cache-context.js","names":["React","createContext","useContext","useCallback","useRef","useMemo","getGlobalQueryCache","configureGlobalQueryCache","jsx","_jsx","QueryCacheContext","QueryCacheProvider","_ref","children","_ref$maxCacheSize","maxCacheSize","_ref$maxCacheAge","maxCacheAge","isConfigured","current","cacheManager","getCachedQuery","componentId","interactionType","state","setCachedQuery","entry","invalidateComponent","invalidateAll","isCached","value","Provider","useQueryCache","context","Error","useInvalidateCacheOnChange","dependencies","_useQueryCache","prevDepsRef","useEffect","length","hasChanged","some","dep","index"],"sources":["../../../src/plugins/helpers/query-cache-context.tsx"],"sourcesContent":["import React, { createContext, useContext, useCallback, useRef, useMemo } from 'react';\nimport {\n QueryCacheEntry,\n InteractionType,\n InteractionState,\n} from './query-cache-utils';\nimport { getGlobalQueryCache, configureGlobalQueryCache } from './query-cache-singleton';\n\ntype QueryCacheContextValue = {\n getCachedQuery: (\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState\n ) => QueryCacheEntry | null;\n \n setCachedQuery: (\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState,\n entry: QueryCacheEntry\n ) => void;\n \n invalidateComponent: (componentId: string) => void;\n\n invalidateAll: () => void;\n\n isCached: (\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState\n ) => boolean;\n};\n\nconst QueryCacheContext = createContext<QueryCacheContextValue | null>(null);\n\ntype QueryCacheProviderProps = {\n children: React.ReactNode;\n maxCacheSize?: number;\n maxCacheAge?: number;\n};\n\nexport function QueryCacheProvider({\n children,\n maxCacheSize = 100,\n maxCacheAge = 5 * 60 * 1000, // 5 minutes\n}: QueryCacheProviderProps) {\n const isConfigured = useRef(false);\n \n if (!isConfigured.current) {\n configureGlobalQueryCache(maxCacheSize, maxCacheAge);\n isConfigured.current = true;\n }\n\n const cacheManager = useRef(getGlobalQueryCache()).current;\n \n const getCachedQuery = useCallback(\n (\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState\n ): QueryCacheEntry | null => {\n return cacheManager.getCachedQuery(componentId, interactionType, state);\n },\n [cacheManager]\n );\n \n const setCachedQuery = useCallback(\n (\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState,\n entry: QueryCacheEntry\n ) => {\n cacheManager.setCachedQuery(componentId, interactionType, state, entry);\n },\n [cacheManager]\n );\n \n const invalidateComponent = useCallback(\n (componentId: string) => {\n cacheManager.invalidateComponent(componentId);\n },\n [cacheManager]\n );\n \n const invalidateAll = useCallback(() => {\n cacheManager.invalidateAll();\n }, [cacheManager]);\n \n const isCached = useCallback(\n (\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState\n ): boolean => {\n return cacheManager.isCached(componentId, interactionType, state);\n },\n [cacheManager]\n );\n \n const value = useMemo(\n () => ({\n getCachedQuery,\n setCachedQuery,\n invalidateComponent,\n invalidateAll,\n isCached,\n }),\n [getCachedQuery, setCachedQuery, invalidateComponent, invalidateAll, isCached]\n );\n \n return (\n <QueryCacheContext.Provider value={value}>\n {children}\n </QueryCacheContext.Provider>\n );\n}\n\nexport function useQueryCache(): QueryCacheContextValue {\n const context = useContext(QueryCacheContext);\n \n if (!context) {\n throw new Error('useQueryCache must be used within a QueryCacheProvider');\n }\n \n return context;\n}\n\nexport function useInvalidateCacheOnChange(\n componentId: string | undefined,\n dependencies: unknown[]\n): void {\n const { invalidateComponent } = useQueryCache();\n const prevDepsRef = useRef<unknown[]>([]);\n \n React.useEffect(() => {\n if (prevDepsRef.current.length === 0) {\n prevDepsRef.current = dependencies;\n\n return;\n }\n \n const hasChanged = dependencies.some(\n (dep, index) => dep !== prevDepsRef.current[index]\n );\n \n if (hasChanged && componentId) {\n invalidateComponent(componentId);\n }\n \n prevDepsRef.current = dependencies;\n }, [componentId, invalidateComponent, dependencies]);\n}\n\n"],"mappings":"AAAA,MAAO,CAAAA,KAAK,EAAIC,aAAa,CAAEC,UAAU,CAAEC,WAAW,CAAEC,MAAM,CAAEC,OAAO,KAAQ,OAAO,CAMtF,OAASC,mBAAmB,CAAEC,yBAAyB,KAAQ,yBAAyB,CAAC,OAAAC,GAAA,IAAAC,IAAA,yBA2BzF,GAAM,CAAAC,iBAAiB,cAAGT,aAAa,CAAgC,IAAI,CAAC,CAQ5E,MAAO,SAAS,CAAAU,kBAAkBA,CAAAC,IAAA,CAIN,IAH1B,CAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CAAAC,iBAAA,CAAAF,IAAA,CACRG,YAAY,CAAZA,YAAY,CAAAD,iBAAA,UAAG,GAAG,CAAAA,iBAAA,CAAAE,gBAAA,CAAAJ,IAA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U,EAAInB,WAAW,CAAE,CAC7BK,mBAAmB,CAACL,WAAW,CACjC,CAEAgB,WAAW,CAACnB,OAAO,CAAGiB,YACxB,CAAC,CAAE,CAACd,WAAW,CAAEK,mBAAmB,CAAES,YAAY,CAAC,CACrD","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ import { QueryCacheEntry, InteractionType, InteractionState } from './query-cache-utils';
2
+ declare class QueryCacheManager {
3
+ private cache;
4
+ private maxCacheSize;
5
+ private maxCacheAge;
6
+ constructor(maxCacheSize?: number, maxCacheAge?: number);
7
+ getCachedQuery(componentId: string, interactionType: InteractionType, state: InteractionState): QueryCacheEntry | null;
8
+ setCachedQuery(componentId: string, interactionType: InteractionType, state: InteractionState, entry: QueryCacheEntry): void;
9
+ invalidateComponent(componentId: string): void;
10
+ invalidateAll(): void;
11
+ isCached(componentId: string, interactionType: InteractionType, state: InteractionState): boolean;
12
+ private cleanupCache;
13
+ getStats(): {
14
+ maxAge: number;
15
+ maxSize: number;
16
+ size: number;
17
+ };
18
+ }
19
+ export declare function getGlobalQueryCache(): QueryCacheManager;
20
+ export declare function resetGlobalQueryCache(): void;
21
+ export declare function configureGlobalQueryCache(maxCacheSize?: number, maxCacheAge?: number): void;
22
+ export {};
@@ -0,0 +1,3 @@
1
+ import _extends from"@babel/runtime/helpers/extends";function _createForOfIteratorHelperLoose(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}import{createCacheKey,getInvalidationPattern}from"./query-cache-utils";var QueryCacheManager=/*#__PURE__*/function(){// 5 minutes
2
+ function QueryCacheManager(maxCacheSize,maxCacheAge){if(maxCacheSize===void 0){maxCacheSize=100}if(maxCacheAge===void 0){maxCacheAge=5*60*1000}this.cache=new Map;this.maxCacheSize=100;this.maxCacheAge=5*60*1000;this.maxCacheSize=maxCacheSize;this.maxCacheAge=maxCacheAge}var _proto=QueryCacheManager.prototype;_proto.getCachedQuery=function getCachedQuery(componentId,interactionType,state){var key=createCacheKey(componentId,interactionType,state);var entry=this.cache.get(key);if(!entry){return null}var now=Date.now();if(now-entry.timestamp>this.maxCacheAge){this.cache["delete"](key);return null}return entry};_proto.setCachedQuery=function setCachedQuery(componentId,interactionType,state,entry){var key=createCacheKey(componentId,interactionType,state);this.cache.set(key,_extends({},entry,{timestamp:Date.now()}));if(this.cache.size>this.maxCacheSize){this.cleanupCache()}};_proto.invalidateComponent=function invalidateComponent(componentId){var pattern=getInvalidationPattern(componentId);for(var _iterator=_createForOfIteratorHelperLoose(this.cache.keys()),_step;!(_step=_iterator()).done;){var key=_step.value;if(pattern.test(key)){this.cache["delete"](key)}}};_proto.invalidateAll=function invalidateAll(){this.cache.clear()};_proto.isCached=function isCached(componentId,interactionType,state){return this.getCachedQuery(componentId,interactionType,state)!==null};_proto.cleanupCache=function cleanupCache(){var now=Date.now();for(var _iterator2=_createForOfIteratorHelperLoose(this.cache.entries()),_step2;!(_step2=_iterator2()).done;){var _step2$value=_step2.value,_key=_step2$value[0],entry=_step2$value[1];if(now-entry.timestamp>this.maxCacheAge){this.cache["delete"](_key)}}if(this.cache.size>this.maxCacheSize){var entries=Array.from(this.cache.entries());entries.sort(function(a,b){return a[1].timestamp-b[1].timestamp});var entriesToRemove=entries.slice(0,this.cache.size-this.maxCacheSize);for(var _iterator3=_createForOfIteratorHelperLoose(entriesToRemove),_step3;!(_step3=_iterator3()).done;){var _step3$value=_step3.value,key=_step3$value[0];this.cache["delete"](key)}}};_proto.getStats=function getStats(){return{maxAge:this.maxCacheAge,maxSize:this.maxCacheSize,size:this.cache.size}};return QueryCacheManager}();var globalCacheInstance=null;export function getGlobalQueryCache(){if(!globalCacheInstance){globalCacheInstance=new QueryCacheManager}return globalCacheInstance}export function resetGlobalQueryCache(){globalCacheInstance=null}export function configureGlobalQueryCache(maxCacheSize,maxCacheAge){if(maxCacheSize===void 0){maxCacheSize=100}if(maxCacheAge===void 0){maxCacheAge=5*60*1000}globalCacheInstance=new QueryCacheManager(maxCacheSize,maxCacheAge)}
3
+ //# sourceMappingURL=query-cache-singleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-cache-singleton.js","names":["createCacheKey","getInvalidationPattern","QueryCacheManager","maxCacheSize","maxCacheAge","cache","Map","_proto","prototype","getCachedQuery","componentId","interactionType","state","key","entry","get","now","Date","timestamp","setCachedQuery","set","_extends","size","cleanupCache","invalidateComponent","pattern","_iterator","_createForOfIteratorHelperLoose","keys","_step","done","value","test","invalidateAll","clear","isCached","_iterator2","entries","_step2","_step2$value","Array","from","sort","a","b","entriesToRemove","slice","_iterator3","_step3","_step3$value","getStats","maxAge","maxSize","globalCacheInstance","getGlobalQueryCache","resetGlobalQueryCache","configureGlobalQueryCache"],"sources":["../../../src/plugins/helpers/query-cache-singleton.ts"],"sourcesContent":["import {\n QueryCacheEntry,\n InteractionType,\n InteractionState,\n createCacheKey,\n getInvalidationPattern\n} from './query-cache-utils';\n\nclass QueryCacheManager {\n private cache: Map<string, QueryCacheEntry> = new Map();\n private maxCacheSize = 100;\n private maxCacheAge: number = 5 * 60 * 1000; // 5 minutes\n\n constructor(maxCacheSize = 100, maxCacheAge = 5 * 60 * 1000) {\n this.maxCacheSize = maxCacheSize;\n this.maxCacheAge = maxCacheAge;\n }\n\n getCachedQuery(\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState\n ): QueryCacheEntry | null {\n const key = createCacheKey(componentId, interactionType, state);\n const entry = this.cache.get(key);\n \n if (!entry) {\n return null;\n }\n \n const now = Date.now();\n\n if (now - entry.timestamp > this.maxCacheAge) {\n this.cache.delete(key);\n\n return null;\n }\n \n return entry;\n }\n\n setCachedQuery(\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState,\n entry: QueryCacheEntry\n ): void {\n const key = createCacheKey(componentId, interactionType, state);\n this.cache.set(key, {\n ...entry,\n timestamp: Date.now(),\n });\n \n if (this.cache.size > this.maxCacheSize) {\n this.cleanupCache();\n }\n }\n\n invalidateComponent(componentId: string): void {\n const pattern = getInvalidationPattern(componentId);\n \n for (const key of this.cache.keys()) {\n if (pattern.test(key)) {\n this.cache.delete(key);\n }\n }\n }\n\n invalidateAll(): void {\n this.cache.clear();\n }\n\n isCached(\n componentId: string,\n interactionType: InteractionType,\n state: InteractionState\n ): boolean {\n return this.getCachedQuery(componentId, interactionType, state) !== null;\n }\n\n private cleanupCache(): void {\n const now = Date.now();\n \n for (const [key, entry] of this.cache.entries()) {\n if (now - entry.timestamp > this.maxCacheAge) {\n this.cache.delete(key);\n }\n }\n \n if (this.cache.size > this.maxCacheSize) {\n const entries = Array.from(this.cache.entries());\n entries.sort((a, b) => a[1].timestamp - b[1].timestamp);\n \n const entriesToRemove = entries.slice(0, this.cache.size - this.maxCacheSize);\n\n for (const [key] of entriesToRemove) {\n this.cache.delete(key);\n }\n }\n }\n\n getStats(): { maxAge: number; maxSize: number; size: number } {\n return {\n maxAge: this.maxCacheAge,\n maxSize: this.maxCacheSize,\n size: this.cache.size,\n };\n }\n}\n\nlet globalCacheInstance: QueryCacheManager | null = null;\n\nexport function getGlobalQueryCache(): QueryCacheManager {\n if (!globalCacheInstance) {\n globalCacheInstance = new QueryCacheManager();\n }\n\n return globalCacheInstance;\n}\n\nexport function resetGlobalQueryCache(): void {\n globalCacheInstance = null;\n}\n\nexport function configureGlobalQueryCache(maxCacheSize = 100, maxCacheAge = 5 * 60 * 1000): void {\n globalCacheInstance = new QueryCacheManager(maxCacheSize, maxCacheAge);\n}\n\n"],"mappings":"89BAAA,OAIEA,cAAc,CACdC,sBAAsB,KACjB,qBAAqB,CAAC,GAEvB,CAAAC,iBAAiB,yBAGwB;AAE7C,SAAAA,kBAAYC,YAAY,CAAQC,WAAW,CAAkB,IAAjDD,YAAY,WAAZA,YAAY,CAAG,GAAG,IAAEC,WAAW,WAAXA,WAAW,CAAG,CAAC,CAAG,EAAE,CAAG,IAAI,MAJnDC,KAAK,CAAiC,GAAI,CAAAC,GAAK,MAC/CH,YAAY,CAAG,GAAG,MAClBC,WAAW,CAAW,CAAC,CAAG,EAAE,CAAG,IAAI,CAGzC,IAAI,CAACD,YAAY,CAAGA,YAAY,CAChC,IAAI,CAACC,WAAW,CAAGA,WACrB,CAAC,IAAAG,MAAA,CAAAL,iBAAA,CAAAM,SAAA,CAAAD,MAAA,CAEDE,cAAc,CAAd,SAAAA,cAAcA,CACZC,WAAmB,CACnBC,eAAgC,CAChCC,KAAuB,CACC,CACxB,GAAM,CAAAC,GAAG,CAAGb,cAAc,CAACU,WAAW,CAAEC,eAAe,CAAEC,KAAK,CAAC,CAC/D,GAAM,CAAAE,KAAK,CAAG,IAAI,CAACT,KAAK,CAACU,GAAG,CAACF,GAAG,CAAC,CAEjC,GAAI,CAACC,KAAK,CAAE,CACV,MAAO,KACT,CAEA,GAAM,CAAAE,GAAG,CAAGC,IAAI,CAACD,GAAG,CAAC,CAAC,CAEtB,GAAIA,GAAG,CAAGF,KAAK,CAACI,SAAS,CAAG,IAAI,CAACd,WAAW,CAAE,CAC5C,IAAI,CAACC,KAAK,UAAO,CAACQ,GAAG,CAAC,CAEtB,MAAO,KACT,CAEA,MAAO,CAAAC,KACT,CAAC,CAAAP,MAAA,CAEDY,cAAc,CAAd,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A,CAAsD,CAC5D,MAAO,CACLC,MAAM,CAAE,IAAI,CAAC/C,WAAW,CACxBgD,OAAO,CAAE,IAAI,CAACjD,YAAY,CAC1BmB,IAAI,CAAE,IAAI,CAACjB,KAAK,CAACiB,IACnB,CACF,CAAC,QAAApB,iBAAA,IAGH,GAAI,CAAAmD,mBAA6C,CAAG,IAAI,CAExD,MAAO,SAAS,CAAAC,mBAAmBA,CAAA,CAAsB,CACvD,GAAI,CAACD,mBAAmB,CAAE,CACxBA,mBAAmB,CAAG,GAAI,CAAAnD,iBAC5B,CAEA,MAAO,CAAAmD,mBACT,CAEA,MAAO,SAAS,CAAAE,qBAAqBA,CAAA,CAAS,CAC5CF,mBAAmB,CAAG,IACxB,CAEA,MAAO,SAAS,CAAAG,yBAAyBA,CAACrD,YAAY,CAAQC,WAAW,CAAwB,IAAvDD,YAAY,WAAZA,YAAY,CAAG,GAAG,IAAEC,WAAW,WAAXA,WAAW,CAAG,CAAC,CAAG,EAAE,CAAG,IAAI,CACvFiD,mBAAmB,CAAG,GAAI,CAAAnD,iBAAiB,CAACC,YAAY,CAAEC,WAAW,CACvE","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ export type InteractionType = 'semanticLayerQuery' | 'tableButton';
2
+ export type InteractionState = {
3
+ [key: string]: unknown;
4
+ bodyContent?: unknown;
5
+ chartData?: unknown;
6
+ chartDataFingerprint?: string;
7
+ chartDataLength?: number;
8
+ dataFingerprint?: string;
9
+ dataLength?: number;
10
+ error?: unknown;
11
+ filterValue?: unknown;
12
+ filters?: Record<string, unknown>;
13
+ footerContent?: unknown;
14
+ headerContent?: unknown;
15
+ isMissing?: unknown;
16
+ pageNumber?: number;
17
+ pageSize?: number;
18
+ searchQuery?: string;
19
+ searchValue?: string;
20
+ sortColumn?: string | null;
21
+ sortDirection?: 'asc' | 'desc' | null;
22
+ summaryText?: unknown;
23
+ };
24
+ export type QueryCacheEntry = {
25
+ queryHeadings: string[];
26
+ sqlQuery: string | string[];
27
+ tableButtonExplanations: Array<{
28
+ action: string;
29
+ buttonClassName?: string;
30
+ buttonStyle?: Record<string, unknown>;
31
+ explanation: string;
32
+ formFields?: Record<string, unknown>;
33
+ jsonBody?: unknown;
34
+ operationDescription?: string;
35
+ operationSummary?: string;
36
+ requestUrl?: string;
37
+ }>;
38
+ timestamp: number;
39
+ };
40
+ export type CacheKey = {
41
+ componentId: string;
42
+ interactionType: InteractionType;
43
+ state: InteractionState;
44
+ };
45
+ export declare function createCacheKey(componentId: string, interactionType: InteractionType, interactionState: InteractionState): string;
46
+ export declare function extractInteractionState(componentProps: Record<string, unknown>): InteractionState;
47
+ export declare function areStatesEqual(state1: InteractionState, state2: InteractionState): boolean;
48
+ export declare function getInvalidationPattern(componentId: string): RegExp;
@@ -0,0 +1,3 @@
1
+ function _createForOfIteratorHelperLoose(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}export function createCacheKey(componentId,interactionType,interactionState){var sortedState=sortObjectKeys(interactionState);var stateString=JSON.stringify(sortedState);return componentId+"::"+interactionType+"::"+stateString}function sortObjectKeys(obj){if(obj===null||obj===undefined){return obj}if(Array.isArray(obj)){return obj.map(function(item){return sortObjectKeys(item)})}if(typeof obj==="object"){var sorted={};var keys=Object.keys(obj).sort();for(var _iterator=_createForOfIteratorHelperLoose(keys),_step;!(_step=_iterator()).done;){var _key=_step.value;sorted[_key]=sortObjectKeys(obj[_key])}return sorted}return obj}export function extractInteractionState(componentProps){var state={};if("pagination"in componentProps&&typeof componentProps.pagination==="object"&&componentProps.pagination){var pagination=componentProps.pagination;if("pageNumber"in pagination&&typeof pagination.pageNumber==="number"){state.pageNumber=pagination.pageNumber}if("pageSize"in pagination&&typeof pagination.pageSize==="number"){state.pageSize=pagination.pageSize}}if("sortColumn"in componentProps){state.sortColumn=componentProps.sortColumn}if("sortDirection"in componentProps){state.sortDirection=componentProps.sortDirection}if("filters"in componentProps&&typeof componentProps.filters==="object"){state.filters=componentProps.filters}if("value"in componentProps){state.filterValue=componentProps.value}if("searchQuery"in componentProps&&typeof componentProps.searchQuery==="string"){state.searchQuery=componentProps.searchQuery}if("searchValue"in componentProps&&typeof componentProps.searchValue==="string"){state.searchValue=componentProps.searchValue}if("data"in componentProps){var data=componentProps.data;if(Array.isArray(data)&&data.length>0){state.dataLength=data.length;var firstRow=data[0];var lastRow=data[data.length-1];if(firstRow&&typeof firstRow==="object"){state.dataFingerprint=JSON.stringify({firstId:firstRow.id||Object.values(firstRow)[0],lastId:lastRow&&typeof lastRow==="object"?lastRow.id||Object.values(lastRow)[0]:null,length:data.length})}}else if(data&&typeof data==="object"&&data.name==="__peak_placeholder"){state.dataFingerprint="__peak_placeholder"}else{state.dataFingerprint="empty"}}if("bodyContent"in componentProps){state.bodyContent=componentProps.bodyContent}if("headerContent"in componentProps){state.headerContent=componentProps.headerContent}if("footerContent"in componentProps){state.footerContent=componentProps.footerContent}if("chartData"in componentProps){var chartData=componentProps.chartData;if(Array.isArray(chartData)){state.chartDataLength=chartData.length;state.chartDataFingerprint=JSON.stringify(chartData)}}if("summaryText"in componentProps){state.summaryText=componentProps.summaryText}if("error"in componentProps){state.error=componentProps.error}if("isMissing"in componentProps){state.isMissing=componentProps.isMissing}return state}export function areStatesEqual(state1,state2){return createCacheKey("test","semanticLayerQuery",state1)===createCacheKey("test","semanticLayerQuery",state2)}export function getInvalidationPattern(componentId){var escapedId=componentId.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");// eslint-disable-next-line security/detect-non-literal-regexp
2
+ return new RegExp("^"+escapedId+"::")}
3
+ //# sourceMappingURL=query-cache-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-cache-utils.js","names":["createCacheKey","componentId","interactionType","interactionState","sortedState","sortObjectKeys","stateString","JSON","stringify","obj","undefined","Array","isArray","map","item","sorted","keys","Object","sort","_iterator","_createForOfIteratorHelperLoose","_step","done","key","value","extractInteractionState","componentProps","state","pagination","pageNumber","pageSize","sortColumn","sortDirection","filters","filterValue","searchQuery","searchValue","data","length","dataLength","firstRow","lastRow","dataFingerprint","firstId","id","values","lastId","name","bodyContent","headerContent","footerContent","chartData","chartDataLength","chartDataFingerprint","summaryText","error","isMissing","areStatesEqual","state1","state2","getInvalidationPattern","escapedId","replace","RegExp"],"sources":["../../../src/plugins/helpers/query-cache-utils.ts"],"sourcesContent":["\nexport type InteractionType = 'semanticLayerQuery' | 'tableButton';\n\nexport type InteractionState = {\n [key: string]: unknown;\n bodyContent?: unknown;\n chartData?: unknown;\n chartDataFingerprint?: string;\n chartDataLength?: number;\n dataFingerprint?: string;\n dataLength?: number;\n error?: unknown;\n filterValue?: unknown;\n filters?: Record<string, unknown>;\n footerContent?: unknown;\n headerContent?: unknown;\n isMissing?: unknown;\n pageNumber?: number;\n pageSize?: number;\n searchQuery?: string;\n searchValue?: string;\n sortColumn?: string | null;\n sortDirection?: 'asc' | 'desc' | null;\n summaryText?: unknown;\n};\n\nexport type QueryCacheEntry = {\n queryHeadings: string[];\n sqlQuery: string | string[];\n tableButtonExplanations: Array<{\n action: string;\n buttonClassName?: string;\n buttonStyle?: Record<string, unknown>;\n explanation: string;\n formFields?: Record<string, unknown>;\n jsonBody?: unknown;\n operationDescription?: string;\n operationSummary?: string;\n requestUrl?: string;\n }>;\n timestamp: number;\n};\n\nexport type CacheKey = {\n componentId: string;\n interactionType: InteractionType;\n state: InteractionState;\n};\n\nexport function createCacheKey(\n componentId: string,\n interactionType: InteractionType,\n interactionState: InteractionState\n): string {\n const sortedState = sortObjectKeys(interactionState);\n \n const stateString = JSON.stringify(sortedState);\n \n return `${componentId}::${interactionType}::${stateString}`;\n}\n\nfunction sortObjectKeys(obj: unknown): unknown {\n if (obj === null || obj === undefined) {\n return obj;\n }\n \n if (Array.isArray(obj)) {\n return obj.map(item => sortObjectKeys(item));\n }\n \n if (typeof obj === 'object') {\n const sorted: Record<string, unknown> = {};\n const keys = Object.keys(obj as Record<string, unknown>).sort();\n \n for (const key of keys) {\n sorted[key] = sortObjectKeys((obj as Record<string, unknown>)[key]);\n }\n \n return sorted;\n }\n \n return obj;\n}\n\nexport function extractInteractionState(componentProps: Record<string, unknown>): InteractionState {\n const state: InteractionState = {};\n \n if ('pagination' in componentProps && typeof componentProps.pagination === 'object' && componentProps.pagination) {\n const pagination = componentProps.pagination as Record<string, unknown>;\n\n if ('pageNumber' in pagination && typeof pagination.pageNumber === 'number') {\n state.pageNumber = pagination.pageNumber;\n }\n\n if ('pageSize' in pagination && typeof pagination.pageSize === 'number') {\n state.pageSize = pagination.pageSize;\n }\n }\n \n if ('sortColumn' in componentProps) {\n state.sortColumn = componentProps.sortColumn as string | null;\n }\n \n if ('sortDirection' in componentProps) {\n state.sortDirection = componentProps.sortDirection as 'asc' | 'desc' | null;\n }\n \n if ('filters' in componentProps && typeof componentProps.filters === 'object') {\n state.filters = componentProps.filters as Record<string, unknown>;\n }\n \n if ('value' in componentProps) {\n state.filterValue = componentProps.value as unknown;\n }\n \n if ('searchQuery' in componentProps && typeof componentProps.searchQuery === 'string') {\n state.searchQuery = componentProps.searchQuery;\n }\n \n if ('searchValue' in componentProps && typeof componentProps.searchValue === 'string') {\n state.searchValue = componentProps.searchValue;\n }\n\n if ('data' in componentProps) {\n const data = componentProps.data;\n \n if (Array.isArray(data) && data.length > 0) {\n state.dataLength = data.length;\n const firstRow = data[0];\n const lastRow = data[data.length - 1];\n \n if (firstRow && typeof firstRow === 'object') {\n state.dataFingerprint = JSON.stringify({\n firstId: (firstRow as Record<string, unknown>).id || Object.values(firstRow)[0],\n lastId: lastRow && typeof lastRow === 'object' \n ? ((lastRow as Record<string, unknown>).id || Object.values(lastRow)[0])\n : null,\n length: data.length\n });\n }\n } else if (data && typeof data === 'object' && (data as Record<string, unknown>).name === '__peak_placeholder') {\n state.dataFingerprint = '__peak_placeholder';\n } else {\n state.dataFingerprint = 'empty';\n }\n }\n \n if ('bodyContent' in componentProps) {\n state.bodyContent = componentProps.bodyContent as unknown;\n }\n \n if ('headerContent' in componentProps) {\n state.headerContent = componentProps.headerContent as unknown;\n }\n \n if ('footerContent' in componentProps) {\n state.footerContent = componentProps.footerContent as unknown;\n }\n \n if ('chartData' in componentProps) {\n const chartData = componentProps.chartData;\n\n if (Array.isArray(chartData)) {\n state.chartDataLength = chartData.length;\n state.chartDataFingerprint = JSON.stringify(chartData);\n }\n }\n \n if ('summaryText' in componentProps) {\n state.summaryText = componentProps.summaryText as unknown;\n }\n \n if ('error' in componentProps) {\n state.error = componentProps.error as unknown;\n }\n \n if ('isMissing' in componentProps) {\n state.isMissing = componentProps.isMissing as unknown;\n }\n \n return state;\n}\n\nexport function areStatesEqual(state1: InteractionState, state2: InteractionState): boolean {\n return createCacheKey('test', 'semanticLayerQuery', state1) === \n createCacheKey('test', 'semanticLayerQuery', state2);\n}\n\nexport function getInvalidationPattern(componentId: string): RegExp {\n const escapedId = componentId.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n // eslint-disable-next-line security/detect-non-literal-regexp\n return new RegExp(`^${escapedId}::`);\n}\n\n"],"mappings":"y6BAiDA,MAAO,SAAS,CAAAA,cAAcA,CAC5BC,WAAmB,CACnBC,eAAgC,CAChCC,g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SAAS,CAE1C,GAAIxC,KAAK,CAACC,OAAO,CAACuC,SAAS,CAAC,CAAE,CAC5BxB,KAAK,CAACyB,eAAe,CAAGD,SAAS,CAACb,MAAM,CACxCX,KAAK,CAAC0B,oBAAoB,CAAG9C,IAAI,CAACC,SAAS,CAAC2C,SAAS,CACvD,CACF,CAEA,GAAI,aAAa,EAAI,CAAAzB,cAAc,CAAE,CACnCC,KAAK,CAAC2B,WAAW,CAAG5B,cAAc,CAAC4B,WACrC,CAEA,GAAI,OAAO,EAAI,CAAA5B,cAAc,CAAE,CAC7BC,KAAK,CAAC4B,KAAK,CAAG7B,cAAc,CAAC6B,KAC/B,CAEA,GAAI,WAAW,EAAI,CAAA7B,cAAc,CAAE,CACjCC,KAAK,CAAC6B,SAAS,CAAG9B,cAAc,CAAC8B,SACnC,CAEA,MAAO,CAAA7B,KACT,CAEA,MAAO,SAAS,CAAA8B,cAAcA,CAACC,MAAwB,CAAEC,MAAwB,CAAW,CAC1F,MAAO,CAAA3D,cAAc,CAAC,MAAM,CAAE,oBAAoB,CAAE0D,MAAM,CAAC,GACpD1D,cAAc,CAAC,MAAM,CAAE,oBAAoB,CAAE2D,MAAM,CAC5D,CAEA,MAAO,SAAS,CAAAC,sBAAsBA,CAAC3D,WAAmB,CAAU,CAClE,GAAM,CAAA4D,SAAS,CAAG5D,WAAW,CAAC6D,OAAO,CAAC,qBAAqB,CAAE,MAAM,CAAC,CAEpE;AACA,MAAO,IAAI,CAAAC,MAAM,KAAKF,SAAS,KAAI,CACrC","ignoreList":[]}
@@ -4,14 +4,19 @@ type QueryDetailsModalProps = {
4
4
  isLoading: boolean;
5
5
  error: string;
6
6
  sqlQuery: string | string[];
7
+ queryHeadings?: string[];
7
8
  tableButtonExplanations?: Array<{
8
9
  action: string;
9
10
  explanation: string;
10
- operationName?: string;
11
+ operationSummary?: string;
12
+ operationDescription?: string;
11
13
  buttonClassName?: string;
12
14
  buttonStyle?: Record<string, unknown>;
15
+ formFields?: Record<string, unknown>;
16
+ jsonBody?: unknown;
17
+ requestUrl?: string;
13
18
  }>;
14
19
  onRetry: () => void;
15
20
  };
16
- export declare function QueryDetailsModal({ isOpen, onClose, isLoading, error, sqlQuery, tableButtonExplanations, onRetry }: QueryDetailsModalProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function QueryDetailsModal({ isOpen, onClose, isLoading, error, sqlQuery, queryHeadings, tableButtonExplanations, onRetry }: QueryDetailsModalProps): import("react/jsx-runtime").JSX.Element;
17
22
  export default QueryDetailsModal;
@@ -1,4 +1,4 @@
1
- import _extends from"@babel/runtime/helpers/extends";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import React,{useState,useEffect}from"react";import{CustomModal}from"./custom-modal";import{Copy,Check,ChevronDown}from"lucide-react";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export function QueryDetailsModal(_ref){var isOpen=_ref.isOpen,onClose=_ref.onClose,isLoading=_ref.isLoading,error=_ref.error,sqlQuery=_ref.sqlQuery,_ref$tableButtonExpla=_ref.tableButtonExplanations,tableButtonExplanations=_ref$tableButtonExpla===void 0?[]:_ref$tableButtonExpla,onRetry=_ref.onRetry;var _useState=useState({}),copied=_useState[0],setCopied=_useState[1];var _useState2=useState({}),expandedButtons=_useState2[0],setExpandedButtons=_useState2[1];// Reset expanded state when modal closes
2
- useEffect(function(){if(!isOpen){setExpandedButtons({})}},[isOpen]);function copyToClipboard(_x,_x2){return _copyToClipboard.apply(this,arguments)}function _copyToClipboard(){_copyToClipboard=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(queryToCopy,copyId){var textToCopy,id;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:textToCopy=queryToCopy;if(!textToCopy){if(Array.isArray(sqlQuery)){textToCopy=sqlQuery.filter(function(q){return q&&typeof q==="string"}).join("\n\n-- Next Query --\n\n")}else if(typeof sqlQuery==="string"){textToCopy=sqlQuery}else{textToCopy=""}}if(textToCopy){_context.next=4;break}return _context.abrupt("return");case 4:id=copyId||"main";_context.prev=5;_context.next=8;return navigator.clipboard.writeText(textToCopy);case 8:setCopied(function(prev){var _extends3;return _extends({},prev,(_extends3={},_extends3[id]=true,_extends3))});setTimeout(function(){return setCopied(function(prev){var _extends4;return _extends({},prev,(_extends4={},_extends4[id]=false,_extends4))})},2000);_context.next=14;break;case 12:_context.prev=12;_context.t0=_context["catch"](5);case 14:case"end":return _context.stop()}},_callee,null,[[5,12]])}));return _copyToClipboard.apply(this,arguments)}function toggleButtonExpansion(buttonIndex){setExpandedButtons(function(prev){var _extends2;return _extends({},prev,(_extends2={},_extends2[buttonIndex]=!prev[buttonIndex],_extends2))})}function renderTableButtonExplanations(){if(!tableButtonExplanations||tableButtonExplanations.length===0){return null}return/*#__PURE__*/_jsx("div",{className:"mb-6",children:tableButtonExplanations.map(function(button,index){var _button$buttonStyle,_button$buttonStyle2,_button$buttonStyle3;return/*#__PURE__*/_jsxs("div",{className:"mb-3 border border-gray-200 rounded-lg",children:[/*#__PURE__*/_jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between rounded-lg",children:[/*#__PURE__*/_jsx("span",{className:"font-medium text-xs text-gray-500",children:"What does this button do?"}),/*#__PURE__*/_jsxs("div",{className:"flex items-center",children:[/*#__PURE__*/_jsx("button",{onClick:function onClick(){return toggleButtonExpansion(index)},className:button.buttonClassName||"flex items-center px-3 py-1.5 rounded text-xs font-medium",style:_extends({backgroundColor:((_button$buttonStyle=button.buttonStyle)==null?void 0:_button$buttonStyle.backgroundColor)||"#f3f4f6",color:((_button$buttonStyle2=button.buttonStyle)==null?void 0:_button$buttonStyle2.color)||"#374151",border:((_button$buttonStyle3=button.buttonStyle)==null?void 0:_button$buttonStyle3.border)||"1px solid #d1d5db"},button.buttonStyle||{}),children:button.action}),/*#__PURE__*/_jsx(ChevronDown,{className:"ml-2 w-4 h-4 text-gray-500 transition-transform cursor-pointer "+(expandedButtons[index]?"rotate-180":""),onClick:function onClick(){return toggleButtonExpansion(index)}})]})]}),expandedButtons[index]&&/*#__PURE__*/_jsx("div",{className:"px-4 pb-3 border-t border-gray-200",children:/*#__PURE__*/_jsxs("p",{className:"text-xs text-gray-700 mt-2",children:["This button will make a request to ",/*#__PURE__*/_jsx("span",{className:"font-semibold",children:button.explanation})]})})]},index)})})}function renderModalContent(){if(isLoading){return/*#__PURE__*/_jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[/*#__PURE__*/_jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mb-4"}),/*#__PURE__*/_jsx("span",{className:"text-xs text-gray-600",children:"Fetching query details from semantic layer..."}),/*#__PURE__*/_jsx("span",{className:"text-xs text-gray-400 mt-2",children:"This may take a few moments"})]})}if(error){return/*#__PURE__*/_jsxs("div",{className:"text-red-600 p-4 bg-red-50 rounded-lg border border-red-200 m-6",children:[/*#__PURE__*/_jsx("p",{className:"font-medium mb-2 text-xs",children:"Unable to fetch query details"}),/*#__PURE__*/_jsx("p",{className:"text-xs mb-3",children:error}),/*#__PURE__*/_jsx("button",{onClick:onRetry,className:"px-4 py-2 bg-red-100 hover:bg-red-200 rounded text-xs font-medium transition-colors",type:"button",children:"Retry"})]})}if(!sqlQuery||Array.isArray(sqlQuery)&&sqlQuery.length===0){return/*#__PURE__*/_jsx("div",{className:"text-gray-600 p-6",children:/*#__PURE__*/_jsx("p",{className:"text-xs",children:"No query details available"})})}// Handle multiple queries
3
- if(Array.isArray(sqlQuery)){return/*#__PURE__*/_jsxs("div",{className:"p-6 space-y-4",children:[sqlQuery.filter(function(query){return query&&typeof query==="string"&&query.trim()}).map(function(query,index){return/*#__PURE__*/_jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4",children:[/*#__PURE__*/_jsxs("div",{className:"flex justify-between items-start mb-3",children:[/*#__PURE__*/_jsx("h3",{className:"font-semibold text-xs text-gray-500 m-0",children:"Query details"}),/*#__PURE__*/_jsx("button",{onClick:function onClick(){return copyToClipboard(query,"query-"+index)},className:"flex items-center gap-2 px-2 py-1 text-xs bg-gray-50 border border-gray-300 rounded hover:bg-gray-100 transition-colors",type:"button",children:copied["query-"+index]?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Check,{className:"w-3 h-3 text-green-600"}),/*#__PURE__*/_jsx("span",{className:"text-green-600",children:"Copied!"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Copy,{className:"w-3 h-3 text-gray-600"}),/*#__PURE__*/_jsx("span",{className:"text-gray-600",children:"Copy"})]})})]}),/*#__PURE__*/_jsx("pre",{className:"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0",children:query})]},index)}),renderTableButtonExplanations()]})}return/*#__PURE__*/_jsxs("div",{className:"p-6 space-y-4",children:[/*#__PURE__*/_jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4",children:[/*#__PURE__*/_jsxs("div",{className:"flex justify-between items-start mb-3",children:[/*#__PURE__*/_jsx("h3",{className:"font-semibold text-xs text-gray-500 m-0",children:"Query details"}),/*#__PURE__*/_jsx("button",{onClick:function onClick(){return copyToClipboard(undefined,"single")},className:"flex items-center gap-2 px-2 py-1 text-xs bg-gray-50 border border-gray-300 rounded hover:bg-gray-100 transition-colors",type:"button",children:copied.single?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Check,{className:"w-3 h-3 text-green-600"}),/*#__PURE__*/_jsx("span",{className:"text-green-600",children:"Copied!"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Copy,{className:"w-3 h-3 text-gray-600"}),/*#__PURE__*/_jsx("span",{className:"text-gray-600",children:"Copy"})]})})]}),/*#__PURE__*/_jsx("pre",{className:"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0",children:sqlQuery})]}),renderTableButtonExplanations()]})}return/*#__PURE__*/_jsx(CustomModal,{isOpen:isOpen,onClose:onClose,title:"How was this metric calculated?",children:renderModalContent()})}export default QueryDetailsModal;
1
+ import _extends from"@babel/runtime/helpers/extends";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import React,{useState,useEffect}from"react";import{CustomModal}from"./custom-modal";import{Copy,Check,ChevronDown}from"lucide-react";import{formatQueryHeading}from"./query-heading-formatter";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";function CopyButton(_ref){var onClick=_ref.onClick,isCopied=_ref.isCopied,_ref$variant=_ref.variant,variant=_ref$variant===void 0?"default":_ref$variant;var baseClasses="flex items-center gap-1 px-2 py-1 text-xs border rounded transition-colors";var variantClasses=variant==="light"?"bg-gray-50 border-gray-300 hover:bg-gray-100":"bg-gray-100 border-gray-300 hover:bg-gray-200";return/*#__PURE__*/_jsx("button",{onClick:onClick,className:baseClasses+" "+variantClasses,type:"button",children:isCopied?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Check,{className:"w-3 h-3 text-green-600"}),/*#__PURE__*/_jsx("span",{className:"text-green-600",children:"Copied!"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Copy,{className:"w-3 h-3 text-gray-600"}),/*#__PURE__*/_jsx("span",{className:"text-gray-600",children:"Copy"})]})})}function ContentText(_ref2){var children=_ref2.children,_ref2$hasOverflowHand=_ref2.hasOverflowHandling,hasOverflowHandling=_ref2$hasOverflowHand===void 0?true:_ref2$hasOverflowHand;var overflowClasses=hasOverflowHandling?"overflow-hidden break-words":"";return/*#__PURE__*/_jsx("pre",{className:"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0 "+overflowClasses,children:children})}function ContentBlock(_ref3){var title=_ref3.title,children=_ref3.children,copyContent=_ref3.copyContent,copyId=_ref3.copyId,copied=_ref3.copied,onCopy=_ref3.onCopy,_ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?"bordered":_ref3$variant,_ref3$copyButtonVaria=_ref3.copyButtonVariant,copyButtonVariant=_ref3$copyButtonVaria===void 0?"default":_ref3$copyButtonVaria;var containerClasses=variant==="bordered"?"rounded-lg p-3":"bg-white border border-gray-200 rounded-lg p-4";var containerStyle=variant==="bordered"?{border:"1px solid #E9EAF5"}:{};var titleClasses=variant==="bordered"?"text-sm font-medium text-gray-600":"font-semibold text-sm text-gray-500 m-0";return/*#__PURE__*/_jsxs("div",{className:containerClasses,style:containerStyle,children:[/*#__PURE__*/_jsxs("div",{className:"flex justify-between items-start mb-2",children:[/*#__PURE__*/_jsx("span",{className:titleClasses,children:title}),copyContent&&/*#__PURE__*/_jsx(CopyButton,{onClick:function onClick(){return onCopy(copyContent,copyId)},isCopied:copied[copyId]||false,variant:copyButtonVariant})]}),children]})}export function QueryDetailsModal(_ref4){var isOpen=_ref4.isOpen,onClose=_ref4.onClose,isLoading=_ref4.isLoading,error=_ref4.error,sqlQuery=_ref4.sqlQuery,_ref4$queryHeadings=_ref4.queryHeadings,queryHeadings=_ref4$queryHeadings===void 0?[]:_ref4$queryHeadings,_ref4$tableButtonExpl=_ref4.tableButtonExplanations,tableButtonExplanations=_ref4$tableButtonExpl===void 0?[]:_ref4$tableButtonExpl,onRetry=_ref4.onRetry;var _useState=useState({}),copied=_useState[0],setCopied=_useState[1];var _useState2=useState({}),expandedButtons=_useState2[0],setExpandedButtons=_useState2[1];// Reset expanded state when modal closes
2
+ useEffect(function(){if(!isOpen){setExpandedButtons({})}},[isOpen]);function copyToClipboard(_x,_x2){return _copyToClipboard.apply(this,arguments)}function _copyToClipboard(){_copyToClipboard=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(queryToCopy,copyId){var textToCopy,id;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:textToCopy=queryToCopy;if(!textToCopy){if(Array.isArray(sqlQuery)){textToCopy=sqlQuery.filter(function(q){return q&&typeof q==="string"}).join("\n\n-- Next Query --\n\n")}else if(typeof sqlQuery==="string"){textToCopy=sqlQuery}else{textToCopy=""}}if(textToCopy){_context.next=4;break}return _context.abrupt("return");case 4:id=copyId||"main";_context.prev=5;_context.next=8;return navigator.clipboard.writeText(textToCopy);case 8:setCopied(function(prev){var _extends3;return _extends({},prev,(_extends3={},_extends3[id]=true,_extends3))});setTimeout(function(){return setCopied(function(prev){var _extends4;return _extends({},prev,(_extends4={},_extends4[id]=false,_extends4))})},2000);_context.next=14;break;case 12:_context.prev=12;_context.t0=_context["catch"](5);case 14:case"end":return _context.stop()}},_callee,null,[[5,12]])}));return _copyToClipboard.apply(this,arguments)}function toggleButtonExpansion(buttonIndex){setExpandedButtons(function(prev){var _extends2;return _extends({},prev,(_extends2={},_extends2[buttonIndex]=!prev[buttonIndex],_extends2))})}function renderTableButtonExplanations(){if(!tableButtonExplanations||tableButtonExplanations.length===0){return null}function hasValidJsonBody(jsonBody){return jsonBody!==null&&jsonBody!==undefined&&jsonBody!==""}function hasValidFormFields(formFields){return formFields!==null&&formFields!==undefined&&Object.keys(formFields||{}).length>0}return/*#__PURE__*/_jsx("div",{className:"mb-6",children:tableButtonExplanations.map(function(button,index){var _button$buttonStyle,_button$buttonStyle2,_button$buttonStyle3;return/*#__PURE__*/_jsxs("div",{className:"mb-3 border border-gray-200 rounded-lg",children:[/*#__PURE__*/_jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between rounded-lg",children:[/*#__PURE__*/_jsxs("div",{className:"flex items-center",children:[/*#__PURE__*/_jsx("button",{onClick:function onClick(){return toggleButtonExpansion(index)},className:button.buttonClassName||"flex items-center justify-center px-3 rounded text-xs font-medium",style:_extends({height:"35px",width:"fit-content",minWidth:"fit-content",backgroundColor:(_button$buttonStyle=button.buttonStyle)==null?void 0:_button$buttonStyle.backgroundColor,color:(_button$buttonStyle2=button.buttonStyle)==null?void 0:_button$buttonStyle2.color,border:(_button$buttonStyle3=button.buttonStyle)==null?void 0:_button$buttonStyle3.border},button.buttonStyle||{},button.buttonStyle||{},{display:"flex",alignItems:"center",justifyContent:"center"}),children:button.action}),/*#__PURE__*/_jsx("div",{className:"ml-3 flex flex-col",children:button.operationSummary&&/*#__PURE__*/_jsx("span",{className:"text-xs text-gray-700 font-medium",children:button.operationSummary})})]}),/*#__PURE__*/_jsx(ChevronDown,{className:"w-4 h-4 text-gray-500 transition-transform cursor-pointer "+(expandedButtons[index]?"rotate-180":""),onClick:function onClick(){return toggleButtonExpansion(index)}})]}),expandedButtons[index]&&/*#__PURE__*/_jsx("div",{className:"px-4 pb-3 border-t border-gray-200",children:/*#__PURE__*/_jsxs("div",{className:"mt-2 space-y-3",children:[button.operationDescription&&/*#__PURE__*/_jsx(ContentBlock,{title:"Description",copyId:"description-"+index,copied:copied,onCopy:copyToClipboard,variant:"bordered",children:/*#__PURE__*/_jsx(ContentText,{children:button.operationDescription})}),(button.requestUrl||button.explanation)&&/*#__PURE__*/_jsx(ContentBlock,{title:"URL",copyContent:button.requestUrl||button.explanation,copyId:"url-"+index,copied:copied,onCopy:copyToClipboard,variant:"bordered",children:/*#__PURE__*/_jsx(ContentText,{children:button.requestUrl||button.explanation})}),(hasValidJsonBody(button.jsonBody)||hasValidFormFields(button.formFields))&&/*#__PURE__*/_jsx(ContentBlock,{title:"Payload",copyContent:JSON.stringify(hasValidJsonBody(button.jsonBody)?button.jsonBody:button.formFields,null,2),copyId:"payload-"+index,copied:copied,onCopy:copyToClipboard,variant:"bordered",children:/*#__PURE__*/_jsx(ContentText,{children:hasValidJsonBody(button.jsonBody)?JSON.stringify(button.jsonBody,null,2):JSON.stringify(button.formFields,null,2)})})]})})]},index)})})}function renderModalContent(){if(isLoading){return/*#__PURE__*/_jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[/*#__PURE__*/_jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mb-4"}),/*#__PURE__*/_jsx("span",{className:"text-xs text-gray-600",children:"Fetching query details from semantic layer..."}),/*#__PURE__*/_jsx("span",{className:"text-xs text-gray-400 mt-2",children:"This may take a few moments"})]})}if(error){return/*#__PURE__*/_jsxs("div",{className:"text-red-600 p-4 bg-red-50 rounded-lg border border-red-200 m-6",children:[/*#__PURE__*/_jsx("p",{className:"font-medium mb-2 text-xs",children:"Unable to fetch query details"}),/*#__PURE__*/_jsx("p",{className:"text-xs mb-3",children:error}),/*#__PURE__*/_jsx("button",{onClick:onRetry,className:"px-4 py-2 bg-red-100 hover:bg-red-200 rounded text-xs font-medium transition-colors",type:"button",children:"Retry"})]})}if(!sqlQuery||Array.isArray(sqlQuery)&&sqlQuery.length===0){return/*#__PURE__*/_jsx("div",{className:"text-gray-600 p-6",children:/*#__PURE__*/_jsx("p",{className:"text-xs",children:"No query details available"})})}// Handle multiple queries
3
+ if(Array.isArray(sqlQuery)){return/*#__PURE__*/_jsxs("div",{className:"p-6 space-y-4",children:[sqlQuery.filter(function(query){return query&&typeof query==="string"&&query.trim()}).map(function(query,index){var rawHeading=queryHeadings[index]||"Query "+(index+1);var heading=formatQueryHeading(rawHeading);return/*#__PURE__*/_jsx(ContentBlock,{title:heading,copyContent:query,copyId:"query-"+index,copied:copied,onCopy:copyToClipboard,variant:"default",copyButtonVariant:"light",children:/*#__PURE__*/_jsx(ContentText,{hasOverflowHandling:false,children:query})},index)}),renderTableButtonExplanations()]})}return/*#__PURE__*/_jsxs("div",{className:"p-6 space-y-4",children:[/*#__PURE__*/_jsx(ContentBlock,{title:formatQueryHeading(queryHeadings[0]||"Query details"),copyContent:typeof sqlQuery==="string"?sqlQuery:"",copyId:"single",copied:copied,onCopy:copyToClipboard,variant:"default",copyButtonVariant:"light",children:/*#__PURE__*/_jsx(ContentText,{hasOverflowHandling:false,children:sqlQuery})}),renderTableButtonExplanations()]})}return/*#__PURE__*/_jsx(CustomModal,{isOpen:isOpen,onClose:onClose,title:"How was this metric calculated?",children:renderModalContent()})}export default QueryDetailsModal;
4
4
  //# sourceMappingURL=query-details-modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-details-modal.js","names":["React","useState","useEffect","CustomModal","Copy","Check","ChevronDown","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","QueryDetailsModal","_ref","isOpen","onClose","isLoading","error","sqlQuery","_ref$tableButtonExpla","tableButtonExplanations","onRetry","_useState","copied","setCopied","_useState2","expandedButtons","setExpandedButtons","copyToClipboard","_x","_x2","_copyToClipboard","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","queryToCopy","copyId","textToCopy","id","wrap","_callee$","_context","prev","next","Array","isArray","filter","q","join","abrupt","navigator","clipboard","writeText","_extends3","_extends","setTimeout","_extends4","t0","stop","toggleButtonExpansion","buttonIndex","_extends2","renderTableButtonExplanations","length","className","children","map","button","index","_button$buttonStyle","_button$buttonStyle2","_button$buttonStyle3","onClick","buttonClassName","style","backgroundColor","buttonStyle","color","border","action","explanation","renderModalContent","type","query","trim","undefined","single","title"],"sources":["../../../src/plugins/helpers/query-details-modal.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { CustomModal } from './custom-modal';\nimport { Copy, Check, ChevronDown } from 'lucide-react';\n\ntype QueryDetailsModalProps = {\n isOpen: boolean;\n onClose: () => void;\n isLoading: boolean;\n error: string;\n sqlQuery: string | string[];\n tableButtonExplanations?: Array<{action: string, explanation: string, operationName?: string, buttonClassName?: string, buttonStyle?: Record<string, unknown>}>;\n onRetry: () => void;\n};\n\nexport function QueryDetailsModal({\n isOpen,\n onClose,\n isLoading,\n error,\n sqlQuery,\n tableButtonExplanations = [],\n onRetry\n}: QueryDetailsModalProps) {\n const [copied, setCopied] = useState<{ [key: string]: boolean }>({});\n const [expandedButtons, setExpandedButtons] = useState<{ [key: string]: boolean }>({});\n\n // Reset expanded state when modal closes\n useEffect(() => {\n if (!isOpen) {\n setExpandedButtons({});\n }\n }, [isOpen]);\n\n async function copyToClipboard(queryToCopy?: string, copyId?: string) {\n let textToCopy = queryToCopy;\n \n if (!textToCopy) {\n if (Array.isArray(sqlQuery)) {\n textToCopy = sqlQuery.filter(q => q && typeof q === 'string').join('\\n\\n-- Next Query --\\n\\n');\n } else if (typeof sqlQuery === 'string') {\n textToCopy = sqlQuery;\n } else {\n textToCopy = '';\n }\n }\n \n if (!textToCopy) {\n return;\n }\n \n const id = copyId || 'main';\n \n try {\n await navigator.clipboard.writeText(textToCopy);\n setCopied(prev => ({ ...prev, [id]: true }));\n setTimeout(() => setCopied(prev => ({ ...prev, [id]: false })), 2000);\n } catch (err) {\n // Silently fail if clipboard API is not available\n }\n }\n\n function toggleButtonExpansion(buttonIndex: number) {\n setExpandedButtons(prev => ({\n ...prev,\n [buttonIndex]: !prev[buttonIndex]\n }));\n }\n\n function renderTableButtonExplanations() {\n if (!tableButtonExplanations || tableButtonExplanations.length === 0) {\n return null;\n }\n\n return (\n <div className=\"mb-6\">\n {tableButtonExplanations.map((button, index) => (\n <div key={index} className=\"mb-3 border border-gray-200 rounded-lg\">\n <div className=\"w-full px-4 py-3 flex items-center justify-between rounded-lg\">\n <span className=\"font-medium text-xs text-gray-500\">\n What does this button do?\n </span>\n <div className=\"flex items-center\">\n <button\n onClick={() => toggleButtonExpansion(index)}\n className={button.buttonClassName || \"flex items-center px-3 py-1.5 rounded text-xs font-medium\"}\n style={{\n backgroundColor: (button.buttonStyle?.backgroundColor as string) || '#f3f4f6',\n color: (button.buttonStyle?.color as string) || '#374151',\n border: (button.buttonStyle?.border as string) || '1px solid #d1d5db',\n ...(button.buttonStyle as React.CSSProperties || {})\n }}\n >\n {button.action}\n </button>\n <ChevronDown \n className={`ml-2 w-4 h-4 text-gray-500 transition-transform cursor-pointer ${\n expandedButtons[index] ? 'rotate-180' : ''\n }`}\n onClick={() => toggleButtonExpansion(index)}\n />\n </div>\n </div>\n \n {expandedButtons[index] && (\n <div className=\"px-4 pb-3 border-t border-gray-200\">\n <p className=\"text-xs text-gray-700 mt-2\">\n This button will make a request to <span className=\"font-semibold\">{button.explanation}</span> \n </p>\n </div>\n )}\n </div>\n ))}\n </div>\n );\n }\n\n function renderModalContent() {\n if (isLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mb-4\"></div>\n <span className=\"text-xs text-gray-600\">Fetching query details from semantic layer...</span>\n <span className=\"text-xs text-gray-400 mt-2\">This may take a few moments</span>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-red-600 p-4 bg-red-50 rounded-lg border border-red-200 m-6\">\n <p className=\"font-medium mb-2 text-xs\">Unable to fetch query details</p>\n <p className=\"text-xs mb-3\">{error}</p>\n <button \n onClick={onRetry}\n className=\"px-4 py-2 bg-red-100 hover:bg-red-200 rounded text-xs font-medium transition-colors\"\n type=\"button\"\n >\n Retry\n </button>\n </div>\n );\n }\n\n if (!sqlQuery || (Array.isArray(sqlQuery) && sqlQuery.length === 0)) {\n return (\n <div className=\"text-gray-600 p-6\">\n <p className=\"text-xs\">No query details available</p>\n </div>\n );\n }\n\n // Handle multiple queries\n if (Array.isArray(sqlQuery)) {\n return (\n <div className=\"p-6 space-y-4\">\n {sqlQuery\n .filter(query => query && typeof query === 'string' && query.trim())\n .map((query, index) => (\n <div \n key={index} \n className=\"bg-white border border-gray-200 rounded-lg p-4\"\n >\n <div className=\"flex justify-between items-start mb-3\">\n <h3 className=\"font-semibold text-xs text-gray-500 m-0\">\n Query details\n </h3>\n <button\n onClick={() => copyToClipboard(query, `query-${index}`)}\n className=\"flex items-center gap-2 px-2 py-1 text-xs bg-gray-50 border border-gray-300 rounded hover:bg-gray-100 transition-colors\"\n type=\"button\"\n >\n {copied[`query-${index}`] ? (\n <>\n <Check className=\"w-3 h-3 text-green-600\" />\n <span className=\"text-green-600\">Copied!</span>\n </>\n ) : (\n <>\n <Copy className=\"w-3 h-3 text-gray-600\" />\n <span className=\"text-gray-600\">Copy</span>\n </>\n )}\n </button>\n </div>\n <pre className=\"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0\">\n {query}\n </pre>\n </div>\n ))}\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <div className=\"p-6 space-y-4\">\n <div className=\"bg-white border border-gray-200 rounded-lg p-4\">\n <div className=\"flex justify-between items-start mb-3\">\n <h3 className=\"font-semibold text-xs text-gray-500 m-0\">\n Query details\n </h3>\n <button\n onClick={() => copyToClipboard(undefined, 'single')}\n className=\"flex items-center gap-2 px-2 py-1 text-xs bg-gray-50 border border-gray-300 rounded hover:bg-gray-100 transition-colors\"\n type=\"button\"\n >\n {copied.single ? (\n <>\n <Check className=\"w-3 h-3 text-green-600\" />\n <span className=\"text-green-600\">Copied!</span>\n </>\n ) : (\n <>\n <Copy className=\"w-3 h-3 text-gray-600\" />\n <span className=\"text-gray-600\">Copy</span>\n </>\n )}\n </button>\n </div>\n <pre className=\"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0\">\n {sqlQuery}\n </pre>\n </div>\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <CustomModal\n isOpen={isOpen}\n onClose={onClose}\n title=\"How was this metric calculated?\"\n >\n {renderModalContent()}\n </CustomModal>\n );\n}\n\nexport default QueryDetailsModal;\n"],"mappings":"wLAAA,MAAO,CAAAA,KAAK,EAAIC,QAAQ,CAAEC,SAAS,KAAQ,OAAO,CAClD,OAASC,WAAW,KAAQ,gBAAgB,CAC5C,OAASC,IAAI,CAAEC,KAAK,CAAEC,WAAW,KAAQ,cAAc,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,CAAAC,QAAA,IAAAC,SAAA,yBAYxD,MAAO,SAAS,CAAAC,iBAAiBA,CAAAC,IAAA,CAQN,IAPzB,CAAAC,MAAM,CAAAD,IAAA,CAANC,MAAM,CACNC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CACPC,SAAS,CAAAH,IAAA,CAATG,SAAS,CACTC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CACLC,QAAQ,CAAAL,IAAA,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AAW,EACVY,MAAM,CAAEA,MAAO,CACfC,OAAO,CAAEA,OAAQ,CACjB2E,KAAK,CAAC,iCAAiC,CAAAtB,QAAA,CAEtCgB,kBAAkB,CAAC,CAAC,CACV,CAEjB,CAEA,cAAe,CAAAxE,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"query-details-modal.js","names":["React","useState","useEffect","CustomModal","Copy","Check","ChevronDown","formatQueryHeading","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CopyButton","_ref","onClick","isCopied","_ref$variant","variant","baseClasses","variantClasses","className","type","children","ContentText","_ref2","_ref2$hasOverflowHand","hasOverflowHandling","overflowClasses","ContentBlock","_ref3","title","copyContent","copyId","copied","onCopy","_ref3$variant","_ref3$copyButtonVaria","copyButtonVariant","containerClasses","containerStyle","border","titleClasses","style","QueryDetailsModal","_ref4","isOpen","onClose","isLoading","error","sqlQuery","_ref4$queryHeadings","queryHeadings","_ref4$tableButtonExpl","tableButtonExplanations","onRetry","_useState","setCopied","_useState2","expandedButtons","setExpandedButtons","copyToClipboard","_x","_x2","_copyToClipboard","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","queryToCopy","textToCopy","id","wrap","_callee$","_context","prev","next","Array","isArray","filter","q","join","abrupt","navigator","clipboard","writeText","_extends3","_extends","setTimeout","_extends4","t0","stop","toggleButtonExpansion","buttonIndex","_extends2","renderTableButtonExplanations","length","hasValidJsonBody","jsonBody","undefined","hasValidFormFields","formFields","Object","keys","map","button","index","_button$buttonStyle","_button$buttonStyle2","_button$buttonStyle3","buttonClassName","height","width","minWidth","backgroundColor","buttonStyle","color","display","alignItems","justifyContent","action","operationSummary","operationDescription","requestUrl","explanation","JSON","stringify","renderModalContent","query","trim","rawHeading","heading"],"sources":["../../../src/plugins/helpers/query-details-modal.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { CustomModal } from './custom-modal';\nimport { Copy, Check, ChevronDown, X } from 'lucide-react';\nimport { formatQueryHeading } from './query-heading-formatter';\n\ntype CopyButtonProps = {\n onClick: () => void;\n isCopied: boolean;\n variant?: 'default' | 'light';\n};\n\nfunction CopyButton({ onClick, isCopied, variant = 'default' }: CopyButtonProps) {\n const baseClasses = \"flex items-center gap-1 px-2 py-1 text-xs border rounded transition-colors\";\n const variantClasses = variant === 'light' \n ? \"bg-gray-50 border-gray-300 hover:bg-gray-100\"\n : \"bg-gray-100 border-gray-300 hover:bg-gray-200\";\n\n return (\n <button\n onClick={onClick}\n className={`${baseClasses} ${variantClasses}`}\n type=\"button\"\n >\n {isCopied ? (\n <>\n <Check className=\"w-3 h-3 text-green-600\" />\n <span className=\"text-green-600\">Copied!</span>\n </>\n ) : (\n <>\n <Copy className=\"w-3 h-3 text-gray-600\" />\n <span className=\"text-gray-600\">Copy</span>\n </>\n )}\n </button>\n );\n}\n\ntype ContentTextProps = {\n children: React.ReactNode;\n hasOverflowHandling?: boolean;\n};\n\nfunction ContentText({ children, hasOverflowHandling = true }: ContentTextProps) {\n const overflowClasses = hasOverflowHandling ? \"overflow-hidden break-words\" : \"\";\n\n return (\n <pre className={`whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0 ${overflowClasses}`}>\n {children}\n </pre>\n );\n}\n\ntype ContentBlockProps = {\n title: string;\n children: React.ReactNode;\n copyContent?: string;\n copyId: string;\n copied: Record<string, boolean>;\n onCopy: (content: string, id: string) => void;\n variant?: 'default' | 'bordered';\n copyButtonVariant?: 'default' | 'light';\n};\n\nfunction ContentBlock({ \n title, \n children, \n copyContent, \n copyId, \n copied, \n onCopy,\n variant = 'bordered',\n copyButtonVariant = 'default'\n}: ContentBlockProps) {\n const containerClasses = variant === 'bordered' \n ? \"rounded-lg p-3\"\n : \"bg-white border border-gray-200 rounded-lg p-4\";\n \n const containerStyle = variant === 'bordered' \n ? { border: '1px solid #E9EAF5' }\n : {};\n\n const titleClasses = variant === 'bordered'\n ? \"text-sm font-medium text-gray-600\"\n : \"font-semibold text-sm text-gray-500 m-0\";\n\n return (\n <div className={containerClasses} style={containerStyle}>\n <div className=\"flex justify-between items-start mb-2\">\n <span className={titleClasses}>{title}</span>\n {copyContent && (\n <CopyButton\n onClick={() => onCopy(copyContent, copyId)}\n isCopied={copied[copyId] || false}\n variant={copyButtonVariant}\n />\n )}\n </div>\n {children}\n </div>\n );\n}\n\ntype QueryDetailsModalProps = {\n isOpen: boolean;\n onClose: () => void;\n isLoading: boolean;\n error: string;\n sqlQuery: string | string[];\n queryHeadings?: string[];\n tableButtonExplanations?: Array<{\n action: string, \n explanation: string, \n operationSummary?: string,\n operationDescription?: string,\n buttonClassName?: string, \n buttonStyle?: Record<string, unknown>,\n formFields?: Record<string, unknown>;\n jsonBody?: unknown;\n requestUrl?: string;\n }>;\n onRetry: () => void;\n};\n\nexport function QueryDetailsModal({\n isOpen,\n onClose,\n isLoading,\n error,\n sqlQuery,\n queryHeadings = [],\n tableButtonExplanations = [],\n onRetry\n}: QueryDetailsModalProps) {\n const [copied, setCopied] = useState<{ [key: string]: boolean }>({});\n const [expandedButtons, setExpandedButtons] = useState<{ [key: string]: boolean }>({});\n\n // Reset expanded state when modal closes\n useEffect(() => {\n if (!isOpen) {\n setExpandedButtons({});\n }\n }, [isOpen]);\n\n async function copyToClipboard(queryToCopy?: string, copyId?: string) {\n let textToCopy = queryToCopy;\n \n if (!textToCopy) {\n if (Array.isArray(sqlQuery)) {\n textToCopy = sqlQuery.filter(q => q && typeof q === 'string').join('\\n\\n-- Next Query --\\n\\n');\n } else if (typeof sqlQuery === 'string') {\n textToCopy = sqlQuery;\n } else {\n textToCopy = '';\n }\n }\n \n if (!textToCopy) {\n return;\n }\n \n const id = copyId || 'main';\n \n try {\n await navigator.clipboard.writeText(textToCopy);\n setCopied(prev => ({ ...prev, [id]: true }));\n setTimeout(() => setCopied(prev => ({ ...prev, [id]: false })), 2000);\n } catch (err) {\n // Silently fail if clipboard API is not available\n }\n }\n\n function toggleButtonExpansion(buttonIndex: number) {\n setExpandedButtons(prev => ({\n ...prev,\n [buttonIndex]: !prev[buttonIndex]\n }));\n }\n\n function renderTableButtonExplanations() {\n if (!tableButtonExplanations || tableButtonExplanations.length === 0) {\n return null;\n }\n\n function hasValidJsonBody(jsonBody: unknown): boolean {\n return jsonBody !== null && jsonBody !== undefined && jsonBody !== '';\n }\n\n function hasValidFormFields(formFields: Record<string, unknown> | undefined): boolean {\n return formFields !== null && formFields !== undefined && Object.keys(formFields || {}).length > 0;\n }\n\n return (\n <div className=\"mb-6\">\n {tableButtonExplanations.map((button, index) => (\n <div key={index} className=\"mb-3 border border-gray-200 rounded-lg\">\n <div className=\"w-full px-4 py-3 flex items-center justify-between rounded-lg\">\n <div className=\"flex items-center\">\n <button\n onClick={() => toggleButtonExpansion(index)}\n className={button.buttonClassName || \"flex items-center justify-center px-3 rounded text-xs font-medium\"}\n style={{\n height: '35px',\n width: 'fit-content',\n minWidth: 'fit-content',\n backgroundColor: (button.buttonStyle?.backgroundColor as string),\n color: (button.buttonStyle?.color as string),\n border: (button.buttonStyle?.border as string),\n ...(button.buttonStyle as React.CSSProperties || {})\n , ...button.buttonStyle as React.CSSProperties || {},\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n {button.action}\n </button>\n <div className=\"ml-3 flex flex-col\">\n {button.operationSummary && (\n <span className=\"text-xs text-gray-700 font-medium\">\n {button.operationSummary}\n </span>\n )}\n </div>\n </div>\n <ChevronDown \n className={`w-4 h-4 text-gray-500 transition-transform cursor-pointer ${\n expandedButtons[index] ? 'rotate-180' : ''\n }`}\n onClick={() => toggleButtonExpansion(index)}\n />\n </div>\n \n {expandedButtons[index] && (\n <div className=\"px-4 pb-3 border-t border-gray-200\">\n <div className=\"mt-2 space-y-3\">\n {/* Description Block */}\n {button.operationDescription && (\n <ContentBlock\n title=\"Description\"\n copyId={`description-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"bordered\"\n >\n <ContentText>\n {button.operationDescription}\n </ContentText>\n </ContentBlock>\n )}\n\n {(button.requestUrl || button.explanation) && (\n <ContentBlock\n title=\"URL\"\n copyContent={button.requestUrl || button.explanation}\n copyId={`url-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"bordered\"\n >\n <ContentText>\n {button.requestUrl || button.explanation}\n </ContentText>\n </ContentBlock>\n )}\n \n {(hasValidJsonBody(button.jsonBody) || hasValidFormFields(button.formFields)) && (\n <ContentBlock\n title=\"Payload\"\n copyContent={JSON.stringify(\n hasValidJsonBody(button.jsonBody) ? button.jsonBody : button.formFields, \n null, \n 2\n )}\n copyId={`payload-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"bordered\"\n >\n <ContentText>\n {hasValidJsonBody(button.jsonBody) \n ? JSON.stringify(button.jsonBody, null, 2)\n : JSON.stringify(button.formFields, null, 2)}\n </ContentText>\n </ContentBlock>\n )}\n </div>\n </div>\n )}\n </div>\n ))}\n </div>\n );\n }\n\n function renderModalContent() {\n if (isLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mb-4\"></div>\n <span className=\"text-xs text-gray-600\">Fetching query details from semantic layer...</span>\n <span className=\"text-xs text-gray-400 mt-2\">This may take a few moments</span>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-red-600 p-4 bg-red-50 rounded-lg border border-red-200 m-6\">\n <p className=\"font-medium mb-2 text-xs\">Unable to fetch query details</p>\n <p className=\"text-xs mb-3\">{error}</p>\n <button \n onClick={onRetry}\n className=\"px-4 py-2 bg-red-100 hover:bg-red-200 rounded text-xs font-medium transition-colors\"\n type=\"button\"\n >\n Retry\n </button>\n </div>\n );\n }\n\n if (!sqlQuery || (Array.isArray(sqlQuery) && sqlQuery.length === 0)) {\n return (\n <div className=\"text-gray-600 p-6\">\n <p className=\"text-xs\">No query details available</p>\n </div>\n );\n }\n\n // Handle multiple queries\n if (Array.isArray(sqlQuery)) {\n return (\n <div className=\"p-6 space-y-4\">\n {sqlQuery\n .filter(query => query && typeof query === 'string' && query.trim())\n .map((query, index) => {\n\n const rawHeading = queryHeadings[index] || `Query ${index + 1}`;\n const heading = formatQueryHeading(rawHeading);\n\n return (\n <ContentBlock\n key={index}\n title={heading}\n copyContent={query}\n copyId={`query-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"default\"\n copyButtonVariant=\"light\"\n >\n <ContentText hasOverflowHandling={false}>\n {query}\n </ContentText>\n </ContentBlock>\n );\n })}\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <div className=\"p-6 space-y-4\">\n <ContentBlock\n title={formatQueryHeading(queryHeadings[0] || \"Query details\")}\n copyContent={typeof sqlQuery === 'string' ? sqlQuery : ''}\n copyId=\"single\"\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"default\"\n copyButtonVariant=\"light\"\n >\n <ContentText hasOverflowHandling={false}>\n {sqlQuery}\n </ContentText>\n </ContentBlock>\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <CustomModal\n isOpen={isOpen}\n onClose={onClose}\n title=\"How was this metric calculated?\"\n >\n {renderModalContent()}\n </CustomModal>\n );\n}\n\nexport default QueryDetailsModal;\n"],"mappings":"wLAAA,MAAO,CAAAA,KAAK,EAAIC,QAAQ,CAAEC,SAAS,KAAQ,OAAO,CAClD,OAASC,WAAW,KAAQ,gBAAgB,CAC5C,OAASC,IAAI,CAAEC,KAAK,CAAEC,WAAW,KAAW,cAAc,CAC1D,OAASC,kBAAkB,KAAQ,2BAA2B,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,QAAA,IAAAC,SAAA,CAAAC,IAAA,IAAAC,KAAA,yBAQ/D,QAAS,CAAAC,UAAUA,CAAAC,IAAA,CAA8D,IAA3D,CAAAC,OAAO,CAAAD,IAAA,CAAPC,OAAO,CAAEC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CAAAC,YAAA,CAAAH,IAAA,CAAEI,OAAO,CAAPA,OAAO,CAAAD,YAAA,UAAG,S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,OAAO,CAAEA,OAAQ,CACjBhB,KAAK,CAAC,iCAAiC,CAAAR,QAAA,CAEtC0G,kBAAkB,CAAC,CAAC,CACV,CAEjB,CAEA,cAAe,CAAArF,iBAAiB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare function formatQueryHeading(heading: string): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utility function to format query headings for display
3
+ * Converts technical query keys into presentable headings
4
+ */export function formatQueryHeading(heading){if(!heading){return"Query details"}var formatted=heading.replace(/_[a-z-]+-[a-z0-9]+$/i,"");formatted=formatted.replace(/_/g," ");formatted=formatted.replace(/([a-z])([A-Z])/g,"$1 $2");var componentRegex=/\b(table|chart|card|button|text|image|list|modal|dropdown|tabs|header|footer|nav|menu|pagination|search|filter|sort|pagination)\b/gi;formatted=formatted.replace(componentRegex,"").trim();formatted=formatted.replace(/\b\w/g,function(l){return l.toUpperCase()});formatted=formatted.replace(/\s+/g," ").trim();return formatted||"Query details"}
5
+ //# sourceMappingURL=query-heading-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-heading-formatter.js","names":["formatQueryHeading","heading","formatted","replace","componentRegex","trim","l","toUpperCase"],"sources":["../../../src/plugins/helpers/query-heading-formatter.ts"],"sourcesContent":["/**\n * Utility function to format query headings for display\n * Converts technical query keys into presentable headings\n */\nexport function formatQueryHeading(heading: string): string {\n if (!heading) {\n return 'Query details';\n }\n\n let formatted = heading.replace(/_[a-z-]+-[a-z0-9]+$/i, '');\n \n formatted = formatted.replace(/_/g, ' ');\n \n formatted = formatted.replace(/([a-z])([A-Z])/g, '$1 $2');\n\n const componentRegex = /\\b(table|chart|card|button|text|image|list|modal|dropdown|tabs|header|footer|nav|menu|pagination|search|filter|sort|pagination)\\b/gi;\n formatted = formatted.replace(componentRegex, '').trim();\n \n formatted = formatted.replace(/\\b\\w/g, l => l.toUpperCase());\n \n formatted = formatted.replace(/\\s+/g, ' ').trim();\n \n return formatted || 'Query details';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,GACA,MAAO,SAAS,CAAAA,kBAAkBA,CAACC,OAAe,CAAU,CAC1D,GAAI,CAACA,OAAO,CAAE,CACZ,MAAO,eACT,CAEA,GAAI,CAAAC,SAAS,CAAGD,OAAO,CAACE,OAAO,CAAC,sBAAsB,CAAE,EAAE,CAAC,CAE3DD,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,IAAI,CAAE,GAAG,CAAC,CAExCD,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,iBAAiB,CAAE,OAAO,CAAC,CAEzD,GAAM,CAAAC,cAAc,CAAG,qIAAqI,CAC5JF,SAAS,CAAGA,SAAS,CAACC,OAAO,CAACC,cAAc,CAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC,CAExDH,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,OAAO,CAAE,SAAAG,CAAC,QAAI,CAAAA,CAAC,CAACC,WAAW,CAAC,CAAC,EAAC,CAE5DL,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,MAAM,CAAE,GAAG,CAAC,CAACE,IAAI,CAAC,CAAC,CAEjD,MAAO,CAAAH,SAAS,EAAI,eACtB","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  type QueryLoadingModalProps = {
2
2
  isOpen: boolean;
3
+ onClose: () => void;
3
4
  };
4
- export declare function QueryLoadingModal({ isOpen }: QueryLoadingModalProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function QueryLoadingModal({ isOpen, onClose }: QueryLoadingModalProps): import("react/jsx-runtime").JSX.Element | null;
5
6
  export {};