@chaibuilder/pages 0.14.1 → 0.14.3

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 (64) hide show
  1. package/dist/{2AITGKQY-PHs1xUsz.cjs → 2AITGKQY-DWDDkd18.cjs} +1 -1
  2. package/dist/{2AITGKQY-Cti4x7QE.js → 2AITGKQY-DtQPkxBe.js} +2 -2
  3. package/dist/{NCMVHL6D-BChQ0wDN.cjs → NCMVHL6D-6CkVnw0a.cjs} +1 -1
  4. package/dist/{NCMVHL6D-fAWarBw8.js → NCMVHL6D-CksZXXOw.js} +2 -2
  5. package/dist/{ZDWCUMSJ-DRWuu_nE.js → ZDWCUMSJ-BXQ01VPt.js} +1 -1
  6. package/dist/{ZDWCUMSJ-CwWfQqyn.cjs → ZDWCUMSJ-DoM-AA0C.cjs} +1 -1
  7. package/dist/{add-new-language-page-Dt9DWunK.cjs → add-new-language-page-BA73lQnm.cjs} +1 -1
  8. package/dist/{add-new-language-page-CcBqDtYv.js → add-new-language-page-D8iXtyLA.js} +2 -2
  9. package/dist/{add-new-page-CTUiEKzv.js → add-new-page-DESlqvED.js} +1 -1
  10. package/dist/{add-new-page-BN3z9rSq.cjs → add-new-page-EOMgMSeq.cjs} +1 -1
  11. package/dist/{delete-page-8MnGZ_mz.js → delete-page-BP1Df8QL.js} +1 -1
  12. package/dist/{delete-page-jELwTpGY.cjs → delete-page-ZvnuEow6.cjs} +1 -1
  13. package/dist/{digital-asset-manager-BJhwyEdT.js → digital-asset-manager-Bb81T3mS.js} +1 -1
  14. package/dist/{digital-asset-manager-ZyQJP6AO.cjs → digital-asset-manager-BxWb1j_y.cjs} +1 -1
  15. package/dist/{duplicate-page-BGYZLkco.js → duplicate-page-B1j0H7gP.js} +2 -2
  16. package/dist/{duplicate-page-BRjKFpBP.cjs → duplicate-page-W5xbmPSC.cjs} +1 -1
  17. package/dist/{dynamic-page-selector-CR-ZpSJ8.cjs → dynamic-page-selector-BZKJmSx5.cjs} +1 -1
  18. package/dist/{dynamic-page-selector-CrbujoYg.js → dynamic-page-selector-Crjyco6l.js} +1 -1
  19. package/dist/{index-Byi6-4u1.js → index-DFvsMFVH.js} +600 -604
  20. package/dist/index-Qnh8Lkr0.cjs +5 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/{json-diff-viewer-De2bStRw.js → json-diff-viewer-BGGSLqtx.js} +1 -1
  24. package/dist/{json-diff-viewer-DKlC7yl6.cjs → json-diff-viewer-DRkE-x_z.cjs} +1 -1
  25. package/dist/{lang-panel-B3bC1gKq.cjs → lang-panel-9T8dIx2p.cjs} +1 -1
  26. package/dist/{lang-panel-G7RoMOP7.js → lang-panel-B3tr2uhr.js} +2 -2
  27. package/dist/{mark-as-template-OgR8I38n.cjs → mark-as-template-DPVPRgbi.cjs} +1 -1
  28. package/dist/{mark-as-template-B1TpGPms.js → mark-as-template-L9cHzL84.js} +1 -1
  29. package/dist/{no-language-page-content-iZo2ztXp.cjs → no-language-page-content-Cy_D-3jE.cjs} +1 -1
  30. package/dist/{no-language-page-content-CqH4FMNy.js → no-language-page-content-DP7gmy0s.js} +1 -1
  31. package/dist/{page-creator-Chnj3W4j.js → page-creator-Ctn5ixJE.js} +2 -2
  32. package/dist/{page-creator-DUXzx-zg.cjs → page-creator-DDaI1HYj.cjs} +1 -1
  33. package/dist/{page-lock-request-D3gmV8Yq.cjs → page-lock-request-BKrxnEtQ.cjs} +1 -1
  34. package/dist/{page-lock-request-Dc-JkLEZ.js → page-lock-request-CjJFJKL2.js} +1 -1
  35. package/dist/{page-locked-by-dialog-DC8UKy9e.js → page-locked-by-dialog-DmsSmAY2.js} +1 -1
  36. package/dist/{page-locked-by-dialog-B9pGi6zb.cjs → page-locked-by-dialog-b25_rn2m.cjs} +1 -1
  37. package/dist/{page-manager-new-CFtYUNbS.cjs → page-manager-new-DiZVY7Me.cjs} +1 -1
  38. package/dist/{page-manager-new-DYYWpxWy.js → page-manager-new-EsIg6iQn.js} +3 -3
  39. package/dist/{page-manager-search-and-filter-B4xo9IJO.js → page-manager-search-and-filter-Bt4T_dnB.js} +2 -2
  40. package/dist/{page-manager-search-and-filter-DT9V9AoS.cjs → page-manager-search-and-filter-CgY2qiXU.cjs} +1 -1
  41. package/dist/{page-revisions-content-KJGhm9Pl.js → page-revisions-content-CsT6aF2I.js} +2 -2
  42. package/dist/{page-revisions-content-BjIECUPY.cjs → page-revisions-content-DtI8CmtR.cjs} +1 -1
  43. package/dist/{publish-pages-content-CTduLNtg.cjs → publish-pages-content-DpC7RcTw.cjs} +1 -1
  44. package/dist/{publish-pages-content-BWLQZGjd.js → publish-pages-content-KAuhOPv0.js} +2 -2
  45. package/dist/{save-to-lib-CsrSeusU.cjs → save-to-lib-BGpWGHJo.cjs} +1 -1
  46. package/dist/{save-to-lib-B07GbG4I.js → save-to-lib-CeWaSQdB.js} +1 -1
  47. package/dist/{seo-panel-B20DCgo0.js → seo-panel-Dhhpe_7z.js} +1 -1
  48. package/dist/{seo-panel-QphuqXT2.cjs → seo-panel-JDQ_7bOx.cjs} +1 -1
  49. package/dist/{shared-json-ld-C_vIO-Qk.cjs → shared-json-ld-BYbdMttx.cjs} +1 -1
  50. package/dist/{shared-json-ld-CkOQRUEw.js → shared-json-ld-BliIbNv9.js} +1 -1
  51. package/dist/{slug-input-71BuN79c.cjs → slug-input-QxBMijHP.cjs} +1 -1
  52. package/dist/{slug-input-rAe3mMkd.js → slug-input-hJdU8DaF.js} +1 -1
  53. package/dist/{theme-panel-footer-DHRs6ag2.cjs → theme-panel-footer-BZnPvTkM.cjs} +1 -1
  54. package/dist/{theme-panel-footer-DFUfCqKP.js → theme-panel-footer-D2B7iYW2.js} +1 -1
  55. package/dist/{unmark-as-template-Cx0CqrpM.cjs → unmark-as-template-Byn2RRAp.cjs} +1 -1
  56. package/dist/{unmark-as-template-_VyWoVNk.js → unmark-as-template-Dcpkj7EZ.js} +1 -1
  57. package/dist/{unpublish-page-D3NM8b3u.cjs → unpublish-page-5Fi1wKXb.cjs} +1 -1
  58. package/dist/{unpublish-page-CuSJRr5c.js → unpublish-page-CPLlsfm4.js} +1 -1
  59. package/dist/{use-page-expand-manager-_msrWd0a.js → use-page-expand-manager-DkyBiNpx.js} +1 -1
  60. package/dist/{use-page-expand-manager-MjYZ3CDZ.cjs → use-page-expand-manager-To-SsGy3.cjs} +1 -1
  61. package/dist/{web-preview-CI3Vz7Yp.cjs → web-preview-CVvxe5Ll.cjs} +1 -1
  62. package/dist/{web-preview-BL-vsgoa.js → web-preview-YuuoRaZn.js} +1 -1
  63. package/package.json +3 -3
  64. package/dist/index-DSUpSpeI.cjs +0 -5
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-DSUpSpeI.cjs"),P=require("@chaibuilder/sdk"),d=require("lodash-es"),v=require("react"),a=require("@chaibuilder/sdk/ui"),L=require("sonner"),ce=require("@tanstack/react-query"),K=require("lucide-react"),M=require("./get-seo-defaults-Cw7vFt-B.cjs"),de=()=>{const{selectedLang:t}=P.useLanguages(),{data:x,isFetching:u}=i.useLanguagePages();return{data:v.useMemo(()=>d.find(x,{lang:t||""})||{},[x,t]),isFetching:u}},ue=()=>{var p;const x=(p=document.getElementById("canvas-iframe").contentDocument)==null?void 0:p.body.innerHTML;if(!x)return null;const c=new DOMParser().parseFromString(x,"text/html");c.querySelectorAll("style, script, link, svg, [data-block-type='PartialBlock']").forEach(g=>g.remove()),c.querySelectorAll("*").forEach(g=>{Array.from(g.attributes).forEach(m=>g.removeAttribute(m.name))});const r=c.querySelectorAll("h1, h2, h3, h4, h5, h6, p");return Array.from(r).map(g=>`<${g.tagName.toLowerCase()}>${g.innerHTML}</${g.tagName.toLowerCase()}>`).join(" ").replace(/<p>Partial block. Double click to edit.<\/p>/,"")},F=({keyword:t,onComplete:x,field:u})=>{const c=i.useFetch(),r=i.useApiUrl(),{selectedLang:N,fallbackLang:p}=P.useLanguages(),{mutate:g,isPending:m}=ce.useMutation({mutationFn:async()=>{const D=ue();return await c(r,{action:i.ACTIONS.GENERATE_SEO_FIELD,data:{pageContext:"",dynamic:!1,field:u,lang:N||p,pageContent:D,keyword:t}})},onSuccess:D=>{x({fieldValue:D.field})},onError:D=>{x({fieldValue:null,error:D.message})}});return e.jsx(a.Button,{disabled:m,type:"button",className:"h-5 w-5",variant:"ghost",size:"sm",onClick:()=>g(),children:m?e.jsx(K.Loader,{className:"h-3 w-3 animate-spin text-yellow-500"}):e.jsx(K.Wand2Icon,{className:"text-yellow-500"})})},ge=({isOpen:t,onClose:x,onSave:u,onDiscard:c,isSaving:r=!1,fromLanguage:N,toLanguage:p})=>{const g=i.LANGUAGES[N]||N,m=i.LANGUAGES[p]||p;return e.jsx(a.Dialog,{open:t,onOpenChange:x,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Unsaved SEO Changes"}),e.jsxs(a.DialogDescription,{children:['You have unsaved changes in the SEO for "',g,'" version. Do you want to save these changes before switching to "',m,'" version?']})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(a.Button,{variant:"outline",onClick:c,disabled:r,children:"Discard Changes"}),e.jsx(a.Button,{onClick:u,disabled:r,children:r?"Saving...":"Save & Switch"})]})]})})},me=t=>{if(!t)return!0;try{return JSON.parse(t),!0}catch{return!1}},he=(t,x)=>{const u=t.selectionStart||0,c=t.selectionEnd||0,r=t.value,N=r.substring(0,u),p=r.substring(c),g=`{{${x}}}`,m=N+""+g+p,D=u+0+g.length;return{value:m,newCursorPos:D}},Q=()=>{const{t}=P.useTranslation(),[,x]=P.useSidebarActivePanel(),{data:u}=i.useCurrentPage(),{data:c}=i.useBuilderPageData(),{data:r,isFetching:N}=de(),p=r==null?void 0:r.seo,g=v.useRef(null),[m,D]=v.useState("seo"),R=u==null?void 0:u.id,W=u==null?void 0:u.pageType,I=i.usePageType(W),{selectedLang:$,fallbackLang:X}=P.useLanguages(),h=$||X,[H,J]=v.useState(!1),[Z,_]=v.useState(!1),[ee,V]=v.useState(!1),[S,U]=v.useState(null),[n,w]=v.useState({keyword:"",title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",ogImageId:"",searchTitle:"",searchDescription:"",jsonLD:"{}",metaOther:"{}",...p}),E=v.useRef({}),{mutate:se,isPending:q}=i.useUpdatePage(),f=q||H||Z,{hasPermission:te}=P.usePermissions(),o=te(i.PAGES_PERMISSIONS.EDIT_SEO),[ae]=i.usePagesProps(),ne=d.get(ae,"features.canResetSeoToDefault",!1),z=!$||n.jsonLD!=="{}";v.useEffect(()=>{if(!N&&p&&R){const s={keyword:"",title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",ogImageId:"",searchTitle:"",searchDescription:"",jsonLD:"",metaOther:"",...p};w(s),E.current[h]=s}},[N,p,h,R]),v.useEffect(()=>{const s=l=>{const{fromLang:b,toLang:A,switchHandler:y}=l.detail,G=E.current[h];(G?!d.isEqual(G,n):!1)?(U({fromLang:b,toLang:A,switchHandler:y}),V(!0)):y()};return window.addEventListener("seo-language-switch-check",s),()=>{window.removeEventListener("seo-language-switch-check",s)}},[R,n,h]);const oe=async()=>{if(!(!I||!h))try{J(!0);const s=M.getSeoDefaults(I,h),l={...n,keyword:d.get(s,"seo.keyword",""),title:d.get(s,"seo.title",""),description:d.get(s,"seo.description",""),cononicalUrl:d.get(s,"seo.canonicalUrl",""),noIndex:d.get(s,"seo.noIndex",!1),noFollow:d.get(s,"seo.noFollow",!1),ogTitle:d.get(s,"seo.ogTitle",""),ogDescription:d.get(s,"seo.ogDescription","")};w(l),L.toast.success(t("SEO fields reset to defaults"))}catch(s){L.toast.error(t("Failed to reset SEO fields")),console.error("Reset SEO error:",s)}finally{J(!1)}},le=async()=>{if(!(!I||!h))try{_(!0);const s=M.getSeoDefaults(I,h),l={...n,jsonLD:d.get(s,"seo.jsonLD","")};w(l),L.toast.success(t("JSON-LD reset to default"))}catch(s){L.toast.error(t("Failed to reset JSON-LD")),console.error("Reset JSON-LD error:",s)}finally{_(!1)}},re=async()=>{if(!(!I||!h))try{J(!0);const s=M.getSeoDefaults(I,h),l={...n,ogTitle:d.get(s,"seo.ogTitle",""),ogDescription:d.get(s,"seo.ogDescription",""),ogImage:d.get(s,"seo.ogImage",""),ogImageId:d.get(s,"seo.ogImageId",""),metaOther:d.get(s,"seo.metaOther","{}")};w(l),L.toast.success(t("Meta Tag fields reset to defaults"))}catch(s){L.toast.error(t("Failed to reset Meta Tag fields")),console.error("Reset Meta Tag error:",s)}finally{J(!1)}},Y=async()=>{se({id:r==null?void 0:r.id,seo:n,primaryPage:R},{onSuccess:()=>{console.log("SEO & JSON-LD updated successfully",n),E.current[h]=n,L.toast.success("SEO & JSON-LD updated successfully")}})},O=(s,l)=>{const b=document.getElementById(l);if(b){const{value:A,newCursorPos:y}=he(b,s);g.current={id:l,position:y},b.tagName.toLowerCase()==="input"?(b.value=A,w(C=>({...C,[b.name]:A})),b.focus(),b.setSelectionRange(y,y),[0,10,50,100,200].forEach(C=>{setTimeout(()=>{const B=document.getElementById(l);B&&(B.focus(),B.setSelectionRange(y,y))},C)})):(w(T=>({...T,[b.name]:A})),requestAnimationFrame(()=>{const T=document.getElementById(l);T&&(T.focus(),T.setSelectionRange(y,y),setTimeout(()=>{const C=document.getElementById(l);C&&(C.focus(),C.setSelectionRange(y,y))},50))}))}},j=s=>{const l={...n,[s.target.name]:s.target.name==="noIndex"||s.target.name==="noFollow"?s.target.checked:s.target.value};w(l)},k=s=>l=>{d.isEmpty(l.fieldValue)||j({target:{name:s,value:typeof l.fieldValue=="string"?l.fieldValue.replace(/^"(.*)"$/,"$1"):l.fieldValue}}),l.error&&L.toast.error(e.jsxs("div",{children:[e.jsx("h2",{children:"Failed to generate:"}),e.jsx("p",{children:l.error})]}))},ie=()=>{const s=d.get(u,"seo.jsonLD","{}");if((s==null?void 0:s.trim())==="{}"){L.toast.error("Default page JSON-LD is empty");return}j({target:{name:"jsonLD",value:s}})};return e.jsxs("div",{className:"relative flex h-full flex-col","data-panel-id":"seo",children:[!o&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",children:e.jsx(a.Alert,{variant:"default",className:"w-[80%] max-w-md text-xs",children:e.jsx(a.AlertDescription,{children:t("You don't have permission to edit SEO settings. Contact your administrator for access.")})})}),e.jsxs("div",{className:"no-scrollbar flex-grow overflow-y-auto px-2 pb-20",children:[e.jsxs("div",{className:"mb-4 flex w-full items-center justify-between rounded-md bg-gray-100 px-2 py-1 text-left text-sm",children:[e.jsxs("span",{children:[e.jsx("div",{className:"font-medium",children:r==null?void 0:r.name}),e.jsx("span",{className:"font-mono text-xs leading-tight text-gray-500",children:r==null?void 0:r.slug})]}),e.jsx(i.LanguageSwitcher,{variant:"outline",showAdd:!1})]}),e.jsx("form",{className:"space-y-8",children:e.jsxs(a.Tabs,{value:m,onValueChange:D,className:"w-full",children:[e.jsxs(a.TabsList,{className:"mb-4 grid w-full grid-cols-3",children:[e.jsx(a.TabsTrigger,{value:"seo",children:t("SEO")}),e.jsx(a.TabsTrigger,{value:"opengraph",children:t("Meta Tags")}),e.jsx(a.TabsTrigger,{value:"jsonld",children:t("JSON-LD")})]}),e.jsx("div",{className:m==="seo"?"":"sr-only",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"keyword",children:t("Keyword")}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"keyword")})]}),e.jsx(a.Input,{type:"text",id:"keyword",name:"keyword",value:n.keyword,onChange:j,disabled:f||!o,placeholder:t("Enter keyword"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"title",children:t("SEO Title")}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("title"),field:"title"}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"title")})]})]}),e.jsx(a.Input,{type:"text",id:"title",name:"title",value:n.title,onChange:j,disabled:f||!o,placeholder:t("Enter SEO title"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"description",children:t("SEO Description")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("description"),field:"description"}),o&&e.jsx(i.NestedPathSelector,{data:c??{},onSelect:s=>O(s,"description")})]})]}),e.jsx(a.Textarea,{id:"description",name:"description",rows:5,value:n.description,onChange:j,disabled:f||!o,placeholder:t("Enter SEO description"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"title",children:t("Canonical URL")}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"canonicalUrl")})]}),e.jsx(a.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:n.canonicalUrl,onChange:j,disabled:f||!o,placeholder:t("Enter Canonical URL"),readOnly:!o})]}),e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(a.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:n.noIndex,onChange:j,disabled:f||!o,className:"h-4 w-4"}),e.jsx(a.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:t("No Index")})]}),e.jsx("p",{className:"mt-0 text-[10px] font-light leading-4 text-gray-400",children:t("Check this if you don't want search engines to index this page.")})]}),e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(a.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:n.noFollow,onChange:j,disabled:f||!o,className:"h-4 w-4"}),e.jsx(a.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:t("No Follow")})]}),e.jsx("p",{className:"text-[10px] font-light leading-4 text-gray-400",children:t("Check this if you don't want search engines to follow links on this page.")})]})]})}),e.jsx("div",{className:m==="opengraph"?"":"sr-only",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"mb-4 font-semibold text-slate-700",children:t("Open Graph")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"ogTitle",children:t("OG Title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("ogTitle"),field:"ogTitle"}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"ogTitle")})]})]}),e.jsx(a.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:n.ogTitle,onChange:j,disabled:f||!o,placeholder:t("Enter OG title"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"ogDescription",children:t("OG Description")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("ogDescription"),field:"ogDescription"}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"ogDescription")})]})]}),e.jsx(a.Textarea,{id:"ogDescription",name:"ogDescription",rows:5,value:n.ogDescription,onChange:j,disabled:f||!o,placeholder:t("Enter OG description"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"ogImage",children:t("OG Image")}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>{w({...n,ogImage:`{{${s}}}`,ogImageId:""})}})]}),e.jsx(i.ImagePicker,{assetId:n.ogImageId,assetUrl:n.ogImage,onChange:s=>{w({...n,ogImage:s.url,ogImageId:s.id})},disabled:f||!o,placeholder:t("Select OG image"),className:"mb-2"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"metaOther",children:t("Meta Tags")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{keyword:n.keyword,onComplete:k("metaOther"),field:"metaOther"})})]}),e.jsx(i.SmartJsonInput,{id:"metaOther",value:n.metaOther,onChange:s=>{j({target:{name:"metaOther",value:s}})},placeholder:t("Enter Meta Tags JSON"),disabled:f||!o,readOnly:!o,pageData:c||{},rows:8,handleFieldInsert:O})]})]})]})})}),e.jsx("div",{className:m==="jsonld"?"":"sr-only",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"jsonLD",children:t("JSON-LD")}),z&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{keyword:n.keyword,onComplete:k("jsonLD"),field:"jsonLD"})})]}),e.jsx("div",{className:"hidden",children:JSON.stringify(c)}),e.jsx(i.SmartJsonInput,{id:"jsonLD",value:n.jsonLD,onChange:s=>{j({target:{name:"jsonLD",value:s}})},placeholder:t("Enter JSON-LD"),disabled:f||!o,readOnly:!o,pageData:c||{},rows:12,handleFieldInsert:O,hasJsonLdForSelectedLang:z,copyJsonLDFromDefaultPage:ie})]})})})]})})]}),o&&e.jsxs("div",{className:"fixed bottom-0 left-0 right-0 flex w-full flex-shrink-0 items-center justify-between border-t bg-background p-4",children:[ne?e.jsx(a.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>{m==="jsonld"?le():m==="opengraph"?re():oe()},disabled:f||!o||!I,children:t(H?"Resetting...":`Reset to ${m==="jsonld"?"Default JSON-LD":m==="opengraph"?"Default Open Graph":"Default SEO"}`)}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(a.Button,{onClick:Y,disabled:!me(n==null?void 0:n.jsonLD)||(E.current[h]?d.isEqual(E.current[h],n):!1)||f||!o,children:t(q?"Saving...":"Save")}),e.jsx(a.Button,{variant:"link",className:"text-gray-500 hover:text-gray-700",onClick:()=>x("outline"),children:t("Cancel")})]})]}),e.jsx(ge,{isOpen:ee,onClose:()=>{V(!1),U(null)},onSave:async()=>{S&&(await Y(),S.switchHandler(),V(!1),U(null))},onDiscard:()=>{if(S){const s=E.current[h];s&&w(s),S.switchHandler(),V(!1),U(null)}},isSaving:q,fromLanguage:(S==null?void 0:S.fromLang)||h,toLanguage:(S==null?void 0:S.toLang)||""})]})};Q.displayName="SeoPanel";exports.default=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-Qnh8Lkr0.cjs"),P=require("@chaibuilder/sdk"),d=require("lodash-es"),v=require("react"),a=require("@chaibuilder/sdk/ui"),L=require("sonner"),ce=require("@tanstack/react-query"),K=require("lucide-react"),M=require("./get-seo-defaults-Cw7vFt-B.cjs"),de=()=>{const{selectedLang:t}=P.useLanguages(),{data:x,isFetching:u}=i.useLanguagePages();return{data:v.useMemo(()=>d.find(x,{lang:t||""})||{},[x,t]),isFetching:u}},ue=()=>{var p;const x=(p=document.getElementById("canvas-iframe").contentDocument)==null?void 0:p.body.innerHTML;if(!x)return null;const c=new DOMParser().parseFromString(x,"text/html");c.querySelectorAll("style, script, link, svg, [data-block-type='PartialBlock']").forEach(g=>g.remove()),c.querySelectorAll("*").forEach(g=>{Array.from(g.attributes).forEach(m=>g.removeAttribute(m.name))});const r=c.querySelectorAll("h1, h2, h3, h4, h5, h6, p");return Array.from(r).map(g=>`<${g.tagName.toLowerCase()}>${g.innerHTML}</${g.tagName.toLowerCase()}>`).join(" ").replace(/<p>Partial block. Double click to edit.<\/p>/,"")},F=({keyword:t,onComplete:x,field:u})=>{const c=i.useFetch(),r=i.useApiUrl(),{selectedLang:N,fallbackLang:p}=P.useLanguages(),{mutate:g,isPending:m}=ce.useMutation({mutationFn:async()=>{const D=ue();return await c(r,{action:i.ACTIONS.GENERATE_SEO_FIELD,data:{pageContext:"",dynamic:!1,field:u,lang:N||p,pageContent:D,keyword:t}})},onSuccess:D=>{x({fieldValue:D.field})},onError:D=>{x({fieldValue:null,error:D.message})}});return e.jsx(a.Button,{disabled:m,type:"button",className:"h-5 w-5",variant:"ghost",size:"sm",onClick:()=>g(),children:m?e.jsx(K.Loader,{className:"h-3 w-3 animate-spin text-yellow-500"}):e.jsx(K.Wand2Icon,{className:"text-yellow-500"})})},ge=({isOpen:t,onClose:x,onSave:u,onDiscard:c,isSaving:r=!1,fromLanguage:N,toLanguage:p})=>{const g=i.LANGUAGES[N]||N,m=i.LANGUAGES[p]||p;return e.jsx(a.Dialog,{open:t,onOpenChange:x,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Unsaved SEO Changes"}),e.jsxs(a.DialogDescription,{children:['You have unsaved changes in the SEO for "',g,'" version. Do you want to save these changes before switching to "',m,'" version?']})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(a.Button,{variant:"outline",onClick:c,disabled:r,children:"Discard Changes"}),e.jsx(a.Button,{onClick:u,disabled:r,children:r?"Saving...":"Save & Switch"})]})]})})},me=t=>{if(!t)return!0;try{return JSON.parse(t),!0}catch{return!1}},he=(t,x)=>{const u=t.selectionStart||0,c=t.selectionEnd||0,r=t.value,N=r.substring(0,u),p=r.substring(c),g=`{{${x}}}`,m=N+""+g+p,D=u+0+g.length;return{value:m,newCursorPos:D}},Q=()=>{const{t}=P.useTranslation(),[,x]=P.useSidebarActivePanel(),{data:u}=i.useCurrentPage(),{data:c}=i.useBuilderPageData(),{data:r,isFetching:N}=de(),p=r==null?void 0:r.seo,g=v.useRef(null),[m,D]=v.useState("seo"),R=u==null?void 0:u.id,W=u==null?void 0:u.pageType,I=i.usePageType(W),{selectedLang:$,fallbackLang:X}=P.useLanguages(),h=$||X,[H,J]=v.useState(!1),[Z,_]=v.useState(!1),[ee,V]=v.useState(!1),[S,U]=v.useState(null),[n,w]=v.useState({keyword:"",title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",ogImageId:"",searchTitle:"",searchDescription:"",jsonLD:"{}",metaOther:"{}",...p}),E=v.useRef({}),{mutate:se,isPending:q}=i.useUpdatePage(),f=q||H||Z,{hasPermission:te}=P.usePermissions(),o=te(i.PAGES_PERMISSIONS.EDIT_SEO),[ae]=i.usePagesProps(),ne=d.get(ae,"features.canResetSeoToDefault",!1),z=!$||n.jsonLD!=="{}";v.useEffect(()=>{if(!N&&p&&R){const s={keyword:"",title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",ogImageId:"",searchTitle:"",searchDescription:"",jsonLD:"",metaOther:"",...p};w(s),E.current[h]=s}},[N,p,h,R]),v.useEffect(()=>{const s=l=>{const{fromLang:b,toLang:A,switchHandler:y}=l.detail,G=E.current[h];(G?!d.isEqual(G,n):!1)?(U({fromLang:b,toLang:A,switchHandler:y}),V(!0)):y()};return window.addEventListener("seo-language-switch-check",s),()=>{window.removeEventListener("seo-language-switch-check",s)}},[R,n,h]);const oe=async()=>{if(!(!I||!h))try{J(!0);const s=M.getSeoDefaults(I,h),l={...n,keyword:d.get(s,"seo.keyword",""),title:d.get(s,"seo.title",""),description:d.get(s,"seo.description",""),cononicalUrl:d.get(s,"seo.canonicalUrl",""),noIndex:d.get(s,"seo.noIndex",!1),noFollow:d.get(s,"seo.noFollow",!1),ogTitle:d.get(s,"seo.ogTitle",""),ogDescription:d.get(s,"seo.ogDescription","")};w(l),L.toast.success(t("SEO fields reset to defaults"))}catch(s){L.toast.error(t("Failed to reset SEO fields")),console.error("Reset SEO error:",s)}finally{J(!1)}},le=async()=>{if(!(!I||!h))try{_(!0);const s=M.getSeoDefaults(I,h),l={...n,jsonLD:d.get(s,"seo.jsonLD","")};w(l),L.toast.success(t("JSON-LD reset to default"))}catch(s){L.toast.error(t("Failed to reset JSON-LD")),console.error("Reset JSON-LD error:",s)}finally{_(!1)}},re=async()=>{if(!(!I||!h))try{J(!0);const s=M.getSeoDefaults(I,h),l={...n,ogTitle:d.get(s,"seo.ogTitle",""),ogDescription:d.get(s,"seo.ogDescription",""),ogImage:d.get(s,"seo.ogImage",""),ogImageId:d.get(s,"seo.ogImageId",""),metaOther:d.get(s,"seo.metaOther","{}")};w(l),L.toast.success(t("Meta Tag fields reset to defaults"))}catch(s){L.toast.error(t("Failed to reset Meta Tag fields")),console.error("Reset Meta Tag error:",s)}finally{J(!1)}},Y=async()=>{se({id:r==null?void 0:r.id,seo:n,primaryPage:R},{onSuccess:()=>{console.log("SEO & JSON-LD updated successfully",n),E.current[h]=n,L.toast.success("SEO & JSON-LD updated successfully")}})},O=(s,l)=>{const b=document.getElementById(l);if(b){const{value:A,newCursorPos:y}=he(b,s);g.current={id:l,position:y},b.tagName.toLowerCase()==="input"?(b.value=A,w(C=>({...C,[b.name]:A})),b.focus(),b.setSelectionRange(y,y),[0,10,50,100,200].forEach(C=>{setTimeout(()=>{const B=document.getElementById(l);B&&(B.focus(),B.setSelectionRange(y,y))},C)})):(w(T=>({...T,[b.name]:A})),requestAnimationFrame(()=>{const T=document.getElementById(l);T&&(T.focus(),T.setSelectionRange(y,y),setTimeout(()=>{const C=document.getElementById(l);C&&(C.focus(),C.setSelectionRange(y,y))},50))}))}},j=s=>{const l={...n,[s.target.name]:s.target.name==="noIndex"||s.target.name==="noFollow"?s.target.checked:s.target.value};w(l)},k=s=>l=>{d.isEmpty(l.fieldValue)||j({target:{name:s,value:typeof l.fieldValue=="string"?l.fieldValue.replace(/^"(.*)"$/,"$1"):l.fieldValue}}),l.error&&L.toast.error(e.jsxs("div",{children:[e.jsx("h2",{children:"Failed to generate:"}),e.jsx("p",{children:l.error})]}))},ie=()=>{const s=d.get(u,"seo.jsonLD","{}");if((s==null?void 0:s.trim())==="{}"){L.toast.error("Default page JSON-LD is empty");return}j({target:{name:"jsonLD",value:s}})};return e.jsxs("div",{className:"relative flex h-full flex-col","data-panel-id":"seo",children:[!o&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",children:e.jsx(a.Alert,{variant:"default",className:"w-[80%] max-w-md text-xs",children:e.jsx(a.AlertDescription,{children:t("You don't have permission to edit SEO settings. Contact your administrator for access.")})})}),e.jsxs("div",{className:"no-scrollbar flex-grow overflow-y-auto px-2 pb-20",children:[e.jsxs("div",{className:"mb-4 flex w-full items-center justify-between rounded-md bg-gray-100 px-2 py-1 text-left text-sm",children:[e.jsxs("span",{children:[e.jsx("div",{className:"font-medium",children:r==null?void 0:r.name}),e.jsx("span",{className:"font-mono text-xs leading-tight text-gray-500",children:r==null?void 0:r.slug})]}),e.jsx(i.LanguageSwitcher,{variant:"outline",showAdd:!1})]}),e.jsx("form",{className:"space-y-8",children:e.jsxs(a.Tabs,{value:m,onValueChange:D,className:"w-full",children:[e.jsxs(a.TabsList,{className:"mb-4 grid w-full grid-cols-3",children:[e.jsx(a.TabsTrigger,{value:"seo",children:t("SEO")}),e.jsx(a.TabsTrigger,{value:"opengraph",children:t("Meta Tags")}),e.jsx(a.TabsTrigger,{value:"jsonld",children:t("JSON-LD")})]}),e.jsx("div",{className:m==="seo"?"":"sr-only",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"keyword",children:t("Keyword")}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"keyword")})]}),e.jsx(a.Input,{type:"text",id:"keyword",name:"keyword",value:n.keyword,onChange:j,disabled:f||!o,placeholder:t("Enter keyword"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"title",children:t("SEO Title")}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("title"),field:"title"}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"title")})]})]}),e.jsx(a.Input,{type:"text",id:"title",name:"title",value:n.title,onChange:j,disabled:f||!o,placeholder:t("Enter SEO title"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"description",children:t("SEO Description")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("description"),field:"description"}),o&&e.jsx(i.NestedPathSelector,{data:c??{},onSelect:s=>O(s,"description")})]})]}),e.jsx(a.Textarea,{id:"description",name:"description",rows:5,value:n.description,onChange:j,disabled:f||!o,placeholder:t("Enter SEO description"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"title",children:t("Canonical URL")}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"canonicalUrl")})]}),e.jsx(a.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:n.canonicalUrl,onChange:j,disabled:f||!o,placeholder:t("Enter Canonical URL"),readOnly:!o})]}),e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(a.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:n.noIndex,onChange:j,disabled:f||!o,className:"h-4 w-4"}),e.jsx(a.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:t("No Index")})]}),e.jsx("p",{className:"mt-0 text-[10px] font-light leading-4 text-gray-400",children:t("Check this if you don't want search engines to index this page.")})]}),e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(a.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:n.noFollow,onChange:j,disabled:f||!o,className:"h-4 w-4"}),e.jsx(a.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:t("No Follow")})]}),e.jsx("p",{className:"text-[10px] font-light leading-4 text-gray-400",children:t("Check this if you don't want search engines to follow links on this page.")})]})]})}),e.jsx("div",{className:m==="opengraph"?"":"sr-only",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"mb-4 font-semibold text-slate-700",children:t("Open Graph")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"ogTitle",children:t("OG Title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("ogTitle"),field:"ogTitle"}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"ogTitle")})]})]}),e.jsx(a.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:n.ogTitle,onChange:j,disabled:f||!o,placeholder:t("Enter OG title"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"ogDescription",children:t("OG Description")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{keyword:n.keyword,onComplete:k("ogDescription"),field:"ogDescription"}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>O(s,"ogDescription")})]})]}),e.jsx(a.Textarea,{id:"ogDescription",name:"ogDescription",rows:5,value:n.ogDescription,onChange:j,disabled:f||!o,placeholder:t("Enter OG description"),readOnly:!o})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"ogImage",children:t("OG Image")}),o&&e.jsx(i.NestedPathSelector,{dataType:"value",data:c??{},onSelect:s=>{w({...n,ogImage:`{{${s}}}`,ogImageId:""})}})]}),e.jsx(i.ImagePicker,{assetId:n.ogImageId,assetUrl:n.ogImage,onChange:s=>{w({...n,ogImage:s.url,ogImageId:s.id})},disabled:f||!o,placeholder:t("Select OG image"),className:"mb-2"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"metaOther",children:t("Meta Tags")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{keyword:n.keyword,onComplete:k("metaOther"),field:"metaOther"})})]}),e.jsx(i.SmartJsonInput,{id:"metaOther",value:n.metaOther,onChange:s=>{j({target:{name:"metaOther",value:s}})},placeholder:t("Enter Meta Tags JSON"),disabled:f||!o,readOnly:!o,pageData:c||{},rows:8,handleFieldInsert:O})]})]})]})})}),e.jsx("div",{className:m==="jsonld"?"":"sr-only",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-xs",htmlFor:"jsonLD",children:t("JSON-LD")}),z&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{keyword:n.keyword,onComplete:k("jsonLD"),field:"jsonLD"})})]}),e.jsx("div",{className:"hidden",children:JSON.stringify(c)}),e.jsx(i.SmartJsonInput,{id:"jsonLD",value:n.jsonLD,onChange:s=>{j({target:{name:"jsonLD",value:s}})},placeholder:t("Enter JSON-LD"),disabled:f||!o,readOnly:!o,pageData:c||{},rows:12,handleFieldInsert:O,hasJsonLdForSelectedLang:z,copyJsonLDFromDefaultPage:ie})]})})})]})})]}),o&&e.jsxs("div",{className:"fixed bottom-0 left-0 right-0 flex w-full flex-shrink-0 items-center justify-between border-t bg-background p-4",children:[ne?e.jsx(a.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>{m==="jsonld"?le():m==="opengraph"?re():oe()},disabled:f||!o||!I,children:t(H?"Resetting...":`Reset to ${m==="jsonld"?"Default JSON-LD":m==="opengraph"?"Default Open Graph":"Default SEO"}`)}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(a.Button,{onClick:Y,disabled:!me(n==null?void 0:n.jsonLD)||(E.current[h]?d.isEqual(E.current[h],n):!1)||f||!o,children:t(q?"Saving...":"Save")}),e.jsx(a.Button,{variant:"link",className:"text-gray-500 hover:text-gray-700",onClick:()=>x("outline"),children:t("Cancel")})]})]}),e.jsx(ge,{isOpen:ee,onClose:()=>{V(!1),U(null)},onSave:async()=>{S&&(await Y(),S.switchHandler(),V(!1),U(null))},onDiscard:()=>{if(S){const s=E.current[h];s&&w(s),S.switchHandler(),V(!1),U(null)}},isSaving:q,fromLanguage:(S==null?void 0:S.fromLang)||h,toLanguage:(S==null?void 0:S.toLang)||""})]})};Q.displayName="SeoPanel";exports.default=Q;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("@chaibuilder/sdk"),s=require("@chaibuilder/sdk/ui"),w=require("lodash-es"),m=require("lucide-react"),p=require("react"),L=require("sonner"),u=require("./index-DSUpSpeI.cjs"),J=require("@tanstack/react-query"),S=()=>{const n=u.useApiUrl(),d=u.useFetch();return J.useQuery({queryKey:[u.ACTIONS.GET_APP_SHARED_JSONLD],queryFn:async()=>await d(n,{action:u.ACTIONS.GET_APP_SHARED_JSONLD})||[],placeholderData:[],staleTime:60*60*1e3,retry:2})};function P(){const{data:n}=u.useCurrentPage(),d=w.get(n,"metadata",{})||{},[o,j]=p.useState(w.get(d,"sharedJsonLD",[])||[]),[x,h]=p.useState({show:!1,data:null}),{mutateAsync:y}=u.useUpdateActivePageMetadata(),[a,r]=p.useState(null),{data:i,isLoading:g}=S(),{mutateAsync:f}=u.useUpdateAppSharedJsonLD(),{selectedLang:b}=T.useLanguages(),l=async t=>{await y({...d,sharedJsonLD:t}),j(t),r(null)},v=async t=>{r(t);let c=[...o];w.includes(o,t)?c=c.filter(N=>N!==t):c=[...c||[],t],await l(c)},A=async t=>{r(t);try{const c=i==null?void 0:i.filter(N=>N.id!==t);await f(c),j(c),r(null)}catch{r(null)}};return e.jsxs("div",{className:"rounded border bg-muted p-2",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:"Shared JSON-LD Templates"}),e.jsx("div",{className:"w-full text-xs text-gray-500",children:"Manage reusable JSON-LD schemas that can be applied across multiple pages"})]}),!b&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{type:"button",disabled:g,className:"rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",onClick:t=>{t.stopPropagation(),h({show:!0,data:null})},children:g?e.jsx(m.Loader,{className:"h-4 w-4 animate-spin"}):e.jsx(m.Plus,{className:"h-4 w-4"})}),e.jsx(s.TooltipContent,{children:"Add new schema"})]})]}),e.jsxs(s.ScrollArea,{className:"max-h-96 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-2",children:[(!i||(i==null?void 0:i.length)===0)&&!g&&e.jsx("div",{className:"flex items-center justify-center px-2 py-4 text-xs",children:"No shared JSON-LD found"}),i==null?void 0:i.map(t=>{const c=u.parseJSONWithPlaceholders(t.content),N=c.isValid?c.parsed:"",C=w.includes(o,t.id),D=!b;return e.jsxs(s.Card,{className:`relative border-gray-300 p-0 shadow-none transition-all ${a===t.id?"pointer-events-none":""}`,children:[a===t.id&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80",children:e.jsx(m.Loader,{className:"h-5 w-5 animate-spin text-primary"})}),e.jsx(s.CardHeader,{className:"p-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[D&&e.jsx(s.Switch,{checked:C,onCheckedChange:()=>v(t.id)}),e.jsxs("div",{children:[e.jsx(s.CardTitle,{className:"flex items-center gap-2 text-sm leading-none",children:t.name}),(t==null?void 0:t.description)&&e.jsx("p",{className:"mt-1 text-xs leading-none text-muted-foreground",children:t==null?void 0:t.description})]})]}),D&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>h({show:!0,data:t}),children:e.jsx(m.Edit,{className:"h-4 w-4"})}),e.jsxs(s.AlertDialog,{children:[e.jsx(s.AlertDialogTrigger,{className:"flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800",children:e.jsx(m.Trash,{className:"h-4 w-4"})}),e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Schema"}),e.jsxs(s.AlertDialogDescription,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium",children:t.name}),"? This action cannot be undone."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{type:"button",children:"Cancel"}),e.jsx(s.AlertDialogAction,{type:"button",onClick:()=>A(t.id),className:"bg-red-500 text-white hover:bg-red-600",children:"Delete"})]})]})]})]})]})}),e.jsx(s.CardContent,{className:"px-2 pb-2",children:D?e.jsx(s.Textarea,{id:t.id,rows:1,readOnly:!0,value:JSON.stringify(N,null,2),className:"no-scrollbar cursor-text overflow-hidden rounded-md border-none bg-gray-100/80 text-xs"}):e.jsxs("div",{className:"flex h-20 w-full flex-col items-center justify-center rounded-lg border bg-gray-100",children:[e.jsx("div",{className:"max-w-xl text-center text-xs text-gray-500",children:"Not available in selected language, but available in default language."}),e.jsx(s.Button,{size:"sm",variant:"outline",className:"mt-2",onClick:()=>{},children:"Copy & Edit from default language"})]})})]})})]}),g&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(m.Loader,{className:"h-5 w-5 animate-spin"})})]}),e.jsx(O,{data:x==null?void 0:x.data,show:x==null?void 0:x.show,onClose:()=>{h({show:!1,data:null})}})]})}const O=({data:n,show:d,onClose:o})=>e.jsx(s.Dialog,{open:d,onOpenChange:()=>o(),children:d&&e.jsx(F,{data:n,show:d,onClose:o})}),F=({data:n,show:d,onClose:o})=>{const[j,x]=p.useState("edit"),[h,y]=p.useState(""),[a,r]=p.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),{data:i}=S(),{mutateAsync:g,isPending:f}=u.useUpdateAppSharedJsonLD();p.useEffect(()=>{x("edit"),r({name:"",description:"",content:"",enabledByDefaultForNewPages:!1}),n&&r({name:n.name,description:n.description,content:n.content,enabledByDefaultForNewPages:n.enabledByDefaultForNewPages})},[n,d]),p.useEffect(()=>{const l=u.parseJSONWithPlaceholders(a.content);y(l.isValid?JSON.stringify(l.parsed,null,2):"")},[a.content]);const b=async()=>{if(!a.name||!a.content){L.toast.error("Please enter a name and content");return}const l={id:n?n.id:crypto.randomUUID(),name:a.name,description:a.description,content:a.content};n?await g([...(i||[]).map(v=>v.id===n.id?l:v)]):await g([...i||[],l]),o()};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Add New Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-name",children:"Schema Name"}),e.jsx(s.Input,{id:"new-name",value:a.name,onChange:l=>r({...a,name:l.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-description",children:"Description"}),e.jsx(s.Input,{id:"new-description",value:a.description||"",onChange:l=>r({...a,description:l.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-content",children:"JSON-LD Content"}),e.jsxs(s.Tabs,{value:j,onValueChange:x,className:"w-full",children:[e.jsxs("div",{className:"mb-2 flex w-full items-center justify-between",children:[e.jsxs(s.TabsList,{className:"w-max",children:[e.jsxs(s.TabsTrigger,{value:"edit",className:"flex items-center gap-1",children:[e.jsx(m.Code,{className:"h-4 w-4"}),e.jsx("span",{children:"Edit"})]}),e.jsxs(s.TabsTrigger,{value:"preview",className:"flex items-center gap-1",disabled:!h,children:[e.jsx(m.Eye,{className:"h-4 w-4"}),e.jsx("span",{children:"Preview"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:j==="edit"&&e.jsx(s.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>r({...a,content:h}),disabled:!h,children:"Format"})})]}),e.jsxs(s.TabsContent,{value:"edit",children:[e.jsx(s.Textarea,{id:"new-content",value:a.content||"{}",onChange:l=>r({...a,content:l.target.value}),className:"font-mono text-sm",placeholder:"Enter JSON-LD markup...",rows:10}),!h&&a.content?e.jsx("p",{className:"pt-px text-xs text-red-500",children:"Invalid JSON-LD"}):e.jsx("p",{})]}),e.jsx(s.TabsContent,{value:"preview",children:e.jsx(s.Textarea,{id:"new-content",value:h||"{}",className:"bg-muted font-mono text-sm",placeholder:"{}",rows:10,readOnly:!0})})]})]}),n&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-blue-900",children:"Apply to All Existing Pages"}),e.jsx("div",{className:"text-xs text-blue-700",children:"This will add this JSON-LD schema to all existing pages on your site a"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",variant:"outline",onClick:()=>{},children:"Apply to all"}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>{},children:"Remove to all"})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(s.Switch,{id:"new-enabled",checked:a.enabledByDefaultForNewPages,onCheckedChange:l=>r({...a,enabledByDefaultForNewPages:l})}),e.jsxs(s.Label,{htmlFor:"new-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(s.Button,{disabled:f,variant:"outline",type:"button",size:"sm",onClick:()=>o(),children:"Cancel"}),e.jsx(s.Button,{disabled:f||!h,type:"button",size:"sm",onClick:b,children:f?e.jsxs(e.Fragment,{children:[e.jsx(m.Loader,{className:"h-4 w-4 animate-spin"})," ",n?"Updating":"Adding"]}):n?"Update Schema":"Add Schema"})]})]})]})]})};exports.default=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("@chaibuilder/sdk"),s=require("@chaibuilder/sdk/ui"),w=require("lodash-es"),m=require("lucide-react"),p=require("react"),L=require("sonner"),u=require("./index-Qnh8Lkr0.cjs"),J=require("@tanstack/react-query"),S=()=>{const n=u.useApiUrl(),d=u.useFetch();return J.useQuery({queryKey:[u.ACTIONS.GET_APP_SHARED_JSONLD],queryFn:async()=>await d(n,{action:u.ACTIONS.GET_APP_SHARED_JSONLD})||[],placeholderData:[],staleTime:60*60*1e3,retry:2})};function P(){const{data:n}=u.useCurrentPage(),d=w.get(n,"metadata",{})||{},[o,j]=p.useState(w.get(d,"sharedJsonLD",[])||[]),[x,h]=p.useState({show:!1,data:null}),{mutateAsync:y}=u.useUpdateActivePageMetadata(),[a,r]=p.useState(null),{data:i,isLoading:g}=S(),{mutateAsync:f}=u.useUpdateAppSharedJsonLD(),{selectedLang:b}=T.useLanguages(),l=async t=>{await y({...d,sharedJsonLD:t}),j(t),r(null)},v=async t=>{r(t);let c=[...o];w.includes(o,t)?c=c.filter(N=>N!==t):c=[...c||[],t],await l(c)},A=async t=>{r(t);try{const c=i==null?void 0:i.filter(N=>N.id!==t);await f(c),j(c),r(null)}catch{r(null)}};return e.jsxs("div",{className:"rounded border bg-muted p-2",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:"Shared JSON-LD Templates"}),e.jsx("div",{className:"w-full text-xs text-gray-500",children:"Manage reusable JSON-LD schemas that can be applied across multiple pages"})]}),!b&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{type:"button",disabled:g,className:"rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",onClick:t=>{t.stopPropagation(),h({show:!0,data:null})},children:g?e.jsx(m.Loader,{className:"h-4 w-4 animate-spin"}):e.jsx(m.Plus,{className:"h-4 w-4"})}),e.jsx(s.TooltipContent,{children:"Add new schema"})]})]}),e.jsxs(s.ScrollArea,{className:"max-h-96 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-2",children:[(!i||(i==null?void 0:i.length)===0)&&!g&&e.jsx("div",{className:"flex items-center justify-center px-2 py-4 text-xs",children:"No shared JSON-LD found"}),i==null?void 0:i.map(t=>{const c=u.parseJSONWithPlaceholders(t.content),N=c.isValid?c.parsed:"",C=w.includes(o,t.id),D=!b;return e.jsxs(s.Card,{className:`relative border-gray-300 p-0 shadow-none transition-all ${a===t.id?"pointer-events-none":""}`,children:[a===t.id&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80",children:e.jsx(m.Loader,{className:"h-5 w-5 animate-spin text-primary"})}),e.jsx(s.CardHeader,{className:"p-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[D&&e.jsx(s.Switch,{checked:C,onCheckedChange:()=>v(t.id)}),e.jsxs("div",{children:[e.jsx(s.CardTitle,{className:"flex items-center gap-2 text-sm leading-none",children:t.name}),(t==null?void 0:t.description)&&e.jsx("p",{className:"mt-1 text-xs leading-none text-muted-foreground",children:t==null?void 0:t.description})]})]}),D&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>h({show:!0,data:t}),children:e.jsx(m.Edit,{className:"h-4 w-4"})}),e.jsxs(s.AlertDialog,{children:[e.jsx(s.AlertDialogTrigger,{className:"flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800",children:e.jsx(m.Trash,{className:"h-4 w-4"})}),e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Schema"}),e.jsxs(s.AlertDialogDescription,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-medium",children:t.name}),"? This action cannot be undone."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{type:"button",children:"Cancel"}),e.jsx(s.AlertDialogAction,{type:"button",onClick:()=>A(t.id),className:"bg-red-500 text-white hover:bg-red-600",children:"Delete"})]})]})]})]})]})}),e.jsx(s.CardContent,{className:"px-2 pb-2",children:D?e.jsx(s.Textarea,{id:t.id,rows:1,readOnly:!0,value:JSON.stringify(N,null,2),className:"no-scrollbar cursor-text overflow-hidden rounded-md border-none bg-gray-100/80 text-xs"}):e.jsxs("div",{className:"flex h-20 w-full flex-col items-center justify-center rounded-lg border bg-gray-100",children:[e.jsx("div",{className:"max-w-xl text-center text-xs text-gray-500",children:"Not available in selected language, but available in default language."}),e.jsx(s.Button,{size:"sm",variant:"outline",className:"mt-2",onClick:()=>{},children:"Copy & Edit from default language"})]})})]})})]}),g&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(m.Loader,{className:"h-5 w-5 animate-spin"})})]}),e.jsx(O,{data:x==null?void 0:x.data,show:x==null?void 0:x.show,onClose:()=>{h({show:!1,data:null})}})]})}const O=({data:n,show:d,onClose:o})=>e.jsx(s.Dialog,{open:d,onOpenChange:()=>o(),children:d&&e.jsx(F,{data:n,show:d,onClose:o})}),F=({data:n,show:d,onClose:o})=>{const[j,x]=p.useState("edit"),[h,y]=p.useState(""),[a,r]=p.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),{data:i}=S(),{mutateAsync:g,isPending:f}=u.useUpdateAppSharedJsonLD();p.useEffect(()=>{x("edit"),r({name:"",description:"",content:"",enabledByDefaultForNewPages:!1}),n&&r({name:n.name,description:n.description,content:n.content,enabledByDefaultForNewPages:n.enabledByDefaultForNewPages})},[n,d]),p.useEffect(()=>{const l=u.parseJSONWithPlaceholders(a.content);y(l.isValid?JSON.stringify(l.parsed,null,2):"")},[a.content]);const b=async()=>{if(!a.name||!a.content){L.toast.error("Please enter a name and content");return}const l={id:n?n.id:crypto.randomUUID(),name:a.name,description:a.description,content:a.content};n?await g([...(i||[]).map(v=>v.id===n.id?l:v)]):await g([...i||[],l]),o()};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Add New Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-name",children:"Schema Name"}),e.jsx(s.Input,{id:"new-name",value:a.name,onChange:l=>r({...a,name:l.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-description",children:"Description"}),e.jsx(s.Input,{id:"new-description",value:a.description||"",onChange:l=>r({...a,description:l.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-content",children:"JSON-LD Content"}),e.jsxs(s.Tabs,{value:j,onValueChange:x,className:"w-full",children:[e.jsxs("div",{className:"mb-2 flex w-full items-center justify-between",children:[e.jsxs(s.TabsList,{className:"w-max",children:[e.jsxs(s.TabsTrigger,{value:"edit",className:"flex items-center gap-1",children:[e.jsx(m.Code,{className:"h-4 w-4"}),e.jsx("span",{children:"Edit"})]}),e.jsxs(s.TabsTrigger,{value:"preview",className:"flex items-center gap-1",disabled:!h,children:[e.jsx(m.Eye,{className:"h-4 w-4"}),e.jsx("span",{children:"Preview"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:j==="edit"&&e.jsx(s.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>r({...a,content:h}),disabled:!h,children:"Format"})})]}),e.jsxs(s.TabsContent,{value:"edit",children:[e.jsx(s.Textarea,{id:"new-content",value:a.content||"{}",onChange:l=>r({...a,content:l.target.value}),className:"font-mono text-sm",placeholder:"Enter JSON-LD markup...",rows:10}),!h&&a.content?e.jsx("p",{className:"pt-px text-xs text-red-500",children:"Invalid JSON-LD"}):e.jsx("p",{})]}),e.jsx(s.TabsContent,{value:"preview",children:e.jsx(s.Textarea,{id:"new-content",value:h||"{}",className:"bg-muted font-mono text-sm",placeholder:"{}",rows:10,readOnly:!0})})]})]}),n&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-blue-900",children:"Apply to All Existing Pages"}),e.jsx("div",{className:"text-xs text-blue-700",children:"This will add this JSON-LD schema to all existing pages on your site a"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",variant:"outline",onClick:()=>{},children:"Apply to all"}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>{},children:"Remove to all"})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(s.Switch,{id:"new-enabled",checked:a.enabledByDefaultForNewPages,onCheckedChange:l=>r({...a,enabledByDefaultForNewPages:l})}),e.jsxs(s.Label,{htmlFor:"new-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(s.Button,{disabled:f,variant:"outline",type:"button",size:"sm",onClick:()=>o(),children:"Cancel"}),e.jsx(s.Button,{disabled:f||!h,type:"button",size:"sm",onClick:b,children:f?e.jsxs(e.Fragment,{children:[e.jsx(m.Loader,{className:"h-4 w-4 animate-spin"})," ",n?"Updating":"Adding"]}):n?"Update Schema":"Add Schema"})]})]})]})]})};exports.default=P;
@@ -5,7 +5,7 @@ import { get as J, includes as P } from "lodash-es";
5
5
  import { Loader as y, Plus as oe, Edit as he, Trash as me, Code as ue, Eye as pe } from "lucide-react";
6
6
  import { useState as g, useEffect as O } from "react";
7
7
  import { toast as ge } from "sonner";
8
- import { ak as fe, al as xe, A as F, am as Ne, an as ve, ao as j, ap as E } from "./index-Byi6-4u1.js";
8
+ import { ak as fe, al as xe, A as F, am as Ne, an as ve, ao as j, ap as E } from "./index-DFvsMFVH.js";
9
9
  import { useQuery as we } from "@tanstack/react-query";
10
10
  const U = () => {
11
11
  const l = fe(), d = xe();
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),u=require("./index-DSUpSpeI.cjs"),b=require("@chaibuilder/sdk/ui"),d=require("react"),j=e=>{if(!e)return{base:e,extension:null};const n=e.lastIndexOf(".");if(n<=0)return{base:e,extension:null};const t=e.substring(n);return{base:e.substring(0,n),extension:t}},x=e=>{if(!e)return e;const{base:n}=j(e);return n};function E(e,n){const t=(e||"").split("/").filter(Boolean);let r="",a=!0;if(n.slug==="/"){const i=t.pop()||"";if(u.LANGUAGES[i])a=!0;else{r=i;const l=t.pop()||"";a=!!u.LANGUAGES[l]}}else if(n.parent)t.length&&(r=t.pop()||"");else if(t.length){r=t.pop()||"";const i=t.pop()||"";a=!!u.LANGUAGES[i]}return{initSlug:r,prefix:a}}const v=e=>e&&x(e),C=(e,n)=>{const t=x(e||"");return!t||t==="/"?`/${n}`:`${t}/${n}`};function A({value:e,onChange:n,placeholder:t,parentSlug:r,onValidationChange:a,disabled:i=!1,fullSlug:l}){const[g,p]=d.useState(e),[o,f]=d.useState(null);d.useEffect(()=>{p(e)},[e]);const h=S=>{const c=S.target.value.replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),m=(c.match(/\./g)||[]).length,N=m<=1;m>1?f("Invalid slug. Only one dot (.) is allowed in the slug"):f(null),a&&a(N),p(c),n(c)};return s.jsxs("div",{children:[r&&s.jsx("div",{className:"mb-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Parent: ",s.jsx("span",{className:"font-mono text-gray-900",children:v(r)})]})}),s.jsxs("div",{className:"relative",children:[s.jsx(b.Input,{disabled:i,value:g,onChange:h,placeholder:t,className:o?"border-red-500":""}),o&&s.jsx("div",{className:"mt-1 text-xs text-red-500",children:o})]}),l&&l!=="undefined"&&s.jsx("div",{className:"mt-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Complete Slug: ",s.jsx("span",{className:"font-mono text-gray-900",children:l})]})})]})}exports.SlugInput=A;exports.combineParentChildSlugs=C;exports.parseSlugForEdit=E;exports.removeSlugExtension=x;
1
+ "use strict";const s=require("react/jsx-runtime"),u=require("./index-Qnh8Lkr0.cjs"),b=require("@chaibuilder/sdk/ui"),d=require("react"),j=e=>{if(!e)return{base:e,extension:null};const n=e.lastIndexOf(".");if(n<=0)return{base:e,extension:null};const t=e.substring(n);return{base:e.substring(0,n),extension:t}},x=e=>{if(!e)return e;const{base:n}=j(e);return n};function E(e,n){const t=(e||"").split("/").filter(Boolean);let r="",a=!0;if(n.slug==="/"){const i=t.pop()||"";if(u.LANGUAGES[i])a=!0;else{r=i;const l=t.pop()||"";a=!!u.LANGUAGES[l]}}else if(n.parent)t.length&&(r=t.pop()||"");else if(t.length){r=t.pop()||"";const i=t.pop()||"";a=!!u.LANGUAGES[i]}return{initSlug:r,prefix:a}}const v=e=>e&&x(e),C=(e,n)=>{const t=x(e||"");return!t||t==="/"?`/${n}`:`${t}/${n}`};function A({value:e,onChange:n,placeholder:t,parentSlug:r,onValidationChange:a,disabled:i=!1,fullSlug:l}){const[g,p]=d.useState(e),[o,f]=d.useState(null);d.useEffect(()=>{p(e)},[e]);const h=S=>{const c=S.target.value.replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),m=(c.match(/\./g)||[]).length,N=m<=1;m>1?f("Invalid slug. Only one dot (.) is allowed in the slug"):f(null),a&&a(N),p(c),n(c)};return s.jsxs("div",{children:[r&&s.jsx("div",{className:"mb-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Parent: ",s.jsx("span",{className:"font-mono text-gray-900",children:v(r)})]})}),s.jsxs("div",{className:"relative",children:[s.jsx(b.Input,{disabled:i,value:g,onChange:h,placeholder:t,className:o?"border-red-500":""}),o&&s.jsx("div",{className:"mt-1 text-xs text-red-500",children:o})]}),l&&l!=="undefined"&&s.jsx("div",{className:"mt-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Complete Slug: ",s.jsx("span",{className:"font-mono text-gray-900",children:l})]})})]})}exports.SlugInput=A;exports.combineParentChildSlugs=C;exports.parseSlugForEdit=E;exports.removeSlugExtension=x;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { L as d } from "./index-Byi6-4u1.js";
2
+ import { L as d } from "./index-DFvsMFVH.js";
3
3
  import { Input as v } from "@chaibuilder/sdk/ui";
4
4
  import { useState as x, useEffect as C } from "react";
5
5
  const y = (e) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DSUpSpeI.cjs"),d=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),l=()=>{const[t]=d.useTheme(),{mutate:o,isPending:i}=s.usePublishPages(),{mutateAsync:n,isPending:u}=s.useUpdateWebsiteSettings(),r=()=>{n({settings:{theme:t}})},c=async()=>{await n({settings:{theme:t}}),o({ids:["THEME"]},{onSuccess:()=>{s.throwConfetti("BOTTOM_RIGHT")}})};return e.jsxs("div",{className:"flex items-center justify-center gap-x-3 border-t bg-white py-3",children:[e.jsx(a.Button,{size:"sm",variant:"outline",disabled:i||u,onClick:r,children:"Save draft"}),e.jsx(a.Button,{size:"sm",disabled:i||u,onClick:c,children:"Publish"})]})};exports.default=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-Qnh8Lkr0.cjs"),d=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),l=()=>{const[t]=d.useTheme(),{mutate:o,isPending:i}=s.usePublishPages(),{mutateAsync:n,isPending:u}=s.useUpdateWebsiteSettings(),r=()=>{n({settings:{theme:t}})},c=async()=>{await n({settings:{theme:t}}),o({ids:["THEME"]},{onSuccess:()=>{s.throwConfetti("BOTTOM_RIGHT")}})};return e.jsxs("div",{className:"flex items-center justify-center gap-x-3 border-t bg-white py-3",children:[e.jsx(a.Button,{size:"sm",variant:"outline",disabled:i||u,onClick:r,children:"Save draft"}),e.jsx(a.Button,{size:"sm",disabled:i||u,onClick:c,children:"Publish"})]})};exports.default=l;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as h, jsx as n } from "react/jsx-runtime";
2
- import { u as l, a as m, t as r } from "./index-Byi6-4u1.js";
2
+ import { u as l, a as m, t as r } from "./index-DFvsMFVH.js";
3
3
  import { useTheme as d } from "@chaibuilder/sdk";
4
4
  import { Button as a } from "@chaibuilder/sdk/ui";
5
5
  const P = () => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-DSUpSpeI.cjs"),t=require("@chaibuilder/sdk/ui"),u=require("react"),d=({page:i,onClose:a})=>{const[s,n]=u.useState(!1),r=c.useUnmarkAsTemplate(),o=()=>{n(!0),r.mutate(i,{onSuccess:()=>{n(!1),a()},onError:()=>{n(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:a,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Unmark as template"}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:"Are you sure you want to unmark this page as a template?"})]}),e.jsxs(t.DialogFooter,{className:s?"pointer-events-none opacity-75":"",children:[e.jsx(t.Button,{variant:"outline",onClick:l=>{l.stopPropagation(),a()},children:"Cancel"}),e.jsx(t.Button,{variant:"default",disabled:s,onClick:o,children:"Unmark as template"})]})]})})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-Qnh8Lkr0.cjs"),t=require("@chaibuilder/sdk/ui"),u=require("react"),d=({page:i,onClose:a})=>{const[s,n]=u.useState(!1),r=c.useUnmarkAsTemplate(),o=()=>{n(!0),r.mutate(i,{onSuccess:()=>{n(!1),a()},onError:()=>{n(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:a,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Unmark as template"}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:"Are you sure you want to unmark this page as a template?"})]}),e.jsxs(t.DialogFooter,{className:s?"pointer-events-none opacity-75":"",children:[e.jsx(t.Button,{variant:"outline",onClick:l=>{l.stopPropagation(),a()},children:"Cancel"}),e.jsx(t.Button,{variant:"default",disabled:s,onClick:o,children:"Unmark as template"})]})]})})};exports.default=d;
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { o as c } from "./index-Byi6-4u1.js";
2
+ import { o as c } from "./index-DFvsMFVH.js";
3
3
  import { Dialog as m, DialogContent as p, DialogHeader as d, DialogTitle as u, DialogDescription as h, DialogFooter as g, Button as r } from "@chaibuilder/sdk/ui";
4
4
  import { useState as f } from "react";
5
5
  const T = ({ page: i, onClose: a }) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("./index-DSUpSpeI.cjs"),e=require("@chaibuilder/sdk/ui"),o=({page:i,onClose:t})=>{const{mutate:r,isPending:l}=s.useUnpublishPage(),c=async()=>{r(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:"Confirm action"}),n.jsxs(e.DialogDescription,{children:[s.CONTENT.UNPUBLISH_MSG," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:"Cancel"}),n.jsx(e.Button,{variant:"destructive",disabled:l,onClick:c,children:l?s.CONTENT.UPDATING:s.CONTENT.UNPUBLISH})]})]})})};exports.default=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("./index-Qnh8Lkr0.cjs"),e=require("@chaibuilder/sdk/ui"),o=({page:i,onClose:t})=>{const{mutate:r,isPending:l}=s.useUnpublishPage(),c=async()=>{r(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:"Confirm action"}),n.jsxs(e.DialogDescription,{children:[s.CONTENT.UNPUBLISH_MSG," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:"Cancel"}),n.jsx(e.Button,{variant:"destructive",disabled:l,onClick:c,children:l?s.CONTENT.UPDATING:s.CONTENT.UNPUBLISH})]})]})})};exports.default=o;
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
- import { l as d, C as r } from "./index-Byi6-4u1.js";
2
+ import { l as d, C as r } from "./index-DFvsMFVH.js";
3
3
  import { Dialog as h, DialogContent as a, DialogHeader as u, DialogTitle as m, DialogDescription as U, DialogFooter as D, Button as e } from "@chaibuilder/sdk/ui";
4
4
  const f = ({ page: i, onClose: o }) => {
5
5
  const { mutate: s, isPending: t } = d(), c = async () => {
@@ -1,7 +1,7 @@
1
1
  import { useAtom as A } from "jotai";
2
2
  import { useCallback as p } from "react";
3
3
  import { isEmpty as i, uniq as S, union as y, flatMap as P, find as O, includes as q, filter as C } from "lodash-es";
4
- import { q as F } from "./index-Byi6-4u1.js";
4
+ import { q as F } from "./index-DFvsMFVH.js";
5
5
  const M = F("expandedPagesState", []), m = (e) => P(e, (n) => [
6
6
  n,
7
7
  ...n.children ? m(n.children) : []
@@ -1 +1 @@
1
- "use strict";const m=require("jotai"),p=require("react"),n=require("lodash-es"),y=require("./index-DSUpSpeI.cjs"),A=y.atomWithStorage("expandedPagesState",[]),E=s=>n.flatMap(s,e=>[e,...e.children?E(e.children):[]]),S=(s,e)=>{const t=(a,i=[])=>{for(const r of a){const o=[...i,r.id];if(r.id===e)return o;if(r.children&&r.children.length>0){const d=t(r.children,o);if(d)return d}}return null};return t(s)||[]},P=(s,e)=>{if(!e)return[];const t=E(s),a=n.find(t,i=>i.id===e);if(a){if(a.parent)return[...P(s,a.parent),e];const i=S(s,e);if(!n.isEmpty(i))return i}return[e]},C=s=>{const e=new Set,t=(a,i=[])=>{a.forEach(r=>{const o=[...i,r.id];r.shouldExpandOnSearch&&o.forEach(d=>e.add(d)),r.children&&!n.isEmpty(r.children)&&t(r.children,o)})};return t(s),Array.from(e)},b=s=>{const[e,t]=m.useAtom(A),a=s?n.includes(e,s):!1,i=p.useCallback(()=>{t(c=>a?n.filter(c,l=>l!==s):[...c,s])},[t,a,s]),r=p.useCallback((c,l)=>{if(!l||n.isEmpty(c))return;const h=E(c),u=P(h,l);if(!Array.isArray(u)||n.isEmpty(u))return;const f=u.slice(0,-1);n.isEmpty(f)||t(g=>n.uniq([...g,...f]))},[t]),o=p.useCallback(c=>{if(n.isEmpty(c))return;const l=C(c);n.isEmpty(l)||t(h=>n.union(h,l))},[t]),d=p.useCallback(c=>{if(n.isEmpty(c))return;const l=n.flatMap(c,h=>{const u=f=>[f.id,...f.children?n.flatMap(f.children,u):[]];return u(h)});t(l)},[t]),x=p.useCallback(()=>{t([])},[t]);return{isExpanded:a,toggleExpanded:i,updateForSelectedPage:r,expandedPages:e,expandPagesOnSearch:o,setExpandedPages:t,expandAll:d,collapseAll:x}};exports.usePageExpandManager=b;
1
+ "use strict";const m=require("jotai"),p=require("react"),n=require("lodash-es"),y=require("./index-Qnh8Lkr0.cjs"),A=y.atomWithStorage("expandedPagesState",[]),E=s=>n.flatMap(s,e=>[e,...e.children?E(e.children):[]]),S=(s,e)=>{const t=(a,i=[])=>{for(const r of a){const o=[...i,r.id];if(r.id===e)return o;if(r.children&&r.children.length>0){const d=t(r.children,o);if(d)return d}}return null};return t(s)||[]},P=(s,e)=>{if(!e)return[];const t=E(s),a=n.find(t,i=>i.id===e);if(a){if(a.parent)return[...P(s,a.parent),e];const i=S(s,e);if(!n.isEmpty(i))return i}return[e]},C=s=>{const e=new Set,t=(a,i=[])=>{a.forEach(r=>{const o=[...i,r.id];r.shouldExpandOnSearch&&o.forEach(d=>e.add(d)),r.children&&!n.isEmpty(r.children)&&t(r.children,o)})};return t(s),Array.from(e)},b=s=>{const[e,t]=m.useAtom(A),a=s?n.includes(e,s):!1,i=p.useCallback(()=>{t(c=>a?n.filter(c,l=>l!==s):[...c,s])},[t,a,s]),r=p.useCallback((c,l)=>{if(!l||n.isEmpty(c))return;const h=E(c),u=P(h,l);if(!Array.isArray(u)||n.isEmpty(u))return;const f=u.slice(0,-1);n.isEmpty(f)||t(g=>n.uniq([...g,...f]))},[t]),o=p.useCallback(c=>{if(n.isEmpty(c))return;const l=C(c);n.isEmpty(l)||t(h=>n.union(h,l))},[t]),d=p.useCallback(c=>{if(n.isEmpty(c))return;const l=n.flatMap(c,h=>{const u=f=>[f.id,...f.children?n.flatMap(f.children,u):[]];return u(h)});t(l)},[t]),x=p.useCallback(()=>{t([])},[t]);return{isExpanded:a,toggleExpanded:i,updateForSelectedPage:r,expandedPages:e,expandPagesOnSearch:o,setExpandedPages:t,expandAll:d,collapseAll:x}};exports.usePageExpandManager=b;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-DSUpSpeI.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:l,setIframeWidth:i})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>i(s),variant:s===t?"default":"ghost",children:l}),p=()=>{const[t,s]=o.useState(1200),l=r=>s(r),[i,d]=h.useAtom(c.previewUrlAtom);if(!i)return null;const u=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,r=>o.createElement(w,{...r,setIframeWidth:l,key:r.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:u,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:i})]})};exports.default=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-Qnh8Lkr0.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:l,setIframeWidth:i})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>i(s),variant:s===t?"default":"ghost",children:l}),p=()=>{const[t,s]=o.useState(1200),l=r=>s(r),[i,d]=h.useAtom(c.previewUrlAtom);if(!i)return null;const u=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,r=>o.createElement(w,{...r,setIframeWidth:l,key:r.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:u,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:i})]})};exports.default=p;
@@ -4,7 +4,7 @@ import { Button as s } from "@chaibuilder/sdk/ui";
4
4
  import { useAtom as h } from "jotai";
5
5
  import { map as p } from "lodash-es";
6
6
  import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
7
- import { p as v, T as _ } from "./index-Byi6-4u1.js";
7
+ import { p as v, T as _ } from "./index-DFvsMFVH.js";
8
8
  const b = [
9
9
  {
10
10
  title: "mobile_xs_title",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Suraj Air",
4
4
  "license": "Private",
5
5
  "homepage": "https://chaibuilder.com",
6
- "version": "0.14.1",
6
+ "version": "0.14.3",
7
7
  "type": "module",
8
8
  "files": [
9
9
  "dist"
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@chaibuilder/runtime": "2.2.0",
68
- "@chaibuilder/sdk": "3.0.5",
68
+ "@chaibuilder/sdk": "3.0.8",
69
69
  "@types/react": "*",
70
70
  "@types/react-dom": "*",
71
71
  "jotai": "2.14.0",
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@chaibuilder/runtime": "2.2.0",
85
- "@chaibuilder/sdk": "3.0.5",
85
+ "@chaibuilder/sdk": "3.0.8",
86
86
  "@mhsdesign/jit-browser-tailwindcss": "^0.4.2",
87
87
  "@radix-ui/react-icons": "^1.3.2",
88
88
  "@supabase/supabase-js": "2.50.3",