1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="931ead49-b9aa-4e42-b8bd-df2ff94a0584",e._sentryDebugIdIdentifier="sentry-dbid-931ead49-b9aa-4e42-b8bd-df2ff94a0584")}catch(e){}}();var _global="u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{};_global.SENTRY_RELEASE={id:"57ecc7b471fce630a9a83e03af7702d6977a38be"};"use strict";(self.webpackChunkopus1io=self.webpackChunkopus1io||[]).push([["10485"],{24894:function(e,t,n){n.d(t,{A:function(){return eI}});var l=n(41374),a=n(71893),i=n(55456),r=n(84577);n(45336),n(23446),n(11516),n(93632),n(69861),n(79936),n(5127),n(65857),n(33676),n(97857),n(4810),n(60865),n(3101),n(39112),n(75516),n(2070),n(96030),n(92167),n(47786),n(19808),n(56059),n(78736),n(68121),n(79389),n(75927),n(72859),n(15441),n(16028),n(3182);var o=n(74848),s=n(96540),d=n(5556),u=n.n(d),m=n(52956),c=n(11387),p=n.n(c),f=n(88055),b=n.n(f),g=n(95093),v=n.n(g),A=n(5287),h=n.n(A),y=n(17378),E=n(86123);n(60726);var S=n(15755),w=n(84678),x=n(96339),I=n(70980);n(13467),n(43831);var D=n(50541),C=n(6251);n(85417);var _=n(50926),T=n(99294),M=n(5792);n(39938),n(3409),n(89773);var j=n(78258),N=n(93229);function P(){var e=(0,r._)(["\n query sessionAttributes($business: String!, $serviceId: ID!) {\n service(business: $business, id: $serviceId) {\n id\n maximumClients\n plans {\n name\n }\n sessions(\n status: [SESSION_STATUS_ACTIVE, SESSION_STATUS_DISABLED]\n includeNotOpenForEnrollment: true\n includePast: true\n ) {\n id\n clientEnrollmentAttributes {\n name\n }\n }\n }\n }\n"]);return P=function(){return e},e}var U=(0,j.J1)(P()),O=(0,N.A)({query:U,defaultVariables:{},dataLabel:"service",queryMiddleware:e=>[].concat(...e.sessions.map(e=>e.clientEnrollmentAttributes.map(e=>({value:e.name,label:(0,_.ZH)(e.name.replace(/_/g," "))})).flat())),selectProps:{isCreatable:!0,getOptionLabel:e=>e.label,getOptionValue:e=>e.value,filterOption:()=>!0,createOptionPosition:"first"}});function k(){var e=(0,r._)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]);return k=function(){return e},e}function Y(){var e=(0,r._)(["\n min-width: 225px;\n margin-right: 15px;\n"]);return Y=function(){return e},e}function q(){var e=(0,r._)(["\n min-width: 125px;\n"]);return q=function(){return e},e}n(521);var B=y.Ay.div(k()),R=y.Ay.div(Y()),F=y.Ay.div(q()),V={ATTRIBUTE_TYPE_TEXT:"Text",ATTRIBUTE_TYPE_STAFF:"Staff",ATTRIBUTE_TYPE_DURATION:"Duration",ATTRIBUTE_TYPE_FILE:"File/URL",ATTRIBUTE_TYPE_BOOLEAN:"True/False"},$=Object.entries(V).map(e=>{var[t,n]=e;return{label:n,value:t}}),L=e=>(0,_.ZH)(e.replace(/_/g," ")),z=e=>e.trim().replace(/[\W]+/g,"_").replace(/^_+|_+$/g,"").toLowerCase(),H=e=>{var t,{formData:n,onChange:l,uiSchema:r,idSchema:s,disabled:d}=e;return(0,o.jsxs)(B,{children:[(0,o.jsx)(R,{className:"field-container-name",children:(0,o.jsx)(O,{instanceId:s.name.$id,className:"mt-0",onChange:e=>{l((0,i._)((0,a._)({},n),{type:n.type||$[0].value,name:z(e.value)}))},queryParams:{serviceId:null==(t=r["ui:options"])?void 0:t.serviceId},placeholder:"Attribute Name",value:n.name?{value:n.name,label:L(n.name)}:null,isDisabled:d})}),(0,o.jsx)(F,{className:"field-container-type",children:(0,o.jsx)(C.Ay,{id:"react-select-".concat(s.type.$id),classNamePrefix:"react-select",value:n.type?{value:n.type,label:V[n.type]}:$[0],isSearchable:!0,onChange:e=>{l((0,i._)((0,a._)({},n),{type:e.value}))},options:$,components:{Option:M.A},isDisabled:d})}),(0,o.jsx)("div",{className:"ml-3 mt-1 field-container-appear-in-program",children:(0,o.jsx)(D.A,{placement:"bottom",trigger:["hover"],overlay:(0,o.jsx)("span",{children:"Appear in program"}),children:(0,o.jsx)("div",{children:(0,o.jsx)(T.A,{checked:n.appearsInProgram,onChange:e=>{l((0,i._)((0,a._)({},n),{appearsInProgram:e.target.checked}))}})})})})]})},J=n(61179),W=n(65802),Z=n(90089),G=n(55179),X=n(26999),K=n(20452),Q=n(88472),ee=n(25167),et=n(69348),en=n(57682),el=n(36596),ea=n(60469),ei=n(12163),er=n(86095),eo=n(38566);function es(){var e=(0,r._)(["\n mutation renameClientEnrollmentAttribute(\n $business: String!\n $sessionId: ID!\n $name: String!\n $newName: String!\n ) {\n renameClientEnrollmentAttribute(\n business: $business\n sessionId: $sessionId\n name: $name\n newName: $newName\n ) {\n status\n error\n session {\n id\n clientEnrollmentAttributes {\n name\n appearsInProgram\n type\n }\n }\n }\n }\n"]);return es=function(){return e},e}var ed=(0,j.J1)(es()),eu=e=>({label:L(e),value:e}),em=e=>{var{toggle:t,serviceId:n,sessionId:a,originalValue:i}=e,r=(0,m.useSelector)(e=>
1e.app.business.name),[d,u]=(0,s.useState)(),[c,{loading:p}]=(0,eo.A)(ed,{successMessage:"Attribute renamed successfully",failureMessage:"Failed to rename attribute"}),f=eu(i),b=(null==d?void 0:d.value)&&d.value!==i;return(0,o.jsxs)(el.A,{isOpen:!0,modalName:"rename-client-enrollment-attribute",toggle:t,wrapClassName:"modal-primary",size:"md",children:[(0,o.jsx)(en.default,{toggle:t,children:"Rename Attribute"}),(0,o.jsxs)(ee.default,{children:[(0,o.jsx)(ei.A,{field:{title:"Original name"},children:(0,o.jsx)(O,{instanceId:"original-value",value:f,isDisabled:!0})}),(0,o.jsx)(ei.A,{field:{title:"New name"},children:(0,o.jsx)(O,{instanceId:"new-value",queryParams:{serviceId:n},placeholder:"New attribute name",value:d,onChange:e=>{u(eu(z(e.value)))}})}),(0,o.jsx)(er.A,{className:"mb-2 mt-3",text:"Changing attribute names will update all client enrollment records with this attribute."})]}),(0,o.jsx)(et.default,{children:(0,o.jsx)(ea.A,{id:"submit-rename-attribute",className:"btn btn-primary btn-rounded",onClick:()=>(0,l._)(function*(){try{yield c({variables:{business:r,sessionId:a,name:i,newName:null==d?void 0:d.value}}),t()}catch(e){(0,_.Fk)(e)}})(),loading:p,disabled:!b,children:"Rename Attribute"})})]})};function ec(e){return e.map(e=>{var t=e.property.split("."),n=(0,a._)({},e);return"is a required property"===e.message&&(n.message="".concat(t[1]," is required")),n})}var ep={type:"object",required:["name","location"],properties:{name:{type:"string",title:"Class Name"},location:{title:"Location",type:"object",default:{},required:["id"]},description:{title:"Description",type:["string","null"],default:""},primaryStaff:{title:"Primary Staff",type:["object","null"],default:null},onlineId:{title:"Online ID (In order to join online, will override Staff Online ID if set)",type:"string",default:""},tags:{type:["array","null"],title:"Tags",default:[],items:{}},maximumClients:{type:"number",title:"How many clients can attend a class or appointment of this class?",subtitle:"If not set, it will use the value set at the service level",default:0},notBeforeAgeMonths:{type:["number","null"],title:"Is there a specific age below which clients are too young for this class?",default:0,subtitle:"This will be enforced at self-booking. (If not set, it will use the value set at the service level)"},notAfterAgeMonths:{type:["number","null"],title:"Is there an age limit after which clients are too old for this class?",default:0,subtitle:"This will be enforced at self-booking. (If not set, it will use the value set at the service level)"},isEnrollmentDateSet:{title:"Does the event have an enrollment deadline?",type:"boolean",default:!1},allowEnrollmentUntilDate:{type:"string",title:"Enrollment deadline",default:v()().add(30,"days").endOf("day").format("YYYY-MM-DD")},maxAllowedSlots:{type:"integer",title:"Maximum number of session performance slots",default:30},eventDurationAllowedPercentage:{type:"integer",title:"How much percentage of time of each scheduled date can allow enrollment?",default:85},clientEnrollmentAttributes:{title:"Custom client attributes for the class",type:"array",items:{type:"object",default:{},required:["name","type"],properties:{name:{type:"string",default:""},type:{type:"string",default:""}}}}}},ef=n(80308),eb=n(22694);n(29262);var eg=n(16517),ev=n(50613),eA=n(77999),eh=n(53199);function ey(){var e=(0,r._)(["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n"]);return ey=function(){return e},e}var eE=y.Ay.div(ey()),eS=e=>{var t=b()(e);return(0,i._)((0,a._)({},t),{tags:(e.tags||[]).map(eA.hJ),maximumClients:e.maximumClients||0,notBeforeAgeMonths:e.notBeforeAgeMonths||0,notAfterAgeMonths:e.notAfterAgeMonths||0,onlineId:e.onlineId||"",clientEnrollmentAttributes:(e.clientEnrollmentAttributes||[]).map(e=>(0,i._)((0,a._)({},e),{uuid:(0,E.A)(),editable:!1})),isEnrollmentDateSet:!!e.allowEnrollmentUntilDate,allowEnrollmentUntilDate:e.allowEnrollmentUntilDate?v()(e.allowEnrollmentUntilDate).endOf("day").format("YYYY-MM-DD"):void 0})},ew=["id","waitlist","order","enrolledAt","status","name","age","staff","enrolledBy"],ex=e=>{var{update:t,onDone:n,service:r,sessionId:d}=e,u=(0,m.useSelector)(e=>e.app.business.name),{data:c,loading:f}=(0,ev.A)({query:eb.oM,variables:{business:u,serviceId:r.id,sessionId:d},processor:e=>{var t,n;return null==e||null==(n=e.service)||null==(t=n.sessions)?void 0:t[0]},skip:!t||!d}),g=eS({name:""}
1),[A,y]=(0,s.useState)(g);(0,s.useEffect)(()=>{t&&c&&y(eS(c))},[t,c,y]);var[E,D]=(0,s.useState)(!1),[C,T]=(0,s.useState)(!1),[M,j]=(0,s.useState)(""),[N]=(0,eo.A)(eb.e3,{successMessage:r.eventType?"Event Created Successfully":"Class Created Successfully",failureMessage:r.eventType?"Error Creating Event":"Error Creating Class"}),[P]=(0,eo.A)(eb.DG,{successMessage:r.eventType?"Event Updated Successfully":"Class Updated Successfully",failureMessage:r.eventType?"Error Updating Event":"Error Updating Class"}),U=e=>{var n=b()(ep);return t&&(delete n.properties.location,n.required=["name"]),r.eventType?(delete n.properties.location,delete n.properties.description,delete n.properties.tags,delete n.properties.notAfterAgeMonths,delete n.properties.notBeforeAgeMonths,delete n.properties.maximumClients,delete n.properties.primaryStaff,n.required=n.required.filter(e=>"location"!==e),n.properties.name.title="Event Name",e.isEnrollmentDateSet||delete n.properties.allowEnrollmentUntilDate):(delete n.properties.isEnrollmentDateSet,delete n.properties.allowEnrollmentUntilDate,delete n.properties.clientEnrollmentAttributes,delete n.properties.maxAllowedSlots,delete n.properties.eventDurationAllowedPercentage,delete n.properties.clientEnrollmentAttributes),n},O=U(A);return(0,o.jsx)("div",{className:"col profile-styles",children:f?(0,o.jsx)(eh.A,{size:40}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(p(),{idPrefix:"form",id:"session-form",liveValidate:t,formData:A,onChange:e=>{var t,n,l,a=U(e.formData),i=(t=e.formData,l=b()(t),(null==(n=t.location)?void 0:n.id)||(l.room={}),t.isEnrollmentDateSet?t.allowEnrollmentUntilDate||(l.allowEnrollmentUntilDate=v()().add(30,"days").endOf("day").format("YYYY-MM-DD")):l.allowEnrollmentUntilDate=void 0,l),r=[...i.clientEnrollmentAttributes||[]].filter(e=>e.name.length>0).map(e=>e.name),o=h()(ew,r);a.properties.clientEnrollmentAttributes&&(i.clientEnrollmentAttributes||[]).filter(e=>""===e.name).length>0?(T(!0),j("Cannot have custom attributes without a name")):a.properties.clientEnrollmentAttributes&&r.length!==new Set(r).size?(T(!0),j("Cannot have two custom attributes with same name")):a.properties.clientEnrollmentAttributes&&o.length>0?(T(!0),j("Cannot use restricted custom attribute names: ".concat(ew.join(", ")))):a.properties.maxAllowedSlots&&(!i.maxAllowedSlots||i.maxAllowedSlots<=0)?(T(!0),j("Maximum number of event performance slots must be greater than 0")):T(!1),y(i)},validate:(e,t)=>{var n=[...e.clientEnrollmentAttributes||[]].filter(e=>e.name.length>0).map(e=>e.name);return n.forEach((e,l)=>{var a=n.findIndex(t=>t===e);ew.includes(e)?t.clientEnrollmentAttributes[l].addError("Cannot use restricted attribute: ".concat(L(e))):a!==l&&t.clientEnrollmentAttributes[l].addError("Duplicate attribute: ".concat(L(e)," "))}),O.properties.maxAllowedSlots&&(!e.maxAllowedSlots||e.maxAllowedSlots<=0)&&t.maxAllowedSlots.addError("Maximum number of event performance slots must be greater than 0"),t},safeRenderCompletion:!0,schema:O,onSubmit:()=>(0,l._)(function*(){try{var e=t?P:N,l=((e,t,n)=>{var l,i,{onlineId:r,allowEnrollmentUntilDate:o}=e,{maximumClients:s,maxAllowedSlots:d,eventDurationAllowedPercentage:u}=e;return n&&(!e.onlineId||0===e.onlineId.length)&&(r=eg.M_),n&&(o=e.isEnrollmentDateSet?v()(e.allowEnrollmentUntilDate).endOf("day").toISOString():eg.M_),{variables:(0,a._)({name:e.name,staffIds:(e.staff||[]).map(e=>e.id),locationId:e.location&&e.location.id,onlineId:r,primaryStaffId:e.primaryStaff?e.primaryStaff.id:null,description:e.description,tags:null==(l=e.tags)?void 0:l.map(e=>e.value),notAfterAgeMonths:e.notAfterAgeMonths,notBeforeAgeMonths:e.notBeforeAgeMonths,maximumClients:s,roomName:e.room&&e.room.name,clientEnrollmentAttributes:null==(i=e.clientEnrollmentAttributes)?void 0:i.map(e=>({name:e.name,type:e.type,appearsInProgram:e.appearsInProgram})),allowEnrollmentUntilDate:o,maxAllowedSlots:d,eventDurationAllowedPercentage:u},t)}})(A,{business:u,serviceId:r.id,sessionId:d},t);D(!0),yield e((0,i._)((0,a._)({},l),{update:(e,t)=>{var n,l;if((null==(n=t.data.createSession)?void 0:n.status)==="ok"&&e.evict({id:"Service:".concat(r.id),fieldName:"sessions"}),(null==(l=t.data.updateSession)?void 0:l.status)==="ok"){e.evict({id:"Session:".concat(d),fieldName:"events"});var{clients:a}=t.data.updateSession.session;[...(a||[]).map(e=>
1e.id)].forEach(t=>{e.evict({id:"People:".concat(t),fieldName:"events"})})}}})),n()}catch(e){(0,_.Fk)(e),D(!1)}})(),uiSchema:(e=>{var{formData:t,service:n}=e;return{name:{"ui:placeholder":n.eventType?"Event Name":"Class Name"},onlineId:{"ui:placeholder":"https://zoom.us/j/xxxxxx"},description:{"ui:widget":"textarea","ui:placeholder":"Description"},primaryStaff:{"ui:placeholder":"Primary Staff","ui:field":S.A,"ui:options":{ApolloSelect:w.kS,params:{iconClass:"far fa-user"}}},tags:{"ui:placeholder":"Tags","ui:field":S.A,"ui:options":{ApolloSelect:Z.ad,params:{icon:"more",isMulti:!0,withSelectAll:!0,isCreatable:!0,isValidNewOption:(e,t)=>!(t.filter(t=>t.label===e).length>0),context:{includeSessionTags:!0}}}},maximumClients:{"ui:placeholder":"Max Clients","ui:field":G.A,"ui:options":{Field:K.A,disabledValue:0,minValue:1,enabledValue:1,label:"Clients",id:"maximum-clients",toggleId:"toggle-wrapper-maximum-clients"}},notAfterAgeMonths:{"ui:placeholder":"Max Age Requirement","ui:field":G.A,"ui:options":{Field:X.A,disabledValue:0,minValue:1,enabledValue:1,toggleId:"toggle-wrapper-max-age-limit",idYears:"not-after-age-years",idMonths:"not-after-age-months"}},notBeforeAgeMonths:{"ui:placeholder":"Min Age Requirement","ui:field":G.A,"ui:options":{Field:X.A,disabledValue:0,minValue:1,enabledValue:1,toggleId:"toggle-wrapper-min-age-limit",idYears:"not-before-age-years",idMonths:"not-before-age-months"}},staff:{"ui:placeholder":"Staff","ui:field":S.A,"ui:options":{ApolloSelect:w.kS,params:{isMulti:!0}}},location:{"ui:placeholder":"Location","ui:field":S.A,"ui:options":{ApolloSelect:x.f,params:{isMulti:!1,iconClass:"far fa-building"}}},clientEnrollmentAttributes:{"ui:field":Q.A,"ui:options":{addButtonIcon:"tag",addButtonLabel:"Add Attribute",nameAttribute:"name",renameModalProps:{serviceId:n.id,sessionId:t.id},RenameModal:em},items:{"ui:field":H,"ui:options":{serviceId:n.id}}},isEnrollmentDateSet:{"ui:field":I.A,"ui:options":{params:{},id:"never-expires"}},allowEnrollmentUntilDate:{"ui:placeholder":"Expiration Date","ui:field":W.A,"ui:options":{params:{icon:"calendar-alt",inputId:"enrollment-deadline",valueType:"string",allowPast:!1}}},eventDurationAllowedPercentage:{"ui:placeholder":"Snap Duration","ui:field":J.Jt,"ui:options":{min:60,max:100,tipFormatter:e=>"".concat(e," %"),railStyle:{backgroundColor:"grey"},className:"w-75",noCol:!0,dots:!0,dotStyle:{borderColor:"grey",backgroundColor:"grey"},activeDotStyle:{borderColor:"blue",backgroundColor:"white"},marks:{60:{label:"60%"},65:{label:"65%"},70:{label:"70%"},75:{label:"75%"},80:{label:"80%"},85:{label:"85%"},90:{label:"90%"},95:{label:"95%"}},step:null,tipProps:{overlayClassName:"p-1"}}}}})({formData:A,service:r}),formContext:{sessionId:d},showErrorList:!1,FieldTemplate:ef.A,transformErrors:ec,children:(0,o.jsx)(eE,{children:(0,o.jsx)(ea.A,{type:"submit",id:"submit-add-session",className:"btn btn-primary btn-rounded pull-right",onMouseDown:e=>e.preventDefault(),loading:E,disabled:C,disabledReason:M,children:"Submit"})})}),r.eventType&&(0,o.jsx)(er.A,{className:"mt-3",text:"While clients are enrolled in the event, custom attributes can not be removed."})]})})};ex.propTypes={update:u().bool,onDone:u().func,service:u().object.isRequired,sessionId:u().string},ex.defaultProps={update:!1,onDone:()=>{},sessionId:void 0};var eI=ex},10769:function(e,t,n){n.d(t,{I:function(){return l}});var l="f29d0e34-459d-43f8-b088-b00b7b10b21d"}}]); 2//# sourceMappingURL=10485.39d87381.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.