PageSourceSearch

https://merchant.vatcompliance.co/static/js/route-core-dialog.cb4a423e.chunk.js

js vatcompliance.co collected 2026-10-01 12:03:56 UTC 11,430 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunklappa_app=self.webpackChunklappa_app||[]).push([[3859],{10488:(e,l,a)=>{a.d(l,{A:()=>s});a(65043);const s=a.p+"static/media/clip.0416f960e86b91ed1a765e6cbecc8aea.svg"},30820:(e,l,a)=>{a.r(l),a.d(l,{default:()=>w});var s=a(65043),i=a(53536),n=a.n(i),t=a(98139),r=a.n(t),d=a(86178),o=a.n(d),c=a(11568),u=a(13397),m=a(26699),g=a(50701),p=a(91232),f=a(25686),x=a(93888),h=a(66823),v=a(21494),b=a(66982),j=a(88117),y=a(37898),_=a(76930),k=a(45847),C=a(83003),S=a(33852),E=a(15462),A=a(10488),T=a(79416),L=a(17848),N=a(52399),P=a(70579);function M(e,l){if(null==e)return null;if(Array.isArray(e)){const a=e.find((e=>String(null===e||void 0===e?void 0:e.id)===String(l)));return null!==a&&void 0!==a?a:1===e.length?e[0]:null}if("object"!==typeof e)return null;if(null!=e.data&&"object"===typeof e.data&&!Array.isArray(e.data))return M(e.data,l);if(null!=e.result&&"object"===typeof e.result&&!Array.isArray(e.result))return M(e.result,l);if(e.error&&null==e.id&&!Array.isArray(e.messages))return null;if(null!=e.id||Array.isArray(e.messages))return e;if(e.items&&Array.isArray(e.items)){const a=e.items,s=a.find((e=>String(null===e||void 0===e?void 0:e.id)===String(l)));return null!==s&&void 0!==s?s:1===a.length?a[0]:null}return e}const w=function(){const{t:e}=(0,_.Bd)(),l=(0,k.Zp)(),a=(0,k.zy)(),i=(0,k.g)(),t=i.dialogId,d=(0,C.d4)((e=>e.user.user)),w=(0,N.Ay)(),R=(0,s.useCallback)((e=>w((0,E.z1)(e))),[w]),D=(0,s.useCallback)((e=>w((0,E.Cz)(e))),[w]),W=(0,s.useCallback)((e=>w((0,E.NY)(e))),[w]),z=(0,s.useCallback)((()=>w((0,E.Me)())),[w]),I=(0,s.useCallback)((e=>w((0,E.zo)(e))),[w]),[B,U]=(0,s.useState)(""),[Y,$]=(0,s.useState)(!1),[q,F]=(0,s.useState)(null),[Z,H]=(0,s.use
1State)({proof_files:[]}),[O,V]=(0,s.useState)(null),[G,J]=(0,s.useState)((()=>i.dialogId?"loading":"idle")),[K,Q]=(0,s.useState)(!1),X=(0,s.useRef)(null),ee=(0,s.useRef)(null),le=(0,s.useRef)({proof_files:[]});(0,s.useEffect)((()=>{let e=!1;return t?(F(null),Q(!1),J("loading"),W(t).then((()=>z())).catch(n().noop),I({dialog_id:t,unread:!1}).then((l=>{if(e)return;const a=M(l,t);F(a),J("ready"),Q(!a)})).catch((()=>{e||(F(null),J("ready"),Q(!0))})),()=>{e=!0}):(J("idle"),Q(!1),void F(null))}),[t,W,z,I]);const ae=(0,s.useCallback)((()=>{const e=X.current;if(e){const{scrollHeight:l,clientHeight:a}=e;e.scrollTop=l-a}}),[]);(0,s.useEffect)((()=>{ae()}),[null===q||void 0===q?void 0:q.messages,null===q||void 0===q?void 0:q.id,ae]);const se=(0,s.useCallback)(((e,l)=>{let a;n().map(le.current[e],((e,s)=>{e.name===l&&(a=s)})),void 0!==a&&(le.current[e].splice(a,1),H((l=>{const s={...l,[e]:[...l[e]]};return s[e].splice(a,1),s})))}),[]),ie=(0,s.useCallback)((e=>{const l=ee.current;l&&(l.click(),l.onchange=()=>{const a=l.files;H((l=>{const s={...l,[e]:[...l[e]]},i=le.current[e];for(let t=0;t<a.length;t++){const l=a[t];let r;n().map(i,((e,a)=>{e.name===l.name&&(r=a)})),void 0!==r&&(i.splice(r,1),s[e].splice(r,1)),i.push(l),s[e].push(l.name)}return s}))})}),[]),ne=(0,s.useCallback)((e=>{D(e).then((l=>{const a=e.indexOf("/")+1,s=e.lastIndexOf("."),i=e.substring(a,s),n=document.createElement("a");n.setAttribute("href",l.link),n.setAttribute("download",i),n.style.display="none",document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(l.link),document.body.removeChild(n)}))}),[D]),te=(0,s.useCallback)((l=>{if(l.preventDefault(),null===q||void 0===q||!q.id)return;if(!B)return void $(e("dialog.addCommMess"));const a={dialogId:+q.id,text:B},s=function(e,l){const a=new FormData;for(let s=0;s<e.proof_files.length;s++)a.append("file_"+s,e.proof_files[s],e.proof_files[s].name);return a.append("text",l),a}(le.current,B);R({...a,data:s}).then((()=>(le.current={proof_files:[]},H({proof_files:[]}),U(""),V(null),I({dialog_id:q.id,unread:!1})))).then((e=>{const l=M(e,String(q.id));F(null!==l&&void 0!==l?l:e)})).catch((e=>{V(e)}))}),[B,q,I,R,e]),re=(0,s.useCallback)((()=>{var e;const l=null!==(e=null===q||void 0===q?void 0:q.id)&&void 0!==e?e:t;return null==l||""===l?"Request":`Request ${String(l).padStart(10,"0")}`}),[q,t]),de=(0,s.useCallback)((l=>{let a="";switch((null!==l&&void 0!==l?l:"").toString().toLowerCase()){case"info":a=(0,P.jsx)(c.E,{tone:"info",children:e("dialog.info")});break;case"action required":a=(0,P.jsx)(c.E,{tone:"warning",children:e("dialog.actionR")});break;case"pending lovat action":a=(0,P.jsx)(c.E,{tone:"success",children:e("dialog.pendingLovat")});break;default:a=(0,P.jsx)(c.E,{children:e("dialog.answered")})}return a}),[e]),oe=(0,s.useCallback)((l=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[(0,P.jsxs)(u.$,{onClick:()=>ie(l),children:["Add file",(0,P.jsx)("input",{type:"file",multiple:!0,style:{display:"none"},ref:ee})]}),(0,P.jsx)(m.E,{color:"subdued",children:e("dialog.chooseFiles")})]}),(0,P.jsx)("div",{children:n().map(Z.proof_files,((e,l)=>(0,P.jsx)("div",{style:{display:"inline-block",margin:"5px"},children:(0,P.jsx)(g.v,{onRemove:()=>{se("proof_files",e)},children:e})},l)))})]})),[se,Z.proof_files,ie,e]),ce=(0,s.useCallback)((()=>{var e,s,i;const n=null===(e=a.state)||void 0===e?void 0:e.supportRestoreCompany;let t=null!=(null===n||void 0===n?void 0:n.id)?{id:n.id,name:null!==(s=n.name)&&void 0!==s?s:""}:void 0;var r,d,o;t||null==(null===q||void 0===q?void 0:q.company_id)||(t={id:q.company_id,name:null!==(r=null!==(d=q.company_name)&&void 0!==d?d:null===(o=q.company)||void 0===o?void 0:o.name)&&void 0!==r?r:""});l("/help",{state:{defaultTab:"support",...null!=(null===(i=t)||void 0===i?void 0:i.id)?{supportRestoreCompany:t}:{}}})}),[l,a.state,q]),ue=Array.isArray(null===q||void 0===q?void 0:q.messages)?q.messages:null;return(0,P.jsxs)(p.Y,{title:(0,P.jsx)(L.A,{onBack:ce,content:(0,P.jsx)(m.E,{variant:"heading3xl",as:"span",children:re()})}),fullWidth:!0,children:[(0,P.jsx)(T.A,{title:"Support chat"}),"loading"===G&&(0,P.jsx)(f.P,{children:(0,P.jsx)(f.P.Section,{children:(0,P.jsx)(x.Z,{sectioned:!0,children:(0,P.jsx)(h.a,{padding:"400",children:(0,P.jsx)(v.y,{accessibilityLabel:e("common.loading",{defaultValue:"Loading"})})})})})}),"ready"===G&&K&&(0,P.jsx)(f.P,{children:(0,P.jsx)(f.P.Section,{children:(0,P.jsx)(S.A,{status:"critical",message:e("dialog.loadFailed",{defaultValue:"Could not load this request. Try again or go back to the list."})})})}),q&&(0,P.jsx)(f.P,{children:(0,P.jsx)(f.P.Section,{children:(0,P.jsxs)(b.x,{children:[(0,P.jsx)(b.x.Cell,{columnSpan:{xs:6,sm:6,md:6,lg:8,xl:8},children:(0,P.jsxs)(x.Z,{children:[(0,P.jsx)("div",{children:(0,P.jsx)(m.E,{variant:"headingLg",children:"Support chat"})}),(0,P.jsx)(h.a,{paddingBlockEnd:"500",children:(0,P.jsx)("div",{className:"dialog__messages",ref:X,children:ue&&ue.map((e=>{var l;const a=function(e,l){const a={avatar:"M",userName:"Manager Lappa",isCurrentUserMessage:!1};if(!e)return a;
1if(e.is_manager||e.id!==l.sender_id||(a.avatar=(e.first_name||"").substr(0,1)+(e.last_name||"").substr(0,1),a.userName=`${e.first_name} ${e.last_name}`),e.is_manager&&!l.is_manager&&l.user_name){const e=l.user_name.match(/[^ ]+ (.+)/),s=e&&e[1]?e[1]:"",i=s?s[0]:"";a.avatar=l.user_name.charAt(0)+i,a.userName=l.user_name}return l.sender_id===e.id&&(a.isCurrentUserMessage=!0,a.userName="You"),a}(d,e);return(0,P.jsxs)("div",{className:r()("dialog__message",{myMessage:a.isCurrentUserMessage}),children:[!a.isCurrentUserMessage&&(0,P.jsx)(j.e,{initials:a.avatar}),(0,P.jsxs)("div",{children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:a.isCurrentUserMessage?"space-between":"start"},children:[(0,P.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,P.jsx)(m.E,{children:a.userName})}),(0,P.jsx)("div",{className:"dialog__message-date",children:(0,P.jsx)(m.E,{color:"subdued",variant:"bodySm",children:o()(e.created).format("LLL")})})]}),(0,P.jsx)("p",{className:"dialog__message-text",dangerouslySetInnerHTML:{__html:String(null!==(l=e.text)&&void 0!==l?l:"").replace(/\n/g,"<br>")}}),Array.isArray(e.files)&&e.files.map(((e,l)=>(0,P.jsxs)("div",{className:"dialog__message-file",children:[(0,P.jsx)("img",{className:"Button__Prefix",src:A.A,alt:"icon save"}),(0,P.jsx)("a",{className:"Polaris-Link",onClick:()=>ne(e),children:e.slice(5)})]},`${l}-file`)))]})]},e.id)}))})}),(0,P.jsxs)("div",{children:[O&&(0,P.jsx)(S.A,{status:"critical",message:O}),(0,P.jsx)("form",{onSubmit:te,children:(0,P.jsxs)(h.a,{display:"flex",flexDirection:"column",gap:"400",children:[(0,P.jsx)(y.A,{id:"desc",name:"description",placeholder:"Write a message",multiline:6,value:B,error:Y,onChange:e=>{U(e),$(!1)}}),(0,P.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-end",gap:"16px",paddingTop:10,width:"100%"},children:[(0,P.jsx)("div",{style:{flex:"1 1 200px",minWidth:0},children:(0,P.jsx)("div",{style:{paddingBottom:8},children:oe("proof_files")})}),(0,P.jsx)("div",{style:{flex:"0 0 auto",marginLeft:"auto"},children:(0,P.jsx)(u.$,{variant:"primary",submit:!0,size:"large",children:"Send"})})]})]})})]})]})}),(0,P.jsx)(b.x.Cell,{columnSpan:{xs:6,sm:6,md:6,lg:4,xl:4},children:(0,P.jsx)(x.Z,{sectioned:!0,children:(0,P.jsxs)(h.a,{display:"flex",flexDirection:"column",gap:"6",children:[(0,P.jsxs)(h.a,{display:"flex",flexDirection:"column",gap:"2",children:[(0,P.jsx)(m.E,{fontWeight:"medium",children:"Case number"}),(0,P.jsx)(m.E,{color:"subdued",children:re()})]}),(0,P.jsxs)(h.a,{display:"flex",flexDirection:"column",gap:"2",children:[(0,P.jsx)(m.E,{fontWeight:"medium",children:"Status"}),de(q.dialog_status)]}),(0,P.jsxs)(h.a,{display:"flex",flexDirection:"column",gap:"2",children:[(0,P.jsx)(m.E,{fontWeight:"medium",children:"Date update"}),(0,P.jsx)(m.E,{color:"subdued",children:o()(q.modified).format("DD-MM-YYYY hh:mm")})]}),(0,P.jsxs)(h.a,{display:"flex",flexDirection:"column",gap:"2",children:[(0,P.jsx)(m.E,{fontWeight:"medium",children:"Case group"}),(0,P.jsx)(m.E,{color:"subdued",children:(0,P.jsx)("span",{style:{textTransform:"capitalize"},children:q.case_group})})]})]})})})]})})})]})}},50701:(e,l,a)=>{a.d(l,{v:()=>u});var s=a(65043),i=a(97814),n=a(71616),t=a(85659),r={Tag:"Polaris-Tag",disabled:"Polaris-Tag--disabled",clickable:"Polaris-Tag--clickable",linkable:"Polaris-Tag--linkable",removable:"Polaris-Tag--removable",Button:"Polaris-Tag__Button",Link:"Polaris-Tag__Link",segmented:"Polaris-Tag--segmented",Text:"Polaris-Tag__Text",sizeLarge:"Polaris-Tag--sizeLarge",overlay:"Polaris-Tag--overlay"},d=a(87382),o=a(26699),c=a(18943);function u(e){let{children:l,disabled:a=!1,onClick:u,onRemove:m,accessibilityLabel:g,url:p,size:f}=e;const x=(0,d.s)(),h=m&&p,v=(0,n.xW)(r.Tag,a&&r.disabled,u&&r.clickable,m&&r.removable,p&&!a&&r.linkable,h&&r.segmented,f&&r[(0,n.Ny)("size",f)]);let b=g;b||(b="string"===typeof l?l:void 0);const j=s.createElement(o.E,{as:"span",variant:"bodySm",truncate:!0},s.createElement("span",{title:b,className:r.Text},l));if(u)return s.createElement("button",{type:"button",disabled:a,className:v,onClick:u},j);const y=x.translate("Polaris.Tag.ariaLabel",{children:b||""}),_=m?s.createElement("button",{type:"button","aria-label":y,className:(0,n.xW)(r.Button,h&&r.segmented),onClick:m,onMouseUp:t.bh,disabled:a},s.createElement(c.I,{source:i.S})):null,k=p&&!a?s.createElement("a",{className:(0,n.xW)(r.Link,h&&r.segmented),href:p},j):j;return s.createElement("span",{className:v,"aria-disabled":a},k,"large"===f&&s.createElement("span",{className:r.overlay}),_)}}}]);
2//# sourceMappingURL=route-core-dialog.cb4a423e.chunk.js.map

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.