bonuspluscomponents 0.0.221 → 0.0.223
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.
|
@@ -253,4 +253,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
253
253
|
`)),"")}function $D(e,t,n,r){if(!e)return!1;const a=r.formatByString(r.date(cf),t).replace(n,ya),i=r.formatByString(r.date(lf),t).replace(n,"_"),s=i===a&&e===i;return!s&&r.lib!=="luxon"&&process.env.NODE_ENV!=="production"&&(t.includes("MMM")?console.warn(["Mask does not support literals such as 'MMM'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
|
|
254
254
|
`)):i&&i!==a?console.warn(["Mask does not support numbers with variable length such as 'M'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
|
|
255
255
|
`)):e&&console.warn([`The mask "${e}" you passed is not valid for the format used ${t}.`,"Falling down to uncontrolled no-mask input."].join(`
|
|
256
|
-
`))),s}const ND=(e,t)=>n=>{let r=0;return n.split("").map((o,a)=>{if(t.lastIndex=0,r>e.length-1)return"";const i=e[r],s=e[r+1],u=t.test(o)?o:"",c=i===ya?u:i+u;return r+=c.length,a===n.length-1&&s&&s!==ya?c?c+s:"":c}).join("")},RD=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:n,ignoreInvalidInputs:r,inputFormat:o,inputProps:a,label:i,mask:s,onChange:u,rawValue:c,readOnly:d,rifmFormatter:h,TextFieldProps:p,validationError:v})=>{const g=Je(),m=g.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:E}=w.useMemo(()=>{if(n)return{shouldUseMaskedInput:!1,maskToUse:""};const I=SD(s,o,e,g);return{shouldUseMaskedInput:$D(I,o,e,g),maskToUse:I}},[e,n,o,s,g]),M=w.useMemo(()=>y&&E?ND(E,e):I=>I,[e,E,y]),x=c===null?null:g.date(c),[C,b]=w.useState(x),[T,O]=w.useState(uf(g,c,o)),j=w.useRef(),L=w.useRef(g.locale),$=w.useRef(o);w.useEffect(()=>{const I=c!==j.current,R=g.locale!==L.current,A=o!==$.current;if(j.current=c,L.current=g.locale,$.current=o,!I&&!R&&!A)return;const H=c===null?null:g.date(c),Z=c===null||g.isValid(H);let ee=C===null&&H===null;if(C!==null&&H!==null){const N=g.isEqual(C,H);if(N)ee=!0;else{const V=Math.abs(g.getDiff(C,H));ee=V===0?N:V<1e3}}if(!R&&!A&&(!Z||ee))return;const k=uf(g,c,o);b(H),O(k)},[g,c,o,C]);const Y=I=>{const R=I===""||I===s?"":I;O(R);const A=R===null?null:g.parse(R,o);r&&!g.isValid(A)||(b(A),u(A,R||void 0))},Q=_D({value:T,onChange:Y,format:h||M});return D({label:i,disabled:t,error:v,inputProps:D({},y?Q:{value:T,onChange:I=>{Y(I.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},p)},jD=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],df=w.forwardRef(function(t,n){const{className:r,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:u,inputRef:c,openPicker:d,OpenPickerButtonProps:h,renderInput:p}=t,v=de(t,jD),g=or(),m=i??g.openDatePickerDialogue,y=Je(),E=RD(v),M=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||jd;return p(D({ref:n,inputRef:c,className:r},E,{InputProps:D({},u,{[`${M}Adornment`]:a?void 0:f.jsx(MD,D({position:M},s,{children:f.jsx(ar,D({edge:M,disabled:v.disabled||v.readOnly,"aria-label":m(v.rawValue,y)},h,{onClick:d,children:f.jsx(x,{})}))}))})}))});function ff(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const AD=(e,t)=>{const[n,r]=w.useState(ff);return It(()=>{const a=()=>{r(ff())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),gd(e,["hours","minutes","seconds"])?!1:(t||n)==="landscape"},ID=({autoFocus:e,openView:t})=>{const[n,r]=w.useState(e?t:null),o=w.useCallback(a=>i=>{r(i?a:s=>a===s?null:s)},[]);return{focusedView:n,setFocusedView:o}};function LD(e){return F.generateUtilityClass("MuiCalendarOrClockPicker",e)}F.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const BD=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],FD=e=>{const{classes:t}=e,n={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return F.unstable_composeClasses(n,LD,t)},VD=le("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),WD=le("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),UD={fullWidth:!0},pf=e=>e==="year"||e==="month"||e==="day",hf=e=>e==="hours"||e==="minutes"||e==="seconds";let mf=!1;function YD(e){var t,n;const r=$e({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:u,onViewChange:c,openTo:d,orientation:h,showToolbar:p,toggleMobileKeyboardView:v,ToolbarComponent:g=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:E,views:M,dateRangeIcon:x,timeIcon:C,hideTabs:b}=r,T=de(r,BD),O=(t=T.components)==null?void 0:t.Tabs,j=AD(M,h),L=w.useContext(ir),$=FD(r),Y=p??L!=="desktop",Q=!b&&typeof window<"u"&&window.innerHeight>667,X=w.useCallback((k,N)=>{u(k,L,N)},[u,L]),I=w.useCallback(k=>{s&&v(),c&&c(k)},[s,c,v]);process.env.NODE_ENV!=="production"&&!mf&&!M.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${M.join('", "')}"]\`.`),mf=!0);const{openView:R,setOpenView:A,handleChangeAndOpenNext:H}=ws({view:void 0,views:M,openTo:d,onChange:X,onViewChange:I}),{focusedView:Z,setFocusedView:ee}=ID({autoFocus:o,openView:R});return f.jsxs(WD,{ownerState:{isLandscape:j},className:$.root,children:[Y&&f.jsx(g,D({},T,{views:M,isLandscape:j,parsedValue:a,onChange:X,setOpenView:A,openView:R,toolbarTitle:E,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:v})),Q&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:R,onChange:A},(n=T.componentsProps)==null?void 0:n.tabs)),f.jsx(Es,{children:s?f.jsx(VD,{className:$.mobileKeyboardInputView,children:f.jsx(df,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:UD}))}):f.jsxs(w.Fragment,{children:[pf(R)&&f.jsx(Wd,D({autoFocus:o,date:a,onViewChange:A,onChange:H,view:R,views:M.filter(pf),focusedView:Z,onFocusedViewChange:ee},T)),hf(R)&&f.jsx(qd,D({},T,{autoFocus:o,date:a,view:R,views:M.filter(hf),onChange:H,onViewChange:A,showViewSwitcher:L==="desktop"}))]})})]})}const HD=({open:e,onOpen:t,onClose:n})=>{const r=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(r){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[r,e]);const i=w.useCallback(s=>{r||a(s),s&&t&&t(),!s&&n&&n()},[r,t,n]);return{isOpen:o,setIsOpen:i}},zD=(e,t)=>{const{onAccept:n,onChange:r,value:o,closeOnSelect:a}=e,i=Je(),{isOpen:s,setIsOpen:u}=HD(e),c=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,h]=w.useState(c),[p,v]=w.useState(()=>({committed:c,draft:c,resetFallback:c})),g=w.useCallback(T=>{v(O=>{switch(T.action){case"setAll":case"acceptAndClose":return{draft:T.value,committed:T.value,resetFallback:T.value};case"setCommitted":return D({},O,{draft:T.value,committed:T.value});case"setDraft":return D({},O,{draft:T.value});default:return O}}),(T.forceOnChangeCall||!T.skipOnChangeCall&&!t.areValuesEqual(i,p.committed,T.value))&&r(T.value),T.action==="acceptAndClose"&&(u(!1),n&&!t.areValuesEqual(i,p.resetFallback,T.value)&&n(T.value))},[n,r,u,p,i,t]);w.useEffect(()=>{i.isValid(c)&&h(c)},[i,c]),w.useEffect(()=>{s&&g({action:"setAll",value:c,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,p.committed,c)||g({action:"setCommitted",value:c,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{g({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{g({value:p.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,c)})},onDismiss:()=>{g({value:p.committed,action:"acceptAndClose"})},onCancel:()=>{g({value:p.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{g({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[g,s,i,p,t,o,c]),[y,E]=w.useState(!1),M=w.useMemo(()=>({parsedValue:p.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>E(!y),onDateChange:(T,O,j="partial")=>{switch(j){case"shallow":return g({action:"setDraft",value:T,skipOnChangeCall:!0});case"partial":return g({action:"setDraft",value:T});case"finish":return g(a??O==="desktop"?{value:T,action:"acceptAndClose"}:{value:T,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[g,y,p.draft,a]),x=w.useCallback((T,O)=>{const j=t.valueReducer?t.valueReducer(i,d,T):T;r(j,O)},[r,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>u(!0)}),[x,s,o,u]),b={pickerProps:M,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:p,other:b}})),b},qD=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],vf=w.forwardRef(function(t,n){const r=xP(t,"MuiDesktopDatePicker"),o=gE(r)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=zD(r,wP),{PopperProps:u,PaperProps:c,ToolbarComponent:d=KP,TransitionComponent:h,components:p,componentsProps:v}=r,g=de(r,qD),m=D({},i,g,{components:p,componentsProps:v,ref:n,validationError:o});return f.jsx(CD,D({},s,{DateInputProps:m,KeyboardDateInputComponent:df,PopperProps:u,PaperProps:c,TransitionComponent:h,components:p,componentsProps:v,children:f.jsx(YD,D({},a,{autoFocus:!0,toolbarTitle:r.label||r.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:p,componentsProps:v},g))}))});process.env.NODE_ENV!=="production"&&(vf.propTypes={acceptRegex:l.instanceOf(RegExp),autoFocus:l.bool,children:l.node,className:l.string,closeOnSelect:l.bool,components:l.object,componentsProps:l.object,dayOfWeekFormatter:l.func,defaultCalendarMonth:l.any,disabled:l.bool,disableFuture:l.bool,disableHighlightToday:l.bool,disableMaskedInput:l.bool,disableOpenPicker:l.bool,disablePast:l.bool,getOpenDialogAriaText:l.func,getViewSwitchingButtonText:l.func,ignoreInvalidInputs:l.bool,InputAdornmentProps:l.object,inputFormat:l.string,InputProps:l.object,inputRef:l.oneOfType([l.func,l.shape({current:l.object})]),label:l.node,leftArrowButtonText:l.string,loading:l.bool,mask:l.string,maxDate:l.any,minDate:l.any,onAccept:l.func,onChange:l.func.isRequired,onClose:l.func,onError:l.func,onMonthChange:l.func,onOpen:l.func,onViewChange:l.func,onYearChange:l.func,open:l.bool,OpenPickerButtonProps:l.object,openTo:l.oneOf(["day","month","year"]),orientation:l.oneOf(["landscape","portrait"]),PaperProps:l.object,PopperProps:l.object,readOnly:l.bool,reduceAnimations:l.bool,renderDay:l.func,renderInput:l.func.isRequired,renderLoading:l.func,rifmFormatter:l.func,rightArrowButtonText:l.string,shouldDisableDate:l.func,shouldDisableMonth:l.func,shouldDisableYear:l.func,showDaysOutsideCurrentMonth:l.bool,showToolbar:l.bool,ToolbarComponent:l.elementType,toolbarFormat:l.string,toolbarPlaceholder:l.node,toolbarTitle:l.node,TransitionComponent:l.elementType,value:l.any,views:l.arrayOf(l.oneOf(["day","month","year"]).isRequired)});const Os=({title:e,value:t,readonly:n,onChange:r,required:o,id:a,fullWidth:i=!0})=>f.jsx(vf,{disabled:n,label:e,value:t,onChange:s=>r(s),renderInput:s=>{var c,d,h;let u;return(c=s.inputProps)!=null&&c.placeholder&&(u=(h=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:h.slice(),s.inputProps.placeholder=void 0),f.jsx(F.TextField,{...s,required:o,sx:{width:"100%"},placeholder:u,autoComplete:"off",variant:"standard",error:!1})}});var ks={},GD=dt;Object.defineProperty(ks,"__esModule",{value:!0});var Ms=ks.default=void 0,KD=GD(ft()),XD=f,QD=(0,KD.default)((0,XD.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Ms=ks.default=QD;var _s={},ZD=dt;Object.defineProperty(_s,"__esModule",{value:!0});var gf=_s.default=void 0,JD=ZD(ft()),eO=f,tO=(0,JD.default)((0,eO.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");gf=_s.default=tO;const nO=({dates:e,readonly:t,onChange:n,title:r})=>{const[o,a]=S.useState(Math.random()),[i,s]=S.useState(e??[null]),{ToIsoWithoutTimeZone:u,ParseDataToRusLocale:c}=Wr();S.useEffect(()=>{n(i.filter(p=>!!p&&Date.parse(p)).map(p=>u(p)).join(","))},[i]);const d=()=>{s(p=>[...p,null]),a(Math.random())},h=p=>{s(v=>[...v.filter((g,m)=>m!==p)]),a(Math.random())};return i.length<2?f.jsx(Jo,{dateAdapter:ms,locale:gs,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Os,{id:"",title:r??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:p=>s(v=>(v[i.length-1]=p,[...v]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(F.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ms,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #88888850",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((p,v)=>v<i.length-1).map((p,v)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:p&&c(p.toString())}),f.jsx("div",{children:!t&&f.jsx(F.IconButton,{size:"small",color:"primary",onClick:()=>h(v),children:f.jsx(gf,{})})})]},v))}),f.jsx("div",{children:f.jsx(Jo,{dateAdapter:ms,locale:gs,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Os,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:p=>s(v=>(v[i.length-1]=p,[...v]))}),!t&&f.jsx(F.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ms,{})})]})})})]})})]})},rO=({id:e,defaultChecked:t,title:n,readonly:r,required:o,onChange:a,value:i})=>{const s=F.useTheme(),u=(c,d=!1)=>{if(!o)return;const h=new CustomEvent(Fr,{detail:{id:e,empty:!c,label:n}});document.dispatchEvent(h)};return S.useEffect(()=>{setTimeout(()=>u(i),1)},[]),S.useEffect(()=>{u(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(F.Checkbox,{required:o,sx:{padding:0},readOnly:r,checked:i,onChange:()=>a(!i)}),f.jsx(F.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:n}})]})},oO=({control:e,isReg:t,readonlyControls:n,onChangeRadio:r})=>{var a,i,s,u,c,d;const o=(h,p=!1)=>{if(!e.validation.required)return;const v=new CustomEvent(Fr,{detail:{id:e.id,empty:!h,label:e.title}});document.dispatchEvent(v)};return S.useEffect(()=>{setTimeout(()=>{var h,p;return o((p=(h=e.values)==null?void 0:h.find(v=>v.selected))==null?void 0:p.id)},1)},[]),f.jsx(F.Box,{sx:{minWidth:120},children:f.jsxs(F.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(F.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(F.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(n==null?void 0:n.includes(e.id)),labelId:`select-${e.id}`,value:((c=(u=e.values)==null?void 0:u.find(h=>h.selected))==null?void 0:c.id)||"",label:e.title,onChange:h=>{var v,g;(v=e.values)==null||v.filter(m=>m.id!==h.target.value).forEach(m=>m.selected=!1);let p=(g=e.values)==null?void 0:g.find(m=>m.id===h.target.value);p&&(o(!0,!0),p.selected=!0),r({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(h=>f.jsx(F.MenuItem,{value:h.id,children:h.text},h.id))})]})})},aO=({control:e,value:t,onChange:n,onChangeRadio:r,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,u,c,d,h,p,v,g;switch(e.type){case Nn.Textbox:return f.jsx(Vr,{value:t,onChange:m=>n(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((u=e==null?void 0:e.validation)==null?void 0:u.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Nn.RadiobuttonGroup:return f.jsx(oO,{control:e,isReg:a,readonlyControls:i,onChangeRadio:r});case Nn.Select:return f.jsx(F.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(F.FormControl,{fullWidth:!0,variant:"standard",required:(c=e==null?void 0:e.validation)==null?void 0:c.required,children:[f.jsx(F.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(F.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>n(m.target.value),children:(h=e.values)==null?void 0:h.map(m=>f.jsx(F.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Nn.Date:return f.jsx(Jo,{dateAdapter:ms,locale:gs,children:f.jsx(Os,{id:e.id,title:e.title,value:t,readonly:!a&&((p=e==null?void 0:e.validation)==null?void 0:p.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>n(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required})});case Nn.ParentBirthday:return f.jsx(nO,{title:e.title,onChange:m=>n(m),readonly:!a,dates:e.dates??[null]});case Nn.Checkbox:return f.jsx(rO,{id:e.id,onChange:m=>o(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},iO=e=>{const t=()=>{const r=new RegExp(/^\.*/);return e.type!==null?e.type===Gr.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===Gr.Url||e.type===Gr.Date?r:e.type===Gr.Phone?new RegExp(/^[+]?[\d]{10,11}$/):r:r},n=r=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&r.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&r.length<=(e==null?void 0:e.maxTextLength)),o};return r=>t().test(r)?n(r)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},yf=({onControlsGet:e,buttonSaveText:t,isReg:n=!1,previewControls:r})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:u,telegramInfo:c,linkId:d,refferalCode:h,cabinetUISettings:p}=S.useContext(st),{setIsLoading:v}=S.useContext(ln),{showErrorAlert:g}=S.useContext(Ut),{setOpenedPage:m}=S.useContext(mr),[y,E]=S.useState(!1),[M,x]=S.useState(r??[]);S.useEffect(()=>{x(r??[])},[r]);const[C,b]=S.useState([]),[T,O]=S.useState(Math.random()),[j,L]=S.useState(!1),{validationPopup:$,formIsValid:Y,setValidations:Q}=zo({}),{ToIsoWithoutTimeZone:X}=Wr();S.useEffect(()=>{Q(M.map(k=>({id:k.id,label:k.title,validator:iO(k.validation)})))},[M]);const I=()=>{const k={};return M.map(N=>k[N.id]=N.text),k};S.useEffect(()=>{r||(async()=>{v("GetControls",!0);const N=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e(N.data.controls);let V=N.data.controls;V.some(U=>U.id==="parentphone")&&h&&(V=V.filter(U=>U.id!=="parentphone")),x(V),b(N.data.controls.filter(U=>{var q;return((q=U.validation)==null?void 0:q.readOnly)&&!!U.text})),v("GetControls",!1)})()},[]);const R=()=>{Y()&&!r&&(L(!0),o().patch("/externalCustomerCabinet/form/registration",{recommend:h,linkId:d,controls:M,...a,VKUserId:i,...c??{}}).then(k=>{s(N=>({...N,isReg:!1})),u(k.data.phoneNumber),E(!0),m("info"),b(M.filter(N=>{var V;return((V=N.validation)==null?void 0:V.readOnly)&&!!N.text})),n&&(p!=null&&p.ymIdentifier)&&(p!=null&&p.ymReachGoalIdentifier)&&ym(p==null?void 0:p.ymIdentifier,"reachGoal",p==null?void 0:p.ymReachGoalIdentifier)}).catch(k=>{g(k.response.data.msg)}).finally(()=>{L(!1)}))},A=(k,N)=>{Date.parse(N)&&(N=X(N)),x(V=>{const U=V.find(q=>q.id===k);return U&&(U.text=N),[...V]})},H=(k,N)=>{x(V=>{const U=V.find(q=>q.id===k);return U&&(U.checked=N),[...V]})},Z=k=>{x(N=>{let V=N.find(U=>U.id===k.id);return V&&(V={...k},O(Math.random())),[...N]})};return{controlsForm:f.jsxs(F.Container,{maxWidth:"sm",children:[$,f.jsxs(F.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:M==null?void 0:M.map((k,N)=>f.jsx("div",{children:f.jsx(aO,{isReg:n,control:k,onChange:V=>A(k.id,V),onChangeChecked:V=>H(k.id,V),onChangeRadio:V=>Z(V),value:k.text??"",readonlyControls:C.map(V=>V.id)})},N))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(Yo,{isLoading:j,onClick:()=>R(),children:t||"Сохранить анкету"})})]})]}),setControls:x,saved:y,setSaved:E,GetObjectByControls:I}},sO=()=>{S.useContext(st);const{controlsForm:e,saved:t,setSaved:n}=yf({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(vr,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},uO=()=>{const{controlsForm:e,saved:t,setSaved:n}=yf({buttonSaveText:"Редактирование анкеты",isReg:!1});return f.jsx("div",{children:e})},lO=({})=>{const{cabinetSettings:e}=S.useContext(st),{currentMode:t}=S.useContext(An);return f.jsx(F.Backdrop,{sx:{color:t==="light"?"#191919":"#e9e9e9",zIndex:n=>n.zIndex.drawer+1,backgroundColor:t==="light"?"#e9e9e9":"#191919"},open:!!e&&!(e!=null&&e.cabinetEnabled),children:f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em",alignItems:"center"},children:f.jsx("div",{children:"Бот сейчас отключен"})})})},cO=({showHeader:e})=>{var h;const{cabinetSettings:t,cabinetUISettings:n}=S.useContext(st);S.useContext(An);const{isLoading:r}=S.useContext(ln),{openedPage:o,setOpenedPage:a}=S.useContext(mr),i=(p,v)=>{a(v)},{popups:s,closePopupById:u}=S.useContext(Ut),d=[{icon:f.jsx(cc,{}),value:"info",label:"Карта",page:f.jsx(n1,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(uc,{}),value:"receipt",label:"История",page:f.jsx(n0,{}),active:t==null?void 0:t.canShowPurchaseHistory,disabled:t==null?void 0:t.isReg},{icon:f.jsx(dc,{}),value:"appeals",label:"Обращения",page:f.jsx(m0,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ho,{}),value:"businessInfo",label:"Информация",page:f.jsx(r0,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(lc,{}),value:"personInfo",label:"Клиент",page:f.jsx(uO,{}),active:t==null?void 0:t.canEditPersonInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(fc,{}),value:"registration",label:"Регистрация",page:f.jsx(sO,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(p=>p.active&&!p.disabled);return f.jsxs(F.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx(Bs,{}),f.jsx(Fs,{show:r}),f.jsx(lO,{}),s.map((p,v)=>f.jsx(Li,{title:p.title,opened:!0,setOpened:()=>u(p.id),children:f.jsx("div",{children:p.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(h=d.find(p=>p.value===o))==null?void 0:h.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(F.BottomNavigation,{sx:{borderTop:"solid 1px #88888850",bgcolor:"background.default"},value:o,onChange:i,children:d.map((p,v)=>f.jsx(F.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:p.label,value:p.value,icon:p.icon},v))})})})]})};Pe.AppContext=st,Pe.AppProvider=Ff,Pe.BonusPlusThemeContext=An,Pe.BonusPlusThemeProvider=Uf,Pe.Cloud=vr,Pe.ErrorBoundary=Tb,Pe.Header=Bs,Pe.Input=Vr,Pe.Loader=Fs,Pe.LoadingContext=ln,Pe.LoadingProvider=Rf,Pe.PageContext=mr,Pe.PageProvider=If,Pe.Popup=Li,Pe.PopupContext=Ut,Pe.PopupProvider=Zy,Pe.RedirectEnum=ec,Pe.Router=cO,Pe.SubmitButton=Yo,Pe.UseFormHelper=zo,Pe.useAxios=pn,Pe.useQuery=Jf,Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"})});
|
|
256
|
+
`))),s}const ND=(e,t)=>n=>{let r=0;return n.split("").map((o,a)=>{if(t.lastIndex=0,r>e.length-1)return"";const i=e[r],s=e[r+1],u=t.test(o)?o:"",c=i===ya?u:i+u;return r+=c.length,a===n.length-1&&s&&s!==ya?c?c+s:"":c}).join("")},RD=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:n,ignoreInvalidInputs:r,inputFormat:o,inputProps:a,label:i,mask:s,onChange:u,rawValue:c,readOnly:d,rifmFormatter:h,TextFieldProps:p,validationError:v})=>{const g=Je(),m=g.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:E}=w.useMemo(()=>{if(n)return{shouldUseMaskedInput:!1,maskToUse:""};const I=SD(s,o,e,g);return{shouldUseMaskedInput:$D(I,o,e,g),maskToUse:I}},[e,n,o,s,g]),M=w.useMemo(()=>y&&E?ND(E,e):I=>I,[e,E,y]),x=c===null?null:g.date(c),[C,b]=w.useState(x),[T,O]=w.useState(uf(g,c,o)),j=w.useRef(),L=w.useRef(g.locale),$=w.useRef(o);w.useEffect(()=>{const I=c!==j.current,R=g.locale!==L.current,A=o!==$.current;if(j.current=c,L.current=g.locale,$.current=o,!I&&!R&&!A)return;const H=c===null?null:g.date(c),Z=c===null||g.isValid(H);let ee=C===null&&H===null;if(C!==null&&H!==null){const N=g.isEqual(C,H);if(N)ee=!0;else{const V=Math.abs(g.getDiff(C,H));ee=V===0?N:V<1e3}}if(!R&&!A&&(!Z||ee))return;const k=uf(g,c,o);b(H),O(k)},[g,c,o,C]);const Y=I=>{const R=I===""||I===s?"":I;O(R);const A=R===null?null:g.parse(R,o);r&&!g.isValid(A)||(b(A),u(A,R||void 0))},Q=_D({value:T,onChange:Y,format:h||M});return D({label:i,disabled:t,error:v,inputProps:D({},y?Q:{value:T,onChange:I=>{Y(I.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},p)},jD=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],df=w.forwardRef(function(t,n){const{className:r,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:u,inputRef:c,openPicker:d,OpenPickerButtonProps:h,renderInput:p}=t,v=de(t,jD),g=or(),m=i??g.openDatePickerDialogue,y=Je(),E=RD(v),M=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||jd;return p(D({ref:n,inputRef:c,className:r},E,{InputProps:D({},u,{[`${M}Adornment`]:a?void 0:f.jsx(MD,D({position:M},s,{children:f.jsx(ar,D({edge:M,disabled:v.disabled||v.readOnly,"aria-label":m(v.rawValue,y)},h,{onClick:d,children:f.jsx(x,{})}))}))})}))});function ff(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const AD=(e,t)=>{const[n,r]=w.useState(ff);return It(()=>{const a=()=>{r(ff())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),gd(e,["hours","minutes","seconds"])?!1:(t||n)==="landscape"},ID=({autoFocus:e,openView:t})=>{const[n,r]=w.useState(e?t:null),o=w.useCallback(a=>i=>{r(i?a:s=>a===s?null:s)},[]);return{focusedView:n,setFocusedView:o}};function LD(e){return F.generateUtilityClass("MuiCalendarOrClockPicker",e)}F.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const BD=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],FD=e=>{const{classes:t}=e,n={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return F.unstable_composeClasses(n,LD,t)},VD=le("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),WD=le("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),UD={fullWidth:!0},pf=e=>e==="year"||e==="month"||e==="day",hf=e=>e==="hours"||e==="minutes"||e==="seconds";let mf=!1;function YD(e){var t,n;const r=$e({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:u,onViewChange:c,openTo:d,orientation:h,showToolbar:p,toggleMobileKeyboardView:v,ToolbarComponent:g=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:E,views:M,dateRangeIcon:x,timeIcon:C,hideTabs:b}=r,T=de(r,BD),O=(t=T.components)==null?void 0:t.Tabs,j=AD(M,h),L=w.useContext(ir),$=FD(r),Y=p??L!=="desktop",Q=!b&&typeof window<"u"&&window.innerHeight>667,X=w.useCallback((k,N)=>{u(k,L,N)},[u,L]),I=w.useCallback(k=>{s&&v(),c&&c(k)},[s,c,v]);process.env.NODE_ENV!=="production"&&!mf&&!M.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${M.join('", "')}"]\`.`),mf=!0);const{openView:R,setOpenView:A,handleChangeAndOpenNext:H}=ws({view:void 0,views:M,openTo:d,onChange:X,onViewChange:I}),{focusedView:Z,setFocusedView:ee}=ID({autoFocus:o,openView:R});return f.jsxs(WD,{ownerState:{isLandscape:j},className:$.root,children:[Y&&f.jsx(g,D({},T,{views:M,isLandscape:j,parsedValue:a,onChange:X,setOpenView:A,openView:R,toolbarTitle:E,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:v})),Q&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:R,onChange:A},(n=T.componentsProps)==null?void 0:n.tabs)),f.jsx(Es,{children:s?f.jsx(VD,{className:$.mobileKeyboardInputView,children:f.jsx(df,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:UD}))}):f.jsxs(w.Fragment,{children:[pf(R)&&f.jsx(Wd,D({autoFocus:o,date:a,onViewChange:A,onChange:H,view:R,views:M.filter(pf),focusedView:Z,onFocusedViewChange:ee},T)),hf(R)&&f.jsx(qd,D({},T,{autoFocus:o,date:a,view:R,views:M.filter(hf),onChange:H,onViewChange:A,showViewSwitcher:L==="desktop"}))]})})]})}const HD=({open:e,onOpen:t,onClose:n})=>{const r=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(r){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[r,e]);const i=w.useCallback(s=>{r||a(s),s&&t&&t(),!s&&n&&n()},[r,t,n]);return{isOpen:o,setIsOpen:i}},zD=(e,t)=>{const{onAccept:n,onChange:r,value:o,closeOnSelect:a}=e,i=Je(),{isOpen:s,setIsOpen:u}=HD(e),c=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,h]=w.useState(c),[p,v]=w.useState(()=>({committed:c,draft:c,resetFallback:c})),g=w.useCallback(T=>{v(O=>{switch(T.action){case"setAll":case"acceptAndClose":return{draft:T.value,committed:T.value,resetFallback:T.value};case"setCommitted":return D({},O,{draft:T.value,committed:T.value});case"setDraft":return D({},O,{draft:T.value});default:return O}}),(T.forceOnChangeCall||!T.skipOnChangeCall&&!t.areValuesEqual(i,p.committed,T.value))&&r(T.value),T.action==="acceptAndClose"&&(u(!1),n&&!t.areValuesEqual(i,p.resetFallback,T.value)&&n(T.value))},[n,r,u,p,i,t]);w.useEffect(()=>{i.isValid(c)&&h(c)},[i,c]),w.useEffect(()=>{s&&g({action:"setAll",value:c,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,p.committed,c)||g({action:"setCommitted",value:c,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{g({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{g({value:p.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,c)})},onDismiss:()=>{g({value:p.committed,action:"acceptAndClose"})},onCancel:()=>{g({value:p.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{g({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[g,s,i,p,t,o,c]),[y,E]=w.useState(!1),M=w.useMemo(()=>({parsedValue:p.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>E(!y),onDateChange:(T,O,j="partial")=>{switch(j){case"shallow":return g({action:"setDraft",value:T,skipOnChangeCall:!0});case"partial":return g({action:"setDraft",value:T});case"finish":return g(a??O==="desktop"?{value:T,action:"acceptAndClose"}:{value:T,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[g,y,p.draft,a]),x=w.useCallback((T,O)=>{const j=t.valueReducer?t.valueReducer(i,d,T):T;r(j,O)},[r,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>u(!0)}),[x,s,o,u]),b={pickerProps:M,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:p,other:b}})),b},qD=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],vf=w.forwardRef(function(t,n){const r=xP(t,"MuiDesktopDatePicker"),o=gE(r)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=zD(r,wP),{PopperProps:u,PaperProps:c,ToolbarComponent:d=KP,TransitionComponent:h,components:p,componentsProps:v}=r,g=de(r,qD),m=D({},i,g,{components:p,componentsProps:v,ref:n,validationError:o});return f.jsx(CD,D({},s,{DateInputProps:m,KeyboardDateInputComponent:df,PopperProps:u,PaperProps:c,TransitionComponent:h,components:p,componentsProps:v,children:f.jsx(YD,D({},a,{autoFocus:!0,toolbarTitle:r.label||r.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:p,componentsProps:v},g))}))});process.env.NODE_ENV!=="production"&&(vf.propTypes={acceptRegex:l.instanceOf(RegExp),autoFocus:l.bool,children:l.node,className:l.string,closeOnSelect:l.bool,components:l.object,componentsProps:l.object,dayOfWeekFormatter:l.func,defaultCalendarMonth:l.any,disabled:l.bool,disableFuture:l.bool,disableHighlightToday:l.bool,disableMaskedInput:l.bool,disableOpenPicker:l.bool,disablePast:l.bool,getOpenDialogAriaText:l.func,getViewSwitchingButtonText:l.func,ignoreInvalidInputs:l.bool,InputAdornmentProps:l.object,inputFormat:l.string,InputProps:l.object,inputRef:l.oneOfType([l.func,l.shape({current:l.object})]),label:l.node,leftArrowButtonText:l.string,loading:l.bool,mask:l.string,maxDate:l.any,minDate:l.any,onAccept:l.func,onChange:l.func.isRequired,onClose:l.func,onError:l.func,onMonthChange:l.func,onOpen:l.func,onViewChange:l.func,onYearChange:l.func,open:l.bool,OpenPickerButtonProps:l.object,openTo:l.oneOf(["day","month","year"]),orientation:l.oneOf(["landscape","portrait"]),PaperProps:l.object,PopperProps:l.object,readOnly:l.bool,reduceAnimations:l.bool,renderDay:l.func,renderInput:l.func.isRequired,renderLoading:l.func,rifmFormatter:l.func,rightArrowButtonText:l.string,shouldDisableDate:l.func,shouldDisableMonth:l.func,shouldDisableYear:l.func,showDaysOutsideCurrentMonth:l.bool,showToolbar:l.bool,ToolbarComponent:l.elementType,toolbarFormat:l.string,toolbarPlaceholder:l.node,toolbarTitle:l.node,TransitionComponent:l.elementType,value:l.any,views:l.arrayOf(l.oneOf(["day","month","year"]).isRequired)});const Os=({title:e,value:t,readonly:n,onChange:r,required:o,id:a,fullWidth:i=!0})=>f.jsx(vf,{disabled:n,label:e,value:t,onChange:s=>r(s),renderInput:s=>{var c,d,h;let u;return(c=s.inputProps)!=null&&c.placeholder&&(u=(h=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:h.slice(),s.inputProps.placeholder=void 0),f.jsx(F.TextField,{...s,required:o,sx:{width:"100%"},placeholder:u,autoComplete:"off",variant:"standard",error:!1})}});var ks={},GD=dt;Object.defineProperty(ks,"__esModule",{value:!0});var Ms=ks.default=void 0,KD=GD(ft()),XD=f,QD=(0,KD.default)((0,XD.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Ms=ks.default=QD;var _s={},ZD=dt;Object.defineProperty(_s,"__esModule",{value:!0});var gf=_s.default=void 0,JD=ZD(ft()),eO=f,tO=(0,JD.default)((0,eO.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");gf=_s.default=tO;const nO=({dates:e,readonly:t,onChange:n,title:r})=>{const[o,a]=S.useState(Math.random()),[i,s]=S.useState(e??[null]),{ToIsoWithoutTimeZone:u,ParseDataToRusLocale:c}=Wr();S.useEffect(()=>{n(i.filter(p=>!!p&&Date.parse(p)).map(p=>u(p)).join(","))},[i]);const d=()=>{s(p=>[...p,null]),a(Math.random())},h=p=>{s(v=>[...v.filter((g,m)=>m!==p)]),a(Math.random())};return i.length<2?f.jsx(Jo,{dateAdapter:ms,locale:gs,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Os,{id:"",title:r??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:p=>s(v=>(v[i.length-1]=p,[...v]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(F.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ms,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #88888850",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((p,v)=>v<i.length-1).map((p,v)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:p&&c(p.toString())}),f.jsx("div",{children:!t&&f.jsx(F.IconButton,{size:"small",color:"primary",onClick:()=>h(v),children:f.jsx(gf,{})})})]},v))}),f.jsx("div",{children:f.jsx(Jo,{dateAdapter:ms,locale:gs,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Os,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:p=>s(v=>(v[i.length-1]=p,[...v]))}),!t&&f.jsx(F.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ms,{})})]})})})]})})]})},rO=({id:e,defaultChecked:t,title:n,readonly:r,required:o,onChange:a,value:i})=>{const s=F.useTheme(),u=(c,d=!1)=>{if(!o)return;const h=new CustomEvent(Fr,{detail:{id:e,empty:!c,label:n}});document.dispatchEvent(h)};return S.useEffect(()=>{setTimeout(()=>u(i),1)},[]),S.useEffect(()=>{u(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(F.Checkbox,{required:o,sx:{padding:0},readOnly:r,checked:i,onChange:()=>a(!i)}),f.jsx(F.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:n}})]})},oO=({control:e,isReg:t,readonlyControls:n,onChangeRadio:r})=>{var a,i,s,u,c,d;const o=(h,p=!1)=>{if(!e.validation.required)return;const v=new CustomEvent(Fr,{detail:{id:e.id,empty:!h,label:e.title}});document.dispatchEvent(v)};return S.useEffect(()=>{setTimeout(()=>{var h,p;return o((p=(h=e.values)==null?void 0:h.find(v=>v.selected))==null?void 0:p.id)},1)},[]),f.jsx(F.Box,{sx:{minWidth:120},children:f.jsxs(F.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(F.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(F.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(n==null?void 0:n.includes(e.id)),labelId:`select-${e.id}`,value:((c=(u=e.values)==null?void 0:u.find(h=>h.selected))==null?void 0:c.id)||"",label:e.title,onChange:h=>{var v,g;(v=e.values)==null||v.filter(m=>m.id!==h.target.value).forEach(m=>m.selected=!1);let p=(g=e.values)==null?void 0:g.find(m=>m.id===h.target.value);p&&(o(!0,!0),p.selected=!0),r({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(h=>f.jsx(F.MenuItem,{value:h.id,children:h.text},h.id))})]})})},aO=({control:e,value:t,onChange:n,onChangeRadio:r,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,u,c,d,h,p,v,g;switch(e.type){case Nn.Textbox:return f.jsx(Vr,{value:t,onChange:m=>n(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((u=e==null?void 0:e.validation)==null?void 0:u.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Nn.RadiobuttonGroup:return f.jsx(oO,{control:e,isReg:a,readonlyControls:i,onChangeRadio:r});case Nn.Select:return f.jsx(F.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(F.FormControl,{fullWidth:!0,variant:"standard",required:(c=e==null?void 0:e.validation)==null?void 0:c.required,children:[f.jsx(F.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(F.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>n(m.target.value),children:(h=e.values)==null?void 0:h.map(m=>f.jsx(F.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Nn.Date:return f.jsx(Jo,{dateAdapter:ms,locale:gs,children:f.jsx(Os,{id:e.id,title:e.title,value:t,readonly:!a&&((p=e==null?void 0:e.validation)==null?void 0:p.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>n(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required})});case Nn.ParentBirthday:return f.jsx(nO,{title:e.title,onChange:m=>n(m),readonly:!a,dates:e.dates??[null]});case Nn.Checkbox:return f.jsx(rO,{id:e.id,onChange:m=>o(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},iO=e=>{const t=()=>{const r=new RegExp(/^\.*/);return e.type!==null?e.type===Gr.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===Gr.Url||e.type===Gr.Date?r:e.type===Gr.Phone?new RegExp(/^[+]?[\d]{10,11}$/):r:r},n=r=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&r.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&r.length<=(e==null?void 0:e.maxTextLength)),o};return r=>t().test(r)?n(r)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},yf=({onControlsGet:e,buttonSaveText:t,isReg:n=!1,previewControls:r})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:u,telegramInfo:c,linkId:d,refferalCode:h,cabinetUISettings:p}=S.useContext(st),{setIsLoading:v}=S.useContext(ln),{showErrorAlert:g}=S.useContext(Ut),{setOpenedPage:m}=S.useContext(mr),[y,E]=S.useState(!1),[M,x]=S.useState(r??[]);S.useEffect(()=>{x(r??[])},[r]);const[C,b]=S.useState([]),[T,O]=S.useState(Math.random()),[j,L]=S.useState(!1),{validationPopup:$,formIsValid:Y,setValidations:Q}=zo({}),{ToIsoWithoutTimeZone:X}=Wr();S.useEffect(()=>{Q(M.map(k=>({id:k.id,label:k.title,validator:iO(k.validation)})))},[M]);const I=()=>{const k={};return M.map(N=>k[N.id]=N.text),k};S.useEffect(()=>{r||(async()=>{v("GetControls",!0);const N=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e(N.data.controls);let V=N.data.controls;V.some(U=>U.id==="parentphone")&&h&&(V=V.filter(U=>U.id!=="parentphone")),x(V),b(N.data.controls.filter(U=>{var q;return((q=U.validation)==null?void 0:q.readOnly)&&!!U.text})),v("GetControls",!1)})()},[]);const R=()=>{Y()&&!r&&(L(!0),o().patch("/externalCustomerCabinet/form/registration",{recommend:h,linkId:d,controls:M,...a,VKUserId:i,...c??{}}).then(k=>{s(N=>({...N,isReg:!1})),u(k.data.phoneNumber),E(!0),m("info"),b(M.filter(N=>{var V;return((V=N.validation)==null?void 0:V.readOnly)&&!!N.text})),n&&(p!=null&&p.ymIdentifier)&&(p!=null&&p.ymReachGoalIdentifier)&&ym(p==null?void 0:p.ymIdentifier,"reachGoal",p==null?void 0:p.ymReachGoalIdentifier)}).catch(k=>{g(k.response.data.msg)}).finally(()=>{L(!1)}))},A=(k,N)=>{Date.parse(N)&&(N=X(N)),x(V=>{const U=V.find(q=>q.id===k);return U&&(U.text=N),[...V]})},H=(k,N)=>{x(V=>{const U=V.find(q=>q.id===k);return U&&(U.checked=N),[...V]})},Z=k=>{x(N=>{let V=N.find(U=>U.id===k.id);return V&&(V={...k},O(Math.random())),[...N]})};return{controlsForm:f.jsxs(F.Container,{maxWidth:"sm",children:[$,f.jsxs(F.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:M==null?void 0:M.map((k,N)=>f.jsx("div",{children:f.jsx(aO,{isReg:n,control:k,onChange:V=>A(k.id,V),onChangeChecked:V=>H(k.id,V),onChangeRadio:V=>Z(V),value:k.text??"",readonlyControls:C.map(V=>V.id)})},N))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(Yo,{isLoading:j,onClick:()=>R(),children:t||"Сохранить анкету"})})]})]}),setControls:x,saved:y,setSaved:E,GetObjectByControls:I}},sO=()=>{S.useContext(st);const{controlsForm:e,saved:t,setSaved:n}=yf({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(vr,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},uO=()=>{const{controlsForm:e,saved:t,setSaved:n}=yf({buttonSaveText:"Редактирование анкеты",isReg:!1});return f.jsx("div",{children:e})},lO=({})=>{const{cabinetSettings:e}=S.useContext(st),{currentMode:t}=S.useContext(An);return f.jsx(F.Backdrop,{sx:{color:t==="light"?"#191919":"#e9e9e9",zIndex:n=>n.zIndex.drawer+1,backgroundColor:t==="light"?"#e9e9e9":"#191919"},open:!!e&&!(e!=null&&e.cabinetEnabled),children:f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em",alignItems:"center"},children:f.jsx("div",{children:"Бот сейчас отключен"})})})},cO=({showHeader:e})=>{var h;const{cabinetSettings:t,cabinetUISettings:n}=S.useContext(st);S.useContext(An);const{isLoading:r}=S.useContext(ln),{openedPage:o,setOpenedPage:a}=S.useContext(mr),i=(p,v)=>{a(v)},{popups:s,closePopupById:u}=S.useContext(Ut),d=[{icon:f.jsx(cc,{}),value:"info",label:"Карта",page:f.jsx(n1,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(uc,{}),value:"receipt",label:"История",page:f.jsx(n0,{}),active:t==null?void 0:t.canShowPurchaseHistory,disabled:t==null?void 0:t.isReg},{icon:f.jsx(dc,{}),value:"appeals",label:"Обращения",page:f.jsx(m0,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ho,{}),value:"businessInfo",label:"Информация",page:f.jsx(r0,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(lc,{}),value:"personInfo",label:"Клиент",page:f.jsx(uO,{}),active:t==null?void 0:t.canEditPersonInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(fc,{}),value:"registration",label:"Регистрация",page:f.jsx(sO,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(p=>p.active&&!p.disabled);return f.jsxs(F.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx(Bs,{}),f.jsx(Fs,{show:r}),f.jsx(lO,{}),s.map((p,v)=>f.jsx(Li,{title:p.title,opened:!0,setOpened:()=>u(p.id),children:f.jsx("div",{children:p.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:f.jsx(F.Container,{maxWidth:"md",style:{display:"flex",justifyContent:"center"},children:f.jsx(F.Container,{maxWidth:"sm",children:(h=d.find(p=>p.value===o))==null?void 0:h.page})})}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(F.BottomNavigation,{sx:{borderTop:"solid 1px #88888850",bgcolor:"background.default"},value:o,onChange:i,children:d.map((p,v)=>f.jsx(F.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:p.label,value:p.value,icon:p.icon},v))})})})]})};Pe.AppContext=st,Pe.AppProvider=Ff,Pe.BonusPlusThemeContext=An,Pe.BonusPlusThemeProvider=Uf,Pe.Cloud=vr,Pe.ErrorBoundary=Tb,Pe.Header=Bs,Pe.Input=Vr,Pe.Loader=Fs,Pe.LoadingContext=ln,Pe.LoadingProvider=Rf,Pe.PageContext=mr,Pe.PageProvider=If,Pe.Popup=Li,Pe.PopupContext=Ut,Pe.PopupProvider=Zy,Pe.RedirectEnum=ec,Pe.Router=cO,Pe.SubmitButton=Yo,Pe.UseFormHelper=zo,Pe.useAxios=pn,Pe.useQuery=Jf,Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../src/components/Router/Router.tsx"],"names":[],"mappings":"AAkBA,OAAO,eAAe,CAAA;AAiBtB,KAAK,KAAK,GAAG;IACT,UAAU,EAAE,OAAO,CAAA;CACtB,CAAA;AAGD,QAAA,MAAM,MAAM,mBAAkB,KAAK,
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../src/components/Router/Router.tsx"],"names":[],"mappings":"AAkBA,OAAO,eAAe,CAAA;AAiBtB,KAAK,KAAK,GAAG;IACT,UAAU,EAAE,OAAO,CAAA;CACtB,CAAA;AAGD,QAAA,MAAM,MAAM,mBAAkB,KAAK,4CA8HlC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|