bonuspluscomponents 0.0.98 → 0.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerInfoPage.d.ts","sourceRoot":"","sources":["../../../src/Pages/CustomerInfoPage/CustomerInfoPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomerInfoPage.d.ts","sourceRoot":"","sources":["../../../src/Pages/CustomerInfoPage/CustomerInfoPage.tsx"],"names":[],"mappings":"AASA,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,gBAAgB,+CAuErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -222,4 +222,4 @@ const theme2 = createTheme({ palette: {
|
|
|
222
222
|
animation: ${0} 1.4s linear infinite;
|
|
223
223
|
`),af)),df=ze("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),ff=ze("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.circle,t[`circle${ce(r.variant)}`],r.disableShrink&&t.circleDisableShrink]}})(({ownerState:e,theme:t})=>N({stroke:"currentColor"},e.variant==="determinate"&&{transition:t.transitions.create("stroke-dashoffset")},e.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:e})=>e.variant==="indeterminate"&&!e.disableShrink&&xn(es||(es=Er`
|
|
224
224
|
animation: ${0} 1.4s ease-in-out infinite;
|
|
225
|
-
`),cf)),ri=O.forwardRef(function(t,r){const n=$t({props:t,name:"MuiCircularProgress"}),{className:o,color:s="primary",disableShrink:i=!1,size:a=40,style:u,thickness:l=3.6,value:d=0,variant:g="indeterminate"}=n,v=Pe(n,sf),_=N({},n,{color:s,disableShrink:i,size:a,thickness:l,value:d,variant:g}),b=uf(_),f={},h={},R={};if(g==="determinate"){const A=2*Math.PI*((et-l)/2);f.strokeDasharray=A.toFixed(3),R["aria-valuenow"]=Math.round(d),f.strokeDashoffset=`${((100-d)/100*A).toFixed(3)}px`,h.transform="rotate(-90deg)"}return c.jsx(lf,N({className:Ie(b.root,o),style:N({width:a,height:a},h,u),ownerState:_,ref:r,role:"progressbar"},R,v,{children:c.jsx(df,{className:b.svg,ownerState:_,viewBox:`${et/2} ${et/2} ${et} ${et}`,children:c.jsx(ff,{className:b.circle,style:f,ownerState:_,cx:et,cy:et,r:(et-l)/2,fill:"none",strokeWidth:l})})}))});process.env.NODE_ENV!=="production"&&(ri.propTypes={classes:y.object,className:y.string,color:y.oneOfType([y.oneOf(["inherit","primary","secondary","error","info","success","warning"]),y.string]),disableShrink:cn(y.bool,e=>e.disableShrink&&e.variant&&e.variant!=="indeterminate"?new Error("MUI: You have provided the `disableShrink` prop with a variant other than `indeterminate`. This will have no effect."):null),size:y.oneOfType([y.number,y.string]),style:y.object,sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),thickness:y.number,value:y.number,variant:y.oneOf(["determinate","indeterminate"])});const pf=ri;function mf(e){return at("MuiLoadingButton",e)}const hf=Tt("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),Xe=hf,vf=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],gf=e=>{const{loading:t,loadingPosition:r,classes:n}=e,o={root:["root",t&&"loading"],startIcon:[t&&`startIconLoading${ce(r)}`],endIcon:[t&&`endIconLoading${ce(r)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${ce(r)}`]},s=Lt(o,mf,n);return N({},n,s)},yf=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",bf=ze(Xs,{shouldForwardProp:e=>yf(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${Xe.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${Xe.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>N({[`& .${Xe.startIconLoadingStart}, & .${Xe.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},e.loadingPosition==="center"&&{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${Xe.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${Xe.startIconLoadingStart}, & .${Xe.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${Xe.startIconLoadingStart}, & .${Xe.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),xf=ze("div",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.loadingIndicator,t[`loadingIndicator${ce(r.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>N({position:"absolute",visibility:"visible",display:"flex"},t.loadingPosition==="start"&&(t.variant==="outlined"||t.variant==="contained")&&{left:t.size==="small"?10:14},t.loadingPosition==="start"&&t.variant==="text"&&{left:6},t.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled},t.loadingPosition==="end"&&(t.variant==="outlined"||t.variant==="contained")&&{right:t.size==="small"?10:14},t.loadingPosition==="end"&&t.variant==="text"&&{right:6},t.loadingPosition==="start"&&t.fullWidth&&{position:"relative",left:-10},t.loadingPosition==="end"&&t.fullWidth&&{position:"relative",right:-10})),ni=O.forwardRef(function(t,r){const n=$t({props:t,name:"MuiLoadingButton"}),{children:o,disabled:s=!1,id:i,loading:a=!1,loadingIndicator:u,loadingPosition:l="center",variant:d="text"}=n,g=Pe(n,vf),v=ds(i),_=u??c.jsx(pf,{"aria-labelledby":v,color:"inherit",size:16}),b=N({},n,{disabled:s,loading:a,loadingIndicator:_,loadingPosition:l,variant:d}),f=gf(b),h=a?c.jsx(xf,{className:f.loadingIndicator,ownerState:b,children:_}):null;return c.jsxs(bf,N({disabled:s||a,id:v,ref:r},g,{variant:d,classes:f,ownerState:b,children:[b.loadingPosition==="end"?o:h,b.loadingPosition==="end"?h:o]}))});process.env.NODE_ENV!=="production"&&(ni.propTypes={children:y.node,classes:y.object,disabled:y.bool,id:y.string,loading:y.bool,loadingIndicator:y.node,loadingPosition:cn(y.oneOf(["start","end","center"]),e=>e.loadingPosition==="start"&&!e.startIcon?new Error('MUI: The loadingPosition="start" should be used in combination with startIcon.'):e.loadingPosition==="end"&&!e.endIcon?new Error('MUI: The loadingPosition="end" should be used in combination with endIcon.'):null),sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),variant:y.oneOfType([y.oneOf(["contained","outlined","text"]),y.string])});const _f=ni,oi=({onClick:e,isLoading:t,children:r})=>($.useEffect(()=>{const n=o=>{(o.code==="Enter"||o.code==="NumpadEnter")&&(e==null||e(),o.preventDefault())};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e]),c.jsx(_f,{onClick:()=>e==null?void 0:e(),loading:t,variant:"contained",children:r||"Далее"}));function Ef({opened:e,setOpened:t,requiredMessages:r,incorrectMessages:n}){const o=()=>{t(!1)};return c.jsx(fe.Modal,{open:e,onClose:t,children:c.jsx(fe.Box,{className:"validation popup__root",children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"validation_popup",children:[c.jsxs("div",{className:"validation_popup__title",children:[c.jsx("div",{children:"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{onClick:()=>o(),children:c.jsx(Vn,{})})})]}),c.jsxs("div",{className:"validation_popup__body",children:[r.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(ir,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Не указаны следующие обязательные поля:"}),c.jsx("ul",{children:r.map((s,i)=>c.jsx("li",{dangerouslySetInnerHTML:{__html:s}},i))})]})]})}),n.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(ir,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Следующие поля заполнены с ошибкой:"}),c.jsx("ul",{children:n.map((s,i)=>c.jsx("li",{children:s},i))})]})]})})]}),c.jsx("div",{className:"validation_popup__buttons",children:c.jsx(oi,{onClick:()=>o(),children:"Продолжить"})})]})})})}const si=({validationsProp:e})=>{const[t,r]=$.useState(e),n=$.useRef({incorrect:[]}),o=(f,h,R,A)=>{const{detail:x}=f;if(x&&A){const C=n.current.incorrect;if(!x.value){n.current.incorrect=C.filter(P=>P.id!==h),s({id:x.id,isError:!1});return}const p=A(x.value);p.isError?C.some(P=>P.id===h)||(n.current.incorrect=[...C,{id:h,message:p.message,label:R}]):n.current.incorrect=C.filter(P=>P.id!==h),s({id:x.id,isError:p.isError,message:p.message})}},s=f=>{const h=new CustomEvent(`${rn}_${f.id}`,{detail:{...f}});document.dispatchEvent(h)},i=()=>({addEventListeners:()=>t==null?void 0:t.forEach(f=>document.addEventListener(`${tn}_${f.id}`,h=>o(h,f.id,f.label,f.validator))),removeEventListeners:()=>t==null?void 0:t.forEach(f=>document.removeEventListener(`${tn}_${f.id}`,h=>o(h,f.id,f.label,f.validator)))});$.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=i();return f(),()=>{h()}},[t]);const a=$.useRef({empties:[]}),u=()=>a.current.empties.length>0||n.current.incorrect.length>0?(l(),_(!0),!1):!0,l=()=>{const f=new CustomEvent(Qr,{detail:{ids:a.current.empties.map(h=>h.id)}});document.dispatchEvent(f)},d=f=>{var R,A,x;const h=a.current.empties;(R=f==null?void 0:f.detail)!=null&&R.empty?h.some(C=>{var p;return C.id===((p=f==null?void 0:f.detail)==null?void 0:p.id)})||(a.current.empties=[...h,{id:(A=f==null?void 0:f.detail)==null?void 0:A.id,label:f==null?void 0:f.detail.label,message:(x=f==null?void 0:f.detail)==null?void 0:x.message}]):a.current.empties=h.filter(C=>{var p;return C.id!==((p=f==null?void 0:f.detail)==null?void 0:p.id)})},g=()=>({addEventListeners:()=>document.addEventListener(en,d),removeEventListeners:()=>document.removeEventListener(en,d)}),[v,_]=$.useState(!1),b=c.jsx(Ef,{incorrectMessages:n.current.incorrect.map(f=>f.label),requiredMessages:a.current.empties.map(f=>f.label),opened:v,setOpened:_});return $.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=g();return f(),()=>{h()}},[]),{validationPopup:b,formIsValid:u,setValidations:r}},nn=({id:e,requiredMessage:t,variant:r="standard",...n})=>{const[o,s]=$.useState({isError:!1}),[i,a]=$.useState(!1),u=b=>{const f=new CustomEvent(`${tn}_${e}`,{detail:{id:e,value:b}});document.dispatchEvent(f)},l=b=>{const{detail:f}=b;f&&s(h=>({isError:f.isError,message:f.message}))};$.useEffect(()=>(document.addEventListener(`${rn}_${e}`,l),()=>{document.removeEventListener(`${rn}_${e}`,l)}),[]);const d=(b,f=!1)=>{if(!n.required)return;f&&a(!b);const h=new CustomEvent(en,{detail:{id:e,empty:!b,label:n.label??"",message:t}});document.dispatchEvent(h)};$.useEffect(()=>{setTimeout(()=>d((n==null?void 0:n.value)||""),1)},[]);const g=b=>{var f,h;a(((h=(f=b==null?void 0:b.detail)==null?void 0:f.ids)==null?void 0:h.includes(e))||!1)},v=()=>({addEventListeners:()=>document.addEventListener(Qr,g),removeEventListeners:()=>document.removeEventListener(Qr,g)});$.useEffect(()=>{const{addEventListeners:b,removeEventListeners:f}=v();return b(),()=>{f()}},[]);const _=()=>{if(o.isError)return o.message;if(i)return t||"Это поле обязательно к заполнению"};return $.useEffect(()=>{n.value&&d(n.value,!0)},[n.value]),c.jsx(fe.TextField,{sx:{".MuiInputLabel-root.Mui-focused":{color:"#bbb"},".MuiInput-root:after":{borderBottomColor:"#CBD7DC"}},...n,variant:r,helperText:_(),error:o.isError||i||!1,onChange:b=>{var f;(f=n==null?void 0:n.onChange)==null||f.call(n,b),d(b.target.value,!0)},onBlur:b=>{var f;u(b.target.value),(f=n==null?void 0:n.onBlur)==null||f.call(n,b)},autoComplete:"off",fullWidth:!0})},on=({text:e,onSuccessAdd:t})=>{const{phoneNumber:r}=$.useContext(Qe),{closePopupById:n}=$.useContext(ut),[o,s]=$.useState({text:e??"",title:""}),{isLoading:i,Send:a}=St({url:"externalCustomerCabinet/ticket",method:"post",successMessage:"Обращение успешно создано",onSuccessMessageConfirm:()=>n(on.name)}),{formIsValid:u,validationPopup:l}=si({}),d=()=>{u()&&a({...o,phone:r}).then(()=>{t==null||t()})};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[l,c.jsx("div",{children:c.jsx(nn,{id:"title",label:"Заголовок",value:o.title,onChange:g=>s(v=>({...v,title:g.target.value}))})}),c.jsx("div",{children:c.jsx(nn,{multiline:!0,required:!0,id:"text",label:"Текст",value:o.text,onChange:g=>s(v=>({...v,text:g.target.value}))})}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(oi,{isLoading:i,onClick:()=>d(),children:"Создать новое обращение"})})]})},Cf=()=>{const{phoneNumber:e}=$.useContext(Qe),{showNewPopup:t}=$.useContext(ut),{setIsLoading:r}=$.useContext(ct),[n,o]=$.useState([]),[s,i]=$.useState(null),{Send:a}=St({url:"externalCustomerCabinet/tickets",method:"get",initLoading:!0}),u=async()=>{r(!0);const g=await a({phone:e});o(g.tickets),r(!1)};$.useEffect(()=>{u()},[]);const l=()=>{t({content:c.jsx(on,{onSuccessAdd:()=>u()}),id:on.name,title:"Создание обращения"})},d=$.useMemo(()=>c.jsx(fe.Button,{variant:"contained",onClick:()=>l(),children:"Создать обращение"}),[]);return{appeals:n,createAppealButton:d,additionalInfoState:s}};const ii=({opened:e,setOpened:t,title:r,style:n,children:o})=>c.jsx(fe.Modal,{open:e,onClose:()=>{t(!1)},children:c.jsx(fe.Box,{className:"popup__root",style:n,children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"popup",children:[c.jsxs("div",{className:"popup__title",children:[c.jsx("div",{children:r||"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{color:"primary",onClick:()=>t(!1),children:c.jsx(Vn,{})})})]}),c.jsx("div",{className:"popup__body",children:o})]})})});var Bn={},Sf=Le;Object.defineProperty(Bn,"__esModule",{value:!0});var ai=Bn.default=void 0,Tf=Sf(Ve()),Rf=c,$f=(0,Tf.default)((0,Rf.jsx)("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send");ai=Bn.default=$f;const wf=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};function jf(e,t){const r=$.useRef(t);wf(t,r.current)||(r.current=t),$.useEffect(e,[e])}const Of=({messages:e,preparedMessage:t,onSendMessageClick:r,isLoading:n,addIsLoading:o,remoteColor:s,remoteBackgroundColor:i})=>{var f;const[a,u]=$.useState(t??"");(((f=document.getElementById("root"))==null?void 0:f.clientWidth)??0)-80;const{ConvertUTCDateToLocalDate:l,ParseDataTimeToRusLocale:d}=kn(),{formIsValid:g,validationPopup:v}=si({}),_=()=>{g()&&(r(a),u(""))},b=h=>d(l(new Date(h.creationDate)));return jf(()=>{setTimeout(()=>{let h=document.getElementById("chat__chat_area");h&&h.scrollBy({top:h.scrollHeight,behavior:"smooth"})},300)},e.map(h=>h.id)),c.jsx("div",{children:c.jsxs("div",{className:"chat",children:[v,c.jsxs("section",{id:"chat__chat_area",className:"chat__chat_area",children:[e.length===0&&c.jsx("div",{className:"chat__chat_area__not_found",children:c.jsx("div",{children:n?"Идет загрузка":"Сообщения не найдены"})}),c.jsx("div",{className:"chat__chat_area__messages",children:e.map((h,R)=>c.jsx("div",{className:ar("chat__chat_area__messages__message",{remote:!h.isBusinessMessage}),children:c.jsx("div",{children:c.jsxs("div",{style:{backgroundColor:h.isBusinessMessage?void 0:i,opacity:h.isBusinessMessage?void 0:.8,color:h.isBusinessMessage?void 0:s},children:[c.jsx("div",{children:h.text}),c.jsx("div",{className:"chat__chat_area__messages__message__date",children:b(h)})]})})},R))})]}),c.jsx("div",{className:"chat__input",children:c.jsx(nn,{required:!0,id:"chatMessage",label:"Текст",value:a,onChange:h=>u(h.target.value),multiline:!0})}),c.jsx("div",{className:"chat__button",children:c.jsx(bi.LoadingButton,{disabled:!a,loading:o,variant:"contained",endIcon:c.jsx(ai,{}),onClick:()=>_(),children:"Отправить"})})]})})},Pf=(e,t)=>{const[r,n]=$.useState(Math.random()),o=$.useRef(!0);$.useEffect(()=>{if(o.current){o.current=!1,e(),n(Math.random());return}setTimeout(()=>{e(),n(Math.random())},t)},[r])},If=({opened:e,setOpened:t,appeal:r,onSuccess:n,preparedText:o})=>{const[s,i]=$.useState([]),{Send:a,isLoading:u}=St({url:"/externalCustomerCabinet/ticket/messages",method:"post",initLoading:!0}),{Send:l,isLoading:d}=St({url:"/externalCustomerCabinet/ticket/messages/new",method:"post",successMessage:"Сообщение успешно отправлено"}),g=_=>{l({chatId:r.chatId,message:_}).then(b=>{b.message.creationDate=new Date(b.message.creationDate.replace("Z","")),i(f=>[...f,b.message])})},v=()=>{a({chatId:r.chatId}).then(_=>{i(_.messages)})};return Pf(()=>v(),5e3),c.jsx(ii,{title:"Обращение",opened:e,setOpened:()=>t(!1),children:c.jsx(Of,{preparedMessage:o,messages:s,isLoading:u,onSendMessageClick:_=>g(_),addIsLoading:d})})};const Nf=({appeal:e,additionalInfo:t})=>{const{ParseDataToRusLocale:r}=kn(),[n,o]=$.useState(!1);return $.useEffect(()=>{t&&t.id===e.id&&o(!0)},[t]),c.jsxs("div",{children:[n&&c.jsx(If,{preparedText:t==null?void 0:t.text,opened:n,setOpened:()=>o(!1),appeal:e}),c.jsxs("div",{className:"appeal_element",onClick:()=>o(!0),children:[c.jsxs("div",{className:"appeal_element__header",children:[c.jsx("div",{className:"appeal_element__header__left",children:c.jsxs("div",{children:[c.jsxs("div",{children:["Обращение № ",e.number]}),c.jsx("div",{children:e.title})]})}),c.jsx("div",{className:"appeal_element__header__right",children:c.jsx("div",{children:r(e.creationDate,{day:"2-digit",month:"2-digit",year:"2-digit"})})})]}),c.jsx("div",{className:"appeal_element__body",children:c.jsx(Zr,{title:`Последнее сообщение (${e.lastMessageIsBusiness?"Вам":"Вы"})`,text:e.lastMessageText})})]})]})},Af=()=>{const{appeals:e,createAppealButton:t,additionalInfoState:r}=Cf();return c.jsxs("div",{children:[c.jsx("div",{style:{marginBottom:"1em",display:"flex",flexDirection:"column",gap:"1em"},children:e.map((n,o)=>c.jsx(Nf,{additionalInfo:r,appeal:n},o))}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t})]})},Mf=({show:e})=>c.jsx(fe.Backdrop,{sx:{color:"#fff",zIndex:t=>t.zIndex.drawer+1},open:e,children:c.jsx(fe.CircularProgress,{color:"inherit"})});const kf=({isAndroid:e,isIOS:t})=>t||e?c.jsx("div",{className:ar("download_card_button",{download_card_button__android:e},{download_card_button__ios:t}),children:c.jsx("div",{})}):null;const Df=$u(({className:e,...t})=>c.jsx(fe.Tooltip,{...t,leaveDelay:500,classes:{popper:e}}))(({theme:e})=>({[`& .${fe.tooltipClasses.tooltip}`]:{backgroundColor:"#fff",color:"#000",boxShadow:"rgba(0, 0, 0, 0.4) 0px 30px 90px",maxWidth:400,display:"flex",justifyContent:"center",fontSize:"1em",fontWeight:300,padding:"1.5em",borderRadius:"1em",p:{marginBottom:".5em",span:{color:"var(--primary)"}}}}));var Fn={},Lf=Le;Object.defineProperty(Fn,"__esModule",{value:!0});var ci=Fn.default=void 0,zf=Lf(Ve()),Vf=c,Bf=(0,zf.default)((0,Vf.jsx)("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMark");ci=Fn.default=Bf;const Ff=({title:e,color:t})=>c.jsx(Df,{className:"question_tooltip",title:e,placement:"top",arrow:!0,children:c.jsx("div",{children:c.jsx("div",{className:"question_tooltip_icon",style:{display:"flex",backgroundColor:t??"#e9e9e9",padding:"0.1em",borderRadius:"50%",fontSize:"14px"},children:c.jsx(ci,{fontSize:"inherit"})})})}),Uf=({children:e,questionText:t,labelRightSlot:r,label:n,...o})=>c.jsxs("div",{...o,className:"text_with_label",children:[c.jsxs("div",{className:"text_with_label__label",children:[c.jsx("div",{children:n}),r&&c.jsx("div",{style:{marginLeft:"1em"},children:r}),t&&c.jsx("div",{children:c.jsx(Ff,{title:t})})]}),c.jsx("div",{className:"text_with_label__body",children:e})]}),Yf=e=>e||"—",Wf=()=>{const e=window.navigator.userAgent.toLowerCase().includes("iphone"),t=window.navigator.userAgent.toLowerCase().includes("android"),{phoneNumber:r,cabinetSettings:n,customer:o}=$.useContext(Qe),{setIsLoading:s}=$.useContext(ct),[i,a]=$.useState([]),{Send:u}=St({url:"/externalCustomerCabinet/form/info",method:"post"}),l=async()=>{s(!0);const d=await u();a(d.controls),s(!1)};return $.useEffect(()=>{r&&l()},[r]),c.jsx("div",{children:c.jsxs("div",{className:"customer_info",children:[c.jsx("div",{className:"qr_element",children:(n==null?void 0:n.canShowECardLink)&&c.jsx("a",{href:"",target:"_blank",children:c.jsx(kf,{isIOS:e,isAndroid:t})})}),c.jsxs("div",{className:"person_loyalty_info",children:[c.jsx("div",{children:"Информация по карте лояльности"}),c.jsx("div",{className:"controls",children:i.map((d,g)=>c.jsx(Uf,{label:d.title,children:c.jsx("div",{children:Yf(d.text)})}))})]})]})})},qf=()=>{var u;const[e,t]=$.useState(""),r=(l,d)=>{t(d)},{cabinetSettings:n}=$.useContext(Qe),{isLoading:o}=$.useContext(ct),{popups:s,closePopupById:i}=$.useContext(ut),a=[{icon:c.jsx(Vs,{}),value:"info",label:"Карта",page:c.jsx(Wf,{}),active:!0},{icon:c.jsx(Ls,{}),value:"receipt",label:"История",page:c.jsx(Zd,{}),active:!0},{icon:c.jsx(Bs,{}),value:"appeals",label:"Обращения",page:c.jsx(Af,{}),active:n==null?void 0:n.canShowAppeals},{icon:c.jsx(ir,{}),value:"businessInfo",label:"Информация",page:c.jsx(Qd,{}),active:n==null?void 0:n.canShowBusinessInfo},{icon:c.jsx(zs,{}),value:"personInfo",label:"Клиент",page:c.jsx("div",{children:"Редактирование клиента"}),active:n==null?void 0:n.canEditPersonInfo},{icon:c.jsx(Fs,{}),value:"registration",label:"Регистрация",page:c.jsx("div",{children:"Регистрация клиента"}),active:n==null?void 0:n.isReg}];return c.jsxs("div",{className:"page_view",children:[c.jsx(Mf,{show:o}),s.map((l,d)=>c.jsx(ii,{title:l.title,opened:!0,setOpened:()=>i(l.id),children:c.jsx("div",{children:l.content})})),c.jsx("div",{className:"page_view__page scrollbar",children:(u=a.find(l=>l.value===e))==null?void 0:u.page}),c.jsx("div",{className:"page_view__navigation",children:c.jsx("div",{children:c.jsx(fe.BottomNavigation,{sx:{paddingBottom:"2em"},value:e,onChange:r,children:a.map((l,d)=>c.jsx(fe.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:l.label,value:l.value,icon:l.icon},d))})})})]})};exports.AppContext=Qe;exports.AppProvider=td;exports.ErrorBoundary=Si;exports.LoadingContext=ct;exports.LoadingProvider=Zl;exports.PopupContext=ut;exports.PopupProvider=Vd;exports.Router=qf;
|
|
225
|
+
`),cf)),ri=O.forwardRef(function(t,r){const n=$t({props:t,name:"MuiCircularProgress"}),{className:o,color:s="primary",disableShrink:i=!1,size:a=40,style:u,thickness:l=3.6,value:d=0,variant:g="indeterminate"}=n,v=Pe(n,sf),_=N({},n,{color:s,disableShrink:i,size:a,thickness:l,value:d,variant:g}),b=uf(_),f={},h={},R={};if(g==="determinate"){const A=2*Math.PI*((et-l)/2);f.strokeDasharray=A.toFixed(3),R["aria-valuenow"]=Math.round(d),f.strokeDashoffset=`${((100-d)/100*A).toFixed(3)}px`,h.transform="rotate(-90deg)"}return c.jsx(lf,N({className:Ie(b.root,o),style:N({width:a,height:a},h,u),ownerState:_,ref:r,role:"progressbar"},R,v,{children:c.jsx(df,{className:b.svg,ownerState:_,viewBox:`${et/2} ${et/2} ${et} ${et}`,children:c.jsx(ff,{className:b.circle,style:f,ownerState:_,cx:et,cy:et,r:(et-l)/2,fill:"none",strokeWidth:l})})}))});process.env.NODE_ENV!=="production"&&(ri.propTypes={classes:y.object,className:y.string,color:y.oneOfType([y.oneOf(["inherit","primary","secondary","error","info","success","warning"]),y.string]),disableShrink:cn(y.bool,e=>e.disableShrink&&e.variant&&e.variant!=="indeterminate"?new Error("MUI: You have provided the `disableShrink` prop with a variant other than `indeterminate`. This will have no effect."):null),size:y.oneOfType([y.number,y.string]),style:y.object,sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),thickness:y.number,value:y.number,variant:y.oneOf(["determinate","indeterminate"])});const pf=ri;function mf(e){return at("MuiLoadingButton",e)}const hf=Tt("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),Xe=hf,vf=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],gf=e=>{const{loading:t,loadingPosition:r,classes:n}=e,o={root:["root",t&&"loading"],startIcon:[t&&`startIconLoading${ce(r)}`],endIcon:[t&&`endIconLoading${ce(r)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${ce(r)}`]},s=Lt(o,mf,n);return N({},n,s)},yf=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",bf=ze(Xs,{shouldForwardProp:e=>yf(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${Xe.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${Xe.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>N({[`& .${Xe.startIconLoadingStart}, & .${Xe.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},e.loadingPosition==="center"&&{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${Xe.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${Xe.startIconLoadingStart}, & .${Xe.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${Xe.startIconLoadingStart}, & .${Xe.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),xf=ze("div",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.loadingIndicator,t[`loadingIndicator${ce(r.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>N({position:"absolute",visibility:"visible",display:"flex"},t.loadingPosition==="start"&&(t.variant==="outlined"||t.variant==="contained")&&{left:t.size==="small"?10:14},t.loadingPosition==="start"&&t.variant==="text"&&{left:6},t.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled},t.loadingPosition==="end"&&(t.variant==="outlined"||t.variant==="contained")&&{right:t.size==="small"?10:14},t.loadingPosition==="end"&&t.variant==="text"&&{right:6},t.loadingPosition==="start"&&t.fullWidth&&{position:"relative",left:-10},t.loadingPosition==="end"&&t.fullWidth&&{position:"relative",right:-10})),ni=O.forwardRef(function(t,r){const n=$t({props:t,name:"MuiLoadingButton"}),{children:o,disabled:s=!1,id:i,loading:a=!1,loadingIndicator:u,loadingPosition:l="center",variant:d="text"}=n,g=Pe(n,vf),v=ds(i),_=u??c.jsx(pf,{"aria-labelledby":v,color:"inherit",size:16}),b=N({},n,{disabled:s,loading:a,loadingIndicator:_,loadingPosition:l,variant:d}),f=gf(b),h=a?c.jsx(xf,{className:f.loadingIndicator,ownerState:b,children:_}):null;return c.jsxs(bf,N({disabled:s||a,id:v,ref:r},g,{variant:d,classes:f,ownerState:b,children:[b.loadingPosition==="end"?o:h,b.loadingPosition==="end"?h:o]}))});process.env.NODE_ENV!=="production"&&(ni.propTypes={children:y.node,classes:y.object,disabled:y.bool,id:y.string,loading:y.bool,loadingIndicator:y.node,loadingPosition:cn(y.oneOf(["start","end","center"]),e=>e.loadingPosition==="start"&&!e.startIcon?new Error('MUI: The loadingPosition="start" should be used in combination with startIcon.'):e.loadingPosition==="end"&&!e.endIcon?new Error('MUI: The loadingPosition="end" should be used in combination with endIcon.'):null),sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),variant:y.oneOfType([y.oneOf(["contained","outlined","text"]),y.string])});const _f=ni,oi=({onClick:e,isLoading:t,children:r})=>($.useEffect(()=>{const n=o=>{(o.code==="Enter"||o.code==="NumpadEnter")&&(e==null||e(),o.preventDefault())};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e]),c.jsx(_f,{onClick:()=>e==null?void 0:e(),loading:t,variant:"contained",children:r||"Далее"}));function Ef({opened:e,setOpened:t,requiredMessages:r,incorrectMessages:n}){const o=()=>{t(!1)};return c.jsx(fe.Modal,{open:e,onClose:t,children:c.jsx(fe.Box,{className:"validation popup__root",children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"validation_popup",children:[c.jsxs("div",{className:"validation_popup__title",children:[c.jsx("div",{children:"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{onClick:()=>o(),children:c.jsx(Vn,{})})})]}),c.jsxs("div",{className:"validation_popup__body",children:[r.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(ir,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Не указаны следующие обязательные поля:"}),c.jsx("ul",{children:r.map((s,i)=>c.jsx("li",{dangerouslySetInnerHTML:{__html:s}},i))})]})]})}),n.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(ir,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Следующие поля заполнены с ошибкой:"}),c.jsx("ul",{children:n.map((s,i)=>c.jsx("li",{children:s},i))})]})]})})]}),c.jsx("div",{className:"validation_popup__buttons",children:c.jsx(oi,{onClick:()=>o(),children:"Продолжить"})})]})})})}const si=({validationsProp:e})=>{const[t,r]=$.useState(e),n=$.useRef({incorrect:[]}),o=(f,h,R,A)=>{const{detail:x}=f;if(x&&A){const C=n.current.incorrect;if(!x.value){n.current.incorrect=C.filter(P=>P.id!==h),s({id:x.id,isError:!1});return}const p=A(x.value);p.isError?C.some(P=>P.id===h)||(n.current.incorrect=[...C,{id:h,message:p.message,label:R}]):n.current.incorrect=C.filter(P=>P.id!==h),s({id:x.id,isError:p.isError,message:p.message})}},s=f=>{const h=new CustomEvent(`${rn}_${f.id}`,{detail:{...f}});document.dispatchEvent(h)},i=()=>({addEventListeners:()=>t==null?void 0:t.forEach(f=>document.addEventListener(`${tn}_${f.id}`,h=>o(h,f.id,f.label,f.validator))),removeEventListeners:()=>t==null?void 0:t.forEach(f=>document.removeEventListener(`${tn}_${f.id}`,h=>o(h,f.id,f.label,f.validator)))});$.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=i();return f(),()=>{h()}},[t]);const a=$.useRef({empties:[]}),u=()=>a.current.empties.length>0||n.current.incorrect.length>0?(l(),_(!0),!1):!0,l=()=>{const f=new CustomEvent(Qr,{detail:{ids:a.current.empties.map(h=>h.id)}});document.dispatchEvent(f)},d=f=>{var R,A,x;const h=a.current.empties;(R=f==null?void 0:f.detail)!=null&&R.empty?h.some(C=>{var p;return C.id===((p=f==null?void 0:f.detail)==null?void 0:p.id)})||(a.current.empties=[...h,{id:(A=f==null?void 0:f.detail)==null?void 0:A.id,label:f==null?void 0:f.detail.label,message:(x=f==null?void 0:f.detail)==null?void 0:x.message}]):a.current.empties=h.filter(C=>{var p;return C.id!==((p=f==null?void 0:f.detail)==null?void 0:p.id)})},g=()=>({addEventListeners:()=>document.addEventListener(en,d),removeEventListeners:()=>document.removeEventListener(en,d)}),[v,_]=$.useState(!1),b=c.jsx(Ef,{incorrectMessages:n.current.incorrect.map(f=>f.label),requiredMessages:a.current.empties.map(f=>f.label),opened:v,setOpened:_});return $.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=g();return f(),()=>{h()}},[]),{validationPopup:b,formIsValid:u,setValidations:r}},nn=({id:e,requiredMessage:t,variant:r="standard",...n})=>{const[o,s]=$.useState({isError:!1}),[i,a]=$.useState(!1),u=b=>{const f=new CustomEvent(`${tn}_${e}`,{detail:{id:e,value:b}});document.dispatchEvent(f)},l=b=>{const{detail:f}=b;f&&s(h=>({isError:f.isError,message:f.message}))};$.useEffect(()=>(document.addEventListener(`${rn}_${e}`,l),()=>{document.removeEventListener(`${rn}_${e}`,l)}),[]);const d=(b,f=!1)=>{if(!n.required)return;f&&a(!b);const h=new CustomEvent(en,{detail:{id:e,empty:!b,label:n.label??"",message:t}});document.dispatchEvent(h)};$.useEffect(()=>{setTimeout(()=>d((n==null?void 0:n.value)||""),1)},[]);const g=b=>{var f,h;a(((h=(f=b==null?void 0:b.detail)==null?void 0:f.ids)==null?void 0:h.includes(e))||!1)},v=()=>({addEventListeners:()=>document.addEventListener(Qr,g),removeEventListeners:()=>document.removeEventListener(Qr,g)});$.useEffect(()=>{const{addEventListeners:b,removeEventListeners:f}=v();return b(),()=>{f()}},[]);const _=()=>{if(o.isError)return o.message;if(i)return t||"Это поле обязательно к заполнению"};return $.useEffect(()=>{n.value&&d(n.value,!0)},[n.value]),c.jsx(fe.TextField,{sx:{".MuiInputLabel-root.Mui-focused":{color:"#bbb"},".MuiInput-root:after":{borderBottomColor:"#CBD7DC"}},...n,variant:r,helperText:_(),error:o.isError||i||!1,onChange:b=>{var f;(f=n==null?void 0:n.onChange)==null||f.call(n,b),d(b.target.value,!0)},onBlur:b=>{var f;u(b.target.value),(f=n==null?void 0:n.onBlur)==null||f.call(n,b)},autoComplete:"off",fullWidth:!0})},on=({text:e,onSuccessAdd:t})=>{const{phoneNumber:r}=$.useContext(Qe),{closePopupById:n}=$.useContext(ut),[o,s]=$.useState({text:e??"",title:""}),{isLoading:i,Send:a}=St({url:"externalCustomerCabinet/ticket",method:"post",successMessage:"Обращение успешно создано",onSuccessMessageConfirm:()=>n(on.name)}),{formIsValid:u,validationPopup:l}=si({}),d=()=>{u()&&a({...o,phone:r}).then(()=>{t==null||t()})};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[l,c.jsx("div",{children:c.jsx(nn,{id:"title",label:"Заголовок",value:o.title,onChange:g=>s(v=>({...v,title:g.target.value}))})}),c.jsx("div",{children:c.jsx(nn,{multiline:!0,required:!0,id:"text",label:"Текст",value:o.text,onChange:g=>s(v=>({...v,text:g.target.value}))})}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(oi,{isLoading:i,onClick:()=>d(),children:"Создать новое обращение"})})]})},Cf=()=>{const{phoneNumber:e}=$.useContext(Qe),{showNewPopup:t}=$.useContext(ut),{setIsLoading:r}=$.useContext(ct),[n,o]=$.useState([]),[s,i]=$.useState(null),{Send:a}=St({url:"externalCustomerCabinet/tickets",method:"get",initLoading:!0}),u=async()=>{r(!0);const g=await a({phone:e});o(g.tickets),r(!1)};$.useEffect(()=>{u()},[]);const l=()=>{t({content:c.jsx(on,{onSuccessAdd:()=>u()}),id:on.name,title:"Создание обращения"})},d=$.useMemo(()=>c.jsx(fe.Button,{variant:"contained",onClick:()=>l(),children:"Создать обращение"}),[]);return{appeals:n,createAppealButton:d,additionalInfoState:s}};const ii=({opened:e,setOpened:t,title:r,style:n,children:o})=>c.jsx(fe.Modal,{open:e,onClose:()=>{t(!1)},children:c.jsx(fe.Box,{className:"popup__root",style:n,children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"popup",children:[c.jsxs("div",{className:"popup__title",children:[c.jsx("div",{children:r||"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{color:"primary",onClick:()=>t(!1),children:c.jsx(Vn,{})})})]}),c.jsx("div",{className:"popup__body",children:o})]})})});var Bn={},Sf=Le;Object.defineProperty(Bn,"__esModule",{value:!0});var ai=Bn.default=void 0,Tf=Sf(Ve()),Rf=c,$f=(0,Tf.default)((0,Rf.jsx)("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send");ai=Bn.default=$f;const wf=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};function jf(e,t){const r=$.useRef(t);wf(t,r.current)||(r.current=t),$.useEffect(e,[e])}const Of=({messages:e,preparedMessage:t,onSendMessageClick:r,isLoading:n,addIsLoading:o,remoteColor:s,remoteBackgroundColor:i})=>{var f;const[a,u]=$.useState(t??"");(((f=document.getElementById("root"))==null?void 0:f.clientWidth)??0)-80;const{ConvertUTCDateToLocalDate:l,ParseDataTimeToRusLocale:d}=kn(),{formIsValid:g,validationPopup:v}=si({}),_=()=>{g()&&(r(a),u(""))},b=h=>d(l(new Date(h.creationDate)));return jf(()=>{setTimeout(()=>{let h=document.getElementById("chat__chat_area");h&&h.scrollBy({top:h.scrollHeight,behavior:"smooth"})},300)},e.map(h=>h.id)),c.jsx("div",{children:c.jsxs("div",{className:"chat",children:[v,c.jsxs("section",{id:"chat__chat_area",className:"chat__chat_area",children:[e.length===0&&c.jsx("div",{className:"chat__chat_area__not_found",children:c.jsx("div",{children:n?"Идет загрузка":"Сообщения не найдены"})}),c.jsx("div",{className:"chat__chat_area__messages",children:e.map((h,R)=>c.jsx("div",{className:ar("chat__chat_area__messages__message",{remote:!h.isBusinessMessage}),children:c.jsx("div",{children:c.jsxs("div",{style:{backgroundColor:h.isBusinessMessage?void 0:i,opacity:h.isBusinessMessage?void 0:.8,color:h.isBusinessMessage?void 0:s},children:[c.jsx("div",{children:h.text}),c.jsx("div",{className:"chat__chat_area__messages__message__date",children:b(h)})]})})},R))})]}),c.jsx("div",{className:"chat__input",children:c.jsx(nn,{required:!0,id:"chatMessage",label:"Текст",value:a,onChange:h=>u(h.target.value),multiline:!0})}),c.jsx("div",{className:"chat__button",children:c.jsx(bi.LoadingButton,{disabled:!a,loading:o,variant:"contained",endIcon:c.jsx(ai,{}),onClick:()=>_(),children:"Отправить"})})]})})},Pf=(e,t)=>{const[r,n]=$.useState(Math.random()),o=$.useRef(!0);$.useEffect(()=>{if(o.current){o.current=!1,e(),n(Math.random());return}setTimeout(()=>{e(),n(Math.random())},t)},[r])},If=({opened:e,setOpened:t,appeal:r,onSuccess:n,preparedText:o})=>{const[s,i]=$.useState([]),{Send:a,isLoading:u}=St({url:"/externalCustomerCabinet/ticket/messages",method:"post",initLoading:!0}),{Send:l,isLoading:d}=St({url:"/externalCustomerCabinet/ticket/messages/new",method:"post",successMessage:"Сообщение успешно отправлено"}),g=_=>{l({chatId:r.chatId,message:_}).then(b=>{b.message.creationDate=new Date(b.message.creationDate.replace("Z","")),i(f=>[...f,b.message])})},v=()=>{a({chatId:r.chatId}).then(_=>{i(_.messages)})};return Pf(()=>v(),5e3),c.jsx(ii,{title:"Обращение",opened:e,setOpened:()=>t(!1),children:c.jsx(Of,{preparedMessage:o,messages:s,isLoading:u,onSendMessageClick:_=>g(_),addIsLoading:d})})};const Nf=({appeal:e,additionalInfo:t})=>{const{ParseDataToRusLocale:r}=kn(),[n,o]=$.useState(!1);return $.useEffect(()=>{t&&t.id===e.id&&o(!0)},[t]),c.jsxs("div",{children:[n&&c.jsx(If,{preparedText:t==null?void 0:t.text,opened:n,setOpened:()=>o(!1),appeal:e}),c.jsxs("div",{className:"appeal_element",onClick:()=>o(!0),children:[c.jsxs("div",{className:"appeal_element__header",children:[c.jsx("div",{className:"appeal_element__header__left",children:c.jsxs("div",{children:[c.jsxs("div",{children:["Обращение № ",e.number]}),c.jsx("div",{children:e.title})]})}),c.jsx("div",{className:"appeal_element__header__right",children:c.jsx("div",{children:r(e.creationDate,{day:"2-digit",month:"2-digit",year:"2-digit"})})})]}),c.jsx("div",{className:"appeal_element__body",children:c.jsx(Zr,{title:`Последнее сообщение (${e.lastMessageIsBusiness?"Вам":"Вы"})`,text:e.lastMessageText})})]})]})},Af=()=>{const{appeals:e,createAppealButton:t,additionalInfoState:r}=Cf();return c.jsxs("div",{children:[c.jsx("div",{style:{marginBottom:"1em",display:"flex",flexDirection:"column",gap:"1em"},children:e.map((n,o)=>c.jsx(Nf,{additionalInfo:r,appeal:n},o))}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t})]})},Mf=({show:e})=>c.jsx(fe.Backdrop,{sx:{color:"#fff",zIndex:t=>t.zIndex.drawer+1},open:e,children:c.jsx(fe.CircularProgress,{color:"inherit"})});const kf=({isAndroid:e,isIOS:t})=>t||e?c.jsx("div",{className:ar("download_card_button",{download_card_button__android:e},{download_card_button__ios:t}),children:c.jsx("div",{})}):null;const Df=$u(({className:e,...t})=>c.jsx(fe.Tooltip,{...t,leaveDelay:500,classes:{popper:e}}))(({theme:e})=>({[`& .${fe.tooltipClasses.tooltip}`]:{backgroundColor:"#fff",color:"#000",boxShadow:"rgba(0, 0, 0, 0.4) 0px 30px 90px",maxWidth:400,display:"flex",justifyContent:"center",fontSize:"1em",fontWeight:300,padding:"1.5em",borderRadius:"1em",p:{marginBottom:".5em",span:{color:"var(--primary)"}}}}));var Fn={},Lf=Le;Object.defineProperty(Fn,"__esModule",{value:!0});var ci=Fn.default=void 0,zf=Lf(Ve()),Vf=c,Bf=(0,zf.default)((0,Vf.jsx)("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMark");ci=Fn.default=Bf;const Ff=({title:e,color:t})=>c.jsx(Df,{className:"question_tooltip",title:e,placement:"top",arrow:!0,children:c.jsx("div",{children:c.jsx("div",{className:"question_tooltip_icon",style:{display:"flex",backgroundColor:t??"#e9e9e9",padding:"0.1em",borderRadius:"50%",fontSize:"14px"},children:c.jsx(ci,{fontSize:"inherit"})})})}),Uf=({children:e,questionText:t,labelRightSlot:r,label:n,...o})=>c.jsxs("div",{...o,className:"text_with_label",children:[c.jsxs("div",{className:"text_with_label__label",children:[c.jsx("div",{children:n}),r&&c.jsx("div",{style:{marginLeft:"1em"},children:r}),t&&c.jsx("div",{children:c.jsx(Ff,{title:t})})]}),c.jsx("div",{className:"text_with_label__body",children:e})]}),Yf=e=>e||"—";const Wf=()=>{const e=window.navigator.userAgent.toLowerCase().includes("iphone"),t=window.navigator.userAgent.toLowerCase().includes("android"),{phoneNumber:r,cabinetSettings:n,customer:o}=$.useContext(Qe),{setIsLoading:s}=$.useContext(ct),[i,a]=$.useState([]),{Send:u}=St({url:"/externalCustomerCabinet/form/info",method:"post"}),l=async()=>{s(!0);const d=await u();a(d.controls),s(!1)};return $.useEffect(()=>{r&&l()},[r]),c.jsx("div",{children:c.jsxs("div",{className:"customer_info",children:[c.jsx("div",{className:"qr_element",children:(n==null?void 0:n.canShowECardLink)&&c.jsx("a",{href:"",target:"_blank",children:c.jsx(kf,{isIOS:e,isAndroid:t})})}),c.jsxs("div",{className:"person_loyalty_info",children:[c.jsx("div",{children:"Информация по карте лояльности"}),c.jsx("div",{className:"controls",children:i.map((d,g)=>c.jsx(Uf,{label:d.title,children:c.jsx("div",{children:Yf(d.text)})}))})]})]})})},qf=()=>{var u;const[e,t]=$.useState(""),r=(l,d)=>{t(d)},{cabinetSettings:n}=$.useContext(Qe),{isLoading:o}=$.useContext(ct),{popups:s,closePopupById:i}=$.useContext(ut),a=[{icon:c.jsx(Vs,{}),value:"info",label:"Карта",page:c.jsx(Wf,{}),active:!0},{icon:c.jsx(Ls,{}),value:"receipt",label:"История",page:c.jsx(Zd,{}),active:!0},{icon:c.jsx(Bs,{}),value:"appeals",label:"Обращения",page:c.jsx(Af,{}),active:n==null?void 0:n.canShowAppeals},{icon:c.jsx(ir,{}),value:"businessInfo",label:"Информация",page:c.jsx(Qd,{}),active:n==null?void 0:n.canShowBusinessInfo},{icon:c.jsx(zs,{}),value:"personInfo",label:"Клиент",page:c.jsx("div",{children:"Редактирование клиента"}),active:n==null?void 0:n.canEditPersonInfo},{icon:c.jsx(Fs,{}),value:"registration",label:"Регистрация",page:c.jsx("div",{children:"Регистрация клиента"}),active:n==null?void 0:n.isReg}];return c.jsxs("div",{className:"page_view",children:[c.jsx(Mf,{show:o}),s.map((l,d)=>c.jsx(ii,{title:l.title,opened:!0,setOpened:()=>i(l.id),children:c.jsx("div",{children:l.content})})),c.jsx("div",{className:"page_view__page scrollbar",children:(u=a.find(l=>l.value===e))==null?void 0:u.page}),c.jsx("div",{className:"page_view__navigation",children:c.jsx("div",{children:c.jsx(fe.BottomNavigation,{sx:{paddingBottom:"2em"},value:e,onChange:r,children:a.map((l,d)=>c.jsx(fe.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:l.label,value:l.value,icon:l.icon},d))})})})]})};exports.AppContext=Qe;exports.AppProvider=td;exports.ErrorBoundary=Si;exports.LoadingContext=ct;exports.LoadingProvider=Zl;exports.PopupContext=ut;exports.PopupProvider=Vd;exports.Router=qf;
|
|
@@ -7748,7 +7748,8 @@ const up = ({ title: e, color: t }) => (
|
|
|
7748
7748
|
t && /* @__PURE__ */ c.jsx("div", { children: /* @__PURE__ */ c.jsx(up, { title: t }) })
|
|
7749
7749
|
] }),
|
|
7750
7750
|
/* @__PURE__ */ c.jsx("div", { className: "text_with_label__body", children: e })
|
|
7751
|
-
] }), dp = (e) => e || "—"
|
|
7751
|
+
] }), dp = (e) => e || "—";
|
|
7752
|
+
const fp = () => {
|
|
7752
7753
|
const e = window.navigator.userAgent.toLowerCase().includes("iphone"), t = window.navigator.userAgent.toLowerCase().includes("android"), { phoneNumber: r, cabinetSettings: n, customer: o } = Re(nt), { setIsLoading: i } = Re(wt), [s, a] = me([]), { Send: u } = Tt({
|
|
7753
7754
|
url: "/externalCustomerCabinet/form/info",
|
|
7754
7755
|
method: "post"
|
|
@@ -222,4 +222,4 @@ const theme2 = createTheme({ palette: {
|
|
|
222
222
|
animation: ${0} 1.4s linear infinite;
|
|
223
223
|
`),jd)),Id=ze("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),Nd=ze("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.circle,t[`circle${ae(r.variant)}`],r.disableShrink&&t.circleDisableShrink]}})(({ownerState:e,theme:t})=>N({stroke:"currentColor"},e.variant==="determinate"&&{transition:t.transitions.create("stroke-dashoffset")},e.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:e})=>e.variant==="indeterminate"&&!e.disableShrink&&rn(Hs||(Hs=yr`
|
|
224
224
|
animation: ${0} 1.4s ease-in-out infinite;
|
|
225
|
-
`),Od)),Xs=O.forwardRef(function(t,r){const n=St({props:t,name:"MuiCircularProgress"}),{className:o,color:s="primary",disableShrink:i=!1,size:a=40,style:u,thickness:l=3.6,value:d=0,variant:g="indeterminate"}=n,v=Re(n,wd),E=N({},n,{color:s,disableShrink:i,size:a,thickness:l,value:d,variant:g}),b=Pd(E),f={},h={},$={};if(g==="determinate"){const A=2*Math.PI*((rt-l)/2);f.strokeDasharray=A.toFixed(3),$["aria-valuenow"]=Math.round(d),f.strokeDashoffset=`${((100-d)/100*A).toFixed(3)}px`,h.transform="rotate(-90deg)"}return c.jsx(Rd,N({className:Ne(b.root,o),style:N({width:a,height:a},h,u),ownerState:E,ref:r,role:"progressbar"},$,v,{children:c.jsx(Id,{className:b.svg,ownerState:E,viewBox:`${rt/2} ${rt/2} ${rt} ${rt}`,children:c.jsx(Nd,{className:b.circle,style:f,ownerState:E,cx:rt,cy:rt,r:(rt-l)/2,fill:"none",strokeWidth:l})})}))});process.env.NODE_ENV!=="production"&&(Xs.propTypes={classes:y.object,className:y.string,color:y.oneOfType([y.oneOf(["inherit","primary","secondary","error","info","success","warning"]),y.string]),disableShrink:Pr(y.bool,e=>e.disableShrink&&e.variant&&e.variant!=="indeterminate"?new Error("MUI: You have provided the `disableShrink` prop with a variant other than `indeterminate`. This will have no effect."):null),size:y.oneOfType([y.number,y.string]),style:y.object,sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),thickness:y.number,value:y.number,variant:y.oneOf(["determinate","indeterminate"])});const Ad=Xs;function Md(e){return nt("MuiLoadingButton",e)}const He=mt("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),kd=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],Dd=e=>{const{loading:t,loadingPosition:r,classes:n}=e,o={root:["root",t&&"loading"],startIcon:[t&&`startIconLoading${ae(r)}`],endIcon:[t&&`endIconLoading${ae(r)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${ae(r)}`]},s=Pt(o,Md,n);return N({},n,s)},Ld=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",zd=ze(zs,{shouldForwardProp:e=>Ld(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${He.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${He.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>N({[`& .${He.startIconLoadingStart}, & .${He.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},e.loadingPosition==="center"&&{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${He.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${He.startIconLoadingStart}, & .${He.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${He.startIconLoadingStart}, & .${He.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),Bd=ze("div",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.loadingIndicator,t[`loadingIndicator${ae(r.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>N({position:"absolute",visibility:"visible",display:"flex"},t.loadingPosition==="start"&&(t.variant==="outlined"||t.variant==="contained")&&{left:t.size==="small"?10:14},t.loadingPosition==="start"&&t.variant==="text"&&{left:6},t.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled},t.loadingPosition==="end"&&(t.variant==="outlined"||t.variant==="contained")&&{right:t.size==="small"?10:14},t.loadingPosition==="end"&&t.variant==="text"&&{right:6},t.loadingPosition==="start"&&t.fullWidth&&{position:"relative",left:-10},t.loadingPosition==="end"&&t.fullWidth&&{position:"relative",right:-10})),Js=O.forwardRef(function(t,r){const n=St({props:t,name:"MuiLoadingButton"}),{children:o,disabled:s=!1,id:i,loading:a=!1,loadingIndicator:u,loadingPosition:l="center",variant:d="text"}=n,g=Re(n,kd),v=yo(i),E=u??c.jsx(Ad,{"aria-labelledby":v,color:"inherit",size:16}),b=N({},n,{disabled:s,loading:a,loadingIndicator:E,loadingPosition:l,variant:d}),f=Dd(b),h=a?c.jsx(Bd,{className:f.loadingIndicator,ownerState:b,children:E}):null;return c.jsxs(zd,N({disabled:s||a,id:v,ref:r},g,{variant:d,classes:f,ownerState:b,children:[b.loadingPosition==="end"?o:h,b.loadingPosition==="end"?h:o]}))});process.env.NODE_ENV!=="production"&&(Js.propTypes={children:y.node,classes:y.object,disabled:y.bool,id:y.string,loading:y.bool,loadingIndicator:y.node,loadingPosition:Pr(y.oneOf(["start","end","center"]),e=>e.loadingPosition==="start"&&!e.startIcon?new Error('MUI: The loadingPosition="start" should be used in combination with startIcon.'):e.loadingPosition==="end"&&!e.endIcon?new Error('MUI: The loadingPosition="end" should be used in combination with endIcon.'):null),sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),variant:y.oneOfType([y.oneOf(["contained","outlined","text"]),y.string])});const Vd=Js,Zs=({onClick:e,isLoading:t,children:r})=>(w.useEffect(()=>{const n=o=>{(o.code==="Enter"||o.code==="NumpadEnter")&&(e==null||e(),o.preventDefault())};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e]),c.jsx(Vd,{onClick:()=>e==null?void 0:e(),loading:t,variant:"contained",children:r||"Далее"})),tp="";function Fd({opened:e,setOpened:t,requiredMessages:r,incorrectMessages:n}){const o=()=>{t(!1)};return c.jsx(fe.Modal,{open:e,onClose:t,children:c.jsx(fe.Box,{className:"validation popup__root",children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"validation_popup",children:[c.jsxs("div",{className:"validation_popup__title",children:[c.jsx("div",{children:"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{onClick:()=>o(),children:c.jsx(In,{})})})]}),c.jsxs("div",{className:"validation_popup__body",children:[r.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(mr,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Не указаны следующие обязательные поля:"}),c.jsx("ul",{children:r.map((s,i)=>c.jsx("li",{dangerouslySetInnerHTML:{__html:s}},i))})]})]})}),n.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(mr,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Следующие поля заполнены с ошибкой:"}),c.jsx("ul",{children:n.map((s,i)=>c.jsx("li",{children:s},i))})]})]})})]}),c.jsx("div",{className:"validation_popup__buttons",children:c.jsx(Zs,{onClick:()=>o(),children:"Продолжить"})})]})})})}const Qs=({validationsProp:e})=>{const[t,r]=w.useState(e),n=w.useRef({incorrect:[]}),o=(f,h,$,A)=>{const{detail:x}=f;if(x&&A){const C=n.current.incorrect;if(!x.value){n.current.incorrect=C.filter(R=>R.id!==h),s({id:x.id,isError:!1});return}const p=A(x.value);p.isError?C.some(R=>R.id===h)||(n.current.incorrect=[...C,{id:h,message:p.message,label:$}]):n.current.incorrect=C.filter(R=>R.id!==h),s({id:x.id,isError:p.isError,message:p.message})}},s=f=>{const h=new CustomEvent(`${Pn}_${f.id}`,{detail:{...f}});document.dispatchEvent(h)},i=()=>({addEventListeners:()=>t==null?void 0:t.forEach(f=>document.addEventListener(`${On}_${f.id}`,h=>o(h,f.id,f.label,f.validator))),removeEventListeners:()=>t==null?void 0:t.forEach(f=>document.removeEventListener(`${On}_${f.id}`,h=>o(h,f.id,f.label,f.validator)))});w.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=i();return f(),()=>{h()}},[t]);const a=w.useRef({empties:[]}),u=()=>a.current.empties.length>0||n.current.incorrect.length>0?(l(),E(!0),!1):!0,l=()=>{const f=new CustomEvent(wn,{detail:{ids:a.current.empties.map(h=>h.id)}});document.dispatchEvent(f)},d=f=>{var $,A,x;const h=a.current.empties;($=f==null?void 0:f.detail)!=null&&$.empty?h.some(C=>{var p;return C.id===((p=f==null?void 0:f.detail)==null?void 0:p.id)})||(a.current.empties=[...h,{id:(A=f==null?void 0:f.detail)==null?void 0:A.id,label:f==null?void 0:f.detail.label,message:(x=f==null?void 0:f.detail)==null?void 0:x.message}]):a.current.empties=h.filter(C=>{var p;return C.id!==((p=f==null?void 0:f.detail)==null?void 0:p.id)})},g=()=>({addEventListeners:()=>document.addEventListener(jn,d),removeEventListeners:()=>document.removeEventListener(jn,d)}),[v,E]=w.useState(!1),b=c.jsx(Fd,{incorrectMessages:n.current.incorrect.map(f=>f.label),requiredMessages:a.current.empties.map(f=>f.label),opened:v,setOpened:E});return w.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=g();return f(),()=>{h()}},[]),{validationPopup:b,formIsValid:u,setValidations:r}},Nn=({id:e,requiredMessage:t,variant:r="standard",...n})=>{const[o,s]=w.useState({isError:!1}),[i,a]=w.useState(!1),u=b=>{const f=new CustomEvent(`${On}_${e}`,{detail:{id:e,value:b}});document.dispatchEvent(f)},l=b=>{const{detail:f}=b;f&&s(h=>({isError:f.isError,message:f.message}))};w.useEffect(()=>(document.addEventListener(`${Pn}_${e}`,l),()=>{document.removeEventListener(`${Pn}_${e}`,l)}),[]);const d=(b,f=!1)=>{if(!n.required)return;f&&a(!b);const h=new CustomEvent(jn,{detail:{id:e,empty:!b,label:n.label??"",message:t}});document.dispatchEvent(h)};w.useEffect(()=>{setTimeout(()=>d((n==null?void 0:n.value)||""),1)},[]);const g=b=>{var f,h;a(((h=(f=b==null?void 0:b.detail)==null?void 0:f.ids)==null?void 0:h.includes(e))||!1)},v=()=>({addEventListeners:()=>document.addEventListener(wn,g),removeEventListeners:()=>document.removeEventListener(wn,g)});w.useEffect(()=>{const{addEventListeners:b,removeEventListeners:f}=v();return b(),()=>{f()}},[]);const E=()=>{if(o.isError)return o.message;if(i)return t||"Это поле обязательно к заполнению"};return w.useEffect(()=>{n.value&&d(n.value,!0)},[n.value]),c.jsx(fe.TextField,{sx:{".MuiInputLabel-root.Mui-focused":{color:"#bbb"},".MuiInput-root:after":{borderBottomColor:"#CBD7DC"}},...n,variant:r,helperText:E(),error:o.isError||i||!1,onChange:b=>{var f;(f=n==null?void 0:n.onChange)==null||f.call(n,b),d(b.target.value,!0)},onBlur:b=>{var f;u(b.target.value),(f=n==null?void 0:n.onBlur)==null||f.call(n,b)},autoComplete:"off",fullWidth:!0})},An=({text:e,onSuccessAdd:t})=>{const{phoneNumber:r}=w.useContext(Ge),{closePopupById:n}=w.useContext(at),[o,s]=w.useState({text:e??"",title:""}),{isLoading:i,Send:a}=Tt({url:"externalCustomerCabinet/ticket",method:"post",successMessage:"Обращение успешно создано",onSuccessMessageConfirm:()=>n(An.name)}),{formIsValid:u,validationPopup:l}=Qs({}),d=()=>{u()&&a({...o,phone:r}).then(()=>{t==null||t()})};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[l,c.jsx("div",{children:c.jsx(Nn,{id:"title",label:"Заголовок",value:o.title,onChange:g=>s(v=>({...v,title:g.target.value}))})}),c.jsx("div",{children:c.jsx(Nn,{multiline:!0,required:!0,id:"text",label:"Текст",value:o.text,onChange:g=>s(v=>({...v,text:g.target.value}))})}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Zs,{isLoading:i,onClick:()=>d(),children:"Создать новое обращение"})})]})},Ud=()=>{const{phoneNumber:e}=w.useContext(Ge),{showNewPopup:t}=w.useContext(at),{setIsLoading:r}=w.useContext(st),[n,o]=w.useState([]),[s,i]=w.useState(null),{Send:a}=Tt({url:"externalCustomerCabinet/tickets",method:"get",initLoading:!0}),u=async()=>{r(!0);const g=await a({phone:e});o(g.tickets),r(!1)};w.useEffect(()=>{u()},[]);const l=()=>{t({content:c.jsx(An,{onSuccessAdd:()=>u()}),id:An.name,title:"Создание обращения"})},d=w.useMemo(()=>c.jsx(fe.Button,{variant:"contained",onClick:()=>l(),children:"Создать обращение"}),[]);return{appeals:n,createAppealButton:d,additionalInfoState:s}},rp="",ei=({opened:e,setOpened:t,title:r,style:n,children:o})=>c.jsx(fe.Modal,{open:e,onClose:()=>{t(!1)},children:c.jsx(fe.Box,{className:"popup__root",style:n,children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"popup",children:[c.jsxs("div",{className:"popup__title",children:[c.jsx("div",{children:r||"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{color:"primary",onClick:()=>t(!1),children:c.jsx(In,{})})})]}),c.jsx("div",{className:"popup__body",children:o})]})})});var Mn={},Yd=Le;Object.defineProperty(Mn,"__esModule",{value:!0});var ti=Mn.default=void 0,Wd=Yd(Be()),qd=c,Kd=(0,Wd.default)((0,qd.jsx)("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send");ti=Mn.default=Kd;const Gd=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};function Hd(e,t){const r=w.useRef(t);Gd(t,r.current)||(r.current=t),w.useEffect(e,[e])}const np="",Xd=({messages:e,preparedMessage:t,onSendMessageClick:r,isLoading:n,addIsLoading:o,remoteColor:s,remoteBackgroundColor:i})=>{var f;const[a,u]=w.useState(t??"");(((f=document.getElementById("root"))==null?void 0:f.clientWidth)??0)-80;const{ConvertUTCDateToLocalDate:l,ParseDataTimeToRusLocale:d}=Cn(),{formIsValid:g,validationPopup:v}=Qs({}),E=()=>{g()&&(r(a),u(""))},b=h=>d(l(new Date(h.creationDate)));return Hd(()=>{setTimeout(()=>{let h=document.getElementById("chat__chat_area");h&&h.scrollBy({top:h.scrollHeight,behavior:"smooth"})},300)},e.map(h=>h.id)),c.jsx("div",{children:c.jsxs("div",{className:"chat",children:[v,c.jsxs("section",{id:"chat__chat_area",className:"chat__chat_area",children:[e.length===0&&c.jsx("div",{className:"chat__chat_area__not_found",children:c.jsx("div",{children:n?"Идет загрузка":"Сообщения не найдены"})}),c.jsx("div",{className:"chat__chat_area__messages",children:e.map((h,$)=>c.jsx("div",{className:gr("chat__chat_area__messages__message",{remote:!h.isBusinessMessage}),children:c.jsx("div",{children:c.jsxs("div",{style:{backgroundColor:h.isBusinessMessage?void 0:i,opacity:h.isBusinessMessage?void 0:.8,color:h.isBusinessMessage?void 0:s},children:[c.jsx("div",{children:h.text}),c.jsx("div",{className:"chat__chat_area__messages__message__date",children:b(h)})]})})},$))})]}),c.jsx("div",{className:"chat__input",children:c.jsx(Nn,{required:!0,id:"chatMessage",label:"Текст",value:a,onChange:h=>u(h.target.value),multiline:!0})}),c.jsx("div",{className:"chat__button",children:c.jsx(di.LoadingButton,{disabled:!a,loading:o,variant:"contained",endIcon:c.jsx(ti,{}),onClick:()=>E(),children:"Отправить"})})]})})},Jd=(e,t)=>{const[r,n]=w.useState(Math.random()),o=w.useRef(!0);w.useEffect(()=>{if(o.current){o.current=!1,e(),n(Math.random());return}setTimeout(()=>{e(),n(Math.random())},t)},[r])},Zd=({opened:e,setOpened:t,appeal:r,onSuccess:n,preparedText:o})=>{const[s,i]=w.useState([]),{Send:a,isLoading:u}=Tt({url:"/externalCustomerCabinet/ticket/messages",method:"post",initLoading:!0}),{Send:l,isLoading:d}=Tt({url:"/externalCustomerCabinet/ticket/messages/new",method:"post",successMessage:"Сообщение успешно отправлено"}),g=E=>{l({chatId:r.chatId,message:E}).then(b=>{b.message.creationDate=new Date(b.message.creationDate.replace("Z","")),i(f=>[...f,b.message])})},v=()=>{a({chatId:r.chatId}).then(E=>{i(E.messages)})};return Jd(()=>v(),5e3),c.jsx(ei,{title:"Обращение",opened:e,setOpened:()=>t(!1),children:c.jsx(Xd,{preparedMessage:o,messages:s,isLoading:u,onSendMessageClick:E=>g(E),addIsLoading:d})})},op="",Qd=({appeal:e,additionalInfo:t})=>{const{ParseDataToRusLocale:r}=Cn(),[n,o]=w.useState(!1);return w.useEffect(()=>{t&&t.id===e.id&&o(!0)},[t]),c.jsxs("div",{children:[n&&c.jsx(Zd,{preparedText:t==null?void 0:t.text,opened:n,setOpened:()=>o(!1),appeal:e}),c.jsxs("div",{className:"appeal_element",onClick:()=>o(!0),children:[c.jsxs("div",{className:"appeal_element__header",children:[c.jsx("div",{className:"appeal_element__header__left",children:c.jsxs("div",{children:[c.jsxs("div",{children:["Обращение № ",e.number]}),c.jsx("div",{children:e.title})]})}),c.jsx("div",{className:"appeal_element__header__right",children:c.jsx("div",{children:r(e.creationDate,{day:"2-digit",month:"2-digit",year:"2-digit"})})})]}),c.jsx("div",{className:"appeal_element__body",children:c.jsx($n,{title:`Последнее сообщение (${e.lastMessageIsBusiness?"Вам":"Вы"})`,text:e.lastMessageText})})]})]})},ef=()=>{const{appeals:e,createAppealButton:t,additionalInfoState:r}=Ud();return c.jsxs("div",{children:[c.jsx("div",{style:{marginBottom:"1em",display:"flex",flexDirection:"column",gap:"1em"},children:e.map((n,o)=>c.jsx(Qd,{additionalInfo:r,appeal:n},o))}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t})]})},tf=({show:e})=>c.jsx(fe.Backdrop,{sx:{color:"#fff",zIndex:t=>t.zIndex.drawer+1},open:e,children:c.jsx(fe.CircularProgress,{color:"inherit"})}),sp="",rf=({isAndroid:e,isIOS:t})=>t||e?c.jsx("div",{className:gr("download_card_button",{download_card_button__android:e},{download_card_button__ios:t}),children:c.jsx("div",{})}):null,ip="",ap="",nf=fu(({className:e,...t})=>c.jsx(fe.Tooltip,{...t,leaveDelay:500,classes:{popper:e}}))(({theme:e})=>({[`& .${fe.tooltipClasses.tooltip}`]:{backgroundColor:"#fff",color:"#000",boxShadow:"rgba(0, 0, 0, 0.4) 0px 30px 90px",maxWidth:400,display:"flex",justifyContent:"center",fontSize:"1em",fontWeight:300,padding:"1.5em",borderRadius:"1em",p:{marginBottom:".5em",span:{color:"var(--primary)"}}}}));var kn={},of=Le;Object.defineProperty(kn,"__esModule",{value:!0});var ri=kn.default=void 0,sf=of(Be()),af=c,cf=(0,sf.default)((0,af.jsx)("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMark");ri=kn.default=cf;const uf=({title:e,color:t})=>c.jsx(nf,{className:"question_tooltip",title:e,placement:"top",arrow:!0,children:c.jsx("div",{children:c.jsx("div",{className:"question_tooltip_icon",style:{display:"flex",backgroundColor:t??"#e9e9e9",padding:"0.1em",borderRadius:"50%",fontSize:"14px"},children:c.jsx(ri,{fontSize:"inherit"})})})}),lf=({children:e,questionText:t,labelRightSlot:r,label:n,...o})=>c.jsxs("div",{...o,className:"text_with_label",children:[c.jsxs("div",{className:"text_with_label__label",children:[c.jsx("div",{children:n}),r&&c.jsx("div",{style:{marginLeft:"1em"},children:r}),t&&c.jsx("div",{children:c.jsx(uf,{title:t})})]}),c.jsx("div",{className:"text_with_label__body",children:e})]}),df=e=>e||"—",ff=()=>{const e=window.navigator.userAgent.toLowerCase().includes("iphone"),t=window.navigator.userAgent.toLowerCase().includes("android"),{phoneNumber:r,cabinetSettings:n,customer:o}=w.useContext(Ge),{setIsLoading:s}=w.useContext(st),[i,a]=w.useState([]),{Send:u}=Tt({url:"/externalCustomerCabinet/form/info",method:"post"}),l=async()=>{s(!0);const d=await u();a(d.controls),s(!1)};return w.useEffect(()=>{r&&l()},[r]),c.jsx("div",{children:c.jsxs("div",{className:"customer_info",children:[c.jsx("div",{className:"qr_element",children:(n==null?void 0:n.canShowECardLink)&&c.jsx("a",{href:"",target:"_blank",children:c.jsx(rf,{isIOS:e,isAndroid:t})})}),c.jsxs("div",{className:"person_loyalty_info",children:[c.jsx("div",{children:"Информация по карте лояльности"}),c.jsx("div",{className:"controls",children:i.map((d,g)=>c.jsx(lf,{label:d.title,children:c.jsx("div",{children:df(d.text)})}))})]})]})})},pf=()=>{var u;const[e,t]=w.useState(""),r=(l,d)=>{t(d)},{cabinetSettings:n}=w.useContext(Ge),{isLoading:o}=w.useContext(st),{popups:s,closePopupById:i}=w.useContext(at),a=[{icon:c.jsx(Ss,{}),value:"info",label:"Карта",page:c.jsx(ff,{}),active:!0},{icon:c.jsx(_s,{}),value:"receipt",label:"История",page:c.jsx(xd,{}),active:!0},{icon:c.jsx(Ts,{}),value:"appeals",label:"Обращения",page:c.jsx(ef,{}),active:n==null?void 0:n.canShowAppeals},{icon:c.jsx(mr,{}),value:"businessInfo",label:"Информация",page:c.jsx(Ed,{}),active:n==null?void 0:n.canShowBusinessInfo},{icon:c.jsx(Cs,{}),value:"personInfo",label:"Клиент",page:c.jsx("div",{children:"Редактирование клиента"}),active:n==null?void 0:n.canEditPersonInfo},{icon:c.jsx($s,{}),value:"registration",label:"Регистрация",page:c.jsx("div",{children:"Регистрация клиента"}),active:n==null?void 0:n.isReg}];return c.jsxs("div",{className:"page_view",children:[c.jsx(tf,{show:o}),s.map((l,d)=>c.jsx(ei,{title:l.title,opened:!0,setOpened:()=>i(l.id),children:c.jsx("div",{children:l.content})})),c.jsx("div",{className:"page_view__page scrollbar",children:(u=a.find(l=>l.value===e))==null?void 0:u.page}),c.jsx("div",{className:"page_view__navigation",children:c.jsx("div",{children:c.jsx(fe.BottomNavigation,{sx:{paddingBottom:"2em"},value:e,onChange:r,children:a.map((l,d)=>c.jsx(fe.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:l.label,value:l.value,icon:l.icon},d))})})})]})};we.AppContext=Ge,we.AppProvider=$l,we.ErrorBoundary=gi,we.LoadingContext=st,we.LoadingProvider=Cl,we.PopupContext=at,we.PopupProvider=cd,we.Router=pf,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"})});
|
|
225
|
+
`),Od)),Xs=O.forwardRef(function(t,r){const n=St({props:t,name:"MuiCircularProgress"}),{className:o,color:s="primary",disableShrink:i=!1,size:a=40,style:u,thickness:l=3.6,value:d=0,variant:g="indeterminate"}=n,v=Re(n,wd),E=N({},n,{color:s,disableShrink:i,size:a,thickness:l,value:d,variant:g}),b=Pd(E),f={},h={},$={};if(g==="determinate"){const A=2*Math.PI*((rt-l)/2);f.strokeDasharray=A.toFixed(3),$["aria-valuenow"]=Math.round(d),f.strokeDashoffset=`${((100-d)/100*A).toFixed(3)}px`,h.transform="rotate(-90deg)"}return c.jsx(Rd,N({className:Ne(b.root,o),style:N({width:a,height:a},h,u),ownerState:E,ref:r,role:"progressbar"},$,v,{children:c.jsx(Id,{className:b.svg,ownerState:E,viewBox:`${rt/2} ${rt/2} ${rt} ${rt}`,children:c.jsx(Nd,{className:b.circle,style:f,ownerState:E,cx:rt,cy:rt,r:(rt-l)/2,fill:"none",strokeWidth:l})})}))});process.env.NODE_ENV!=="production"&&(Xs.propTypes={classes:y.object,className:y.string,color:y.oneOfType([y.oneOf(["inherit","primary","secondary","error","info","success","warning"]),y.string]),disableShrink:Pr(y.bool,e=>e.disableShrink&&e.variant&&e.variant!=="indeterminate"?new Error("MUI: You have provided the `disableShrink` prop with a variant other than `indeterminate`. This will have no effect."):null),size:y.oneOfType([y.number,y.string]),style:y.object,sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),thickness:y.number,value:y.number,variant:y.oneOf(["determinate","indeterminate"])});const Ad=Xs;function Md(e){return nt("MuiLoadingButton",e)}const He=mt("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),kd=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],Dd=e=>{const{loading:t,loadingPosition:r,classes:n}=e,o={root:["root",t&&"loading"],startIcon:[t&&`startIconLoading${ae(r)}`],endIcon:[t&&`endIconLoading${ae(r)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${ae(r)}`]},s=Pt(o,Md,n);return N({},n,s)},Ld=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",zd=ze(zs,{shouldForwardProp:e=>Ld(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${He.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${He.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>N({[`& .${He.startIconLoadingStart}, & .${He.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},e.loadingPosition==="center"&&{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${He.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${He.startIconLoadingStart}, & .${He.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${He.startIconLoadingStart}, & .${He.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),Bd=ze("div",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.loadingIndicator,t[`loadingIndicator${ae(r.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>N({position:"absolute",visibility:"visible",display:"flex"},t.loadingPosition==="start"&&(t.variant==="outlined"||t.variant==="contained")&&{left:t.size==="small"?10:14},t.loadingPosition==="start"&&t.variant==="text"&&{left:6},t.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled},t.loadingPosition==="end"&&(t.variant==="outlined"||t.variant==="contained")&&{right:t.size==="small"?10:14},t.loadingPosition==="end"&&t.variant==="text"&&{right:6},t.loadingPosition==="start"&&t.fullWidth&&{position:"relative",left:-10},t.loadingPosition==="end"&&t.fullWidth&&{position:"relative",right:-10})),Js=O.forwardRef(function(t,r){const n=St({props:t,name:"MuiLoadingButton"}),{children:o,disabled:s=!1,id:i,loading:a=!1,loadingIndicator:u,loadingPosition:l="center",variant:d="text"}=n,g=Re(n,kd),v=yo(i),E=u??c.jsx(Ad,{"aria-labelledby":v,color:"inherit",size:16}),b=N({},n,{disabled:s,loading:a,loadingIndicator:E,loadingPosition:l,variant:d}),f=Dd(b),h=a?c.jsx(Bd,{className:f.loadingIndicator,ownerState:b,children:E}):null;return c.jsxs(zd,N({disabled:s||a,id:v,ref:r},g,{variant:d,classes:f,ownerState:b,children:[b.loadingPosition==="end"?o:h,b.loadingPosition==="end"?h:o]}))});process.env.NODE_ENV!=="production"&&(Js.propTypes={children:y.node,classes:y.object,disabled:y.bool,id:y.string,loading:y.bool,loadingIndicator:y.node,loadingPosition:Pr(y.oneOf(["start","end","center"]),e=>e.loadingPosition==="start"&&!e.startIcon?new Error('MUI: The loadingPosition="start" should be used in combination with startIcon.'):e.loadingPosition==="end"&&!e.endIcon?new Error('MUI: The loadingPosition="end" should be used in combination with endIcon.'):null),sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object]),variant:y.oneOfType([y.oneOf(["contained","outlined","text"]),y.string])});const Vd=Js,Zs=({onClick:e,isLoading:t,children:r})=>(w.useEffect(()=>{const n=o=>{(o.code==="Enter"||o.code==="NumpadEnter")&&(e==null||e(),o.preventDefault())};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e]),c.jsx(Vd,{onClick:()=>e==null?void 0:e(),loading:t,variant:"contained",children:r||"Далее"})),tp="";function Fd({opened:e,setOpened:t,requiredMessages:r,incorrectMessages:n}){const o=()=>{t(!1)};return c.jsx(fe.Modal,{open:e,onClose:t,children:c.jsx(fe.Box,{className:"validation popup__root",children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"validation_popup",children:[c.jsxs("div",{className:"validation_popup__title",children:[c.jsx("div",{children:"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{onClick:()=>o(),children:c.jsx(In,{})})})]}),c.jsxs("div",{className:"validation_popup__body",children:[r.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(mr,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Не указаны следующие обязательные поля:"}),c.jsx("ul",{children:r.map((s,i)=>c.jsx("li",{dangerouslySetInnerHTML:{__html:s}},i))})]})]})}),n.length>0&&c.jsx("div",{children:c.jsxs("div",{children:[c.jsx("div",{className:"validation_popup__body__warning",children:c.jsx(mr,{color:"error",fontSize:"inherit"})}),c.jsxs("div",{children:[c.jsx("div",{children:"Следующие поля заполнены с ошибкой:"}),c.jsx("ul",{children:n.map((s,i)=>c.jsx("li",{children:s},i))})]})]})})]}),c.jsx("div",{className:"validation_popup__buttons",children:c.jsx(Zs,{onClick:()=>o(),children:"Продолжить"})})]})})})}const Qs=({validationsProp:e})=>{const[t,r]=w.useState(e),n=w.useRef({incorrect:[]}),o=(f,h,$,A)=>{const{detail:x}=f;if(x&&A){const C=n.current.incorrect;if(!x.value){n.current.incorrect=C.filter(R=>R.id!==h),s({id:x.id,isError:!1});return}const p=A(x.value);p.isError?C.some(R=>R.id===h)||(n.current.incorrect=[...C,{id:h,message:p.message,label:$}]):n.current.incorrect=C.filter(R=>R.id!==h),s({id:x.id,isError:p.isError,message:p.message})}},s=f=>{const h=new CustomEvent(`${Pn}_${f.id}`,{detail:{...f}});document.dispatchEvent(h)},i=()=>({addEventListeners:()=>t==null?void 0:t.forEach(f=>document.addEventListener(`${On}_${f.id}`,h=>o(h,f.id,f.label,f.validator))),removeEventListeners:()=>t==null?void 0:t.forEach(f=>document.removeEventListener(`${On}_${f.id}`,h=>o(h,f.id,f.label,f.validator)))});w.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=i();return f(),()=>{h()}},[t]);const a=w.useRef({empties:[]}),u=()=>a.current.empties.length>0||n.current.incorrect.length>0?(l(),E(!0),!1):!0,l=()=>{const f=new CustomEvent(wn,{detail:{ids:a.current.empties.map(h=>h.id)}});document.dispatchEvent(f)},d=f=>{var $,A,x;const h=a.current.empties;($=f==null?void 0:f.detail)!=null&&$.empty?h.some(C=>{var p;return C.id===((p=f==null?void 0:f.detail)==null?void 0:p.id)})||(a.current.empties=[...h,{id:(A=f==null?void 0:f.detail)==null?void 0:A.id,label:f==null?void 0:f.detail.label,message:(x=f==null?void 0:f.detail)==null?void 0:x.message}]):a.current.empties=h.filter(C=>{var p;return C.id!==((p=f==null?void 0:f.detail)==null?void 0:p.id)})},g=()=>({addEventListeners:()=>document.addEventListener(jn,d),removeEventListeners:()=>document.removeEventListener(jn,d)}),[v,E]=w.useState(!1),b=c.jsx(Fd,{incorrectMessages:n.current.incorrect.map(f=>f.label),requiredMessages:a.current.empties.map(f=>f.label),opened:v,setOpened:E});return w.useEffect(()=>{const{addEventListeners:f,removeEventListeners:h}=g();return f(),()=>{h()}},[]),{validationPopup:b,formIsValid:u,setValidations:r}},Nn=({id:e,requiredMessage:t,variant:r="standard",...n})=>{const[o,s]=w.useState({isError:!1}),[i,a]=w.useState(!1),u=b=>{const f=new CustomEvent(`${On}_${e}`,{detail:{id:e,value:b}});document.dispatchEvent(f)},l=b=>{const{detail:f}=b;f&&s(h=>({isError:f.isError,message:f.message}))};w.useEffect(()=>(document.addEventListener(`${Pn}_${e}`,l),()=>{document.removeEventListener(`${Pn}_${e}`,l)}),[]);const d=(b,f=!1)=>{if(!n.required)return;f&&a(!b);const h=new CustomEvent(jn,{detail:{id:e,empty:!b,label:n.label??"",message:t}});document.dispatchEvent(h)};w.useEffect(()=>{setTimeout(()=>d((n==null?void 0:n.value)||""),1)},[]);const g=b=>{var f,h;a(((h=(f=b==null?void 0:b.detail)==null?void 0:f.ids)==null?void 0:h.includes(e))||!1)},v=()=>({addEventListeners:()=>document.addEventListener(wn,g),removeEventListeners:()=>document.removeEventListener(wn,g)});w.useEffect(()=>{const{addEventListeners:b,removeEventListeners:f}=v();return b(),()=>{f()}},[]);const E=()=>{if(o.isError)return o.message;if(i)return t||"Это поле обязательно к заполнению"};return w.useEffect(()=>{n.value&&d(n.value,!0)},[n.value]),c.jsx(fe.TextField,{sx:{".MuiInputLabel-root.Mui-focused":{color:"#bbb"},".MuiInput-root:after":{borderBottomColor:"#CBD7DC"}},...n,variant:r,helperText:E(),error:o.isError||i||!1,onChange:b=>{var f;(f=n==null?void 0:n.onChange)==null||f.call(n,b),d(b.target.value,!0)},onBlur:b=>{var f;u(b.target.value),(f=n==null?void 0:n.onBlur)==null||f.call(n,b)},autoComplete:"off",fullWidth:!0})},An=({text:e,onSuccessAdd:t})=>{const{phoneNumber:r}=w.useContext(Ge),{closePopupById:n}=w.useContext(at),[o,s]=w.useState({text:e??"",title:""}),{isLoading:i,Send:a}=Tt({url:"externalCustomerCabinet/ticket",method:"post",successMessage:"Обращение успешно создано",onSuccessMessageConfirm:()=>n(An.name)}),{formIsValid:u,validationPopup:l}=Qs({}),d=()=>{u()&&a({...o,phone:r}).then(()=>{t==null||t()})};return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[l,c.jsx("div",{children:c.jsx(Nn,{id:"title",label:"Заголовок",value:o.title,onChange:g=>s(v=>({...v,title:g.target.value}))})}),c.jsx("div",{children:c.jsx(Nn,{multiline:!0,required:!0,id:"text",label:"Текст",value:o.text,onChange:g=>s(v=>({...v,text:g.target.value}))})}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:c.jsx(Zs,{isLoading:i,onClick:()=>d(),children:"Создать новое обращение"})})]})},Ud=()=>{const{phoneNumber:e}=w.useContext(Ge),{showNewPopup:t}=w.useContext(at),{setIsLoading:r}=w.useContext(st),[n,o]=w.useState([]),[s,i]=w.useState(null),{Send:a}=Tt({url:"externalCustomerCabinet/tickets",method:"get",initLoading:!0}),u=async()=>{r(!0);const g=await a({phone:e});o(g.tickets),r(!1)};w.useEffect(()=>{u()},[]);const l=()=>{t({content:c.jsx(An,{onSuccessAdd:()=>u()}),id:An.name,title:"Создание обращения"})},d=w.useMemo(()=>c.jsx(fe.Button,{variant:"contained",onClick:()=>l(),children:"Создать обращение"}),[]);return{appeals:n,createAppealButton:d,additionalInfoState:s}},rp="",ei=({opened:e,setOpened:t,title:r,style:n,children:o})=>c.jsx(fe.Modal,{open:e,onClose:()=>{t(!1)},children:c.jsx(fe.Box,{className:"popup__root",style:n,children:c.jsxs(fe.Box,{sx:{bgcolor:"background.default"},className:"popup",children:[c.jsxs("div",{className:"popup__title",children:[c.jsx("div",{children:r||"ОПОВЕЩЕНИЕ"}),c.jsx("div",{children:c.jsx(fe.IconButton,{color:"primary",onClick:()=>t(!1),children:c.jsx(In,{})})})]}),c.jsx("div",{className:"popup__body",children:o})]})})});var Mn={},Yd=Le;Object.defineProperty(Mn,"__esModule",{value:!0});var ti=Mn.default=void 0,Wd=Yd(Be()),qd=c,Kd=(0,Wd.default)((0,qd.jsx)("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send");ti=Mn.default=Kd;const Gd=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};function Hd(e,t){const r=w.useRef(t);Gd(t,r.current)||(r.current=t),w.useEffect(e,[e])}const np="",Xd=({messages:e,preparedMessage:t,onSendMessageClick:r,isLoading:n,addIsLoading:o,remoteColor:s,remoteBackgroundColor:i})=>{var f;const[a,u]=w.useState(t??"");(((f=document.getElementById("root"))==null?void 0:f.clientWidth)??0)-80;const{ConvertUTCDateToLocalDate:l,ParseDataTimeToRusLocale:d}=Cn(),{formIsValid:g,validationPopup:v}=Qs({}),E=()=>{g()&&(r(a),u(""))},b=h=>d(l(new Date(h.creationDate)));return Hd(()=>{setTimeout(()=>{let h=document.getElementById("chat__chat_area");h&&h.scrollBy({top:h.scrollHeight,behavior:"smooth"})},300)},e.map(h=>h.id)),c.jsx("div",{children:c.jsxs("div",{className:"chat",children:[v,c.jsxs("section",{id:"chat__chat_area",className:"chat__chat_area",children:[e.length===0&&c.jsx("div",{className:"chat__chat_area__not_found",children:c.jsx("div",{children:n?"Идет загрузка":"Сообщения не найдены"})}),c.jsx("div",{className:"chat__chat_area__messages",children:e.map((h,$)=>c.jsx("div",{className:gr("chat__chat_area__messages__message",{remote:!h.isBusinessMessage}),children:c.jsx("div",{children:c.jsxs("div",{style:{backgroundColor:h.isBusinessMessage?void 0:i,opacity:h.isBusinessMessage?void 0:.8,color:h.isBusinessMessage?void 0:s},children:[c.jsx("div",{children:h.text}),c.jsx("div",{className:"chat__chat_area__messages__message__date",children:b(h)})]})})},$))})]}),c.jsx("div",{className:"chat__input",children:c.jsx(Nn,{required:!0,id:"chatMessage",label:"Текст",value:a,onChange:h=>u(h.target.value),multiline:!0})}),c.jsx("div",{className:"chat__button",children:c.jsx(di.LoadingButton,{disabled:!a,loading:o,variant:"contained",endIcon:c.jsx(ti,{}),onClick:()=>E(),children:"Отправить"})})]})})},Jd=(e,t)=>{const[r,n]=w.useState(Math.random()),o=w.useRef(!0);w.useEffect(()=>{if(o.current){o.current=!1,e(),n(Math.random());return}setTimeout(()=>{e(),n(Math.random())},t)},[r])},Zd=({opened:e,setOpened:t,appeal:r,onSuccess:n,preparedText:o})=>{const[s,i]=w.useState([]),{Send:a,isLoading:u}=Tt({url:"/externalCustomerCabinet/ticket/messages",method:"post",initLoading:!0}),{Send:l,isLoading:d}=Tt({url:"/externalCustomerCabinet/ticket/messages/new",method:"post",successMessage:"Сообщение успешно отправлено"}),g=E=>{l({chatId:r.chatId,message:E}).then(b=>{b.message.creationDate=new Date(b.message.creationDate.replace("Z","")),i(f=>[...f,b.message])})},v=()=>{a({chatId:r.chatId}).then(E=>{i(E.messages)})};return Jd(()=>v(),5e3),c.jsx(ei,{title:"Обращение",opened:e,setOpened:()=>t(!1),children:c.jsx(Xd,{preparedMessage:o,messages:s,isLoading:u,onSendMessageClick:E=>g(E),addIsLoading:d})})},op="",Qd=({appeal:e,additionalInfo:t})=>{const{ParseDataToRusLocale:r}=Cn(),[n,o]=w.useState(!1);return w.useEffect(()=>{t&&t.id===e.id&&o(!0)},[t]),c.jsxs("div",{children:[n&&c.jsx(Zd,{preparedText:t==null?void 0:t.text,opened:n,setOpened:()=>o(!1),appeal:e}),c.jsxs("div",{className:"appeal_element",onClick:()=>o(!0),children:[c.jsxs("div",{className:"appeal_element__header",children:[c.jsx("div",{className:"appeal_element__header__left",children:c.jsxs("div",{children:[c.jsxs("div",{children:["Обращение № ",e.number]}),c.jsx("div",{children:e.title})]})}),c.jsx("div",{className:"appeal_element__header__right",children:c.jsx("div",{children:r(e.creationDate,{day:"2-digit",month:"2-digit",year:"2-digit"})})})]}),c.jsx("div",{className:"appeal_element__body",children:c.jsx($n,{title:`Последнее сообщение (${e.lastMessageIsBusiness?"Вам":"Вы"})`,text:e.lastMessageText})})]})]})},ef=()=>{const{appeals:e,createAppealButton:t,additionalInfoState:r}=Ud();return c.jsxs("div",{children:[c.jsx("div",{style:{marginBottom:"1em",display:"flex",flexDirection:"column",gap:"1em"},children:e.map((n,o)=>c.jsx(Qd,{additionalInfo:r,appeal:n},o))}),c.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t})]})},tf=({show:e})=>c.jsx(fe.Backdrop,{sx:{color:"#fff",zIndex:t=>t.zIndex.drawer+1},open:e,children:c.jsx(fe.CircularProgress,{color:"inherit"})}),sp="",rf=({isAndroid:e,isIOS:t})=>t||e?c.jsx("div",{className:gr("download_card_button",{download_card_button__android:e},{download_card_button__ios:t}),children:c.jsx("div",{})}):null,ip="",ap="",nf=fu(({className:e,...t})=>c.jsx(fe.Tooltip,{...t,leaveDelay:500,classes:{popper:e}}))(({theme:e})=>({[`& .${fe.tooltipClasses.tooltip}`]:{backgroundColor:"#fff",color:"#000",boxShadow:"rgba(0, 0, 0, 0.4) 0px 30px 90px",maxWidth:400,display:"flex",justifyContent:"center",fontSize:"1em",fontWeight:300,padding:"1.5em",borderRadius:"1em",p:{marginBottom:".5em",span:{color:"var(--primary)"}}}}));var kn={},of=Le;Object.defineProperty(kn,"__esModule",{value:!0});var ri=kn.default=void 0,sf=of(Be()),af=c,cf=(0,sf.default)((0,af.jsx)("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMark");ri=kn.default=cf;const uf=({title:e,color:t})=>c.jsx(nf,{className:"question_tooltip",title:e,placement:"top",arrow:!0,children:c.jsx("div",{children:c.jsx("div",{className:"question_tooltip_icon",style:{display:"flex",backgroundColor:t??"#e9e9e9",padding:"0.1em",borderRadius:"50%",fontSize:"14px"},children:c.jsx(ri,{fontSize:"inherit"})})})}),lf=({children:e,questionText:t,labelRightSlot:r,label:n,...o})=>c.jsxs("div",{...o,className:"text_with_label",children:[c.jsxs("div",{className:"text_with_label__label",children:[c.jsx("div",{children:n}),r&&c.jsx("div",{style:{marginLeft:"1em"},children:r}),t&&c.jsx("div",{children:c.jsx(uf,{title:t})})]}),c.jsx("div",{className:"text_with_label__body",children:e})]}),df=e=>e||"—",cp="",ff=()=>{const e=window.navigator.userAgent.toLowerCase().includes("iphone"),t=window.navigator.userAgent.toLowerCase().includes("android"),{phoneNumber:r,cabinetSettings:n,customer:o}=w.useContext(Ge),{setIsLoading:s}=w.useContext(st),[i,a]=w.useState([]),{Send:u}=Tt({url:"/externalCustomerCabinet/form/info",method:"post"}),l=async()=>{s(!0);const d=await u();a(d.controls),s(!1)};return w.useEffect(()=>{r&&l()},[r]),c.jsx("div",{children:c.jsxs("div",{className:"customer_info",children:[c.jsx("div",{className:"qr_element",children:(n==null?void 0:n.canShowECardLink)&&c.jsx("a",{href:"",target:"_blank",children:c.jsx(rf,{isIOS:e,isAndroid:t})})}),c.jsxs("div",{className:"person_loyalty_info",children:[c.jsx("div",{children:"Информация по карте лояльности"}),c.jsx("div",{className:"controls",children:i.map((d,g)=>c.jsx(lf,{label:d.title,children:c.jsx("div",{children:df(d.text)})}))})]})]})})},pf=()=>{var u;const[e,t]=w.useState(""),r=(l,d)=>{t(d)},{cabinetSettings:n}=w.useContext(Ge),{isLoading:o}=w.useContext(st),{popups:s,closePopupById:i}=w.useContext(at),a=[{icon:c.jsx(Ss,{}),value:"info",label:"Карта",page:c.jsx(ff,{}),active:!0},{icon:c.jsx(_s,{}),value:"receipt",label:"История",page:c.jsx(xd,{}),active:!0},{icon:c.jsx(Ts,{}),value:"appeals",label:"Обращения",page:c.jsx(ef,{}),active:n==null?void 0:n.canShowAppeals},{icon:c.jsx(mr,{}),value:"businessInfo",label:"Информация",page:c.jsx(Ed,{}),active:n==null?void 0:n.canShowBusinessInfo},{icon:c.jsx(Cs,{}),value:"personInfo",label:"Клиент",page:c.jsx("div",{children:"Редактирование клиента"}),active:n==null?void 0:n.canEditPersonInfo},{icon:c.jsx($s,{}),value:"registration",label:"Регистрация",page:c.jsx("div",{children:"Регистрация клиента"}),active:n==null?void 0:n.isReg}];return c.jsxs("div",{className:"page_view",children:[c.jsx(tf,{show:o}),s.map((l,d)=>c.jsx(ei,{title:l.title,opened:!0,setOpened:()=>i(l.id),children:c.jsx("div",{children:l.content})})),c.jsx("div",{className:"page_view__page scrollbar",children:(u=a.find(l=>l.value===e))==null?void 0:u.page}),c.jsx("div",{className:"page_view__navigation",children:c.jsx("div",{children:c.jsx(fe.BottomNavigation,{sx:{paddingBottom:"2em"},value:e,onChange:r,children:a.map((l,d)=>c.jsx(fe.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:l.label,value:l.value,icon:l.icon},d))})})})]})};we.AppContext=Ge,we.AppProvider=$l,we.ErrorBoundary=gi,we.LoadingContext=st,we.LoadingProvider=Cl,we.PopupContext=at,we.PopupProvider=cd,we.Router=pf,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"})});
|