PageSourceSearch

https://psadvisory.com/assets/KnowledgeDirect-e2zW28Ua.js

js psadvisory.com collected 2026-09-26 04:14:57 UTC 10,610 bytes, 1 lines download raw bytes

1import{O as M,u as R,r as h,p as v,ay as q,az as b,j as e,V as I,aw as z,W as K,H as V,at as O,B as g,C as U,e as H,_ as Q,a0 as Y,a1 as D,a2 as J,a3 as W,U as m,a4 as Z,Y as y,Z as G}from"./index-CFpOLRUd.js";import{u as k}from"./useMutation-DQr32Z_q.js";import{z as r}from"./index-BvC0Pe3b.js";import{u as X,F as ee,a as n,b as o,c,d,e as x,t as se}from"./form-CKHAQ760.js";import{S as ae}from"./separator-CzMdKxqc.js";import{C as te}from"./checkbox-DKWvV0-3.js";import{T as ie}from"./triangle-alert-DN2uoNVs.js";import{B as S}from"./book-BEU45Blm.js";import{T as le}from"./tag-trou4w1H.js";import{C as re}from"./calendar-Cu9rfsKV.js";import{D as A}from"./download-Zftoh-Vb.js";import{A as ne}from"./arrow-left-GM2CmTcw.js";import{F as oe}from"./file-D1pLFtxY.js";const ce=r.object({firstName:r.string().min(1,"First name is required"),lastName:r.string().min(1,"Last name is required"),email:r.string().email("Please enter a valid email address"),company:r.string().min(1,"Company name is required"),phone:r.string().optional(),consentMarketing:r.boolean().default(!1)});function Se(){const{slug:t}=M();R();const[F,u]=h.useState(!1),[j,C]=h.useState(!1),[de,me]=h.useState(null),p=localStorage.getItem(`knowledge_registered_${t}`)==="true",{data:s,isLoading:P,error:_}=v({queryKey:[`/api/knowledge/direct/${t}`],queryFn:async()=>{const a=await fetch(`/api/knowledge/direct/${t}`);if(!a.ok)throw new Error("Entry not found or not publicly accessible");return(await a.json()).entry},enabled:!!t}),{data:w,isLoading:E}=v({queryKey:[`/api/knowledge/content/${s==null?void 0:s.id}`],queryFn:async()=>{const a=await fetch(`/api/knowledge/content/${s==null?void 0:s.id}`);if(!a.ok)throw new Error("Failed to fetch content");return(await a.json()).content},enabled:!!(s!=null&&s.id)&&((s==null?void 0:s.isPubliclyAccessible)||p||j)}),N=k({mutationFn:async a=>{await fetch(`/api/knowledge/view/${a}`,{method:"POST"})}});h.useEffect(()=>{s!=null&&s.id&&!N.isPending&&(N.mutate(s.id),q(`/knowledge-direct/${t}`),b("knowledge_article_view","knowledge_base",s.title))},[s==null?void 0:s.id,t]);const i=X({resolver:se(ce),defaultValues:{firstName:"",lastName:"",email:"",company:"",phone:"",consentMarketing:!1}}),f=k({mutationFn:async a=>{const l=await fetch("/api/knowledge/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,articleId:s==null?void 0:s.id,articleSlug:t})});if(!l.ok){const B=await l.json();throw new Error(B.message||"Registration failed")}return l.json()},onSuccess:()=>{localStorage.setItem(`knowledge_registered_${t}`,"true"),C(!0),u(!1),b("knowledge_registration","knowledge_base",(s==null?void 0:s.title)||t),y({title:"Registration successful!",description:"You can now access the full content of this article."}),G.invalidateQueries({queryKey:[`/api/knowledge/content/${s==null?void 0:s.id}`]})},onError:a=>{y({title:"Registration failed",description:a.message,variant:"destructive"})}}),L=a=>{f.mutate(a)},T=()=>{p||j||u(!0)},$=(a,l)=>{b("file_download","knowledge_base",l),window.open(a,"_blank")};return P?e.jsx("div",{className:"flex-1 bg-gradient-to-br from-blue-50 to-indigo-100",children:e.jsx("div",{className:"container mx-auto px-4 py-12",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-8 bg-gray-300 rounded w-3/4 mb-4"}),e.jsx("div",{className:"h-4 bg-gray-300 rounded w-1/2 mb-8"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-gray-300 rounded"}),e.jsx("div",{className:"h-4 bg-gray-300 rounded w-5/6"}),e.jsx("div",{className:"h-4 bg-gray-300 rounded w-4/6"})]})]})})})}):_||!s?e.jsx("div",{className:"flex-1 bg-gradient-to-br from-blue-50 to-indigo-100",children:e.jsx("div",{className:"container mx-auto px-4 py-12",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs(I,{variant:"destructive",children:[e.jsx(ie,{className:"h-4 w-4"}),e.jsx(z,{children:"Article Not Found"}),e.jsx(K,{children:"The knowledge base article you're looking for is not available or not publicly accessible."})]})})})}):e.jsxs(e.Fragment,{children:[e.jsxs(V,{children:[e.jsxs("title",{children:[s.title," | PS Advisory Knowledge Base"]}),e.jsx("meta",{name:"description",content:s.summary||`Learn about ${s.title} from PS Advisory's knowledge base.`}),e.jsx("meta",{property:"og:title",content:`${s.title} | PS Advisory Knowledge Base`}),e.jsx("meta",{property:"og:description",content:s.summary||`Learn about ${s.title} from PS Advisory's knowledge base.`}),e.jsx("meta",{property:"og:type",content:"article"})]}),e.jsx("div",{className:"flex-1 bg-gradient-to-br from-blue-50 to-indigo-100",children:e.jsx("div",{className:"container mx-auto px-4 py-12",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 mb-4",children:[e.jsx(S,{className:"h-4 w-4"}),e.jsx("span",{children:"PS Advisory Knowledge Base"})]}),e.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-4",children:s.title}),s.summary&&e.jsx("p",{className:"text-xl text-gray-700 mb-6",children:s.summary}),e.jsxs("div",{className:"flex items-center gap-6 text-sm text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4"}),e.jsx("span",{className:"capitalize",children:s.category})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-4 w-4"}),e.jsxs("span",{children:[s.views," views"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx("span",{children:new Date(s.updatedAt).toLocaleDateString()})]})]})]}),s.fileUrl&&s.fileName&&e.jsx("div",{className:"mb-8 bg-gradient-to-r from-purple-50 to-blue-50 border border-purple-200 rounded-lg p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-purple-100 p-3 rounded-full",children:e.jsx(A,{className:"h-6 w-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-purple-900 mb-1",children:"📎 File Attachment Available"}),e.jsxs("p",{className:"text-purple-700 text-sm",children:["This article includes a downloadable resource: ",e.jsx("span",{className:"font-medium",children:s.fileName}),s.fileSize&&` (${(s.fileSize/1024/1024).toFixed(2)} MB)`]})]})]}),e.jsxs(g,{onClick:()=>{const a=document.getElementById("download-section");a&&a.scrollIntoView({behavior:"smooth",block:"center"})},variant:"outline",className:"border-purple-300 text-purple-700 hover:bg-purple-50",children:["View Download Section",e.jsx(ne,{className:"h-4 w-4 ml-2 rotate-180"})]})]})}),e.jsx(ae,{className:"mb-8"}
1),e.jsx(U,{children:e.jsxs(H,{className:"p-8",children:[(s.isPubliclyAccessible||p||j)&&w?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"prose prose-lg max-w-none",dangerouslySetInnerHTML:{__html:w}}),s.fileUrl&&s.fileName&&e.jsx("div",{id:"download-section",className:"mt-8 p-6 bg-blue-50 border border-blue-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx(oe,{className:"h-8 w-8 text-blue-600 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-lg font-semibold text-blue-900 mb-2",children:"Download Attachment"}),e.jsx("p",{className:"text-blue-700 mb-4",children:"This article includes a downloadable file with additional resources."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-blue-900",children:s.fileName}),s.fileSize&&e.jsxs("p",{className:"text-sm text-blue-700",children:[(s.fileSize/1024/1024).toFixed(2)," MB"]})]}),e.jsxs(g,{onClick:()=>$(s.fileUrl,s.fileName),className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Download"]})]})]})]})})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(S,{className:"h-16 w-16 mx-auto text-gray-400 mb-4"}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Access Full Content"}),e.jsxs("p",{className:"text-gray-600 mb-6 max-w-md mx-auto",children:["Register with your information to access the complete content of this knowledge base article.",s.fileUrl&&" This article also includes a downloadable file."]}),e.jsx(g,{onClick:T,size:"lg",children:"Access Full Article"})]}),E&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Loading content..."})]})]})})]})})}),e.jsx(Q,{open:F,onOpenChange:u,children:e.jsxs(Y,{className:"sm:max-w-md",children:[e.jsxs(D,{children:[e.jsx(J,{children:"Access Knowledge Base Article"}),e.jsx(W,{children:"Please provide your information to access the full content of this article."})]}),e.jsx(ee,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(L),className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(n,{control:i.control,name:"firstName",render:({field:a})=>e.jsxs(o,{children:[e.jsx(c,{children:"First Name *"}),e.jsx(d,{children:e.jsx(m,{...a})}),e.jsx(x,{})]})}),e.jsx(n,{control:i.control,name:"lastName",render:({field:a})=>e.jsxs(o,{children:[e.jsx(c,{children:"Last Name *"}),e.jsx(d,{children:e.jsx(m,{...a})}),e.jsx(x,{})]})})]}),e.jsx(n,{control:i.control,name:"email",render:({field:a})=>e.jsxs(o,{children:[e.jsx(c,{children:"Email Address *"}),e.jsx(d,{children:e.jsx(m,{type:"email",...a})}),e.jsx(x,{})]})}),e.jsx(n,{control:i.control,name:"company",render:({field:a})=>e.jsxs(o,{children:[e.jsx(c,{children:"Company *"}),e.jsx(d,{children:e.jsx(m,{...a})}),e.jsx(x,{})]})}),e.jsx(n,{control:i.control,name:"phone",render:({field:a})=>e.jsxs(o,{children:[e.jsx(c,{children:"Phone Number (Optional)"}),e.jsx(d,{children:e.jsx(m,{...a})}),e.jsx(x,{})]})}),e.jsx(n,{control:i.control,name:"consentMarketing",render:({field:a})=>e.jsxs(o,{className:"flex flex-row items-start space-x-3 space-y-0",children:[e.jsx(d,{children:e.jsx(te,{checked:a.value,onCheckedChange:a.onChange})}),e.jsx("div",{className:"space-y-1 leading-none",children:e.jsx(c,{className:"text-sm",children:"I agree to receive marketing communications from PS Advisory"})})]})}),e.jsx(Z,{children:e.jsx(g,{type:"submit",disabled:f.isPending,className:"w-full",children:f.isPending?"Registering...":"Access Article"})})]})})]})})]})}export{Se 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.