@hubspot/cms-dev-server 1.0.7 → 1.0.10

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.
@@ -107,7 +107,7 @@ Error generating stack: `+l.message+`
107
107
  *
108
108
  * This source code is licensed under the ISC license.
109
109
  * See the LICENSE file in the root directory of this source tree.
110
- */const oy=st("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ly=e=>{navigator.clipboard.writeText(e)},ji=({Icon:e,iconClassName:t,tooltipText:n,isCircle:r=!1,canCopy:o=!1,...l})=>{const[i,s]=Ko.useState(!1);Ko.useEffect(()=>{if(i){const u=setTimeout(()=>{s(!1)},2e3);return()=>clearTimeout(u)}},[i]);const a=()=>{o&&(ly((n==null?void 0:n.toString())||""),s(!0))};return d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx(Ue,{variant:"outline",size:"icon",className:`w-10 h-10 min-w-10 p-0 flex items-center justify-center ${r?"rounded-full":""}`,onClick:a,children:i?d.jsx(q0,{className:t,strokeWidth:3,...l}):e&&d.jsx(e,{className:t,strokeWidth:3,...l})})}),d.jsx(hn,{side:"bottom",className:"max-w-[200px] font-medium",children:n})]})},Tc=({count:e,label:t,subText:n,onClick:r})=>d.jsxs("div",{onClick:r,className:"flex-1 md:flex-none md:w-[170px] h-36 px-8 py-6 bg-white rounded-lg flex flex-col justify-center items-center gap-1 text-gray-900 cursor-pointer",children:[d.jsx("div",{className:"text-2xl font-light",children:e}),d.jsx("div",{className:"text-xs font-semibold uppercase leading-4",children:t}),d.jsx("div",{className:"text-xs font-light leading-8",children:n})]}),iy=({modulesData:e,partialsData:t})=>d.jsxs("div",{className:"flex flex-row md:flex-row justify-start gap-4 w-full",children:[d.jsx(Tc,{count:e.length,label:e.length===1?"Module":"Modules",subText:"In this Project",onClick:()=>{var n;return(n=document.getElementById("modules-table"))==null?void 0:n.scrollIntoView({behavior:"smooth"})}}),d.jsx(Tc,{count:t.length,label:t.length===1?"Partial":"Partials",subText:"In this Project",onClick:()=>{var n;return(n=document.getElementById("partials-table"))==null?void 0:n.scrollIntoView({behavior:"smooth"})}})]}),sy=({cliCommands:e=[]})=>d.jsx("div",{className:"flex flex-col justify-end items-start min-h-36 p-6 bg-slate-900 rounded-xl gap-6 overflow-hidden",children:d.jsxs("div",{className:"flex flex-col justify-start items-start gap-6 w-full",children:[d.jsx("div",{className:"text-white text-xl font-medium leading-7",children:"Copy CLI Commands"}),d.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(100px,1fr))] auto-cols-fr gap-2 w-full px-1 py-1 bg-white rounded-md border border-slate-300 text-black text-sm font-medium leading-tight",children:e&&e.map(({scriptName:t,description:n,runCommand:r})=>d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{className:"h-8 px-3 py-1.5 bg-white flex items-center justify-center relative group cursor-pointer hover:bg-gray-100 active:bg-gray-200 max-w-[200px] mx-auto w-full",children:d.jsx("span",{children:t})})}),d.jsxs(hn,{side:"bottom",className:"bg-white font-medium p-4",children:[d.jsxs("div",{children:[d.jsx("div",{className:"font-medium text-base leading-none",children:"Copy Command"}),d.jsxs("div",{className:"font-light text-sm leading-5 mt-2 mb-4",children:[d.jsx("strong",{className:"font-bold",children:r}),d.jsx("br",{}),n]})]}),d.jsx("div",{className:"flex justify-end",children:d.jsxs(Ue,{size:"sm",variant:"default",onClick:()=>navigator.clipboard.writeText(r),children:[d.jsx(Qp,{})," Copy"]})})]})]},t))})]})}),ay=({projectName:e,authedPortalId:t,modulesData:n,partialsData:r,hubLModules:o,cliCommands:l,projectData:i,authedEnv:s})=>{const a=!!t,u=a?"You are connected to your HubSpot account":'You are not connected to your HubSpot Account. Please run "hs init" to connect and view content in the dev server.',c=[...n,...o],f=()=>{try{const v=`${Va(s)}/developer-projects/${t}/project/${e}`;window.open(v,"_blank")}catch(h){console.error("Failed to open project in app:",h)}};return d.jsxs("div",{className:"w-full h-full bg-gray-200 rounded-3xl px-10 py-8",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"text-gray-900 text-2xl font-semibold flex items-center gap-2 leading-6",children:["CMS Developer Server",a?d.jsx(ji,{Icon:ey,iconClassName:"text-green-500 w-4 h-4",tooltipText:u,isCircle:!0}):d.jsx(ji,{Icon:ry,iconClassName:"text-red-500 w-4 h-4",tooltipText:u,isCircle:!0})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(jc,{text:"Slack Community",Icon:Ho,url:"https://developers.hubspot.com/beta-docs/getting-started/slack/developer-slack",className:"hidden lg:block"}),d.jsx(jc,{text:"Getting started docs",Icon:Ho,url:"https://developers.hubspot.com/docs/cms/cms-react-quickstart?hs_preview=XztBJnma-168859451746",className:"hidden lg:block"}),t&&d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{children:d.jsxs(Ue,{size:"sm",variant:"default",onClick:f,disabled:!i,children:[d.jsx(Ho,{})," View in HubSpot"]})})}),d.jsx(hn,{children:d.jsxs("div",{children:["To view file in the HubSpot,",d.jsx("br",{}),'run "hs project upload".',d.jsx("br",{}),"If you encounter any issues",d.jsx("br",{}),"with this version, you can revert it in Projects."]})})]})]})]}),e&&d.jsx("div",{className:"w-full text-gray-900 text-4xl font-extrabold mt-5 mb-4",children:e}),d.jsx("div",{className:"flex items-center space-x-4 text-black text-sm font-light",children:t&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("strong",{children:"Portal ID:"}),d.jsx("span",{className:"mr-2",children:t}),d.jsx(ji,{Icon:ty,canCopy:!0,tooltipText:t})]})}),d.jsxs("div",{className:"flex flex-col md:flex-row w-full mt-10 gap-14",children:[d.jsx("div",{className:"md:flex-none",children:d.jsx(iy,{modulesData:c,partialsData:r})}),d.jsx("div",{className:"flex-grow",children:d.jsx(sy,{cliCommands:l})})]})]})},Ha=x.forwardRef(({className:e,containerClassName:t,...n},r)=>d.jsx("div",{className:le("relative w-full",t),children:d.jsx("table",{ref:r,className:le("w-full caption-bottom text-sm",e),...n})}));Ha.displayName="Table";const Qa=x.forwardRef(({className:e,...t},n)=>d.jsx("thead",{ref:n,className:le("[&_tr]:border-b",e),...t}));Qa.displayName="TableHeader";const Ga=x.forwardRef(({className:e,...t},n)=>d.jsx("tbody",{ref:n,className:le("[&_tr:last-child]:border-0",e),...t}));Ga.displayName="TableBody";const uy=x.forwardRef(({className:e,...t},n)=>d.jsx("tfoot",{ref:n,className:le("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));uy.displayName="TableFooter";const Xr=x.forwardRef(({className:e,...t},n)=>d.jsx("tr",{ref:n,className:le("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Xr.displayName="TableRow";const kl=x.forwardRef(({className:e,...t},n)=>d.jsx("th",{ref:n,className:le("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));kl.displayName="TableHead";const pt=x.forwardRef(({className:e,...t},n)=>d.jsx("td",{ref:n,className:le("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));pt.displayName="TableCell";const cy=x.forwardRef(({className:e,...t},n)=>d.jsx("caption",{ref:n,className:le("mt-4 text-sm text-muted-foreground",e),...t}));cy.displayName="TableCaption";function dy(){return d.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("g",{clipPath:"url(#clip0_5814_65268)",children:d.jsx("path",{d:"M19.7328 7.77091C19.4838 7.67469 19.2259 7.58365 18.9602 7.49755C19.0039 7.29749 19.044 7.10001 19.0796 6.90589C19.6644 3.71841 19.282 1.15055 17.9763 0.305104C16.7243 -0.505568 14.6767 0.339688 12.6087 2.3604C12.4099 2.55471 12.2104 2.76043 12.0111 2.97604C11.8783 2.83339 11.7457 2.69554 11.6134 2.56368C9.44613 0.403003 7.27375 -0.507535 5.96931 0.340359C4.71847 1.15338 4.34805 3.56741 4.87449 6.58821C4.92532 6.87999 4.98475 7.17795 5.05194 7.48091C4.74449 7.5789 4.44767 7.68337 4.16367 7.79451C1.62275 8.78918 0 10.3481 0 11.9651C0 13.6351 1.74202 15.3101 4.38859 16.3258C4.59745 16.406 4.81417 16.4818 5.0375 16.5537C4.96501 16.8814 4.90195 17.2025 4.84903 17.5156C4.34707 20.484 4.73906 22.841 5.98656 23.6489C7.27512 24.4832 9.43767 23.6256 11.5435 21.5589C11.7099 21.3955 11.8769 21.2222 12.0443 21.0406C12.2611 21.2751 12.4777 21.4971 12.6931 21.7053C14.7328 23.676 16.7473 24.4718 17.9937 23.6617C19.2809 22.825 19.6993 20.293 19.1561 17.2124C19.1147 16.9772 19.0664 16.7368 19.0122 16.4922C19.164 16.4418 19.3131 16.3897 19.4585 16.3356C22.2099 15.3121 24 13.6574 24 11.9651C24 10.3422 22.3249 8.77282 19.7328 7.77091ZM19.1361 15.2429C19.0048 15.2917 18.8702 15.3388 18.733 15.3845C18.4292 14.3049 18.0193 13.1568 17.5176 11.9707C17.9963 10.8128 18.3904 9.67938 18.6857 8.60672C18.9312 8.68648 19.1695 8.77062 19.3991 8.8594C21.62 9.71785 22.9747 10.9871 22.9747 11.9651C22.9747 13.0068 21.5117 14.3591 19.1361 15.2429ZM18.1504 17.436C18.3905 18.7982 18.4248 20.0298 18.2657 20.9925C18.1228 21.8576 17.8353 22.4344 17.4799 22.6654C16.7236 23.157 15.1061 22.518 13.3617 20.8326C13.1618 20.6394 12.9603 20.4331 12.7583 20.2148C13.4345 19.3843 14.1104 18.4189 14.77 17.3467C15.9303 17.2311 17.0264 17.0422 18.0204 16.7841C18.0694 17.0059 18.1129 17.2234 18.1504 17.436ZM8.18214 22.5805C7.44318 22.8735 6.85463 22.8819 6.49886 22.6516C5.74182 22.1613 5.42711 20.2689 5.8564 17.7303C5.90557 17.4396 5.96409 17.141 6.03155 16.8357C7.0147 17.0798 8.10281 17.2555 9.26581 17.3613C9.92989 18.4105 10.6253 19.3748 11.3261 20.2192C11.1729 20.3852 11.0204 20.5432 10.8688 20.6921C9.93762 21.606 9.0045 22.2544 8.18214 22.5805ZM4.72018 15.2365C3.54992 14.7874 2.58347 14.2037 1.92102 13.5668C1.32576 12.9944 1.02523 12.4261 1.02523 11.9651C1.02523 10.9838 2.32814 9.73224 4.50116 8.88156C4.76482 8.77834 5.04084 8.68106 5.32727 8.58969C5.62759 9.68657 6.02155 10.8334 6.49698 11.9931C6.0154 13.17 5.61584 14.3351 5.31258 15.4448C5.10838 15.3789 4.91054 15.3095 4.72018 15.2365ZM5.88066 6.36714C5.42963 3.77899 5.72918 1.82658 6.48297 1.33666C7.28588 0.814743 9.06136 1.55889 10.9326 3.42452C11.0523 3.54377 11.1723 3.66857 11.2928 3.7977C10.5955 4.6384 9.90644 5.59551 9.24825 6.63848C8.11952 6.75595 7.03905 6.94465 6.04565 7.19733C5.98319 6.91524 5.92787 6.6381 5.88066 6.36714ZM16.2332 9.23737C15.9957 8.7768 15.7519 8.32712 15.5034 7.88972C16.2691 7.99841 17.0028 8.14269 17.6918 8.31926C17.4849 9.06359 17.2271 9.84184 16.9236 10.6397C16.7059 10.1756 16.4757 9.70768 16.2332 9.23737ZM12.0114 4.62041C12.4844 5.19567 12.9579 5.83793 13.4238 6.53478C12.9544 6.50988 12.4791 6.49693 12 6.49693C11.5254 6.49693 11.0537 6.5096 10.5872 6.53406C11.0535 5.84369 11.5312 5.20228 12.0114 4.62041ZM7.76268 9.24533C7.52546 9.7072 7.29947 10.1726 7.08519 10.6388C6.78662 9.84376 6.5312 9.06196 6.32255 8.30707C7.00731 8.13502 7.73752 7.99433 8.4984 7.88771C8.24635 8.32914 8.00054 8.78213 7.76268 9.24524V9.24533ZM8.52031 16.1245C7.73418 16.026 6.993 15.8926 6.30841 15.7253C6.52039 14.9569 6.78145 14.1584 7.08634 13.3463C7.30118 13.8122 7.52806 14.2777 7.76674 14.7406H7.76678C8.0099 15.2122 8.26177 15.6741 8.52031 16.1245ZM12.0398 19.3909C11.5539 18.8022 11.0692 18.151 10.5958 17.4505C11.0553 17.4708 11.5238 17.4811 12 17.4811C12.4892 17.4811 12.9728 17.4688 13.4488 17.445C12.9814 18.158 12.5095 18.8102 12.0398 19.3909ZM16.9334 13.3049C17.2542 14.1258 17.5246 14.9201 17.7393 15.6754C17.0434 15.8537 16.2921 15.9972 15.5005 16.1039C15.7497 15.6606 15.9956 15.2032 16.2373 14.7327C16.4818 14.2567 16.7139 13.7799 16.9334 13.3049ZM15.3492 14.1576C14.974 14.888 14.5889 15.5852 14.1978 16.2433C13.4857 16.3005 12.7499 16.33 12 16.33C11.2531 16.33 10.5266 16.3039 9.82706 16.2529C9.42029 15.5861 9.02675 14.8869 8.65398 14.1639H8.65407C8.28228 13.4428 7.94009 12.7157 7.63003 11.9927C7.94001 11.268 8.28129 10.54 8.65095 9.8203L8.65086 9.82045C9.0215 9.0988 9.41157 8.40291 9.81459 7.74031C10.5283 7.67973 11.2603 7.64812 12 7.64812H12C12.743 7.64812 13.4759 7.67997 14.1894 7.74107C14.5863 8.39883 14.9737 9.09247 15.3458 9.81421C15.7221 10.5441 16.0678 11.2671 16.3804 11.9763C16.0688 12.6977 15.7238 13.4281 15.3492 14.1576ZM17.4642 1.30241C18.2679 1.8228 18.5804 3.9215 18.0755 6.67354C18.0433 6.84915 18.007 7.02801 17.9676 7.20928C16.9719 6.95131 15.8907 6.75936 14.7586 6.64011C14.0992 5.58568 13.4158 4.62708 12.7298 3.79717C12.9142 3.59797 13.0984 3.40802 13.2818 3.22877C15.0536 1.49744 16.7097 0.813879 17.4642 1.30241ZM12 9.55874C13.1836 9.55874 14.1431 10.6361 14.1431 11.9651C14.1431 13.294 13.1836 14.3714 12 14.3714C10.8164 14.3714 9.85688 13.294 9.85688 11.9651C9.85688 10.6361 10.8164 9.55874 12 9.55874Z",fill:"black"})}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_5814_65268",children:d.jsx("rect",{width:"24",height:"24",fill:"white"})})})]})}var Ti="focusScope.autoFocusOnMount",_i="focusScope.autoFocusOnUnmount",_c={bubbles:!1,cancelable:!0},fy="FocusScope",Gp=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...i}=e,[s,a]=x.useState(null),u=Ht(o),c=Ht(l),f=x.useRef(null),h=Ze(t,g=>a(g)),v=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let g=function(y){if(v.paused||!s)return;const C=y.target;s.contains(C)?f.current=C:jt(f.current,{select:!0})},S=function(y){if(v.paused||!s)return;const C=y.relatedTarget;C!==null&&(s.contains(C)||jt(f.current,{select:!0}))},m=function(y){if(document.activeElement===document.body)for(const k of y)k.removedNodes.length>0&&jt(s)};document.addEventListener("focusin",g),document.addEventListener("focusout",S);const p=new MutationObserver(m);return s&&p.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",S),p.disconnect()}}},[r,s,v.paused]),x.useEffect(()=>{if(s){bc.add(v);const g=document.activeElement;if(!s.contains(g)){const m=new CustomEvent(Ti,_c);s.addEventListener(Ti,u),s.dispatchEvent(m),m.defaultPrevented||(py(yy(Kp(s)),{select:!0}),document.activeElement===g&&jt(s))}return()=>{s.removeEventListener(Ti,u),setTimeout(()=>{const m=new CustomEvent(_i,_c);s.addEventListener(_i,c),s.dispatchEvent(m),m.defaultPrevented||jt(g??document.body,{select:!0}),s.removeEventListener(_i,c),bc.remove(v)},0)}}},[s,u,c,v]);const w=x.useCallback(g=>{if(!n&&!r||v.paused)return;const S=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,m=document.activeElement;if(S&&m){const p=g.currentTarget,[y,C]=hy(p);y&&C?!g.shiftKey&&m===C?(g.preventDefault(),n&&jt(y,{select:!0})):g.shiftKey&&m===y&&(g.preventDefault(),n&&jt(C,{select:!0})):m===p&&g.preventDefault()}},[n,r,v.paused]);return d.jsx(we.div,{tabIndex:-1,...i,ref:h,onKeyDown:w})});Gp.displayName=fy;function py(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(jt(r,{select:t}),document.activeElement!==n)return}function hy(e){const t=Kp(e),n=Rc(t,e),r=Rc(t.reverse(),e);return[n,r]}function Kp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Rc(e,t){for(const n of e)if(!my(n,{upTo:t}))return n}function my(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vy(e){return e instanceof HTMLInputElement&&"select"in e}function jt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vy(e)&&t&&e.select()}}var bc=gy();function gy(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Oc(e,t),e.unshift(t)},remove(t){var n;e=Oc(e,t),(n=e[0])==null||n.resume()}}}function Oc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yy(e){return e.filter(t=>t.tagName!=="A")}var Ri=0;function xy(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ac()),document.body.insertAdjacentElement("beforeend",e[1]??Ac()),Ri++,()=>{Ri===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ri--}},[])}function Ac(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ot=function(){return Ot=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ot.apply(this,arguments)};function wy(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Cy(e,t,n){for(var r=0,o=t.length,l;r<o;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var Qo="right-scroll-bar-position",Go="width-before-scroll-bar",Sy="with-scroll-bars-hidden",ky="--removed-body-scroll-bar-size";function bi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ey(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ny=typeof window<"u"?x.useLayoutEffect:x.useEffect,Lc=new WeakMap;function Py(e,t){var n=Ey(null,function(r){return e.forEach(function(o){return bi(o,r)})});return Ny(function(){var r=Lc.get(n);if(r){var o=new Set(r),l=new Set(e),i=n.current;o.forEach(function(s){l.has(s)||bi(s,null)}),l.forEach(function(s){o.has(s)||bi(s,i)})}Lc.set(n,e)},[e]),n}var El=function(){return El=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},El.apply(this,arguments)};function jy(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Ty(e){return e}function _y(e,t){t===void 0&&(t=Ty);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var i=t(l,r);return n.push(i),function(){n=n.filter(function(s){return s!==i})}},assignSyncMedium:function(l){for(r=!0;n.length;){var i=n;n=[],i.forEach(l)}n={push:function(s){return l(s)},filter:function(){return n}}},assignMedium:function(l){r=!0;var i=[];if(n.length){var s=n;n=[],s.forEach(l),i=n}var a=function(){var c=i;i=[],c.forEach(l)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){i.push(c),u()},filter:function(c){return i=i.filter(c),n}}}};return o}function Ry(e){e===void 0&&(e={});var t=_y(null);return t.options=El({async:!0,ssr:!1},e),t}var Yp=function(e){var t=e.sideCar,n=jy(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,El({},n))};Yp.isSideCarExport=!0;function by(e,t){return e.useMedium(t),Yp}var Xp=Ry(),Oi=function(){},Zl=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Oi,onWheelCapture:Oi,onTouchMoveCapture:Oi}),o=r[0],l=r[1],i=e.forwardProps,s=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,f=e.shards,h=e.sideCar,v=e.noIsolation,w=e.inert,g=e.allowPinchZoom,S=e.as,m=S===void 0?"div":S,p=e.gapMode,y=wy(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,k=Py([n,t]),N=Ot(Ot({},y),o);return x.createElement(x.Fragment,null,c&&x.createElement(C,{sideCar:Xp,removeScrollBar:u,shards:f,noIsolation:v,inert:w,setCallbacks:l,allowPinchZoom:!!g,lockRef:n,gapMode:p}),i?x.cloneElement(x.Children.only(s),Ot(Ot({},N),{ref:k})):x.createElement(m,Ot({},N,{className:a,ref:k}),s))});Zl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Zl.classNames={fullWidth:Go,zeroRight:Qo};var Oy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ay(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Oy();return t&&e.setAttribute("nonce",t),e}function Ly(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function My(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Dy=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ay())&&(Ly(t,n),My(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zy=function(){var e=Dy();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zp=function(){var e=zy(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Iy={left:0,top:0,right:0,gap:0},Ai=function(e){return parseInt(e||"",10)||0},Fy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ai(n),Ai(r),Ai(o)]},$y=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Iy;var t=Fy(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Uy=Zp(),Vn="data-scroll-locked",Wy=function(e,t,n,r){var o=e.left,l=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),`
110
+ */const oy=st("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ly=e=>{navigator.clipboard.writeText(e)},ji=({Icon:e,iconClassName:t,tooltipText:n,isCircle:r=!1,canCopy:o=!1,...l})=>{const[i,s]=Ko.useState(!1);Ko.useEffect(()=>{if(i){const u=setTimeout(()=>{s(!1)},2e3);return()=>clearTimeout(u)}},[i]);const a=()=>{o&&(ly((n==null?void 0:n.toString())||""),s(!0))};return d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx(Ue,{variant:"outline",size:"icon",className:`w-10 h-10 min-w-10 p-0 flex items-center justify-center ${r?"rounded-full":""}`,onClick:a,children:i?d.jsx(q0,{className:t,strokeWidth:3,...l}):e&&d.jsx(e,{className:t,strokeWidth:3,...l})})}),d.jsx(hn,{side:"bottom",className:"max-w-[200px] font-medium",children:n})]})},Tc=({count:e,label:t,subText:n,onClick:r})=>d.jsxs("div",{onClick:r,className:"flex-1 md:flex-none md:w-[170px] h-36 px-8 py-6 bg-white rounded-lg flex flex-col justify-center items-center gap-1 text-gray-900 cursor-pointer",children:[d.jsx("div",{className:"text-2xl font-light",children:e}),d.jsx("div",{className:"text-xs font-semibold uppercase leading-4",children:t}),d.jsx("div",{className:"text-xs font-light leading-8",children:n})]}),iy=({modulesData:e,partialsData:t,projectName:n})=>d.jsxs("div",{className:"flex flex-row md:flex-row justify-start gap-4 w-full",children:[d.jsx(Tc,{count:e.length,label:e.length===1?"Module":"Modules",subText:n?"In this Project":"Available",onClick:()=>{var r;return(r=document.getElementById("modules-table"))==null?void 0:r.scrollIntoView({behavior:"smooth"})}}),d.jsx(Tc,{count:t.length,label:t.length===1?"Partial":"Partials",subText:n?"In this Project":"Available",onClick:()=>{var r;return(r=document.getElementById("partials-table"))==null?void 0:r.scrollIntoView({behavior:"smooth"})}})]}),sy=({cliCommands:e=[]})=>d.jsx("div",{className:"flex flex-col justify-end items-start min-h-36 p-6 bg-slate-900 rounded-xl gap-6 overflow-hidden",children:d.jsxs("div",{className:"flex flex-col justify-start items-start gap-6 w-full",children:[d.jsx("div",{className:"text-white text-xl font-medium leading-7",children:"Copy CLI Commands"}),d.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(100px,1fr))] auto-cols-fr gap-2 w-full px-1 py-1 bg-white rounded-md border border-slate-300 text-black text-sm font-medium leading-tight",children:e&&e.map(({scriptName:t,description:n,runCommand:r})=>d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{className:"h-8 px-3 py-1.5 bg-white flex items-center justify-center relative group cursor-pointer hover:bg-gray-100 active:bg-gray-200 max-w-[200px] mx-auto w-full",children:d.jsx("span",{children:t})})}),d.jsxs(hn,{side:"bottom",className:"bg-white font-medium p-4",children:[d.jsxs("div",{children:[d.jsx("div",{className:"font-medium text-base leading-none",children:"Copy Command"}),d.jsxs("div",{className:"font-light text-sm leading-5 mt-2 mb-4",children:[d.jsx("strong",{className:"font-bold",children:r}),d.jsx("br",{}),n]})]}),d.jsx("div",{className:"flex justify-end",children:d.jsxs(Ue,{size:"sm",variant:"default",onClick:()=>navigator.clipboard.writeText(r),children:[d.jsx(Qp,{})," Copy"]})})]})]},t))})]})}),ay=({projectName:e,authedPortalId:t,modulesData:n,partialsData:r,hubLModules:o,cliCommands:l,projectData:i,authedEnv:s})=>{const a=!!t,u=a?"You are connected to your HubSpot account":'You are not connected to your HubSpot Account. Please run "hs init" to connect and view content in the dev server.',c=[...n,...o],f=()=>{try{const v=`${Va(s)}/developer-projects/${t}/project/${e}`;window.open(v,"_blank")}catch(h){console.error("Failed to open project in app:",h)}};return d.jsxs("div",{className:"w-full h-full bg-gray-200 rounded-3xl px-10 py-8",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"text-gray-900 text-2xl font-semibold flex items-center gap-2 leading-6",children:["CMS Developer Server",a?d.jsx(ji,{Icon:ey,iconClassName:"text-green-500 w-4 h-4",tooltipText:u,isCircle:!0}):d.jsx(ji,{Icon:ry,iconClassName:"text-red-500 w-4 h-4",tooltipText:u,isCircle:!0})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(jc,{text:"Slack Community",Icon:Ho,url:"https://developers.hubspot.com/beta-docs/getting-started/slack/developer-slack",className:"hidden lg:block"}),d.jsx(jc,{text:"Getting started docs",Icon:Ho,url:"https://developers.hubspot.com/docs/cms/cms-react-quickstart?hs_preview=XztBJnma-168859451746",className:"hidden lg:block"}),t&&e&&d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{children:d.jsxs(Ue,{size:"sm",variant:"default",onClick:f,disabled:!i,children:[d.jsx(Ho,{})," View in HubSpot"]})})}),d.jsx(hn,{children:d.jsxs("div",{children:["To view file in the HubSpot,",d.jsx("br",{}),'run "hs project upload".',d.jsx("br",{}),"If you encounter any issues",d.jsx("br",{}),"with this version, you can revert it in Projects."]})})]})]})]}),e&&d.jsx("div",{className:"w-full text-gray-900 text-4xl font-extrabold mt-5 mb-4",children:e}),d.jsx("div",{className:"flex items-center space-x-4 text-black text-sm font-light",children:t&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("strong",{children:"Portal ID:"}),d.jsx("span",{className:"mr-2",children:t}),d.jsx(ji,{Icon:ty,canCopy:!0,tooltipText:t})]})}),d.jsxs("div",{className:"flex flex-col md:flex-row w-full mt-10 gap-14",children:[d.jsx("div",{className:"md:flex-none",children:d.jsx(iy,{modulesData:c,partialsData:r,projectName:e})}),e&&d.jsx("div",{className:"flex-grow",children:d.jsx(sy,{cliCommands:l})})]})]})},Ha=x.forwardRef(({className:e,containerClassName:t,...n},r)=>d.jsx("div",{className:le("relative w-full",t),children:d.jsx("table",{ref:r,className:le("w-full caption-bottom text-sm",e),...n})}));Ha.displayName="Table";const Qa=x.forwardRef(({className:e,...t},n)=>d.jsx("thead",{ref:n,className:le("[&_tr]:border-b",e),...t}));Qa.displayName="TableHeader";const Ga=x.forwardRef(({className:e,...t},n)=>d.jsx("tbody",{ref:n,className:le("[&_tr:last-child]:border-0",e),...t}));Ga.displayName="TableBody";const uy=x.forwardRef(({className:e,...t},n)=>d.jsx("tfoot",{ref:n,className:le("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));uy.displayName="TableFooter";const Xr=x.forwardRef(({className:e,...t},n)=>d.jsx("tr",{ref:n,className:le("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Xr.displayName="TableRow";const kl=x.forwardRef(({className:e,...t},n)=>d.jsx("th",{ref:n,className:le("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));kl.displayName="TableHead";const pt=x.forwardRef(({className:e,...t},n)=>d.jsx("td",{ref:n,className:le("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));pt.displayName="TableCell";const cy=x.forwardRef(({className:e,...t},n)=>d.jsx("caption",{ref:n,className:le("mt-4 text-sm text-muted-foreground",e),...t}));cy.displayName="TableCaption";function dy(){return d.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("g",{clipPath:"url(#clip0_5814_65268)",children:d.jsx("path",{d:"M19.7328 7.77091C19.4838 7.67469 19.2259 7.58365 18.9602 7.49755C19.0039 7.29749 19.044 7.10001 19.0796 6.90589C19.6644 3.71841 19.282 1.15055 17.9763 0.305104C16.7243 -0.505568 14.6767 0.339688 12.6087 2.3604C12.4099 2.55471 12.2104 2.76043 12.0111 2.97604C11.8783 2.83339 11.7457 2.69554 11.6134 2.56368C9.44613 0.403003 7.27375 -0.507535 5.96931 0.340359C4.71847 1.15338 4.34805 3.56741 4.87449 6.58821C4.92532 6.87999 4.98475 7.17795 5.05194 7.48091C4.74449 7.5789 4.44767 7.68337 4.16367 7.79451C1.62275 8.78918 0 10.3481 0 11.9651C0 13.6351 1.74202 15.3101 4.38859 16.3258C4.59745 16.406 4.81417 16.4818 5.0375 16.5537C4.96501 16.8814 4.90195 17.2025 4.84903 17.5156C4.34707 20.484 4.73906 22.841 5.98656 23.6489C7.27512 24.4832 9.43767 23.6256 11.5435 21.5589C11.7099 21.3955 11.8769 21.2222 12.0443 21.0406C12.2611 21.2751 12.4777 21.4971 12.6931 21.7053C14.7328 23.676 16.7473 24.4718 17.9937 23.6617C19.2809 22.825 19.6993 20.293 19.1561 17.2124C19.1147 16.9772 19.0664 16.7368 19.0122 16.4922C19.164 16.4418 19.3131 16.3897 19.4585 16.3356C22.2099 15.3121 24 13.6574 24 11.9651C24 10.3422 22.3249 8.77282 19.7328 7.77091ZM19.1361 15.2429C19.0048 15.2917 18.8702 15.3388 18.733 15.3845C18.4292 14.3049 18.0193 13.1568 17.5176 11.9707C17.9963 10.8128 18.3904 9.67938 18.6857 8.60672C18.9312 8.68648 19.1695 8.77062 19.3991 8.8594C21.62 9.71785 22.9747 10.9871 22.9747 11.9651C22.9747 13.0068 21.5117 14.3591 19.1361 15.2429ZM18.1504 17.436C18.3905 18.7982 18.4248 20.0298 18.2657 20.9925C18.1228 21.8576 17.8353 22.4344 17.4799 22.6654C16.7236 23.157 15.1061 22.518 13.3617 20.8326C13.1618 20.6394 12.9603 20.4331 12.7583 20.2148C13.4345 19.3843 14.1104 18.4189 14.77 17.3467C15.9303 17.2311 17.0264 17.0422 18.0204 16.7841C18.0694 17.0059 18.1129 17.2234 18.1504 17.436ZM8.18214 22.5805C7.44318 22.8735 6.85463 22.8819 6.49886 22.6516C5.74182 22.1613 5.42711 20.2689 5.8564 17.7303C5.90557 17.4396 5.96409 17.141 6.03155 16.8357C7.0147 17.0798 8.10281 17.2555 9.26581 17.3613C9.92989 18.4105 10.6253 19.3748 11.3261 20.2192C11.1729 20.3852 11.0204 20.5432 10.8688 20.6921C9.93762 21.606 9.0045 22.2544 8.18214 22.5805ZM4.72018 15.2365C3.54992 14.7874 2.58347 14.2037 1.92102 13.5668C1.32576 12.9944 1.02523 12.4261 1.02523 11.9651C1.02523 10.9838 2.32814 9.73224 4.50116 8.88156C4.76482 8.77834 5.04084 8.68106 5.32727 8.58969C5.62759 9.68657 6.02155 10.8334 6.49698 11.9931C6.0154 13.17 5.61584 14.3351 5.31258 15.4448C5.10838 15.3789 4.91054 15.3095 4.72018 15.2365ZM5.88066 6.36714C5.42963 3.77899 5.72918 1.82658 6.48297 1.33666C7.28588 0.814743 9.06136 1.55889 10.9326 3.42452C11.0523 3.54377 11.1723 3.66857 11.2928 3.7977C10.5955 4.6384 9.90644 5.59551 9.24825 6.63848C8.11952 6.75595 7.03905 6.94465 6.04565 7.19733C5.98319 6.91524 5.92787 6.6381 5.88066 6.36714ZM16.2332 9.23737C15.9957 8.7768 15.7519 8.32712 15.5034 7.88972C16.2691 7.99841 17.0028 8.14269 17.6918 8.31926C17.4849 9.06359 17.2271 9.84184 16.9236 10.6397C16.7059 10.1756 16.4757 9.70768 16.2332 9.23737ZM12.0114 4.62041C12.4844 5.19567 12.9579 5.83793 13.4238 6.53478C12.9544 6.50988 12.4791 6.49693 12 6.49693C11.5254 6.49693 11.0537 6.5096 10.5872 6.53406C11.0535 5.84369 11.5312 5.20228 12.0114 4.62041ZM7.76268 9.24533C7.52546 9.7072 7.29947 10.1726 7.08519 10.6388C6.78662 9.84376 6.5312 9.06196 6.32255 8.30707C7.00731 8.13502 7.73752 7.99433 8.4984 7.88771C8.24635 8.32914 8.00054 8.78213 7.76268 9.24524V9.24533ZM8.52031 16.1245C7.73418 16.026 6.993 15.8926 6.30841 15.7253C6.52039 14.9569 6.78145 14.1584 7.08634 13.3463C7.30118 13.8122 7.52806 14.2777 7.76674 14.7406H7.76678C8.0099 15.2122 8.26177 15.6741 8.52031 16.1245ZM12.0398 19.3909C11.5539 18.8022 11.0692 18.151 10.5958 17.4505C11.0553 17.4708 11.5238 17.4811 12 17.4811C12.4892 17.4811 12.9728 17.4688 13.4488 17.445C12.9814 18.158 12.5095 18.8102 12.0398 19.3909ZM16.9334 13.3049C17.2542 14.1258 17.5246 14.9201 17.7393 15.6754C17.0434 15.8537 16.2921 15.9972 15.5005 16.1039C15.7497 15.6606 15.9956 15.2032 16.2373 14.7327C16.4818 14.2567 16.7139 13.7799 16.9334 13.3049ZM15.3492 14.1576C14.974 14.888 14.5889 15.5852 14.1978 16.2433C13.4857 16.3005 12.7499 16.33 12 16.33C11.2531 16.33 10.5266 16.3039 9.82706 16.2529C9.42029 15.5861 9.02675 14.8869 8.65398 14.1639H8.65407C8.28228 13.4428 7.94009 12.7157 7.63003 11.9927C7.94001 11.268 8.28129 10.54 8.65095 9.8203L8.65086 9.82045C9.0215 9.0988 9.41157 8.40291 9.81459 7.74031C10.5283 7.67973 11.2603 7.64812 12 7.64812H12C12.743 7.64812 13.4759 7.67997 14.1894 7.74107C14.5863 8.39883 14.9737 9.09247 15.3458 9.81421C15.7221 10.5441 16.0678 11.2671 16.3804 11.9763C16.0688 12.6977 15.7238 13.4281 15.3492 14.1576ZM17.4642 1.30241C18.2679 1.8228 18.5804 3.9215 18.0755 6.67354C18.0433 6.84915 18.007 7.02801 17.9676 7.20928C16.9719 6.95131 15.8907 6.75936 14.7586 6.64011C14.0992 5.58568 13.4158 4.62708 12.7298 3.79717C12.9142 3.59797 13.0984 3.40802 13.2818 3.22877C15.0536 1.49744 16.7097 0.813879 17.4642 1.30241ZM12 9.55874C13.1836 9.55874 14.1431 10.6361 14.1431 11.9651C14.1431 13.294 13.1836 14.3714 12 14.3714C10.8164 14.3714 9.85688 13.294 9.85688 11.9651C9.85688 10.6361 10.8164 9.55874 12 9.55874Z",fill:"black"})}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_5814_65268",children:d.jsx("rect",{width:"24",height:"24",fill:"white"})})})]})}var Ti="focusScope.autoFocusOnMount",_i="focusScope.autoFocusOnUnmount",_c={bubbles:!1,cancelable:!0},fy="FocusScope",Gp=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...i}=e,[s,a]=x.useState(null),u=Ht(o),c=Ht(l),f=x.useRef(null),h=Ze(t,g=>a(g)),v=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let g=function(y){if(v.paused||!s)return;const C=y.target;s.contains(C)?f.current=C:jt(f.current,{select:!0})},S=function(y){if(v.paused||!s)return;const C=y.relatedTarget;C!==null&&(s.contains(C)||jt(f.current,{select:!0}))},m=function(y){if(document.activeElement===document.body)for(const k of y)k.removedNodes.length>0&&jt(s)};document.addEventListener("focusin",g),document.addEventListener("focusout",S);const p=new MutationObserver(m);return s&&p.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",S),p.disconnect()}}},[r,s,v.paused]),x.useEffect(()=>{if(s){bc.add(v);const g=document.activeElement;if(!s.contains(g)){const m=new CustomEvent(Ti,_c);s.addEventListener(Ti,u),s.dispatchEvent(m),m.defaultPrevented||(py(yy(Kp(s)),{select:!0}),document.activeElement===g&&jt(s))}return()=>{s.removeEventListener(Ti,u),setTimeout(()=>{const m=new CustomEvent(_i,_c);s.addEventListener(_i,c),s.dispatchEvent(m),m.defaultPrevented||jt(g??document.body,{select:!0}),s.removeEventListener(_i,c),bc.remove(v)},0)}}},[s,u,c,v]);const w=x.useCallback(g=>{if(!n&&!r||v.paused)return;const S=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,m=document.activeElement;if(S&&m){const p=g.currentTarget,[y,C]=hy(p);y&&C?!g.shiftKey&&m===C?(g.preventDefault(),n&&jt(y,{select:!0})):g.shiftKey&&m===y&&(g.preventDefault(),n&&jt(C,{select:!0})):m===p&&g.preventDefault()}},[n,r,v.paused]);return d.jsx(we.div,{tabIndex:-1,...i,ref:h,onKeyDown:w})});Gp.displayName=fy;function py(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(jt(r,{select:t}),document.activeElement!==n)return}function hy(e){const t=Kp(e),n=Rc(t,e),r=Rc(t.reverse(),e);return[n,r]}function Kp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Rc(e,t){for(const n of e)if(!my(n,{upTo:t}))return n}function my(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vy(e){return e instanceof HTMLInputElement&&"select"in e}function jt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vy(e)&&t&&e.select()}}var bc=gy();function gy(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Oc(e,t),e.unshift(t)},remove(t){var n;e=Oc(e,t),(n=e[0])==null||n.resume()}}}function Oc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yy(e){return e.filter(t=>t.tagName!=="A")}var Ri=0;function xy(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ac()),document.body.insertAdjacentElement("beforeend",e[1]??Ac()),Ri++,()=>{Ri===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ri--}},[])}function Ac(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ot=function(){return Ot=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ot.apply(this,arguments)};function wy(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Cy(e,t,n){for(var r=0,o=t.length,l;r<o;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var Qo="right-scroll-bar-position",Go="width-before-scroll-bar",Sy="with-scroll-bars-hidden",ky="--removed-body-scroll-bar-size";function bi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ey(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ny=typeof window<"u"?x.useLayoutEffect:x.useEffect,Lc=new WeakMap;function Py(e,t){var n=Ey(null,function(r){return e.forEach(function(o){return bi(o,r)})});return Ny(function(){var r=Lc.get(n);if(r){var o=new Set(r),l=new Set(e),i=n.current;o.forEach(function(s){l.has(s)||bi(s,null)}),l.forEach(function(s){o.has(s)||bi(s,i)})}Lc.set(n,e)},[e]),n}var El=function(){return El=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},El.apply(this,arguments)};function jy(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Ty(e){return e}function _y(e,t){t===void 0&&(t=Ty);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var i=t(l,r);return n.push(i),function(){n=n.filter(function(s){return s!==i})}},assignSyncMedium:function(l){for(r=!0;n.length;){var i=n;n=[],i.forEach(l)}n={push:function(s){return l(s)},filter:function(){return n}}},assignMedium:function(l){r=!0;var i=[];if(n.length){var s=n;n=[],s.forEach(l),i=n}var a=function(){var c=i;i=[],c.forEach(l)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){i.push(c),u()},filter:function(c){return i=i.filter(c),n}}}};return o}function Ry(e){e===void 0&&(e={});var t=_y(null);return t.options=El({async:!0,ssr:!1},e),t}var Yp=function(e){var t=e.sideCar,n=jy(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,El({},n))};Yp.isSideCarExport=!0;function by(e,t){return e.useMedium(t),Yp}var Xp=Ry(),Oi=function(){},Zl=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Oi,onWheelCapture:Oi,onTouchMoveCapture:Oi}),o=r[0],l=r[1],i=e.forwardProps,s=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,f=e.shards,h=e.sideCar,v=e.noIsolation,w=e.inert,g=e.allowPinchZoom,S=e.as,m=S===void 0?"div":S,p=e.gapMode,y=wy(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,k=Py([n,t]),N=Ot(Ot({},y),o);return x.createElement(x.Fragment,null,c&&x.createElement(C,{sideCar:Xp,removeScrollBar:u,shards:f,noIsolation:v,inert:w,setCallbacks:l,allowPinchZoom:!!g,lockRef:n,gapMode:p}),i?x.cloneElement(x.Children.only(s),Ot(Ot({},N),{ref:k})):x.createElement(m,Ot({},N,{className:a,ref:k}),s))});Zl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Zl.classNames={fullWidth:Go,zeroRight:Qo};var Oy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ay(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Oy();return t&&e.setAttribute("nonce",t),e}function Ly(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function My(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Dy=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ay())&&(Ly(t,n),My(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zy=function(){var e=Dy();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zp=function(){var e=zy(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Iy={left:0,top:0,right:0,gap:0},Ai=function(e){return parseInt(e||"",10)||0},Fy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ai(n),Ai(r),Ai(o)]},$y=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Iy;var t=Fy(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Uy=Zp(),Vn="data-scroll-locked",Wy=function(e,t,n,r){var o=e.left,l=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),`
111
111
  .`.concat(Sy,` {
112
112
  overflow: hidden `).concat(r,`;
113
113
  padding-right: `).concat(s,"px ").concat(r,`;
@@ -151,4 +151,4 @@ Error generating stack: `+l.message+`
151
151
 
152
152
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
153
153
 
154
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},hx="DialogDescriptionWarning",mx=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yh(hx).contentName}}.`;return x.useEffect(()=>{var l;const o=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vx=oh,gx=ih,yx=ah,xh=uh,wh=ch,Ch=fh,Sh=hh,kh=vh;const xx=vx,wx=gx,Cx=kh,Sx=yx,Eh=x.forwardRef(({className:e,...t},n)=>d.jsx(xh,{className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Eh.displayName=xh.displayName;const kx=Vp("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Nh=x.forwardRef(({side:e="right",className:t,children:n,...r},o)=>d.jsxs(Sx,{children:[d.jsx(Eh,{}),d.jsxs(wh,{ref:o,className:le(kx({side:e}),t),...r,children:[n,d.jsxs(kh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[d.jsx(oy,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nh.displayName=wh.displayName;const Ph=({className:e,...t})=>d.jsx("div",{className:le("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ph.displayName="SheetHeader";const jh=({className:e,...t})=>d.jsx("div",{className:le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});jh.displayName="SheetFooter";const Th=x.forwardRef(({className:e,...t},n)=>d.jsx(Ch,{ref:n,className:le("text-lg font-semibold text-foreground",e),...t}));Th.displayName=Ch.displayName;const _h=x.forwardRef(({className:e,...t},n)=>d.jsx(Sh,{ref:n,className:le("text-sm text-muted-foreground",e),...t}));_h.displayName=Sh.displayName;var vn=(e=>(e.REACT="react",e.HUBL="hubl",e))(vn||{});function Mi({className:e,...t}){return d.jsx("div",{className:le("animate-pulse rounded-md bg-muted",e),...t})}function Ex(e,t){const[n,r]=x.useState({moduleDependencies:null,isLoading:!1,error:null});return x.useEffect(()=>{e&&(r(o=>({...o,isLoading:!0})),fetch(`/api/module-pages?path=${encodeURIComponent(e)}&portalId=${t}`).then(o=>o.ok?o.json():Promise.reject(new Error("Failed to fetch module pages"))).then(o=>r({moduleDependencies:o,isLoading:!1,error:null})).catch(o=>r({moduleDependencies:null,isLoading:!1,error:String(o)})))},[e]),n}const Nx=(e,t,n)=>`${Va(n)}/pages/${e}/editor/${t}/content`,Px=({pages:e,componentType:t,authedPortalId:n,authedEnv:r})=>{if(e.length===0)return d.jsxs("div",{children:["No pages found using this ",t]});function o(l){return l?l.split("_").map(i=>i.charAt(0)+i.slice(1).toLowerCase()).join(" "):""}return d.jsxs(Ha,{className:"border text-[16px]",containerClassName:"h-fit max-h-[770px] overflow-y-auto relative",children:[d.jsx(Qa,{children:d.jsxs(Xr,{children:[d.jsx(kl,{className:"border",children:"Page Name"}),d.jsx(kl,{className:"border",children:"Page Type"})]})}),d.jsx(Ga,{className:"overflow-y-auto",children:e.map((l,i)=>d.jsxs(Xr,{className:"odd:bg-white even:bg-gray-50",children:[d.jsx(pt,{className:"border",children:d.jsxs("a",{href:Nx(n,l.id,r),target:"_blank",className:"underline flex items-center gap-1",children:[l.label,d.jsx(Ho,{className:"w-4 h-4"})]})}),d.jsx(pt,{className:"border",children:o(l.subType)})]},i))})]})},jx=({componentType:e,authedPortalId:t,projectName:n,projectData:r,webRootProjectComponentFolder:o,isOpen:l,moduleData:i,authedEnv:s})=>{const a=i.type===vn.REACT?`@projects/${n}/${o}/components/modules/${i.nameWithExtension}`:i.subPath,{moduleDependencies:u,isLoading:c,error:f}=Ex(r&&l?a:null,t);return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex justify-between items-center mb-3 gap-8",children:[d.jsx("h2",{className:"text-2xl font-semibold leading-9 decoration-skip-ink",children:"Dependencies"}),r&&c?d.jsx(Mi,{className:"h-[20px] flex-1"}):r&&u&&d.jsx("span",{className:"text-lg font-bold leading-8",children:`${u.length} ${u.length===1?"page uses":"pages use"} this ${e}`})]}),r?c?d.jsxs("div",{className:"space-y-2",children:[d.jsx(Mi,{className:"h-[20px] w-full"}),d.jsx(Mi,{className:"h-[20px] w-full"})]}):f?d.jsxs("div",{className:"text-red-500",children:["Error loading dependencies: ",f]}):d.jsx(Px,{pages:u||[],componentType:e,authedPortalId:t,authedEnv:s}):d.jsx("div",{className:"text-sm text-gray-500 italic",children:'Please run "hs project upload" to see what pages this module is used on.'})]})},Tx=({moduleData:e,themeWebRoot:t})=>{var i;const n=JSON.stringify(e.fieldsJson,null,2),r=e.type===vn.REACT?e.subPath:`hubl/${(i=e.subPath)==null?void 0:i.split("/hubl/")[1]}`,o=e.type===vn.REACT?`${t}/${r}.${e.extension}`:`${t}/${r}.module/fields.json`,l=()=>{o&&fetch(`/api/open-file?path=${encodeURIComponent(o)}`).catch(s=>console.error("Failed to open file:",s))};return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("h2",{className:"text-2xl font-semibold leading-8",children:"JSON Fields"}),n?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"relative mt-6 mb-3",children:[d.jsx(Ue,{variant:"outline",size:"icon",className:"w-6 h-6 text-xs rounded-md absolute top-1.5 right-1.5 z-10 opacity-90",onClick:()=>navigator.clipboard.writeText(n),children:d.jsx(Qp,{})}),d.jsx("div",{className:"rounded-xl overflow-hidden p-4 bg-[#0F172A]",children:d.jsx("pre",{className:"text-[14px] font-medium leading-6 text-[#9CDCFE] whitespace-pre-wrap",children:n})})]}),d.jsx("div",{children:d.jsx(Ue,{variant:"outline",onClick:l,children:"View Code"})})]}):d.jsx("p",{children:"No fields found"})]})},_x=({moduleData:e,componentType:t,themeWebRoot:n,authedPortalId:r,projectName:o,webRootProjectComponentFolder:l,projectData:i,authedEnv:s,fieldBuilderEnabled:a,children:u})=>{var v;const[c,f]=x.useState(!1),h=t.charAt(0).toUpperCase()+t.slice(1);return d.jsxs(xx,{onOpenChange:f,children:[d.jsx(wx,{asChild:!0,children:u}),d.jsxs(Nh,{className:"sm:max-w-xl overflow-y-scroll","aria-describedby":"sheet-title",children:[d.jsxs(Ph,{children:[d.jsx(Th,{className:"text-xl font-semibold leading-8 pb-8",children:d.jsx("span",{id:"sheet-title",children:d.jsxs(d.Fragment,{children:[e.name," - ",h," Details"]})})}),d.jsxs(_h,{className:"text-sm leading-5",children:[d.jsx("strong",{children:"Directory Path:"})," ",e.type===vn.REACT?e.subPath:`hubl/${((v=e.subPath)==null?void 0:v.split("/hubl/")[1])||e.subPath}`]})]}),d.jsx("div",{className:"grid gap-6 pb-6 my-6 border-b border-gray-300",children:d.jsx(jx,{componentType:t,authedPortalId:r,projectName:o,projectData:i,webRootProjectComponentFolder:l,isOpen:c,moduleData:e,authedEnv:s})}),d.jsx("div",{className:"grid gap-6 my-6",children:a?d.jsx("h2",{className:"text-2xl font-semibold leading-8",children:"Field Builder Placeholder"}):d.jsx(Tx,{moduleData:e,themeWebRoot:n})}),d.jsx(jh,{className:"",children:d.jsx(Cx,{asChild:!0,children:d.jsx(Ue,{variant:"outline",type:"submit",children:"Close"})})})]})]})},Rx=(e,t,n,r,o)=>{if(!n.nameWithExtension)throw new Error(`Could not find component: ${n.name}`);const l=n.type===vn.REACT?`@projects/${e}/${t}/components/modules/${n.nameWithExtension}`:n.subPath;return`${Va(o)}/design-previewer/${r}/local-module-preview/${l}`},bx=({component:e,componentType:t,onPreviewClick:n,onViewLocalClick:r,sslEnabled:o,projectData:l})=>d.jsxs("div",{className:"flex gap-2",children:[t==="module"&&d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{children:d.jsx(Ue,{variant:"outline",onClick:()=>n(e),disabled:!o||!l,children:"View in app"})})}),o?l?null:d.jsx(hn,{children:'Please run "hs project upload" to view in HubSpot'}):d.jsx(hn,{children:"Please run the dev server with the --ssl flag to view in HubSpot"})]}),d.jsx(Ue,{variant:"outline",onClick:()=>r(e),children:"View local version"})]});function Ox({componentList:e,headers:t,webRootProjectComponentFolder:n,themeWebRoot:r,projectName:o,authedPortalId:l,componentType:i,authedEnv:s,sslEnabled:a,projectData:u,fieldBuilderEnabled:c}){const f=v=>{try{const w=Rx(o,n,v,l,s);window.open(w,"_blank")}catch(w){console.error("Failed to open preview:",w)}},h=v=>{try{let w;switch(i){case"module":w=v.type==="react"?`/preview/module/${v.name}`:`/hublmodule/${v.subPath}`;break;case"template":w=`/template/${v.subPath}`;break;case"partial":w=`/partial/${v.name}`;break;default:throw new Error(`Unknown component type: ${i}`)}window.open(w,"_blank")}catch(w){console.error("Failed to open preview:",w)}};return d.jsxs(Ha,{className:"border text-[16px]",containerClassName:"h-fit max-h-[770px] overflow-y-auto relative",children:[d.jsx(Qa,{children:d.jsx(Xr,{className:"",children:t.map((v,w)=>d.jsx(kl,{className:"border",children:v},w))})}),d.jsx(Ga,{className:"overflow-y-auto",children:e.map((v,w)=>d.jsxs(Xr,{className:"even:bg-gray-100 hover:bg-gray-200",children:[v.name&&d.jsx(pt,{className:"border",children:i==="module"?d.jsxs(oo,{children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{children:d.jsx(_x,{moduleData:v,componentType:i,themeWebRoot:r,authedPortalId:l,projectName:o,webRootProjectComponentFolder:n,projectData:u,authedEnv:s,fieldBuilderEnabled:c,children:d.jsx("span",{className:"underline cursor-pointer",children:v.name})})})}),d.jsx(hn,{children:"View details, dependencies, and more"})]}):d.jsx("span",{children:v.name})}),v.type&&d.jsx(pt,{className:"border",children:d.jsxs("div",{className:"flex items-center gap-2",children:[v.type==="react"?d.jsx(dy,{}):d.jsx(J0,{}),d.jsx("span",{children:v.type==="react"?"React":"HubL"})]})}),v.dateCreated&&d.jsx(pt,{className:"border",children:v.dateCreated}),v.status&&d.jsx(pt,{className:"border",children:v.status}),v.templateTypeLabel&&d.jsx(pt,{className:"border",children:v.templateTypeLabel}),d.jsx(pt,{className:"border",children:d.jsx(bx,{component:v,componentType:i,onPreviewClick:f,onViewLocalClick:h,sslEnabled:a,projectData:u})})]},w))})]})}const Di=({id:e,header:t,componentType:n,subtext:r,headers:o,data:l,webRootProjectComponentFolder:i,themeWebRoot:s,projectName:a,authedPortalId:u,authedEnv:c,sslEnabled:f,projectData:h,fieldBuilderEnabled:v})=>d.jsxs("div",{id:e,className:"mb-16",children:[d.jsx("h2",{className:"font-inter text-2xl font-semibold leading-9 tracking-tight text-left mb-6",children:t}),r&&d.jsx("p",{className:"font-inter text-base font-normal leading-7 text-left mb-5",children:r}),d.jsx(Ox,{authedEnv:c,componentList:l,headers:o,webRootProjectComponentFolder:i,themeWebRoot:s,projectName:a,authedPortalId:u,componentType:n,sslEnabled:f,projectData:h,fieldBuilderEnabled:v})]}),Ax=({modulesData:e,partialsData:t,hubLModules:n,hubLTemplates:r,webRootProjectComponentFolder:o,themeWebRoot:l,projectName:i,authedPortalId:s,authedEnv:a,sslEnabled:u,projectData:c,fieldBuilderEnabled:f})=>{const h=(S,m)=>S.map(p=>({...p,type:m})),v=[...h(e,"react"),...n.map(S=>({...S,type:"hubl"}))],w=[...h(t,"react")],g=r.map(S=>({...S,type:vn.HUBL}));return d.jsxs("div",{className:"mt-12",children:[d.jsx(Di,{id:"modules-table",header:"Modules",componentType:"module",headers:["Name","Type","Actions"],data:v,webRootProjectComponentFolder:o,themeWebRoot:l,projectName:i,authedPortalId:s,authedEnv:a,sslEnabled:u,projectData:c,fieldBuilderEnabled:f}),d.jsx(Di,{id:"partials-table",header:"Partials",componentType:"partial",headers:["Name","Type","Actions"],data:w,sslEnabled:u,projectData:c,fieldBuilderEnabled:f}),d.jsx(Di,{id:"templates-table",header:"Templates",componentType:"template",headers:["Name","Type","Template Type","Actions"],data:g,sslEnabled:u,projectData:c,fieldBuilderEnabled:f})]})};var Lx="Separator",Fc="horizontal",Mx=["horizontal","vertical"],Rh=x.forwardRef((e,t)=>{const{decorative:n,orientation:r=Fc,...o}=e,l=Dx(r)?r:Fc,s=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return d.jsx(we.div,{"data-orientation":l,...s,...o,ref:t})});Rh.displayName=Lx;function Dx(e){return Mx.includes(e)}var bh=Rh;const Oh=x.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>d.jsx(bh,{ref:o,decorative:n,orientation:t,className:le("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Oh.displayName=bh.displayName;const zx=()=>{const e=[{href:"https://www.youtube.com/playlist?list=PLjtLN8FCj4SljVFvkJbSk9J5hq4KTKYcB&jct=pci9oBKT6ttPIJIGKv-rVg",text:"CMS React Videos"},{href:"https://developers.hubspot.com/beta-docs/guides/cms/content/modules/build-modules-and-partials-with-react",text:"React Docs"},{href:"https://react.dev",text:"Learn React"},{href:"https://github.com/HubSpot/cms-react/tree/main/examples",text:"Github Examples"},{href:"https://developers.hubspot.com/beta-docs/getting-started/slack/developer-slack",text:"Slack Community"}];return d.jsx("footer",{className:"w-full py-16",children:d.jsx("nav",{className:"flex justify-center items-center gap-4 text-gray-900 text-sm font-normal",children:e.map((t,n)=>d.jsxs(Ko.Fragment,{children:[d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",children:t.text}),n<e.length-1&&d.jsx(Oh,{className:"bg-gray-200 h-4",orientation:"vertical"})]},n))})})};function Ix({size:e=24,...t}){return d.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("circle",{cx:"20",cy:"20",r:"20",fill:"url(#paint0_linear_6129_76863)"}),d.jsx("mask",{id:"mask0_6129_76863",maskUnits:"userSpaceOnUse",x:"8",y:"7",width:"24",height:"28",children:d.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.18164 7.27271H31.6885V34.3423H8.18164V7.27271Z",fill:"white"})}),d.jsx("g",{mask:"url(#mask0_6129_76863)",children:d.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.2583 26.7794C23.4375 26.7794 21.9612 25.1574 21.9612 23.1566C21.9612 21.1557 23.4375 19.5336 25.2583 19.5336C27.0789 19.5336 28.555 21.1557 28.555 23.1566C28.555 25.1574 27.0789 26.7794 25.2583 26.7794ZM26.2452 16.1818V12.9592C27.0106 12.5618 27.5471 11.7108 27.5471 10.7231V10.6487C27.5471 9.28578 26.532 8.17055 25.292 8.17055H25.2242C23.984 8.17055 22.969 9.28578 22.969 10.6487V10.7231C22.969 11.7108 23.5055 12.5618 24.2709 12.9592V16.182C23.1313 16.3754 22.0899 16.892 21.2306 17.6522L13.1786 10.7689C13.2315 10.5449 13.2687 10.314 13.269 10.0716C13.2708 8.52773 12.1334 7.27469 10.7285 7.27271C9.32372 7.27072 8.1833 8.52062 8.18164 10.0645C8.17984 11.6082 9.31724 12.8613 10.7222 12.8632C11.18 12.8639 11.6036 12.721 11.9752 12.4889L19.8959 19.26C19.2222 20.3773 18.8278 21.7158 18.8278 23.1566C18.8278 24.665 19.2614 26.0602 19.9943 27.2079L17.5855 29.8549C17.395 29.7922 17.1973 29.7482 16.9881 29.7482C15.8338 29.7482 14.8978 30.7767 14.8978 32.0453C14.8978 33.3139 15.8338 34.3423 16.9881 34.3423C18.1426 34.3423 19.0785 33.3139 19.0785 32.0453C19.0785 31.8155 19.0386 31.5981 18.9814 31.389L21.3641 28.7706C22.4457 29.678 23.7925 30.2228 25.2582 30.2228C28.8096 30.2228 31.6885 27.0591 31.6885 23.1566C31.6885 19.6236 29.3267 16.7049 26.2452 16.1818Z",fill:"white"})}),d.jsx("defs",{children:d.jsxs("linearGradient",{id:"paint0_linear_6129_76863",x1:"0",y1:"0",x2:"0",y2:"40",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#FF8F59"}),d.jsx("stop",{offset:"1",stopColor:"#FF7A59"})]})})]})}function Fx({onClose:e}){const t=x.useCallback(()=>{navigator.clipboard.writeText("hs init"),window.open("terminal://open?path=.","_blank"),window.location.reload()},[]);return d.jsx("div",{className:"w-full max-w-2xl bg-background border rounded-lg shadow-lg p-8 mx-4",children:d.jsxs("div",{className:"flex flex-col items-center justify-center space-y-6 text-center",children:[d.jsx("div",{className:"bg-slate-900/90 rounded-lg p-6 w-full",children:d.jsxs("div",{className:"flex items-center justify-center gap-3",children:[d.jsx(ny,{className:"w-8 h-8 text-white"}),d.jsx(Z0,{className:"w-8 h-8 text-slate-400"}),d.jsx(Ix,{size:32,className:"text-[#ff7a59]"})]})}),d.jsx("div",{className:"space-y-2",children:d.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Enjoy the full preview experience by connecting to HubSpot"})}),d.jsx("div",{className:"space-y-4 max-w-md",children:d.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[d.jsxs("p",{children:["Connect by using the"," ",d.jsx("code",{className:"bg-slate-100 px-1.5 py-0.5 rounded text-slate-900",children:"hs init"})," ","command to create a new config file. Ensure there's a"," ",d.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded-md",children:"hubspot.config.yaml"})," ","in the folder (or a parent)."]}),d.jsx("p",{children:"By connecting and authenticating you can use local proxy functionality and module preview routes."}),d.jsx("p",{className:"italic",children:`You can work on modules locally at "/module/[module_name]", but we won't have all your account data to display in this server.`})]})}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(Ue,{variant:"outline",onClick:e,children:"Close"}),d.jsx(Ue,{onClick:t,children:"Connect Now"})]})]})})}function $x({initialProps:e}){const{projectName:t,authedEnv:n,authedPortalId:r,modulesData:o,hubLModules:l,partialsData:i,hubLTemplates:s,webRootProjectComponentFolder:a,themeWebRoot:u,cliCommands:c,sslEnabled:f,projectData:h,fieldBuilderEnabled:v}=e,[w,g]=x.useState(!r),S=()=>{g(!1)};return d.jsx(H0,{children:d.jsxs("div",{className:"container relative pt-8",children:[d.jsx(ay,{projectName:t,authedPortalId:r,modulesData:o,partialsData:i,hubLModules:l,cliCommands:c,projectData:h,authedEnv:n}),d.jsx(Ax,{modulesData:o,hubLModules:l,partialsData:i,hubLTemplates:s,webRootProjectComponentFolder:a,themeWebRoot:u,projectName:t,authedPortalId:r,authedEnv:n,sslEnabled:f,projectData:h,fieldBuilderEnabled:v}),d.jsx(zx,{}),w&&d.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",children:d.jsx("div",{className:"fixed inset-0 flex items-center justify-center",children:d.jsx(Fx,{onClose:S})})})]})})}const Ux=window==null?void 0:window.__hsInitialProps;ep(document.getElementById("root"),d.jsx(x.StrictMode,{children:d.jsx($x,{initialProps:Ux})}));
154
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},hx="DialogDescriptionWarning",mx=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yh(hx).contentName}}.`;return x.useEffect(()=>{var l;const o=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vx=oh,gx=ih,yx=ah,xh=uh,wh=ch,Ch=fh,Sh=hh,kh=vh;const xx=vx,wx=gx,Cx=kh,Sx=yx,Eh=x.forwardRef(({className:e,...t},n)=>d.jsx(xh,{className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Eh.displayName=xh.displayName;const kx=Vp("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Nh=x.forwardRef(({side:e="right",className:t,children:n,...r},o)=>d.jsxs(Sx,{children:[d.jsx(Eh,{}),d.jsxs(wh,{ref:o,className:le(kx({side:e}),t),...r,children:[n,d.jsxs(kh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[d.jsx(oy,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nh.displayName=wh.displayName;const Ph=({className:e,...t})=>d.jsx("div",{className:le("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ph.displayName="SheetHeader";const jh=({className:e,...t})=>d.jsx("div",{className:le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});jh.displayName="SheetFooter";const Th=x.forwardRef(({className:e,...t},n)=>d.jsx(Ch,{ref:n,className:le("text-lg font-semibold text-foreground",e),...t}));Th.displayName=Ch.displayName;const _h=x.forwardRef(({className:e,...t},n)=>d.jsx(Sh,{ref:n,className:le("text-sm text-muted-foreground",e),...t}));_h.displayName=Sh.displayName;var vn=(e=>(e.REACT="react",e.HUBL="hubl",e))(vn||{});function Mi({className:e,...t}){return d.jsx("div",{className:le("animate-pulse rounded-md bg-muted",e),...t})}function Ex(e,t){const[n,r]=x.useState({moduleDependencies:null,isLoading:!1,error:null});return x.useEffect(()=>{e&&(r(o=>({...o,isLoading:!0})),fetch(`/api/module-pages?path=${encodeURIComponent(e)}&portalId=${t}`).then(o=>o.ok?o.json():Promise.reject(new Error("Failed to fetch module pages"))).then(o=>r({moduleDependencies:o,isLoading:!1,error:null})).catch(o=>r({moduleDependencies:null,isLoading:!1,error:String(o)})))},[e]),n}const Nx=(e,t,n)=>`${Va(n)}/pages/${e}/editor/${t}/content`,Px=({pages:e,componentType:t,authedPortalId:n,authedEnv:r})=>{if(e.length===0)return d.jsxs("div",{children:["No pages found using this ",t]});function o(l){return l?l.split("_").map(i=>i.charAt(0)+i.slice(1).toLowerCase()).join(" "):""}return d.jsxs(Ha,{className:"border text-[16px]",containerClassName:"h-fit max-h-[770px] overflow-y-auto relative",children:[d.jsx(Qa,{children:d.jsxs(Xr,{children:[d.jsx(kl,{className:"border",children:"Page Name"}),d.jsx(kl,{className:"border",children:"Page Type"})]})}),d.jsx(Ga,{className:"overflow-y-auto",children:e.map((l,i)=>d.jsxs(Xr,{className:"odd:bg-white even:bg-gray-50",children:[d.jsx(pt,{className:"border",children:d.jsxs("a",{href:Nx(n,l.id,r),target:"_blank",className:"underline flex items-center gap-1",children:[l.label,d.jsx(Ho,{className:"w-4 h-4"})]})}),d.jsx(pt,{className:"border",children:o(l.subType)})]},i))})]})},jx=({componentType:e,authedPortalId:t,projectName:n,projectData:r,webRootProjectComponentFolder:o,isOpen:l,moduleData:i,authedEnv:s})=>{const a=i.type===vn.REACT?`@projects/${n}/${o}/components/modules/${i.nameWithExtension}`:`@projects/${i.subPath}`,{moduleDependencies:u,isLoading:c,error:f}=Ex(r&&l?a:null,t);return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex justify-between items-center mb-3 gap-8",children:[d.jsx("h2",{className:"text-2xl font-semibold leading-9 decoration-skip-ink",children:"Dependencies"}),r&&c?d.jsx(Mi,{className:"h-[20px] flex-1"}):r&&u&&d.jsx("span",{className:"text-lg font-bold leading-8",children:`${u.length} ${u.length===1?"page uses":"pages use"} this ${e}`})]}),r?c?d.jsxs("div",{className:"space-y-2",children:[d.jsx(Mi,{className:"h-[20px] w-full"}),d.jsx(Mi,{className:"h-[20px] w-full"})]}):f?d.jsxs("div",{className:"text-red-500",children:["Error loading dependencies: ",f]}):d.jsx(Px,{pages:u||[],componentType:e,authedPortalId:t,authedEnv:s}):d.jsx("div",{className:"text-sm text-gray-500 italic",children:'Please run "hs project upload" to see what pages this module is used on.'})]})},Tx=({moduleData:e,themeWebRoot:t})=>{var i;const n=JSON.stringify(e.fieldsJson,null,2),r=e.type===vn.REACT?e.subPath:`hubl/${(i=e.subPath)==null?void 0:i.split("/hubl/")[1]}`,o=e.type===vn.REACT?`${t}/${r}.${e.extension}`:`${t}/${r}.module/fields.json`,l=()=>{o&&fetch(`/api/open-file?path=${encodeURIComponent(o)}`).catch(s=>console.error("Failed to open file:",s))};return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("h2",{className:"text-2xl font-semibold leading-8",children:"JSON Fields"}),n?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"relative mt-6 mb-3",children:[d.jsx(Ue,{variant:"outline",size:"icon",className:"w-6 h-6 text-xs rounded-md absolute top-1.5 right-1.5 z-10 opacity-90",onClick:()=>navigator.clipboard.writeText(n),children:d.jsx(Qp,{})}),d.jsx("div",{className:"rounded-xl overflow-hidden p-4 bg-[#0F172A]",children:d.jsx("pre",{className:"text-[14px] font-medium leading-6 text-[#9CDCFE] whitespace-pre-wrap",children:n})})]}),d.jsx("div",{children:d.jsx(Ue,{variant:"outline",onClick:l,children:"View Code"})})]}):d.jsx("p",{children:"No fields found"})]})},_x=({moduleData:e,componentType:t,themeWebRoot:n,authedPortalId:r,projectName:o,webRootProjectComponentFolder:l,projectData:i,authedEnv:s,fieldBuilderEnabled:a,children:u})=>{var v;const[c,f]=x.useState(!1),h=t.charAt(0).toUpperCase()+t.slice(1);return d.jsxs(xx,{onOpenChange:f,children:[d.jsx(wx,{asChild:!0,children:u}),d.jsxs(Nh,{className:"sm:max-w-xl overflow-y-scroll","aria-describedby":"sheet-title",children:[d.jsxs(Ph,{children:[d.jsx(Th,{className:"text-xl font-semibold leading-8 pb-8",children:d.jsx("span",{id:"sheet-title",children:d.jsxs(d.Fragment,{children:[e.name," - ",h," Details"]})})}),d.jsxs(_h,{className:"text-sm leading-5",children:[d.jsx("strong",{children:"Directory Path:"})," ",e.type===vn.REACT?e.subPath:`hubl/${((v=e.subPath)==null?void 0:v.split("/hubl/")[1])||e.subPath}`]})]}),o?d.jsx("div",{className:"grid gap-6 pb-6 my-6 border-b border-gray-300",children:d.jsx(jx,{componentType:t,authedPortalId:r,projectName:o,projectData:i,webRootProjectComponentFolder:l,isOpen:c,moduleData:e,authedEnv:s})}):null,d.jsx("div",{className:"grid gap-6 my-6",children:a?d.jsx("h2",{className:"text-2xl font-semibold leading-8",children:"Field Builder Placeholder"}):d.jsx(Tx,{moduleData:e,themeWebRoot:n})}),d.jsx(jh,{className:"",children:d.jsx(Cx,{asChild:!0,children:d.jsx(Ue,{variant:"outline",type:"submit",children:"Close"})})})]})]})},Rx=(e,t,n,r,o)=>{if(!n.nameWithExtension)throw new Error(`Could not find component: ${n.name}`);const l=n.type===vn.REACT?`@projects/${e}/${t}/components/modules/${n.nameWithExtension}`:n.subPath;return`${Va(o)}/design-previewer/${r}/local-module-preview/${l}`},bx=({component:e,componentType:t,onPreviewClick:n,onViewLocalClick:r,sslEnabled:o,projectName:l,projectData:i})=>d.jsxs("div",{className:"flex gap-2",children:[t==="module"&&l&&d.jsxs(oo,{delayDuration:100,children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{children:d.jsx(Ue,{variant:"outline",onClick:()=>n(e),disabled:!o||!i,children:"View in app"})})}),o?i?null:d.jsx(hn,{children:'Please run "hs project upload" to view in HubSpot'}):d.jsx(hn,{children:"Please run the dev server with the --ssl flag to view in HubSpot"})]}),d.jsx(Ue,{variant:"outline",onClick:()=>r(e),children:"View local version"})]});function Ox({componentList:e,headers:t,webRootProjectComponentFolder:n,themeWebRoot:r,projectName:o,authedPortalId:l,componentType:i,authedEnv:s,sslEnabled:a,projectData:u,fieldBuilderEnabled:c}){const f=v=>{try{const w=Rx(o,n,v,l,s);window.open(w,"_blank")}catch(w){console.error("Failed to open preview:",w)}},h=v=>{try{let w;switch(i){case"module":w=v.type==="react"?`/preview/module/${v.name}`:`/hublmodule/${v.subPath}`;break;case"template":w=`/template/${v.subPath}`;break;case"partial":w=`/partial/${v.name}`;break;default:throw new Error(`Unknown component type: ${i}`)}window.open(w,"_blank")}catch(w){console.error("Failed to open preview:",w)}};return d.jsxs(Ha,{className:"border text-[16px]",containerClassName:"h-fit max-h-[770px] overflow-y-auto relative",children:[d.jsx(Qa,{children:d.jsx(Xr,{className:"",children:t.map((v,w)=>d.jsx(kl,{className:"border",children:v},w))})}),d.jsx(Ga,{className:"overflow-y-auto",children:e.map((v,w)=>d.jsxs(Xr,{className:"even:bg-gray-100 hover:bg-gray-200",children:[v.name&&d.jsx(pt,{className:"border",children:i==="module"?d.jsxs(oo,{children:[d.jsx(lo,{asChild:!0,children:d.jsx("div",{children:d.jsx(_x,{moduleData:v,componentType:i,themeWebRoot:r,authedPortalId:l,projectName:o,webRootProjectComponentFolder:n,projectData:u,authedEnv:s,fieldBuilderEnabled:c,children:d.jsx("span",{className:"underline cursor-pointer",children:v.name})})})}),d.jsx(hn,{children:"View details, dependencies, and more"})]}):d.jsx("span",{children:v.name})}),v.type&&d.jsx(pt,{className:"border",children:d.jsxs("div",{className:"flex items-center gap-2",children:[v.type==="react"?d.jsx(dy,{}):d.jsx(J0,{}),d.jsx("span",{children:v.type==="react"?"React":"HubL"})]})}),v.dateCreated&&d.jsx(pt,{className:"border",children:v.dateCreated}),v.status&&d.jsx(pt,{className:"border",children:v.status}),v.templateTypeLabel&&d.jsx(pt,{className:"border",children:v.templateTypeLabel}),d.jsx(pt,{className:"border",children:d.jsx(bx,{component:v,componentType:i,onPreviewClick:f,onViewLocalClick:h,sslEnabled:a,projectData:u,projectName:o})})]},w))})]})}const Di=({id:e,header:t,componentType:n,subtext:r,headers:o,data:l,webRootProjectComponentFolder:i,themeWebRoot:s,projectName:a,authedPortalId:u,authedEnv:c,sslEnabled:f,projectData:h,fieldBuilderEnabled:v})=>d.jsxs("div",{id:e,className:"mb-16",children:[d.jsx("h2",{className:"font-inter text-2xl font-semibold leading-9 tracking-tight text-left mb-6",children:t}),r&&d.jsx("p",{className:"font-inter text-base font-normal leading-7 text-left mb-5",children:r}),d.jsx(Ox,{authedEnv:c,componentList:l,headers:o,webRootProjectComponentFolder:i,themeWebRoot:s,projectName:a,authedPortalId:u,componentType:n,sslEnabled:f,projectData:h,fieldBuilderEnabled:v})]}),Ax=({modulesData:e,partialsData:t,hubLModules:n,hubLTemplates:r,webRootProjectComponentFolder:o,themeWebRoot:l,projectName:i,authedPortalId:s,authedEnv:a,sslEnabled:u,projectData:c,fieldBuilderEnabled:f})=>{const h=(S,m)=>S.map(p=>({...p,type:m})),v=[...h(e,"react"),...n.map(S=>({...S,type:"hubl"}))],w=[...h(t,"react")],g=r.map(S=>({...S,type:vn.HUBL}));return d.jsxs("div",{className:"mt-12",children:[d.jsx(Di,{id:"modules-table",header:"Modules",componentType:"module",headers:["Name","Type","Actions"],data:v,webRootProjectComponentFolder:o,themeWebRoot:l,projectName:i,authedPortalId:s,authedEnv:a,sslEnabled:u,projectData:c,fieldBuilderEnabled:f}),d.jsx(Di,{id:"partials-table",header:"Partials",componentType:"partial",headers:["Name","Type","Actions"],data:w,sslEnabled:u,projectData:c,fieldBuilderEnabled:f}),d.jsx(Di,{id:"templates-table",header:"Templates",componentType:"template",headers:["Name","Type","Template Type","Actions"],data:g,sslEnabled:u,projectData:c,fieldBuilderEnabled:f})]})};var Lx="Separator",Fc="horizontal",Mx=["horizontal","vertical"],Rh=x.forwardRef((e,t)=>{const{decorative:n,orientation:r=Fc,...o}=e,l=Dx(r)?r:Fc,s=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return d.jsx(we.div,{"data-orientation":l,...s,...o,ref:t})});Rh.displayName=Lx;function Dx(e){return Mx.includes(e)}var bh=Rh;const Oh=x.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>d.jsx(bh,{ref:o,decorative:n,orientation:t,className:le("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Oh.displayName=bh.displayName;const zx=()=>{const e=[{href:"https://www.youtube.com/playlist?list=PLjtLN8FCj4SljVFvkJbSk9J5hq4KTKYcB&jct=pci9oBKT6ttPIJIGKv-rVg",text:"CMS React Videos"},{href:"https://developers.hubspot.com/beta-docs/guides/cms/content/modules/build-modules-and-partials-with-react",text:"React Docs"},{href:"https://react.dev",text:"Learn React"},{href:"https://github.com/HubSpot/cms-react/tree/main/examples",text:"Github Examples"},{href:"https://developers.hubspot.com/beta-docs/getting-started/slack/developer-slack",text:"Slack Community"}];return d.jsx("footer",{className:"w-full py-16",children:d.jsx("nav",{className:"flex justify-center items-center gap-4 text-gray-900 text-sm font-normal",children:e.map((t,n)=>d.jsxs(Ko.Fragment,{children:[d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",children:t.text}),n<e.length-1&&d.jsx(Oh,{className:"bg-gray-200 h-4",orientation:"vertical"})]},n))})})};function Ix({size:e=24,...t}){return d.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("circle",{cx:"20",cy:"20",r:"20",fill:"url(#paint0_linear_6129_76863)"}),d.jsx("mask",{id:"mask0_6129_76863",maskUnits:"userSpaceOnUse",x:"8",y:"7",width:"24",height:"28",children:d.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.18164 7.27271H31.6885V34.3423H8.18164V7.27271Z",fill:"white"})}),d.jsx("g",{mask:"url(#mask0_6129_76863)",children:d.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.2583 26.7794C23.4375 26.7794 21.9612 25.1574 21.9612 23.1566C21.9612 21.1557 23.4375 19.5336 25.2583 19.5336C27.0789 19.5336 28.555 21.1557 28.555 23.1566C28.555 25.1574 27.0789 26.7794 25.2583 26.7794ZM26.2452 16.1818V12.9592C27.0106 12.5618 27.5471 11.7108 27.5471 10.7231V10.6487C27.5471 9.28578 26.532 8.17055 25.292 8.17055H25.2242C23.984 8.17055 22.969 9.28578 22.969 10.6487V10.7231C22.969 11.7108 23.5055 12.5618 24.2709 12.9592V16.182C23.1313 16.3754 22.0899 16.892 21.2306 17.6522L13.1786 10.7689C13.2315 10.5449 13.2687 10.314 13.269 10.0716C13.2708 8.52773 12.1334 7.27469 10.7285 7.27271C9.32372 7.27072 8.1833 8.52062 8.18164 10.0645C8.17984 11.6082 9.31724 12.8613 10.7222 12.8632C11.18 12.8639 11.6036 12.721 11.9752 12.4889L19.8959 19.26C19.2222 20.3773 18.8278 21.7158 18.8278 23.1566C18.8278 24.665 19.2614 26.0602 19.9943 27.2079L17.5855 29.8549C17.395 29.7922 17.1973 29.7482 16.9881 29.7482C15.8338 29.7482 14.8978 30.7767 14.8978 32.0453C14.8978 33.3139 15.8338 34.3423 16.9881 34.3423C18.1426 34.3423 19.0785 33.3139 19.0785 32.0453C19.0785 31.8155 19.0386 31.5981 18.9814 31.389L21.3641 28.7706C22.4457 29.678 23.7925 30.2228 25.2582 30.2228C28.8096 30.2228 31.6885 27.0591 31.6885 23.1566C31.6885 19.6236 29.3267 16.7049 26.2452 16.1818Z",fill:"white"})}),d.jsx("defs",{children:d.jsxs("linearGradient",{id:"paint0_linear_6129_76863",x1:"0",y1:"0",x2:"0",y2:"40",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#FF8F59"}),d.jsx("stop",{offset:"1",stopColor:"#FF7A59"})]})})]})}function Fx({onClose:e}){const t=x.useCallback(()=>{navigator.clipboard.writeText("hs init"),window.open("terminal://open?path=.","_blank"),window.location.reload()},[]);return d.jsx("div",{className:"w-full max-w-2xl bg-background border rounded-lg shadow-lg p-8 mx-4",children:d.jsxs("div",{className:"flex flex-col items-center justify-center space-y-6 text-center",children:[d.jsx("div",{className:"bg-slate-900/90 rounded-lg p-6 w-full",children:d.jsxs("div",{className:"flex items-center justify-center gap-3",children:[d.jsx(ny,{className:"w-8 h-8 text-white"}),d.jsx(Z0,{className:"w-8 h-8 text-slate-400"}),d.jsx(Ix,{size:32,className:"text-[#ff7a59]"})]})}),d.jsx("div",{className:"space-y-2",children:d.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Enjoy the full preview experience by connecting to HubSpot"})}),d.jsx("div",{className:"space-y-4 max-w-md",children:d.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[d.jsxs("p",{children:["Connect by using the"," ",d.jsx("code",{className:"bg-slate-100 px-1.5 py-0.5 rounded text-slate-900",children:"hs init"})," ","command to create a new config file. Ensure there's a"," ",d.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded-md",children:"hubspot.config.yaml"})," ","in the folder (or a parent)."]}),d.jsx("p",{children:"By connecting and authenticating you can use local proxy functionality and module preview routes."}),d.jsx("p",{className:"italic",children:`You can work on modules locally at "/module/[module_name]", but we won't have all your account data to display in this server.`})]})}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(Ue,{variant:"outline",onClick:e,children:"Close"}),d.jsx(Ue,{onClick:t,children:"Connect Now"})]})]})})}function $x({initialProps:e}){const{projectName:t,authedEnv:n,authedPortalId:r,modulesData:o,hubLModules:l,partialsData:i,hubLTemplates:s,webRootProjectComponentFolder:a,themeWebRoot:u,cliCommands:c,sslEnabled:f,projectData:h,fieldBuilderEnabled:v}=e,[w,g]=x.useState(!r),S=()=>{g(!1)};return d.jsx(H0,{children:d.jsxs("div",{className:"container relative pt-8",children:[d.jsx(ay,{projectName:t,authedPortalId:r,modulesData:o,partialsData:i,hubLModules:l,cliCommands:c,projectData:h,authedEnv:n}),d.jsx(Ax,{modulesData:o,hubLModules:l,partialsData:i,hubLTemplates:s,webRootProjectComponentFolder:a,themeWebRoot:u,projectName:t,authedPortalId:r,authedEnv:n,sslEnabled:f,projectData:h,fieldBuilderEnabled:v}),d.jsx(zx,{}),w&&d.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",children:d.jsx("div",{className:"fixed inset-0 flex items-center justify-center",children:d.jsx(Fx,{onClose:S})})})]})})}const Ux=window==null?void 0:window.__hsInitialProps;ep(document.getElementById("root"),d.jsx(x.StrictMode,{children:d.jsx($x,{initialProps:Ux})}));
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>CMS React Dev Server Home</title>
7
7
  <!--app-head-->
8
- <script type="module" crossorigin src="/assets/index-Ck3-AaKI.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BjXnYvkv.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-C0KdU9bk.css">
10
10
  </head>
11
11
  <body>
@@ -2516,13 +2516,13 @@ const WhiteBox = ({ count, label, subText, onClick }) => /* @__PURE__ */ jsxs(
2516
2516
  ]
2517
2517
  }
2518
2518
  );
2519
- const WhiteBoxList = ({ modulesData, partialsData }) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row md:flex-row justify-start gap-4 w-full", children: [
2519
+ const WhiteBoxList = ({ modulesData, partialsData, projectName }) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row md:flex-row justify-start gap-4 w-full", children: [
2520
2520
  /* @__PURE__ */ jsx(
2521
2521
  WhiteBox,
2522
2522
  {
2523
2523
  count: modulesData.length,
2524
2524
  label: modulesData.length === 1 ? "Module" : "Modules",
2525
- subText: "In this Project",
2525
+ subText: projectName ? "In this Project" : "Available",
2526
2526
  onClick: () => {
2527
2527
  var _a;
2528
2528
  return (_a = document.getElementById("modules-table")) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
@@ -2534,7 +2534,7 @@ const WhiteBoxList = ({ modulesData, partialsData }) => /* @__PURE__ */ jsxs("di
2534
2534
  {
2535
2535
  count: partialsData.length,
2536
2536
  label: partialsData.length === 1 ? "Partial" : "Partials",
2537
- subText: "In this Project",
2537
+ subText: projectName ? "In this Project" : "Available",
2538
2538
  onClick: () => {
2539
2539
  var _a;
2540
2540
  return (_a = document.getElementById("partials-table")) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
@@ -2642,7 +2642,7 @@ const Hero = ({
2642
2642
  className: "hidden lg:block"
2643
2643
  }
2644
2644
  ),
2645
- authedPortalId && /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
2645
+ authedPortalId && projectName && /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
2646
2646
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
2647
2647
  Button,
2648
2648
  {
@@ -2674,15 +2674,16 @@ const Hero = ({
2674
2674
  /* @__PURE__ */ jsx("span", { className: "mr-2", children: authedPortalId }),
2675
2675
  /* @__PURE__ */ jsx(IconTooltip, { Icon: Copy, canCopy: true, tooltipText: authedPortalId })
2676
2676
  ] }) }),
2677
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row w-full mt-10 gap-14", children: [
2677
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row w-full mt-10 gap-14", children: [
2678
2678
  /* @__PURE__ */ jsx("div", { className: "md:flex-none", children: /* @__PURE__ */ jsx(
2679
2679
  WhiteBoxList,
2680
2680
  {
2681
2681
  modulesData: combinedModules,
2682
- partialsData
2682
+ partialsData,
2683
+ projectName
2683
2684
  }
2684
2685
  ) }),
2685
- /* @__PURE__ */ jsx("div", { className: "flex-grow", children: /* @__PURE__ */ jsx(CLICommands, { cliCommands }) })
2686
+ projectName && /* @__PURE__ */ jsx("div", { className: "flex-grow", children: /* @__PURE__ */ jsx(CLICommands, { cliCommands }) })
2686
2687
  ] })
2687
2688
  ] });
2688
2689
  };
@@ -2983,7 +2984,7 @@ const ComponentDependencySection = ({
2983
2984
  moduleData,
2984
2985
  authedEnv
2985
2986
  }) => {
2986
- const previewPath = moduleData.type === ModuleType.REACT ? `@projects/${projectName}/${webRootProjectComponentFolder}/components/modules/${moduleData.nameWithExtension}` : moduleData.subPath;
2987
+ const previewPath = moduleData.type === ModuleType.REACT ? `@projects/${projectName}/${webRootProjectComponentFolder}/components/modules/${moduleData.nameWithExtension}` : `@projects/${moduleData.subPath}`;
2987
2988
  const { moduleDependencies, isLoading, error } = useModulePages(
2988
2989
  projectData && isOpen ? previewPath : null,
2989
2990
  authedPortalId
@@ -3080,7 +3081,7 @@ const ComponentDetailSheet = ({
3080
3081
  moduleData.type === ModuleType.REACT ? moduleData.subPath : `hubl/${((_a = moduleData.subPath) == null ? void 0 : _a.split("/hubl/")[1]) || moduleData.subPath}`
3081
3082
  ] })
3082
3083
  ] }),
3083
- /* @__PURE__ */ jsx("div", { className: "grid gap-6 pb-6 my-6 border-b border-gray-300", children: /* @__PURE__ */ jsx(
3084
+ projectName ? /* @__PURE__ */ jsx("div", { className: "grid gap-6 pb-6 my-6 border-b border-gray-300", children: /* @__PURE__ */ jsx(
3084
3085
  ComponentDependencySection,
3085
3086
  {
3086
3087
  componentType,
@@ -3092,7 +3093,7 @@ const ComponentDetailSheet = ({
3092
3093
  moduleData,
3093
3094
  authedEnv
3094
3095
  }
3095
- ) }),
3096
+ ) }) : null,
3096
3097
  /* @__PURE__ */ jsx("div", { className: "grid gap-6 my-6", children: fieldBuilderEnabled ? /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold leading-8", children: "Field Builder Placeholder" }) : /* @__PURE__ */ jsx(
3097
3098
  FieldsContainer,
3098
3099
  {
@@ -3120,10 +3121,11 @@ const ActionButtons = ({
3120
3121
  onPreviewClick,
3121
3122
  onViewLocalClick,
3122
3123
  sslEnabled,
3124
+ projectName,
3123
3125
  projectData
3124
3126
  }) => {
3125
3127
  return /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
3126
- componentType === "module" && /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
3128
+ componentType === "module" && projectName && /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
3127
3129
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
3128
3130
  Button,
3129
3131
  {
@@ -3227,7 +3229,8 @@ function ComponentTable({
3227
3229
  onPreviewClick: handlePreviewClick,
3228
3230
  onViewLocalClick: handleViewLocalClick,
3229
3231
  sslEnabled,
3230
- projectData
3232
+ projectData,
3233
+ projectName
3231
3234
  }
3232
3235
  ) })
3233
3236
  ] }, index)) })
@@ -459,6 +459,49 @@ function devSecretsPlugin(secretNames = []) {
459
459
  };
460
460
  }
461
461
 
462
+ // src/plugins/cmsComponentsShimPlugin.ts
463
+ function cmsComponentsShimPlugin() {
464
+ return {
465
+ name: "cms-components-shim",
466
+ resolveId(id) {
467
+ if (id === "@hubspot/cms-components" || id.startsWith("@hubspot/cms-components/")) {
468
+ return `\0${id}`;
469
+ }
470
+ return null;
471
+ },
472
+ load(id) {
473
+ if (id === "\0@hubspot/cms-components") {
474
+ return `
475
+ export const HSEnvironment = {};
476
+ export const Hublet = {};
477
+ export const createEmptyServerRenderContext = () => ({});
478
+ export const buildStaticEnvConfig = () => ({});
479
+ export const initConfigSingletonFromJSON = () => ({});
480
+ export default {};
481
+ `;
482
+ }
483
+ if (id === "\0@hubspot/cms-components/config") {
484
+ return `
485
+ export const EnvironmentConfig = {};
486
+ export const initConfigSingletonFromJSON = () => ({});
487
+ export default {};
488
+ `;
489
+ }
490
+ if (id === "\0@hubspot/cms-components/fields") {
491
+ return `
492
+ export const Field = {};
493
+ export const traverseFieldsJSON = () => ({});
494
+ export default {};
495
+ `;
496
+ }
497
+ if (id.startsWith("\0@hubspot/cms-components/")) {
498
+ return "export default {};";
499
+ }
500
+ return null;
501
+ }
502
+ };
503
+ }
504
+
462
505
  // src/createViteDevServer.ts
463
506
  import { readFileSync } from "fs";
464
507
  import { join } from "path";
@@ -490,6 +533,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
490
533
  const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
491
534
  const consumerDeps = getDepsForPackageIfExists(webRoot);
492
535
  const isProjectWithReact = consumerDeps.includes("@hubspot/cms-components");
536
+ const componentsShimPlugin = isProjectWithReact ? null : cmsComponentsShimPlugin();
493
537
  const ssrAndOptimizeDep = isProjectWithReact ? {
494
538
  ssr: {
495
539
  // TODO: might need more entries here to get things to resolve through
@@ -498,7 +542,12 @@ Custom origin: ${process.env.VITE_ORIGIN}
498
542
  },
499
543
  resolve: {
500
544
  conditions: ["server"],
501
- dedupe: ["react", "react-dom", "@hubspot/cms-components", "styled-jsx"]
545
+ dedupe: [
546
+ "react",
547
+ "react-dom",
548
+ "@hubspot/cms-components",
549
+ "styled-jsx"
550
+ ]
502
551
  },
503
552
  optimizeDeps: {
504
553
  include: ["react", "react-dom", "react-dom/client"]
@@ -535,6 +584,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
535
584
  plugins: [
536
585
  jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
537
586
  sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
587
+ componentsShimPlugin,
538
588
  ...reactAndIslandsPlugins
539
589
  ],
540
590
  css: {
package/dist/index.js CHANGED
@@ -946,6 +946,49 @@ function devSecretsPlugin(secretNames = []) {
946
946
  };
947
947
  }
948
948
 
949
+ // src/plugins/cmsComponentsShimPlugin.ts
950
+ function cmsComponentsShimPlugin() {
951
+ return {
952
+ name: "cms-components-shim",
953
+ resolveId(id) {
954
+ if (id === "@hubspot/cms-components" || id.startsWith("@hubspot/cms-components/")) {
955
+ return `\0${id}`;
956
+ }
957
+ return null;
958
+ },
959
+ load(id) {
960
+ if (id === "\0@hubspot/cms-components") {
961
+ return `
962
+ export const HSEnvironment = {};
963
+ export const Hublet = {};
964
+ export const createEmptyServerRenderContext = () => ({});
965
+ export const buildStaticEnvConfig = () => ({});
966
+ export const initConfigSingletonFromJSON = () => ({});
967
+ export default {};
968
+ `;
969
+ }
970
+ if (id === "\0@hubspot/cms-components/config") {
971
+ return `
972
+ export const EnvironmentConfig = {};
973
+ export const initConfigSingletonFromJSON = () => ({});
974
+ export default {};
975
+ `;
976
+ }
977
+ if (id === "\0@hubspot/cms-components/fields") {
978
+ return `
979
+ export const Field = {};
980
+ export const traverseFieldsJSON = () => ({});
981
+ export default {};
982
+ `;
983
+ }
984
+ if (id.startsWith("\0@hubspot/cms-components/")) {
985
+ return "export default {};";
986
+ }
987
+ return null;
988
+ }
989
+ };
990
+ }
991
+
949
992
  // src/createViteDevServer.ts
950
993
  import { readFileSync as readFileSync2 } from "fs";
951
994
  import { join as join2 } from "path";
@@ -977,6 +1020,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
977
1020
  const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
978
1021
  const consumerDeps = getDepsForPackageIfExists(webRoot);
979
1022
  const isProjectWithReact = consumerDeps.includes("@hubspot/cms-components");
1023
+ const componentsShimPlugin = isProjectWithReact ? null : cmsComponentsShimPlugin();
980
1024
  const ssrAndOptimizeDep = isProjectWithReact ? {
981
1025
  ssr: {
982
1026
  // TODO: might need more entries here to get things to resolve through
@@ -985,7 +1029,12 @@ Custom origin: ${process.env.VITE_ORIGIN}
985
1029
  },
986
1030
  resolve: {
987
1031
  conditions: ["server"],
988
- dedupe: ["react", "react-dom", "@hubspot/cms-components", "styled-jsx"]
1032
+ dedupe: [
1033
+ "react",
1034
+ "react-dom",
1035
+ "@hubspot/cms-components",
1036
+ "styled-jsx"
1037
+ ]
989
1038
  },
990
1039
  optimizeDeps: {
991
1040
  include: ["react", "react-dom", "react-dom/client"]
@@ -1022,6 +1071,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
1022
1071
  plugins: [
1023
1072
  jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
1024
1073
  sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
1074
+ componentsShimPlugin,
1025
1075
  ...reactAndIslandsPlugins
1026
1076
  ],
1027
1077
  css: {
@@ -1465,7 +1515,7 @@ function trackUsage(action) {
1465
1515
  eventName: EVENT_NAME,
1466
1516
  action,
1467
1517
  nodeVersion: getNodeVersionData(),
1468
- version: "1.0.7",
1518
+ version: "1.0.10",
1469
1519
  os: getPlatform()
1470
1520
  };
1471
1521
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -2213,8 +2263,9 @@ function isModuleFolderChild(filePath) {
2213
2263
  import path4 from "path";
2214
2264
  var removePreviewPrefix = (t2) => t2.split("/").slice(2).join("/");
2215
2265
  var getPreviewUrl = (request2, queryParams) => {
2216
- const { authedPortalId, authedEnv, authedHublet } = request2.app.locals;
2217
- return `http://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
2266
+ const { authedPortalId, authedEnv, authedHublet, sslEnabled } = request2.app.locals;
2267
+ const protocol = sslEnabled ? "https" : "http";
2268
+ return `${protocol}://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
2218
2269
  };
2219
2270
  var buildHTMLResponse = (content) => {
2220
2271
  return `
@@ -4126,14 +4177,17 @@ function mapReactModules(modules, themeWebRoot, appViteServer) {
4126
4177
  })
4127
4178
  );
4128
4179
  }
4129
- function normalizeHubLModules(modules) {
4130
- return modules.map((module) => ({
4131
- name: module.name,
4132
- type: "hubl" /* HUBL */,
4133
- subPath: `@projects/${module.path.split("/@projects/")[1] || module.path}`,
4134
- nameWithExtension: module.filename,
4135
- fieldsJson: module.fields
4136
- }));
4180
+ function normalizeHubLModules(modules, projectName) {
4181
+ return modules.map((module) => {
4182
+ const subPath = projectName ? `${module.path.split("/@projects/")[1] || module.path}` : removePreviewPrefix(module.path);
4183
+ return {
4184
+ name: module.name,
4185
+ type: "hubl" /* HUBL */,
4186
+ subPath,
4187
+ nameWithExtension: module.filename,
4188
+ fieldsJson: module.fields
4189
+ };
4190
+ });
4137
4191
  }
4138
4192
  function normalizePartialsData(partialData) {
4139
4193
  return partialData.partialNames.map((name, index) => ({
@@ -4141,21 +4195,15 @@ function normalizePartialsData(partialData) {
4141
4195
  subPath: partialData.partialSubpaths[index]
4142
4196
  }));
4143
4197
  }
4144
- function normalizeTemplatesData(templates) {
4145
- return templates.filter((template) => template.templateType in templateTypeMap).map((template) => ({
4146
- name: template.displayName || template.label,
4147
- subPath: extractSubPath(template.path),
4148
- templateTypeLabel: templateTypeMap[template.templateType]
4149
- }));
4150
- }
4151
- function extractSubPath(componentPath) {
4152
- var _a;
4153
- const projectPrefix = "@projects/";
4154
- if (!componentPath) {
4155
- return projectPrefix;
4156
- }
4157
- const projectPath = (_a = componentPath.split(projectPrefix)) == null ? void 0 : _a[1];
4158
- return `${projectPrefix}${projectPath || componentPath}`;
4198
+ function normalizeTemplatesData(templates, projectName) {
4199
+ return templates.filter((template) => template.templateType in templateTypeMap).map((template) => {
4200
+ const subPath = projectName ? `@projects/${template.path.split("/@projects/")[1] || template.path}` : removePreviewPrefix(template.path);
4201
+ return {
4202
+ name: template.displayName || template.label,
4203
+ subPath,
4204
+ templateTypeLabel: templateTypeMap[template.templateType]
4205
+ };
4206
+ });
4159
4207
  }
4160
4208
  function detectPackageManager(projectRoot) {
4161
4209
  if (fs3.existsSync(path11.join(projectRoot, "yarn.lock")))
@@ -4176,44 +4224,56 @@ async function getDevServerUIData(appLocals) {
4176
4224
  fieldBuilderEnabled,
4177
4225
  appViteServer
4178
4226
  } = appLocals;
4179
- const packageJson = getPackageJson(themeWebRoot);
4180
- const packageManager = detectPackageManager(themeWebRoot);
4181
- const runCommand = packageManager === "yarn" ? "yarn" : `${packageManager} run`;
4182
- const cliCommands = Object.entries((packageJson == null ? void 0 : packageJson.scripts) || {}).map(
4183
- ([scriptName, description]) => ({
4184
- scriptName,
4185
- description,
4186
- runCommand: `${runCommand} ${scriptName}`
4187
- })
4188
- );
4189
4227
  const modulesData = findAllModulesInRoot(themeWebRoot);
4190
4228
  const partialsData = findAllPartialsInRoot(themeWebRoot);
4191
- const reactModules = await mapReactModules(
4192
- modulesData,
4193
- themeWebRoot,
4194
- appViteServer
4195
- );
4229
+ let packageJson = { scripts: {} };
4230
+ let packageManager = "";
4231
+ let cliCommands = [];
4232
+ let reactModules = [];
4233
+ if (projectName) {
4234
+ packageJson = getPackageJson(themeWebRoot);
4235
+ packageManager = detectPackageManager(themeWebRoot);
4236
+ const runCommand = packageManager === "yarn" ? "yarn" : `${packageManager} run`;
4237
+ cliCommands = projectName ? Object.entries((packageJson == null ? void 0 : packageJson.scripts) || {}).map(
4238
+ ([scriptName, description]) => ({
4239
+ scriptName,
4240
+ description,
4241
+ runCommand: `${runCommand} ${scriptName}`
4242
+ })
4243
+ ) : [];
4244
+ reactModules = projectName ? await mapReactModules(modulesData, themeWebRoot, appViteServer) : [];
4245
+ }
4196
4246
  let hubLModuleData = { objects: [] };
4197
4247
  let hubLTemplateData = { objects: [] };
4198
4248
  let projectData = null;
4249
+ let normalizedHubLModules = [];
4199
4250
  if (authedPortalId) {
4200
- [hubLModuleData, hubLTemplateData, projectData] = await Promise.all([
4201
- fetchHubLModules(authedPortalId, localPreviewToken),
4202
- fetchPreviewTemplates(authedPortalId, localPreviewToken),
4203
- fetchProjectByName(authedPortalId, projectName).catch(() => {
4204
- return null;
4205
- })
4206
- ]);
4251
+ try {
4252
+ const dataFetchingPromises = [
4253
+ fetchHubLModules(authedPortalId, localPreviewToken),
4254
+ fetchPreviewTemplates(authedPortalId, localPreviewToken),
4255
+ projectName ? fetchProjectByName(authedPortalId, projectName) : Promise.resolve(null)
4256
+ ];
4257
+ [hubLModuleData, hubLTemplateData, projectData] = await Promise.all(dataFetchingPromises);
4258
+ } catch (e) {
4259
+ console.warn("Error fetching data:", e);
4260
+ }
4261
+ normalizedHubLModules = normalizeHubLModules(
4262
+ (hubLModuleData == null ? void 0 : hubLModuleData.objects) || [],
4263
+ projectName
4264
+ );
4207
4265
  }
4208
- const mappedHubLModules = normalizeHubLModules((hubLModuleData == null ? void 0 : hubLModuleData.objects) || []);
4209
4266
  return {
4210
4267
  authedPortalId,
4211
4268
  authedEnv,
4212
4269
  projectName,
4213
4270
  modulesData: reactModules,
4214
4271
  partialsData: normalizePartialsData(partialsData),
4215
- hubLModules: mappedHubLModules || [],
4216
- hubLTemplates: normalizeTemplatesData((hubLTemplateData == null ? void 0 : hubLTemplateData.objects) || []),
4272
+ hubLModules: normalizedHubLModules || [],
4273
+ hubLTemplates: normalizeTemplatesData(
4274
+ (hubLTemplateData == null ? void 0 : hubLTemplateData.objects) || [],
4275
+ projectName
4276
+ ),
4217
4277
  themeWebRoot,
4218
4278
  webRootProjectComponentFolder,
4219
4279
  cliCommands,
@@ -4294,12 +4354,8 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
4294
4354
  }
4295
4355
  devServerApp.use(viteServer.middlewares);
4296
4356
  devServerApp.use("/api", createAppServerAPIRoutes_default());
4297
- if (appLocals.projectName) {
4298
- devServerApp.get("/", appServerRouteHandler_default);
4299
- devServerApp.get("/legacy", legacyRouteHandler_default);
4300
- } else {
4301
- devServerApp.get("/", legacyRouteHandler_default);
4302
- }
4357
+ devServerApp.get("/", appServerRouteHandler_default);
4358
+ devServerApp.get("/legacy", legacyRouteHandler_default);
4303
4359
  devServerApp.get("/proxy", proxyPathPageRouteHandler);
4304
4360
  devServerApp.get("/partials/", linksToAllPartialsRouteHandler_default);
4305
4361
  devServerApp.get("/partial/:partial", partial_default);
@@ -5267,6 +5323,7 @@ Local proxy functionality and module preview routes will not work without settin
5267
5323
  expressServer.locals.jsRenderingGates = jsRenderingGates;
5268
5324
  expressServer.locals.domainsToProxy = domainsToProxy;
5269
5325
  expressServer.locals.localPreviewToken = _localPreviewToken;
5326
+ expressServer.locals.sslEnabled = sslEnabledOption;
5270
5327
  expressServer.use(bodyParser.json());
5271
5328
  const __dirname = path16.dirname(url2.fileURLToPath(new URL(import.meta.url)));
5272
5329
  let appWebRoot = normalizePath10(path16.resolve(__dirname, "../app"));
@@ -5334,11 +5391,12 @@ Local proxy functionality and module preview routes will not work without settin
5334
5391
  if (authedEnv && authedEnv !== "prod") {
5335
5392
  extraServerInfo += `, env=${authedEnv}`;
5336
5393
  }
5337
- console.log(
5338
- `
5339
- HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectComponentPath} (at ${protocol}://hslocal.net:${PORT}${extraServerInfo})
5340
- `
5341
- );
5394
+ const startMessage = projectName ? `
5395
+ HubSpot CMS dev server ${projectName ? `hosting: ${projectName}/` : "running"}${expressServer.locals.projectComponentPath} (at ${protocol}://hslocal.net:${PORT}${extraServerInfo})
5396
+ ` : `
5397
+ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServerInfo}
5398
+ `;
5399
+ console.log(startMessage);
5342
5400
  if (storybook) {
5343
5401
  const packageRoot = path16.dirname(url2.fileURLToPath(import.meta.url));
5344
5402
  const configPath = path16.resolve(packageRoot, "./storybook-main");
@@ -5395,7 +5453,11 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
5395
5453
  });
5396
5454
  })
5397
5455
  );
5398
- return Promise.allSettled([...serverClosePromises, viteServer.close()]);
5456
+ return Promise.allSettled([
5457
+ ...serverClosePromises,
5458
+ viteServer.close(),
5459
+ appViteServer.close()
5460
+ ]);
5399
5461
  }
5400
5462
  };
5401
5463
  }
package/dist/run.js CHANGED
@@ -2097,7 +2097,7 @@ function trackUsage(action) {
2097
2097
  eventName: EVENT_NAME,
2098
2098
  action,
2099
2099
  nodeVersion: getNodeVersionData(),
2100
- version: "1.0.7",
2100
+ version: "1.0.10",
2101
2101
  os: getPlatform()
2102
2102
  };
2103
2103
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -2845,8 +2845,9 @@ function isModuleFolderChild(filePath) {
2845
2845
  import path5 from "path";
2846
2846
  var removePreviewPrefix = (t2) => t2.split("/").slice(2).join("/");
2847
2847
  var getPreviewUrl = (request2, queryParams) => {
2848
- const { authedPortalId, authedEnv, authedHublet } = request2.app.locals;
2849
- return `http://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
2848
+ const { authedPortalId, authedEnv, authedHublet, sslEnabled } = request2.app.locals;
2849
+ const protocol = sslEnabled ? "https" : "http";
2850
+ return `${protocol}://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
2850
2851
  };
2851
2852
  var buildHTMLResponse = (content) => {
2852
2853
  return `
@@ -4734,6 +4735,49 @@ function devSecretsPlugin(secretNames = []) {
4734
4735
  };
4735
4736
  }
4736
4737
 
4738
+ // src/plugins/cmsComponentsShimPlugin.ts
4739
+ function cmsComponentsShimPlugin() {
4740
+ return {
4741
+ name: "cms-components-shim",
4742
+ resolveId(id) {
4743
+ if (id === "@hubspot/cms-components" || id.startsWith("@hubspot/cms-components/")) {
4744
+ return `\0${id}`;
4745
+ }
4746
+ return null;
4747
+ },
4748
+ load(id) {
4749
+ if (id === "\0@hubspot/cms-components") {
4750
+ return `
4751
+ export const HSEnvironment = {};
4752
+ export const Hublet = {};
4753
+ export const createEmptyServerRenderContext = () => ({});
4754
+ export const buildStaticEnvConfig = () => ({});
4755
+ export const initConfigSingletonFromJSON = () => ({});
4756
+ export default {};
4757
+ `;
4758
+ }
4759
+ if (id === "\0@hubspot/cms-components/config") {
4760
+ return `
4761
+ export const EnvironmentConfig = {};
4762
+ export const initConfigSingletonFromJSON = () => ({});
4763
+ export default {};
4764
+ `;
4765
+ }
4766
+ if (id === "\0@hubspot/cms-components/fields") {
4767
+ return `
4768
+ export const Field = {};
4769
+ export const traverseFieldsJSON = () => ({});
4770
+ export default {};
4771
+ `;
4772
+ }
4773
+ if (id.startsWith("\0@hubspot/cms-components/")) {
4774
+ return "export default {};";
4775
+ }
4776
+ return null;
4777
+ }
4778
+ };
4779
+ }
4780
+
4737
4781
  // src/createViteDevServer.ts
4738
4782
  import { readFileSync as readFileSync3 } from "fs";
4739
4783
  import { join as join4 } from "path";
@@ -4765,6 +4809,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
4765
4809
  const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
4766
4810
  const consumerDeps = getDepsForPackageIfExists(webRoot2);
4767
4811
  const isProjectWithReact = consumerDeps.includes("@hubspot/cms-components");
4812
+ const componentsShimPlugin = isProjectWithReact ? null : cmsComponentsShimPlugin();
4768
4813
  const ssrAndOptimizeDep = isProjectWithReact ? {
4769
4814
  ssr: {
4770
4815
  // TODO: might need more entries here to get things to resolve through
@@ -4773,7 +4818,12 @@ Custom origin: ${process.env.VITE_ORIGIN}
4773
4818
  },
4774
4819
  resolve: {
4775
4820
  conditions: ["server"],
4776
- dedupe: ["react", "react-dom", "@hubspot/cms-components", "styled-jsx"]
4821
+ dedupe: [
4822
+ "react",
4823
+ "react-dom",
4824
+ "@hubspot/cms-components",
4825
+ "styled-jsx"
4826
+ ]
4777
4827
  },
4778
4828
  optimizeDeps: {
4779
4829
  include: ["react", "react-dom", "react-dom/client"]
@@ -4810,6 +4860,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
4810
4860
  plugins: [
4811
4861
  jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
4812
4862
  sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
4863
+ componentsShimPlugin,
4813
4864
  ...reactAndIslandsPlugins
4814
4865
  ],
4815
4866
  css: {
@@ -4866,14 +4917,17 @@ function mapReactModules(modules, themeWebRoot, appViteServer) {
4866
4917
  })
4867
4918
  );
4868
4919
  }
4869
- function normalizeHubLModules(modules) {
4870
- return modules.map((module) => ({
4871
- name: module.name,
4872
- type: "hubl" /* HUBL */,
4873
- subPath: `@projects/${module.path.split("/@projects/")[1] || module.path}`,
4874
- nameWithExtension: module.filename,
4875
- fieldsJson: module.fields
4876
- }));
4920
+ function normalizeHubLModules(modules, projectName) {
4921
+ return modules.map((module) => {
4922
+ const subPath = projectName ? `${module.path.split("/@projects/")[1] || module.path}` : removePreviewPrefix(module.path);
4923
+ return {
4924
+ name: module.name,
4925
+ type: "hubl" /* HUBL */,
4926
+ subPath,
4927
+ nameWithExtension: module.filename,
4928
+ fieldsJson: module.fields
4929
+ };
4930
+ });
4877
4931
  }
4878
4932
  function normalizePartialsData(partialData) {
4879
4933
  return partialData.partialNames.map((name, index) => ({
@@ -4881,21 +4935,15 @@ function normalizePartialsData(partialData) {
4881
4935
  subPath: partialData.partialSubpaths[index]
4882
4936
  }));
4883
4937
  }
4884
- function normalizeTemplatesData(templates) {
4885
- return templates.filter((template) => template.templateType in templateTypeMap).map((template) => ({
4886
- name: template.displayName || template.label,
4887
- subPath: extractSubPath(template.path),
4888
- templateTypeLabel: templateTypeMap[template.templateType]
4889
- }));
4890
- }
4891
- function extractSubPath(componentPath) {
4892
- var _a;
4893
- const projectPrefix = "@projects/";
4894
- if (!componentPath) {
4895
- return projectPrefix;
4896
- }
4897
- const projectPath = (_a = componentPath.split(projectPrefix)) == null ? void 0 : _a[1];
4898
- return `${projectPrefix}${projectPath || componentPath}`;
4938
+ function normalizeTemplatesData(templates, projectName) {
4939
+ return templates.filter((template) => template.templateType in templateTypeMap).map((template) => {
4940
+ const subPath = projectName ? `@projects/${template.path.split("/@projects/")[1] || template.path}` : removePreviewPrefix(template.path);
4941
+ return {
4942
+ name: template.displayName || template.label,
4943
+ subPath,
4944
+ templateTypeLabel: templateTypeMap[template.templateType]
4945
+ };
4946
+ });
4899
4947
  }
4900
4948
  function detectPackageManager(projectRoot) {
4901
4949
  if (fs4.existsSync(path12.join(projectRoot, "yarn.lock")))
@@ -4916,44 +4964,56 @@ async function getDevServerUIData(appLocals) {
4916
4964
  fieldBuilderEnabled: fieldBuilderEnabled2,
4917
4965
  appViteServer
4918
4966
  } = appLocals;
4919
- const packageJson = getPackageJson(themeWebRoot);
4920
- const packageManager = detectPackageManager(themeWebRoot);
4921
- const runCommand = packageManager === "yarn" ? "yarn" : `${packageManager} run`;
4922
- const cliCommands = Object.entries((packageJson == null ? void 0 : packageJson.scripts) || {}).map(
4923
- ([scriptName, description]) => ({
4924
- scriptName,
4925
- description,
4926
- runCommand: `${runCommand} ${scriptName}`
4927
- })
4928
- );
4929
4967
  const modulesData = findAllModulesInRoot(themeWebRoot);
4930
4968
  const partialsData = findAllPartialsInRoot(themeWebRoot);
4931
- const reactModules = await mapReactModules(
4932
- modulesData,
4933
- themeWebRoot,
4934
- appViteServer
4935
- );
4969
+ let packageJson = { scripts: {} };
4970
+ let packageManager = "";
4971
+ let cliCommands = [];
4972
+ let reactModules = [];
4973
+ if (projectName) {
4974
+ packageJson = getPackageJson(themeWebRoot);
4975
+ packageManager = detectPackageManager(themeWebRoot);
4976
+ const runCommand = packageManager === "yarn" ? "yarn" : `${packageManager} run`;
4977
+ cliCommands = projectName ? Object.entries((packageJson == null ? void 0 : packageJson.scripts) || {}).map(
4978
+ ([scriptName, description]) => ({
4979
+ scriptName,
4980
+ description,
4981
+ runCommand: `${runCommand} ${scriptName}`
4982
+ })
4983
+ ) : [];
4984
+ reactModules = projectName ? await mapReactModules(modulesData, themeWebRoot, appViteServer) : [];
4985
+ }
4936
4986
  let hubLModuleData = { objects: [] };
4937
4987
  let hubLTemplateData = { objects: [] };
4938
4988
  let projectData = null;
4989
+ let normalizedHubLModules = [];
4939
4990
  if (authedPortalId) {
4940
- [hubLModuleData, hubLTemplateData, projectData] = await Promise.all([
4941
- fetchHubLModules(authedPortalId, localPreviewToken),
4942
- fetchPreviewTemplates(authedPortalId, localPreviewToken),
4943
- fetchProjectByName(authedPortalId, projectName).catch(() => {
4944
- return null;
4945
- })
4946
- ]);
4991
+ try {
4992
+ const dataFetchingPromises = [
4993
+ fetchHubLModules(authedPortalId, localPreviewToken),
4994
+ fetchPreviewTemplates(authedPortalId, localPreviewToken),
4995
+ projectName ? fetchProjectByName(authedPortalId, projectName) : Promise.resolve(null)
4996
+ ];
4997
+ [hubLModuleData, hubLTemplateData, projectData] = await Promise.all(dataFetchingPromises);
4998
+ } catch (e) {
4999
+ console.warn("Error fetching data:", e);
5000
+ }
5001
+ normalizedHubLModules = normalizeHubLModules(
5002
+ (hubLModuleData == null ? void 0 : hubLModuleData.objects) || [],
5003
+ projectName
5004
+ );
4947
5005
  }
4948
- const mappedHubLModules = normalizeHubLModules((hubLModuleData == null ? void 0 : hubLModuleData.objects) || []);
4949
5006
  return {
4950
5007
  authedPortalId,
4951
5008
  authedEnv,
4952
5009
  projectName,
4953
5010
  modulesData: reactModules,
4954
5011
  partialsData: normalizePartialsData(partialsData),
4955
- hubLModules: mappedHubLModules || [],
4956
- hubLTemplates: normalizeTemplatesData((hubLTemplateData == null ? void 0 : hubLTemplateData.objects) || []),
5012
+ hubLModules: normalizedHubLModules || [],
5013
+ hubLTemplates: normalizeTemplatesData(
5014
+ (hubLTemplateData == null ? void 0 : hubLTemplateData.objects) || [],
5015
+ projectName
5016
+ ),
4957
5017
  themeWebRoot,
4958
5018
  webRootProjectComponentFolder,
4959
5019
  cliCommands,
@@ -5034,12 +5094,8 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
5034
5094
  }
5035
5095
  devServerApp.use(viteServer.middlewares);
5036
5096
  devServerApp.use("/api", createAppServerAPIRoutes_default());
5037
- if (appLocals.projectName) {
5038
- devServerApp.get("/", appServerRouteHandler_default);
5039
- devServerApp.get("/legacy", legacyRouteHandler_default);
5040
- } else {
5041
- devServerApp.get("/", legacyRouteHandler_default);
5042
- }
5097
+ devServerApp.get("/", appServerRouteHandler_default);
5098
+ devServerApp.get("/legacy", legacyRouteHandler_default);
5043
5099
  devServerApp.get("/proxy", proxyPathPageRouteHandler);
5044
5100
  devServerApp.get("/partials/", linksToAllPartialsRouteHandler_default);
5045
5101
  devServerApp.get("/partial/:partial", partial_default);
@@ -6007,6 +6063,7 @@ Local proxy functionality and module preview routes will not work without settin
6007
6063
  expressServer.locals.jsRenderingGates = jsRenderingGates;
6008
6064
  expressServer.locals.domainsToProxy = domainsToProxy;
6009
6065
  expressServer.locals.localPreviewToken = _localPreviewToken;
6066
+ expressServer.locals.sslEnabled = sslEnabledOption2;
6010
6067
  expressServer.use(bodyParser.json());
6011
6068
  const __dirname = path17.dirname(url2.fileURLToPath(new URL(import.meta.url)));
6012
6069
  let appWebRoot = normalizePath10(path17.resolve(__dirname, "../app"));
@@ -6074,11 +6131,12 @@ Local proxy functionality and module preview routes will not work without settin
6074
6131
  if (authedEnv && authedEnv !== "prod") {
6075
6132
  extraServerInfo += `, env=${authedEnv}`;
6076
6133
  }
6077
- console.log(
6078
- `
6079
- HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectComponentPath} (at ${protocol}://hslocal.net:${PORT}${extraServerInfo})
6080
- `
6081
- );
6134
+ const startMessage = projectName ? `
6135
+ HubSpot CMS dev server ${projectName ? `hosting: ${projectName}/` : "running"}${expressServer.locals.projectComponentPath} (at ${protocol}://hslocal.net:${PORT}${extraServerInfo})
6136
+ ` : `
6137
+ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServerInfo}
6138
+ `;
6139
+ console.log(startMessage);
6082
6140
  if (storybook2) {
6083
6141
  const packageRoot = path17.dirname(url2.fileURLToPath(import.meta.url));
6084
6142
  const configPath = path17.resolve(packageRoot, "./storybook-main");
@@ -6135,7 +6193,11 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
6135
6193
  });
6136
6194
  })
6137
6195
  );
6138
- return Promise.allSettled([...serverClosePromises, viteServer.close()]);
6196
+ return Promise.allSettled([
6197
+ ...serverClosePromises,
6198
+ viteServer.close(),
6199
+ appViteServer.close()
6200
+ ]);
6139
6201
  }
6140
6202
  };
6141
6203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -29,7 +29,7 @@
29
29
  "@babel/parser": "^7.25.3",
30
30
  "@babel/traverse": "^7.25.3",
31
31
  "@babel/types": "^7.25.2",
32
- "@hubspot/cms-components": "^1.0.7",
32
+ "@hubspot/cms-components": "^1.0.10",
33
33
  "@hubspot/local-dev-lib": "2.0.1",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -71,7 +71,7 @@
71
71
  "tailwindcss-animate": "^1.0.7",
72
72
  "typescript": "~4.7.0",
73
73
  "vite": "5.4.8",
74
- "vite-plugin-inspect": "^0.4.3",
74
+ "vite-plugin-inspect": "^0.8.0",
75
75
  "vite-plugin-mkcert": "1.16.0"
76
76
  },
77
77
  "devDependencies": {
@@ -131,5 +131,5 @@
131
131
  "publishConfig": {
132
132
  "access": "public"
133
133
  },
134
- "gitHead": "46df6c8d1a6a0ae518ace99d475d736e02d63b73"
134
+ "gitHead": "95335ef8cf0d3f3892dddc0a5e480859e632eaf4"
135
135
  }
@@ -1,5 +1,5 @@
1
1
  import { ThemePreviewOptions } from './lib/previewUtils.js';
2
2
  declare function createDevServer(webRoot: string, storybook: boolean, hubspotCliConfigPathOption?: string, hubspotCliAccountNameOption?: string, sslEnabledOption?: boolean, fieldGenEnabledOption?: boolean, themePreviewOptions?: ThemePreviewOptions, fieldBuilderEnabled?: boolean): Promise<{
3
- close: () => Promise<[...PromiseSettledResult<unknown>[], PromiseSettledResult<unknown>]>;
3
+ close: () => Promise<[...PromiseSettledResult<unknown>[], PromiseSettledResult<unknown>, PromiseSettledResult<unknown>]>;
4
4
  }>;
5
5
  export default createDevServer;
@@ -1,4 +1,5 @@
1
1
  import { ViteDevServer } from 'vite';
2
+ import { HubLModule, HubLTemplate } from '../api/designmanager.js';
2
3
  import { ProjectData } from '../api/project.js';
3
4
  export declare enum ModuleType {
4
5
  REACT = "react",
@@ -53,5 +54,7 @@ export interface AppLocals {
53
54
  appViteServer: ViteDevServer;
54
55
  }
55
56
  export declare const templateTypeMap: Record<number, string>;
57
+ export declare function normalizeHubLModules(modules: HubLModule[], projectName: string): ModuleData[];
58
+ export declare function normalizeTemplatesData(templates: HubLTemplate[], projectName: string): TemplateData[];
56
59
  export declare function getDevServerUIData(appLocals: AppLocals): Promise<DevServerUIData>;
57
60
  export default getDevServerUIData;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This plugin will intercept requests for @hubspot/cms-components and return minimal versions of the
3
+ * cms-components modules. This prevents HubL-only themes that are not in a Project from breaking since
4
+ * the cms-dev-server relies on certain cms-components modules internally. It is safe to return these
5
+ * minimal versions because the cms-dev-server will not use them in a non-Project environment.
6
+ */
7
+ export default function cmsComponentsShimPlugin(): {
8
+ name: string;
9
+ resolveId(id: any): string;
10
+ load(id: any): "\n export const HSEnvironment = {};\n export const Hublet = {};\n export const createEmptyServerRenderContext = () => ({});\n export const buildStaticEnvConfig = () => ({});\n export const initConfigSingletonFromJSON = () => ({});\n export default {};\n " | "\n export const EnvironmentConfig = {};\n export const initConfigSingletonFromJSON = () => ({});\n export default {};\n " | "\n export const Field = {};\n export const traverseFieldsJSON = () => ({});\n export default {};\n " | "export default {};";
11
+ };
@@ -1,5 +0,0 @@
1
- export declare const API_ERRORS: {
2
- readonly MISSING_PARAMS: "MISSING_PARAMS";
3
- readonly FETCH_FAILED: "FETCH_FAILED";
4
- };
5
- export declare type ApiError = (typeof API_ERRORS)[keyof typeof API_ERRORS];
@@ -1,2 +0,0 @@
1
- import { InlineConfig } from 'vite';
2
- export declare function createAppViteConfig(webRoot: string, port: number): InlineConfig;
@@ -1,22 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- export declare function getDevServerCommandLineOptions(argv: NodeJS.Process['argv']): {
3
- hubspotCliConfigPathOption: string;
4
- hubspotCliAccountNameOption: string;
5
- sslEnabledOption: boolean;
6
- storybook: boolean;
7
- fieldGenEnabledOption: boolean;
8
- webRoot: string;
9
- resetSession: boolean;
10
- };
11
- export declare function buildThemePreviewOptions(webRoot: string): Promise<{
12
- filePaths: string[];
13
- startProgressBar: (numFiles: any) => {
14
- onAttemptCallback: () => void;
15
- onSuccessCallback: () => void;
16
- onFirstErrorCallback: () => void;
17
- onRetryCallback: () => void;
18
- onFinalErrorCallback: () => any;
19
- onFinishCallback: (results: any) => void;
20
- };
21
- dest: any;
22
- }>;
@@ -1,14 +0,0 @@
1
- export declare function determineSrcAndDest(): Promise<{
2
- absoluteSrc: any;
3
- dest: any;
4
- }>;
5
- export declare function getUploadableFileList(src: any, convertFields: any): Promise<any[]>;
6
- export declare function fieldsJsPrompt(filePath: any, projectDir: any, skipFiles?: any[]): Promise<any[]>;
7
- export declare function logError(error: any, context?: {}): void;
8
- export declare class ApiErrorContext {
9
- accountId: any;
10
- request: any;
11
- payload: any;
12
- projectName: any;
13
- constructor(props?: any);
14
- }
@@ -1 +0,0 @@
1
- export declare const templateTypeMap: Record<number, string>;
@@ -1,2 +0,0 @@
1
- declare const router: import("express-serve-static-core").Router;
2
- export default router;
@@ -1,5 +0,0 @@
1
- import { Request, Response, NextFunction } from 'express';
2
- export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
3
- export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
4
- export declare function appServerApiRouteHandler(): import("express-serve-static-core").Router;
5
- export default appServerApiRouteHandler;
@@ -1,5 +0,0 @@
1
- import { Request, Response, NextFunction } from 'express';
2
- export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
3
- export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
4
- export declare function appServerRoutes(): import("express-serve-static-core").Router;
5
- export default appServerRoutes;
@@ -1,9 +0,0 @@
1
- declare namespace _default {
2
- namespace parameters {
3
- namespace actions {
4
- const argTypesRegex: string;
5
- }
6
- }
7
- const decorators: ((Story: any) => JSX.Element)[];
8
- }
9
- export default _default;