1import{r as o,j as e,a8 as T,a9 as k,R as v,u as $,h as A,aa as U,p as b,X as f,f as L,ab as F,ac as B,ad as G}from"./index-DixATX_x.js";import H from"./index-CSs3KgI2.js";import{B as S}from"./index-C0mpele2.js";import"./index-CSRbtWnK.js";import"./index-CNS4OU2R.js";import"./slick-theme-B8H7jiE8.js";import"./index-grASQK9G.js";import"./index-BD4GlYHO.js";import"./index-BH3cj0qD.js";import"./index-i4IGLwbQ.js";import"./datetime-C21O7RRc.js";import"./ym-DmpKxSHf.js";import"./index-Dc1rqARH.js";import"./config-DcZQEH1j.js";import"./index-MUsqGyhf.js";import"./AddVideoModal-DxqLuw0o.js";import"./index-BneJc5A0.js";import"./index-C4QGiSbN.js";import"./linkForUserType-C2gTV2do.js";import"./index-C0ELQW0-.js";import"./newsListNavIcons-Ciw2zAMj.js";import"./index-YKXzadLP.js";import"./index-Bimi17Wd.js";import"./free-mode-Bh-_7t-f.js";import"./index-BuOT5f_8.js";import"./index-CTFBMEGO.js";const W="/assets/SENSE_GROUP_Consent_PDN-c2WwwHtW.pdf",J="/assets/SENS_GROUP_Personal_Data_Processing_Policy-BevX509l.pdf",X=({isOpen:a,isLoading:r,onAccept:c,onDecline:l,onClose:s})=>e.jsx(T,{className:"integration-consent-modal",icon:e.jsx(k,{}),title:"ÐнÑоÑмаÑивное ÑообÑение",isOpen:a,onClose:s,children:e.jsxs("div",{className:"integration-consent-modal__content",children:[e.jsx("p",{className:"integration-consent-modal__greeting",children:"УважаемÑй полÑзоваÑелÑ!"}),e.jsxs("p",{className:"integration-consent-modal__text",children:["ÐÐ»Ñ Ð¿ÑÐ¾Ð´Ð¾Ð»Ð¶ÐµÐ½Ð¸Ñ ÑабоÑÑ Ð½Ð° поÑÑале Pawly",e.jsx("br",{}),"Ðам необÑ
одимо даÑÑ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ
даннÑÑ
ÑÑим внеÑним ÑеÑÑÑÑом."]}),e.jsxs("p",{className:"integration-consent-modal__text integration-consent-modal__text--consent-note",children:["ÐÐ°Ð¶Ð¸Ð¼Ð°Ñ ÐºÐ½Ð¾Ð¿ÐºÑ Â«ÐÑедоÑÑавиÑÑ», Ð²Ñ ÑазÑеÑаеÑе ÑÑой оÑганизаÑии",e.jsx("br",{}),"иÑполÑзоваÑÑ ÑказаннÑе даннÑе ÑоглаÑно ÑÑловиÑм"," ",e.jsxs("a",{href:W,target:"_blank",rel:"noopener noreferrer",children:["ÐолÑзоваÑелÑÑкого ",e.jsx("wbr",{})," ÑоглаÑениÑ"]})," ","и"," ",e.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:"ÐолиÑики конÑиденÑиалÑноÑÑи."})]}),e.jsxs("div",{className:"integration-consent-modal__actions",children:[e.jsx(S,{secondary:!0,disabled:r,onClick:l,children:"ÐÑмениÑÑ"}),e.jsx(S,{primary:!0,disabled:r,loading:r,onClick:c,children:"ÐÑедоÑÑавиÑÑ"})]})]})}),q=o.memo(X),z=({isOpen:a,text:r,onOk:c,onClose:l})=>e.jsx(T,{className:"pdn-not-confirmed-modal",icon:e.jsx(k,{}),title:"ÐнÑоÑмаÑивное ÑообÑение",isOpen:a,onClose:l,children:e.jsxs("div",{className:"pdn-not-confirmed-modal__content",children:[e.jsx("p",{className:"pdn-not-confirmed-modal__greeting",children:"УважаемÑй полÑзоваÑелÑ!"}),e.jsx("p",{className:"pdn-not-confirmed-modal__text",children:r}),e.jsx("div",{className:"pdn-not-confirmed-modal__actions",children:e.jsx(S,{primary:!0,onClick:c,children:"Ðк"})})]})}),K=o.memo(z),Q=a=>{const r=new URLSearchParams(a),c=r.get("id"),l=r.get("type"),s=r.get("url"),_=r.get("source");let g="";try{g=s?new URL(s).hostname:""}catch{g=""}return!c||!l||!s||!_?null:{client_id:c,response_type:l,redirect_url:s,source_url:_,hostNameRedirectUrl:g}},V=({isAuthenticated:a,helpdesk_api_key:r,mail:c,name:l,enqueueSnackbar:s,locationSearch:_})=>{const[g,x]=o.useState(!1),[p,w]=o.useState(!1),[R,i]=o.useState(""),[d,j]=o.useState(!1),P=o.useRef(!1),m=o.useRef(!1);o.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]);const t=o.useMemo(()=>Q(_),[_]);o.useEffect(()=>{P.current=!1,m.current&&(x(!1),w(!1),i(""),j(!1))},[_]);const I=n=>n?t?.source_url?n.replace("http://petservice.stage.uep24.ru",t.source_url):n:"",D=n=>{const u=n?.response?.data;return u?.errors?Object.prototype.hasOwnProperty.call(u.errors,"pdn_not_confirmed"):!1},C=n=>{const u=n?.response?.data?.errors?.pdn_not_confirmed;return typeof u=="string"?u.trim():""},y=n=>{if(n?.need_consent===!0){m.current&&x(!0);return}if(n?.need_consent===!1&&n?.redirect_url){window.location.replace(I(n.redirect_url));return}s("Ðе ÑдалоÑÑ Ð¿ÑодолжиÑÑ Ð²Ð½ÐµÑнÑÑ Ð°Ð²ÑоÑизаÑиÑ.",{variant:"error"})},M=async()=>{t&&await v({url:"/api/Authentication/integration/allow",method:"POST",data:JSON.stringify({client_id:t.client_id,response_type:t.response_type,redirect_url:t.redirect_url,source_url:t.source_url})},y,n=>{if(D(n)){const u=C(n);if(!u){s("ÐÑибка пÑи вÑполнении внеÑней авÑоÑизаÑии.",{variant:"error"});return}m.current&&(x(!1),i(u),w(!0));return}s("ÐÑибка пÑи вÑполнении внеÑней авÑоÑизаÑии.",{variant:"error"})})},N=async n=>{t&&(m.current&&j(!0),await v({url:"/api/Authentication/integration/allow/decision",method:"POST",data:JSON.stringify({client_id:t.client_id,response_type:t.response_type,redirect_url:t.redirect_url,source_url:t.source_url,decision:n})},y,()=>{window.location.replace("/")}),m.current&&j(!1))};o.useEffect(()=>{!a||!t||P.current||t.hostNameRedirectUrl!=="info.rkf.online"&&(P.current=!0,M())},[a,t]);const h=a&&t?.hostNameRedirectUrl==="info.rkf.online";return o.useEffect(()=>{if(!(!h||!t))if(r){const n=t.redirect_url;window.location.replace(`${n}?t=${r}&e=${c}&n=${l}`)}else{s("ÐÐµÑ ÐºÐ»ÑÑа Ð´Ð»Ñ Ð°Ð²ÑоÑизаÑии на info.rkf.online",{variant:"error"});const n=setTimeout(()=>{window.location.replace(t.redirect_url)},5e3);return()=>{clearTimeout(n)}}},[h,t,r,c,l,s]),{isIntegrationFlow:!!(a&&t),hasIntegrationParams:!!t,isInfoRkfOnlineFlow:h,isConsentModalOpen:g,isPdnModalOpen:p,isDecisionLoading:d,pdnErrorText:R,onAcceptDecision:()=>N(!0),onDeclineDecision:()=>N(!1),onPdnOk:()=>window.location.replace("/")}},Y=()=>{const[a,r]=o.useState(!0),[c,l]=o.useState(1),s=$(),_=A(),{enqueueSnackbar:g}=U(),{isAuthenticated:x,is_active_profile:p,helpdesk_api_key:w,user_info:R}=b(O=>O.authentication),{alias:i,user_type:d,name:j,mail:P}=R||{},{isIntegrationFlow:m,hasIntegrationParams:t,isInfoRkfOnlineFlow:I,isConsentModalOpen:D,isPdnModalOpen:C,isDecisionLoading:y,pdnErrorText:M,onAcceptDecision:N,onDeclineDecision:h,onPdnOk:n}=V({isAuthenticated:x,helpdesk_api_key:w,mail:P,name:j,enqueueSnackbar:g,locationSearch:_.search}),u=O=>{l(O),s.replace(O===1?B:G)},E=()=>{r(!1),s.push("/")};return I?null:x&&m?e.jsxs(e.Fragment,{children:[e.jsx(q,{isOpen:D,isLoading:y,onAccept:N,onDecline:h,onClose:h}),e.jsx(K,{isOpen:C,text:M,onOk:n,onClose:n})]}):x?!p&&d===3?e.jsx(f,{to:"/not-confirmed"}):!p&&d===4?e.jsx(f,{to:"/kennel/activation"}):p&&d===0&&i==="rkf-online"?e.jsx(f,{to:`/club/${i}`}):p&&d===0?e.jsx(f,{to:`/${i}`}):d===1?e.jsx(f,{to:`/user/${i}`}):p&&d===3&&i!=="rkf"?e.jsx(f,{to:`/club/${i}`}):p&&d===4?e.jsx(f,{to:`/kennel/${i}`}):p&&(d===5||i==="rkf")?e.jsx(f,{to:`/${i}`}):d===7?e.jsx(f,{to:`/nbc/${i}`}):e.jsx(f,{to:"/"}):e.jsxs(L,{children:[e.jsx(H,{}),e.jsx(F,{isOpen:a,formType:c,setFormType:u,isIntegrationAuth:t,onClose:()=>r(!1),onDismiss:E})]})},Re=o.memo(Y);export{Re as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.