Skip to content

Instantly share code, notes, and snippets.

@guidone
Created June 3, 2020 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guidone/f391fd21ad3768a5abfb0272d9263e84 to your computer and use it in GitHub Desktop.
Save guidone/f391fd21ad3768a5abfb0272d9263e84 to your computer and use it in GitHub Desktop.
define(["../../../src/components","../../src/components","code-plug","lodash","prop-types","react","rsuite"],(e,n,t,a,o,r,l)=>(()=>{"use strict";var i={647:(e,n,t)=>{t.r(n);var a=t(297),o=t.n(a),r=t(399),l=t(186),i=t(222),s=t(738),u=t(804),m=t.n(u);const{StringType:c,ArrayType:p,ObjectType:d,DateType:g}=i.Schema.Types,f=i.Schema.Model({openings:p().of(d().shape({start:g().isRequired("Specify starting hour"),end:g().isRequired("Specify ending hour"),range:c().isRequired("Select a range for opening hours")})).addRule(e=>m().isArray(e)&&0!==e.length,"Specify at least an opening hour")});var y=t(229),h=t.n(y);const b=[{value:"mo",label:"Monday"},{value:"tu",label:"Tuesday"},{value:"we",label:"Wednesday"},{value:"th",label:"Thursday"},{value:"fr",label:"Friday"},{value:"sa",label:"Saturday"},{value:"su",label:"Sunday"},{value:"mo-fr",label:"Monday - Friday"},{value:"mo-sa",label:"Monday - Saturday"},{value:"mo-su",label:"Monday - Sunday"},{value:"sa-su",label:"Saturday - Sunday"}],v=e=>{const n=new Date(e);return(t=n)instanceof Date&&!isNaN(t)?n:null;var t},E=({value:e,onChange:n,disabled:t=!1})=>o().createElement("div",null,o().createElement(i.FlexboxGrid,{justify:"space-between"},o().createElement(i.FlexboxGrid.Item,{colspan:7},o().createElement(i.DatePicker,{readOnly:t,format:"HH:mm",value:v(e.start),style:{width:"100%"},onChange:t=>n({...e,start:t})})),o().createElement(i.FlexboxGrid.Item,{colspan:7},o().createElement(i.DatePicker,{readOnly:t,value:v(e.end),format:"HH:mm",style:{width:"100%"},onChange:t=>n({...e,end:t})})),o().createElement(i.FlexboxGrid.Item,{colspan:8},o().createElement(i.SelectPicker,{readOnly:t,format:"HH:mm",block:!0,value:e.range,data:b,style:{width:"100%"},onChange:t=>n({...e,range:t})}))));E.propTypes={value:h().shape({start:h().string,end:h().string,range:h().oneOf(["mo","tu","we","th","fr","sa","su","mo-fr","mo-sa","mo-su","sa-su"])})};const S=E,x=[{name:"openings.openWhen",description:"Text shown before the list of opening hours"},{name:"openings.monday"},{name:"openings.tuesday"},{name:"openings.wednesday"},{name:"openings.friday"},{name:"openings.saturday"},{name:"openings.sunday"},{name:"openings.monfri"},{name:"openings.monsat"},{name:"openings.monsun"},{name:"openings.satsun"},{name:"openings.yes"},{name:"openings.no"}],{NodeRedNode:C,SlugHelp:F,TypeCommand:O}=l.HelpElements;(0,r.plug)("sidebar",null,{id:"configuration",label:"Configuration",permission:"configure",icon:"cog",options:[{id:"configuration-hours",label:"Opening hours",url:"/configuration-openings"}]}),(0,r.plug)("pages",(0,l.withConfigurationPage)("openings",({value:e,onSubmit:n=(()=>{}),disabled:t=!1})=>{const[r,l]=(0,a.useState)(e),[u,m]=(0,a.useState)(null),[c,p]=(0,a.useState)("openings"),d=(0,a.useRef)(null);return o().createElement("div",null,o().createElement(i.Nav,{appearance:"tabs",activeKey:c,onSelect:p,style:{marginBottom:"25px"}},o().createElement(i.Nav.Item,{eventKey:"openings"},"Openings"),o().createElement(i.Nav.Item,{eventKey:"translations"},"Translations")),o().createElement(i.Form,{model:f,disabled:!0,formValue:r,formError:u,ref:d,checkTrigger:"none",layout:"vertical",fluid:!0,onChange:e=>{l(e),m(null)},onCheck:e=>{m(e)}},"translations"===c&&o().createElement(a.Fragment,null,o().createElement(i.FormGroup,null,o().createElement(i.FormControl,{name:"translations",accepter:s.Dictionary,schema:x,disabled:t}))),"openings"===c&&o().createElement(a.Fragment,null,o().createElement(i.FormGroup,null,o().createElement(i.ControlLabel,null,"Openings hours"),o().createElement(i.FormControl,{name:"openings",accepter:s.CollectionEditor,form:S,labelAdd:"Add opening hour",disabled:t})),o().createElement(i.FormGroup,null,o().createElement(i.ControlLabel,null,"Content"),o().createElement(i.FormControl,{useSlug:!0,readOnly:t,name:"content",accepter:s.ContentAutocomplete}),o().createElement(i.HelpBlock,null,"Select a ",o().createElement("em",null,"slug")," for a multi-language content to show additional information when a user requests information about opening hours")),o().createElement(i.FormGroup,null,o().createElement(i.ControlLabel,null,"Sensitivity"),o().createElement(i.FormControl,{disabled:t,name:"threshold",accepter:s.Confidence}),o().createElement(i.HelpBlock,null,"The minimum score of an intent to be considered relevant. Lower this value if the NLP doesn't catch any intent of the user input, raise this value if the NLP of this block is interfering with the NLP of other blocks."))),o().createElement(i.FormGroup,{style:{marginTop:"40px"}},o().createElement(i.ButtonToolbar,null,o().createElement(i.Button,{disabled:t,appearance:"primary",onClick:()=>{d.current.check()&&n(r)}},"Save configuration"),o().createElement(i.Button,{disabled:t,appearance:"default",onClick:()=>{confirm("Reset configuration?")&&l(e)}},"Reset")))))},{Legend:()=>o().createElement("div",null,o().createElement(C,null,"Opening Hours node"),o().createElement("p",null,"Configure the behaviour of this node: customize the opening hours and and some additional content (for example to show extra openings, etc)."),o().createElement(F,null)),title:"Opening Hours"}),{permission:"configure",url:"/configuration-openings",title:"Opening Hours",id:"configuration"})},738:n=>{n.exports=e},186:e=>{e.exports=n},399:e=>{e.exports=t},804:e=>{e.exports=a},229:e=>{e.exports=o},297:e=>{e.exports=r},222:e=>{e.exports=l}},s={};function u(e){if(s[e])return s[e].exports;var n=s[e]={exports:{}};return i[e](n,n.exports,u),n.exports}return u.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return u.d(n,{a:n}),n},u.d=(e,n)=>{for(var t in n)u.o(n,t)&&!u.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},u.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u(647)})());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment