PageSourceSearch

https://app.cookieyes.com/assets/preview.lazy-BKx8htQF.js

js cookieyes.com collected 2026-09-24 07:18:14 UTC 35,063 bytes, 16 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.lazy-C31FZ4X_.js","assets/index-DMQ34O7E.js","assets/index-CcwEZU7V.css","assets/scroll-area-BNxGEwtS.js"])))=>i.map(i=>d[i]);
2import{Y as Ce,u as U,e as ee,j as e,a1 as z,a2 as Ne,a4 as qe,a5 as ve,E as F,r,a as _,hO as P,bI as se,h_ as Ye,a3 as Qe,aw as Xe,h$ as ne,i0 as Je,i1 as _e,i2 as Ze,i3 as es,i4 as we,at as Me,bY as ss,bU as os,bW as ts,co as G,bV as is,T as O,bj as as,au as cs,aS as ls,i5 as ns,e$ as rs,f0 as ds,f1 as ms,f2 as ps,hZ as Se,ay as us,cM as xs,i6 as ys,i7 as re,aq as hs,aP as pe,i8 as fs,i9 as gs,as as ks,eF as Le,ia as bs,hQ as de,a6 as Ps,hU as Te,be as De,bf as Ee,ae as js,bg as Ie,hp as Cs,bh as Z,eX as Ns,ib as vs,d as _s,U as ws,ic as Ms,af as Ss,bl as ke,id as be,ie as Pe,S as Ls}from"./index-DMQ34O7E.js";import{G as Ts}from"./GetInstallationModal-DrvjUmET.js";import{E as Ds}from"./external-link-DGOH_I46.js";import{I as J}from"./InputField-B6_VxhBH.js";import{T as me}from"./TextArea-CUd5MZtP.js";import{F as Es}from"./FooterSection-x2t89AgQ.js";import{E as Is}from"./ellipsis-vertical-DLByw8Iq.js";import"./tabs-CzQu6lkO.js";import"./CircleAlertFillIcon-DCw1b0Ub.js";import"./quill.snow-B58pZGWR.js";/**
3 * @license lucide-react v0.503.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const Fs=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Os=Ce("refresh-cw",Fs);/**
8 * @license lucide-react v0.503.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const Us=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],As=Ce("settings",Us),Fe=({open:c,onClose:i,publishedPageUrl:n})=>{const{t:s}=U(),l=ee(),f=()=>{window.open(n,"_blank","noopener,noreferrer"),i()},m=()=>{l({to:"undefined/cookie-policy/preview"}),i()};return e.jsx(z,{open:c,onOpenChange:p=>!p&&i(),children:e.jsxs(Ne,{className:"sm:max-w-[450px]",children:[e.jsxs("button",{onClick:i,className:"absolute cursor-pointer focus:outline-none focus:ring-0 right-4 top-4 roun
12ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",type:"button","aria-label":"Close",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center",children:[e.jsx("div",{className:"mb-6 flex items-center justify-center",children:e.jsx("img",{src:"/images/icons/policy-published-success.svg",alt:"",width:64,height:64,className:"shrink-0","aria-hidden":!0})}),e.jsx(ve,{className:"mb-3 text-3xl font-semibold text-dark",children:s("cookiePolicy.policyPublishedSuccessModal.title")}),e.jsxs("p",{className:"text-secondary-dark text-md mb-1",children:[s("cookiePolicy.policyPublishedSuccessModal.description")," <",n,">"]}),e.jsx("p",{className:"text-secondary-dark text-md mb-6",children:s("cookiePolicy.policyPublishedSuccessModal.bannerActiveNote")}),e.jsxs(F,{variant:"primary",onClick:f,className:"w-full font-medium mb-3",children:[s("cookiePolicy.policyPublishedSuccessModal.viewCookiePolicy"),e.jsx(Ds,{className:"ml-2 h-4 w-4","aria-hidden":!0})]}),e.jsx("button",{type:"button",onClick:m,className:"text-secondary-dark text-md hover:text-dark underline underline-offset-2 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded",children:s("cookiePolicy.policyPublishedSuccessModal.backToDashboard")})]})]})})},Rs=r.lazy(()=>xs(()=>import("./index.lazy-C31FZ4X_.js"),__vite__mapDeps([0,1,2,3]))),$s=c=>{const i=c.trim();if(!i)return!1;try{const n=new URL(i);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}},je=c=>{const i=c.trim();if(!i)return null;try{let s=new URL(i).hostname.toLowerCase();return s.startsWith("www.")&&(s=s.slice(4)),s}catch{return null}},Oe=c=>c?fs.html(c,{indent_size:2,indent_char:" ",max_preserve_newlines:1,preserve_newlines:!0,indent_inner_html:!0,wrap_line_length:0,end_with_newline:!1}):"";function Hs(c,i,n,s){return c==="snippet"?(n==null?void 0:n.replaceAll(String.raw`\n`,`
13`))??"":i&&(s!=null&&s[i])?Oe(s[i].replaceAll(String.raw`\n`,`
14`)):""}function Vs({selectedOption:c,language:i,languages:n,codeString:s,htmlCode:l,onLanguageClick:f,onCopyCode:m,copied:p,isCopying:k,sendModalOpen:b,onSendModalOpenChange:h}){const{t:o}=U(),y=Hs(c,i,s,l);return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-xl text-primary font-semibold mb-4",children:o("cookiePolicy.addCookiePolicyModal.addCodeToSite")}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-md text-secondary mb-3",children:o(c==="snippet"?"cookiePolicy.addCookiePolicyModal.cookiePolicyAvailableIn":"cookiePolicy.addCookiePolicyModal.selectLanguageToViewCode")}),c==="snippet"&&e.jsx("div",{className:"flex items-center divide-x divide-gray-border text-md font-medium text-dark [&>*:not(:first-child)]:pl-4",children:n.map(t=>e.jsxs("div",{className:"flex items-center gap-2 pr-4",children:[e.jsx(G,{svgColor:"primary",width:18,height:18}),t.name]},t.code))}),c==="html"&&e.jsx("div",{className:"flex items-center text-md font-medium text-dark gap-3",children:n.map(t=>e.jsxs("button",{type:"button",className:`flex items-center gap-2 cursor-pointer rounded-lg px-[18px] py-3 ${i===t.code?"bg-sidebar-active":"bg-gray-lightest"}`,onClick:()=>f(t.code),"aria-pressed":i===t.code,"aria-label":`Select ${t.name} language`,children:[e.jsx(G,{svgColor:i===t.code?"primary":"gray-border",width:18,height:18}),t.name]},t.code))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-secondary-dark text-md",children:c==="snippet"?e.jsx(O,{i18nKey:"cookiePolicy.addCookiePolicyModal.coptJSCode",components:{b:e.jsx("span",{className:"font-semibold"})}}):e.jsx(O,{i18nKey:"cookiePolicy.addCookiePolicyModal.coptHTMLCode",components:{b:e.jsx("span",{className:"font-semibold"})}})}),e.jsx("div",{className:"my-4",children:e.jsx(rs,{value:y,extensions:[ds(),ms("normal"),ps.lineWrapping],editable:!1,theme:"light",basicSetup:{foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,lineNumbers:!0}})})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx(F,{variant:"outline-secondary-dark",className:`font-medium ${k?"opacity-50 cursor-not-allowed":""}`,onClick:m,disabled:k,children:p?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Me,{className:"w-4 h-4"}),"Copied!"]}):"Copy code"}),e.jsxs(z,{open:b,onOpenChange:h,children:[e.jsx(Se,{asChild:!0,children:e.jsxs(F,{variant:"outline-secondary-dark",className:"font-medium",children:[e.jsx(us,{}),o("cookiePolicy.addCookiePolicyModal.sendCodeToTeammate")]})}),e.jsx(_e,{open:b,selectedOption:c})]})]}),e.jsx("p",{className:"text-secondary-dark text-md",children:e.jsx(O,{i18nKey:"cookiePolicy.addCookiePolicyModal.pasteCodeToSite",components:{b:e.jsx("span",{className:"font-semibold"})}})})]})}function Ws({selectedOption:c,isFreePlan:i,isWixSite:n,onSelectOption:s,onOpenPlanModal:l,showMoreExpanded:f,onShowMoreExpandedChange:m}){const{t:p}=U(),k=we,b=n?k.filter(o=>o.type!=="oneClickInstall"&&o.type!=="snippet"):k,h=o=>{const y="isPremium"in o&&o.isPremium,t="isRecommended"in o&&o.isRecommended,u=y&&i,v=`w-full text-left px-4 py-3 rounded-xl flex items-center gap-4 bg-gray-lightest cursor-pointer ${c===o.type?"bg-sidebar-active":""}`,j=e.jsxs(e.Fragment,{children:[u?e.jsx(ys,{className:"flex-shrink-0",width:20,height:20,svgColor:"#9
14CA3AF"}):e.jsx(G,{className:"flex-shrink-0",svgColor:c===o.type?"primary":"gray-border"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("p",{className:"font-semibold text-xl text-dark",children:p(o.title)}),y&&e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-sm font-medium bg-primary-lightest text-primary border border-primary",children:p("cookiePolicy.addCookiePolicyModal.recommended")}),i&&e.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),w.preventDefault(),l(o.type)},className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-warning-lighter flex-shrink-0 cursor-pointer hover:bg-warning-light focus:outline-none","aria-label":p("cookiePolicy.addCookiePolicyModal.openPlanSelection"),"data-testid":`add-cookie-policy-modal-crown-button-${re(o.type)}`,children:e.jsx(hs,{width:12,height:12,svgColor:"#FFB240"})})]})]}),e.jsx("p",{className:"text-md text-dark",children:p(o.description)})]})]});return u?e.jsx("button",{type:"button",className:v,onClick:()=>l(o.type),"aria-label":p("cookiePolicy.addCookiePolicyModal.openPlanSelection"),"data-testid":`add-cookie-policy-modal-option-${re(o.type)}`,children:j},o.type):e.jsx("button",{type:"button",className:v,onClick:()=>s(o.type),"aria-pressed":c===o.type,"aria-label":`Select ${p(o.title)} option`,"data-testid":`add-cookie-policy-modal-option-${re(o.type)}`,children:j},o.type)};return e.jsxs("div",{className:"flex gap-4 relative mb-6",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-primary-lightest border-2 border-primary flex items-center justify-center flex-shrink-0",children:c?e.jsx(Me,{className:"text-primary"}):e.jsx("div",{className:"w-3 h-3 rounded-full bg-primary"})}),e.jsx("div",{className:`h-[calc(100%-40px+20px)] w-[2px] absolute left-5 top-[42px] ${c?"bg-primary":"bg-secondary"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"mt-2 text-xl text-primary font-semibold mb-4",children:p("cookiePolicy.addCookiePolicyModal.selectMethod")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:b.slice(0,2).map(h)}),b.slice(2).length>0&&e.jsx(ss,{type:"single",collapsible:!0,className:"w-full",value:f,onValueChange:m,children:e.jsxs(os,{value:"more",className:"border-none",children:[e.jsx(ts,{className:"pt-0 pb-0",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:b.slice(2).map(o=>{const y=`w-full text-left px-4 py-3 rounded-xl flex items-center gap-4 bg-gray-lightest cursor-pointer ${c===o.type?"bg-sidebar-active":""}`;return e.jsxs("button",{type:"button",className:y,onClick:()=>s(o.type),"aria-pressed":c===o.type,"aria-label":`Select ${p(o.title)} option`,children:[e.jsx(G,{className:"flex-shrink-0",svgColor:c===o.type?"primary":"gray-border"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-xl text-dark mb-1",children:p(o.title)}),e.jsx("p",{className:"text-md text-dark",children:p(o.description)})]})]},o.type)})})}),e.jsx(is,{className:"py-2 text-primary font-medium hover:no-underline justify-end gap-1 [&[data-state=open]>svg]:rotate-180 [&>svg]:text-primary","data-testid":"add-cookie-policy-modal-show-more-toggle",children:p(f==="more"?"cookiePolicy.addCookiePolicyModal.showLess":"cookiePolicy.addCookiePolicyModal.showMore")})]})}),c==="html"&&e.jsx("div",{className:"rounded-xl text-md text-warning-dark",children:e.jsx(O,{i18nKey:n?"cookiePolicy.addCookiePolicyModal.htmlFormatNoteWix":"cookiePolicy.addCookiePolicyModal.htmlFormatNote",components:{b:e.jsx("span",{className:"font-semibold"})}})})]})]})]})}function Bs({open:c,onClose:i,onPublishSuccess:n,initialOption:s}){const{t:l}=U(),f=ee(),[m,p]=r.useState(null),[k,b]=r.useState(),[h,o]=r.useState(),[y,t]=r.useState(),[u,v]=r.useState(),[j,w]=r.useState([]),[g,C]=r.useState(!1),[D,T]=r.useState(!1),[B,A]=r.useState(!1),[q,K]=r.useState(!1),[x,M]=r.useState(""),[E,a]=r.useState(void 0),[N,S]=r.useState(!1),[oe,H]=r.useState(!1),[Ue,Ae]=r.useState(""),[Re,te]=r.useState(!1),V=_(d=>d.websiteId()),W=P(d=>{var R;
14return(R=d.cookiePolicyDetails)==null?void 0:R.policyType}),ie=_(d=>d.websiteURL)(),ae=_(d=>d.websitePlanType)()===1,Y=_(d=>d.getPageToInsertCookiePolicy),L=_(d=>d.website),$e=_(d=>d.setWebsite),He=(L==null?void 0:L.banner_status)===1,ce=r.useRef(""),ue=r.useRef(!1);r.useEffect(()=>{c&&!ue.current&&s&&p(s),ue.current=c},[c,s]);const{refetch:xe}=se({policy_type:W||"cpg",website_id:V}),{mutate:Ve,mutateAsync:We,isPending:ye}=Ye(),Be=d=>{var $;($=we.find(I=>I.type===d))!=null&&$.isPremium&&ae||p(d)},Ke=d=>{v(d)};r.useEffect(()=>{var R;const d=async()=>{try{const I=await es({website_id:V,policy_type:W||"cpg"});b(I.cdn_script_snippet),o(I.snippets),t(I.hosted_page_url),w(I.preferred_languages),I.preferred_languages&&I.preferred_languages.length>0&&v(I.preferred_languages[0].code)}catch($){console.error("Failed to get policy snippet:",$),b(void 0)}};if(c){const $=((R=Y==null?void 0:Y())==null?void 0:R.trim())??"";M($),ce.current=$,d()}else b(void 0),o(void 0),t(void 0),v(void 0),M(""),ce.current=""},[c,V,W,Y]);const Q=x.trim()!==""&&$s(x.trim()),le=je(ie||""),he=je(x.trim()),X=!le||!he||le===he,fe=Q&&X&&x.trim()!==ce.current,ze=async()=>{if(!(!fe||!V)){S(!0);try{await We({website_id:V,policy_type:W||"cpg",has_copied_code:!0,page_to_insert_cookie_policy:x.trim()});const d=x.trim();L!=null&&L.website_metadata&&$e({...L,website_metadata:{...L.website_metadata,page_to_insert_cookie_policy:d}}),xe(),n?(i==null||i(),n(d)):(Ae(d),H(!0))}catch(d){console.error("Failed to publish cookie policy:",d),pe.error(l("cookiePolicy.addCookiePolicyModal.publishCookiePolicyError"))}finally{S(!1)}}},ge=async()=>{let d="";m==="snippet"?d=(k==null?void 0:k.replaceAll(String.raw`\n`,`
15`))??"":m===ne?d=y??"":u&&(h!=null&&h[u])&&(d=Oe(h[u].replaceAll(String.raw`\n`,`
16`)));try{await navigator.clipboard.writeText(d),Ve({website_id:V,policy_type:W||"cpg",...ns(m)},{onSuccess:()=>{C(!0),setTimeout(()=>C(!1),2e3),xe()},onError:()=>{C(!1)}})}catch(R){console.error("Failed to copy to clipboard:",R),C(!1)}},Ge=()=>ae?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-xl text-primary font-semibold mb-4",children:l("cookiePolicy.addCookiePolicyModal.addCookiePolicyToSite")}),e.jsx("p",{className:"text-secondary-dark text-md",children:l("cookiePolicy.addCookiePolicyModal.oneClickInstallDescription")})]}):He?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-xl text-primary font-semibold mb-4",children:l("cookiePolicy.addCookiePolicyModal.addCookiePolicyToSite")}),e.jsx("p",{className:"text-md text-dark font-normal mb-3",children:l("cookiePolicy.addCookiePolicyModal.cookiePolicyAvailableIn")}),e.jsx("div",{className:"flex items-center divide-x divide-gray-border text-md font-semibold text-dark [&>*:not(:first-child)]:pl-4 mb-4",children:j.map(d=>e.jsxs("div",{className:"flex items-center gap-2 pr-4",children:[e.jsx(G,{svgColor:"primary",width:18,height:18}),d.name]},d.code))}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-dark text-md font-normal mb-2",children:[e.jsxs("span",{className:"font-semibold",children:[l("cookiePolicy.addCookiePolicyModal.step1Label")," "]}),l("cookiePolicy.addCookiePolicyModal.step1DescriptionBold"),l("cookiePolicy.addCookiePolicyModal.step1Description")]}),e.jsx("label",{htmlFor:"cookie-policy-page-url",className:"block text-dark text-md font-semibold mb-1.5",children:l("cookiePolicy.addCookiePolicyModal.enterPageUrlLabel")}),e.jsx(as,{id:"cookie-policy-page-url",type:"url",placeholder:l("cookiePolicy.addCookiePolicyModal.enterPageUrlPlaceholder"),value:x,onChange:d=>M(d.target.value),className:Q&&!X?"border border-red-500 rounded-lg px-3 py-2.5 text-dark":"border border-gray-border rounded-lg px-3 py-2.5 text-dark","aria-label":l("cookiePolicy.addCookiePolicyModal.enterPageUrl"),"aria-invalid":Q&&!X}),Q&&!X&&e.jsx("p",{className:"mt-1.5 text-sm text-red-600",role:"alert",children:l("cookiePolicy.addCookiePolicyModal.enterPageUrlDomainMismatch",{websiteDomain:le||ie})})]}),e.jsx("div",{children:e.jsxs("p",{className:"text-dark text-md font-normal mb-2",children:[e.jsxs("span",{className:"font-semibold",children:[l("cookiePolicy.addCookiePolicyModal.step2Label")," "]}),l("cookiePolicy.addCookiePolicyModal.oneClickStep2InstructionBefore")," ",e.jsx("code",{className:"rounded bg-warning-lighter px-1.5 py-0.5 font-mono text-sm text-dark border border-warning-light",children:'<div id="cky-auto-cookie-policy"></div>'})," ",l("cookiePolicy.addCookiePolicyModal.oneClickStep2InstructionAfter")]})}),e.jsx("div",{children:N?e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsxs("div",{className:"relative flex h-8 w-8 shrink-0 items-center justify-center",children:[e.jsx(As,{className:"h-8 w-8 text-cyan-500",strokeWidth:1.5,"aria-hidden":!0}),e.jsx(Os,{className:"absolute h-4 w-4 text-cyan-500 animate-spin",strokeWidth:2,"aria-hidden":!0})]}),e.jsx("p",{className:"text-xl font-semibold text-dark",children:l("cookiePolicy.addCookiePolicyModal.publishingToSite")})]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"primary",className:"font-semibold text-base",type:"button",disabled:!fe,onClick:ze,children:l("cookiePolicy.addCookiePolicyModal.publishCookiePolicy")}),e.jsxs("div",{className:"mt-4 flex items-start gap-2 text-left",children:[e.jsx(cs,{className:"h-5 w-5 shrink-0 text-warning-dark",strokeWidth:1.8,"aria-hidden":!0}),e.jsx("p",{className:"text-md text-[#4d4855]",children:l("cookiePolicy.addCookiePolicyModal.publishNote")})]})]})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-xl text-primary font-semibold mb-4",children:l("cookiePolicy.addCookiePolicyModal.addCookiePolicyToSite")}),e.jsxs("button",{type:"button",onClick:()=>te(!0),className:"flex w-full items-start gap-1 rounded-lg cursor-pointer hover:bg-gray-lightest/50 text-left p-0 border-0 bg-transparent font-inherit focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2","aria-label":l("cookiePolicy.addCookiePolicyModal.installCookieBannerFirst"),children:[e.jsx(ls,{className:"h-5 w-5 shrink-0 text-[#b91c1c]",strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{className:"text-md font-normal text-[#b91c1c]",children:l("cookiePolicy.addCookiePolicyModal.installCookieBannerFirst")})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3",children:[e.jsx(F,{variant:"primary",className:"font-semibold",type:"button",onClick:()=>te(!0),children:l("cookiePolicy.addCookiePolicyModal.getInstallationCode")}),e.jsx("button",{type:"button",onClick:()=>{i==null||i(),f({to:"/dashboard"})},className:"text-md font-normal text-[#4E4A6F] hover:underline focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded",children:l("cookiePolicy.addCookiePolicyModal.backToDashboard")})]})]});return e.jsx(e.Fragment,{children:e.jsxs(Ne,{className:"max-w-250 max-h-[calc(100vh-4rem)] overflow-y-auto",showCloseButton:!0,children:[e.jsxs(Qe,{className:"items-center",children:[e.jsx(ve,{className:"text-primary text-2xl font-heading font-bold mb-1",children:l("cookiePolicy.addCookiePolicyModal.title")}),e.jsx(Xe,{className:"text-secondary-dark text-md font-normal",children:ie})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx(Ws,{selectedOption:m,isFreePlan:ae,isWixSite:(L==null?void 0:L.is_wix_connected_site)??!1,onSelectOption:Be,onOpenPlanModal:d=>{d===ne?K(!0):A(!0)},showMoreExpanded:E,onShowMoreExpandedChange:a}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:`w-10 h-10 rounded-full border-[2px]  flex items-center justify-center flex-shrink-0 ${m?"bg-primary-lightest border-primary":"bg-secondary-lightest border-secondary"}`,children:m&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-primary"})}),m&&e.jsx("div",{className:"flex-1",children:m==="oneClickInstall"?Ge():m===ne?e.jsxs(e.Fragment,{children:[e.jsx(Je,{policyType:W||"cpg",hostedUrl:y,languages:j,copied:g,isCopying:ye,onCopy:ge,onSendClick:()=>T(!0)}),e.jsx(z,{open:D,onOpenChange:T,children:e.jsx(_e,{open:D,selectedOption:m,policyType:W||"cpg"})})]}):e.jsx(Vs,{selectedOption:m,language:u,languages:j,codeString:k,htmlCode:h,onLanguageClick:Ke,onCopyCode:ge,copied:g,isCopying:ye,sendModalOpen:D,onSendModalOpenChange:T})})]})]}),e.jsx(z,{open:B,onOpenChange:A,children:e.jsx(r.Suspense,{fallback:null,children:e.jsx(Rs,{isOpen:B,onClose:()=>A(!1),checkoutRef:"cpgautoinject_basic",freeFeaturesLabel:l("cookiePolicy.addCookiePolicyModal.continueWithoutOneClickInstall")})})}),e.jsx(Ze,{open:q,onOpenChange:K,policyType:"cpg",websiteId:V}),e.jsx(Ts,{open:Re,onOpenChange:te,source:"cookiePolicy"}),!n&&e.jsx(Fe,{open:oe,onClose:()=>{H(!1),i==null||i()},publishedPageUrl:Ue})]})})}function Ks({open:c,onOpenChange:i}){const n=ee(),{t:s}=U(),l=_(g=>g.websiteURL),f=_(g=>g.websiteId),m=P(g=>{var C;return(C=g.cookiePolicyDetails)==null?void 0:C.policyType}),p=P(g=>g.setIsEditMode),{mutate:k,isPending:b}=gs(),{refetch:h}=se({policy_type:m||"cpg",website_id:f()}),[o,y]=r.useState(!1),t=()=>{const g={website_id:f(),policy_type:m||"cpg"};k(g,{onSuccess:()=>{y(!0)}})},u=async()=>{var g;try{await h(),i(!1),p(!1),(g=window.resetCookiePolicyProgression)==null||g.call(window),n({to:"/cookie-policy/language-settings"})}catch(C){console.error("Failed to fetch cookie policy details:",C)}},v=()=>{var g;i(!1),p(!1),(g=window.resetCookiePolicyProgression)==null||g.call(window),n({to:"/legal-policies"})},j=r.useMemo(()=>({title:s("cookiePolicy.deletePolicyModal.title"),description:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"block mb-1",children:e.jsx(O,{i18nKey:s("cookiePolicy.deletePolicyModal.description"),values:{websiteURL:l()},components:{bold:e.jsx("span",{className:"font-semibold"})}})}),e.jsx("span",{className:"block mb-1",children:s("cookiePolicy.deletePolicyModal.description2")}),e.jsx("span",{className:"block",children:s("cookiePolicy.deletePolicyModal.description3")})]}),confirmText:s("cookiePolicy.deletePolicyModal.confirmText"),cancelText:s("cookiePolicy.deletePolicyModal.cancelText")}),[l,s]),w=r.useMemo(()=>({title:s("cookiePolicy.deletePolicySuccessModal.title"),description:e.jsx("span",{className:"block",children:e.jsx(O,{i18nKey:"cookiePolicy.deletePolicySuccessModal.description",values:{websiteURL:l()},components:{bold:e.jsx("span",{className:"font-semibold"})}})}),confirmText:s("cookiePolicy.deletePolicySuccessModal.createNewPolicy"),cancelText:s("cookiePolicy.deletePolicySuccessModal.backToLegalPolicies"),cancelTextNode:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ks,{className:"h-5 w-5"}),s("cookiePolicy.deletePolicySuccessModal.backToLegalPolicies")]})}),[l,s]);return e.jsx(Le,{isOpen:c,config:o?w:j,isLoading:b,onConfirm:o?u:t,onCancel:o?v:()=>i(!1),confirmButtonVariant:o?"primary":"danger",cancelButtonVariant:o?"outline-primary":"outline-secondary-light",classNameHeading:`font-heading ${o?"text-center":""}`,classNameDescription:`${o?"text-center":""}`,classNameFooter:`${o?"!justify-center":""}`})}function zs({emptyFields:c}){const{t:i}=U(),n=P(t=>t.currentLanguage),s=P(t=>t.getContent(n)),l=P(t=>t.updateContentField),f=P(t=>t.getDefaultLanguage()),m=P(t=>t.getPreferredLanguages()),p=P(t=>t.hasEdited()),k=P(t=>t.setIsContentEdited),b=P(t=>t.isContentEdited),h=m==null?void 0:m.find(t=>t.code===n),o=t=>c.includes(t),y=(t,u)=>{l(n,t,u),n!==f&&b&&k(!1),n===f&&k(!0)};return e.jsxs("div",{className:"p-6",children:[n!==f&&p&&e.jsx(bs,{}),e.jsxs("div",{className:"mb-15",children:[e.jsx("h6",{className:"font-body text-3xl text-dark font-bold mb-2",children:i("cookiePolicy.policyEditSection.title",{language:(h==null?void 0:h.name)||n})}),e.jsx("p",{className:"text-md text-dark",children:i("cookiePolicy.policyEditSection.description")}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-2xl text-dark font-bold mb-2",children:i("cookiePolicy.aboutCookies.title")}),e.jsx(J,{label:"Heading",className:"mb-2 text-md text-secondary-dar",value:s==null?void 0:s.about_cookies_title,onChange:t=>y("about_cookies_title",t),error:o("about_cookies_title")?"This field cannot be empty.":void 0}),e.jsx(me,{label:"Description",value:s==null?void 0:s.about_cookies_description,className:"text-md text-secondary-dark",onChange:t=>y("about_cookies_description",t),error:o("about_cookies_description")?"This field cannot be empty.":void 0,pTagStyles:de})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-2xl text-dark font-bold mb-2",children:i("cookiePolicy.useOfCookies.title")}),e.jsx(J,{label:"Heading",className:"mb-2 text-md text-secondary-dark",value:s==null?void 0:s.use_of_cookies_title,onChange:t=>y("use_of_cookies_title",t),error:o("use_of_cookies_title")?"This field cannot be empty.":void 0}),e.jsx(me,{label:"Description",className:"text-md text-secondary-dark",value:s==null?void 0:s.use_of_cookies_description,onChange:t=>y("use_of_cookies_description",t),error:o("use_of_cookies_description")?"This field cannot be empty.":void 0,pTagStyles:de})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-2xl text-dark font-bold mb-2",children:i("cookiePolicy.typesOfCookies.title")}),e.jsx(J,{label:"Heading",className:"mb-2 text-md text-secondary-dark",value:s==null?void 0:s.types_of_cookies_title,onChange:t=>y("types_of_cookies_title",t),error:o("types_of_cookies_title")?"This field cannot be empty.":void 0})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl text-dark font-bold mb-2",children:i("cookiePolicy.cookiePreferences.title")}),e.jsx(J,{label:"Heading",className:"mb-2 text-md text-secondary-dark",value:s==null?void 0:s.cookie_preferences_title,onChange:t=>y("cookie_preferences_title",t),error:o("cookie_preferences_title")?"This field cannot be empty.":void 0}),e.jsx(me,{label:"Description",className:"text-md text-secondary-dark",value:s==null?void 0:s.cookie_preferences_description,onChange:t=>y("cookie_preferences_description",t),error:o("cookie_preferences_description")?"This field cannot be empty.":void 0,pTagStyles:de})]})]})]})]})}function Gs({isOpen:c,languageCode:i,onClose:n}){var y,t;const{t:s}=U(),l=Ps(),f=_(u=>u.websiteId),m=_(u=>u.websiteURL)(),p=P(u=>u.cookiePolicyDetails),{mutate:k,isPending:b}=Te(),h=((t=(y=p==null?void 0:p.preferredLanguages)==null?void 0:y.find(u=>u.code===i))==null?void 0:t.name)||i||"",o=()=>{i&&i&&k({policy_type:"cpg",is_draft:!1,has_published:!0,language_code:i}
16,{onSuccess:()=>{l.invalidateQueries({queryKey:["cookiePolicyDetails","cpg",f()]}),n()}})};return e.jsx(Le,{isOpen:c,config:{title:s("cookiePolicy.deleteLanguageModal.title",{languageName:h}),description:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"block mb-1",children:e.jsx(O,{i18nKey:s("cookiePolicy.deleteLanguageModal.description"),values:{languageName:h,websiteURL:m},components:{bold:e.jsx("span",{className:"font-semibold"})}})}),e.jsx("span",{className:"block",children:s("cookiePolicy.deleteLanguageModal.description2")})]}),confirmText:s("cookiePolicy.deleteLanguageModal.confirmText"),cancelText:s("cookiePolicy.deleteLanguageModal.cancelText")},isLoading:b,onConfirm:o,onCancel:n,confirmButtonVariant:"danger"})}function qs(){const{t:c}=U(),[i,n]=r.useState(null),[s,l]=r.useState(new Set),[f,m]=r.useState(!1),[p,k]=r.useState(null),[b,h]=r.useState(!1),o=_(a=>a.websiteId)(),y=P(a=>a.isEditMode),t=P(a=>a.setIsEditMode),u=P(a=>a.cookiePolicyDetails),v=P(a=>a.getAvailableLanguages()),j=P(a=>a.currentLanguage),w=P(a=>a.defaultLanguage),g=v.find(a=>a.code===w),C=(u==null?void 0:u.preferredLanguages)??[g],D=P(a=>a.setCurrentLanguage),T=P(a=>a.getContent(j)),{refetch:B}=se({policy_type:"cpg",website_id:o});r.useEffect(()=>{j&&!i&&n(j)},[j,i]);const q=(()=>{if(!T)return[];const a=[];return Object.entries({about_cookies_title:"about_cookies_title",about_cookies_description:"about_cookies_description",use_of_cookies_title:"use_of_cookies_title",use_of_cookies_description:"use_of_cookies_description",types_of_cookies_title:"types_of_cookies_title",cookie_preferences_title:"cookie_preferences_title",cookie_preferences_description:"cookie_preferences_description"}).forEach(([S,oe])=>{const H=T[S];(!H||typeof H=="string"&&(H.trim()===""||H.startsWith("<p><br></p>")))&&a.push(oe)}),a})(),K=(a,N)=>a.isDefault?-1:N.isDefault?1:0,x=C&&C.length>0?C.map(a=>{var N;return{lang:a.name,code:a.code,isDefault:a.code===(u==null?void 0:u.defaultLanguage),isCurrent:a.code===j,isEdited:(N=u==null?void 0:u.content[a.code])==null?void 0:N.has_edited,isClicked:s.has(a.code)}}).sort(K):[],M=a=>{D(a),n(a),l(N=>new Set([...N,a])),t(!1),h(!1)},E=(a,N)=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),M(N))};return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("hr",{className:"border-gray-light"}),e.jsx("div",{className:"px-6 py-3 flex items-center gap-4",children:x.map(a=>e.jsxs("div",{className:"flex items-stretch gap-1",children:[e.jsxs("button",{className:`font-medium p-3 rounded-md text-md text-dark flex items-center gap-2 cursor-pointer relative ${a.isCurrent?"bg-sidebar-active":"bg-gray-lightest"}`,"aria-label":`Select ${a.lang} language`,onClick:()=>M(a.code??""),onKeyDown:N=>E(N,a.code??""),children:[e.jsx(G,{width:20,height:20,svgColor:a.isCurrent?"primary":"gray-border"}),a.lang,a.isEdited&&!a.isDefault&&!a.isClicked&&e.jsx("div",{className:"absolute top-[-4px] right-[-4px] w-[10px] h-[10px] bg-primary rounded-full"})]}),a.isCurrent&&e.jsxs(De,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx("div",{className:`rounded-md flex items-center justify-center p-3 cursor-pointer ${i===a.code?"cursor-pointer bg-sidebar-active":"cursor-not-allowed bg-gray-lightest"}`,children:e.jsx(js,{strokeWidth:1.5,size:20,className:"text-secondary-dark","data-testid":"chevron-down"})})}),e.jsx(Ie,{align:"end",sideOffset:4,className:"min-w-38",children:e.jsxs(Cs,{children:[e.jsx(Z,{className:Ns("text-md text-secondary-dark",{"font-semibold":b}),onClick:()=>{t(!0),h(!0)},children:c("cookiePolicy.policyEdit")}),i===a.code&&!a.isDefault&&e.jsx(Z,{className:"text-md text-danger",onClick:()=>{k(a.code),m(!0),h(!1)},children:c("cookiePolicy.policyDelete")})]})})]})]},a.code))}),e.jsx("hr",{className:"border-gray-light"})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:y?e.jsx(zs,{emptyFields:q,"data-testid":"edit-policy"}):e.jsx(vs,{"data-testid":"policy-preview-section"})}),e.jsx(Gs,{isOpen:f,languageCode:p,onClose:()=>m(!1)}),y&&e.jsx(Es,{isEditMode:y,refetchCookiePolicyDetails:B,onExitEditMode:()=>h(!1)})]})}const lo=_s("/cookie-policy/preview")({component:Ys});function Ys(){const{t:c}=U(),i=ee(),n=ws();Ms();const s=_(x=>x.websiteURL)(),l=_(x=>x.websiteId)(),f=P(x=>x.hasCopiedCode()),{data:m,isLoading:p}=se({policy_type:"cpg",website_id:l,source:"published"}),[k,b]=r.useState(!1),[h,o]=r.useState(!1),[y,t]=r.useState(!1),[u,v]=r.useState(""),[j,w]=r.useState(),g=r.useRef(!1),C=r.useRef(!1),D=()=>{b(!1),w(void 0)},T=Ss(x=>x.isLoadedFromWix),{mutate:B,isPending:A}=Te();r.useEffect(()=>{const x=new URLSearchParams(window.location.search),M=x.get("success"),E=x.get("regenerate"),a=x.get("fromCpgLogin"),N=m==null?void 0:m.type;if(!p&&N&&["template","draft"].includes(N)&&i({to:"/cookie-policy/language-settings",...a==="true"?{search:{fromCpgLogin:"true"}}:{}}),M==="true"&&!g.current){g.current=!0;let S="";E==="true"&&!f?S="cookiePolicy.regenerateSuccess":E==="true"&&f?S="cookiePolicy.regenerateSuccessCodeCopied":E==="false"&&(S="cookiePolicy.generateSuccess"),S&&pe.success(e.jsx(O,{i18nKey:S,values:{websiteURL:s},components:{bold:e.jsx("span",{className:"font-semibold"})}}),{className:`!bg-[#b3ded0] !text-[#14142a] !border-[#b3ded0] !rounded ${T?"!min-w-200":"!min-w-300"}`,icon:e.jsx(ke,{className:"w-5 h-5",color:"#00754E"}),...S==="cookiePolicy.generateSuccess"&&{duration:3e3}}),i({to:"/cookie-policy/preview",replace:!0})}},[c,i,s,f,m==null?void 0:m.type,p,T]),r.useEffect(()=>{if(C.current)return;const x=new URLSearchParams(n.search);if(x.get(be)!==Pe)return;C.current=!0,w(Pe),b(!0),x.delete(be);const M=x.toString(),E=n.pathname+(M?`?${M}`:"")+(n.hash||"");globalThis.history.replaceState({},"",E)},[n.search,n.pathname,n.hash]);const q=()=>{B({policy_type:"cpg",is_draft:!1,has_published:!0},{onSuccess:()=>{pe.success(e.jsx(O,{i18nKey:"cookiePolicy.publishChangesSuccess",values:{websiteURL:s,language:"English"},components:{bold:e.jsx("span",{className:"font-semibold"})}}),{className:`!bg-[#b3ded0] !text-[#14142a] !border-[#b3ded0] !rounded ${T?"!min-w-200":"!min-w-300"}`,icon:e.jsx(ke,{className:"w-5 h-5",color:"#00754E"})})}})},K=()=>{o(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-[calc(100vh-96px)]",children:[e.jsxs("div",{className:"flex-shrink-0 p-6 flex justify-between items-center",children:[e.jsx("h6",{className:"text-2xl font-semibold font-heading text-secondary-dark",children:c("cookiePolicy.preview.title")}),e.jsxs("div",{className:"flex items-center gap-1",children:[f&&e.jsxs(F,{variant:"success",className:`font-medium mr-4 ${A?"opacity-50 cursor-not-allowed":""}`,onClick:q,disabled:A,children:[c("cookiePolicy.preview.publishChanges"),A&&e.jsx(Ls,{className:"w-4 h-4"})]}),e.jsxs(z,{open:k,onOpenChange:x=>{x?b(!0):D()},children:[e.jsx(Se,{asChild:!0,children:f?e.jsxs(F,{variant:"outline-primary",className:"font-medium hover:bg-transparent hover:text-primary",children:[c("cookiePolicy.preview.copyCode"),e.jsx("img",{src:"/images/icons/code-snippet.svg",alt:"code-snippet",className:"w-4 h-4 ml-2"})]}):e.jsx(F,{variant:"success",className:"font-medium",children:c("cookiePolicy.preview.addPolicyToSite")})}),e.jsx(Bs,{open:k,initialOption:j,onClose:D,onPublishSuccess:x=>{D(),v(x),t(!0)}})]}),e.jsx(Fe,{open:y,onClose:()=>{t(!1),v("")},publishedPageUrl:u}),e.jsxs(De,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(F,{variant:"link",className:"font-medium",children:e.jsx(Is,{size:20,className:"text-secondary-dark"})})}),e.jsxs(Ie,{align:"end",sideOffset:8,alignOffset:8,className:"min-w-38",children:[e.jsx(Z,{className:"text-md text-secondary-dark",onClick:()=>i({to:"/cookie-policy/language-settings"}
16),children:c("cookiePolicy.preview.editCookiePolicy")}),e.jsx(Z,{className:"text-md text-danger",onClick:K,children:c("cookiePolicy.preview.deleteCookiePolicy")})]})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(qs,{})})]}),e.jsx(z,{open:h,onOpenChange:o,children:e.jsx(Ks,{open:h,onOpenChange:o})})]})}export{lo as Route,Ys as RouteComponent};

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.