"use strict";(globalThis.webpackChunkhelpgent=globalThis.webpackChunkhelpgent||[]).push([[975],{13475:(e,t,n)=>{n.d(t,{A:()=>a}),n(51609);const a="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxNy45OTkiIHZpZXdCb3g9IjAgMCAxOCAxNy45OTkiPgogIDxwYXRoIGlkPSJyb2NrZXQtbHVuY2giIGQ9Ik0zLjk3NiwxNC4wMjZhMS44LDEuOCwwLDAsMSwwLDIuNTQ2LDkuNiw5LjYsMCwwLDEtMy4xNTksMS40MS42NjUuNjY1LDAsMCwxLS44LS43OTQsOS42LDkuNiwwLDAsMSwxLjQwOC0zLjE2MSwxLjgsMS44LDAsMCwxLDIuNTUsMFpNMTIuMDM1LDEzLjIxWk00LjY5Myw2LjFoMEM0LjcxOCw2LjA3LDQuNzA1LDYuMDg3LDQuNjkzLDYuMVptOC44MDguMjcxQTEuODc1LDEuODc1LDAsMSwwLDExLjYyNiw4LjI1LDEuODc1LDEuODc1LDAsMCwwLDEzLjUsNi4zNzVabS0xLjQ4Miw2Ljg0Ny4wMDYsMGE5LjA4LDkuMDgsMCwwLDEtLjYxNywxLjU4Myw2LjUzNSw2LjUzNSwwLDAsMS0yLjg4NiwzLjA1M0ExLjgyLDEuODIsMCwwLDEsNiwxNi4xNjZWMTQuMjUxQTIuMjYxLDIuMjYxLDAsMCwwLDMuNzUxLDEySDEuNzk0QTEuNzgsMS43OCwwLDAsMSwuMTQ0LDkuNTM1LDYuMzg5LDYuMzg5LDAsMCwxLDMuMTMsNi43MTMsOC45MTEsOC45MTEsMCwwLDEsNC42OTMsNi4xYy0uMDEyLjAxNy0uMDIzLjAzMywwLDBDNy41NjcsMi4xLDEwLjg1My4xMjgsMTUuMzQ1LDBBMi42MzUsMi42MzUsMCwwLDEsMTgsMi42MjVjLS4xMjgsNC41MjQtMS45NjksNy43Mi01Ljk3NiwxMC41OTNaTTE1Ljc1MSwyLjU5NGEuMzcuMzcsMCwwLDAtLjM3NS0uMzQ0Yy0zLjc3Ny4xMDgtNi4yMjUsMS41LTguNzA5LDQuOTYxYTIxLjAyOSwyMS4wMjksMCwwLDAtMS42MTUsMi43M0E0LjUxNCw0LjUxNCwwLDAsMSw4LjA0LDEyLjg4M2wxLjYyMi0uODA3Yy4zOC0uMjI1Ljc2NC0uNDc2LDEuMTI5LS43MzdDMTQuMjUxLDguODUsMTUuNjQzLDYuNCwxNS43NTEsMi41OTRaTTEyLjAyNSwxMy4yMThsLjAwOC0uMDA1LS4wMDcuMDA1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTAuMDAxIDApIiBmaWxsPSIjZmZmIi8+Cjwvc3ZnPgo="},19348:(e,t,n)=>{n.d(t,{A:()=>a}),n(51609);const a="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0LjU1MiIgaGVpZ2h0PSI4IiB2aWV3Qm94PSIwIDAgNC41NTIgOCI+CiAgPHBhdGggaWQ9ImFycm93IiBkPSJNNCw5Ny4xNDFhLjU1OS41NTksMCwwLDAtLjQuMTY0bC0zLjQ0LDMuNDM0YS41Ni41NiwwLDAsMCwuNzkyLjc5MUw0LDk4LjQ5bDMuMDQ0LDMuMDM4YS41Ni41NiwwLDAsMCwuNzkyLS43OTFMNC40LDk3LjNBLjU1OS41NTksMCwwLDAsNCw5Ny4xNDFaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMDEuNjkyIC0wLjAwMSkgcm90YXRlKDkwKSIgZmlsbD0iIzZlNmU2ZSIvPgo8L3N2Zz4K"},25975:(e,t,n)=>{n.r(t),n.d(t,{default:()=>T});var a=n(51609),l=n(63064),c=n(64197),s=n(90484),i=n(86087),r=n(84941),g=n(28050),o=n(27723);function u(e){const{moduleState:t,baseApiRoute:n}=e,{guestCsvList:l,guestList:c}=t,{mutateAsync:s,isLoading:u}=(0,g.A)(`${n.contact}/export`);return(0,a.createElement)(i.Fragment,null,(0,a.createElement)("div",{className:"helpgent-crud-header helpgent-d-flex"},(0,a.createElement)("div",{className:"helpgent-crud-header__left"},(0,a.createElement)("h4",{className:"h4 helpgent-crud-header__title"},(0,o.__)("All Contacts","helpgent")),0===l.length?(0,a.createElement)("a",{href:"#",className:"helpgent-crud-header__add-btn helpgent-btn helpgent-btn-dark "+(c&&0!==c.length&&!u?"":"helpgent-btn-disabled"),onClick:e=>async function(e){e.preventDefault();try{const e=await s(),t=document.createElement("a");t.href=e.csv_path,t.download="helpgent-guest-list.csv",t.click()}catch(e){console.log(e)}}(e)},(0,o.__)("Export Guests","helpgent")):(0,a.createElement)(r.CSVLink,{className:"helpgent-crud-header__add-btn helpgent-btn helpgent-btn-dark "+(u?"helpgent-btn-disabled":""),filename:"helpgent-guest-list.csv",data:l},(0,o.__)("Export Guests","helpgent")))))}function p(){return(0,a.createElement)("div",{className:"helpgent-crud-header helpgent-d-flex"},(0,a.createElement)("div",{className:"helpgent-crud-header__left"},(0,a.createElement)("h4",{className:"h4 helpgent-crud-header__title"},(0,o.__)("All Contacts","helpgent"))))}var h=n(65604),m=n(64943),d=n(4286),L=n(38267);const M=L.Ay.div`
    .helpgent-table-contact-email,
    .helpgent-table-contact-company,
    .helpgent-table-contact-number{
        width: 200px;
    }
    .helpgent-table-contact-id{
        width: 35px;
    }
    .helpgent-table-contact-select{
        width: 35px;
    }
   .helpgent-pagination{
        margin-top: 18px;
        padding-top: 40px;
        border-top: 1px solid var(--helpgent-color-bg-light);
        justify-content: center;
    }
    .helpgent-contact-created{
        font-weight: 400;
        color: var(--helpgent-color-gray);
    }
    .helpgent-table tbody tr td{
        color: var(--helpgent-color-gray);
    }
`,N=L.Ay.div`
    .helpgent-pro-content{
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        text-align: center;
        max-width: 420px;
        margin: 0 auto;
        padding: 60px 0;
        .helpgent-pro-content__title{
            font-size: 22px;
            font-weight: 600;
            margin-top: 12px;
            color: var(--helpgent-color-dark);
        }
        .helpgent-pro-content__text{
            font-size: 15px;
            font-weight: 400;
            margin: 14px 0 20px;
            line-height: 1.5;
            color: var(--helpgent-color-gray);
        }
    }
    .helpgent-badge{
        padding: 2px 6px;
    }
`;var w=n(23371),E=n(68357),C=n(49764),D=n.n(C),A=n(71241),x=n(19348),b=n(93832);function _(e){const{moduleState:t,setModuleState:n,baseApiRoute:c}=e,{isAllChecked:s,guestCheckedCheckboxes:r,guestCsvList:g,guestListPage:u}=t,p=(0,l.jE)(),L={per_page:15,page:u},{data:N,isLoading:C,isError:_,errorMessage:j,isFetching:y}=(0,m.A)([`helpgent-guest-list-${u}`],(0,b.addQueryArgs)(c?.contact,L));return(0,i.useEffect)(()=>{let e=[];if(!C)for(let a=0;a<N.guests.length;a++)e.push(!1),n({...t,guestCheckedCheckboxes:e,guestCsvList:[],guestList:N?.guests})},[N]),(0,i.useEffect)(()=>{0===r.filter(e=>!1===e).length&&0!==r.length?n(e=>({...e,isAllChecked:!0})):n(e=>({...e,isAllChecked:!1}))},[r]),(0,a.createElement)(M,null,(0,a.createElement)(d.BI,{className:"helpgent-table"},(0,a.createElement)("thead",null,(0,a.createElement)("tr",null,(0,a.createElement)("th",{className:"helpgent-table-contact-select"},(0,a.createElement)(w.A,{id:"helpgent-checked-all",disabled:0===N?.guests?.length,onChange:function(){const e=!s,a=Array(N.guests.length).fill(e);n({...t,guestCsvList:e?N.guests:[],isAllChecked:e,guestCheckedCheckboxes:a})},checked:s})),(0,a.createElement)("th",{className:"helpgent-table-contact-id"},(0,o.__)("ID","helpgent")),(0,a.createElement)("th",{className:"helpgent-table-contact-name"},(0,o.__)("Name","helpgent")),(0,a.createElement)("th",{className:"helpgent-table-contact-email"},(0,o.__)("Email Address","helpgent")),(0,a.createElement)("th",{className:"helpgent-table-contact-number"},(0,o.__)("Phone Number","helpgent")),(0,a.createElement)("th",{className:"helpgent-table-contact-company"},(0,o.__)("Company","helpgent")))),(0,a.createElement)("tbody",null,C&&(0,a.createElement)("tr",null,(0,a.createElement)("td",{colSpan:8},(0,a.createElement)(E.A,null)," ")),!C&&0===N.guests.length&&(0,a.createElement)("tr",null,(0,a.createElement)("td",{colSpan:8}," ",(0,a.createElement)("span",{className:"helpgent-empty-data"},(0,o.__)("Contact not found","helpgent"))," ")),!C&&N.guests.map((e,l)=>(0,a.createElement)("tr",{key:l},(0,a.createElement)("td",null,(0,a.createElement)(w.A,{id:`helpgent-checkbox-contact-${e.id}`,onChange:a=>function(e,a){const l=[...r];l[e]=!r[e];const c=r[e]?g.filter(e=>e.id!==a):[...g,N.guests.find(e=>e.id===a)];n({...t,guestCsvList:c,isAllChecked:!1,guestCheckedCheckboxes:l})}(l,e.id),checked:!!r[l]})),(0,a.createElement)("td",null,"# ",e.id),(0,a.createElement)("td",null,e.name),(0,a.createElement)("td",null,e.email),(0,a.createElement)("td",null,e.number),(0,a.createElement)("td",null,e.company))))),N&&N.total>15&&(0,a.createElement)(d.MK,null,(0,a.createElement)(D(),{breakLabel:"...",onPageChange:function(e){n({...t,guestListPage:e.selected+1}),p.invalidateQueries([`helpgent-guest-list-${u}`])},nextLabel:(0,a.createElement)(h.A,{src:x.A}),previousLabel:(0,a.createElement)(h.A,{src:A.A}),pageRangeDisplayed:3,pageCount:Math.ceil(N.total/15),previousClassName:"helpgent-pagination__item",previousLinkClassName:"helpgent-pagination__link helpgent-pagination__control",nextClassName:"helpgent-pagination__item",nextLinkClassName:"helpgent-pagination__link helpgent-pagination__control",containerClassName:"helpgent-pagination",pageClassName:"helpgent-pagination__item",pageLinkClassName:"helpgent-pagination__link",activeLinkClassName:"helpgent-pagination__active",renderOnZeroPageCount:null})))}var j=n(13475),y=n(88869);function k(){return(0,a.createElement)(N,null,(0,a.createElement)("div",{className:"helpgent-pro-content"},(0,a.createElement)(y.Badge,{type:"success",text:"PRO",modifier:"helpgent-badge-extended"}),(0,a.createElement)("span",{className:"helpgent-pro-content__title"},(0,o.__)("Lead Collection is a Pro Feature","helpgent")),(0,a.createElement)("span",{className:"helpgent-pro-content__text"},(0,o.__)("We are sorry lead collection is not available on your plan. Please upgrade to unlock this awesome feature.","helpgent")),(0,a.createElement)("a",{className:"helpgent-btn helpgent-btn-primary",href:"https://wpwax.com/helpgent/pricing"}," ",(0,a.createElement)(h.A,{src:j.A})," ",(0,o.__)("Upgrade Now To Get Access","helpgent"))))}var S=n(52619);function I(e){const{tabs:t,activeTab:n,setActiveTab:l}=e;return(0,a.createElement)(d.I3,null,Object.keys(t).map(e=>{const c=t[e];return(0,a.createElement)("div",{key:e,className:"helpgent-tab-single "+(n===e?"helpgent-active":""),onClick:()=>(e=>{l(e)})(e)},c.title)}))}const v=e=>{const{baseApiRoute:t}=e,[n,l]=(0,i.useState)({isAllChecked:!1,guestCheckedCheckboxes:[],guestListPage:1,guestCsvList:[],guestList:[],isContactExportEnabled:!1});return(0,a.createElement)(s.A,{headerChild:(0,a.createElement)(u,{moduleState:n,setModuleState:l,baseApiRoute:t}),headerBottom:(0,S.applyFilters)("contact_page_header_bottom"),mainChild:(0,a.createElement)(_,{moduleState:n,setModuleState:l,baseApiRoute:t})})},f=e=>{const{baseApiRoute:t}=e,[n,l]=(0,i.useState)("guest"),c=(0,S.applyFilters)("helpgent_contact_page_tabs",{guest:{title:(0,o.__)("Guest","helpgent"),component:function(){return(0,a.createElement)(v,{baseApiRoute:t})}},lead:{title:(0,o.__)("Lead","helpgent"),component:function(){return(0,a.createElement)(s.A,{headerChild:(0,a.createElement)(p,null),headerBottom:(0,S.applyFilters)("contact_page_header_bottom"),mainChild:(0,a.createElement)(k,null)})}}});(0,S.addFilter)("contact_page_header_bottom","helpgent",function(){return(0,a.createElement)(I,{tabs:c,activeTab:n,setActiveTab:l})});const r=c[n].component;return(0,a.createElement)(r,null)};function T(e){return(0,a.createElement)(l.Ht,{client:c.A},(0,a.createElement)(f,{...e}))}},64197:(e,t,n)=>{n.d(t,{A:()=>a});const a=new(n(5054).E)},64943:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(9421),l=n(68360),c=n(90212);function s(e,t,n){const{data:s,isLoading:i,error:r,isError:g,isFetching:o,isSuccess:u,isRefetching:p}=(0,a.I)(e,async()=>{const e=await(0,l.A)(t,n?.parser||{});return n&&"function"==typeof n.afterLoadedData&&n.afterLoadedData(e),e},n?.queryConfig||{refetchOnWindowFocus:!1,keepPreviousData:!0,staleTime:1e4});return{data:r||i?null:s,isLoading:i,errorMessage:r?(0,c.A)(r?r?.data?.status:""):"",isError:!!g,isFetching:o,isSuccess:u,isRefetching:p}}},68357:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(51609),l=n(4286);function c({style:e}){const t={minHeight:"500px",maxHeight:"550px"};return e=e?{...t,...e}:t,(0,a.createElement)(l.vY,{style:e,className:"helpgent-content-loading"},(0,a.createElement)("span",{className:"helpgent-shimmer-effect"}),(0,a.createElement)("span",{className:"helpgent-shimmer-effect"}),(0,a.createElement)("span",{className:"helpgent-shimmer-effect"}))}},68360:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1455),l=n.n(a);async function c(e,t){return await l()({path:e,...t}).then(e=>e).catch(e=>{throw e})}},71241:(e,t,n)=>{n.d(t,{A:()=>a}),n(51609);const a="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0LjU1MiIgaGVpZ2h0PSI4IiB2aWV3Qm94PSIwIDAgNC41NTIgOCI+CiAgPHBhdGggaWQ9ImFycm93IiBkPSJNNCwwYS41NTkuNTU5LDAsMCwwLS40LjE2NEwuMTY0LDMuNmEuNTYuNTYsMCwwLDAsLjc5Mi43OTFMNCwxLjM1LDcuMDQ0LDQuMzg4QS41Ni41NiwwLDAsMCw3LjgzNiwzLjZMNC40LjE2NEEuNTU5LjU1OSwwLDAsMCw0LDBaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDgpIHJvdGF0ZSgtOTApIiBmaWxsPSIjNmU2ZTZlIi8+Cjwvc3ZnPgo="},90212:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(27723);function l(e){let t="";switch(e){case 404:t=(0,a.__)("Resource not found","helpgent");break;case 400:t=(0,a.__)("Invalid Request","helpgent");break;case 422:t=(0,a.__)("Invalid data","helpgent");break;case 500:t=(0,a.__)("Internal server error","helpgent");break;default:t=(0,a.__)("Technical error","helpgent")}return t}},90484:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(51609),l=n(4286);function c(e){const{headerChild:t,headerBottom:n,mainChild:c}=e;return(0,a.createElement)(l.WM,{className:"helpgent-page-inner"},(0,a.createElement)("header",{className:"helpgent-crud-header"},t,n),(0,a.createElement)("main",{className:"helpgent-crud-main"},c))}}}]);