PageSourceSearch

https://app.memberstack.com/assets/HelloAndWelcomeAdvanced-Df-TZVmH.js

js memberstack.com collected 2026-09-24 17:16:54 UTC 5,049 bytes, 1 lines download raw bytes

1import{M as P,a5 as U,r as m,j as e}from"./vendor-CSdFbWfl.js";import{aS as Y,G as J,N as Q,e as Z,aH as p,k as A,cv as K,cA as X,bA as $}from"./index-BynWLX9U.js";import{R as q}from"./index-DD2_wu9u.js";import{S as h}from"./SettingsBar-BWNzuPJS.js";import{T as f}from"./TitleSection-CyW0vdJA.js";import{b as V,U as ee}from"./buildDesign-DpZzf840.js";import{u as te,b as ae}from"./design.generated-DLSsa8oz.js";import{I as N}from"./emails.utils-cD0QA7SO.js";import"./ChevronLeft-ByfUf0Ah.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"5fdab7154cbea903e2531547e54739370b469773"};var a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="d66f0bdc-bb65-4178-991e-3b34ae0adb7a",t._sentryDebugIdIdentifier="sentry-dbid-d66f0bdc-bb65-4178-991e-3b34ae0adb7a")}catch{}})();const ne="#F6F6F6",se=140,ie="29px",oe="16px",le="#000000",_=t=>t.replace(/\{\{/g,"\\{{"),re=({paragraph1:t,paragraph2:a,appLogo:o,appName:s})=>{const d=(t==null?void 0:t.trim())||N.paragraph1,l=(a==null?void 0:a.trim())||N.paragraph2,i=[];return o&&i.push({kind:"image",src:o,alt:s||"Logo",align:"left",width:se}),i.push({kind:"heading",text:_(d),level:2,align:"left",fontSize:ie}),i.push({kind:"text",html:_(Y.parse(l,{async:!1})),align:"left",fontSize:oe,color:le}),i},de=t=>V(re(t),{backgroundColor:ne});function ce(){return{member:{name:"Member",mergeTags:{email:{name:"Email",value:"{{member.email}}",sample:"[email protected]"},id:{name:"Member ID",value:"{{member.id}}",sample:"mem_abc123"}}},app:{name:"App",mergeTags:{name:{name:"App Name",value:"{{app.name}}",sample:"My App"},logo:{name:"Logo URL",value:"{{app.logo}}",sample:"https://example.com/logo.png"}}},other:{name:"Other",mergeTags:{current_year:{name:"Current Year",value:"{{current_year}}",sample:String(new Date().getFullYear())}}}}}const ye=()=>{var v,y,E,T;const{appId:t}=P(),a=U(),{createToastAlert:o}=J(),{appData:s}=Q(),d=m.useRef(null),l=`/apps/${t}/emails/transactional/hello-and-welcome`,{data:i,loading:L,error:S,refetch:W}=te(),{data:n,loading:C,error:R,refetch:I}=Z(),b=!!(S||R),[D,{loading:x}]=ae(),g=L||C,r=i==null?void 0:i.getWelcomeDesign,H=(r==null?void 0:r.supported)??!0,u=m.useRef(null);!g&&!b&&u.current===null&&(u.current=r!=null&&r.designJson?r.designJson:de({paragraph1:(y=(v=n==null?void 0:n.getEmails)==null?void 0:v.welcome)==null?void 0:y.paragraph1,paragraph2:(T=(E=n==null?void 0:n.getEmails)==null?void 0:E.welcome)==null?void 0:T.paragraph2,appLogo:s==null?void 0:s.image,appName:s==null?void 0:s.name}));const O=u.current,M=m.useMemo(()=>ce(),[]),[B,F]=m.useState(!1),G=m.useCallback(()=>F(!0),[]),z=async()=>{var w;if(!d.current)return;let k,j;try{const c=await d.current.exportHtml();k=c.html,j=c.design}catch{o({alertType:"error",message:"Could not read the design. Please try again."});return}try{await D({variables:{input:{type:X.Welcome,designHtml:k,designJson:j}}}),o({alertType:"success",message:(w=n==null?void 0:n.getEmails)!=null&&w.welcomeEmailsEnabled?"Welcome email design saved. It is live now.":"Design saved. Turn on the welcome email to start sending it."}),a(l)}catch(c){o({alertType:"error",message:$(c)?c.message:"Could not save the design."})}};return b?e.jsx(p,{children:e.jsxs(h,{children:[e.jsx(f,{title:"Advanced editor",titleHint:"We could not load this email.",backLink:l,backLinkTitle:"Hello & Welcome",emphasize:!0}),e.jsx("div",{className:"px-5 pb-5",children:e.jsx(q,{title:"Couldn't load your design",description:"Nothing was lost or changed. Try again in a moment.",onRetry:()=>{W().catch(()=>{}),I().catch(()=>{})},retrying:g})})]})}):H?e.jsx(p,{children:e.jsxs(h,{className:"w-full flex flex-col overflow-hidden",children:[e.jsx(f,{title:"Advanced editor",titleHint:"Design the Hello & Welcome email. Saving publishes it immediately.",backLink:l,backLinkTitle:"Hello & Welcome",emphasize:!0,buttons:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{variant:"skeleton",onClick:()=>a(l),children:"Cancel"}),e.jsx(A,{onClick:z,isLoading:x,disabled:!B||x,children:"Save"})]})}),e.jsx("div",{className:"px-5 pb-5 flex-1 min-h-0 flex flex-col overflow-hidden",children:g?e.jsx("div",{className:"flex items-center justify-center flex-1 min-h-[500px]",role:"status","aria-label":"Loading editor",children:e.jsx(K,{className:"animate-spin text-muted-foreground"})}):e.jsx(ee,{ref:d,design:O,mergeTags:M,onReady:G,minHeight:"400"})})]})}):e.jsx(p,{children:e.jsxs(h,{children:[e.jsx(f,{title:"Advanced editor",titleHint:"Not available on this app's email provider.",backLink:l,backLinkTitle:"Hello & Welcome",emphasize:!0}),e.jsx("div",{className:"px-5",children:e.jsx("p",{className:"text-muted-foreground text-[14px] leading-6",children:"This app sends transactional email through Postmark, which can only send our built-in template. Add a sending domain to move this app to Resend, then the advanced editor will be available."})})]})})};export{ye as HelloAndWelcomeAdvanced,ye as default};

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.