From b9f1e6a1eecb3abdd9159996e14f2bdf94212b46 Mon Sep 17 00:00:00 2001 From: Atiqur Rahman Date: Wed, 22 Mar 2023 15:55:26 +0600 Subject: [PATCH 1/9] added portal plan checker --- includes/views/pages/settings.php | 103 ++++++------ .../views/shortcode/conversation-details.php | 8 +- includes/views/shortcode/conversations.php | 159 +++++++++--------- resources/js/admin.js | 4 + src/Conversations/Conversation.php | 3 + src/Services/PortalService.php | 26 +++ 6 files changed, 176 insertions(+), 127 deletions(-) create mode 100644 src/Services/PortalService.php diff --git a/includes/views/pages/settings.php b/includes/views/pages/settings.php index caf9650..63d2a2a 100755 --- a/includes/views/pages/settings.php +++ b/includes/views/pages/settings.php @@ -1,11 +1,13 @@ +is_allowed_portal_feature(); +?> + \n \n
\n
\n',et='\n \n \n \n \n',tt=(e,t)=>{let o,n=e.innerHTML;t.iconHtml?o=nt(t.iconHtml):"success"===t.icon?(o=Ge,n=n.replace(/ style=".*?"/g,"")):o="error"===t.icon?et:nt({question:"?",warning:"!",info:"i"}[t.icon]),n.trim()!==o.trim()&&F(e,o)},ot=(e,t)=>{if(t.iconColor){e.style.color=t.iconColor,e.style.borderColor=t.iconColor;for(const o of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])oe(e,o,"backgroundColor",t.iconColor);oe(e,".swal2-success-ring","borderColor",t.iconColor)}},nt=e=>`
${e}
`,st=(e,t)=>{const o=B();t.imageUrl?(ee(o,""),o.setAttribute("src",t.imageUrl),o.setAttribute("alt",t.imageAlt),G(o,"width",t.imageWidth),G(o,"height",t.imageHeight),o.className=n.image,W(o,t,"image")):te(o)},at=(e,t)=>{const o=f(),n=v();t.toast?(G(o,"width",t.width),n.style.width="100%",n.insertBefore(j(),x())):G(n,"width",t.width),G(n,"padding",t.padding),t.color&&(n.style.color=t.color),t.background&&(n.style.background=t.background),te($()),it(n,t)},it=(e,t)=>{e.className=`${n.popup} ${se(e)?t.showClass.popup:""}`,t.toast?(X([document.documentElement,document.body],n["toast-shown"]),X(e,n.toast)):X(e,n.modal),W(e,t,"popup"),"string"==typeof t.customClass&&X(e,t.customClass),t.icon&&X(e,n[`icon-${t.icon}`])},rt=(e,t)=>{const o=P();t.progressSteps&&0!==t.progressSteps.length?(ee(o),o.textContent="",t.currentProgressStep>=t.progressSteps.length&&l("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),t.progressSteps.forEach(((e,s)=>{const a=lt(e);if(o.appendChild(a),s===t.currentProgressStep&&X(a,n["active-progress-step"]),s!==t.progressSteps.length-1){const e=ct(t);o.appendChild(e)}}))):te(o)},lt=e=>{const t=document.createElement("li");return X(t,n["progress-step"]),F(t,e),t},ct=e=>{const t=document.createElement("li");return X(t,n["progress-step-line"]),e.progressStepsDistance&&G(t,"width",e.progressStepsDistance),t},dt=(e,t)=>{const o=C();ne(o,t.title||t.titleText,"block"),t.title&&Ce(t.title,o),t.titleText&&(o.innerText=t.titleText),W(o,t,"title")},ut=(e,t)=>{at(e,t),Oe(e,t),rt(e,t),Xe(e,t),st(e,t),dt(e,t),je(e,t),Ze(e,t),Ee(e,t),Ke(e,t),"function"==typeof t.didRender&&t.didRender(v())};function pt(){const t=e.innerParams.get(this);if(!t)return;const o=e.domCache.get(this);te(o.loader),_()?t.icon&&ee(x()):mt(o),J([o.popup,o.actions],n.loading),o.popup.removeAttribute("aria-busy"),o.popup.removeAttribute("data-loading"),o.confirmButton.disabled=!1,o.denyButton.disabled=!1,o.cancelButton.disabled=!1}const mt=e=>{const t=e.popup.getElementsByClassName(e.loader.getAttribute("data-button-to-replace"));t.length?ee(t[0],"inline-block"):ae()&&te(e.actions)};function wt(t){const o=e.innerParams.get(t||this),n=e.domCache.get(t||this);return n?Y(n.popup,o.input):null}const gt=()=>se(v()),ht=()=>E()&&E().click(),ft=()=>S()&&S().click(),bt=()=>T()&&T().click(),yt=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),vt=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},xt=(e,t,o,n)=>{vt(t),o.toast||(t.keydownHandler=t=>Bt(e,t,n),t.keydownTarget=o.keydownListenerCapture?window:v(),t.keydownListenerCapture=o.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)},kt=(e,t)=>{const o=I();if(o.length)return(e+=t)===o.length?e=0:-1===e&&(e=o.length-1),void o[e].focus();v().focus()},Ct=["ArrowRight","ArrowDown"],At=["ArrowLeft","ArrowUp"],Bt=(t,o,n)=>{const s=e.innerParams.get(t);s&&(o.isComposing||229===o.keyCode||(s.stopKeydownPropagation&&o.stopPropagation(),"Enter"===o.key?Pt(t,o,s):"Tab"===o.key?$t(o):[...Ct,...At].includes(o.key)?Et(o.key):"Escape"===o.key&&Tt(o,s,n)))},Pt=(e,t,o)=>{if(m(o.allowEnterKey)&&t.target&&e.getInput()&&t.target instanceof HTMLElement&&t.target.outerHTML===e.getInput().outerHTML){if(["textarea","file"].includes(o.input))return;ht(),t.preventDefault()}},$t=e=>{const t=e.target,o=I();let n=-1;for(let e=0;e{const t=[E(),S(),T()];if(document.activeElement instanceof HTMLElement&&!t.includes(document.activeElement))return;const o=Ct.includes(e)?"nextElementSibling":"previousElementSibling";let n=document.activeElement;for(let e=0;e{m(t.allowEscapeKey)&&(e.preventDefault(),o(yt.esc))};var St={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const Lt=()=>{Array.from(document.body.children).forEach((e=>{e===f()||e.contains(f())||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")),e.setAttribute("aria-hidden","true"))}))},jt=()=>{Array.from(document.body.children).forEach((e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")}))},Ot=()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!R(document.body,n.iosfix)){const e=document.body.scrollTop;document.body.style.top=-1*e+"px",X(document.body,n.iosfix),zt(),Mt()}},Mt=()=>{const e=navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),o=!!e.match(/WebKit/i);if(t&&o&&!e.match(/CriOS/i)){const e=44;v().scrollHeight>window.innerHeight-e&&(f().style.paddingBottom=`${e}px`)}},zt=()=>{const e=f();let t;e.ontouchstart=e=>{t=Ht(e)},e.ontouchmove=e=>{t&&(e.preventDefault(),e.stopPropagation())}},Ht=e=>{const t=e.target,o=f();return!(qt(e)||It(e)||t!==o&&(ie(o)||!(t instanceof HTMLElement)||"INPUT"===t.tagName||"TEXTAREA"===t.tagName||ie(A())&&A().contains(t)))},qt=e=>e.touches&&e.touches.length&&"stylus"===e.touches[0].touchType,It=e=>e.touches&&e.touches.length>1,Dt=()=>{if(R(document.body,n.iosfix)){const e=parseInt(document.body.style.top,10);J(document.body,n.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}},_t=()=>{null===N.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(N.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${N.previousBodyPadding+$e()}px`)},Vt=()=>{null!==N.previousBodyPadding&&(document.body.style.paddingRight=`${N.previousBodyPadding}px`,N.previousBodyPadding=null)};function Nt(e,t,o,n){_()?Qt(e,n):(me(o).then((()=>Qt(e,n))),vt(ue)),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(t.setAttribute("style","display:none !important"),t.removeAttribute("class"),t.innerHTML=""):t.remove(),D()&&(Vt(),Dt(),jt()),Ft()}function Ft(){J([document.documentElement,document.body],[n.shown,n["height-auto"],n["no-backdrop"],n["toast-shown"]])}function Rt(e){e=Kt(e);const t=St.swalPromiseResolve.get(this),o=Wt(this);this.isAwaitingPromise()?e.isDismissed||(Zt(this),t(e)):o&&t(e)}function Ut(){return!!e.awaitingPromise.get(this)}const Wt=t=>{const o=v();if(!o)return!1;const n=e.innerParams.get(t);if(!n||R(o,n.hideClass.popup))return!1;J(o,n.showClass.popup),X(o,n.hideClass.popup);const s=f();return J(s,n.showClass.backdrop),X(s,n.hideClass.backdrop),Xt(t,o,n),!0};function Yt(e){const t=St.swalPromiseReject.get(this);Zt(this),t&&t(e)}const Zt=t=>{t.isAwaitingPromise()&&(e.awaitingPromise.delete(t),e.innerParams.get(t)||t._destroy())},Kt=e=>void 0===e?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},e),Xt=(e,t,o)=>{const n=f(),s=Pe&&re(t);"function"==typeof o.willClose&&o.willClose(t),s?Jt(e,t,n,o.returnFocus,o.didClose):Nt(e,n,o.returnFocus,o.didClose)},Jt=(e,t,o,n,s)=>{ue.swalCloseEventFinishedCallback=Nt.bind(null,e,o,n,s),t.addEventListener(Pe,(function(e){e.target===t&&(ue.swalCloseEventFinishedCallback(),delete ue.swalCloseEventFinishedCallback)}))},Qt=(e,t)=>{setTimeout((()=>{"function"==typeof t&&t.bind(e.params)(),e._destroy()}))};function Gt(t,o,n){const s=e.domCache.get(t);o.forEach((e=>{s[e].disabled=n}))}function eo(e,t){if(e)if("radio"===e.type){const o=e.parentNode.parentNode.querySelectorAll("input");for(let e=0;eObject.prototype.hasOwnProperty.call(ro,e),mo=e=>-1!==lo.indexOf(e),wo=e=>co[e],go=e=>{po(e)||l(`Unknown parameter "${e}"`)},ho=e=>{uo.includes(e)&&l(`The parameter "${e}" is incompatible with toasts`)},fo=e=>{wo(e)&&p(e,wo(e))},bo=e=>{!1===e.backdrop&&e.allowOutsideClick&&l('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const t in e)go(t),e.toast&&ho(t),fo(t)};function yo(t){const o=v(),n=e.innerParams.get(this);if(!o||R(o,n.hideClass.popup))return void l("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const s=vo(t),a=Object.assign({},n,s);ut(this,a),e.innerParams.set(this,a),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}const vo=e=>{const t={};return Object.keys(e).forEach((o=>{mo(o)?t[o]=e[o]:l(`Invalid parameter to update: ${o}`)})),t};function xo(){const t=e.domCache.get(this),o=e.innerParams.get(this);o?(t.popup&&ue.swalCloseEventFinishedCallback&&(ue.swalCloseEventFinishedCallback(),delete ue.swalCloseEventFinishedCallback),"function"==typeof o.didDestroy&&o.didDestroy(),ko(this)):Co(this)}const ko=e=>{Co(e),delete e.params,delete ue.keydownHandler,delete ue.keydownTarget,delete ue.currentInstance},Co=t=>{t.isAwaitingPromise()?(Ao(e,t),e.awaitingPromise.set(t,!0)):(Ao(St,t),Ao(e,t))},Ao=(e,t)=>{for(const o in e)e[o].delete(t)};var Bo=Object.freeze({__proto__:null,_destroy:xo,close:Rt,closeModal:Rt,closePopup:Rt,closeToast:Rt,disableButtons:oo,disableInput:so,disableLoading:pt,enableButtons:to,enableInput:no,getInput:wt,handleAwaitingPromise:Zt,hideLoading:pt,isAwaitingPromise:Ut,rejectPromise:Yt,resetValidationMessage:io,showValidationMessage:ao,update:yo});const Po=e=>{let t=v();t||new Zn,t=v();const o=j();_()?te(x()):$o(t,e),ee(o),t.setAttribute("data-loading","true"),t.setAttribute("aria-busy","true"),t.focus()},$o=(e,t)=>{const o=O(),s=j();!t&&se(E())&&(t=E()),ee(o),t&&(te(t),s.setAttribute("data-button-to-replace",t.className)),s.parentNode.insertBefore(s,t),X([e,o],n.loading)},Eo=(e,t)=>{"select"===t.input||"radio"===t.input?Oo(e,t):["text","email","number","tel","textarea"].includes(t.input)&&(w(t.inputValue)||h(t.inputValue))&&(Po(E()),Mo(e,t))},To=(e,t)=>{const o=e.getInput();if(!o)return null;switch(t.input){case"checkbox":return So(o);case"radio":return Lo(o);case"file":return jo(o);default:return t.inputAutoTrim?o.value.trim():o.value}},So=e=>e.checked?1:0,Lo=e=>e.checked?e.value:null,jo=e=>e.files.length?null!==e.getAttribute("multiple")?e.files:e.files[0]:null,Oo=(e,t)=>{const o=v(),n=e=>{zo[t.input](o,Ho(e),t)};w(t.inputOptions)||h(t.inputOptions)?(Po(E()),g(t.inputOptions).then((t=>{e.hideLoading(),n(t)}))):"object"==typeof t.inputOptions?n(t.inputOptions):c("Unexpected type of inputOptions! Expected object, Map or Promise, got "+typeof t.inputOptions)},Mo=(e,t)=>{const o=e.getInput();te(o),g(t.inputValue).then((n=>{o.value="number"===t.input?`${parseFloat(n)||0}`:`${n}`,ee(o),o.focus(),e.hideLoading()})).catch((t=>{c(`Error in inputValue promise: ${t}`),o.value="",ee(o),o.focus(),e.hideLoading()}))},zo={select:(e,t,o)=>{const s=Q(e,n.select),a=(e,t,n)=>{const s=document.createElement("option");s.value=n,F(s,t),s.selected=qo(n,o.inputValue),e.appendChild(s)};t.forEach((e=>{const t=e[0],o=e[1];if(Array.isArray(o)){const e=document.createElement("optgroup");e.label=t,e.disabled=!1,s.appendChild(e),o.forEach((t=>a(e,t[1],t[0])))}else a(s,o,t)})),s.focus()},radio:(e,t,o)=>{const s=Q(e,n.radio);t.forEach((e=>{const t=e[0],a=e[1],i=document.createElement("input"),r=document.createElement("label");i.type="radio",i.name=n.radio,i.value=t,qo(t,o.inputValue)&&(i.checked=!0);const l=document.createElement("span");F(l,a),l.className=n.label,r.appendChild(i),r.appendChild(l),s.appendChild(r)}));const a=s.querySelectorAll("input");a.length&&a[0].focus()}},Ho=e=>{const t=[];return"undefined"!=typeof Map&&e instanceof Map?e.forEach(((e,o)=>{let n=e;"object"==typeof n&&(n=Ho(n)),t.push([o,n])})):Object.keys(e).forEach((o=>{let n=e[o];"object"==typeof n&&(n=Ho(n)),t.push([o,n])})),t},qo=(e,t)=>t&&t.toString()===e.toString(),Io=t=>{const o=e.innerParams.get(t);t.disableButtons(),o.input?Vo(t,"confirm"):Wo(t,!0)},Do=t=>{const o=e.innerParams.get(t);t.disableButtons(),o.returnInputValueOnDeny?Vo(t,"deny"):Fo(t,!1)},_o=(e,t)=>{e.disableButtons(),t(yt.cancel)},Vo=(t,o)=>{const n=e.innerParams.get(t);if(!n.input)return void c(`The "input" parameter is needed to be set when using returnInputValueOn${r(o)}`);const s=To(t,n);n.inputValidator?No(t,s,o):t.getInput().checkValidity()?"deny"===o?Fo(t,s):Wo(t,s):(t.enableButtons(),t.showValidationMessage(n.validationMessage))},No=(t,o,n)=>{const s=e.innerParams.get(t);t.disableInput(),Promise.resolve().then((()=>g(s.inputValidator(o,s.validationMessage)))).then((e=>{t.enableButtons(),t.enableInput(),e?t.showValidationMessage(e):"deny"===n?Fo(t,o):Wo(t,o)}))},Fo=(t,o)=>{const n=e.innerParams.get(t||void 0);n.showLoaderOnDeny&&Po(S()),n.preDeny?(e.awaitingPromise.set(t||void 0,!0),Promise.resolve().then((()=>g(n.preDeny(o,n.validationMessage)))).then((e=>{!1===e?(t.hideLoading(),Zt(t)):t.close({isDenied:!0,value:void 0===e?o:e})})).catch((e=>Uo(t||void 0,e)))):t.close({isDenied:!0,value:o})},Ro=(e,t)=>{e.close({isConfirmed:!0,value:t})},Uo=(e,t)=>{e.rejectPromise(t)},Wo=(t,o)=>{const n=e.innerParams.get(t||void 0);n.showLoaderOnConfirm&&Po(),n.preConfirm?(t.resetValidationMessage(),e.awaitingPromise.set(t||void 0,!0),Promise.resolve().then((()=>g(n.preConfirm(o,n.validationMessage)))).then((e=>{se($())||!1===e?(t.hideLoading(),Zt(t)):Ro(t,void 0===e?o:e)})).catch((e=>Uo(t||void 0,e)))):Ro(t,o)},Yo=(t,o,n)=>{e.innerParams.get(t).toast?Zo(t,o,n):(Jo(o),Qo(o),Go(t,o,n))},Zo=(t,o,n)=>{o.popup.onclick=()=>{const o=e.innerParams.get(t);o&&(Ko(o)||o.timer||o.input)||n(yt.close)}},Ko=e=>e.showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton;let Xo=!1;const Jo=e=>{e.popup.onmousedown=()=>{e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(Xo=!0)}}},Qo=e=>{e.container.onmousedown=()=>{e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,(t.target===e.popup||e.popup.contains(t.target))&&(Xo=!0)}}},Go=(t,o,n)=>{o.container.onclick=s=>{const a=e.innerParams.get(t);Xo?Xo=!1:s.target===o.container&&m(a.allowOutsideClick)&&n(yt.backdrop)}},en=e=>"object"==typeof e&&e.jquery,tn=e=>e instanceof Element||en(e),on=e=>{const t={};return"object"!=typeof e[0]||tn(e[0])?["title","html","icon"].forEach(((o,n)=>{const s=e[n];"string"==typeof s||tn(s)?t[o]=s:void 0!==s&&c(`Unexpected type of ${o}! Expected "string" or "Element", got ${typeof s}`)})):Object.assign(t,e[0]),t};function nn(){const e=this;for(var t=arguments.length,o=new Array(t),n=0;nue.timeout&&ue.timeout.getTimerLeft(),rn=()=>{if(ue.timeout)return ce(),ue.timeout.stop()},ln=()=>{if(ue.timeout){const e=ue.timeout.start();return le(e),e}},cn=()=>{const e=ue.timeout;return e&&(e.running?rn():ln())},dn=e=>{if(ue.timeout){const t=ue.timeout.increase(e);return le(t,!0),t}},un=()=>ue.timeout&&ue.timeout.isRunning();let pn=!1;const mn={};function wn(){mn[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"data-swal-template"]=this,pn||(document.body.addEventListener("click",gn),pn=!0)}const gn=e=>{for(let t=e.target;t&&t!==document;t=t.parentNode)for(const e in mn){const o=t.getAttribute(e);if(o)return void mn[e].fire({template:o})}};var hn=Object.freeze({__proto__:null,argsToParams:on,bindClickHandler:wn,clickCancel:bt,clickConfirm:ht,clickDeny:ft,enableLoading:Po,fire:nn,getActions:O,getCancelButton:T,getCloseButton:H,getConfirmButton:E,getContainer:f,getDenyButton:S,getFocusableElements:I,getFooter:M,getHtmlContainer:A,getIcon:x,getIconContent:k,getImage:B,getInputLabel:L,getLoader:j,getPopup:v,getProgressSteps:P,getTimerLeft:an,getTimerProgressBar:z,getTitle:C,getValidationMessage:$,increaseTimer:dn,isDeprecatedParameter:wo,isLoading:V,isTimerRunning:un,isUpdatableParameter:mo,isValidParameter:po,isVisible:gt,mixin:sn,resumeTimer:ln,showLoading:Po,stopTimer:rn,toggleTimer:cn});class fn{constructor(e,t){this.callback=e,this.remaining=t,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=(new Date).getTime()-this.started.getTime()),this.remaining}increase(e){const t=this.running;return t&&this.stop(),this.remaining+=e,t&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const bn=["swal-title","swal-html","swal-footer"],yn=e=>{const t="string"==typeof e.template?document.querySelector(e.template):e.template;if(!t)return{};const o=t.content;return $n(o),Object.assign(vn(o),xn(o),kn(o),Cn(o),An(o),Bn(o),Pn(o,bn))},vn=e=>{const t={};return Array.from(e.querySelectorAll("swal-param")).forEach((e=>{En(e,["name","value"]);const o=e.getAttribute("name"),n=e.getAttribute("value");"boolean"==typeof ro[o]?t[o]="false"!==n:"object"==typeof ro[o]?t[o]=JSON.parse(n):t[o]=n})),t},xn=e=>{const t={};return Array.from(e.querySelectorAll("swal-function-param")).forEach((e=>{const o=e.getAttribute("name"),n=e.getAttribute("value");t[o]=new Function(`return ${n}`)()})),t},kn=e=>{const t={};return Array.from(e.querySelectorAll("swal-button")).forEach((e=>{En(e,["type","color","aria-label"]);const o=e.getAttribute("type");t[`${o}ButtonText`]=e.innerHTML,t[`show${r(o)}Button`]=!0,e.hasAttribute("color")&&(t[`${o}ButtonColor`]=e.getAttribute("color")),e.hasAttribute("aria-label")&&(t[`${o}ButtonAriaLabel`]=e.getAttribute("aria-label"))})),t},Cn=e=>{const t={},o=e.querySelector("swal-image");return o&&(En(o,["src","width","height","alt"]),o.hasAttribute("src")&&(t.imageUrl=o.getAttribute("src")),o.hasAttribute("width")&&(t.imageWidth=o.getAttribute("width")),o.hasAttribute("height")&&(t.imageHeight=o.getAttribute("height")),o.hasAttribute("alt")&&(t.imageAlt=o.getAttribute("alt"))),t},An=e=>{const t={},o=e.querySelector("swal-icon");return o&&(En(o,["type","color"]),o.hasAttribute("type")&&(t.icon=o.getAttribute("type")),o.hasAttribute("color")&&(t.iconColor=o.getAttribute("color")),t.iconHtml=o.innerHTML),t},Bn=e=>{const t={},o=e.querySelector("swal-input");o&&(En(o,["type","label","placeholder","value"]),t.input=o.getAttribute("type")||"text",o.hasAttribute("label")&&(t.inputLabel=o.getAttribute("label")),o.hasAttribute("placeholder")&&(t.inputPlaceholder=o.getAttribute("placeholder")),o.hasAttribute("value")&&(t.inputValue=o.getAttribute("value")));const n=Array.from(e.querySelectorAll("swal-input-option"));return n.length&&(t.inputOptions={},n.forEach((e=>{En(e,["value"]);const o=e.getAttribute("value"),n=e.innerHTML;t.inputOptions[o]=n}))),t},Pn=(e,t)=>{const o={};for(const n in t){const s=t[n],a=e.querySelector(s);a&&(En(a,[]),o[s.replace(/^swal-/,"")]=a.innerHTML.trim())}return o},$n=e=>{const t=bn.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(e.children).forEach((e=>{const o=e.tagName.toLowerCase();t.includes(o)||l(`Unrecognized element <${o}>`)}))},En=(e,t)=>{Array.from(e.attributes).forEach((o=>{-1===t.indexOf(o.name)&&l([`Unrecognized attribute "${o.name}" on <${e.tagName.toLowerCase()}>.`,t.length?`Allowed attributes are: ${t.join(", ")}`:"To set the value, use HTML within the element."])}))},Tn=10,Sn=e=>{const t=f(),o=v();"function"==typeof e.willOpen&&e.willOpen(o);const s=window.getComputedStyle(document.body).overflowY;Mn(t,o,e),setTimeout((()=>{jn(t,o)}),Tn),D()&&(On(t,e.scrollbarPadding,s),Lt()),_()||ue.previousActiveElement||(ue.previousActiveElement=document.activeElement),"function"==typeof e.didOpen&&setTimeout((()=>e.didOpen(o))),J(t,n["no-transition"])},Ln=e=>{const t=v();if(e.target!==t)return;const o=f();t.removeEventListener(Pe,Ln),o.style.overflowY="auto"},jn=(e,t)=>{Pe&&re(t)?(e.style.overflowY="hidden",t.addEventListener(Pe,Ln)):e.style.overflowY="auto"},On=(e,t,o)=>{Ot(),t&&"hidden"!==o&&_t(),setTimeout((()=>{e.scrollTop=0}))},Mn=(e,t,o)=>{X(e,o.showClass.backdrop),t.style.setProperty("opacity","0","important"),ee(t,"grid"),setTimeout((()=>{X(t,o.showClass.popup),t.style.removeProperty("opacity")}),Tn),X([document.documentElement,document.body],n.shown),o.heightAuto&&o.backdrop&&!o.toast&&X([document.documentElement,document.body],n["height-auto"])};var zn={email:(e,t)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid email address"),url:(e,t)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid URL")};function Hn(e){e.inputValidator||Object.keys(zn).forEach((t=>{e.input===t&&(e.inputValidator=zn[t])}))}function qn(e){(!e.target||"string"==typeof e.target&&!document.querySelector(e.target)||"string"!=typeof e.target&&!e.target.appendChild)&&(l('Target parameter is not valid, defaulting to "body"'),e.target="body")}function In(e){Hn(e),e.showLoaderOnConfirm&&!e.preConfirm&&l("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),qn(e),"string"==typeof e.title&&(e.title=e.title.split("\n").join("
")),ke(e)}let Dn;class _n{constructor(){if("undefined"==typeof window)return;Dn=this;for(var t=arguments.length,o=new Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};bo(Object.assign({},o,t)),ue.currentInstance&&(ue.currentInstance._destroy(),D()&&jt()),ue.currentInstance=Dn;const n=Nn(t,o);In(n),Object.freeze(n),ue.timeout&&(ue.timeout.stop(),delete ue.timeout),clearTimeout(ue.restoreFocusTimeout);const s=Fn(Dn);return ut(Dn,n),e.innerParams.set(Dn,n),Vn(Dn,s,n)}then(t){return e.promise.get(this).then(t)}finally(t){return e.promise.get(this).finally(t)}}const Vn=(e,t,o)=>new Promise(((n,s)=>{const a=t=>{e.close({isDismissed:!0,dismiss:t})};St.swalPromiseResolve.set(e,n),St.swalPromiseReject.set(e,s),t.confirmButton.onclick=()=>{Io(e)},t.denyButton.onclick=()=>{Do(e)},t.cancelButton.onclick=()=>{_o(e,a)},t.closeButton.onclick=()=>{a(yt.close)},Yo(e,t,a),xt(e,ue,o,a),Eo(e,o),Sn(o),Rn(ue,o,a),Un(t,o),setTimeout((()=>{t.container.scrollTop=0}))})),Nn=(e,t)=>{const o=yn(e),n=Object.assign({},ro,t,o,e);return n.showClass=Object.assign({},ro.showClass,n.showClass),n.hideClass=Object.assign({},ro.hideClass,n.hideClass),n},Fn=t=>{const o={popup:v(),container:f(),actions:O(),confirmButton:E(),denyButton:S(),cancelButton:T(),loader:j(),closeButton:H(),validationMessage:$(),progressSteps:P()};return e.domCache.set(t,o),o},Rn=(e,t,o)=>{const n=z();te(n),t.timer&&(e.timeout=new fn((()=>{o("timer"),delete e.timeout}),t.timer),t.timerProgressBar&&(ee(n),W(n,t,"timerProgressBar"),setTimeout((()=>{e.timeout&&e.timeout.running&&le(t.timer)}))))},Un=(e,t)=>{t.toast||(m(t.allowEnterKey)?Wn(e,t)||kt(-1,1):Yn())},Wn=(e,t)=>t.focusDeny&&se(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&se(e.cancelButton)?(e.cancelButton.focus(),!0):!(!t.focusConfirm||!se(e.confirmButton)||(e.confirmButton.focus(),0)),Yn=()=>{document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|xn--p1ai)$/)){const e=new Date,t=localStorage.getItem("swal-initiation");t?(e.getTime()-Date.parse(t))/864e5>3&&setTimeout((()=>{document.body.style.pointerEvents="none";const e=document.createElement("audio");e.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",e.loop=!0,document.body.appendChild(e),setTimeout((()=>{e.play().catch((()=>{}))}),2500)}),500):localStorage.setItem("swal-initiation",`${e}`)}Object.assign(_n.prototype,Bo),Object.assign(_n,hn),Object.keys(Bo).forEach((e=>{_n[e]=function(){if(Dn)return Dn[e](...arguments)}})),_n.DismissReason=yt,_n.version="11.7.3";const Zn=_n;return Zn.default=Zn,Zn}(),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2),"undefined"!=typeof document&&function(e,t){var o=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(o),o.styleSheet)o.styleSheet.disabled||(o.styleSheet.cssText=t);else try{o.innerHTML=t}catch(e){o.innerText=t}}(document,'.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:rgba(0,0,0,0) !important}.swal2-container.swal2-top-start,.swal2-container.swal2-center-start,.swal2-container.swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}.swal2-container.swal2-top,.swal2-container.swal2-center,.swal2-container.swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}.swal2-container.swal2-top-end,.swal2-container.swal2-center-end,.swal2-container.swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-start>.swal2-popup,.swal2-container.swal2-center-left>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-start>.swal2-popup,.swal2-container.swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-row>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none !important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:none}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:none}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:rgba(0,0,0,0);color:#f27474}.swal2-close:focus{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-input,.swal2-file,.swal2-textarea,.swal2-select,.swal2-radio,.swal2-checkbox{margin:1em 2em 3px}.swal2-input,.swal2-file,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}.swal2-input.swal2-inputerror,.swal2-file.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}.swal2-input:focus,.swal2-file:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-input::placeholder,.swal2-file::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}.swal2-radio,.swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-radio label,.swal2-checkbox label{margin:0 .6em;font-size:1.125em}.swal2-radio input,.swal2-checkbox input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}')}},t={};function o(n){var s=t[n];if(void 0!==s)return s.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=o(455),t=o.n(e);jQuery(document).ready((function(e){e("#openConversationModal").click((function(t){e(".td-modal-container").removeClass("hidden").fadeIn(500)})),e("#close-modal").click((function(t){e(".td-modal-container").addClass("hidden").fadeOut(200)})),e(document).keydown((function(t){"Escape"===t.key&&e(".td-modal-container").addClass("hidden").fadeOut(200)}));var o,n,s,a=e("#td-ticket-search");a.on("keyup",(function(t){e(this).trigger("search")})),a.on("search",(function(t){var o=e("#conversation-table"),n=e(this).val();o.find("tr").each((function(t,o){var s;if(""!==n){var a=e(o),i=null==a||null===(s=a.text())||void 0===s?void 0:s.toLowerCase();i&&-1===i.toString().indexOf(n)?a.hide():a.show()}else e(o).show()})),0===o.find("tr:visible").length?o.find("#no-results").show():o.find("#no-results").hide()})),e("#td-search-input").keyup((o=function(){var t=e("#td-search-input").val(),o=e("#td-search-spinner");t&&(o.show(),e.ajax({type:"POST",url:td_objects.wp_json_url+"/td-search-query/docs",data:{query_string:t},success:function(t){o.hide();var n=e("#td-search-results"),s="";if(t.data.length>0)t.data.forEach((function(e,t){s+='
  • \n \n
    \n ').concat(e.categories,'\n ').concat(e.title,'\n ').concat(e.excerpt,"\n
    \n
    \n
  • ")}));else{o.hide();var a=e("#td-new-ticket-url").attr("href");s+='
  • \n
    No documentation found. Click here to open a new ticket
    \n
  • ')}n.html(s)}}))},n=1e3,function(){clearTimeout(s),s=setTimeout(o,n)})),e("#td_conversation_reply").submit((function(o){o.preventDefault();var n=e("#td_reply_none").val(),s=e("#td_conversation_id").val(),a=e("#td_conversation_editor").val();""===a?t().fire({icon:"error",title:"Oops...",text:"Reply text can not be empty!"}):(e("#td-reply-spinner").show(),jQuery.post(td_objects.ajax_url,{action:"td_reply_conversation",data:{nonce:n,conversation_id:s,reply_text:a}},(function(o){"success"===o.status?(e("#td-reply-spinner").hide(),t().fire({icon:"success",title:"Reply sent",text:o.message}).then((function(){location.reload()}))):(e("#td-reply-spinner").hide(),t().fire({icon:"error",title:"Oops...",text:o.message}))})))}))}))})()})(); \ No newline at end of file diff --git a/assets/mix-manifest.json b/assets/mix-manifest.json index 0eb176c..be89acb 100644 --- a/assets/mix-manifest.json +++ b/assets/mix-manifest.json @@ -1,6 +1,6 @@ { - "/js/admin.js": "/js/admin.js?id=09af13713d16f03db6425c0acaca8e2e", - "/js/conversation.js": "/js/conversation.js?id=dce3dfac2710a3baf8f73980cb414afc", - "/css/thrivedesk.css": "/css/thrivedesk.css?id=78b5ca6a4402868892e3224a1490b1b7", - "/css/admin.css": "/css/admin.css?id=472dce0a65cb1dc87222f02c5c26f95d" + "/js/admin.js": "/js/admin.js?id=7fa7a88ecc803d79039edf98955946da", + "/js/conversation.js": "/js/conversation.js?id=86c19b8417f013676b42350cd0aeb416", + "/css/thrivedesk.css": "/css/thrivedesk.css?id=262e46f459b3501e944e9e8ea3253933", + "/css/admin.css": "/css/admin.css?id=64c236cd5ab367476f1f642a853ff94a" } From 843e1760b0bf4d2290714ee75cd175074d5b9fc7 Mon Sep 17 00:00:00 2001 From: Atiqur Rahman Date: Mon, 27 Mar 2023 12:27:06 +0600 Subject: [PATCH 7/9] fix: remove required option from the portal new ticket page --- includes/views/pages/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/views/pages/settings.php b/includes/views/pages/settings.php index 63d2a2a..76b98fd 100755 --- a/includes/views/pages/settings.php +++ b/includes/views/pages/settings.php @@ -72,7 +72,7 @@
    - $page ) : ?> '); + + // check assistants array is not empty + if (data?.assistants?.length === 0) { + assistantList.append( + '' + ); + return; + } + data.assistants.forEach(function (item) { assistantList.append( '' diff --git a/src/Conversations/Conversation.php b/src/Conversations/Conversation.php index 62f0068..9c8111d 100644 --- a/src/Conversations/Conversation.php +++ b/src/Conversations/Conversation.php @@ -68,7 +68,13 @@ public function __construct() public function td_verify_helpdesk_api_key( ): void { $apiKey = $_POST['data']['td_helpdesk_api_key'] ?? ''; if ( empty( $apiKey ) ) { - echo json_encode( [ 'status' => 'error', 'message' => 'API key is required' ] ); + echo json_encode( [ + 'code' => 422, + 'status' => 'error', + 'data' => [ + 'message' => 'API Key is required' + ] + ] ); die(); } @@ -76,6 +82,17 @@ public function td_verify_helpdesk_api_key( ): void { $apiService->setApiKey( $apiKey ); $data = $apiService->getRequest( THRIVEDESK_API_URL . '/v1/me' ); + if ( isset( $data['wp_error'] ) && $data['wp_error'] ) { + echo json_encode( [ + 'code' => 422, + 'status' => 'error', + 'data' => [ + 'message' => $data['message'] + ] + ] ); + die(); + } + if ( $data ) { echo json_encode( [ 'status' => 'true', 'data' => $data ] ); die(); diff --git a/src/Services/TDApiService.php b/src/Services/TDApiService.php index 8840ef2..be58ab2 100755 --- a/src/Services/TDApiService.php +++ b/src/Services/TDApiService.php @@ -39,6 +39,11 @@ public function getRequest(string $url) ]; $response = wp_remote_get($url, $args); + + if ( is_wp_error( $response ) ) { + return ['wp_error' => true, 'message' => $response->get_error_message()]; + } + $body = wp_remote_retrieve_body($response); $body = json_decode($body, true); From d68f6e8947f1facb46327f89ebb88296551c7218 Mon Sep 17 00:00:00 2001 From: Atiqur Rahman Date: Mon, 27 Mar 2023 15:30:43 +0600 Subject: [PATCH 9/9] fix: assistant issue with no assistant found --- resources/js/admin.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/resources/js/admin.js b/resources/js/admin.js index db559d5..41174d0 100755 --- a/resources/js/admin.js +++ b/resources/js/admin.js @@ -267,21 +267,22 @@ jQuery(document).ready(($) => { let assistantList = $('#td-assistants'); assistantList.html(''); - assistantList.append(''); - // check assistants array is not empty - if (data?.assistants?.length === 0) { + if (data?.assistants?.length > 0) { + assistantList.append(''); + data.assistants.forEach(function (item) { + assistantList.append( + '' + ); + }); + }else { assistantList.append( - '' + '' ); - return; - } - data.assistants.forEach(function (item) { - assistantList.append( - '' - ); - }); + assistantList.prop('disabled', true); + + } } }) .error(function () {