PageSourceSearch

https://www.aifire.co/assets/RecommendationsForm-_vVlMQ6b.js

js aifire.co collected 2026-10-04 00:17:48 UTC 10,387 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e5b2986b-2bdb-5451-8e8a-379e3bc89c82")}catch(e){}}();
3import{a as e,t}from"./jsx-runtime-CMgEUHpv.js";import{V as n,_ as r}from"./dist-CAHjj65Z.js";import{t as i}from"./useTranslation-BymTnaHx.js";import{c as a,l as o}from"./components-B8bHjdou.js";import{r as s}from"./dist-CrEJxMHP.js";import{t as c}from"./classnames-PxzWHlFm.js";import{t as l}from"./PoweredByBeehiiv-IvsR0uAS.js";import{n as u,r as d}from"./local_storage-CooKze2L.js";import{t as f}from"./Image-B1Otrzxn.js";import{t as p}from"./Button-DG1GtAKw.js";import{t as m}from"./dialog-DQRLOcH9.js";import{t as h}from"./transition-zOPc9j2i.js";import{t as g}from"./usePublication-i2rJD5VI.js";import{t as _}from"./useSignupRedirects-CLiwBByh.js";var v=e(n(),1),y=t(),b=({children:e,handleRedirect:t})=>{let{t:n}=i(),r=a();return(0,v.useEffect)(()=>{r?.status===`success`&&(r?.toast?.message&&s.success(r?.toast?.message),t())},[r]),(0,y.jsxs)(`div`,{className:`sticky bottom-0 left-0 right-0 mx-auto mt-4 w-full max-w-3xl bg-white pb-8 pt-4`,children:[(0,y.jsx)(`div`,{className:`absolute -top-8 right-0 -z-10 h-8 w-full bg-white blur-lg`}),(0,y.jsx)(`div`,{className:`absolute -top-4 right-0 -z-10 h-8 w-full bg-white blur`}),(0,y.jsxs)(`div`,{className:`space-y-4 bg-white`,children:[(0,y.jsx)(`div`,{children:(0,y.jsx)(p,{variant:`primary`,className:`!rounded-md text-lg`,type:`submit`,block:!0,children:e})}),(0,y.jsx)(`div`,{className:`text-center text-sm text-gray-900`,children:(0,y.jsx)(`button`,{type:`button`,onClick:t,className:`text-gray-900`,children:n(`shared.cta.maybe_later`)})})]})]})};function x(e){let{t}=i(),[n]=u();return(0,y.jsx)(`div`,{className:`flex flex-col space-y-4`,suppressHydrationWarning:!0,children:(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col space-y-1`,children:[(0,y.jsx)(`h1`,{className:`text-left text-xl font-bold text-gray-900`,children:n?`${t(`recommendations.suggestion`)}`:t(`recommendations.title`)}),e.isSignupFlowInProgess?(0,y.jsx)(`p`,{className:`text-sm text-left text-gray-700`,children:e.publication.web_template.signup_flow_messaging.recommendations_message?e.publication.web_template.signup_flow_messaging.recommendations_message:`${e.publication.name} also recommends these newsletters.`}):(0,y.jsxs)(`p`,{className:`text-sm text-left text-gray-700`,children:[e.publication.name,` also recommends these newsletters.`]})]})})}function S(e){let{t}=i();return e.hasNextPage?(0,y.jsx)(`div`,{className:`flex justify-center`,children:(0,y.jsx)(`button`,{onClick:e.loadNextPage,disabled:e.isLoading,className:`inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-wt-primary focus:ring-offset-2`,children:e.isLoading?`${t(`shared.actions.loading`)}...`:t(`shared.cta.load_more`)})}):null}function C(e){let t=g(),n=r(),{visitToken:a}=d(),[s,c]=u(),{t:l}=i(),f=n.state===`submitting`,_=n.submission?.formData.get(`email`),b=o();return(0,v.useEffect)(()=>{f&&c(_?String(_):``)},[f,c,_]),(0,y.jsx)(h.Root,{show:e.isOpen,as:v.Fragment,children:(0,y.jsx)(m,{as:`div`,className:`fixed inset-0 z-10 overflow-y-auto`,onClose:e.onClose,children:(0,y.jsxs)(`div`,{className:`flex items-end justify-center px-4 pb-20 pt-4 text-center sm:block sm:p-0`,children:[(0,y.jsx)(h.Child,{as:v.Fragment,enter:`ease-out duration-300`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-200`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,y.jsx)(m.Overlay,{className:`fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity`})}),(0,y.jsx)(`span`,{className:`hidden sm:inline-block sm:h-screen sm:align-middle`,"aria-hidden":`true`,children:`​`}),(0,y.jsx)(h.Child,{as:v.Fragment,enter:`ease-out duration-300`,enterFrom:`opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95`,enterTo:`opacity-100 translate-y-0 sm:scale-100`,leave:`ease-in duration-200`,leaveFrom:`opacity-100 translate-y-0 sm:scale-100`,leaveTo:`opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95`,children:(0,y.jsxs)(b.Form,{className:`inline-block transform rounded-lg bg-white text-left align-bottom shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:align-middle`,action:`/recommendations_subscribe_form`,method:`post`,children:[(0,y.jsx)(`input`,{type:`hidden`,name:`visit_token`,defaultValue:a}),(0,y.jsx)(`input`,{name:`recommendations_success_message`,type:`hidden`,defaultValue:e.successMessage}),(0,y.jsx)(`input`,{type:`hidden`,name:`publication_id`,defaultValue:t.id}),e.recommendation_ids.map(e=>(0,y.jsx)(`input`,{type:`hidden`,name:`recommendation_ids[]`,value:e},e)),(0,y.jsxs)(`div`,{className:`space-y-6 rounded-t-lg bg-white px-4 py-6 sm:p-6`,children:[(0,y.jsx)(`div`,{children:(0,y.jsx)(`h3`,{className:`text-lg font-medium leading-6 text-gray-900`,children:`${l(`recommendations.one_last_thing`)}...`})}),(0,y.jsx)(`div`,{className:`space-y-6`,children:(0,y.jsx)(`div`,{children:(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsx)(`input`,{type:`email`,name:`email`,autoComplete:`email`,placeholder:l(`subscribe.email_placeholder`)||``,className:`block w-full rounded-wt border-2 border-wt-primary bg-white px-5 py-3 text-base font-light text-black placeholder-gray-400 focus:border-wt-primary focus:outline-none`,required:!0,defaultValue:s}),(0,y.jsxs)(`div`,{className:`relative flex items-start`,children:[(0,y.jsx)(`div`,{className:`flex h-5 items-center`,children:(0,y.jsx)(`input`,{name:`include_current_publication`,id:`include_current_publication`,type:`checkbox`,className:`h-4 w-4 roun
3ded border-gray-300 text-indigo-600 focus:ring-indigo-500`,defaultChecked:!0})}),(0,y.jsx)(`div`,{className:`ml-3 text-sm`,children:(0,y.jsx)(`label`,{htmlFor:`include_current_publication`,className:`font-medium text-gray-700`,children:l(`recommendations.opt_in_text`,{name:t.name})})})]})]})})})]}),(0,y.jsxs)(`div`,{className:`align-items-center flex justify-end rounded-b-lg bg-gray-50 px-4 py-3 text-right sm:px-6`,children:[(0,y.jsx)(p,{type:`button`,className:`mx-2`,onClick:e.onClose,variant:`ghost`,disabled:f,children:l(`shared.cta.cancel`)}),(0,y.jsx)(p,{variant:`primary`,type:`submit`,isLoading:f,children:l(`shared.cta.subscribe`)})]})]})})]})})})}function w({boost:e=!1,recommendation:t,selected:n,onToggle:r}){return(0,y.jsx)(`li`,{className:``,children:(0,y.jsx)(`div`,{className:`space-y-4`,children:(0,y.jsxs)(`button`,{type:`button`,className:`relative flex rounded-lg border border-[#E5E7EB] bg-[#F9FAFB] p-4 cursor-pointer transition-all hover:bg-gray-50 hover:border-gray-300 w-full text-left`,onClick:()=>r(t.id),children:[(0,y.jsx)(`div`,{className:`absolute top-4 right-4 rounded-md px-2 py-1 font-medium border shadow-sm pointer-events-none ${n?`bg-wt-primary text-wt-text-on-primary border-wt-primary`:`bg-gray-100 text-gray-700 border-gray-300`}`,children:n?`Selected`:`Select`}),(0,y.jsxs)(`div`,{className:`w-full pr-20`,children:[(0,y.jsx)(`div`,{className:`mb-4 flex-shrink-0`,children:(0,y.jsx)(`div`,{className:`h-14 w-14 overflow-hidden rounded border border-gray-300 bg-white`,children:(0,y.jsx)(f,{maxWidth:128,aspectRatio:`square`,src:t.publication.thumbnail_image_url,alt:t.publication.name})})}),(0,y.jsxs)(`div`,{className:`w-full space-y-0.5`,children:[e&&(0,y.jsx)(`p`,{className:`text-xs text-gray-700`,children:`Sponsored`}),(0,y.jsxs)(`div`,{className:`flex flex-col space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col space-y-0`,children:[(0,y.jsx)(`h4`,{className:`text-lg font-medium text-gray-900`,children:t.publication.name}),t.publication.publisher_name&&(0,y.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`by `,t.publication.publisher_name]}),(0,y.jsx)(`p`,{className:`line-clamp-2 text-sm text-gray-700`,children:t.publication.description})]}),t.reason&&(0,y.jsxs)(`span`,{className:`text-xs italic text-gray-700`,children:[`"`,t.reason,`"`]})]})]})]})]})})})}var T=e(c(),1);function E({children:e}){return(0,y.jsx)(`ul`,{className:(0,T.default)(`flex flex-col gap-4`),children:e})}function D({isLoading:e,recommendations:t,boostedRecommendations:n,hasNextPage:r,loadNextPage:a}){let{t:c}=i(),f=g(),p=o(),m=p.data,h=m?.toast?.status===`success`,[T,D]=(0,v.useState)([]),[O]=u(),[k,A]=(0,v.useState)(!1),{visitToken:j}=d(),{nextPage:M,progress:N}=_(f);(0,v.useEffect)(()=>{h&&(M(),s.success(m.toast.message))},[h]);let P=e=>{if(T.includes(e))return D(T.filter(t=>t!==e));D([...T,e])},F=[...t.filter(e=>T.includes(e.id)),...n.filter(e=>T.includes(e.id))].some(e=>e.double_opt_required),I=c(F?`recommendations.toast.success_one_double_opt`:`recommendations.toast.success_one`),L=c(F?`recommendations.toast.success_other_double_opt`:`recommendations.toast.success_other`,{count:T.length}),R=T.length>1?L:I,z=e=>{if(e.preventDefault(),O){let e=new FormData;e.append(`email`,O),T.length>0?T.forEach(t=>{e.append(`recommendation_ids[]`,t)}):t.map(e=>e.id).concat(n.map(e=>e.id)).forEach(t=>{e.append(`recommendation_ids[]`,t)}),e.append(`include_current_publication`,`false`),e.append(`visit_token`,j||``),e.append(`publication_id`,f.id);let r=c(`errors.default`);e.append(`recommendations_error_message`,r),e.append(`recommendations_success_message`,R),p.submit(e,{method:`post`,action:`/recommendations_subscribe_form`})}else A(!0)},B=T.length===0?c(`recommendations.subscribe_to_all`):c(`meta.titles.subscribe`);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(p.Form,{className:`relative mx-auto w-full max-w-3xl p-6`,onSubmit:z,children:[(0,y.jsx)(x,{isSignupFlowInProgess:!!N,publication:f}),(0,y.jsxs)(E,{children:[n?.map(e=>(0,y.jsx)(w,{boost:!0,selected:T.includes(e.id),onToggle:P,recommendation:e},e.id)),t.map(e=>(0,y.jsx)(w,{selected:T.includes(e.id),onToggle:P,recommendation:e},e.id))]}),r&&(0,y.jsx)(S,{hasNextPage:r,isLoading:e,loadNextPage:a}),(0,y.jsx)(b,{handleRedirect:M,children:B}),(0,y.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,y.jsx)(l,{publication:f})})]}),(0,y.jsx)(C,{isOpen:k,onClose:()=>A(!1),recommendation_ids:T,successMessage:R})]})}export{D as t};
4//# sourceMappingURL=RecommendationsForm-_vVlMQ6b.js.map
5//# debugId=e5b2986b-2bdb-5451-8e8a-379e3bc89c82

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.