PageSourceSearch

https://theaicmo.com/assets/IndustryHub-Ba43qMt_.js

js theaicmo.com collected 2026-10-04 23:20:44 UTC 20,250 bytes, 1 lines download raw bytes

1import{r as n,j as e}from"./react-Deb2Lbti.js";import{A as ee}from"./AppLayout-DrALtnuS.js";import{u as se,m as te,q as ae,s as m,B as b,c as re,t as j,V as S}from"./index-CgNF0Wwm.js";import{I as Y}from"./IndustrySelector-hy0Y1SH4.js";import{u as ie,b as ne}from"./useIndustries-GsmHDAEr.js";import{P as K}from"./ProfileSelector-BvzSAzoZ.js";import{C as V}from"./ClientSelector-C1W59U9F.js";import{L as B,b as H}from"./icons-6yq5rR5p.js";const q=({embedded:o,isAgency:r,children:u,title:N,description:v,rightContent:w})=>o?e.jsx(e.Fragment,{children:u}):e.jsx(ee,{title:N,description:v,rightContent:w??e.jsx("div",{className:"flex items-center gap-2",children:r?e.jsx(V,{}):e.jsx(K,{})}),children:u}),he=({embedded:o=!1}={})=>{const{user:r,businessProfile:u,refreshProfile:N,refreshBusinessProfiles:v}=se(),{activeClient:w,isAgency:h}=te(),{getIndustryById:M,isLoading:P}=ie(),x=ae(),[_,y]=n.useState([]),[le,k]=n.useState(!0),[g,f]=n.useState(!1),[I,F]=n.useState(!1),[$,L]=n.useState(void 0),c=w||u,D=c?.industry_id,J=c?.id,l=$!==void 0?$:D,t=l?M(l):null;n.useEffect(()=>{L(void 0),f(!1)},[J]);const{guardrails:d}=ne(l||null);n.useEffect(()=>{(async()=>{if(!l){y([]),k(!1);return}k(!0);try{const{data:a,error:i}=await m.from("industry_mechanics").select("*").eq("industry_id",l).eq("is_active",!0).order("sort_order",{ascending:!0});if(i){if(i.code==="42P01"){y([]);return}throw i}y(a||[])}catch(a){console.error("Error fetching mechanics:",a),y([])}finally{k(!1)}})()},[l]);const[W,O]=n.useState(!1),[E,R]=n.useState(new Set),[T,z]=n.useState(null);n.useEffect(()=>{if(!r?.id)return;let s=!1;return(async()=>{const{data:a}=await m.from("brand_guardrails").select("name").eq("user_id",r.id).is("deleted_at",null);s||R(new Set((a||[]).map(i=>i.name)))})(),()=>{s=!0}},[r?.id,c?.id]);const Q=async s=>{if(!(!r?.id||E.has(s.name))){z(s.id);try{const{error:a}=await m.from("brand_guardrails").insert({user_id:r.id,client_id:c?.id||null,rule_type:s.rule_type,severity:"warning",is_active:!0,name:s.name,description:"Adopted from an industry suggestion – edit the wording and severity to match your market.",config:s.config||{}});if(a)throw a;R(i=>new Set(i).add(s.name)),j(`"${s.name}" is now your rule – it applies from the next generation.`)}catch(a){S(a?.message||"Could not add that rule")}finally{z(null)}}},X=async()=>{if(!r?.id||!t?.compliance_config)return;const s=t.compliance_config;O(!0);try{const a=c?.id||null,{data:i}=await m.from("brand_guardrails").select("name").eq("user_id",r.id).is("deleted_at",null),U=new Set((i||[]).map(Z=>Z.name)),p=[];if(s.required_disclaimers?.length&&!U.has(`${t.name}: disclaimer`)&&p.push({user_id:r.id,client_id:a,rule_type:"required",severity:"warning",is_active:!0,name:`${t.name}: disclaimer`,description:"Adopted from industry suggestions – edit the phrases and severity to match your licence.",config:{phrases:s.required_disclaimers}}),s.prohibited_words?.length&&!U.has(`${t.name}: words to avoid`)&&p.push({user_id:r.id,client_id:a,rule_type:"forbidden",severity:"warning",is_active:!0,name:`${t.name}: words to avoid`,description:"Adopted from industry suggestions – edit the list and severity to match your market.",config:{words:s.prohibited_words}}),!p.length){j("These suggestions are already in your rules – edit them in Guardrails."),x("/brand?tab=guardrails");return}const{error:G}=await m.from("brand_guardrails").insert(p);if(G)throw G;j(`${p.length} rule(s) added as warnings – set the wording and severity your licence requires.`),x("/brand?tab=guardrails")}catch(a){S(a.message||"Could not add the rules")}finally{O(!1)}},C=async s=>{if(!(!c?.id||!r?.id)){F(!0);try{const a=s?M(s):null,{error:i}=await m.from("business_profiles").update({industry_id:s,industry:a?.name||null}).eq("id",c.id);if(i)throw i;L(s),f(!1),N(),v(),j(s?"Industry updated! AI context refreshed.":"Industry cleared. Using general AI context.")}catch(a){S(a.message||"Failed to update industry")}finally{F(!1)}}};if(!t&&!P)return e.jsx(q,{embedded:o,isAgency:h,title:"Industry Hub",description:"General mode - Works great for all industries",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-6",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-emerald-600",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"})," General mode active"]}),e.jsxs("h2",{className:"mt-3 text-base font-semibold text-gray-900 tracking-[-0.01em]",children:["Works for every industry – ",e.jsx("span",{className:"text-gray-400",children:"no setup needed."})]}),e.jsx("p",{className:"mt-2 max-w-2xl text-xs leading-5 text-gray-500",children:"The AI CMO works great for any business. Regulated industries – gambling, healthcare, finance – can optionally add industry-specific compliance guardrails and terminology."}),e.jsxs("div",{className:"mt-4 space-y-1.5 text-xs text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),"Full AI capabilities available"]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),"Your brand guardrails still apply"]})]})]}),e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-6",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Optional"}),e.jsx("h3",{className:"mt-1 text-sm font-semibold text-gray-900",children:"Add industry context"}),e.jsx("p",{className:"mt-0.5 text-xs text-gray-500 mb-4",children:"Useful for regulated industries like gambling, healthcare, or finance"}),e.jsx(Y,{value:null,onChange:C,placeholder:"Choose an industry (optional)..."})]})]})});if(P)return e.jsx(q,{embedded:o,isAgency:h,title:"Industry Hub",description:"Loading...",children:e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx(B,{className:"h-8 w-8 animate-spin text-gray-400"})})});const A=Object.keys(t?.terminology||{}).length;return e.jsx(q,{embedded:o,isAgency:h,title:"Industry Hub",description:`${t?.name||"Industry"} - Compliance, metrics & premium features`,rightContent:e.jsxs("div",{className:"flex items-center gap-2",children:[h?e.jsx(V,{}):e.jsx(K,{}),e.jsx("button",{onClick:()=>f(!g),className:"h-8 px-3.5 rounded-full text-[11px] font-medium bg-white ring-1 ring-gray-200/80 text-gray-600 hover:ring-gray-300 hover:text-gray-900 transition-all",children:g?"Cancel":"Change industry"})]}),children:e.jsxs("div",{className:"space-y-6",children:[o&&e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.12em] text-gray-400",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),t?.name,t?.region?` · ${t.region}`:""]}),e.jsx("button",{onClick:()=>f(!g),className:"h-7 px-3 rounded-full text-[11px] font-medium ring-1 ring-gray-200/80 text-gray-600 hover:ring-gray-300 hover:text-gray-900 transition-all",children:g?"Cancel":"Change industry"})]}),g&&e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Change industry"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"This updates AI prompts, compliance rules and the MMM demand controls"})]}),l&&e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>C(null),disabled:I,className:"text-xs text-gray-500 hover:text-gray-900",children:"Clear Industry (Use General)"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1",children:e.jsx(Y,{value:l||null,onChange:C,disabled:I,placeholder:"Select an industry or leave empty for general..."})}),I&&e.jsx(B,{className:"h-5 w-5 animate-spin text-gray-400"})]})]}),e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] overflow-hidden",children:[e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-emerald-600",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),"Industry context active",t?.is_premium?" · Premium":""]}),e.jsxs("h2",{className:"mt-3 text-base font-semibold text-gray-900 tracking-[-0.01em]",children:[t?.name,t?.region?` · ${t.region}`:"","."," ",e.jsx("span",{className:"text-gray-400",children:"Compliance, terminology and demand context – applied automatically."})]}),e.jsx("p",{className:"mt-2 max-w-3xl text-xs leading-5 text-gray-500",children:t?.description||"Your AI understands industry terminology, regulatory requirements, and best practices."})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-px bg-gray-100/80 border-t border-gray-100",children:[e.jsxs("div",{className:"bg-white px-5 py-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Suggested guardrails"}),e.jsx("p",{className:"mt-1 text-xl font-semibold tabular-nums text-gray-900",children:d.length}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-400",children:"Yours to adopt – nothing auto-blocks"})]}),e.jsxs("div",{className:"bg-white px-5 py-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Terminology"}),e.jsx("p",{className:"mt-1 text-xl font-semibold tabular-nums text-gray-900",children:A}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-400",children:"Terms the AI uses correctly"})]}),e.jsxs("div",{className:"bg-white px-5 py-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Mechanics"}),e.jsx("p",{className:"mt-1 text-xl font-semibold tabular-nums text-gray-900",children:_.length}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-400",children:"Industry feature specs"})]}),e.jsxs("button",{className:"bg-white px-5 py-4 text-left group transition-colors hover:bg-gray-50/60",onClick:()=>x("/flash-report"),children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Flash report"}),e.jsxs("p",{className:"mt-1 text-sm font-semibold text-gray-900 inline-flex items-center gap-1",children:["View report",e.jsx(H,{className:"h-3 w-3 text-gray-400 transition-transform group-hover:translate-x-0.5"})]}),e.jsx("p",{className:"mt-1 text-[10px] text-gray-400",children:"Industry-aware KPIs"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-5",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"AI context"}),e.jsx("h3",{className:"mt-1 text-sm font-semibold text-gray-900",children:"What every generation inherits"}),e.jsxs("div",{className:"mt-4 space-y-2.5 text-xs text-gray-600",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),e.jsxs("span",{children:["Writes as a ",e.jsx("strong",{className:"font-semibold text-gray-900",children:t?.name})," specialist – strategies, channels and benchmarks native to your market"]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),e.jsxs("span",{children:["Uses ",e.jsxs("strong",{className:"font-semibold text-gray-900",children:[A," industry terms"]})," correctly in every piece of content"]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),e.jsxs("span",{children:["Surfaces ",e.jsxs("strong",{className:"font-semibold text-gray-900",children:[d.length," guardrail suggestions"]})," – you decide which become your rules"]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 rounded-full bg-emerald-500 flex-shrink-0"}),e.jsx("span",{children:"Feeds industry demand context into analytics – Flash Report KPIs and MMM demand controls"})]})]})]}),t?.compliance_config&&e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Industry suggestions"}),e.jsx("h3",{className:"mt-1 text-sm font-semibold text-gray-900",children:"What marketers in your industry usually enforce"})]}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400",children:"Suggestions only"})]}),t.compliance_config.required_disclaimers?.length||t.compliance_config.prohibited_words?.length||t.compliance_config.prohibited_audiences?.length?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-px bg-gray-100/80 rounded-xl overflow-hidden ring-1 ring-gray-200/70",children:[t.compliance_config.required_disclaimers?.length>0&&e.jsxs("div",{className:"bg-white p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-emerald-600 mb-3",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"})," Suggested disclaimers"]}),e.jsx("ul",{className:"space-y-1.5",children:t.compliance_config.required_disclaimers.map((s,a)=>e.jsx("li",{className:"text-[11px] leading-4 text-gray-600",children:s},a))})]}),t.compliance_config.prohibited_words?.length>0&&e.jsxs("div",{className:"bg-white p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-rose-600 mb-3",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"})," Words to consider avoiding"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.compliance_config.prohibited_words.map((s,a)=>e.jsx("span",{className:"rounded-full bg-white px-2 py-0.5 text-[10px] font-medium text-rose-600 ring-1 ring-gray-200/80",children:s},a))})]}),t.compliance_config.prohibited_audiences?.length>0&&e.jsxs("div",{className:"bg-white p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-amber-600 mb-3",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"})," Audiences to consider avoiding"]}),e.jsx("ul",{className:"space-y-1.5",children:t.compliance_config.prohibited_audiences.map((s,a)=>e.jsx("li",{className:"text-[11px] leading-4 text-gray-600 capitalize",children:s.replace("_"," ")},a))})]})]}):e.jsxs("p",{className:"text-xs text-gray-400",children:["No content suggestions for ",t?.name,". Your own brand guardrails still apply to everything."]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100 flex items-center justify-between gap-3",children:[e.jsx("p",{className:"text-[11px] text-gray-400",children:"Nothing here is enforced – your licence and market decide what applies. Adopt these as your own editable rules, or write your own from scratch."}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[(t.compliance_config.required_disclaimers?.length>0||t.compliance_config.prohibited_words?.length>0)&&e.jsx(b,{size:"sm",className:"text-xs h-7 rounded-full",disabled:W,onClick:X,children:W?"Adding…":"Adopt as my rules"}),e.jsx(b,{variant:"outline",size:"sm",className:"text-xs h-7 rounded-full",onClick:()=>x("/brand?tab=guardrails"),children:"Write my own"})]})]})]}),d.length>0&&e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-5",children:[e.jsxs("div",{
1className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Industry context"}),e.jsx("h3",{className:"mt-1 text-sm font-semibold text-gray-900",children:"Informs what gets written"})]}),e.jsxs("span",{className:"text-[11px] text-gray-400 tabular-nums",children:[d.length," ",d.length===1?"suggestion":"suggestions"]})]}),e.jsxs("div",{className:"divide-y divide-gray-100",children:[d.slice(0,5).map(s=>e.jsxs("div",{className:"flex items-start gap-2.5 py-3",children:[e.jsx("span",{className:re("mt-1.5 h-1.5 w-1.5 rounded-full flex-shrink-0",s.severity==="blocking"?"bg-rose-500":s.severity==="warning"?"bg-amber-500":"bg-gray-300")}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-900",children:s.name}),e.jsx("p",{className:"text-[11px] text-gray-500",children:s.description})]}),E.has(s.name)?e.jsxs("span",{className:"flex-shrink-0 inline-flex items-center gap-1.5 text-[11px] font-medium text-gray-500",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),"Your rule"]}):e.jsx(b,{size:"sm",variant:"outline",disabled:T===s.id,onClick:()=>Q(s),className:"flex-shrink-0 h-7 rounded-full border-gray-200 px-3 text-[11px] font-medium",children:T===s.id?"Adding…":"Make it a rule"})]},s.id)),d.length>5&&e.jsxs("p",{className:"text-[11px] text-center text-gray-400 pt-3",children:["+ ",d.length-5," more guardrails"]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] p-5",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Terminology"}),e.jsx("h3",{className:"mt-1 text-sm font-semibold text-gray-900 mb-4",children:"Terms the AI uses correctly"}),A===0?e.jsx("p",{className:"text-xs text-gray-400 text-center py-4",children:"No terminology defined"}):e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto",children:Object.entries(t?.terminology||{}).map(([s,a])=>e.jsxs("div",{className:"p-3 rounded-xl bg-[#FAFAFA] ring-1 ring-gray-200/70",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-900 mb-0.5",children:s}),e.jsx("p",{className:"text-[11px] leading-relaxed text-gray-500",children:a})]},s))})]}),e.jsxs("div",{className:"rounded-2xl bg-white ring-1 ring-gray-200/70 shadow-[0_1px_3px_rgba(15,15,15,0.04)] overflow-hidden",children:[e.jsx("div",{className:"px-5 pt-5 pb-2",children:e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Where this context works"})}),e.jsx("div",{className:"divide-y divide-gray-100",children:[{title:"Flash report",sub:"Industry-aware KPIs and traffic lights",to:"/flash-report"},{title:"Marketing mix modeling",sub:"Industry demand controls and governance",to:"/marketing-mix-modeling"},..._.length>0?[{title:"Premium mechanics",sub:`${_.length} industry feature specs`,to:"/mechanics-marketplace"}]:[],{title:"Create content",sub:"Chat with industry context applied",to:"/agentic-mode"},{title:"Custom guardrails",sub:"Add your own rules on top of the industry set",to:"/brand?tab=guardrails"}].map(s=>e.jsxs("button",{className:"w-full flex items-center justify-between gap-3 px-5 py-3.5 text-left group transition-colors hover:bg-gray-50/60",onClick:()=>x(s.to),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-900",children:s.title}),e.jsx("p",{className:"text-[11px] text-gray-500 truncate",children:s.sub})]}),e.jsx(H,{className:"h-3.5 w-3.5 flex-shrink-0 text-gray-300 transition-all group-hover:text-gray-500 group-hover:translate-x-0.5"})]},s.to))})]})]})]})]})})};export{he 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.