1import{_ as W,bx as q,u,j as e,aC as B,a0 as E,be as J,bf as X,bg as ee,bh as se,T as ae,by as te,bz as v,bA as k,bB as ie,bC as le,az as O,b2 as re,bD as oe,bE as ne,E as L,bF as ce,a1 as de,a2 as ge,a3 as xe,a5 as pe,bG as M,ax as ue,e as he,U as me,bH as fe,a as N,r as be,bI as je,bJ as Ce,bK as ve,bL as we,bM as ye,bN as Pe,bO as Ne,d as Ve}from"./index-6AHMKm1b.js";import{S}from"./separator-5vHaTcia.js";import{U as He}from"./UpgradePromotionPopover-D_CqepYW.js";import{S as d}from"./skeleton-DOWAk-uP.js";import{T as Le}from"./TcgDocumentPreviewContent-DK8ScJR1.js";import"./popover-CZeHj8ru.js";import"./UpgradeCrownIcon-B7so5w-c.js";import"./useApiErrorHandler-CvZwsHwS.js";import"./tcgDocumentView-0I7nc65z.js";const Ee={getDashboard:async s=>{try{const{data:a}=await W.get(`/api/v2/websites/${s}/legal-policies/dashboard`);return a.data}catch(a){throw console.error("Failed to fetch legal policies dashboard:",a),a}}},R={all:["legalPolicies"],dashboard:s=>[...R.all,"dashboard",s]},Ie=s=>q({queryKey:R.dashboard(s),queryFn:()=>Ee.getDashboard(s),enabled:!!s&&s>0}),T={published:{labelKey:"legalPolicies.status.published",variant:"success"},draft:{labelKey:"legalPolicies.status.draft",variant:"warning"},not_generated:{labelKey:"legalPolicies.status.notGenerated",variant:"secondary"}};function De({status:s,isGated:a=!1}){const{t:i}=u(),l=a&&s==="published",r=l?{labelKey:"legalPolicies.status.inactive",variant:"secondary"}:T[s]??T.not_generated;return e.jsxs(B,{variant:r.variant,className:"rounded-full flex items-center gap-1 text-xs font-medium","data-testid":"policy-status-badge","data-status":l?"inactive":s,children:[e.jsx("span",{className:"size-2 rounded-full bg-current","aria-hidden":"true"}),i(r.labelKey)]})}const _e=({width:s=24,height:a=24,svgColor:i="secondary-dark",className:l})=>{const r=E[i]||i;return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:a,viewBox:"0 0 24 24",fill:"none",className:l,"aria-hidden":"true",children:e.jsx("path",{d:"M54 27V31C54 31.2652 54.1054 31.5196 54.2929 31.7071C54.4804 31.8946 54.7348 32 55 32H59M59 32L54 27H47C46.4696 27 45.9609 27.2107 45.5858 27.5858C45.2107 27.9609 45 28.4696 45 29V43C45 43.5304 45.2107 44.0391 45.5858 44.4142C45.9609 44.7893 46.4696 45 47 45H57C57.5304 45 58.0391 44.7893 58.4142 44.4142C58.7893 44.0391 59 43.5304 59 43V32ZM49 41H55M49 37H55",transform:"translate(-40 -24)",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})};function ke({title:s,onViewCurrentVersion:a}){const{t:i}=u();return e.jsxs(J,{children:[e.jsx(X,{"aria-label":i("legalPolicies.card.actionsAriaLabel",{title:s}),"data-testid":"policy-card-kebab-trigger",className:"flex items-center justify-center rounded p-1.5 text-gray-700 transition-colors hover:bg-secondary-lightest focus-visible:ring-2 focus-visible:ring-primary",children:e.jsx("span",{"aria-hidden":"true",className:"text-xl font-bold leading-6 select-none",children:"â®"})}),e.jsx(ee,{align:"end",className:"rounded py-2","data-testid":"policy-card-kebab-content",children:e.jsxs(se,{onClick:a,className:"gap-2 text-xl text-secondary-dark","data-testid":"policy-card-view-current-version",children:[e.jsx(_e,{width:24,height:24,svgColor:"secondary-dark"}),i("legalPolicies.card.viewCurrentVersion")]})})]})}function Me({policyType:s,title:a}){const{t:i}=u(),l=globalThis.window,r=l===void 0?void 0:`${l.location.origin}${l.location.pathname}${l.location.search}`;return e.jsx(He,{trigger:e.jsx("button",{type:"button","aria-label":i("legalPolicies.card.crownTriggerAriaLabel",{title:a}),"data-testid":`policy-card-title-crown-${s}`,className:"flex size-5 items-center justify-center rounded-full cursor-pointer focus-visible:ring-2 focus-visible:ring-primary",children:e.jsx(B,{variant:"amber","aria-hidden":"true",className:"flex size-5 items-center justify-center rounded-full p-0.5",children:e.jsx(te,{width:9,height:8,svgColor:"warning"})})}),contentData:{title:"legalPolicies.tcgUpgradePromotion.description",description:""},planData:e.jsx("p",{className:"text-xs text-secondary-dark",children:e.jsx(ae,{i18nKey:"legalPolicies.tcgUpgradePromotion.availablePlan",components:{plans:e.jsx("span",{className:"font-bold"})}})}),side:"right",align:"start",sideOffset:8,alignOffset:-9,customClassName:"flex w-[277px] flex-col gap-5 space-y-0 rounded-lg px-4 py-5",classNames:{header:"gap-2.5",iconBadge:"[&_svg]:size-5",title:"mb-2",planData:"mt-0",cta:"gap-1.5 font-medium"},upgradeSource:"inap_tcg",openOnHover:!0,contentTestId:"tcg-card-crown-popover",ctaTestId:"tcg-card-crown-popover-cta",returnUrl:r})}const Se=({width:s=24,height:a=24,svgColor:i="currentColor",className:l})=>{const r=E[i]||i;return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:l,children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})},Te=({width:s=20,height:a=20,svgColor:i="white",className:l})=>{const r=E[i]||i;return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:a,viewBox:"0 0 20 20",fill:"none",className:l,"aria-hidden":"true",children:e.jsx("path",{d:"M26 14.1667V25.8333M20.1667 20H31.8334",transform:"translate(-16 -10)",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},Ae=({width:s=40,height:a=40,className:i})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:a,viewBox:"0 0 40 40",fill:"none",className:i,"aria-hidden":"true",children:[e.jsx("path",{d:"M0 9.59999C0 4.29731 4.29732 0 9.6 0H30.4C35.7027 0 40 4.29731 40 9.59999V30.4C40 35.7027 35.7027 40 30.4 40H9.6C4.29732 40 0 35.7027 0 30.4V9.59999Z",fill:"#E6F6F4"}),e.jsx("path",{d:"M11.3344 11.4216C14.4194 8.04512 18.9458 6.56336 23.4316 7.45404L24.4356 7.65638L24.225 8.66029C24.055 9.4376 24.298 10.2473 24.8566 10.806C25.1157 11.057 25.4152 11.2513 25.7633 11.3728L26.4356 11.6076V12.3122C26.4518 12.9114 26.6947 13.4862 27.1238 13.9154C27.5449 14.3445 28.1198 14.5875 28.7352 14.6037L29.4234 14.6201L29.6582 15.2677C29.7878 15.624 29.9739 15.9236 30.2168 16.1665C30.7836 16.7414 31.5935 16.9761 32.3789 16.8142L33.3746 16.6119L33.5773 17.6076L33.5934 17.5833C34.4355 21.8424 33.1157 26.207 30.0469 29.2677C27.6016 31.713 24.3625 33.0572 20.9051 33.0572H20.6219C17.0591 32.9843 13.7715 31.4943 11.3586 28.8708C10.6947 28.1421 10.1198 27.3325 9.63399 26.4662H9.62578V24.4415H9.75547L15.3918 24.4697V24.4658H20.9266V26.4658H16.2461V26.474H12.0227C12.2737 26.8383 12.5571 27.1868 12.8566 27.5107C14.8971 29.7292 17.6663 30.9842 20.6703 31.049C23.6743 31.1218 26.5004 29.972 28.6219 27.8505C30.9943 25.4862 32.1278 22.1826 31.7473 18.879C30.6461 18.8386 29.6013 18.3933 28.8078 17.5997C28.5001 17.3002 28.241 16.952 28.0305 16.5552C27.1479 16.4013 26.3385 15.98 25.6988 15.3404C25.0511 14.6926 24.6379 13.8832 24.484 13.0087C24.0954 12.8063 23.7474 12.5471 23.4316 12.2314C22.6381 11.4379 22.1924 10.385 22.152 9.29193C18.6622 8.87905 15.229 10.1503 12.8242 12.7818C12.2008 13.4619 11.6906 14.2149 11.2695 15.0165H15.0348V17.0408H4.8V15.0165H9.04297C9.60166 13.6968 10.3628 12.4823 11.3344 11.4216Z",fill:"#0F766E"}),e.jsx("path",{d:"M26.1926 21.2353C26.8404 21.2353 27.3668 21.7617 27.3668 22.4095C27.3667 23.0572 26.8403 23.5833 26.1926 23.5833C25.5449 23.5833 25.0185 23.0572 25.0184 22.4095C25.0184 21.7617 25.5448 21.2353 26.1926 21.2353Z",fill:"#0F766E"}),e.jsx("path",{d:"M10.3012 21.7697H6.99414V19.7454H10.3012V21.7697Z",fill:"#0F766E"}),e.jsx("path",{d:"M17.9121 19.7454V21.7697H11.4055V19.7454H17.9121Z",fill:"#0F766E"}),e.jsx("path",{d:"M20.225 14.6037C21.9416 13.5753 23.7232 15.365 22.6867 17.0654C22.5896 17.2192 22.4519 17.3569 22.298 17.454L22.2898 17.4619C20.5895 18.4983 18.7999 16.709 19.8281 15.0005C19.9253 14.8386 20.0631 14.7008 20.225 14.6037Z",fill:"#0F766E"})]}),Fe=({width:s=40,height:a=40,className:i})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:a,viewBox:"0 0 40 40",fill:"none",className:i,"aria-hidden":"true",children:[e.jsx("path",{d:"M30.3993 0H9.60074C4.2984 0 0 4.2984 0 9.60074V30.3993
1C0 35.7016 4.2984 40 9.60074 40H30.3993C35.7016 40 40 35.7016 40 30.3993V9.60074C40 4.2984 35.7016 0 30.3993 0Z",fill:"#E8EEFA"}),e.jsx("path",{d:"M21.119 8.33L9.56894 10.0133V13.2133H5.56V15.2967H16.6856V13.2133H11.6523V11.8133L21.1023 10.4383L29.9523 11.805V25.2633L21.094 31.4133L13.5856 26.5133L13.069 26.155H21.6196V24.0717H9.56894V26.2467L12.4189 28.2383L21.1273 33.93L32.0356 26.355V10.0217L21.119 8.33Z",fill:"#1B4190"}),e.jsx("path",{d:"M11.2341 18.6383H8.10851V20.7217H11.2341V18.6383Z",fill:"#1B4190"}),e.jsx("path",{d:"M19.1716 18.6383H12.446V20.7217H19.1716V18.6383Z",fill:"#1B4190"})]}),Be=({width:s=40,height:a=40,className:i})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:a,viewBox:"0 0 40 40",fill:"none",className:i,"aria-hidden":"true",children:[e.jsx("path",{d:"M9.6 0H30.4C35.7027 0 40 4.29732 40 9.6V30.4C40 35.7027 35.7027 40 30.4 40H9.6C4.29732 40 0 35.7027 0 30.4V9.6C0 4.29732 4.29732 0 9.6 0Z",fill:"#ECEBFF"}),e.jsx("path",{d:"M29.7482 23.607V10.7325C29.7482 9.63943 28.8575 8.74875 27.7644 8.74875H10.7848V14.6354H5.99935V16.6596H17.392V14.6354H12.809V10.773L27.724 10.7325V29.4936H14.7362C13.6754 29.4936 12.809 28.6272 12.809 27.5665V26.6677H21.8098V24.6434H10.8171V25.6555H10.7848V27.5665C10.7848 29.7446 12.558 31.5179 14.7362 31.5179H31.0519V31.4774C32.9142 31.2911 34.3879 29.7284 34.3879 27.8175V23.607H29.7482ZM32.3636 27.8175C32.3636 28.7405 31.6105 29.4936 30.6875 29.4936C30.1693 29.4936 29.7401 29.0725 29.7401 28.5462V25.6312H32.3555V27.8175H32.3636Z",fill:"#4338CA"}),e.jsx("path",{d:"M11.3155 19.6166H8.11611V21.7H11.3155V19.6166Z",fill:"#4338CA"}),e.jsx("path",{d:"M19.4403 19.6166H12.556V21.7H19.4403V19.6166Z",fill:"#4338CA"})]}),A=ie,Oe=`ppg_edit=${encodeURIComponent('"1"')}`,V={cpg:{generate:"/cookie-policy/language-settings",editDraft:"/cookie-policy/language-settings?resume=1",editPublished:`/cookie-policy/language-settings?${le}=1`,viewCurrentVersion:"/cookie-policy/preview"},ppg:{generate:"/privacy-policy/language-preferences",editDraft:"/privacy-policy/language-preferences",editPublished:`/privacy-policy/language-preferences?${Oe}`,viewCurrentVersion:"/privacy-policy/generated-policy"},tcg:{generate:`${v.QUESTIONNAIRE}?${k}=${A}`,editDraft:v.QUESTIONNAIRE,editPublished:`${v.QUESTIONNAIRE}?${k}=${A}`,viewCurrentVersion:v.GENERATED}},U={ppg:{titleKey:"legalPolicies.card.privacyPolicyTitle",iconBgClassName:"bg-primary-lightest",iconColor:"primary",IconTile:Fe},cpg:{titleKey:"legalPolicies.card.cookiePolicyTitle",iconBgClassName:"bg-success-lightest",iconColor:"success",IconTile:Ae},tcg:{titleKey:"legalPolicies.card.termsAndConditionsTitle",iconBgClassName:"bg-primary-lightest",iconColor:"primary",IconTile:Be}},F=["ppg","cpg","tcg"];function Re({policyType:s,title:a,status:i,version:l,lastUpdated:r,languages:b,onEdit:x,onGenerate:h,onPreview:j,onViewCurrentVersion:m,isGated:p=!1}){const{t:c}=u(),f=i!=="not_generated",w=i==="published",g=U[s];return e.jsxs(O,{className:"flex h-full flex-col gap-3 p-4 border border-gray-200 shadow","data-testid":`policy-card-${s}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[g.IconTile?e.jsx(g.IconTile,{width:40,height:40,className:"size-10"}):e.jsx("div",{className:re("flex items-center justify-center size-10 rounded-lg",g.iconBgClassName),children:e.jsx(oe,{width:20,height:20,svgColor:g.iconColor})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{status:i,isGated:p}),f&&!p&&e.jsx("button",{type:"button","aria-label":c("legalPolicies.card.previewAriaLabel",{title:a}),"data-testid":`policy-card-preview-${s}`,onClick:j,className:"flex items-center justify-center size-8 cursor-pointer rounded-lg border border-gray-200 bg-white hover:bg-secondary-lightest focus-visible:ring-2 focus-visible:ring-primary",children:e.jsx(Se,{width:16,height:16,svgColor:"secondary-dark"})}),w&&!p&&e.jsx(ke,{title:a,onViewCurrentVersion:m})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-xl font-bold text-dark","data-testid":`policy-card-title-${s}`,children:a}),p&&e.jsx(Me,{policyType:s,title:a})]}),f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(S,{className:"bg-gray-100"}),e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx(H,{label:c("legalPolicies.card.lastUpdated"),value:ne(r)||"â"}),i==="published"&&e.jsx(H,{label:c("legalPolicies.card.version"),value:l?`V${l}`:"â"}),e.jsx(H,{label:c("legalPolicies.card.languages"),value:b.length>0?b.join(", ").toUpperCase():"â"})]}),e.jsx(S,{className:"bg-gray-100"})]}),e.jsxs(L,{variant:"primary",className:"w-full gap-2 mt-auto",onClick:x,"data-testid":`policy-card-edit-${s}`,children:[e.jsx(ce,{width:16,height:16}),c("legalPolicies.card.edit")]})]}):e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 p-4 min-h-25 rounded-[10px] border border-dashed border-gray-200 bg-gray-50",children:[e.jsx("p",{className:"text-secondary-dark text-xs text-center","data-testid":`policy-card-empty-message-${s}`,children:c("legalPolicies.card.notGeneratedMessage")}),e.jsxs(L,{variant:"primary",className:"gap-1.5",onClick:h,"data-testid":`policy-card-generate-${s}`,children:[e.jsx(Te,{width:20,height:20,svgColor:"white"}),c("legalPolicies.card.generate")]})]})]})}function H({label:s,value:a}){return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-secondary",children:s}),e.jsx("span",{className:"text-dark font-medium",children:a})]})}function Ue(){return e.jsxs(O,{className:"flex flex-col gap-3 p-4 border border-gray-200 shadow","aria-busy":"true","data-testid":"policy-card-skeleton",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{className:"size-10 rounded-lg"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{className:"h-6 w-20 rounded-full"}),e.jsx(d,{className:"size-8 rounded-lg"}),e.jsx(d,{className:"size-8 rounded-lg"})]})]}),e.jsx(d,{className:"h-6 w-40"}),e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx(d,{className:"h-4 w-full"}),e.jsx(d,{className:"h-4 w-full"}),e.jsx(d,{className:"h-4 w-full"})]}),e.jsx(d,{className:"h-9 w-full"})]})}function $e({open:s,onOpenChange:a,websiteId:i,source:l}){const{t:r}=u();return e.jsx(de,{open:s,onOpenChange:a,children:e.jsxs(ge,{showCloseButton:!0,className:"flex max-h-[90vh] max-w-4xl flex-col p-0","data-testid":"tcg-dashboard-preview-modal",children:[e.jsx(xe,{className:"px-8 py-6 text-left",children:e.jsx(pe,{children:M(r,"tcg.preview_modal.title")})}),e.jsx("hr",{className:"mx-8 border-gray-light"}),e.jsx("div",{className:"flex flex-1 flex-col overflow-y-auto px-8 pt-4",children:e.jsx(Le,{websiteId:i,source:l})}),e.jsx("hr",{className:"mx-8 border-gray-light"}),e.jsx(ue,{className:"flex justify-end px-8 py-4",children:e.jsx(L,{type:"button",onClick:()=>a(!1),className:"bg-primary text-white hover:bg-primary/90","data-testid":"tcg-dashboard-preview-modal-close-button",children:M(r,"tcg.preview_modal.close")})})]})})}function Ge(){var D,_;const{t:s}=u(),a=he(),i=me();fe();const l=N(t=>t.websiteId()),r=N(t=>t.websitePlanSlug()),b=N(t=>t.featuresList().tcg??!1),{data:x,isLoading:h,isError:j}=Ie(l),[m,p]=be.useState(null),c=m==="cpg",f=m==="ppg",w=m==="tcg",g=t=>{var n;return((n=x==null?void 0:x[t])==null?void 0:n.status)==="published"?"published":"draft"};je({policy_type:"cpg",website_id:c?l:0,source:g("cpg")});const{data:o}=Ce(l,f,g("ppg")),$=(o==null?void 0:o.defaultLanguage)??"en",I=(_=(D=o==null?void 0:o.renderedContent)==null?void 0:D[$])==null?void 0:_.generated_at,G=I?ve(new Date(I)):void 0,y=()=>p(null),Z=we(i.searchStr),P=t=>Ne(t,Z),K=(t,n)=>{const C=V[t];a({to:P(n?C.editPublished:C.editDraft)})},z=t=>{a({to:P(V[t].generate)})},Q=t=>{a({to:P(V[t].viewCurrentVersion)})};return e.jsx("main",{className:"content-wrapper","data-testid":"legal-policies-page",children:e.jsxs("div",{className:"page-wrapper",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-dark","data-testid":"legal-policies-title",children:s("legalPolicies.page.title")}),e.jsx("p",{className:"text-secondary text-xs","data-testid":"legal-policies-subtitle",children:s("legalPolicies.page.subtitle")})]}),h&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:F.map(t=>e.jsx(Ue,{},t))}),!h&&j&&e.jsx("div",{className:"flex min-h-[60vh] items-center justify-center text-center",role:"alert","data-testid":"legal-policies-error",children:e.jsx("p",{className:"text-danger text-md",children:s("legalPolicies.page.loadError")})}),!h&&!j&&x&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:F.map(t=>{const n=x[t];if(!n)return null;const C=U[t],Y=n.status==="published";return e.jsx(Re,{policyType:t,title:s(C.titleKey),status:n.status,version:n.version,lastUpdated:n.last_updated,languages:n.languages,onEdit:()=>K(t,Y),onGenerate:()=>z(t),onPreview:()=>p(t),onViewCurrentVersion:()=>Q(t),isGated:t==="tcg"&&!b},t)})}),e.jsx(ye,{isOpen:c,onOpenChange:t=>!t&&y()}),e.jsx(Pe,{open:f,onOpenChange:t=>!t&&y(),userResponse:(o==null?void 0:o.userResponses)??{},language:o==null?void 0:o.defaultLanguage,plan:r,effectiveDate:G}),e.jsx($e,{open:w,onOpenChange:t=>!t&&y(),websiteId:l,source:g("tcg")})]})})}const es=Ve("/legal-policies")({component:Ge});export{es as Route};
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.