PageSourceSearch

https://build.typedream.com/_next/static/chunks/pages/ai/dashboard/[space_id]/[ai_page_id]-0c2a414e6658baa6.js

js typedream.com collected 2026-10-03 23:59:00 UTC 12,758 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3420],{87202:function(e,t){"use strict";for(var i="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),n={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},o={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:i?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},r={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},a=1;a<20;a++)r["f"+a]=111+a;function toKeyName(e){return e=o[e=e.toLowerCase()]||e}t.ZP=function(e,t,i){!t||"byKey"in t||(i=t,t=null),Array.isArray(e)||(e=[e]);var a=e.map(function(e){return function(e,t){var i=t&&t.byKey,a={},c=(e=e.replace("++","+add")).split("+"),d=c.length;for(var s in n)a[n[s]]=!1;var l=!0,u=!1,p=void 0;try{for(var h,m=c[Symbol.iterator]();!(l=(h=m.next()).done);l=!0){var w,f=h.value,v=f.endsWith("?")&&f.length>1;v&&(f=f.slice(0,-1));var g=toKeyName(f),_=n[g];if(f.length>1&&!_&&!o[f]&&!r[g])throw TypeError('Unknown modifier: "'+f+'"');1!==d&&_||(i?a.key=g:a.which=(w=f,r[w=toKeyName(w)]||w.toUpperCase().charCodeAt(0))),_&&(a[_]=!v||null)}}catch(e){u=!0,p=e}finally{try{!l&&m.return&&m.return()}finally{if(u)throw p}}return a}(e,t)}),check=function(e){return a.some(function(t){return function(e,t){for(var i in e){var n=e[i],o=void 0;if(null!=n&&(null!=(o="key"===i&&null!=t.key?t.key.toLowerCase():"which"===i?91===n&&93===t.which?91:t.which:t[i])||!1!==n)&&o!==n)return!1}return!0}(t,e)})};return null==i?check:check(i)}},54091:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/ai/dashboard/[space_id]/[ai_page_id]",function(){return i(82853)}])},16824:function(e,t,i){"use strict";i.d(t,{$7:function(){return constructUpdatedPage},ah:function(){return constructUpdateProject},j_:function(){return constructUpdatedPageProject}});var n=i(97030),o=i.n(n),r=i(18149),a=i.n(r);let removeUndefinedAndNull=e=>e&&Object.entries(e).filter(e=>{let[t,i]=e;return null!=i}).reduce((e,t)=>{let[i,n]=t;return{...e,[i]:o()(n)?removeUndefinedAndNull(n):n}},{}),constructUpdatedPage=(e,t)=>{let i={...t,description:e.prompt,sections:e.sections,section_order:e.sectionOrder,section_images:e.sectionImages,section_required_data:e.sectionRequiredData},n=removeUndefinedAndNull(t),o=removeUndefinedAndNull(i);return{updatedPage:i,isPageUpdated:!a()(n,o)}},constructUpdateProject=(e,t)=>{let i={...t,name:e.siteName,metadata:{is_dark_mode:e.isDarkMode,accent_color:e.accentColor,prompt:e.prompt}};"sitemap"in e&&(i.sitemap=e.sitemap);let n=removeUndefinedAndNull(t),o=removeUndefinedAndNull(i);return{updatedProject:i,isProjectUpdated:!a()(n,o)}},constructUpdatedPageProject=(e,t,i)=>{let{updatedPage:n,isPageUpdated:o}=constructUpdatedPage(e,t),{updatedProject:r,isProjectUpdated:a}=constructUpdateProject(e,i);return{updatedPage:n,updatedProject:r,isPageUpdated:o,isProjectUpdated:a}}},82853:function(e,t,i){"use strict";i.r(t),i.d(t,{AIWebsiteBuilderPage:function(){return AIWebsiteBuilderPage}});var n=i(52903),o=i(53554),r=i(24553),a=i(43167),c=i(34711),d=i(74834),s=i(34717),l=i(7822),u=i(81190),p=i(51891),h=i(37724),m=i(20334),w=i(99424),f=i(18537),v=i(75432),g=i(87263),_=i(70354),S=i(94068),E=i(48992),A=i(16824),y=i(5715),b=i(57315),P=i(26602),k=i(38618),x=i(30714),C=i(72247),N=i(17089),V=i(7609),T=i(49102),j=i(3445),I=i(99092),U=i(50405),Z=i(88346),D=i(87202),O=i(24542),B=i.n(O),R=i(32462),K=i.n(R),q=i(97729),M=i.n(q),Q=i(2784),X=i(32955);function ErrorFallback(e){let{error:t,resetErrorBoundary:i}=e;return(0,n.tZ)("div",{className:"fixed inset-0 flex items-center justify-center",role:"alert",children:(0,n.BX)("div",{className:"bg-transparent p-4 rounded-lg shadow-lg flex flex-col gap-6 max-w-[500px]",children:[(0,n.tZ)(j.xv,{size:"display-lg",weight:"semibold",children:"Oops!"}),(0,n.BX)("div",{children:[(0,n.tZ)(j.xv,{as:"p",variant:"mute",children:"The Typedream AI seems puzzled."}),(0,n.tZ)(j.xv,{as:"p",variant:"mute",size:"xs",children:"Not to worry - we've been notified and are looking into it, please try again!"})]}),(0,n.tZ)("div",{children:(0,n.tZ)(j.zx,{onClick:i,variant:"outline",children:"Try again"})})]})})}function AIWebsiteBuilderPage(){var e;let t=(0,j.pm)(),i=(0,k.uj)(),I=(0,k.IR)(),{data:O,error:R}=(0,x.j_)([I,i],{skip:!I||!i}),q=(0,Q.useRef)(O),{data:z,error:L}=(0,x.Me)([null==q?void 0:null===(e=q.current)||void 0===e?void 0:e.ai_project_id,i],{skip:!(null==O?void 0:O.ai_project_id)}),W=(0,Q.useRef)(z),{data:F,isLoading:G}=(0,x.QG)([i,null==O?void 0:O.ai_project_id],{skip:!(null==O?void 0:O.ai_project_id)||!i}),{mutate:$}=(0,x.YD)(),{mutate:H}=(0,x.k2)(),updateAIProjectPure=async(e,n,o,r)=>{try{if(!e||!n||!o||!r)throw Error("Missing required parameters");let{updatedPage:t,updatedProject:a,isPageUpdated:c,isProjectUpdated:d}=(0,A.j_)(e,n,o);if(c){if(!(null==t?void 0:t.ai_project_id)||!i)throw Error("Missing aiPage.ai_project_id ".concat(O.ai_project_id," or spaceID ").concat(i));await $(t,i)}if(d){if(!(null==a?void 0:a.space_id))throw Error("Missing aiProject.space_id");await H(a)}return{updatedPage:t,updatedProject:a,isPageUpdated:c,isProjectUpdated:d}}catch(e){throw t.toast({title:"Error saving page data",description:(0,N.T)(e),variant:"destructive"}),Error(e)}},J=(0,Q.useMemo)(()=>{var e;return null===(e=(F||[]).find(e=>"product_context"===e.name))||void 0===e?void 0:e.id},[F]);(0,Q.useEffect)(()=>{O&&(q.current=O)},[O]),(0,Q.useEffect)(()=>{z&&(W.current=z)},[z]),(0,Q.useEffect)(()=>{R&&t.toast({title:"Error loading AI page",description:(0,N.T)(R),variant:"destructive"})},[R]),(0,Q.useEffect)(()=>{L&&t.toast({title:"Error loading AI project",description:(0,N.T)(L),variant:"destructive"})},[L]);let Y=(0,U.k)(a.$,{delays:{autoSaveDelay:5e3},actions:{onSaveError:()=>{t.toast({title:"Error Saving Project",description:(0,N.T)(R),variant:"destructive"})}},services:{onSaveProject:async e=>updateAIProjectPure(e.aiWebsiteBuilderMachineContext,e.aiPage,e.aiProject,e.spaceID)}}),{isDraft:ee,isSaving:et}=(0,Z.v)(Y,e=>({isSaving:e.matches("Saving"),isDraft:e.matches("Draft")})),ei=(0,U.k)(c.o,{devTools:P.EQp,actions:{triggerUpdateAIProjectExt:e=>{Y.send({type:"CONTEXT.CHANGED",payload:{newContext:e}}),Y.send({type:"USER.PRESS.SAVE"}),K().dataLayer({dataLayer:{event:"ai_generation_complete"}})}}},e=>
1{e.changed&&e.context.initialized&&requestAnimationFrame(()=>{localStorage.setItem("ai-web-builder-debug-ibe",JSON.stringify(e))})}),{initialized:en,context:eo,userPrompt:er,isShowingUserPromptView:ea,isShowingSiteName:ec,isShowingDiveDeeperQuestion:ed,isShowingPasteNotes:es,isShowingAboutProductOffering:el,isShowingAboutValueProp:eu,isShowingAboutFeatures:ep,isShowingAboutBenefits:eh,isShowingAboutAudience:em,isShowingProductContext:ew,isShowingBrandVoice:ef,isShowingOutline:ev,isShowingColorSelectionView:eg,isShowingThemeSelectionView:e_,isShowingSectionsSelectionView:eS,isShowingEditor:eE,isShowingProductContextChat:eA,isRegenarating:ey}=(0,Z.v)(ei,e=>({initialized:e.context.initialized,context:e.context,userPrompt:e.context.prompt,isShowingUserPromptView:e.context.initialized&&e.matches("View.Showing Initial Prompt"),isShowingSiteName:e.matches("View.Showing About - Project Name"),isShowingDiveDeeperQuestion:e.matches("View.Showing About Dive Deeper"),isShowingPasteNotes:e.matches("View.Showing About - Paste Notes"),isShowingAboutProductOffering:e.matches("View.Showing About - Product Offering"),isShowingAboutValueProp:e.matches("View.Showing About - Value Prop"),isShowingAboutFeatures:e.matches("View.Showing About - Features"),isShowingAboutBenefits:e.matches("View.Showing About - Benefits"),isShowingAboutAudience:e.matches("View.Showing About - Audience"),isShowingProductContext:e.matches("View.Showing About Product Context"),isShowingBrandVoice:e.matches("View.Showing About - Brand Voice"),isShowingOutline:e.matches("View.Showing About Outline"),isShowingColorSelectionView:e.matches("View.Showing Color Selection"),isShowingThemeSelectionView:e.matches("View.Showing Theme Selection"),isShowingSectionsSelectionView:e.matches("View.Showing Sections Selection"),isShowingEditor:e.matches("View.Showing Editor"),isShowingProductContextChat:e.matches("View.Creating Product Context"),isRegenarating:"SECTION.REGENERATE"===e.event.type})),eb=(0,Q.useRef)(eo);(0,Q.useEffect)(()=>{eb.current=eo},[eo]),(0,Q.useEffect)(()=>{O&&z&&!en&&x.QG.run([i,O.ai_project_id]).unwrap().then(e=>{var t,i,n,o;let r=(null===(t=(e||[]).find(e=>{let{name:t}=e;return"product_context"===t}))||void 0===t?void 0:t.content)||"",a=(null===(i=(e||[]).find(e=>{let{name:t}=e;return"outline"===t}))||void 0===i?void 0:i.content)||"",c={initialized:!0,prompt:O.description||"",productContext:r,storyline:"",isDarkMode:null==z?void 0:null===(n=z.metadata)||void 0===n?void 0:n.is_dark_mode,outline:a,productQuestions:{product:"",value:"",features:"",benefits:"",audience:""},narrativePoints:{keywords:[],headline:"",brandVoice:"",personality:"",copywritingFramework:""},infoToUse:"prompt",accentColor:(null==z?void 0:null===(o=z.metadata)||void 0===o?void 0:o.accent_color)||"",siteName:(null==z?void 0:z.name)||"",sections:O.sections||{},sectionRequiredData:O.section_required_data||{},sectionImages:O.section_images||{},sectionOrder:O.section_order||[],sectionError:{},newSections:O.sections?Object.entries(O.sections).filter(e=>{let[t,i]=e;return!i.description||!i.template||!O.section_required_data[t]}).map(e=>{let[t,i]=e;return t}):[],sectionChildMachines:{},templatePackID:O.template_pack_id&&O.template_pack_id!==V.O?O.template_pack_id:T._Q,selection:null,chatFlag:!1};ei.send({type:"INIT.CONTEXT",payload:c})}).catch(e=>Error(e))},[O,z,en]),(0,Q.useEffect)(()=>{ey&&B().track(o.K.AI_VIEW_PREVIEW_DASHBORD)},[ey]);let eP=(0,Q.useCallback)((e,t)=>
1{let i=localStorage.getItem("ai-web-builder-xstate");C.$e(n=>{n.setExtra("xstate-ai-localstorage",i),n.setExtra("errorInfo",t),C.Tb(e)})},[]),ek=(0,Q.useCallback)(e=>{ei.send({type:"PRODUCT_CONTEXT.CHANGE",payload:{productContext:e}}),ei.send({type:"PRODUCT_CONTEXT.SAVE",payload:{name:"product_context",spaceID:i,aiProjectID:O.ai_project_id,content:e,aiContextID:J}})},[er,ei]);return(0,d.sd)(ei),(0,Q.useEffect)(()=>{eo&&O&&z&&i&&Y.send({type:"INIT",payload:{spaceID:i,aiWebsiteBuilderMachineContext:eo,aiProject:z,aiPage:O}})},[eo,O,z,i]),(0,Q.useEffect)(()=>{Y.send({type:"CONTEXT.CHANGED",payload:{newContext:eo}})},[eo]),(0,Q.useEffect)(()=>{function handleSaveKeyboard(e){(0,D.ZP)("mod+s")(e)&&(e.preventDefault(),Y.send({type:"USER.PRESS.SAVE"}))}return document.addEventListener("keydown",handleSaveKeyboard),()=>{document.removeEventListener("keydown",handleSaveKeyboard)}},[eb]),(0,Q.useEffect)(()=>{function handleBeforeUnload(e){(ee||et)&&(e.preventDefault(),e.returnValue=!0)}return ee||et?window.addEventListener("beforeunload",handleBeforeUnload):window.removeEventListener("beforeunload",handleBeforeUnload),()=>{window.removeEventListener("beforeunload",handleBeforeUnload)}},[ee,et]),(0,n.BX)(X.SV,{FallbackComponent:ErrorFallback,onError:eP,onReset:()=>{ei.send({type:"RESET"})},children:[(0,n.tZ)(M(),{children:(0,n.tZ)("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})}),(0,n.BX)(y.Uk,{children:[(0,n.tZ)(r.mk,{}),G&&(0,n.tZ)(b.Z,{loading:!0}),ea&&(0,n.tZ)(E.T,{machineActor:ei}),ec&&(0,n.tZ)(m.V,{machineActor:ei}),eA&&(0,n.tZ)(g.a,{onNext:ek}),ed&&(0,n.tZ)(p.J,{machineActor:ei}),es&&(0,n.tZ)(l._,{machineActor:ei}),el&&(0,n.tZ)(u.Q,{machineActor:ei,question:"product"}),eu&&(0,n.tZ)(u.Q,{machineActor:ei,question:"value"}),ep&&(0,n.tZ)(u.Q,{machineActor:ei,question:"features"}),eh&&(0,n.tZ)(u.Q,{machineActor:ei,question:"benefits"}),em&&(0,n.tZ)(u.Q,{machineActor:ei,question:"audience"}),ew&&(0,n.tZ)(h.z,{machineActor:ei}),ef&&(0,n.tZ)(s.$,{machineActor:ei}),ev&&(0,n.tZ)(w.J,{machineActor:ei}),e_&&(0,n.tZ)(S.$,{machineActor:ei}),eg&&(0,n.tZ)(f.D,{machineActor:ei}),eS&&(0,n.tZ)(_.$,{machineActor:ei}),eE&&(0,n.tZ)(v.AIPreview,{machineActor:ei,saveMachineActor:Y})]})]})}P.EQp&&(0,I.XY)({iframe:!1}),t.default=AIWebsiteBuilderPage}},function(e){e.O(0,[480,4185,5646,8903,2182,9097,8421,9721,6577,6653,10,8874,9618,1445,3955,9987,9318,3933,4890,5392,8087,5041,5746,3989,9411,9745,4949,5549,3247,7249,8408,5942,4119,52,1778,5432,8872,9774,2888,179],function(){return e(e.s=54091)}),_N_E=e.O()}]);
2//# sourceMappingURL=[ai_page_id]-0c2a414e6658baa6.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.