PageSourceSearch

https://cacttus.cl/_next/static/chunks/pages/admin/support/cancellation-requests/analytics-7e581e6a308bbbad.js

js cacttus.cl collected 2026-10-01 23:59:12 UTC 64,533 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cbd0a05e-1bdb-41aa-925b-b1beb1f861c9",e._sentryDebugIdIdentifier="sentry-dbid-cbd0a05e-1bdb-41aa-925b-b1beb1f861c9")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2178],{25861:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/support/cancellation-requests/analytics",function(){return a(18636)}])},8547:function(e,t,a){"use strict";a.d(t,{h:function(){return ChartTooltip}});var n=a(52322);function ChartTooltip(e){let{active:t,payload:a,label:s,formatValue:i,showTotal:r}=e;if(!t||!(null==a?void 0:a.length))return null;let l=a.reduce((e,t)=>e+t.value,0);return(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-lg shadow-lg px-4 py-3 text-sm",children:[s&&(0,n.jsx)("p",{className:"text-admin-muted-foreground mb-1",children:s}),a.map(e=>(0,n.jsxs)("p",{className:"text-admin-foreground",children:[(0,n.jsx)("span",{className:"inline-block w-2 h-2 rounded-full mr-2",style:{backgroundColor:e.color}}),i?i(e.name,e.value):"".concat(e.name,": ").concat(e.value.toLocaleString("es-CL"))]},e.name)),r&&a.length>1&&(0,n.jsxs)("p",{className:"text-admin-foreground font-medium border-t border-admin-border mt-1.5 pt-1.5",children:["Total: ",l.toLocaleString("es-CL")]})]})}a(2784)},86251:function(e,t,a){"use strict";a.d(t,{q:function(){return DashboardAreaChart}});var n=a(52322),s=a(2784),i=a(27392),r=a(50603),l=a(9937),d=a(25556),o=a(3131),c=a(63929),u=a(49778),m=a(41033),x=a(49759),_=a(8547);function DashboardAreaChart(e){let{title:t,subtitle:a,data:h,series:f,xAxisKey:p="month",height:g=280,isLoading:v,isError:j,errorMessage:b="Error al cargar datos",formatTooltipValue:y}=e,R=(0,s.useId)();return(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5 flex flex-col",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-sm text-admin-foreground mb-0.5",children:t}),a&&(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:a})]}),(0,n.jsx)("div",{style:{height:g},children:v?(0,n.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,n.jsx)(x.Z,{className:"w-6 h-6 animate-spin text-admin-muted-foreground"})}):j?(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-admin-muted-foreground",children:b}):(0,n.jsx)(i.h,{width:"100%",height:"100%",children:(0,n.jsxs)(r.T,{data:h,margin:{top:4,right:4,bottom:0,left:4},children:[(0,n.jsx)("defs",{children:f.map(e=>(0,n.jsxs)("linearGradient",{id:"area-gradient-".concat(R,"-").concat(e.key),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:e.color,stopOpacity:.15}),(0,n.jsx)("stop",{offset:"100%",stopColor:e.color,stopOpacity:0})]},e.key))}),(0,n.jsx)(l.q,{strokeDasharray:"3 3",stroke:"rgb(var(--admin-border))",vertical:!1}),(0,n.jsx)(d.K,{dataKey:p,tick:{fontSize:12,fill:"rgb(var(--admin-muted-foreground))"},axisLine:!1,tickLine:!1}),(0,n.jsx)(o.B,{tick:{fontSize:12,fill:"rgb(var(--admin-muted-foreground))"},axisLine:!1,tickLine:!1,width:40}),(0,n.jsx)(c.u,{content:(0,n.jsx)(_.h,{formatValue:y})}),f.length>1&&(0,n.jsx)(u.D,{iconType:"circle",iconSize:8,wrapperStyle:{fontSize:"12px"}}),f.map(e=>(0,n.jsx)(m.uN,{type:"monotone",dataKey:e.key,name:e.name,stroke:e.color,strokeWidth:2,fill:"url(#area-gradient-".concat(R,"-").concat(e.key,")"),dot:!1,activeDot:{r:3,strokeWidth:0,fill:e.color}},e.key))]})})})]})}},38800:function(e,t,a){"use strict";a.d(t,{A:function(){return DashboardBarChart}});var n=a(52322);a(2784);var s=a(27392),i=a(80739),r=a(9937),l=a(25556),d=a(3131),o=a(63929),c=a(49778),u=a(59888),m=a(49759),x=a(8547);function DashboardBarChart(e){let{title:t,subtitle:a,data:_,series:h,xAxisKey:f="month",height:p=280,isLoading:g,isError:v,errorMessage:j="Error al cargar datos",formatTooltipValue:b,stacked:y}=e;return(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5 flex flex-col",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-sm text-admin-foreground mb-0.5",children:t}),a&&(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:a})]}),(0,n.jsx)("div",{style:{height:p},children:g?(0,n.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,n.jsx)(m.Z,{className:"w-6 h-6 animate-spin text-admin-muted-foreground"})}):v?(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-admin-muted-foreground",children:j}):(0,n.jsx)(s.h,{width:"100%",height:"100%",children:(0,n.jsxs)(i.v,{data:_,margin:{top:4,right:4,bottom:0,left:4},children:[(0,n.jsx)(r.q,{strokeDasharray:"3 3",stroke:"rgb(var(--admin-border))",vertical:!1}),(0,n.jsx)(l.K,{dataKey:f,tick:{fontSize:12,fill:"rgb(var(--admin-muted-foreground))"}
1,axisLine:!1,tickLine:!1}),(0,n.jsx)(d.B,{tick:{fontSize:12,fill:"rgb(var(--admin-muted-foreground))"},axisLine:!1,tickLine:!1,width:40}),(0,n.jsx)(o.u,{content:(0,n.jsx)(x.h,{formatValue:b,showTotal:h.length>1})}),h.length>1&&(0,n.jsx)(c.D,{iconType:"circle",iconSize:8,wrapperStyle:{fontSize:"12px"}}),h.map(e=>(0,n.jsx)(u.$Q,{dataKey:e.key,name:e.name,fill:e.color,radius:[3,3,0,0],stackId:y?"stack":void 0},e.key))]})})})]})}},41557:function(e,t,a){"use strict";a.d(t,{R:function(){return StatCard}});var n=a(52322);a(2784);var s=a(72058),i=a(45564),r=a(25987);let l={default:"bg-admin-card border-admin-border",success:"bg-admin-success/5 border-admin-success/20",warning:"bg-admin-warning/5 border-admin-warning/20",destructive:"bg-admin-error/5 border-admin-error/20"},d={up:"text-admin-success",down:"text-admin-error",neutral:"text-admin-muted-foreground"};function StatCard(e){let{title:t,value:a,subtitle:o,icon:c,trend:u,variant:m="default",onClick:x,active:_}=e,h=u?u.value>0?"up":u.value<0?"down":"neutral":null,f=!!x;return(0,n.jsxs)("div",{className:(0,r.cn)("border rounded-xl p-5",l[m],f&&"cursor-pointer transition-colors hover:bg-admin-accent",_&&"ring-2 ring-admin-primary"),onClick:x,role:f?"button":void 0,tabIndex:f?0:void 0,onKeyDown:f?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),x())}:void 0,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,n.jsx)("p",{className:"text-sm text-admin-muted-foreground",children:t}),c&&(0,n.jsx)("div",{className:"text-admin-muted-foreground",children:c})]}),(0,n.jsx)("p",{className:"text-3xl text-admin-foreground",children:a}),(o||u)&&(0,n.jsxs)("div",{className:"mt-1",children:[o&&(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:o}),u&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[u.label&&(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:u.label}),h&&(0,n.jsxs)("span",{className:(0,r.cn)("flex items-center gap-0.5 text-xs font-medium",d[h]),children:["up"===h&&(0,n.jsx)(s.Z,{className:"w-3 h-3"}),"down"===h&&(0,n.jsx)(i.Z,{className:"w-3 h-3"}),u.value>0?"+":"",u.value,"%"]})]})]})]})}},18636:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return J}});var n=a(52322),s=a(2784),i=a(97729),r=a.n(i),l=a(83878),d=a(28857),o=a(5632),c=a(39097),u=a.n(c),m=a(78134),x=a(41557);function BreakdownCard(e){let{title:t,value:a,subtitle:s,items:i}=e;return(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5 flex flex-col",children:[(0,n.jsx)("p",{className:"text-sm text-admin-muted-foreground mb-1",children:t}),(0,n.jsx)("p",{className:"text-3xl text-admin-foreground mb-1",children:a}),s&&(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground mb-4",children:s}),(0,n.jsx)("div",{className:"flex flex-col mt-auto divide-y divide-admin-border",children:i.map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between py-2.5 text-sm",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 text-admin-muted-foreground min-w-0",children:[e.color&&(0,n.jsx)("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,n.jsx)("span",{className:"truncate",children:e.label})]}),(0,n.jsx)("span",{className:"text-admin-foreground shrink-0",children:e.value})]},e.label))})]})}a(8547);var _=a(38800),h=a(86251),f=a(38681),p=a(93227),g=a(87078),v=a(66123);f.Z,p.Z,g.Z,v.Z;var j=a(93829),b=a(70333),y=a(37903),R=a(75262),N=a(29591),Z=a(10777),w=a(69405),k=a(47994),q=a(5289),C=a(68471),S=a(43253),D=a(46443),M=a(49530);let P=["30","90","180","365","custom"],O={30:"\xdaltimos 30 d\xedas",90:"\xdaltimos 90 d\xedas",180:"\xdaltimos 180 d\xedas",365:"\xdaltimos 365 d\xedas",custom:"Personalizado"},A={declared:"Declarado",effective:"Efectivo",verified:"Verificado"},isDatePreset=e=>P.some(t=>t===e),isReasonView=e=>Z.GP.some(t=>t===e);function AnalyticsFilters(e){let{preset:t,dateFrom:a,dateTo:s,reasonView:i,reasonOptionId:r,comparisonLabel:l,onPresetChange:d,onDateFromChange:o,onDateToChange:c,onReasonViewChange:u,onReasonOptionChange:m}=e,{data:x}=(0,M.$i)();return(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5 space-y-4",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(q._,{className:"text-xs text-admin-muted-foreground",children:"Per\xedodo"}),(0,n.jsxs)(C.Ph,{value:t,onValueChange:e=>{isDatePreset(e)&&d(e)},children:[(0,n.jsx)(C.i4,{className:"w-52",children:(0,n.jsx)(C.ki,{placeholder:"Per\xedodo"})}),(0,n.jsx)(C.Bw,{children:P.map(e=>(0,n.jsx)(C.Ql,{value:e,children:O[e]},e))})]})]}),"custom"===t&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(q._,{className:"text-xs text-admin-muted-foreground",htmlFor:"analytics-date-from",children:"Desde"}),(0,n.jsx)(k.I,{id:"analytics-date-from",type:"date",value:a,max:s,onChange:e=>o(e.target.value),className:"w-44"})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(q._,{className:"text-xs text-admin-muted-foreground",htmlFor:"analytics-date-to",children:"Hasta"}),(0,n.jsx)(k.I,{id:"analytics-date-to",type:"date",value:s,min:a,onChange:e=>c(e.target.value),className:"w-44"})]})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(q._,{className:"text-xs text-admin-muted-foreground",children:"Motivo"}),(0,n.jsxs)(C.Ph,{value:r,onValueChange:m,children:[(0,n.jsx)(C.i4,{className:"w-64",children:(0,n.jsx)(C.ki,{placeholder:"Motivo"})}),(0,n.jsxs)(C.Bw,{children:[(0,n.jsx)(C.Ql,{value:"all",children:"Todos los motivos"}),(null!=x?x:[]).filter(e=>e.is_active).map(e=>(0,n.jsx)(C.Ql,{value:String(e.id),children:e.label},e.id))]})]})]})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(q._,{className:"text-xs text-admin-muted-foreground",children:"Vista de motivo"}),(0,n.jsx)(D.pn,{children:(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":"Qu\xe9 significa cada vista de motivo",children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 text-admin-muted-foreground"})})}),(0,n.jsx)(D._v,{className:"max-w-xs",children:"Declarado es lo que el cliente dijo al pedir la cancelaci\xf3n. Verificado es el diagn\xf3stico de la o
1peradora despu\xe9s de hablar con \xe9l. Efectivo usa el verificado y cae al declarado cuando no se verific\xf3."})]})})]}),(0,n.jsx)(S.mQ,{value:i,onValueChange:e=>{isReasonView(e)&&u(e)},children:(0,n.jsx)(S.dr,{children:Z.GP.map(e=>(0,n.jsx)(S.SP,{value:e,children:A[e]},e))})})]})]}),l&&(0,n.jsxs)("p",{className:"text-xs text-admin-muted-foreground",children:["Comparando contra ",l]})]})}var T=a(20085);let formatRate=e=>null==e?"-":"".concat(e,"%"),formatCount=e=>null==e?"-":String(e),resolvedOf=e=>e.retained+e.cancelled;function ClaimsImpactSection(e){var t;let{claimsImpact:a,isLoading:i}=e,{coverage:r,paid_total_clp:l,signals:d,with_paid_claim:o,without_paid_claim:c}=a,u=(0,s.useMemo)(()=>r.map(e=>({coverage:e.label,paid_amount_clp:e.paid_amount_clp})),[r]),m=(0,s.useMemo)(()=>r.reduce((e,t)=>e+t.paid_claims_count,0),[r]),h=Math.round(100*d.loss_ratio_threshold),f=null===d.both_count||void 0===d.both_count,p=[{key:"with",label:"Con siniestro pagado",split:o},{key:"without",label:"Sin siniestro pagado",split:c}];return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg text-admin-foreground",children:"Siniestralidad: uso del seguro antes de cancelar"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Cohorte por fecha de solicitud, desenlace a hoy"})]}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(x.R,{title:"Siniestros pagados",value:(0,N.TU)(l),subtitle:"total hist\xf3rico de las p\xf3lizas de la cohorte"}),(0,n.jsx)(x.R,{title:"Con siniestro pagado",value:String(o.requests),subtitle:"retenci\xf3n ".concat(formatRate(o.retention_rate)," sobre ").concat(resolvedOf(o)," resueltas")}),(0,n.jsx)(x.R,{title:"Sin siniestro pagado",value:String(c.requests),subtitle:"retenci\xf3n ".concat(formatRate(c.retention_rate)," sobre ").concat(resolvedOf(c)," resueltas")}),(0,n.jsx)(x.R,{title:"Patr\xf3n uso y fuga",value:formatCount(d.both_count),variant:!f&&(null!==(t=d.both_count)&&void 0!==t?t:0)>0?"warning":"default",subtitle:f?"UF no disponible":"pago ≤ ".concat(d.recent_window_days," d\xedas antes y pagos ≥ ").concat(h,"% de la prima anual")})]}),(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-3",children:[(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)(_.A,{title:"Monto pagado por cobertura",subtitle:"Total hist\xf3rico de las p\xf3lizas de la cohorte: ".concat(m," pagos"),data:u,series:[{color:"rgb(59, 130, 246)",key:"paid_amount_clp",name:"Monto pagado"}],xAxisKey:"coverage",formatTooltipValue:(e,t)=>(0,N.TU)(t),isLoading:i})}),(0,n.jsx)(BreakdownCard,{title:"Se\xf1ales de uso y fuga",value:String(o.requests),subtitle:"Solicitudes de la cohorte con al menos un siniestro pagado",items:[{label:"Pago ≤ ".concat(d.recent_window_days," d\xedas antes de la solicitud"),value:String(d.recent_paid_count)},{label:"Pagos ≥ ".concat(h,"% de la prima anual"),value:formatCount(d.high_loss_ratio_count)},{label:"Ambas se\xf1ales",value:formatCount(d.both_count)}]})]}),(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h3",{className:"text-sm text-admin-foreground mb-0.5",children:"Retenci\xf3n seg\xfan uso del seguro"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Las abiertas quedan fuera del denominador de la retenci\xf3n, as\xed que esta tasa no es comparable con la de los KPIs"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Las desistidas por el cliente no se cuentan en estas columnas, as\xed que las filas no suman las solicitudes creadas"})]}),(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(T.iA,{children:[(0,n.jsx)(T.xD,{children:(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.ss,{className:"text-admin-muted-foreground",children:"Grupo"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Solicitudes"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Retenidas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Canceladas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Abiertas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Retenci\xf3n"})]})}),(0,n.jsx)(T.RM,{children:p.map(e=>(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.pj,{className:"text-admin-foreground",children:e.label}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.split.requests}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.split.retained}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.split.cancelled}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.split.open}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:formatRate(e.split.retention_rate)})]},e.key))})]})})]})]})}var L=a(7313),K=a(10763);let I=(0,K.Z)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),Q=(0,K.Z)("coins",[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",ke
1y:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]);var F=a(25987);let V=["retention-roi","retention-real-cost"],E={destructive:"bg-admin-error/5 border-admin-error/20",info:"bg-admin-card border-admin-border",success:"bg-admin-success/5 border-admin-success/20",warning:"bg-admin-warning/5 border-admin-warning/20"},X={destructive:"text-admin-error",info:"text-admin-primary",success:"text-admin-success",warning:"text-admin-warning"},toPercent=e=>Math.round(100*e),z={destructive:L.Z,info:I,success:f.Z,warning:L.Z};function InsightsPanel(e){let{analytics:t}=e,a=(0,s.useMemo)(()=>(function(e){let t=[],{claims_impact:a,kpis:n,reason_matrix:s,reasons:i,retention_actions:r,retention_economics:l,tenure:d,uf_value:o,verification:c}=e,u=i.reduce((e,t)=>e+t.total_created,0),m=i.reduce((e,t)=>null===e||t.total_created>e.total_created?t:e,null);if(m&&u>0){let e=m.total_created/u;e>=.2&&t.push({id:"dominant-reason",text:'"'.concat(m.reason_label,'" es el motivo dominante: ').concat(toPercent(e),"% de las solicitudes del per\xedodo."),tone:"info"})}let x=i.filter(e=>null!==e.retention_rate&&void 0!==e.retention_rate&&e.retained+e.cancelled>=10).reduce((e,t)=>{var a,n;return null===e||(null!==(a=t.retention_rate)&&void 0!==a?a:0)<(null!==(n=e.retention_rate)&&void 0!==n?n:0)?t:e},null);x&&t.push({id:"worst-retention-reason",text:'"'.concat(x.reason_label,'" es el motivo con peor retenci\xf3n: ').concat(x.retention_rate,"% sobre ").concat(x.retained+x.cancelled," resueltas."),tone:"warning"});let _=r.filter(e=>null!==e.effectiveness&&void 0!==e.effectiveness&&e.retained+e.cancelled_anyway>=5).reduce((e,t)=>{var a,n;return null===e||(null!==(a=t.effectiveness)&&void 0!==a?a:0)>(null!==(n=e.effectiveness)&&void 0!==n?n:0)?t:e},null);_&&t.push({id:"best-action",text:'"'.concat(_.action_label,'" es la acci\xf3n m\xe1s efectiva: retiene el ').concat(_.effectiveness,"% (").concat(_.retained,"/").concat(_.retained+_.cancelled_anyway,")."),tone:"success"});let h=s.filter(e=>e.declared_option_id!==e.verified_option_id&&e.count>=5).reduce((e,t)=>null===e||t.count>e.count?t:e,null);h&&t.push({id:"top-mismatch",text:'Los clientes que declaran "'.concat(h.declared_label,'" terminan verificados como "').concat(h.verified_label,'" en ').concat(h.count," casos."),tone:"warning"});let f=n.current.requests_resolved;if(f>=10){let e=c.unverified_resolved_count/f;e>.3?t.push({id:"verification-behind",text:"".concat(toPercent(e),"% de las resueltas se cerraron sin verificar el motivo: la reporter\xeda se est\xe1 construyendo sobre lo que el cliente dijo, no sobre el diagn\xf3stico."),tone:"destructive"}):t.push({id:"verification-on-track",text:"La verificaci\xf3n de motivos est\xe1 al d\xeda: solo ".concat(toPercent(e),"% de las resueltas qued\xf3 sin diagn\xf3stico."),tone:"success"})}let p=n.current.retention_spend_clp;if(p>0&&o){let e=n.current.premium_retained_annual_uf*o;t.push({id:"retention-roi",text:"Por cada $".concat((0,N.T4)(1e3)," gastados en retenci\xf3n se retuvieron $").concat((0,N.T4)(Math.round(e/p*1e3))," de prima anual."),tone:"info"})}let g=a.with_paid_claim,v=a.without_paid_claim,j=g.retention_rate,b=v.retention_rate;if(null!=j&&null!=b&&g.retained+g.cancelled>=10&&v.retained+v.cancelled>=10){let e=Math.round((b-j)*10)/10;e>=10&&t.push({id:"claims-retention-gap",text:"Los clientes que cobraron siniestro se retienen ".concat(e," pts menos (").concat(j,"% vs ").concat(b,"%)."),tone:"warning"})}let y=a.signals.both_count;null!=y&&y>=3&&t.push({id:"use-and-leave",text:"".concat(y," solicitudes muestran el patr\xf3n uso y fuga: siniestro pagado ≤ ").concat(a.signals.recent_window_days," d\xedas antes de pedir la baja y pagos ≥ ").concat(toPercent(a.signals.loss_ratio_threshold),"% de la prima anual."),tone:"destructive"});let R=d.buckets.find(e=>"lt_6m"===e.bucket),Z=R?R.retained+R.cancelled:0,w=null==R?void 0:R.retention_rate;if(null!=w&&Z>=5){let e=Math.round((n.current.retention_rate-w)*10)/10;e>=10&&t.push({id:"tenure-early-churn",text:"Los clientes con menos de 6 meses se retienen ".concat(e," pts menos que el promedio (").concat(w,"% vs ").concat(n.current.retention_rate,"%) sobre ").concat(Z," resueltas."),tone:"warning"})}let k=l.total_retention_cost_clp,q=l.net_premium_retained_annual_uf;if(null!=k&&q>0&&o){let e=q*o,a=k/e;t.push({id:"retention-real-cost",text:"Retener cost\xf3 $".concat((0,N.T4)(k)," entre prima cedida y gasto directo, frente a $").concat((0,N.T4)(Math.round(e))," de prima neta retenida al a\xf1o (").concat(toPercent(a),"%)."),tone:a>.5?"warning":"info"})}return t})(t),[t]);return 0===a.length?null:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("h2",{className:"text-lg text-admin-foreground",children:"Hallazgos del per\xedodo"}),(0,n.jsx)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:a.map(e=>{let t=V.includes(e.id)?Q:z[e.tone];return(0,n.jsxs)("div",{className:(0,F.cn)("border rounded-xl p-5 flex gap-3",E[e.tone]),children:[(0,n.jsx)(t,{className:(0,F.cn)("h-5 w-5 shrink-0 mt-0.5",X[e.tone])}),(0,n.jsx)("p",{className:"text-sm text-admin-foreground",children:e.text})]},e.id)})})]})}var U=a(90708),B=a(80762);let buildColumns=()=>[{accessorKey:"reason_label",header:e=>{let{column:t}=e;return(0,n.jsx)(B.v9,{column:t,children:"Motivo"})},cell:e=>{let{row:t}=e;return(0,n.jsx)("span",{className:"text-admin-foreground",children:t.original.reason_label})}},{accessorKey:"total_created",header:e=>{let{column:t}=e;return(0,n.jsx)(B.v9,{column:t,className:"justify-end",children:"Solicitudes"})},cell:e=>{let{row:t}=e;return(0,n.jsx)("div",{className:"text-right text-admin-foreground",children:t.original.total_created})}
1,meta:{cellClassName:"text-right",headerClassName:"text-right"}},{accessorKey:"retained",header:e=>{let{column:t}=e;return(0,n.jsx)(B.v9,{column:t,className:"justify-end",children:"Retenidas"})},cell:e=>{let{row:t}=e;return(0,n.jsx)("div",{className:"text-right text-admin-foreground",children:t.original.retained})},meta:{cellClassName:"text-right",headerClassName:"text-right"}},{accessorKey:"cancelled",header:e=>{let{column:t}=e;return(0,n.jsx)(B.v9,{column:t,className:"justify-end",children:"Canceladas"})},cell:e=>{let{row:t}=e;return(0,n.jsx)("div",{className:"text-right text-admin-foreground",children:t.original.cancelled})},meta:{cellClassName:"text-right",headerClassName:"text-right"}},{accessorKey:"retention_rate",header:e=>{let{column:t}=e;return(0,n.jsx)(B.v9,{column:t,children:"Tasa de retenci\xf3n"})},cell:e=>{let{row:t}=e,a=t.original.retention_rate;return(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-[7rem]",children:[(0,n.jsx)("span",{className:"h-1.5 flex-1 rounded-full bg-admin-muted",children:(0,n.jsx)("span",{className:"block h-1.5 rounded-full bg-admin-primary",style:{width:"".concat(Math.min(null!=a?a:0,100),"%")}})}),(0,n.jsx)("span",{className:"text-xs text-admin-muted-foreground w-12 text-right",children:formatRate(a)})]})}},{accessorKey:"premium_lost_annual_uf",header:e=>{let{column:t}=e;return(0,n.jsx)(B.v9,{column:t,className:"justify-end",children:"Prima perdida (UF)"})},cell:e=>{let{row:t}=e;return(0,n.jsx)("div",{className:"text-right text-admin-foreground",children:t.original.premium_lost_annual_uf})},meta:{cellClassName:"text-right",headerClassName:"text-right"}},{id:"actions",header:"",cell:e=>{let{row:t}=e,a=t.original.reason_option_id;return null==a?null:(0,n.jsxs)(u(),{href:{pathname:"/admin/support/cancellation-requests",query:{tab:"all",reason:String(a)}},className:"flex items-center gap-1 text-xs text-admin-primary hover:underline",children:["Ver en inbox",(0,n.jsx)(U.Z,{className:"h-3 w-3"})]})}}];function ReasonBreakdownTable(e){let{reasons:t,isLoading:a}=e,i=(0,s.useMemo)(()=>buildColumns(),[]);return(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-sm text-admin-foreground mb-0.5",children:"Detalle por motivo"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Solicitudes por fecha de solicitud; retenidas y canceladas por fecha de resoluci\xf3n"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Las desistidas por el cliente no se cuentan en estas columnas, as\xed que las filas no suman las solicitudes creadas"})]}),(0,n.jsx)(B.wQ,{columns:i,data:t,isLoading:a,getRowId:e=>{var t;return String(null!==(t=e.reason_option_id)&&void 0!==t?t:"unclassified")},emptyMessage:"No hay motivos registrados en el per\xedodo"})]})}let declaredKey=e=>null===e.declared_option_id||void 0===e.declared_option_id?"unclassified":String(e.declared_option_id),intensityClass=(e,t)=>{if(0===e||0===t)return"";let a=e/t;return a>.75?"bg-admin-primary/40":a>.5?"bg-admin-primary/30":a>.25?"bg-admin-primary/20":"bg-admin-primary/10"};function ReasonMatrixTable(e){let{cells:t}=e,{columns:a,counts:i,maxCount:r,rows:l}=(0,s.useMemo)(()=>{let e=new Map,a=new Map,n=new Map;return t.forEach(t=>{e.set(declaredKey(t),t.declared_label),a.set(t.verified_option_id,t.verified_label),n.set("".concat(declaredKey(t),":").concat(t.verified_option_id),t.count)}),{columns:Array.from(a.entries()).map(e=>{let[t,a]=e;return{id:t,label:a}}),counts:n,maxCount:t.reduce((e,t)=>Math.max(e,t.count),0),rows:Array.from(e.entries()).map(e=>{let[t,a]=e;return{key:t,label:a}})}},[t]);return 0===l.length?(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsx)("h2",{className:"text-sm text-admin-foreground mb-0.5",children:"Declarado vs verificado"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"No hay solicitudes con motivo verificado en el per\xedodo"})]}):(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-sm text-admin-foreground mb-0.5",children:"Declarado vs verificado"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Filas: lo que el cliente declar\xf3. Columnas: lo que la operadora verific\xf3. La diagonal son los casos alineados"})]}),(0,n.jsx)(D.pn,{children:(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(T.iA,{children:[(0,n.jsx)(T.xD,{children:(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.ss,{className:"text-admin-muted-foreground",children:"Declarado \\ Verificado"}),a.map(e=>(0,n.jsx)(T.ss,{className:"text-center text-admin-muted-foreground whitespace-nowrap",children:e.label},e.id))]})}),(0,n.jsx)(T.RM,{children:l.map(e=>(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.pj,{className:"text-admin-foreground whitespace-nowrap",children:e.label}),a.map(t=>{var a;let s=null!==(a=i.get("".concat(e.key,":").concat(t.id)))&&void 0!==a?a:0,l=e.key===String(t.id);return 0===s?(0,n.jsx)(T.pj,{className:"text-center text-admin-muted-foreground",children:"-"},t.id):(0,n.jsx)(T.pj,{className:(0,F.cn)("text-center text-admin-foreground",intensityClass(s,r),l&&"ring-1 ring-inset ring-admin-primary"),children:l?s:(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsx)("span",{className:"cursor-help",children:s})}),(0,n.jsx)(D._v,{className:"max-w-xs",children:"".concat(s,' declararon "').concat(e.label,'" y en realidad eran "').concat(t.label,'"')})]})},t.id)})]},e.key))})]})})})]})}function RetentionEconomicsSection(e){let{economics:t,ufValue:a}=e,{net_premium_retained_annual_uf:s,overdue_cancelled:i,overdue_retained:r,premium_ceded_annual_uf:l,retained_with_plan_change:d,retention_spend_clp:o,total_retention_cost_clp:c}=t,u=a?Math.round(s*a):null;return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg text-admin-foreground",children:"Econom\xeda de la retenci\xf3n"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Cu\xe1nto se resigna de prima para quedarse con el cliente, sobre las solicitudes resueltas del per\xedodo"})]}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsx)(x.R,{title:"Prima cedida en retenciones",value:(0,N.yK)(l),variant:l>0?"warning":"default",subtitle:a?"≈ ".concat((0,N.TU)(Math.round(l*a))," al a\xf1o"):"anual, por cambios de plan a la baja"}),(0,n.jsx)(x.R,{title:"Prima retenida neta",value:(0,N.yK)(s),variant:"success",subtitle:null===u?"prima retenida menos la prima cedida":"≈ ".concat((0,N.TU)(u)," al a\xf1o")}),(0,n.jsx)(x.R,{title:"Costo total de retenci\xf3n",value:(0,N.TU)(c),subtitle:null==c?"UF n
1o disponible para valorizar la prima cedida":"incluye ".concat((0,N.TU)(o)," invertidos y la prima cedida")}),(0,n.jsx)(x.R,{title:"Retenidas con cambio de plan",value:String(d),subtitle:"se quedaron bajando su cobertura o su prima"})]}),(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h3",{className:"text-sm text-admin-foreground mb-0.5",children:"Deuda vencida al momento de la solicitud"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Cuotas impagas de las p\xf3lizas de la cohorte, seg\xfan el desenlace de la solicitud"})]}),(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(T.iA,{children:[(0,n.jsx)(T.xD,{children:(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.ss,{className:"text-admin-muted-foreground",children:"Desenlace"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Solicitudes con deuda"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Cuotas vencidas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Monto"})]})}),(0,n.jsx)(T.RM,{children:[{key:"retained",label:"Retenidas",split:r},{key:"cancelled",label:"Canceladas",split:i}].map(e=>(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.pj,{className:"text-admin-foreground",children:e.label}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.split.requests_with_overdue}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.split.overdue_invoices_count}),(0,n.jsxs)(T.pj,{className:"text-right text-admin-foreground",children:[(0,n.jsx)("div",{children:(0,N.yK)(e.split.overdue_amount_uf)}),null===e.split.overdue_amount_clp||void 0===e.split.overdue_amount_clp?null:(0,n.jsxs)("div",{className:"text-xs text-admin-muted-foreground",children:["≈ ",(0,N.TU)(e.split.overdue_amount_clp)]})]})]},e.key))})]})})]})]})}function RetentionEffectivenessSection(e){let{retentionActions:t,retentionReasons:a,isLoading:i}=e,r=(0,s.useMemo)(()=>t.map(e=>({action:e.action_label,offers:e.offers,retained:e.retained})),[t]),l=(0,s.useMemo)(()=>a.reduce((e,t)=>e+t.count,0),[a]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("h2",{className:"text-lg text-admin-foreground",children:"Retenci\xf3n: qu\xe9 funciona y cu\xe1nto cuesta"}),(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-3",children:[(0,n.jsx)("div",{className:"lg:col-span-2",children:i||0!==t.length?(0,n.jsx)(_.A,{title:"Ofertas de retenci\xf3n y su resultado",subtitle:"Por acci\xf3n registrada, en solicitudes resueltas por fecha de resoluci\xf3n",data:r,series:[{color:"rgb(163, 163, 163)",key:"offers",name:"Ofertas"},{color:"rgb(20, 184, 166)",key:"retained",name:"Retenidas"}],xAxisKey:"action",isLoading:i}):(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5 flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-sm text-admin-foreground mb-0.5",children:"Ofertas de retenci\xf3n y su resultado"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Por acci\xf3n registrada, en solicitudes resueltas por fecha de resoluci\xf3n"})]}),(0,n.jsx)("div",{className:"flex flex-1 items-center justify-center px-6 text-center text-xs text-admin-muted-foreground",children:'A\xfan no hay gestiones de retenci\xf3n registradas en este per\xedodo. Se registran desde el detalle de cada solicitud, en "Forma de gesti\xf3n"; el gr\xe1fico se llena a medida que las operadoras las registren.'})]})}),(0,n.jsx)(BreakdownCard,{title:"\xbfPor qu\xe9 se quedaron?",value:String(l),subtitle:"Raz\xf3n de permanencia registrada al retener",items:a.map(e=>({label:e.reason_label,value:String(e.count)}))})]}),(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h3",{className:"text-sm text-admin-foreground mb-0.5",children:"Efectividad por acci\xf3n"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Se registra la \xfaltima acci\xf3n ofrecida, as\xed que la efectividad mide la \xfaltima oferta antes del desenlace"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Las desistidas por el cliente no se cuentan en estas columnas, as\xed que las filas no suman las solicitudes creadas"})]}),(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(T.iA,{children:[(0,n.jsx)(T.xD,{children:(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.ss,{className:"text-admin-muted-foreground",children:"Acci\xf3n"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Ofertas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Retenidas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Canceladas igual"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Abiertas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Efectividad"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Costo total"})]})}),(0,n.jsx)(T.RM,{children:0===t.length?(0,n.jsx)(T.SC,{children:(0,n.jsx)(T.pj,{colSpan:7,className:"text-center text-admin-muted-foreground",children:"No hay acciones de retenci\xf3n registradas en el per\xedodo"})}):t.map(e=>(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.pj,{className:"text-admin-foreground",children:e.action_label}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.offers}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.retained}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.cancelled_anyway}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.still_open}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:formatRate(e.effectiveness)}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:"$".concat((0,N.T4)(e.total_spend_clp))})]}
1,e.action_type_id))})]})})]})]})}let $="unknown",formatMonths=e=>{if(null==e)return"—";let t=Math.round(10*e)/10;if(t<12)return"".concat(t," ").concat(1===t?"mes":"meses");let a=Math.floor(t/12),n=Math.round(t-12*a),s="".concat(a," ").concat(1===a?"a\xf1o":"a\xf1os");return 0===n?s:"".concat(s," y ").concat(n," ").concat(1===n?"mes":"meses")},hasData=e=>e.total_created>0||e.premium_lost_annual_uf>0;function TenureSection(e){let{tenure:t,ufValue:a,isLoading:i}=e,{avg_tenure_months_cancelled:r,avg_tenure_months_retained:l,buckets:d}=t,o=(0,s.useMemo)(()=>d.filter(e=>e.bucket!==$||hasData(e)),[d]),c=(0,s.useMemo)(()=>d.filter(e=>e.bucket!==$||hasData(e)).map(e=>{var t;return{retention_rate:null!==(t=e.retention_rate)&&void 0!==t?t:0,tenure:e.label}}),[d]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg text-admin-foreground",children:"Antig\xfcedad del cliente"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Meses desde la primera p\xf3liza hasta la fecha de la solicitud"})]}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,n.jsx)(x.R,{title:"Antig\xfcedad promedio (retenidas)",value:formatMonths(l),subtitle:"clientes que se quedaron",variant:"success"}),(0,n.jsx)(x.R,{title:"Antig\xfcedad promedio (canceladas)",value:formatMonths(r),subtitle:"clientes que se fueron",variant:"destructive"})]}),(0,n.jsx)(_.A,{title:"Tasa de retenci\xf3n por antig\xfcedad",subtitle:"Sobre las solicitudes resueltas de cada tramo",data:c,series:[{color:"rgb(20, 184, 166)",key:"retention_rate",name:"Tasa de retenci\xf3n"}],xAxisKey:"tenure",formatTooltipValue:(e,t)=>"".concat(t,"%"),isLoading:i}),(0,n.jsxs)("div",{className:"bg-admin-card border border-admin-border rounded-xl p-5",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h3",{className:"text-sm text-admin-foreground mb-0.5",children:"Detalle por tramo de antig\xfcedad"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Las abiertas quedan fuera del denominador de la tasa de retenci\xf3n"}),(0,n.jsx)("p",{className:"text-xs text-admin-muted-foreground",children:"Las desistidas por el cliente no se cuentan en estas columnas, as\xed que las filas no suman las solicitudes creadas"})]}),(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(T.iA,{children:[(0,n.jsx)(T.xD,{children:(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.ss,{className:"text-admin-muted-foreground",children:"Antig\xfcedad"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Solicitudes"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Retenidas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Canceladas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Abiertas"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Tasa de retenci\xf3n"}),(0,n.jsx)(T.ss,{className:"text-right text-admin-muted-foreground",children:"Prima perdida"})]})}),(0,n.jsx)(T.RM,{children:0===o.length?(0,n.jsx)(T.SC,{children:(0,n.jsx)(T.pj,{colSpan:7,className:"text-center text-admin-muted-foreground",children:"No hay solicitudes en el per\xedodo"})}):o.map(e=>(0,n.jsxs)(T.SC,{children:[(0,n.jsx)(T.pj,{className:"text-admin-foreground",children:e.label}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.total_created}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.retained}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.cancelled}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:e.open}),(0,n.jsx)(T.pj,{className:"text-right text-admin-foreground",children:formatRate(e.retention_rate)}),(0,n.jsxs)(T.pj,{className:"text-right text-admin-foreground",children:[(0,n.jsx)("div",{children:(0,N.yK)(e.premium_lost_annual_uf)}),a?(0,n.jsxs)("div",{className:"text-xs text-admin-muted-foreground",children:["≈ ",(0,N.TU)(Math.round(e.premium_lost_annual_uf*a))]}):null]})]},e.bucket))})]})})]})]})}let H="/admin/support/cancellation-requests",G={declared:"vista: declarado por el cliente",effective:"vista: efectivo (verificado con fallback al declarado)",verified:"vista: verificado por la operadora"},CancellationAnalyticsDashboard_isDatePreset=e=>P.some(t=>t===e),CancellationAnalyticsDashboard_isReasonView=e=>
1Z.GP.some(t=>t===e),isPlainDate=e=>/^\d{4}-\d{2}-\d{2}$/.test(e),rangeForPreset=e=>{let t=Number("custom"===e?"90":e),a=(0,y.YM)();return{from:(0,y.eW)(a,-(t-1)),to:a}},percentDelta=(e,t)=>0===t?0===e?0:100:Math.round((e-t)/t*1e3)/10,pointsDelta=(e,t)=>Math.round((e-t)*10)/10,bucketLabel=(e,t)=>"month"===t?(0,y.Pb)(e):(0,y.p6)(e);function CancellationAnalyticsDashboard(){var e;let t=(0,o.useRouter)(),a=(0,s.useRef)(!1),i=(0,s.useMemo)(()=>rangeForPreset("90"),[]),[r,l]=(0,s.useState)("90"),[d,c]=(0,s.useState)(i.from),[f,p]=(0,s.useState)(i.to),[g,v]=(0,s.useState)("effective"),[Z,w]=(0,s.useState)("all");(0,s.useEffect)(()=>{if(!t.isReady||a.current)return;let{from:e,preset:n,reason:s,to:i,view:r}=t.query;if("string"==typeof n&&CancellationAnalyticsDashboard_isDatePreset(n)&&(l(n),"custom"!==n)){let e=rangeForPreset(n);c(e.from),p(e.to)}"string"==typeof e&&isPlainDate(e)&&c(e),"string"==typeof i&&isPlainDate(i)&&p(i),"string"==typeof r&&CancellationAnalyticsDashboard_isReasonView(r)&&v(r),"string"==typeof s&&w(s),a.current=!0},[t.isReady,t.query]),(0,s.useEffect)(()=>{if(!t.isReady||!a.current)return;let e={from:d,preset:r,to:f,view:g};"all"!==Z&&(e.reason=Z);let n={};Object.entries(t.query).forEach(e=>{let[t,a]=e;"string"==typeof a&&(n[t]=a)});let s=Object.keys(e).length!==Object.keys(n).length||Object.keys(e).some(t=>e[t]!==n[t]);s&&t.replace({pathname:t.pathname,query:e},void 0,{shallow:!0})},[d,f,r,Z,g,t]);let k=(0,s.useCallback)(e=>{if(l(e),"custom"===e)return;let t=rangeForPreset(e);c(t.from),p(t.to)},[]),q=(0,s.useMemo)(()=>({date_from:d,date_to:f,reason_view:g,..."all"!==Z?{reason_option_id:Number(Z)}:{}}),[d,f,Z,g]),{data:C,error:S,isError:D,isFetching:M,isLoading:P,refetch:O}=(0,R.HK)(q),A=C?"".concat((0,y.p6)(C.kpis.previous_date_from)," – ").concat((0,y.p6)(C.kpis.previous_date_to)):null,T=(0,s.useMemo)(()=>{var e;return(null!==(e=null==C?void 0:C.time_series)&&void 0!==e?e:[]).map(e=>{var t;return{bucket:bucketLabel(e.bucket,null!==(t=null==C?void 0:C.granularity)&&void 0!==t?t:"day"),cancelled:e.cancelled,created:e.created,retained:e.retained,withdrawn:e.withdrawn}})},[null==C?void 0:C.granularity,null==C?void 0:C.time_series]),L=(0,s.useMemo)(()=>{var e;return(null!==(e=null==C?void 0:C.reasons)&&void 0!==e?e:[]).reduce((e,t)=>e+t.total_created,0)},[null==C?void 0:C.reasons]);return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-2xl font-bold text-admin-foreground",children:"Anal\xedtica de cancelaciones"}),(0,n.jsx)("p",{className:"text-admin-muted-foreground",children:"Volumen, motivos y efectividad de retenci\xf3n sobre las solicitudes de cancelaci\xf3n"})]}),(0,n.jsx)(u(),{href:H,children:(0,n.jsxs)(j.z,{variant:"outline",className:"flex items-center gap-2",children:[(0,n.jsx)(m.Z,{className:"h-4 w-4"}),"Volver al inbox"]})})]}
1),(0,n.jsx)(AnalyticsFilters,{preset:r,dateFrom:d,dateTo:f,reasonView:g,reasonOptionId:Z,comparisonLabel:A,onPresetChange:k,onDateFromChange:c,onDateToChange:p,onReasonViewChange:v,onReasonOptionChange:w}),(0,n.jsx)(b.o,{isLoading:P,isError:D,error:S,refetch:()=>{O()},data:C,children:C&&(0,n.jsxs)("div",{className:"space-y-8",children:[(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[(0,n.jsx)(x.R,{title:"Solicitudes creadas",value:String(C.kpis.current.requests_created),trend:{label:"por fecha de solicitud, vs per\xedodo anterior",value:percentDelta(C.kpis.current.requests_created,C.kpis.previous.requests_created)}}),(0,n.jsx)(x.R,{title:"Resueltas",value:String(C.kpis.current.requests_resolved),trend:{label:"".concat(C.kpis.current.requests_retained," retenidas + ").concat(C.kpis.current.requests_withdrawn," desistidas + ").concat(C.kpis.current.requests_cancelled," canceladas"),value:percentDelta(C.kpis.current.requests_resolved,C.kpis.previous.requests_resolved)}}),(0,n.jsx)(x.R,{title:"Desistidas por el cliente",value:String(C.kpis.current.requests_withdrawn),subtitle:"el cliente anul\xf3 su solicitud sin gesti\xf3n del equipo",trend:{label:"vs per\xedodo anterior, fuera de la tasa de retenci\xf3n",value:percentDelta(C.kpis.current.requests_withdrawn,C.kpis.previous.requests_withdrawn)}}),(0,n.jsx)(x.R,{title:"Tasa de retenci\xf3n",value:"".concat(C.kpis.current.retention_rate,"%"),subtitle:"retenidas sobre retenidas + canceladas",variant:C.kpis.current.retention_rate>=C.kpis.previous.retention_rate?"success":"warning",trend:{label:"puntos porcentuales vs per\xedodo anterior",value:pointsDelta(C.kpis.current.retention_rate,C.kpis.previous.retention_rate)}}),(0,n.jsx)(x.R,{title:"Prima retenida",value:(0,N.yK)(C.kpis.current.premium_retained_annual_uf),variant:"success",trend:{label:C.uf_value?"≈ ".concat((0,N.TU)(Math.round(C.kpis.current.premium_retained_annual_uf*C.uf_value))," al a\xf1o"):"anual, vs per\xedodo anterior",value:percentDelta(C.kpis.current.premium_retained_annual_uf,C.kpis.previous.premium_retained_annual_uf)}}),(0,n.jsx)(x.R,{title:"Prima perdida",value:(0,N.yK)(C.kpis.current.premium_lost_annual_uf),variant:"destructive",trend:{label:C.uf_value?"≈ ".concat((0,N.TU)(Math.round(C.kpis.current.premium_lost_annual_uf*C.uf_value))," al a\xf1o"):"anual, vs per\xedodo anterior",value:percentDelta(C.kpis.current.premium_lost_annual_uf,C.kpis.previous.premium_lost_annual_uf)}}),(0,n.jsx)(x.R,{title:"Costo de retenci\xf3n",value:(0,N.TU)(C.kpis.current.retention_spend_clp),trend:{label:null===C.kpis.current.avg_retention_spend_clp||void 0===C.kpis.current.avg_retention_spend_clp?"sin gasto registrado por retenida":"promedio ".concat((0,N.TU)(C.kpis.current.avg_retention_spend_clp)," por retenida"),value:percentDelta(C.kpis.current.retention_spend_clp,C.kpis.previous.retention_spend_clp)}})]}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,n.jsx)(x.R,{title:"Tiempo medio de resoluci\xf3n",value:"".concat(C.kpis.current.avg_resolution_hours," h"),trend:{label:"desde la solicitud hasta el cierre",value:percentDelta(C.kpis.current.avg_resolution_hours,C.kpis.previous.avg_resolution_hours)}}),(0,n.jsx)(x.R,{title:"Pendientes de verificar motivo",value:String(C.verification.pending_reason_verification),subtitle:"solicitudes abiertas sin diagn\xf3stico, snapshot actual",variant:C.verification.pending_reason_verification>0?"warning":"default",onClick:()=>{t.push({pathname:H,query:{tab:"all",verified:"false"}})}})]})]}),(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsx)(_.A,{title:"Resultado de las resueltas",subtitle:"Por fecha de resoluci\xf3n",data:T,series:[{color:"rgb(20, 184, 166)",key:"retained",name:"Retenidas"},{color:"rgb(148, 163, 184)",key:"withdrawn",name:"Desistidas"},{color:"rgb(236, 72, 153)",key:"cancelled",name:"Canceladas"}],xAxisKey:"bucket",stacked:!0,isLoading:M}),(0,n.jsx)(h.q,{title:"Solicitudes creadas",subtitle:"Por fecha de solicitud",data:T,series:[{color:"rgb(59, 130, 246)",key:"created",
1name:"Solicitudes creadas"}],xAxisKey:"bucket",isLoading:M})]}),(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-3",children:[(0,n.jsx)(BreakdownCard,{title:"Motivos de cancelaci\xf3n",value:String(L),subtitle:G[g],items:C.reasons.slice(0,5).map(e=>({label:e.reason_label,value:String(e.total_created)}))}),(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)(ReasonBreakdownTable,{reasons:C.reasons,isLoading:M})})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("h2",{className:"text-lg text-admin-foreground",children:"Lo que el cliente dice vs lo que realmente pasa"}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-4",children:[(0,n.jsx)(x.R,{title:"Verificadas en el per\xedodo",value:String(C.verification.verified_count),subtitle:"con diagn\xf3stico de la operadora"}),(0,n.jsx)(x.R,{title:"Verificadas sin motivo declarado",value:String(C.verification.verified_without_declared_count),subtitle:"no entran en la desalineaci\xf3n: no hay con qu\xe9 comparar"}),(0,n.jsx)(x.R,{title:"Desalineaci\xf3n",value:null===C.verification.mismatch_rate||void 0===C.verification.mismatch_rate?"-":"".concat(C.verification.mismatch_rate,"%"),subtitle:"de las que declararon un motivo, cu\xe1ntas no coincidieron",variant:(null!==(e=C.verification.mismatch_rate)&&void 0!==e?e:0)>30?"warning":"default"}),(0,n.jsx)(x.R,{title:"Resueltas sin verificar",value:String(C.verification.unverified_resolved_count),subtitle:"cerradas sin diagn\xf3stico del motivo real",variant:C.kpis.current.requests_resolved>0&&C.verification.unverified_resolved_count/C.kpis.current.requests_resolved>.3?"destructive":"default"})]}),(0,n.jsx)(ReasonMatrixTable,{cells:C.reason_matrix})]}),(0,n.jsx)(TenureSection,{tenure:C.tenure,ufValue:C.uf_value,isLoading:M}),(0,n.jsx)(RetentionEffectivenessSection,{retentionActions:C.retention_actions,retentionReasons:C.retention_reasons,isLoading:M}),(0,n.jsx)(RetentionEconomicsSection,{economics:C.retention_economics,ufValue:C.uf_value}),(0,n.jsx)(ClaimsImpactSection,{claimsImpact:C.claims_impact,isLoading:M}),(0,n.jsx)(InsightsPanel,{analytics:C})]})})]})}var J=(0,l.Z)(()=>(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(r(),{children:(0,n.jsx)("title",{children:"Anal\xedtica de Cancelaciones | Admin Cacttus"})}),(0,n.jsx)(CancellationAnalyticsDashboard,{})]}))},75262:function(e,t,a){"use strict";a.d(t,{rK:function(){return searchCancellationAssignees},HK:function(){return useCancellationAnalyticsQuery},i0:function(){return useCancellationRequestContextQuery},IY:function(){return useCancellationRequestQuery},Ze:function(){return useCancellationRequestTimelineQuery},Ee:function(){return useCancellationRequestsQuery},VA:function(){return useCancellationRequestsStatsQuery}});var n=a(7040),s=a(53538),i=a(44994),r=a(13346),l=a(67669),d=a(23466);let o=s.Ry({is_annual:s.O7(),deductible_uf:s.Rx(),used_uf:s.Rx(),remaining_uf:s.Rx(),used_percentage:s.Rx(),last_event_claim_id:s.Z_().nullish(),last_event_claim_number:s.Z_().nullish(),last_event_claim_date:s.Z_().nullish()}),c=s.Ry({limit_uf:s.Rx(),used_uf:s.Rx(),remaining_uf:s.Rx(),used_percentage:s.Rx()}),u=s.Ry({id:s.Z_(),document_number:s.Z_().nullish(),readable_id:s.Z_(),plan_name:s.Z_().nullish(),start_date:s.Z_().nullish(),end_date:s.Z_().nullish(),cancelled_at:s.Z_().nullish(),is_cancelled:s.O7(),was_cancelled_before_end_date:s.O7(),is_delinquent:s.O7(),installments_number:s.Rx().nullish(),annual_premium_uf:s.Rx().nullish(),annual_premium_clp:s.Rx().nullish(),monthly_premium_uf:s.Rx().nullish(),monthly_premium_clp:s.Rx().nullish(),paid_to_date_uf:s.Rx(),pet_name:s.Z_().nullish(),pet_species:s.Z_().nullish(),uf_value:s.Rx().nullish()}),m=s.Ry({package_name:s.Z_().nullish(),deductible_uf:s.Rx().nullish(),is_annual_deductible:s.O7(),amount_limit_uf:s.Rx().nullish(),amount_limit_per_event_uf:s.Rx().nullish(),percentage_covered:s.Rx().nullish(),has_accidents_coverage:s.O7(),has_illnesses_coverage:s.O7(),has_preventive_coverage:s.O7(),deductible_usage:o.nullish(),coverage_limit_usage:c.nullish()}),x=s.Ry({id:s.Z_(),claim_number:s.Z_().nullish(),event_date:s.Z_().nullish(),diagnosis:s.Z_().nullish(),status_key:s.Z_().nullish(),status_label:s.Z_().nullish(),is_open:s.O7(),is_paid:s.O7(),amount_covered_clp:s.Rx().nullish(),amount_covered_uf:s.Rx().nullish()}),_=s.Ry({id:s.Rx(),fee_payment_number:s.Rx().nullish(),due_date:s.Z_().nullish(),amount_uf:s.Rx().nullish(),amount_clp:s.Rx().nullish(),is_paid:s.O7(),is_overdue:s.O7(),payment_method:s.Z_().nullish()}),h=s.Ry({id:s.Rx().nullish(),first_name:s.Z_().nullish(),last_name:s.Z_().nullish(),email:s.Z_().nullish(),rut:s.Z_().nullish(),phone_with_prefix:s.Z_().nullish(),tenure_months:s.Rx().nullish(),tenure_months_at_request:s.Rx().nullish(),customer_since:s.Z_().nullish()}),f=s.Ry({overdue_invoices_count:s.Rx(),overdue_amount_uf:s.Rx(),overdue_amount_clp:s.Rx().nullish()}),p=s.Ry({source:s.Z_(),status:s.Z_(),previous_annual_premium_uf:s.Rx().nullish(),new_annual_premium_uf:s.Rx().nullish(),new_annual_premium_clp:s.Rx().nullish(),premium_delta_annual_uf:s.Rx().nullish(),premium_delta_annual_clp:s.Rx().nullish(),discount_rate:s.Rx().nullish()}),g=s.Ry({current_annual_premium_uf:s.Rx().nullish(),current_annual_premium_clp:s.Rx().nullish(),overdue:f,retention_offer:p.nullish(),retention_spend_clp:s.Rx().nullish(),first_year_retention_cost_clp:s.Rx().nullish()}),v=s.Ry({scheduled_at:s.Z_().nullish(),cancellation_date:s.Z_().nullish(),is_overdue:s.O7(),hours_remaining:s.Rx().nullish(),already_executed:s.O7(),original_scheduled_at:s.Z_().nullish(),min_scheduled_date:s.Z_().nullish(),max_scheduled_date:s.Z_().nullish()}),j=s.Ry({has_blocking_claim:s.O7(),blocking_claim_id:s.Z_().nullish(),blocking_claim_number:s.Z_().nullish(),renewal_blocked:s.O7(),renewal_end_date:s.Z_().nullish(),is_delinquent:s.O7(),is_assigned_to_other:s.O7(),assigned_to_name:s.Z_().nullish(),is_resolved:s.O7()}),b=s.Ry({policy:u,coverage:m,claims:s.IX(x),invoices:s.IX(_),customer:h,deadline:v,flags:j,retention_economics:g}),y=s.Ry({field:s.Z_(),field_label:s.Z_(),old_value:s.Z_().nullish(),new_value:s.Z_().nullish()}),R=s.Ry({id:s.Z_(),source:s.Z_(),kind:s.Z_(),timestamp:s.Z_(),actor_name:s.Z_().nullish(),actor_email:s.Z_().nullish(),summary:s.Z_(),changes:s.IX(y)}),N=s.Ry({entries:s.IX(R),total_entries:s.Rx().nullish(),truncated:s.O7().nullish()});var Z=a(10777);let useCancellationRequestsQuery=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{status_group:t,status_key:a,assigned_to_id:s,search:o,reason_option_id:c,tenure_bucket:u,verified:m,overdue:x,order_by:_,order_direction:h,page:f=1,page_size:p=20}=e;
1return(0,n.a)({queryKey:l.a.cancellationRequests.list({status_group:t,status_key:a,assigned_to_id:s,search:o,reason_option_id:c,tenure_bucket:u,verified:m,overdue:x,order_by:_,order_direction:h,page:f,page_size:p}),queryFn:async()=>{let e=new URLSearchParams({page:f.toString(),page_size:p.toString()});t&&e.append("status_group",t),a&&e.append("status_key",a),void 0!==s&&e.append("assigned_to_id",s.toString()),o&&e.append("search",o),void 0!==c&&e.append("reason_option_id",c.toString()),u&&e.append("tenure_bucket",u),void 0!==m&&e.append("verified",String(m)),void 0!==x&&e.append("overdue",String(x)),_&&e.append("order_by",_),h&&e.append("order_direction",h);let n="".concat(r.Z.admin.cancellationRequests.list(),"?").concat(e.toString()),l=await (0,i.h)(d.jg,{method:"get",url:n});return l.data},keepPreviousData:!0})},useCancellationRequestsStatsQuery=()=>(0,n.a)({queryKey:l.a.cancellationRequests.stats(),queryFn:async()=>{let e=await (0,i.h)(d.LB,{method:"get",url:r.Z.admin.cancellationRequests.stats()});return e.data}}),useCancellationAnalyticsQuery=e=>(0,n.a)({queryKey:l.a.cancellationRequests.analytics(e),queryFn:async()=>{let t=await (0,i.h)(Z.UH,{method:"get",params:e,url:r.Z.admin.cancellationRequests.analytics()});return t.data},keepPreviousData:!0}),useCancellationRequestQuery=e=>(0,n.a)({queryKey:l.a.cancellationRequests.detail(null!=e?e:0),queryFn:async()=>{let t=await (0,i.h)(d.L,{method:"get",url:r.Z.admin.cancellationRequests.detail(e)});return t.data},enabled:null!==e}),useCancellationRequestContextQuery=e=>(0,n.a)({queryKey:l.a.cancellationRequests.context(null!=e?e:0),queryFn:async()=>{let t=await (0,i.h)(b,{method:"get",url:r.Z.admin.cancellationRequests.context(e)});return t.data},enabled:null!==e}),useCancellationRequestTimelineQuery=(e,t)=>(0,n.a)({queryKey:l.a.cancellationRequests.timeline(null!=e?e:0),queryFn:async()=>{let t=await (0,i.h)(N,{method:"get",url:r.Z.admin.cancellationRequests.timeline(e)});return t.data},enabled:null!==e&&t}),w=s.Ry({id:s.Rx(),email:s.Z_(),name:s.Z_()}),searchCancellationAssignees=async e=>{if(e.length<2)return[];let t=await (0,i.h)(s.IX(w),{method:"get",params:{search:e,limit:10},url:r.Z.admin.cancellationRequests.assignees()});return t.data.map(e=>({...e,rut:null}))}},49530:function(e,t,a){"use strict";a.d(t,{$i:function(){return useCancellationReasonOptionsQuery},JY:function(){return useCancellationRequestStatusesQuery},Re:function(){return useRetentionActionTypesQuery},gg:function(){return useCancellationReasonCategoriesQuery},iH:function(){return useRetentionReasonOptionsQuery}});var n=a(7040),s=a(44994),i=a(13346),r=a(67669),l=a(40131),d=a(53538);let useCancellationReasonCategoriesQuery=()=>(0,n.a)({queryKey:r.a.cancellationSettings.reasonCategories(),queryFn:async()=>{let e=await (0,s.h)(d.IX(l.PQ),{method:"get",url:i.Z.admin.cancellationSettings.reasonCategories.list()});return e.data}}),useCancellationReasonOptionsQuery=()=>(0,n.a)({queryKey:r.a.cancellationSettings.reasonOptions(),queryFn:async()=>{let e=await (0,s.h)(d.IX(l.oX),{method:"get",url:i.Z.admin.cancellationSettings.reasonOptions.list()});return e.data}}),useCancellationRequestStatusesQuery=()=>(0,n.a)({queryKey:r.a.cancellationSettings.statuses(),queryFn:async()=>{let e=await (0,s.h)(d.IX(l.Qf),{method:"get",url:i.Z.admin.cancellationSettings.statuses.list()});return e.data}}),useRetentionReasonOptionsQuery=()=>(0,n.a)({queryKey:r.a.cancellationSettings.retentionReasons(),queryFn:async()=>{let e=await (0,s.h)(d.IX(l.pr),{method:"get",url:i.Z.admin.cancellationSettings.retentionReasons.list()});return e.data}}),useRetentionActionTypesQuery=()=>(0,n.a)({queryKey:r.a.cancellationSettings.retentionActions(),queryFn:async()=>{let e=await (0,s.h)(d.IX(l.mj),{method:"get",url:i.Z.admin.cancellationSettings.retentionActions.list()});return e.data}})},10777:function(e,t,a){"use strict";a.d(t,{GP:function(){return s},UH:function(){return b}});var n=a(53538);let s=["effective","declared","verified"],i=n.Ry({requests_created:n.Rx(),requests_resolved:n.Rx(),requests_retained:n.Rx(),requests_withdrawn:n.Rx(),requests_cancelled:n.Rx(),retention_rate:n.Rx(),avg_resolution_hours:n.Rx(),premium_retained_annual_uf:n.Rx(),premium_lost_annual_uf:n.Rx(),retention_spend_clp:n.Rx(),avg_retention_spend_clp:n.Rx().nullish()}
1),r=n.Ry({current:i,previous:i,previous_date_from:n.Z_(),previous_date_to:n.Z_()}),l=n.Ry({bucket:n.Z_(),created:n.Rx(),retained:n.Rx(),withdrawn:n.Rx(),cancelled:n.Rx()}),d=n.Ry({reason_option_id:n.Rx().nullish(),reason_label:n.Z_(),total_created:n.Rx(),retained:n.Rx(),cancelled:n.Rx(),open:n.Rx(),retention_rate:n.Rx().nullish(),premium_lost_annual_uf:n.Rx()}),o=n.Ry({declared_option_id:n.Rx().nullish(),declared_label:n.Z_(),verified_option_id:n.Rx(),verified_label:n.Z_(),count:n.Rx()}),c=n.Ry({verified_count:n.Rx(),verified_without_declared_count:n.Rx(),unverified_resolved_count:n.Rx(),mismatch_rate:n.Rx().nullish(),pending_reason_verification:n.Rx()}),u=n.Ry({action_type_id:n.Rx(),action_label:n.Z_(),offers:n.Rx(),retained:n.Rx(),cancelled_anyway:n.Rx(),still_open:n.Rx(),effectiveness:n.Rx().nullish(),total_spend_clp:n.Rx()}),m=n.Ry({reason_option_id:n.Rx(),reason_label:n.Z_(),count:n.Rx()}),x=n.Ry({bucket:n.Z_(),label:n.Z_(),paid_amount_clp:n.Rx(),paid_claims_count:n.Rx()}),_=n.Ry({requests:n.Rx(),retained:n.Rx(),cancelled:n.Rx(),open:n.Rx(),retention_rate:n.Rx().nullish()}),h=n.Ry({recent_paid_count:n.Rx(),high_loss_ratio_count:n.Rx().nullish(),both_count:n.Rx().nullish(),recent_window_days:n.Rx(),loss_ratio_threshold:n.Rx()}),f=n.Ry({paid_total_clp:n.Rx(),coverage:n.IX(x),with_paid_claim:_,without_paid_claim:_,signals:h}),p=n.Ry({bucket:n.Z_(),label:n.Z_(),total_created:n.Rx(),retained:n.Rx(),cancelled:n.Rx(),open:n.Rx(),retention_rate:n.Rx().nullish(),premium_lost_annual_uf:n.Rx()}),g=n.Ry({buckets:n.IX(p),avg_tenure_months_retained:n.Rx().nullish(),avg_tenure_months_cancelled:n.Rx().nullish()}),v=n.Ry({requests_with_overdue:n.Rx(),overdue_invoices_count:n.Rx(),overdue_amount_uf:n.Rx(),overdue_amount_clp:n.Rx().nullish()}),j=n.Ry({retained_with_plan_change:n.Rx(),premium_ceded_annual_uf:n.Rx(),net_premium_retained_annual_uf:n.Rx(),retention_spend_clp:n.Rx(),total_retention_cost_clp:n.Rx().nullish(),overdue_retained:v,overdue_cancelled:v}),b=n.Ry({date_from:n.Z_(),date_to:n.Z_(),granularity:n.Z_(),reason_view:n.Z_(),uf_value:n.Rx().nullish(),kpis:r,time_series:n.IX(l),reasons:n.IX(d),reason_matrix:n.IX(o),verification:c,retention_actions:n.IX(u),retention_reasons:n.IX(m),claims_impact:f,tenure:g,retention_economics:j})},23466:function(e,t,a){"use strict";a.d(t,{L:function(){return s},LB:function(){return r},U4:function(){return m},Ze:function(){return o},c7:function(){return c},jg:function(){return i},pw:function(){return l},tj:function(){return u},yb:function(){return d}});var n=a(53538);let s=n.Ry({id:n.Rx(),policy_id:n.Z_(),document_number:n.Z_().nullable(),insured_id:n.Rx().nullable(),email:n.Z_().nullable(),first_name:n.Z_().nullable(),last_name:n.Z_().nullable(),cancellation_reason:n.Z_(),cancellation_reason_details:n.Z_().nullable(),cancellation_date:n.Z_().nullable(),amount_spent:n.Rx().nullable(),voided_at:n.Z_().nullable(),policy_cancelled_at:n.Z_().nullable(),created_at:n.Z_(),status_key:n.Z_(),status_label:n.Z_(),status_group:n.Z_(),status_color:n.Z_(),assigned_to_id:n.Rx().nullable(),assigned_to_name:n.Z_().nullable(),sales_agent_name:n.Z_().nullable(),plan_name:n.Z_().nullable(),policy_start_date:n.Z_().nullable(),pet_name:n.Z_().nullable(),pet_species:n.Z_().nullable(),claims_count:n.Rx(),total_reimbursed_clp:n.Rx().nullish(),is_renewal:n.O7(),retention_reason_key:n.Z_().nullable(),retention_reason_label:n.Z_().nullable(),retention_reason_details:n.Z_().nullable(),verified_reason_key:n.Z_().nullish(),verified_reason_label:n.Z_().nullish(),verified_reason_details:n.Z_().nullish(),is_reason_verified:n.O7().nullish(),reason_verified_at:n.Z_().nullish(),reason_verified_by_name:n.Z_().nullish(),retention_action_key:n.Z_().nullish(),retention_action_label:n.Z_().nullish(),retention_offer_details:n.Z_().nullish(),annual_premium_uf:n.Rx().nullish(),monthly_premium_uf:n.Rx().nullish(),monthly_premium_clp:n.Rx().nullish(),tenure_months:n.Rx().nullish(),auto_cancel_scheduled_at:n.Z_().nullish(),original_auto_cancel_scheduled_at:n.Z_().nullish(),reschedule_min_date:n.Z_().nullish(),reschedule_max_date:n.Z_().nullish(),hours_until_auto_cancel:n.Rx().nullish(),is_overdue:n.O7().nullish(),has_blocking_claim:n.O7().nullish()}),i=n.Ry({items:n.IX(s),total_items:n.Rx(),page:n.Rx(),page_size:n.Rx(),total_pages:n.Rx()}),r=n.Ry({total_pending:n.Rx(),total_contacted:n.Rx(),total_critical:n.Rx(),total_stuck:n.Rx().nullish(),retention_rate_30d:n.Rx(),avg_resolution_hours:n.Rx(),premium_at_risk_annual_uf:n.Rx().nullish(),premium_at_risk_monthly_clp:n.Rx().nullish(),pending_reason_verification:n.Rx().nullish(),overdue_count:n.Rx().nullish(),unassigned_count:n.Rx().nullish()}),l=n.Ry({id:n.Rx(),kind:n.Z_(),kind_label:n.Z_(),body:n.Z_(),author_name:n.Z_().nullish(),author_email:n.Z_().nullish(),created_at:n.Z_()});n.Ry({items:n.IX(l)});let d=n.Ry({scheduled_at:n.Z_(),previous_scheduled_at:n.Z_(),original_scheduled_at:n.Z_().nullish(),cancellation_date:n.Z_().nullish(),min_scheduled_date:n.Z_(),max_scheduled_date:n.Z_(),message:n.Z_()}),o=n.Ry({message:n.Z_(),cancellation_request:s}),c=n.Ry({message:n.Z_(),cancellation_request:s}),u=n.Ry({message:n.Z_(),id:n.Rx(),policy_id:n.Z_()}),m=s},40131:function(e,t,a){"use strict";a.d(t,{PQ:function(){return s},Qf:function(){return r},mj:function(){return l},oX:function(){return i},pr:function(){return d}});var n=a(53538);let s=n.Ry({id:n.Rx(),key:n.Z_(),label:n.Z_(),is_active:n.O7(),sort_order:n.Rx(),reason_options_count:n.Rx()}),i=n.Ry({id:n.Rx(),key:n.Z_(),label:n.Z_(),category_id:n.Rx(),category_label:n.Z_(),is_active:n.O7(),sort_order:n.Rx()}),r=n.Ry({id:n.Rx(),key:n.Z_(),label:n.Z_(),group:n.Z_(),group_label:n.Z_(),c
1olor:n.Z_(),is_default:n.O7(),is_active:n.O7(),sort_order:n.Rx(),requests_count:n.Rx()}),l=n.Ry({id:n.Rx(),key:n.Z_(),label:n.Z_(),is_active:n.O7(),sort_order:n.Rx(),requests_count:n.Rx()}),d=n.Ry({id:n.Rx(),key:n.Z_(),label:n.Z_(),is_active:n.O7(),sort_order:n.Rx(),requests_count:n.Rx()})},45564:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});var n=a(10763);let s=(0,n.Z)("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]])},72058:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});var n=a(10763);let s=(0,n.Z)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]])}},function(e){e.O(0,[6495,8897,2128,7718,314,1493,9617,9778,95,7127,8857,9774,2888,179],function(){return e(e.s=25861)}),_N_E=e.O()}]);

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.