@hubspot/cms-dev-server 1.0.10 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/{index-BjXnYvkv.js → index-BROXLRNa.js} +2 -2
- package/dist/app/index.html +1 -1
- package/dist/app/server/serverEntry.js +6 -5
- package/dist/generateJsonFromJsx.js +55 -1
- package/dist/index.js +69 -6
- package/dist/internalSsr.js +8 -3
- package/dist/run.js +69 -6
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +12 -7
- package/package.json +3 -3
- package/types/lib/viteAssetHandler.d.ts +15 -0
- package/types/plugins/hsStaticAssetPlugin.d.ts +2 -0
- package/types/plugins/hubspotStaticAssetPlugin.d.ts +2 -0
- package/types/plugins/remoteAssetsPlugin.d.ts +7 -0
|
@@ -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,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"),`
|
|
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/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/guides/cms/quickstart/react-plus-hubl-quickstart",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}`:`@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})}));
|
|
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/docs/guides/cms/react/overview",text:"CMS 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})}));
|
package/dist/app/index.html
CHANGED
|
@@ -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-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BROXLRNa.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-C0KdU9bk.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -193,7 +193,8 @@ var ClientRenderContextProvider = ({
|
|
|
193
193
|
hydrationFinished,
|
|
194
194
|
island,
|
|
195
195
|
entryPointBasePath: basePath,
|
|
196
|
-
supplementalFieldValues: island == null ? void 0 : island.supplementalFieldValues
|
|
196
|
+
supplementalFieldValues: island == null ? void 0 : island.supplementalFieldValues,
|
|
197
|
+
resolvedDataDependencies: island == null ? void 0 : island.resolvedDataDependencies
|
|
197
198
|
};
|
|
198
199
|
useLayoutEffect(() => {
|
|
199
200
|
if (hydrationFinished.current) {
|
|
@@ -2629,7 +2630,7 @@ const Hero = ({
|
|
|
2629
2630
|
{
|
|
2630
2631
|
text: "Slack Community",
|
|
2631
2632
|
Icon: ExternalLink,
|
|
2632
|
-
url: "https://developers.hubspot.com/
|
|
2633
|
+
url: "https://developers.hubspot.com/docs/getting-started/slack/developer-slack",
|
|
2633
2634
|
className: "hidden lg:block"
|
|
2634
2635
|
}
|
|
2635
2636
|
),
|
|
@@ -2638,7 +2639,7 @@ const Hero = ({
|
|
|
2638
2639
|
{
|
|
2639
2640
|
text: "Getting started docs",
|
|
2640
2641
|
Icon: ExternalLink,
|
|
2641
|
-
url: "https://developers.hubspot.com/docs/cms/
|
|
2642
|
+
url: "https://developers.hubspot.com/docs/guides/cms/quickstart/react-plus-hubl-quickstart",
|
|
2642
2643
|
className: "hidden lg:block"
|
|
2643
2644
|
}
|
|
2644
2645
|
),
|
|
@@ -3376,8 +3377,8 @@ const Footer = () => {
|
|
|
3376
3377
|
text: "CMS React Videos"
|
|
3377
3378
|
},
|
|
3378
3379
|
{
|
|
3379
|
-
href: "https://developers.hubspot.com/
|
|
3380
|
-
text: "React Docs"
|
|
3380
|
+
href: "https://developers.hubspot.com/docs/guides/cms/react/overview",
|
|
3381
|
+
text: "CMS React Docs"
|
|
3381
3382
|
},
|
|
3382
3383
|
{
|
|
3383
3384
|
href: "https://react.dev",
|
|
@@ -9,7 +9,7 @@ import { normalizePath as normalizePath2 } from "vite";
|
|
|
9
9
|
import { createServer as createViteServer } from "vite";
|
|
10
10
|
import { default as react } from "@vitejs/plugin-react";
|
|
11
11
|
|
|
12
|
-
// ../cms-js-internal/dist/types-
|
|
12
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
13
13
|
import path from "path";
|
|
14
14
|
var viteRoot;
|
|
15
15
|
var viteCommand;
|
|
@@ -502,6 +502,59 @@ function cmsComponentsShimPlugin() {
|
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
// src/plugins/hsStaticAssetPlugin.ts
|
|
506
|
+
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
507
|
+
function hsStaticAssetPlugin() {
|
|
508
|
+
return {
|
|
509
|
+
name: "hsstatic-assets-plugin",
|
|
510
|
+
enforce: "pre",
|
|
511
|
+
configureServer(server) {
|
|
512
|
+
return () => {
|
|
513
|
+
const getDomainInfo = (req) => {
|
|
514
|
+
const { authedPortalId, authedHublet, sslEnabled, authedEnv } = req.app.locals;
|
|
515
|
+
const env = authedEnv === "qa" ? "qa" : "";
|
|
516
|
+
const previewDomain = `${authedPortalId}.hubspotpreview${env}-${authedHublet}.com`;
|
|
517
|
+
const protocol = sslEnabled ? "https" : "http";
|
|
518
|
+
return { previewDomain, protocol };
|
|
519
|
+
};
|
|
520
|
+
server.middlewares.use(
|
|
521
|
+
createProxyMiddleware(
|
|
522
|
+
(__pathname, req) => {
|
|
523
|
+
var _a;
|
|
524
|
+
if (!((_a = req.url) == null ? void 0 : _a.match("^/hs/hsstatic/.*")))
|
|
525
|
+
return false;
|
|
526
|
+
const { authedPortalId, authedHublet, authedEnv } = req.app.locals;
|
|
527
|
+
return !!(authedPortalId && authedHublet && authedEnv);
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
changeOrigin: true,
|
|
531
|
+
secure: false,
|
|
532
|
+
xfwd: true,
|
|
533
|
+
logLevel: "silent",
|
|
534
|
+
// This is a placeholder target that gets overridden by the router
|
|
535
|
+
// but is a required parameter for initialization
|
|
536
|
+
target: "https://hubspot.com",
|
|
537
|
+
router: (req) => {
|
|
538
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
539
|
+
return `${protocol}://${previewDomain}`;
|
|
540
|
+
},
|
|
541
|
+
onProxyReq: (proxyReq, req, __res) => {
|
|
542
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
543
|
+
proxyReq.setHeader("X-Forwarded-Proto", protocol);
|
|
544
|
+
proxyReq.setHeader("host", previewDomain);
|
|
545
|
+
proxyReq.setHeader(
|
|
546
|
+
"referer",
|
|
547
|
+
`${protocol}://${previewDomain}/content-rendering/v1/public/_hcms/preview/template/multi`
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
)
|
|
552
|
+
);
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
505
558
|
// src/createViteDevServer.ts
|
|
506
559
|
import { readFileSync } from "fs";
|
|
507
560
|
import { join } from "path";
|
|
@@ -582,6 +635,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
582
635
|
root: webRoot,
|
|
583
636
|
...ssrAndOptimizeDep,
|
|
584
637
|
plugins: [
|
|
638
|
+
hsStaticAssetPlugin(),
|
|
585
639
|
jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
|
|
586
640
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
587
641
|
componentsShimPlugin,
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createServer as createViteServer } from "vite";
|
|
3
3
|
import { default as react } from "@vitejs/plugin-react";
|
|
4
4
|
|
|
5
|
-
// ../cms-js-internal/dist/types-
|
|
5
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { createHash } from "crypto";
|
|
8
8
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -330,7 +330,8 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
330
330
|
sharedStateID,
|
|
331
331
|
supplementalFieldValues,
|
|
332
332
|
wrapperModuleId,
|
|
333
|
-
wrapperUrl
|
|
333
|
+
wrapperUrl,
|
|
334
|
+
resolvedDataDependencies
|
|
334
335
|
}) => {
|
|
335
336
|
const output = {
|
|
336
337
|
id,
|
|
@@ -342,6 +343,9 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
342
343
|
props,
|
|
343
344
|
url: url3
|
|
344
345
|
};
|
|
346
|
+
if (resolvedDataDependencies) {
|
|
347
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
348
|
+
}
|
|
345
349
|
if (sharedStateID) {
|
|
346
350
|
output.sharedStateID = sharedStateID;
|
|
347
351
|
}
|
|
@@ -989,6 +993,59 @@ function cmsComponentsShimPlugin() {
|
|
|
989
993
|
};
|
|
990
994
|
}
|
|
991
995
|
|
|
996
|
+
// src/plugins/hsStaticAssetPlugin.ts
|
|
997
|
+
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
998
|
+
function hsStaticAssetPlugin() {
|
|
999
|
+
return {
|
|
1000
|
+
name: "hsstatic-assets-plugin",
|
|
1001
|
+
enforce: "pre",
|
|
1002
|
+
configureServer(server) {
|
|
1003
|
+
return () => {
|
|
1004
|
+
const getDomainInfo = (req) => {
|
|
1005
|
+
const { authedPortalId, authedHublet, sslEnabled, authedEnv } = req.app.locals;
|
|
1006
|
+
const env = authedEnv === "qa" ? "qa" : "";
|
|
1007
|
+
const previewDomain = `${authedPortalId}.hubspotpreview${env}-${authedHublet}.com`;
|
|
1008
|
+
const protocol = sslEnabled ? "https" : "http";
|
|
1009
|
+
return { previewDomain, protocol };
|
|
1010
|
+
};
|
|
1011
|
+
server.middlewares.use(
|
|
1012
|
+
createProxyMiddleware(
|
|
1013
|
+
(__pathname, req) => {
|
|
1014
|
+
var _a;
|
|
1015
|
+
if (!((_a = req.url) == null ? void 0 : _a.match("^/hs/hsstatic/.*")))
|
|
1016
|
+
return false;
|
|
1017
|
+
const { authedPortalId, authedHublet, authedEnv } = req.app.locals;
|
|
1018
|
+
return !!(authedPortalId && authedHublet && authedEnv);
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
changeOrigin: true,
|
|
1022
|
+
secure: false,
|
|
1023
|
+
xfwd: true,
|
|
1024
|
+
logLevel: "silent",
|
|
1025
|
+
// This is a placeholder target that gets overridden by the router
|
|
1026
|
+
// but is a required parameter for initialization
|
|
1027
|
+
target: "https://hubspot.com",
|
|
1028
|
+
router: (req) => {
|
|
1029
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
1030
|
+
return `${protocol}://${previewDomain}`;
|
|
1031
|
+
},
|
|
1032
|
+
onProxyReq: (proxyReq, req, __res) => {
|
|
1033
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
1034
|
+
proxyReq.setHeader("X-Forwarded-Proto", protocol);
|
|
1035
|
+
proxyReq.setHeader("host", previewDomain);
|
|
1036
|
+
proxyReq.setHeader(
|
|
1037
|
+
"referer",
|
|
1038
|
+
`${protocol}://${previewDomain}/content-rendering/v1/public/_hcms/preview/template/multi`
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
)
|
|
1043
|
+
);
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
|
|
992
1049
|
// src/createViteDevServer.ts
|
|
993
1050
|
import { readFileSync as readFileSync2 } from "fs";
|
|
994
1051
|
import { join as join2 } from "path";
|
|
@@ -1069,6 +1126,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
1069
1126
|
root: webRoot,
|
|
1070
1127
|
...ssrAndOptimizeDep,
|
|
1071
1128
|
plugins: [
|
|
1129
|
+
hsStaticAssetPlugin(),
|
|
1072
1130
|
jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
|
|
1073
1131
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
1074
1132
|
componentsShimPlugin,
|
|
@@ -1100,7 +1158,7 @@ import {
|
|
|
1100
1158
|
urlencoded,
|
|
1101
1159
|
static as expressStatic
|
|
1102
1160
|
} from "express";
|
|
1103
|
-
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
1161
|
+
import { createProxyMiddleware as createProxyMiddleware2 } from "http-proxy-middleware";
|
|
1104
1162
|
|
|
1105
1163
|
// src/routes/partial.ts
|
|
1106
1164
|
import path7 from "path";
|
|
@@ -1515,7 +1573,7 @@ function trackUsage(action) {
|
|
|
1515
1573
|
eventName: EVENT_NAME,
|
|
1516
1574
|
action,
|
|
1517
1575
|
nodeVersion: getNodeVersionData(),
|
|
1518
|
-
version: "1.0.
|
|
1576
|
+
version: "1.0.17",
|
|
1519
1577
|
os: getPlatform()
|
|
1520
1578
|
};
|
|
1521
1579
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -3975,6 +4033,7 @@ var buildModuleIndex = () => buildHTMLResponse(`
|
|
|
3975
4033
|
import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
3976
4034
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
3977
4035
|
import { getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
4036
|
+
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
3978
4037
|
var templateRouteHandler = async (request2, response) => {
|
|
3979
4038
|
sendTrackingRequest("view-template-route");
|
|
3980
4039
|
const {
|
|
@@ -4031,9 +4090,13 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4031
4090
|
params
|
|
4032
4091
|
})).data;
|
|
4033
4092
|
const pageHtml = addRefreshScript(result);
|
|
4093
|
+
const finalHtml = pageHtml.replace(
|
|
4094
|
+
HUBSPOT_PREVIEW_BASE_TAG_REGEX,
|
|
4095
|
+
'<base href="/" />'
|
|
4096
|
+
);
|
|
4034
4097
|
infillReactModulesAndWriteResponse(
|
|
4035
4098
|
response,
|
|
4036
|
-
|
|
4099
|
+
finalHtml,
|
|
4037
4100
|
webRoot,
|
|
4038
4101
|
fullOriginalUrl,
|
|
4039
4102
|
environmentConfig,
|
|
@@ -4336,7 +4399,7 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
|
4336
4399
|
});
|
|
4337
4400
|
if (storybookPort) {
|
|
4338
4401
|
devServerApp.use(
|
|
4339
|
-
|
|
4402
|
+
createProxyMiddleware2(
|
|
4340
4403
|
(__pathname, req) => STORYBOOK_DOMAINS.includes(req.hostname),
|
|
4341
4404
|
{
|
|
4342
4405
|
logLevel: "warn",
|
package/dist/internalSsr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../cms-js-internal/dist/types-
|
|
1
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { createHash } from "crypto";
|
|
4
4
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -322,7 +322,8 @@ var GATES = [
|
|
|
322
322
|
"CMS:JSRenderer:RemoveMockClientEntryPlugin",
|
|
323
323
|
"CMS:JSRenderer:AnalyzeCmsModules",
|
|
324
324
|
"CMS:JSRenderer:ClientOnlySupplementalFieldSerialization",
|
|
325
|
-
"CMS:React:UnifiedThemePreview"
|
|
325
|
+
"CMS:React:UnifiedThemePreview",
|
|
326
|
+
"CMS:JSRenderer:CompressResponse"
|
|
326
327
|
];
|
|
327
328
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
328
329
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
@@ -495,7 +496,8 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
495
496
|
sharedStateID,
|
|
496
497
|
supplementalFieldValues,
|
|
497
498
|
wrapperModuleId,
|
|
498
|
-
wrapperUrl
|
|
499
|
+
wrapperUrl,
|
|
500
|
+
resolvedDataDependencies
|
|
499
501
|
}) => {
|
|
500
502
|
const output = {
|
|
501
503
|
id,
|
|
@@ -507,6 +509,9 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
507
509
|
props,
|
|
508
510
|
url
|
|
509
511
|
};
|
|
512
|
+
if (resolvedDataDependencies) {
|
|
513
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
514
|
+
}
|
|
510
515
|
if (sharedStateID) {
|
|
511
516
|
output.sharedStateID = sharedStateID;
|
|
512
517
|
}
|
package/dist/run.js
CHANGED
|
@@ -773,7 +773,7 @@ import {
|
|
|
773
773
|
urlencoded,
|
|
774
774
|
static as expressStatic
|
|
775
775
|
} from "express";
|
|
776
|
-
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
776
|
+
import { createProxyMiddleware as createProxyMiddleware2 } from "http-proxy-middleware";
|
|
777
777
|
|
|
778
778
|
// src/routes/partial.ts
|
|
779
779
|
import path8 from "path";
|
|
@@ -811,7 +811,7 @@ function packagePath(metaUrl, projectPath) {
|
|
|
811
811
|
);
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
-
// ../cms-js-internal/dist/types-
|
|
814
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
815
815
|
import path3 from "path";
|
|
816
816
|
import { createHash } from "crypto";
|
|
817
817
|
import fs2, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
|
|
@@ -1139,7 +1139,8 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
1139
1139
|
sharedStateID,
|
|
1140
1140
|
supplementalFieldValues,
|
|
1141
1141
|
wrapperModuleId,
|
|
1142
|
-
wrapperUrl
|
|
1142
|
+
wrapperUrl,
|
|
1143
|
+
resolvedDataDependencies
|
|
1143
1144
|
}) => {
|
|
1144
1145
|
const output = {
|
|
1145
1146
|
id,
|
|
@@ -1151,6 +1152,9 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
1151
1152
|
props,
|
|
1152
1153
|
url: url3
|
|
1153
1154
|
};
|
|
1155
|
+
if (resolvedDataDependencies) {
|
|
1156
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
1157
|
+
}
|
|
1154
1158
|
if (sharedStateID) {
|
|
1155
1159
|
output.sharedStateID = sharedStateID;
|
|
1156
1160
|
}
|
|
@@ -2097,7 +2101,7 @@ function trackUsage(action) {
|
|
|
2097
2101
|
eventName: EVENT_NAME,
|
|
2098
2102
|
action,
|
|
2099
2103
|
nodeVersion: getNodeVersionData(),
|
|
2100
|
-
version: "1.0.
|
|
2104
|
+
version: "1.0.17",
|
|
2101
2105
|
os: getPlatform()
|
|
2102
2106
|
};
|
|
2103
2107
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -4557,6 +4561,7 @@ var buildModuleIndex = () => buildHTMLResponse(`
|
|
|
4557
4561
|
import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
4558
4562
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
4559
4563
|
import { getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
4564
|
+
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
4560
4565
|
var templateRouteHandler = async (request2, response) => {
|
|
4561
4566
|
sendTrackingRequest("view-template-route");
|
|
4562
4567
|
const {
|
|
@@ -4613,9 +4618,13 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4613
4618
|
params
|
|
4614
4619
|
})).data;
|
|
4615
4620
|
const pageHtml = addRefreshScript(result);
|
|
4621
|
+
const finalHtml = pageHtml.replace(
|
|
4622
|
+
HUBSPOT_PREVIEW_BASE_TAG_REGEX,
|
|
4623
|
+
'<base href="/" />'
|
|
4624
|
+
);
|
|
4616
4625
|
infillReactModulesAndWriteResponse(
|
|
4617
4626
|
response,
|
|
4618
|
-
|
|
4627
|
+
finalHtml,
|
|
4619
4628
|
webRoot2,
|
|
4620
4629
|
fullOriginalUrl,
|
|
4621
4630
|
environmentConfig,
|
|
@@ -4778,6 +4787,59 @@ function cmsComponentsShimPlugin() {
|
|
|
4778
4787
|
};
|
|
4779
4788
|
}
|
|
4780
4789
|
|
|
4790
|
+
// src/plugins/hsStaticAssetPlugin.ts
|
|
4791
|
+
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
4792
|
+
function hsStaticAssetPlugin() {
|
|
4793
|
+
return {
|
|
4794
|
+
name: "hsstatic-assets-plugin",
|
|
4795
|
+
enforce: "pre",
|
|
4796
|
+
configureServer(server) {
|
|
4797
|
+
return () => {
|
|
4798
|
+
const getDomainInfo = (req) => {
|
|
4799
|
+
const { authedPortalId, authedHublet, sslEnabled, authedEnv } = req.app.locals;
|
|
4800
|
+
const env2 = authedEnv === "qa" ? "qa" : "";
|
|
4801
|
+
const previewDomain = `${authedPortalId}.hubspotpreview${env2}-${authedHublet}.com`;
|
|
4802
|
+
const protocol = sslEnabled ? "https" : "http";
|
|
4803
|
+
return { previewDomain, protocol };
|
|
4804
|
+
};
|
|
4805
|
+
server.middlewares.use(
|
|
4806
|
+
createProxyMiddleware(
|
|
4807
|
+
(__pathname, req) => {
|
|
4808
|
+
var _a;
|
|
4809
|
+
if (!((_a = req.url) == null ? void 0 : _a.match("^/hs/hsstatic/.*")))
|
|
4810
|
+
return false;
|
|
4811
|
+
const { authedPortalId, authedHublet, authedEnv } = req.app.locals;
|
|
4812
|
+
return !!(authedPortalId && authedHublet && authedEnv);
|
|
4813
|
+
},
|
|
4814
|
+
{
|
|
4815
|
+
changeOrigin: true,
|
|
4816
|
+
secure: false,
|
|
4817
|
+
xfwd: true,
|
|
4818
|
+
logLevel: "silent",
|
|
4819
|
+
// This is a placeholder target that gets overridden by the router
|
|
4820
|
+
// but is a required parameter for initialization
|
|
4821
|
+
target: "https://hubspot.com",
|
|
4822
|
+
router: (req) => {
|
|
4823
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
4824
|
+
return `${protocol}://${previewDomain}`;
|
|
4825
|
+
},
|
|
4826
|
+
onProxyReq: (proxyReq, req, __res) => {
|
|
4827
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
4828
|
+
proxyReq.setHeader("X-Forwarded-Proto", protocol);
|
|
4829
|
+
proxyReq.setHeader("host", previewDomain);
|
|
4830
|
+
proxyReq.setHeader(
|
|
4831
|
+
"referer",
|
|
4832
|
+
`${protocol}://${previewDomain}/content-rendering/v1/public/_hcms/preview/template/multi`
|
|
4833
|
+
);
|
|
4834
|
+
}
|
|
4835
|
+
}
|
|
4836
|
+
)
|
|
4837
|
+
);
|
|
4838
|
+
};
|
|
4839
|
+
}
|
|
4840
|
+
};
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4781
4843
|
// src/createViteDevServer.ts
|
|
4782
4844
|
import { readFileSync as readFileSync3 } from "fs";
|
|
4783
4845
|
import { join as join4 } from "path";
|
|
@@ -4858,6 +4920,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
4858
4920
|
root: webRoot2,
|
|
4859
4921
|
...ssrAndOptimizeDep,
|
|
4860
4922
|
plugins: [
|
|
4923
|
+
hsStaticAssetPlugin(),
|
|
4861
4924
|
jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
|
|
4862
4925
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
4863
4926
|
componentsShimPlugin,
|
|
@@ -5076,7 +5139,7 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
|
5076
5139
|
});
|
|
5077
5140
|
if (storybookPort) {
|
|
5078
5141
|
devServerApp.use(
|
|
5079
|
-
|
|
5142
|
+
createProxyMiddleware2(
|
|
5080
5143
|
(__pathname, req) => STORYBOOK_DOMAINS.includes(req.hostname),
|
|
5081
5144
|
{
|
|
5082
5145
|
logLevel: "warn",
|
package/dist/storybook/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// ../cms-js-internal/dist/types-
|
|
11
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -313,8 +313,8 @@ function isStylesheetAsset(staticAsset) {
|
|
|
313
313
|
return staticAsset.type === "stylesheet";
|
|
314
314
|
}
|
|
315
315
|
var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, TEMPLATE_FOLDER_PATH, VIRTUAL_ISLAND_RUNTIME, VIRTUAL_CONFIG_SETUP, CSS_LANGS_RE, collectCssModules, collectCssInDev, badInlineJsChars, inlineJsEscapeChars, viteRoot, viteCommand, clientRenderIsland, virtualClientRenderIslandModuleId, scriptTagToLogServerMessages, getComponentExtension, hasComponentExtension, isStorybookStory, removeComponentExtension, COMBINED_REACT_BASE_PATH, ISLAND_RUNTIME_CONFIG_BASE_PATH, removeIndexFromPath, removeIndexOrTrailingJsFromPath, HEALTHCHECKS_ENABLED_DEFAULT, HEALTHCHECKS_STRICT_DEFAULT, BUILD_INFO_PATH, GATES, ENABLED_FEATURES_GATE_MAP, findAllComponentsIn;
|
|
316
|
-
var
|
|
317
|
-
"../cms-js-internal/dist/types-
|
|
316
|
+
var init_types_CtlqY6u0 = __esm({
|
|
317
|
+
"../cms-js-internal/dist/types-CtlqY6u0.js"() {
|
|
318
318
|
COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
319
319
|
ENTRY_POINTS_PATH = "components/partials/";
|
|
320
320
|
MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -437,7 +437,8 @@ ${groupEnd}</script>
|
|
|
437
437
|
"CMS:JSRenderer:RemoveMockClientEntryPlugin",
|
|
438
438
|
"CMS:JSRenderer:AnalyzeCmsModules",
|
|
439
439
|
"CMS:JSRenderer:ClientOnlySupplementalFieldSerialization",
|
|
440
|
-
"CMS:React:UnifiedThemePreview"
|
|
440
|
+
"CMS:React:UnifiedThemePreview",
|
|
441
|
+
"CMS:JSRenderer:CompressResponse"
|
|
441
442
|
];
|
|
442
443
|
ENABLED_FEATURES_GATE_MAP = {
|
|
443
444
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
@@ -1097,8 +1098,8 @@ function ModuleSlot(props) {
|
|
|
1097
1098
|
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
1098
1099
|
var init_dist = __esm({
|
|
1099
1100
|
"../cms-js-internal/dist/index.js"() {
|
|
1100
|
-
|
|
1101
|
-
|
|
1101
|
+
init_types_CtlqY6u0();
|
|
1102
|
+
init_types_CtlqY6u0();
|
|
1102
1103
|
({ setProperty, getProperty, hasProperty } = dotProp);
|
|
1103
1104
|
serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
|
|
1104
1105
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
|
@@ -1114,7 +1115,8 @@ var init_dist = __esm({
|
|
|
1114
1115
|
sharedStateID,
|
|
1115
1116
|
supplementalFieldValues,
|
|
1116
1117
|
wrapperModuleId,
|
|
1117
|
-
wrapperUrl
|
|
1118
|
+
wrapperUrl,
|
|
1119
|
+
resolvedDataDependencies
|
|
1118
1120
|
}) => {
|
|
1119
1121
|
const output = {
|
|
1120
1122
|
id,
|
|
@@ -1126,6 +1128,9 @@ var init_dist = __esm({
|
|
|
1126
1128
|
props,
|
|
1127
1129
|
url
|
|
1128
1130
|
};
|
|
1131
|
+
if (resolvedDataDependencies) {
|
|
1132
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
1133
|
+
}
|
|
1129
1134
|
if (sharedStateID) {
|
|
1130
1135
|
output.sharedStateID = sharedStateID;
|
|
1131
1136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
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.
|
|
32
|
+
"@hubspot/cms-components": "^1.0.17",
|
|
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",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"publishConfig": {
|
|
132
132
|
"access": "public"
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "039eff6b0212f13bf55d14b56b386895747b5d56"
|
|
135
135
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Processes HTML to find remote assets and replace with Vite-managed URLs
|
|
4
|
+
*/
|
|
5
|
+
export declare function processRemoteAssets(html: string, viteServer: ViteDevServer): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Vite plugin to handle remote assets
|
|
8
|
+
*/
|
|
9
|
+
export declare function remoteAssetsPlugin(): {
|
|
10
|
+
name: string;
|
|
11
|
+
apply: "serve";
|
|
12
|
+
configResolved(config: any): void;
|
|
13
|
+
resolveId(id: string): string;
|
|
14
|
+
load(id: string): Promise<string>;
|
|
15
|
+
};
|