PageSourceSearch

https://bluethread.lovable.app/assets/exportAdvisoryDocx-CAU3urjG.js

js bluethread.lovable.app collected 2026-10-03 03:27:42 UTC 17,741 bytes, 7 lines download raw bytes

1import{BorderStyle as u,Paragraph as a,TextRun as i,PageBreak as Oe,Header as Re,TabStopPosition as te,TabStopType as re,Footer as Se,PageNumber as oe,Document as Ne,PageOrientation as ze,AlignmentType as Fe,LevelFormat as De,Packer as xe,Table as q,WidthType as b,TableRow as B,TableCell as S,ShadingType as I,HeadingLevel as ne}from"./index-a9PisJHo.js";import{a as Be}from"./FileSaver.min-BH_gW3Qt.js";import{s as Ie}from"./index-DaNgbS5L.js";import{s as N,r as ke,a as Pe}from"./partnerStackAdvisor--VQqylcW.js";import{f as ie}from"./format-BJNWob66.js";function Ge(l){return Pe.map(h=>{const f=l[h.id],O=Array.isArray(f)?f:f?[f]:[];if(O.length===0)return null;const C=O.map(y=>h.options.find(L=>L.value===y)?.label||y);return`- ${h.section} | ${h.title}: ${C.join("; ")}`}).filter(Boolean).join(`
2`)}function He(l){const h=l.tooling_specific;if(!Array.isArray(h)||h.length===0)return{text:"(none declared)",byCategory:{}};const f={};return h.forEach(C=>{const[y,L]=String(C).split(":");y&&L&&(f[y]=L)}),{text:Object.entries(f).map(([C,y])=>`- ${N[C]?.label||C}: ${y}`).join(`
3`),byCategory:f}}async function We(l){const h=l.answers||{},f=l.recommended_stack||{},O=Array.isArray(f.recommendedCategories)?f.recommendedCategories:[],{text:C,byCategory:y}=He(h),L={};for(const[e,r]of Object.entries(y)){const n=N[e];if(!n)continue;n.bluethreadVendors.map(p=>p.toLowerCase()).includes(String(r).toLowerCase())&&(L[e]=r)}const ae=O.map(e=>{const r=N[e];if(!r)return null;const n=L[e];if(n)return`- ${r.label}: customer already uses BlueThread preferred vendor (${n}) - no additional vendor recommendation needed.`;const d=ke(e,h);if(d.length>0){const p=d.map(w=>`    • ${w.vendor} (${w.role}) - ${w.reason}`).join(`
4`),v=r.alternatives.length>0?`
5    Alternatives to evaluate: ${r.alternatives.join(", ")}`:"";return`- ${r.label} (BlueThread preferred: ${r.bluethreadVendors.join(", ")||"none"}):
6${p}${v}`}return r.bluethreadVendors.length===0?`- ${r.label}: (no BlueThread preferred vendor - alternatives only: ${r.alternatives.join(", ")})`:`- ${r.label}: ${r.bluethreadVendors.join(", ")}`}).filter(Boolean).join(`
7`),se={submission:{id:l.id,full_name:l.full_name,company:l.company||l.profile?.company,work_email:l.work_email,maturity_stage:l.maturity_stage,answersFormatted:Ge(h),recommendedCategoriesFormatted:O.map(e=>N[e]?.label||e),bluethreadVendorsFormatted:ae,currentToolsFormatted:C}},{data:le,error:U}=await Ie.functions.invoke("psa-advisory-doc",{body:se});if(U)throw new Error(U.message||"Failed to generate advisory brief");const o=le.brief;if(!o)throw new Error("Advisory model returned no brief");const V=l.full_name||[l.profile?.first_name,l.profile?.last_name].filter(Boolean).join(" ")||"Respondent",k=l.company||l.profile?.company||"-",_="0B1220",T="1F2937",g="64748B",z="E2E8F0",F="6E3FF3",P="4C1D95",ce="0B1220",de="FFFFFF",X="F8FAFC",pe="F5F3FF",ue="6E3FF3",K=12240,Y=1440,Q=1440,he=1440,me=1440,m=K-Y-Q;let J=0;const c=e=>{J+=1;const r=String(J).padStart(2,"0");return[new a({spacing:{before:360,after:40},border:{top:{style:u.SINGLE,size:12,color:F,space:6}},children:[new i({text:`${r}  /  ${e.toUpperCase()}`,bold:!0,size:18,characterSpacing:40,color:P})]}),new a({heading:ne.HEADING_1,spacing:{before:40,after:160},children:[new i({text:e,bold:!0,color:_})]})]},Z=e=>new a({heading:ne.HEADING_2,children:[new i({text:e,bold:!0,color:_})]}),R=e=>new a({spacing:{before:160,after:60},children:[new i({text:e.toUpperCase(),bold:!0,size:16,characterSpacing:30,color:g})]}),W=(e,r={})=>new a({spacing:{after:120,line:300},children:[new i({text:e,bold:r.bold,italics:r.italics,color:r.color||T})]}),D=e=>new a({spacing:{after:200,line:320},children:[new i({text:e,size:24,color:T})]}),x=e=>new a({numbering:{reference:"bullets",level:0},spacing:{after:80,line:280},children:[new i({text:e,color:T})]}),fe=(e,r)=>new a({spacing:{after:100,line:300},children:[new i({text:`${e} - `,bold:!0,color:_}),new i({text:r,color:T})]}),G={style:u.NONE,size:0,color:"FFFFFF"},ee=(e,r)=>new q({width:{size:m,type:b.DXA},columnWidths:[m],borders:{top:{style:u.SINGLE,size:4,color:z},bottom:{style:u.SINGLE,size:4,color:z},left:{style:u.SINGLE,size:24,color:ue},right:{style:u.SINGLE,size:4,color:z},insideHorizontal:G,insideVertical:G},rows:[new B({children:[new S({width:{size:m,type:b.DXA},shading:{fill:pe,type:I.CLEAR,color:"auto"},margins:{top:200,bottom:200,left:280,right:280},children:[new a({spacing:{after:60},children:[new i({text:e.toUpperCase(),bold:!0,size:16,characterSpacing:30,color:P})]}),new a({children:[new i({text:r,color:_})]})]})]})]}),H={style:u.SINGLE,size:4,color:z},$={top:H,bottom:H,left:H,right:H},_e=(e,r)=>new S({width:{size:r,type:b.DXA},borders:$,shading:{fill:ce,type:I.CLEAR,color:"auto"}
7,margins:{top:140,bottom:140,left:160,right:160},children:[new a({children:[new i({text:(e||"").toUpperCase(),bold:!0,size:18,characterSpacing:20,color:de})]})]}),ge=(e,r,n)=>new S({width:{size:r,type:b.DXA},borders:$,shading:n?{fill:X,type:I.CLEAR,color:"auto"}:void 0,margins:{top:120,bottom:120,left:160,right:160},children:[new a({spacing:{line:280},children:[new i({text:e||"-",color:T})]})]}),A=(e,r)=>{const n=e.length,d=Math.floor(m/n),p=new Array(n).fill(d);return p[n-1]=m-d*(n-1),new q({width:{size:m,type:b.DXA},columnWidths:p,rows:[new B({tableHeader:!0,children:e.map((v,w)=>_e(v,p[w]))}),...r.map((v,w)=>new B({children:v.map((Le,Te)=>ge(Le,p[Te],w%2===1))}))]})},E=e=>{const r=e.filter(([,p])=>!!p&&String(p).trim().length>0),n=Math.floor(m*.32),d=m-n;return new q({width:{size:m,type:b.DXA},columnWidths:[n,d],rows:r.map(([p,v],w)=>new B({children:[new S({width:{size:n,type:b.DXA},borders:$,shading:{fill:X,type:I.CLEAR,color:"auto"},margins:{top:120,bottom:120,left:160,right:160},children:[new a({children:[new i({text:p,bold:!0,color:_,size:20})]})]}),new S({width:{size:d,type:b.DXA},borders:$,margins:{top:120,bottom:120,left:160,right:160},children:[new a({spacing:{line:280},children:[new i({text:v,color:T})]})]})]}))})},s=(e=120)=>new a({spacing:{after:e},children:[new i("")]}),we="FEF3C7",M="F59E0B",be="78350F",j=e=>{const r=e==="start"?"ADVISOR ONLY  -  INTERNAL PREP. DELETE THIS SECTION BEFORE SENDING TO THE CLIENT.":"END ADVISOR-ONLY SECTION  -  DELETE EVERYTHING BETWEEN THE AMBER BANNERS BEFORE SENDING TO THE CLIENT.";return new q({width:{size:m,type:b.DXA},columnWidths:[m],borders:{top:{style:u.SINGLE,size:12,color:M},bottom:{style:u.SINGLE,size:12,color:M},left:{style:u.SINGLE,size:12,color:M},right:{style:u.SINGLE,size:12,color:M},insideHorizontal:G,insideVertical:G},rows:[new B({children:[new S({width:{size:m,type:b.DXA},shading:{fill:we,type:I.CLEAR,color:"auto"},margins:{top:140,bottom:140,left:200,right:200},children:[new a({children:[new i({text:r,bold:!0,size:18,characterSpacing:30,color:be})]})]})]})]})},t=[];if(t.push(new a({spacing:{after:0},border:{bottom:{style:u.SINGLE,size:36,color:F,space:1}},children:[new i("")]})),t.push(new a({spacing:{before:600,after:120},children:[new i({text:"BLUETHREAD  /  ADVISORY",bold:!0,size:20,characterSpacing:60,color:P})]})),t.push(new a({spacing:{before:240,after:160},children:[new i({text:"Partner Stack Advisory Brief",bold:!0,size:60,color:_})]})),t.push(new a({spacing:{after:600},children:[new i({text:"Operating model, system architecture, and a minimum-viable path to a partner stack that fits.",size:26,color:g,italics:!0})]})),t.push(E([["Prepared for",V],["Organization",k!=="-"?k:void 0],["Maturity stage",l.maturity_stage||void 0],["Date",ie(new Date,"PPP")],["Reference",l.id.slice(0,8).toUpperCase()]])),t.push(new a({spacing:{before:600,after:0},border:{top:{style:u.SINGLE,size:12,color:F,space:6}},children:[new i({text:"Confidential - prepared for the named recipient only.",size:16,color:g,italics:!0})]})),t.push(new a({children:[new Oe]})),t.push(...c("Executive summary")),t.push(D(o.executive_summary)),t.push(...c("What we heard")),t.push(W(o.what_we_heard)),o.hidden_signals?.length&&(t.push(...c("Hidden signals to probe")),o.hidden_signals.forEach(e=>{t.push(new a({spacing:{before:120,after:40},children:[new i({text:e.signal,bold:!0,color:_,size:24})]})),t.push(W(e.why_it_matters))})),o.recommendation_confidence){const e=o.recommendation_confidence;t.push(j("start")),t.push(s(80)),t.push(...c("Recommendation confidence and assumptions"));const r=e.level==="High"?"16A34A":e.level==="Low"?"B91C1C":"B45309";t.push(new a({spacing:{after:160},children:[new i({text:"CONFIDENCE  ",bold:!0,size:16,characterSpacing:30,color:g}),new i({text:(e.level||"-").toUpperCase(),bold:!0,size:22,color:r})]})),e.summary&&t.push(ee("Why we have this confidence",e.summary)),t.push(s(120)),e.key_assumptions?.length&&(t.push(R("Key assumptions")),e.key_assumptions.forEach(n=>t.push(x(n)))),e.missing_information?.length&&(t.push(R("Missing information that could change the recommendation")),e.missing_information.forEach(n=>t.push(x(n)))),e.validate_in_call?.length&&(t.push(R("Validate live on the advisor call")),e.validate_in_call.forEach(n=>t.push(x(n)))),t.push(s(120)),t.push(j("end"))}if(o.operating_model_requirements){const e=o.operating_model_requirements;t.push(...c("Operating model requirements")),e.framing&&t.push(D(e.framing)),t.push(E([["Partner attribution model",e.partner_attribution_model],["CRM source of truth",e.crm_source_of_truth],["Partner lifecycle stages",e.partner_lifecycle_stages],["Deal registration rules",e.deal_registration_rules],["Referral rules",e.referral_rules],["Co-sell workflow rules",e.cosell_workflow_rules],["MDF approval & measurement",e.mdf_rules],["Enablement / certification",e.enablement_certification_requirements],["Governance ca
7dence",e.governance_cadence],["Data ownership",e.data_ownership],["Compliance requirements",e.compliance_requirements]])),t.push(s())}if(o.selection_criteria?.length&&(t.push(...c("Selection criteria used")),t.push(A(["Criterion","Why it matters here"],o.selection_criteria.map(e=>[e.criterion,e.why_it_matters_here]))),t.push(s())),o.crm_architecture){const e=o.crm_architecture;t.push(...c("CRM architecture and source of truth")),t.push(E([["Source of truth - partner accounts",e.source_of_truth_partner_accounts],["Source of truth - partner contacts",e.source_of_truth_partner_contacts],["Deal registration object / workflow",e.deal_registration_object],["Referral object / workflow",e.referral_object],["Partner attribution fields",e.partner_attribution_fields?.length?e.partner_attribution_fields.join(", "):void 0],["Required fields for claims",e.required_fields_for_claims],["Sync logic (PRM ↔ referral ↔ co-sell ↔ CRM)",e.sync_logic],["Forecasting / reporting flow",e.forecasting_flow],["Data ownership by role",e.data_ownership_by_role]])),t.push(s())}if(o.partner_motion_segmentation?.length&&(t.push(...c("Partner motion segmentation")),t.push(A(["Partner type","Primary workflow","Stack requirement"],o.partner_motion_segmentation.map(e=>[e.partner_type,e.primary_workflow,e.stack_requirement+(e.notes?` - ${e.notes}`:"")]))),t.push(s())),o.attribution_definitions?.applicable){const e=o.attribution_definitions;t.push(...c("Attribution definitions")),e.framing&&t.push(D(e.framing)),e.definitions?.length&&(t.push(A(["Term","Definition"],e.definitions.map(r=>[r.term,r.definition]))),t.push(s())),(e.attribution_window||e.override_process)&&(t.push(E([["Attribution window",e.attribution_window],["Override process",e.override_process]])),t.push(s()))}if(o.category_analysis?.length){t.push(...c("Category analysis and recommendations"));const e={};Object.keys(N).forEach(n=>{const d=N[n];e[d.label.toLowerCase()]=d.bluethreadVendors,e[d.shortLabel.toLowerCase()]=d.bluethreadVendors});const r=(n,d)=>{const p=e[(n||"").toLowerCase()]||[];if(p.length===0)return!1;const v=(d||"").toLowerCase();return p.some(w=>v.includes(w.toLowerCase()))};o.category_analysis.forEach((n,d)=>{d>0&&t.push(s(160)),t.push(Z(n.category));const p=r(n.category,n.bluethread_recommendation)?"BlueThread recommendation":"Alternatives to consider";t.push(E([["Score read",n.score_interpretation],[p,n.bluethread_recommendation],["Current tool",n.current_tool||"None declared"]])),t.push(s(80)),t.push(R(n.differs_from_bt?"Why BlueThread's pick is worth considering":"Why this is the right long-term bet")),t.push(W(n.why_bt_pick_matters))})}if(o.current_tool_disposition?.length&&(t.push(...c("Current tool disposition")),t.push(D("Explicit disposition for each tool already in use - keep, replace, consolidate, integrate, sunset, or defer.")),t.push(A(["Tool","Disposition","Reason","Timing"],o.current_tool_disposition.map(e=>[`${e.tool}${e.category?` (${e.category})`:""}`,e.disposition,e.reason,e.timing]))),t.push(s())),o.budget_fit_analysis){const e=o.budget_fit_analysis;t.push(...c("Budget-fit analysis")),(e.stated_budget||e.budget_realism)&&(t.push(E([["Stated budget",e.stated_budget],["Budget realism",e.budget_realism]])),t.push(s())),e.options?.length&&(t.push(A(["Option","Scope","When to use","Approx. cost"],e.options.map(r=>[r.option,r.scope,r.when_to_use,r.approx_cost||"-"]))),t.push(s()))}if(o.twelve_month_roadmap?.length&&(t.push(...c("12-18 month roadmap")),t.push(D("Process design and platform implementation are sequenced separately. Don't run them in parallel without ops capacity.")),o.twelve_month_roadmap.forEach((e,r)=>{r>0&&t.push(s(120)),t.push(Z(`${e.phase} · ${e.timeframe} - ${e.workstream}`)),t.push(E([["Goal",e.goal],["Success criteria",e.success_criteria],["Trigger for next phase",e.trigger_for_next]]))}),t.push(s())),o.governance_model?.applicable){const e=o.governance_model;t.push(...c("Governance model")),t.push(E([["Deal registration approval SLA",e.deal_reg_approval_sla],["Attribution review cadence",e.attribution_review_cadence],["Conflict resolution process",e.conflict_resolution_process],["MDF approval process",e.mdf_approval_process],["Data quality owner",e.data_quality_owner],["Required CRM fields",e.required_crm_fields?.length?e.required_crm_fields.join(", "):void 0],["Quarterly hygiene review",e.quarterly_hygiene_review],["RevOps / Sales / Finance / Partnerships responsibilities",e.role_responsibilities],["Manual override rules",e.manual_override_rules]])),t.push(s())}if(o.partner_experience){const e=o.partner_experience;
7t.push(...c("Partner experience design")),t.push(E([["Partner-facing workflows",e.partner_facing_workflows],["Internal-only workflows",e.internal_only_workflows],["Low-volume partner path",e.low_volume_partner_path],["Strategic partner consideration",e.strategic_partner_consideration],["Status visibility for partners",e.status_visibility],["Friction added by the new process",e.friction_added],["What partners get in exchange for compliance",e.partner_value_exchange]])),t.push(s())}o.compliance_security?.applicable&&o.compliance_security.checklist?.length&&(t.push(...c("Compliance and security due diligence")),t.push(A(["Item","Requirement","Vendor must provide"],o.compliance_security.checklist.map(e=>[e.item,e.requirement,e.vendor_must_provide||"-"]))),t.push(s())),o.risks?.length&&(t.push(...c("Risks and mitigations")),t.push(A(["Risk","Mitigation"],o.risks.map(e=>[e.risk,e.mitigation]))),t.push(s())),o.success_metrics?.length&&(t.push(...c("Success metrics")),t.push(A(["Metric","Target","How it's measured"],o.success_metrics.map(e=>[e.metric,e.target,e.measurement_method]))),t.push(s())),t.push(j("start")),t.push(s(80)),t.push(...c("Advisor call prep")),t.push(ee("Opening frame",o.advisor_call_prep.opening_frame)),t.push(s(160)),t.push(R("Discovery questions")),o.advisor_call_prep.discovery_questions.forEach(e=>t.push(x(e))),t.push(R("Objections to anticipate")),o.advisor_call_prep.objections_to_anticipate.forEach(e=>t.push(x(e))),t.push(s(120)),t.push(fe("Recommended next step",o.advisor_call_prep.recommended_next_step)),t.push(s(120)),t.push(j("end"));const ye=new Re({children:[new a({spacing:{after:0},border:{bottom:{style:u.SINGLE,size:6,color:F,space:4}},tabStops:[{type:re.RIGHT,position:te.MAX}],children:[new i({text:"BlueThread  /  Advisory",bold:!0,size:16,characterSpacing:40,color:P}),new i({text:`	${k!=="-"?k:V}`,size:16,color:g})]})]}),Ee=new Se({children:[new a({spacing:{before:0},border:{top:{style:u.SINGLE,size:6,color:z,space:4}},tabStops:[{type:re.RIGHT,position:te.MAX}],children:[new i({text:`Confidential  ·  ${ie(new Date,"PPP")}`,size:16,color:g}),new i({text:"	Page ",size:16,color:g}),new i({children:[oe.CURRENT],size:16,color:g}),new i({text:" of ",size:16,color:g}),new i({children:[oe.TOTAL_PAGES],size:16,color:g})]})]}),ve=new Ne({creator:"BlueThread",title:"BlueThread Advisory Brief",styles:{default:{document:{run:{font:"Calibri",size:22,color:T}}},paragraphStyles:[{id:"Heading1",name:"Heading 1",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:40,bold:!0,color:_,font:"Calibri"},paragraph:{spacing:{before:80,after:200},outlineLevel:0}},{id:"Heading2",name:"Heading 2",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:26,bold:!0,color:_,font:"Calibri"},paragraph:{spacing:{before:240,after:120},outlineLevel:1}},{id:"Heading3",name:"Heading 3",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:22,bold:!0,color:_,font:"Calibri"},paragraph:{spacing:{before:160,after:80},outlineLevel:2}}]},numbering:{config:[{reference:"bullets",levels:[{level:0,format:De.BULLET,text:"•",alignment:Fe.LEFT,style:{paragraph:{indent:{left:540,hanging:280}},run:{color:F}}}]}]},sections:[{properties:{page:{size:{width:K,height:15840,orientation:ze.PORTRAIT},margin:{top:he,right:Q,bottom:me,left:Y}},titlePage:!0},headers:{default:ye},footers:{default:Ee},children:t}]}),Ce=await xe.toBlob(ve),Ae=V.replace(/[^a-z0-9]+/gi,"-").toLowerCase();Be.saveAs(Ce,`bluethread-advisory-${Ae}-${l.id.slice(0,8)}.docx`)}export{We as exportAdvisoryDocx};

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.