@hubspot/cms-dev-server 1.0.16 → 1.0.19
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 +4 -4
- package/dist/generateJsonFromJsx.js +55 -1
- package/dist/index.js +142 -12
- package/dist/internalSsr.js +76 -7
- package/dist/run.js +142 -12
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +80 -11
- 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>
|
|
@@ -2630,7 +2630,7 @@ const Hero = ({
|
|
|
2630
2630
|
{
|
|
2631
2631
|
text: "Slack Community",
|
|
2632
2632
|
Icon: ExternalLink,
|
|
2633
|
-
url: "https://developers.hubspot.com/
|
|
2633
|
+
url: "https://developers.hubspot.com/docs/getting-started/slack/developer-slack",
|
|
2634
2634
|
className: "hidden lg:block"
|
|
2635
2635
|
}
|
|
2636
2636
|
),
|
|
@@ -2639,7 +2639,7 @@ const Hero = ({
|
|
|
2639
2639
|
{
|
|
2640
2640
|
text: "Getting started docs",
|
|
2641
2641
|
Icon: ExternalLink,
|
|
2642
|
-
url: "https://developers.hubspot.com/docs/cms/
|
|
2642
|
+
url: "https://developers.hubspot.com/docs/guides/cms/quickstart/react-plus-hubl-quickstart",
|
|
2643
2643
|
className: "hidden lg:block"
|
|
2644
2644
|
}
|
|
2645
2645
|
),
|
|
@@ -3377,8 +3377,8 @@ const Footer = () => {
|
|
|
3377
3377
|
text: "CMS React Videos"
|
|
3378
3378
|
},
|
|
3379
3379
|
{
|
|
3380
|
-
href: "https://developers.hubspot.com/
|
|
3381
|
-
text: "React Docs"
|
|
3380
|
+
href: "https://developers.hubspot.com/docs/guides/cms/react/overview",
|
|
3381
|
+
text: "CMS React Docs"
|
|
3382
3382
|
},
|
|
3383
3383
|
{
|
|
3384
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-BxnmA6nH.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-BxnmA6nH.js
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { createHash } from "crypto";
|
|
8
8
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -10,6 +10,64 @@ import { join } from "path/posix";
|
|
|
10
10
|
var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
11
11
|
var ENTRY_POINTS_PATH = "components/partials/";
|
|
12
12
|
var MODULE_FOLDER_PATH = "components/modules/";
|
|
13
|
+
function sortKeys(input, options = {}) {
|
|
14
|
+
const { deep, compare } = options;
|
|
15
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
function deepSortArray(array) {
|
|
17
|
+
const resultFromCache = cache.get(array);
|
|
18
|
+
if (resultFromCache !== void 0) {
|
|
19
|
+
return resultFromCache;
|
|
20
|
+
}
|
|
21
|
+
const result = [];
|
|
22
|
+
cache.set(array, result);
|
|
23
|
+
result.push(
|
|
24
|
+
...array.map((item) => {
|
|
25
|
+
if (Array.isArray(item)) {
|
|
26
|
+
return deepSortArray(item);
|
|
27
|
+
}
|
|
28
|
+
if (isPlainObject(item)) {
|
|
29
|
+
return _sortKeys(item);
|
|
30
|
+
}
|
|
31
|
+
return item;
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function _sortKeys(object) {
|
|
37
|
+
const resultFromCache = cache.get(object);
|
|
38
|
+
if (resultFromCache !== void 0) {
|
|
39
|
+
return resultFromCache;
|
|
40
|
+
}
|
|
41
|
+
const result = {};
|
|
42
|
+
const keys = Object.keys(object).sort(compare);
|
|
43
|
+
cache.set(object, result);
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
const value = object[key];
|
|
46
|
+
let newValue;
|
|
47
|
+
if (deep && Array.isArray(value)) {
|
|
48
|
+
newValue = deepSortArray(value);
|
|
49
|
+
} else {
|
|
50
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
51
|
+
}
|
|
52
|
+
Object.defineProperty(result, key, {
|
|
53
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
54
|
+
value: newValue
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(input)) {
|
|
60
|
+
return deep ? deepSortArray(input) : [...input];
|
|
61
|
+
}
|
|
62
|
+
return _sortKeys(input);
|
|
63
|
+
}
|
|
64
|
+
function isPlainObject(value) {
|
|
65
|
+
if (typeof value !== "object" || value === null) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const prototype = Object.getPrototypeOf(value);
|
|
69
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
70
|
+
}
|
|
13
71
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
14
72
|
var inlineJsEscapeChars = {
|
|
15
73
|
"\u2028": "\\u2028",
|
|
@@ -27,11 +85,18 @@ function escapeForInlineJS(input) {
|
|
|
27
85
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
28
86
|
const indentString = " ".repeat(baseIndent);
|
|
29
87
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
88
|
+
let sorted;
|
|
89
|
+
try {
|
|
90
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
91
|
+
sorted = sortKeys(input, { deep: true });
|
|
92
|
+
}
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.error("Error sorting Island keys", e);
|
|
95
|
+
}
|
|
96
|
+
return escapeForInlineJS(
|
|
97
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
98
|
+
).replace(/\n/gm, `
|
|
99
|
+
${indentString}`);
|
|
35
100
|
}
|
|
36
101
|
var viteRoot;
|
|
37
102
|
var viteCommand;
|
|
@@ -330,7 +395,8 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
330
395
|
sharedStateID,
|
|
331
396
|
supplementalFieldValues,
|
|
332
397
|
wrapperModuleId,
|
|
333
|
-
wrapperUrl
|
|
398
|
+
wrapperUrl,
|
|
399
|
+
resolvedDataDependencies
|
|
334
400
|
}) => {
|
|
335
401
|
const output = {
|
|
336
402
|
id,
|
|
@@ -342,6 +408,9 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
342
408
|
props,
|
|
343
409
|
url: url3
|
|
344
410
|
};
|
|
411
|
+
if (resolvedDataDependencies) {
|
|
412
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
413
|
+
}
|
|
345
414
|
if (sharedStateID) {
|
|
346
415
|
output.sharedStateID = sharedStateID;
|
|
347
416
|
}
|
|
@@ -989,6 +1058,59 @@ function cmsComponentsShimPlugin() {
|
|
|
989
1058
|
};
|
|
990
1059
|
}
|
|
991
1060
|
|
|
1061
|
+
// src/plugins/hsStaticAssetPlugin.ts
|
|
1062
|
+
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
1063
|
+
function hsStaticAssetPlugin() {
|
|
1064
|
+
return {
|
|
1065
|
+
name: "hsstatic-assets-plugin",
|
|
1066
|
+
enforce: "pre",
|
|
1067
|
+
configureServer(server) {
|
|
1068
|
+
return () => {
|
|
1069
|
+
const getDomainInfo = (req) => {
|
|
1070
|
+
const { authedPortalId, authedHublet, sslEnabled, authedEnv } = req.app.locals;
|
|
1071
|
+
const env = authedEnv === "qa" ? "qa" : "";
|
|
1072
|
+
const previewDomain = `${authedPortalId}.hubspotpreview${env}-${authedHublet}.com`;
|
|
1073
|
+
const protocol = sslEnabled ? "https" : "http";
|
|
1074
|
+
return { previewDomain, protocol };
|
|
1075
|
+
};
|
|
1076
|
+
server.middlewares.use(
|
|
1077
|
+
createProxyMiddleware(
|
|
1078
|
+
(__pathname, req) => {
|
|
1079
|
+
var _a;
|
|
1080
|
+
if (!((_a = req.url) == null ? void 0 : _a.match("^/hs/hsstatic/.*")))
|
|
1081
|
+
return false;
|
|
1082
|
+
const { authedPortalId, authedHublet, authedEnv } = req.app.locals;
|
|
1083
|
+
return !!(authedPortalId && authedHublet && authedEnv);
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
changeOrigin: true,
|
|
1087
|
+
secure: false,
|
|
1088
|
+
xfwd: true,
|
|
1089
|
+
logLevel: "silent",
|
|
1090
|
+
// This is a placeholder target that gets overridden by the router
|
|
1091
|
+
// but is a required parameter for initialization
|
|
1092
|
+
target: "https://hubspot.com",
|
|
1093
|
+
router: (req) => {
|
|
1094
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
1095
|
+
return `${protocol}://${previewDomain}`;
|
|
1096
|
+
},
|
|
1097
|
+
onProxyReq: (proxyReq, req, __res) => {
|
|
1098
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
1099
|
+
proxyReq.setHeader("X-Forwarded-Proto", protocol);
|
|
1100
|
+
proxyReq.setHeader("host", previewDomain);
|
|
1101
|
+
proxyReq.setHeader(
|
|
1102
|
+
"referer",
|
|
1103
|
+
`${protocol}://${previewDomain}/content-rendering/v1/public/_hcms/preview/template/multi`
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
)
|
|
1108
|
+
);
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
|
|
992
1114
|
// src/createViteDevServer.ts
|
|
993
1115
|
import { readFileSync as readFileSync2 } from "fs";
|
|
994
1116
|
import { join as join2 } from "path";
|
|
@@ -1069,6 +1191,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
1069
1191
|
root: webRoot,
|
|
1070
1192
|
...ssrAndOptimizeDep,
|
|
1071
1193
|
plugins: [
|
|
1194
|
+
hsStaticAssetPlugin(),
|
|
1072
1195
|
jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
|
|
1073
1196
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
1074
1197
|
componentsShimPlugin,
|
|
@@ -1100,7 +1223,7 @@ import {
|
|
|
1100
1223
|
urlencoded,
|
|
1101
1224
|
static as expressStatic
|
|
1102
1225
|
} from "express";
|
|
1103
|
-
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
1226
|
+
import { createProxyMiddleware as createProxyMiddleware2 } from "http-proxy-middleware";
|
|
1104
1227
|
|
|
1105
1228
|
// src/routes/partial.ts
|
|
1106
1229
|
import path7 from "path";
|
|
@@ -1515,7 +1638,7 @@ function trackUsage(action) {
|
|
|
1515
1638
|
eventName: EVENT_NAME,
|
|
1516
1639
|
action,
|
|
1517
1640
|
nodeVersion: getNodeVersionData(),
|
|
1518
|
-
version: "1.0.
|
|
1641
|
+
version: "1.0.19",
|
|
1519
1642
|
os: getPlatform()
|
|
1520
1643
|
};
|
|
1521
1644
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -3975,6 +4098,7 @@ var buildModuleIndex = () => buildHTMLResponse(`
|
|
|
3975
4098
|
import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
3976
4099
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
3977
4100
|
import { getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
4101
|
+
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
3978
4102
|
var templateRouteHandler = async (request2, response) => {
|
|
3979
4103
|
sendTrackingRequest("view-template-route");
|
|
3980
4104
|
const {
|
|
@@ -4031,9 +4155,13 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4031
4155
|
params
|
|
4032
4156
|
})).data;
|
|
4033
4157
|
const pageHtml = addRefreshScript(result);
|
|
4158
|
+
const finalHtml = pageHtml.replace(
|
|
4159
|
+
HUBSPOT_PREVIEW_BASE_TAG_REGEX,
|
|
4160
|
+
'<base href="/" />'
|
|
4161
|
+
);
|
|
4034
4162
|
infillReactModulesAndWriteResponse(
|
|
4035
4163
|
response,
|
|
4036
|
-
|
|
4164
|
+
finalHtml,
|
|
4037
4165
|
webRoot,
|
|
4038
4166
|
fullOriginalUrl,
|
|
4039
4167
|
environmentConfig,
|
|
@@ -4336,7 +4464,7 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
|
4336
4464
|
});
|
|
4337
4465
|
if (storybookPort) {
|
|
4338
4466
|
devServerApp.use(
|
|
4339
|
-
|
|
4467
|
+
createProxyMiddleware2(
|
|
4340
4468
|
(__pathname, req) => STORYBOOK_DOMAINS.includes(req.hostname),
|
|
4341
4469
|
{
|
|
4342
4470
|
logLevel: "warn",
|
|
@@ -4350,7 +4478,7 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
|
4350
4478
|
const distAssetsPath = path13.join(appWebRoot, "assets");
|
|
4351
4479
|
devServerApp.use("/assets", expressStatic(distAssetsPath));
|
|
4352
4480
|
} else {
|
|
4353
|
-
devServerApp.use(appViteServer.middlewares);
|
|
4481
|
+
devServerApp.use("/local", appViteServer.middlewares);
|
|
4354
4482
|
}
|
|
4355
4483
|
devServerApp.use(viteServer.middlewares);
|
|
4356
4484
|
devServerApp.use("/api", createAppServerAPIRoutes_default());
|
|
@@ -4498,6 +4626,7 @@ import {
|
|
|
4498
4626
|
} from "vite";
|
|
4499
4627
|
import { default as react2 } from "@vitejs/plugin-react";
|
|
4500
4628
|
import { default as mkcert2 } from "vite-plugin-mkcert";
|
|
4629
|
+
var isProd3 = true;
|
|
4501
4630
|
async function createAppServer(appWebRoot, port, sslEnabled) {
|
|
4502
4631
|
const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
|
|
4503
4632
|
const viteConfig = {
|
|
@@ -4512,6 +4641,7 @@ async function createAppServer(appWebRoot, port, sslEnabled) {
|
|
|
4512
4641
|
},
|
|
4513
4642
|
appType: "custom",
|
|
4514
4643
|
root: appWebRoot,
|
|
4644
|
+
base: isProd3 ? void 0 : "/local",
|
|
4515
4645
|
ssr: {
|
|
4516
4646
|
noExternal: "@hubspot/cms-components"
|
|
4517
4647
|
},
|
package/dist/internalSsr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../cms-js-internal/dist/types-
|
|
1
|
+
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { createHash } from "crypto";
|
|
4
4
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -68,6 +68,64 @@ var collectCssInDev = (modulePathToStartWith, viteServer, cssModulesImported = /
|
|
|
68
68
|
).map((cssModule) => createPreloadLink(cssModule.url)).join("\n")}
|
|
69
69
|
`;
|
|
70
70
|
};
|
|
71
|
+
function sortKeys(input, options = {}) {
|
|
72
|
+
const { deep, compare } = options;
|
|
73
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
74
|
+
function deepSortArray(array) {
|
|
75
|
+
const resultFromCache = cache.get(array);
|
|
76
|
+
if (resultFromCache !== void 0) {
|
|
77
|
+
return resultFromCache;
|
|
78
|
+
}
|
|
79
|
+
const result = [];
|
|
80
|
+
cache.set(array, result);
|
|
81
|
+
result.push(
|
|
82
|
+
...array.map((item) => {
|
|
83
|
+
if (Array.isArray(item)) {
|
|
84
|
+
return deepSortArray(item);
|
|
85
|
+
}
|
|
86
|
+
if (isPlainObject(item)) {
|
|
87
|
+
return _sortKeys(item);
|
|
88
|
+
}
|
|
89
|
+
return item;
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
function _sortKeys(object) {
|
|
95
|
+
const resultFromCache = cache.get(object);
|
|
96
|
+
if (resultFromCache !== void 0) {
|
|
97
|
+
return resultFromCache;
|
|
98
|
+
}
|
|
99
|
+
const result = {};
|
|
100
|
+
const keys = Object.keys(object).sort(compare);
|
|
101
|
+
cache.set(object, result);
|
|
102
|
+
for (const key of keys) {
|
|
103
|
+
const value = object[key];
|
|
104
|
+
let newValue;
|
|
105
|
+
if (deep && Array.isArray(value)) {
|
|
106
|
+
newValue = deepSortArray(value);
|
|
107
|
+
} else {
|
|
108
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
109
|
+
}
|
|
110
|
+
Object.defineProperty(result, key, {
|
|
111
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
112
|
+
value: newValue
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(input)) {
|
|
118
|
+
return deep ? deepSortArray(input) : [...input];
|
|
119
|
+
}
|
|
120
|
+
return _sortKeys(input);
|
|
121
|
+
}
|
|
122
|
+
function isPlainObject(value) {
|
|
123
|
+
if (typeof value !== "object" || value === null) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const prototype = Object.getPrototypeOf(value);
|
|
127
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
128
|
+
}
|
|
71
129
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
72
130
|
var inlineJsEscapeChars = {
|
|
73
131
|
"\u2028": "\\u2028",
|
|
@@ -85,11 +143,18 @@ function escapeForInlineJS(input) {
|
|
|
85
143
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
86
144
|
const indentString = " ".repeat(baseIndent);
|
|
87
145
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
146
|
+
let sorted;
|
|
147
|
+
try {
|
|
148
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
149
|
+
sorted = sortKeys(input, { deep: true });
|
|
150
|
+
}
|
|
151
|
+
} catch (e) {
|
|
152
|
+
console.error("Error sorting Island keys", e);
|
|
153
|
+
}
|
|
154
|
+
return escapeForInlineJS(
|
|
155
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
156
|
+
).replace(/\n/gm, `
|
|
157
|
+
${indentString}`);
|
|
93
158
|
}
|
|
94
159
|
var viteRoot;
|
|
95
160
|
var viteCommand;
|
|
@@ -496,7 +561,8 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
496
561
|
sharedStateID,
|
|
497
562
|
supplementalFieldValues,
|
|
498
563
|
wrapperModuleId,
|
|
499
|
-
wrapperUrl
|
|
564
|
+
wrapperUrl,
|
|
565
|
+
resolvedDataDependencies
|
|
500
566
|
}) => {
|
|
501
567
|
const output = {
|
|
502
568
|
id,
|
|
@@ -508,6 +574,9 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
508
574
|
props,
|
|
509
575
|
url
|
|
510
576
|
};
|
|
577
|
+
if (resolvedDataDependencies) {
|
|
578
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
579
|
+
}
|
|
511
580
|
if (sharedStateID) {
|
|
512
581
|
output.sharedStateID = sharedStateID;
|
|
513
582
|
}
|
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-BxnmA6nH.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";
|
|
@@ -819,6 +819,64 @@ import { join as join2 } from "path/posix";
|
|
|
819
819
|
var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
820
820
|
var ENTRY_POINTS_PATH = "components/partials/";
|
|
821
821
|
var MODULE_FOLDER_PATH = "components/modules/";
|
|
822
|
+
function sortKeys(input, options = {}) {
|
|
823
|
+
const { deep, compare } = options;
|
|
824
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
825
|
+
function deepSortArray(array) {
|
|
826
|
+
const resultFromCache = cache.get(array);
|
|
827
|
+
if (resultFromCache !== void 0) {
|
|
828
|
+
return resultFromCache;
|
|
829
|
+
}
|
|
830
|
+
const result = [];
|
|
831
|
+
cache.set(array, result);
|
|
832
|
+
result.push(
|
|
833
|
+
...array.map((item) => {
|
|
834
|
+
if (Array.isArray(item)) {
|
|
835
|
+
return deepSortArray(item);
|
|
836
|
+
}
|
|
837
|
+
if (isPlainObject(item)) {
|
|
838
|
+
return _sortKeys(item);
|
|
839
|
+
}
|
|
840
|
+
return item;
|
|
841
|
+
})
|
|
842
|
+
);
|
|
843
|
+
return result;
|
|
844
|
+
}
|
|
845
|
+
function _sortKeys(object) {
|
|
846
|
+
const resultFromCache = cache.get(object);
|
|
847
|
+
if (resultFromCache !== void 0) {
|
|
848
|
+
return resultFromCache;
|
|
849
|
+
}
|
|
850
|
+
const result = {};
|
|
851
|
+
const keys = Object.keys(object).sort(compare);
|
|
852
|
+
cache.set(object, result);
|
|
853
|
+
for (const key of keys) {
|
|
854
|
+
const value = object[key];
|
|
855
|
+
let newValue;
|
|
856
|
+
if (deep && Array.isArray(value)) {
|
|
857
|
+
newValue = deepSortArray(value);
|
|
858
|
+
} else {
|
|
859
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
860
|
+
}
|
|
861
|
+
Object.defineProperty(result, key, {
|
|
862
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
863
|
+
value: newValue
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
return result;
|
|
867
|
+
}
|
|
868
|
+
if (Array.isArray(input)) {
|
|
869
|
+
return deep ? deepSortArray(input) : [...input];
|
|
870
|
+
}
|
|
871
|
+
return _sortKeys(input);
|
|
872
|
+
}
|
|
873
|
+
function isPlainObject(value) {
|
|
874
|
+
if (typeof value !== "object" || value === null) {
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
const prototype = Object.getPrototypeOf(value);
|
|
878
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
879
|
+
}
|
|
822
880
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
823
881
|
var inlineJsEscapeChars = {
|
|
824
882
|
"\u2028": "\\u2028",
|
|
@@ -836,11 +894,18 @@ function escapeForInlineJS(input) {
|
|
|
836
894
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
837
895
|
const indentString = " ".repeat(baseIndent);
|
|
838
896
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
897
|
+
let sorted;
|
|
898
|
+
try {
|
|
899
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
900
|
+
sorted = sortKeys(input, { deep: true });
|
|
901
|
+
}
|
|
902
|
+
} catch (e) {
|
|
903
|
+
console.error("Error sorting Island keys", e);
|
|
904
|
+
}
|
|
905
|
+
return escapeForInlineJS(
|
|
906
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
907
|
+
).replace(/\n/gm, `
|
|
908
|
+
${indentString}`);
|
|
844
909
|
}
|
|
845
910
|
var viteRoot;
|
|
846
911
|
var viteCommand;
|
|
@@ -1139,7 +1204,8 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
1139
1204
|
sharedStateID,
|
|
1140
1205
|
supplementalFieldValues,
|
|
1141
1206
|
wrapperModuleId,
|
|
1142
|
-
wrapperUrl
|
|
1207
|
+
wrapperUrl,
|
|
1208
|
+
resolvedDataDependencies
|
|
1143
1209
|
}) => {
|
|
1144
1210
|
const output = {
|
|
1145
1211
|
id,
|
|
@@ -1151,6 +1217,9 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
1151
1217
|
props,
|
|
1152
1218
|
url: url3
|
|
1153
1219
|
};
|
|
1220
|
+
if (resolvedDataDependencies) {
|
|
1221
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
1222
|
+
}
|
|
1154
1223
|
if (sharedStateID) {
|
|
1155
1224
|
output.sharedStateID = sharedStateID;
|
|
1156
1225
|
}
|
|
@@ -2097,7 +2166,7 @@ function trackUsage(action) {
|
|
|
2097
2166
|
eventName: EVENT_NAME,
|
|
2098
2167
|
action,
|
|
2099
2168
|
nodeVersion: getNodeVersionData(),
|
|
2100
|
-
version: "1.0.
|
|
2169
|
+
version: "1.0.19",
|
|
2101
2170
|
os: getPlatform()
|
|
2102
2171
|
};
|
|
2103
2172
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -4557,6 +4626,7 @@ var buildModuleIndex = () => buildHTMLResponse(`
|
|
|
4557
4626
|
import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
4558
4627
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
4559
4628
|
import { getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
4629
|
+
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
4560
4630
|
var templateRouteHandler = async (request2, response) => {
|
|
4561
4631
|
sendTrackingRequest("view-template-route");
|
|
4562
4632
|
const {
|
|
@@ -4613,9 +4683,13 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4613
4683
|
params
|
|
4614
4684
|
})).data;
|
|
4615
4685
|
const pageHtml = addRefreshScript(result);
|
|
4686
|
+
const finalHtml = pageHtml.replace(
|
|
4687
|
+
HUBSPOT_PREVIEW_BASE_TAG_REGEX,
|
|
4688
|
+
'<base href="/" />'
|
|
4689
|
+
);
|
|
4616
4690
|
infillReactModulesAndWriteResponse(
|
|
4617
4691
|
response,
|
|
4618
|
-
|
|
4692
|
+
finalHtml,
|
|
4619
4693
|
webRoot2,
|
|
4620
4694
|
fullOriginalUrl,
|
|
4621
4695
|
environmentConfig,
|
|
@@ -4778,6 +4852,59 @@ function cmsComponentsShimPlugin() {
|
|
|
4778
4852
|
};
|
|
4779
4853
|
}
|
|
4780
4854
|
|
|
4855
|
+
// src/plugins/hsStaticAssetPlugin.ts
|
|
4856
|
+
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
4857
|
+
function hsStaticAssetPlugin() {
|
|
4858
|
+
return {
|
|
4859
|
+
name: "hsstatic-assets-plugin",
|
|
4860
|
+
enforce: "pre",
|
|
4861
|
+
configureServer(server) {
|
|
4862
|
+
return () => {
|
|
4863
|
+
const getDomainInfo = (req) => {
|
|
4864
|
+
const { authedPortalId, authedHublet, sslEnabled, authedEnv } = req.app.locals;
|
|
4865
|
+
const env2 = authedEnv === "qa" ? "qa" : "";
|
|
4866
|
+
const previewDomain = `${authedPortalId}.hubspotpreview${env2}-${authedHublet}.com`;
|
|
4867
|
+
const protocol = sslEnabled ? "https" : "http";
|
|
4868
|
+
return { previewDomain, protocol };
|
|
4869
|
+
};
|
|
4870
|
+
server.middlewares.use(
|
|
4871
|
+
createProxyMiddleware(
|
|
4872
|
+
(__pathname, req) => {
|
|
4873
|
+
var _a;
|
|
4874
|
+
if (!((_a = req.url) == null ? void 0 : _a.match("^/hs/hsstatic/.*")))
|
|
4875
|
+
return false;
|
|
4876
|
+
const { authedPortalId, authedHublet, authedEnv } = req.app.locals;
|
|
4877
|
+
return !!(authedPortalId && authedHublet && authedEnv);
|
|
4878
|
+
},
|
|
4879
|
+
{
|
|
4880
|
+
changeOrigin: true,
|
|
4881
|
+
secure: false,
|
|
4882
|
+
xfwd: true,
|
|
4883
|
+
logLevel: "silent",
|
|
4884
|
+
// This is a placeholder target that gets overridden by the router
|
|
4885
|
+
// but is a required parameter for initialization
|
|
4886
|
+
target: "https://hubspot.com",
|
|
4887
|
+
router: (req) => {
|
|
4888
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
4889
|
+
return `${protocol}://${previewDomain}`;
|
|
4890
|
+
},
|
|
4891
|
+
onProxyReq: (proxyReq, req, __res) => {
|
|
4892
|
+
const { previewDomain, protocol } = getDomainInfo(req);
|
|
4893
|
+
proxyReq.setHeader("X-Forwarded-Proto", protocol);
|
|
4894
|
+
proxyReq.setHeader("host", previewDomain);
|
|
4895
|
+
proxyReq.setHeader(
|
|
4896
|
+
"referer",
|
|
4897
|
+
`${protocol}://${previewDomain}/content-rendering/v1/public/_hcms/preview/template/multi`
|
|
4898
|
+
);
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
)
|
|
4902
|
+
);
|
|
4903
|
+
};
|
|
4904
|
+
}
|
|
4905
|
+
};
|
|
4906
|
+
}
|
|
4907
|
+
|
|
4781
4908
|
// src/createViteDevServer.ts
|
|
4782
4909
|
import { readFileSync as readFileSync3 } from "fs";
|
|
4783
4910
|
import { join as join4 } from "path";
|
|
@@ -4858,6 +4985,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
4858
4985
|
root: webRoot2,
|
|
4859
4986
|
...ssrAndOptimizeDep,
|
|
4860
4987
|
plugins: [
|
|
4988
|
+
hsStaticAssetPlugin(),
|
|
4861
4989
|
jsRenderingGates.includes("CMS:JSRenderer:AnalyzeCmsModules") ? findCmsModules() : null,
|
|
4862
4990
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
4863
4991
|
componentsShimPlugin,
|
|
@@ -5076,7 +5204,7 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
|
5076
5204
|
});
|
|
5077
5205
|
if (storybookPort) {
|
|
5078
5206
|
devServerApp.use(
|
|
5079
|
-
|
|
5207
|
+
createProxyMiddleware2(
|
|
5080
5208
|
(__pathname, req) => STORYBOOK_DOMAINS.includes(req.hostname),
|
|
5081
5209
|
{
|
|
5082
5210
|
logLevel: "warn",
|
|
@@ -5090,7 +5218,7 @@ var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
|
5090
5218
|
const distAssetsPath = path14.join(appWebRoot, "assets");
|
|
5091
5219
|
devServerApp.use("/assets", expressStatic(distAssetsPath));
|
|
5092
5220
|
} else {
|
|
5093
|
-
devServerApp.use(appViteServer.middlewares);
|
|
5221
|
+
devServerApp.use("/local", appViteServer.middlewares);
|
|
5094
5222
|
}
|
|
5095
5223
|
devServerApp.use(viteServer.middlewares);
|
|
5096
5224
|
devServerApp.use("/api", createAppServerAPIRoutes_default());
|
|
@@ -5238,6 +5366,7 @@ import {
|
|
|
5238
5366
|
} from "vite";
|
|
5239
5367
|
import { default as react2 } from "@vitejs/plugin-react";
|
|
5240
5368
|
import { default as mkcert2 } from "vite-plugin-mkcert";
|
|
5369
|
+
var isProd3 = true;
|
|
5241
5370
|
async function createAppServer(appWebRoot, port, sslEnabled) {
|
|
5242
5371
|
const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
|
|
5243
5372
|
const viteConfig = {
|
|
@@ -5252,6 +5381,7 @@ async function createAppServer(appWebRoot, port, sslEnabled) {
|
|
|
5252
5381
|
},
|
|
5253
5382
|
appType: "custom",
|
|
5254
5383
|
root: appWebRoot,
|
|
5384
|
+
base: isProd3 ? void 0 : "/local",
|
|
5255
5385
|
ssr: {
|
|
5256
5386
|
noExternal: "@hubspot/cms-components"
|
|
5257
5387
|
},
|
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-BxnmA6nH.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -35,6 +35,64 @@ function createPreloadLink(assetPath, basePath = "") {
|
|
|
35
35
|
throw new Error(`Unknown preload type for ${assetPath}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
function sortKeys(input, options = {}) {
|
|
39
|
+
const { deep, compare } = options;
|
|
40
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
function deepSortArray(array) {
|
|
42
|
+
const resultFromCache = cache.get(array);
|
|
43
|
+
if (resultFromCache !== void 0) {
|
|
44
|
+
return resultFromCache;
|
|
45
|
+
}
|
|
46
|
+
const result = [];
|
|
47
|
+
cache.set(array, result);
|
|
48
|
+
result.push(
|
|
49
|
+
...array.map((item) => {
|
|
50
|
+
if (Array.isArray(item)) {
|
|
51
|
+
return deepSortArray(item);
|
|
52
|
+
}
|
|
53
|
+
if (isPlainObject(item)) {
|
|
54
|
+
return _sortKeys(item);
|
|
55
|
+
}
|
|
56
|
+
return item;
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
function _sortKeys(object) {
|
|
62
|
+
const resultFromCache = cache.get(object);
|
|
63
|
+
if (resultFromCache !== void 0) {
|
|
64
|
+
return resultFromCache;
|
|
65
|
+
}
|
|
66
|
+
const result = {};
|
|
67
|
+
const keys = Object.keys(object).sort(compare);
|
|
68
|
+
cache.set(object, result);
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
const value = object[key];
|
|
71
|
+
let newValue;
|
|
72
|
+
if (deep && Array.isArray(value)) {
|
|
73
|
+
newValue = deepSortArray(value);
|
|
74
|
+
} else {
|
|
75
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
76
|
+
}
|
|
77
|
+
Object.defineProperty(result, key, {
|
|
78
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
79
|
+
value: newValue
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(input)) {
|
|
85
|
+
return deep ? deepSortArray(input) : [...input];
|
|
86
|
+
}
|
|
87
|
+
return _sortKeys(input);
|
|
88
|
+
}
|
|
89
|
+
function isPlainObject(value) {
|
|
90
|
+
if (typeof value !== "object" || value === null) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const prototype = Object.getPrototypeOf(value);
|
|
94
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
95
|
+
}
|
|
38
96
|
function escapeChar(unsafeChar) {
|
|
39
97
|
return inlineJsEscapeChars[unsafeChar];
|
|
40
98
|
}
|
|
@@ -44,11 +102,18 @@ function escapeForInlineJS(input) {
|
|
|
44
102
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
45
103
|
const indentString = " ".repeat(baseIndent);
|
|
46
104
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
105
|
+
let sorted;
|
|
106
|
+
try {
|
|
107
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
108
|
+
sorted = sortKeys(input, { deep: true });
|
|
109
|
+
}
|
|
110
|
+
} catch (e) {
|
|
111
|
+
console.error("Error sorting Island keys", e);
|
|
112
|
+
}
|
|
113
|
+
return escapeForInlineJS(
|
|
114
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
115
|
+
).replace(/\n/gm, `
|
|
116
|
+
${indentString}`);
|
|
52
117
|
}
|
|
53
118
|
function resolveIslandPlugin(islandsSet) {
|
|
54
119
|
return {
|
|
@@ -313,8 +378,8 @@ function isStylesheetAsset(staticAsset) {
|
|
|
313
378
|
return staticAsset.type === "stylesheet";
|
|
314
379
|
}
|
|
315
380
|
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-
|
|
381
|
+
var init_types_BxnmA6nH = __esm({
|
|
382
|
+
"../cms-js-internal/dist/types-BxnmA6nH.js"() {
|
|
318
383
|
COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
319
384
|
ENTRY_POINTS_PATH = "components/partials/";
|
|
320
385
|
MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -1098,8 +1163,8 @@ function ModuleSlot(props) {
|
|
|
1098
1163
|
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
1099
1164
|
var init_dist = __esm({
|
|
1100
1165
|
"../cms-js-internal/dist/index.js"() {
|
|
1101
|
-
|
|
1102
|
-
|
|
1166
|
+
init_types_BxnmA6nH();
|
|
1167
|
+
init_types_BxnmA6nH();
|
|
1103
1168
|
({ setProperty, getProperty, hasProperty } = dotProp);
|
|
1104
1169
|
serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
|
|
1105
1170
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
|
@@ -1115,7 +1180,8 @@ var init_dist = __esm({
|
|
|
1115
1180
|
sharedStateID,
|
|
1116
1181
|
supplementalFieldValues,
|
|
1117
1182
|
wrapperModuleId,
|
|
1118
|
-
wrapperUrl
|
|
1183
|
+
wrapperUrl,
|
|
1184
|
+
resolvedDataDependencies
|
|
1119
1185
|
}) => {
|
|
1120
1186
|
const output = {
|
|
1121
1187
|
id,
|
|
@@ -1127,6 +1193,9 @@ var init_dist = __esm({
|
|
|
1127
1193
|
props,
|
|
1128
1194
|
url
|
|
1129
1195
|
};
|
|
1196
|
+
if (resolvedDataDependencies) {
|
|
1197
|
+
output.resolvedDataDependencies = resolvedDataDependencies;
|
|
1198
|
+
}
|
|
1130
1199
|
if (sharedStateID) {
|
|
1131
1200
|
output.sharedStateID = sharedStateID;
|
|
1132
1201
|
}
|
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.19",
|
|
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.19",
|
|
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": "93a5843ed0250056800ed4aa76beb96f7a7887e0"
|
|
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
|
+
};
|