PageSourceSearch

https://app.opus1.io/releases/20260925T143842Z-e1befdfb692b/async/11846.5daf60ec.js

js opus1.io collected 2026-09-25 18:53:25 UTC 36,987 bytes, 2 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},i=(new e.Error).stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="8e4e3df6-3ce4-4f18-ad12-7bc6342f5111",e._sentryDebugIdIdentifier="sentry-dbid-8e4e3df6-3ce4-4f18-ad12-7bc6342f5111")}catch(e){}}();var _global="u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{};_global.SENTRY_RELEASE={id:"e1befdfb692b28496829f71c2490b06d48ba02c9"};"use strict";(self.webpackChunkopus1io=self.webpackChunkopus1io||[]).push([["11846"],{78437:function(e,i,n){n.d(i,{A:function(){return e3}});var t=n(84577);n(89773),n(93632),n(5409),n(45336),n(23446);var a=n(74848),r=n(96540),o=n(5556),s=n.n(o),l=n(17378),c=n(56347),d=n(52956),u=n(26871),p=n(48689),v=n(7091),f=n(24988),m=n(52556),h=n(41374),g=n(50467),b=n(71893),y=n(55456),x=n(24930),A=n(17535),I=n(8756),C=n(11387),S=n.n(C),j=n(95093),_=n.n(j),N=n(27140),w=n.n(N),E=n(29436),O=n(88055),D=n.n(O),U=n(2543),R=n(50926),T=n(61734),k=n(68618),P=n(93863),M=n(42479),V=n(31471),q=n(59038),F=n(36596),z=n(16517),B=n(37690),$=n(30205),L=n(60469),Y=n(59373);function Q(){var e=(0,t._)(["\n    margin-right: 0 !important;\n\n    i {\n        vertical-align: middle;\n        margin-right: 4px;\n    }\n    span {\n        vertical-align: middle;\n    }\n"]);return Q=function(){return e},e}var W=(0,l.Ay)(L.A)(Q());class H extends r.Component{UNSAFE_componentWillReceiveProps(e){var{credit:i,business:n}=e,{credit:t}=e.data||{};if(!this.formPopulated&&t&&t.id===(i||{}).id){var a=this.initalizeFormState(n,t,e.otherFormData);this.setState(a)}}render(){var e,i,n,t,{timezone:r}=this.context,{loading:o,formSchema:s,formData:l,formErrors:c}=this.state,{credit:d,data:u,isOpen:p,toggle:v,defaultCurrency:f}=this.props,{credit:m}=u||{},h=m||d,g=!!(c&&c.length);return(0,a.jsxs)(F.A,{isOpen:p,toggle:v,modalName:"update-credit",size:"lg",children:[(0,a.jsx)(x.A,{toggle:v,children:"Update Credit"}),(u||{}).loading||o?(0,a.jsx)(T.A,{}):(0,a.jsxs)(A.A,{children:[(0,a.jsxs)("div",{className:"d-flex flex-row flex-wrap justify-content-center mr-2 mb-2",children:[h.service&&(0,a.jsx)(M.sS,{falIcon:"clipboard",text:null==(e=h.service)?void 0:e.name}),h.client&&(0,a.jsx)(M.sS,{falIcon:"user",text:null==(i=h.client)?void 0:i.name}),h.event&&(0,a.jsx)(M.sS,{falIcon:"tag",text:"from: ".concat(null==(n=h.event)?void 0:n.name," - ").concat((0,R.x_)(null==(t=h.event)?void 0:t.startAt,r))})]}),(0,a.jsx)(S(),{idPrefix:"form",liveValidate:!0,safeRenderCompletion:!0,schema:s,uiSchema:(0,V.oz)(this.props,this.state,null,f),fields:V.OA,validate:this.validate,transformErrors:this.transformErrors,formData:l,showErrorList:!1,onChange:this.handleChange,children:(0,a.jsx)("button",{className:"hidden",type:"submit",ref:e=>{this.submitButton=e}})}),(0,a.jsx)($.t,{isServiceCredit:!!l.service})]}),(0,a.jsx)(I.A,{children:(0,a.jsx)(W,{id:"btn-update",className:"btn btn-primary btn-rounded",loading:o,onClick:this.handleUpdateCredit,disabled:g,children:"Update"})})]})}constructor(e,i){super(e,i),n=this,(0,g._)(this,"initalizeFormState",(e,i,n)=>{this.formPopulated=!0;var t=(0,b._)({},this.state),a=this.populateFormData(i,n);a.validUntil&&(a.validUntil=_()(a.validUntil).startOf("day"));var r=this.cleanSchema(D()(V.wQ),a);return this.original||(this.original=this.prepQueryParams(a,{business:e})),t.formData=a,t.formSchema=r,t.loading=!1,t}),(0,g._)(this,"populateFormData",e=>{var i=(0,P.tF)(e);return e?(i.neverExpires=!e.validUntil,i.validUntil=e.validUntil?_()(e.validUntil).startOf("day"):void 0,i.notValidBefore=_()(e.notValidBefore),e.subscription&&(i.subscription=e.subscription),i):void(0,R.Fk)("form data population failed")}),(0,g._)(this,"cleanFormData",e=>{var i=(0,b._)({},e);return e.validUntil||(i.validUntil=_()().add(30,"days")),(0,U.isEmpty)(e.subscription)&&delete i.creationReason,(0,U.isEmpty)(e.creationReason)&&(i.creationReason=null),i}),(0,g._)(this,"cleanSchema",(e,i)=>{var{data:n}=this.props,{credit:t}=n||{},a=!!((null==t?void 0:t.service)&&!(null==t?void 0:t.amount)),r=(0,b._)({},e);return(0,U.isEmpty)(i.subscription)&&delete r.properties.creationReason,i.neverExpires&&delete r.properties.validUntil,(null==t?void 0:t.event)||delete r.properties.onlyValidOncePaid,a?(delete r.properties.amount,delete r.properties.currency):(delete r.properties.service,delete r.properties.subscription,delete r.properties.visit
1Count,delete r.properties.notValidBefore,delete r.properties.staff,delete r.properties.creationReason),r}),(0,g._)(this,"prepQueryParams",(e,i)=>{var n=null,t=null;e.notValidBefore&&(t=_()(e.notValidBefore).format("YYYY-MM-DDTHH:MM:ss.SSSZ")),e.validUntil&&!e.neverExpires&&(n=_()(e.validUntil).format("YYYY-MM-DDTHH:MM:ss.SSSZ"));var a=(this.original||{}).subscriptionId&&!(e.subscription||{}).id,r=a||(0,U.isEmpty)(e.creationReason);return(0,b._)((0,y._)((0,b._)({},e),{clientId:e.client.id,staffIds:(e.staff||[]).map(e=>e.id),notValidBefore:t,validUntil:e.neverExpires?z.M_:n,subscriptionId:a?z.M_:(e.subscription||{}).id,creationReason:r?null:e.creationReason,serviceId:(e.service||{}).id}),i)}),(0,g._)(this,"handleUpdateCredit",()=>(0,h._)(function*(){var{onDone:e}=n.props,{formData:i}=n.state||{};if(i){n.setState({loading:!0});var{updateCredit:t,toggle:a,business:r}=n.props,o=n.prepQueryParams(i,{business:r}),s=(0,k.H)(n.original,o,["id","business","creationReason"]);try{yield t({variables:s}),e(),a()}catch(e){n.setState({loading:!1}),(0,R.Fk)(e)}}})()),(0,g._)(this,"handleChange",e=>{var{formData:i,errors:n}=e,t=this.cleanFormData(i),a=this.cleanSchema(D()(V.wQ),t);this.setState({formData:t,formSchema:a,formErrors:n})}),(0,g._)(this,"transformErrors",e=>e.map(e=>("required"===e.name&&("name"===e.params.missingProperty?e.message="A reason is required":e.message="A value is required"),e))),(0,g._)(this,"validate",(e,i)=>{var n,{data:t}=this.props,{credit:a}=t||{},{id:r,name:o}=e.client,{id:s}=(null==(n=e.subscription)?void 0:n.client)||{};return!a.service||a.amount||(0,U.isEmpty)(e.subscription)||s===r||i.subscription.addError("subscription must be for ".concat(o)),i});var n,{business:t,otherFormData:a}=e,{credit:r}=e.data||{};this.state={loading:!0,errors:null,formData:{},formSchema:D()(V.wQ)},this.formPopulated=!1,this.original=void 0,r&&(this.state=this.initalizeFormState(t,r,a))}}(0,g._)(H,"contextType",Y.$),H.propTypes={business:s().string.isRequired,data:s().object.isRequired,isOpen:s().bool.isRequired,toggle:s().func.isRequired,credit:s().shape({id:s().string,client:s().object}),onDone:s().func},H.defaultProps={credit:{id:void 0,client:{}},onDone:()=>{}};var J=w()((0,d.connect)(e=>({business:e.app.business.name,defaultCurrency:e.app.business.defaultCurrency})),(0,E.U)(q.wh,{skip:e=>{var{credit:i}=e;return!(i||{}).id},options:e=>({variables:{business:e.business,creditId:(e.credit||{}).id}})}),(0,E.U)(q.sz,{options:e=>({update:(i,n)=>{var t,a;if((null==(a=n.data)||null==(t=a.updateCredit)?void 0:t.status)==="ok"){var{id:r}=n.data.updateCredit.credit.client,{id:o}=e.credit.client;r!==o?(i.evict({id:"People:".concat(r),fieldName:"credits"}),i.evict({id:"People:".concat(r),fieldName:"paginatedCredits"}),i.evict({id:"People:".concat(o),fieldName:"creditBalance"}),i.evict({id:"People:".concat(o),fieldName:"credits"}),i.evict({id:"People:".concat(o),fieldName:"paginatedCredits"}),i.evict({id:"People:".concat(o),fieldName:"creditBalance"})):i.evict({id:"People:".concat(r),fieldName:"creditBalance"}),i.gc()}}}),props:(0,B.X)({name:"updateCredit",success:"Credit Updated Successfully",failure:"Error Updating Credit"})}))(H),G=n(38566);function K(){var e=(0,t._)(["\n    margin-right: 0 !important;\n\n    i {\n        vertical-align: middle;\n        margin-right: 4px;\n    }\n    span {\n        vertical-align: middle;\n    }\n"]);return K=function(){return e},e}function Z(){var e=(0,t._)(["\n    overflow: hidden;\n    text-overflow: ellipsis;\n"]);return Z=function(){return e},e}var X=(0,l.Ay)(L.A)(K()),ee=(0,l.Ay)(A.A)(Z()),ei=e=>{var{isOpen:i,toggle:n,credit:t,onDone:r}=e,o=(0,d.useSelector)(e=>e.app.business.name),[s,{loading:l}]=(0,G.A)(q.il,{successMessage:"Credit Deleted Successfully",failureMessage:"Error Deleting Credit"});return(0,a.jsxs)(F.A,{isOpen:i,toggle:n,modalName:"delete-credit",children:[(0,a.jsx)(x.A,{toggle:n,children:"Delete Credit"}),(0,a.jsx)(ee,{children:"Are you sure you want to delete '".concat((t.service||{}).name||t.name,"' ?")}),(0,a.jsx)(I.A,{children:(0,a.jsx)(X,{id:"btn-continue",className:"btn btn-danger btn-rounded",loading:l,onClick:()=>(0,h._)(function*(){try{yield s({variables:{business:o,id:t.id},update:(e,i)=>{var n,a;(null==(a=i.data)||null==(n=a.deleteCredit)?void 0:n.status)==="ok"&&(e.evict({id:"People:".concat(t.client.id),fieldName:"
1creditBalance"}),e.evict({id:"Credit:".concat(t.id)}),e.gc())}}),r(),n()}catch(e){(0,R.Fk)(e)}})(),children:"Continue"})})]})};n(60726);var en=n(35970),et=n.n(en),ea=n(39124),er=n(4301);function eo(){var e=(0,t._)(["\n    padding: 0px !important;\n    border: none;\n"]);return eo=function(){return e},e}function es(){var e=(0,t._)(["\n    .modal-content {\n        padding: 10px;\n    }\n"]);return es=function(){return e},e}var el=(0,l.Ay)(f.A)(eo()),ec=(0,l.Ay)(F.A)(es());class ed extends r.Component{render(){var e,{credit:i,data:n,isOpen:t,toggle:r}=this.props,{credit:o,myself:s,loading:l}=n||{};if(s){var c=[...s.credits,...et()(s.dependents.map(e=>e.credits))];[e]=c}var d=o||e||i;return(0,a.jsxs)(ec,{centered:!0,name:"credit-details",isOpen:t,toggle:r,modalName:"credit-info",size:"lg",children:[l&&(0,a.jsx)(T.A,{}),!l&&(0,a.jsx)(el,{credit:d}),(0,a.jsx)(er.wl,{className:"btn-close align-self-end",onClick:r,children:"Close"})]})}constructor(...e){super(...e),(0,g._)(this,"func",()=>{})}}(0,g._)(ed,"propTypes",{isOpen:s().bool.isRequired,toggle:s().func.isRequired,credit:s().shape({id:s().string,client:s().object})}),(0,g._)(ed,"defaultProps",{credit:{id:void 0,client:{}}});var eu=e=>({variables:{business:e.business,creditId:(e.credit||{}).id}}),ep=w()(c.y,(0,d.connect)(e=>({business:e.app.business.name,currentUser:e.auth.currentUser})),(0,E.U)(q.wh,{skip:e=>{var{match:i,credit:n}=e;return i.url.includes("self")||!(n||{}).id},options:eu}),(0,E.U)(ea.ll,{skip:e=>{var{match:i,credit:n}=e;return!i.url.includes("self")||!(n||{}).id},options:eu}))(ed),ev=n(6683),ef=n(37762),em=n(72557);n(11516);var eh=n(78258),eg=n(6251),eb=n(50613),ey=n(12163),ex=n(17124),eA=n(94794),eI=n(11205),eC=n(6702),eS=n(53894);function ej(){var e=(0,t._)(["\n    margin: 5px;\n"]);return ej=function(){return e},e}function e_(){var e=(0,t._)(["\n    font-size: 16px;\n    font-weight: 600;\n    /* margin-left: 5px; */\n    /* margin-bottom: 5px; */\n"]);return e_=function(){return e},e}function eN(){var e=(0,t._)(["\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n"]);return eN=function(){return e},e}var ew=l.Ay.div(ej()),eE=l.Ay.div(e_()),eO=l.Ay.div(eN()),eD=e=>{var i,n,t,a,r,{className:o,cx:s,getStyles:l,isDisabled:c,isFocused:d,isSelected:u,innerRef:p,innerProps:v,data:f}=e,m=(0,eS.A)(),h=(0,eC.FM)(),g=null==(n=(f.value.lineItems||[])[0])||null==(i=n.client)?void 0:i.name;return(0,eI.Y)("div",(0,b._)({ref:p,css:l("option",e),className:s({option:!0,"option--is-disabled":c,"option--is-focused":d,"option--is-selected":u},o)},v),(0,eI.Y)(ew,null,(0,eI.Y)(eE,{className:"invoice-description"},null==f||null==(t=f.value)?void 0:t.description),(0,eI.Y)(eO,{className:"invoice-details"},"Due on: ".concat(m(null==f||null==(a=f.value)?void 0:a.dueDate).format("ll")," • Remaining due: ").concat((0,eC.og)(h,null==f||null==(r=f.value)?void 0:r.remainingDue)," ").concat(g&&"• for ".concat(g," ")))))},eU=e=>{var i,{className:n,cx:t,getStyles:a,isDisabled:r,innerProps:o,data:s,children:l}=e;return(0,eI.Y)("div",(0,b._)({css:a("singleValue",e),className:t({"single-value":!0,"single-value--is-disabled":r},"".concat(n," d-flex flex-column"))},o),(0,eI.Y)("div",{className:"invoice-description"},null==s||null==(i=s.value)?void 0:i.description))},eR=n(44123);function eT(){var e=(0,t._)(["\n    query payersInvoice($business: String!, $payerId: ID!) {\n        invoices(business: $business, payerId: $payerId, status: STATUS_OPEN) {\n            id\n            description\n            totalDue\n            remainingDue\n            dueDate\n            payer {\n                id\n                name\n                profilePhoto\n            }\n            lineItems {\n                id\n                client {\n                    id\n                    name\n                }\n            }\n        }\n    }\n"]);return eT=function(){return e},e}function ek(){var e=(0,t._)(["\n    mutation applyCreditToInvoice(\n        $business: String!\n        $creditId: ID!\n        $invoiceId: ID!\n    ) {\n        applyCreditToInvoice(\n            business: $business\n            creditId: $creditId\n            invoiceId: $invoiceId\n        ) {\n            status\n            error\n            credit {\n                id\n                amount\n                status\n                client {\n                    id\n                    creditBalance\n                }\n            }\n            invoice {\n                id\n                status\n                remainingDue\n                ...detailedInvoice\n            }\n        }\n    }\n    ","\n"]);return ek=function(){return e},e}var eP=(0,eh.J1)(eT()),eM=(0,eh.J1)(ek(),eA.So),eV=e=>{var{isOpen:i,toggle:n,credit:t}=e,o=(0,d.useSelector)(e=>e.app.business.name),s=(0,eC.FM)(),[l,c]=(0,r.useState)(!1),[f,m]=(0,r.useState)(),[g,b]=(0,r.useState)(),{data:y,loading:C}=(0,eb.A)({query:eP,variables:{business:o,payerId:t.client.id},processor:e=>e.invoices,skip:!(0,u.Ay)(p.ACTION_LIST,v.RESOURCE_INVOICES),fetchPolicy:"no-cache"}),[S]=(0,G.A)(eM,{successMessage:"Successfully applied credit",failureMessage:"Failed to apply credit"});return((0,r.useEffect)(()=>{y&&y.length&&m({label:y[0],value:y[0]}),(0,u.Ay)(p.ACTION_LIST,v.RESOURCE_INVOICES)&&!C&&(null==y?void 0:y.length)===0&&b("No valid invoices available to apply ".concat(t.client.name,"'s credit to."))},[y,C,t]),(0,u.Ay)(p.ACTION_LIST,v.RESOURCE_INVOICES))?(0,a.jsxs)(F.A,{isOpen:i,toggle:n,modalName:"use-monetary-credit",size:"md",children:[(0,a.jsx)(x.A,{toggle:n,children:"Use Monetary Credit"}),C&&(0,a.jsx)(T.A,{}),!C&&(0,a.jsxs)(A.A,{children:[g&&(0,a.jsx)(ex.A,{children:g}),!g&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ey.A,{field:{title:"Select an invoice to apply the credit to:"},children:(0,a.jsx)(eg.Ay,{id:"react-select-".concat(eR.hY),classNamePrefix:"react-select",className:"",isSearchable:!1,placeholder:"Select an invoice",value:f,options:(y||[]).map(e=>({label:e,value:e})),components:{Option:eD,SingleValue:eU},onChange:m})}),f&&(0,a.jsx)(ex.A,{id:"apply-credit-message",children:"A credit amount of ".concat((0,eC.og)(s,t.amount)," will be applied to invoice ").concat(f.value.description)})]})]}),(0,a.jsx)(I.A,{children:(0,a.jsx)(L.A,{className:"btn btn-danger rounded",onClick:()=>(0,h._)(function*(){c(!0);try{yield S({variables:{business:o,invoiceId:null==f?void 0:f.value.id,creditId:t.id},update:(e,i)=>{var{invoice:n,status:t}=i.data.applyCreditToInvoice||{};"ok"===t&&(e.evict({id:"People:".concat(n.payer.id),fieldName:"invoices"}),e.evict({id:"People:".concat(n.payer.id),fieldName:"paginatedInvoices"}),e.evict({id:"Self:".concat(n.payer.id),fieldName:"invoices"}),e.evict({id:"Self:".concat(n.payer.id),fieldName:"paginatedInvoices"}))}}),n()}catch(e){(0,R.Fk)(e)}c(!1)})(),disabled:!f,loading:l,id:"apply-monetary-credit-button",children:"Apply"})})]}):(0,a.jsxs)(F.A,{isOpen:i,toggle:n,modalName:"use-monetary-credit",size:"md",children:[(0,a.jsx)(x.A,{toggle:n,children:"Use Monetary Credit"}),(0,a.jsx)(A.A,{children:"To use a monetary credit, click Pay on an invoice and toggle Use Account Balance"})]})};n(91625),n(79936);var eq=n(47215),eF=n(7841),ez=n(7574),eB=n(86095);function e$(){var e=(0,t._)(["\n    :last-child {\n        border-bottom: none;\n    }\n"]);return e$=function(){return e},e}function eL(){var e=(0,t._)(["\n    query selfSubscriptionsForUseUnpaidCredit(\n        $business: String!\n        $depen
1dentId: ID\n        $subscriptionId: ID\n        $status: [SubscriptionStatus]\n    ) {\n        myself(business: $business, id: $dependentId) {\n            id\n            subscriptions(id: $subscriptionId, status: $status) {\n                id\n                invoices {\n                    id\n                    dueDate\n                    ...PayInvoiceModalInvoice\n                    ...InvoiceItemInvoice\n                    ...detailedInvoice\n                }\n            }\n        }\n    }\n    ","\n    ","\n    ","\n"]);return eL=function(){return e},e}function eY(){var e=(0,t._)(["\n    query invoiceForUseUnpaidCredit(\n        $business: String!\n        $eventId: ID!\n        $dependentId: ID!\n    ) {\n        myself(business: $business, id: $dependentId) {\n            id\n            events(eventId: $eventId) {\n                id\n                clients {\n                    peopleId\n                    invoice {\n                        id\n                        dueDate\n                        ...PayInvoiceModalInvoice\n                        ...InvoiceItemInvoice\n                        ...detailedInvoice\n                    }\n                }\n            }\n        }\n    }\n    ","\n    ","\n    ","\n"]);return eY=function(){return e},e}function eQ(){var e=(0,t._)(["\n        fragment useUnpaidCreditModalEvent on Event {\n            id\n            startAt\n            clients {\
1n                peopleId\n                subscriptionId\n            }\n        }\n    "]);return eQ=function(){return e},e}var eW=(0,l.Ay)(eF.A)(e$()),eH=(0,eh.J1)(eL(),eF.A.fragments.invoice,eq.A.fragments.invoice,eA.So),eJ=(0,eh.J1)(eY(),eF.A.fragments.invoice,eq.A.fragments.invoice,eA.So),eG=e=>{var i,n,t,r,o,{isOpen:s,toggle:l,credit:c,onDone:u}=e,[p,v,f]=(0,m.A)(!1),[h,g,b]=(0,m.A)(!1),y=(0,d.useSelector)(e=>e.app.business.name),C=(0,d.useSelector)(e=>e.auth.currentUser);console.log({credit:c});var S=null==c||null==(i=c.event)?void 0:i.clients.find(e=>{var i;return e.peopleId===(null==c||null==(i=c.client)?void 0:i.id)});console.log({eventParticipant:S});var{data:j,loading:_,refetch:N}=(0,eb.A)({query:eH,variables:{business:y,status:["SUBSCRIPTION_STATUS_ACTIVE","SUBSCRIPTION_STATUS_HOLD","SUBSCRIPTION_STATUS_PENDING"],subscriptionId:null==S?void 0:S.subscriptionId},processor:e=>{var i;return(null==(i=e.myself.subscriptions)?void 0:i.length)>0&&e.myself.subscriptions[0].invoices},skip:!(null==S?void 0:S.subscriptionId)});console.log({subscriptionInvoices:j});var{data:w,loading:E,refetch:O}=(0,eb.A)({query:eJ,variables:{business:y,eventId:null==c||null==(n=c.event)?void 0:n.id,dependentId:null==c||null==(t=c.client)?void 0:t.id},processor:e=>e.myself.events[0].clients.find(e=>{var i;return e.peopleId===(null==c||null==(i=c.client)?void 0:i.id)}).invoice,skip:!(null==S?void 0:S.invoiceId)});console.log({invoice:w});var D=[];(null==S?void 0:S.subscriptionId)?(r=_,o=N,D=(j||[]).filter(e=>[z.Az,z.ze].includes(e.status)).filter(e=>e.dueDate<(null==c?void 0:c.event.startAt))):(null==S?void 0:S.invoiceId)&&(r=E,o=O,[z.Az,z.ze].includes(null==w?void 0:w.status)&&(D=[w]));var[U,...R]=D,k=(null==D?void 0:D.length)===0,P=!0,M="The following invoice".concat(D.length>1?"s":""," must be paid in order to proceed with booking using this credit.");(null==R?void 0:R.length)||(null==U?void 0:U.status)!==z.ze||(M="This invoice is processing and must settle before this credit can be used."),U||(M="Unpaid invoices may still be processing and must settle before this credit can be used."),U&&U.payer.id!==C.id&&(M="The following invoice must be paid by its assigned payer (".concat(U.payer.name,") in order to proceed with booking using this credit."),P=!1);var V=!r&&!k,q=!r&&k;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(F.A,{centered:!0,isOpen:s,toggle:l,modalName:"unpaid-use-credit",size:"lg",children:[(0,a.jsx)(x.A,{toggle:l,children:"Appointment/Class Credit Unpaid"}),r&&(0,a.jsx)(A.A,{children:(0,a.jsx)(T.A,{})}),V&&(0,a.jsxs)(A.A,{children:[M,U&&(0,a.jsx)(eW,{invoice:U,onPay:P&&(()=>f(U)),onDetails:P&&(()=>b(U))},U.id),(R||[]).map(e=>(0,a.jsx)(eW,{invoice:e,onPay:()=>f(e),onDetails:()=>b(e)},e.id))]}),q&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.A,{children:c.status===z.vi?(0,a.jsx)(eB.A,{className:"text-danger",text:"Invoice payment status for this credit cannot be verified because the appointment / class date linked to this credit has been deleted."}):"Required invoices have been paid, you may now proceed to book using this credit."}),(0,a.jsx)(I.A,{children:(0,a.jsx)(L.A,{id:"continue-to-book",className:"btn btn-primary btn-rounded",onClick:()=>u(c),children:"Continue To Booking"})})]})]}),p&&(0,a.jsx)(eq.A,{isOpen:p,toggle:f,invoice:v,refetchInvoices:o}),h&&(0,a.jsx)(ez.A,{isOpen:h,toggle:b,invoice:g})]})};eG.propTypes={onDone:s().func.isRequired,event:s().object.isRequired,isOpen:s().bool.isRequired,toggle:s().func.isRequired},eG.fragments={event:(0,eh.J1)(eQ())};var eK=n(29277),eZ=n(67131),eX=function(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.pathname;return!!(null==i?void 0:i.staffRole)&&!!(e.service&&!e.amount&&(0,ef.Y)(e.service)===ev.fW)&&!n.includes("self")},e0=function(e,i,n){var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window.location.pathname;return e.amount?n.onMonetaryUse:e.onlyValidOncePaid&&!e.paid?n.onUnpaidUse:eX(e,i,t)?n.onServiceCreditModal:n.onBookWithCredit},e1=function(e,i,n){var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window.location.pathname;eX(e,i,t)?n.onServiceCreditModal(e):n.onBookWithCredit(e)};function e5(){var e=(0,t._)(["\n    display: flex;\n    flex-direction: column;
1\n    align-items: center;\n    width: 100%;\n    @media screen and (min-width: 768px) {\n        background-color: transparent;\n    }\n    background-color: white;\n"]);return e5=function(){return e},e}var e2=l.Ay.div(e5()),e4=e=>{var{allCredits:i,refetch:n}=e,[t,r,o]=(0,m.A)(),[s,l,h]=(0,m.A)(),[g,b,y]=(0,m.A)(),[x,A,I]=(0,m.A)(),[C,S,j]=(0,m.A)(),[_,N,w]=(0,m.A)(),E=(0,d.useDispatch)(),O=(0,c.W6)(),D=(0,d.useSelector)(e=>e.auth.currentUser),U=()=>{E((0,em.kg)())},R=(e=>{var{toggleUseModal:i,toggleUseUnpaidModal:n,toggleUseServiceCreditModal:t,bookWithCredit:a}=e;return{onMonetaryUse:i,onUnpaidUse:n,onServiceCreditModal:t,onBookWithCredit:a}})({toggleUseModal:I,toggleUseUnpaidModal:j,toggleUseServiceCreditModal:w,bookWithCredit:e=>{var{service:i,id:n,client:{id:t}}=e,a=(e=>{var{service:i,sessionId:n,creditId:t,clientId:a}=e;if(i){if(window.location.pathname.includes("self")||!(0,u.oz)(p.ACTION_BOOK,v.RESOURCE_APPOINTMENT))return"/selfBook?serviceId=".concat(i.id,"&creditId=").concat(t,"&clientId=").concat(a);if((0,ef.Y)(i)===ev.Yc)return"/appointment/create?serviceId=".concat(i.id,"&creditId=").concat(t,"&clientId=").concat(a);if((0,ef.Y)(i)===ev.fW)return n?"/services/".concat(i.id,"/sessions/").concat(n,"/enroll"):"/services/".concat(i.id,"/sessions/enroll?creditId=").concat(t,"&clientId=").concat(a,"&onlyPayableWithCredit=true");if((0,ef.Y)(i)===ev.ll)return"/services/".concat(i.id,"/edit#Events");throw Error("Invalid service context for route")}})({service:i,creditId:n,clientId:t});O.push(a)}});return(0,a.jsxs)(a.Fragment,{children:[(i||[]).map((e,n)=>{var t,r=e0(e,D,R);return(null==(t=e.service)?void 0:t.disableUseCredits)&&(window.location.pathname.includes("self")||!(0,u.oz)(p.ACTION_BOOK,v.RESOURCE_APPOINTMENT))&&(r=null),(0,a.jsx)(e2,{children:(0,a.jsx)(f.A,{className:n===i.length-1&&"border-disabler"||void 0,index:n,credit:e,onMoreInfo:o,onDelete:(0,u.oz)(p.ACTION_DELETE,v.RESOURCE_CREDIT)?y:void 0,onUpdate:(0,u.oz)(p.ACTION_UPDATE,v.RESOURCE_CREDIT)?h:void 0,onUse:r})},"credit-item-".concat(e.id))}),s&&(0,a.jsx)(J,{isOpen:s,toggle:h,credit:l,onDone:U}),g&&(0,a.jsx)(ei,{isOpen:g,toggle:y,credit:b,onDone:()=>{n(),U()}}),t&&(0,a.jsx)(ep,{isOpen:t,toggle:o,credit:r}
1),x&&(0,a.jsx)(eV,{isOpen:x,toggle:I,credit:A}),C&&(0,a.jsx)(eG,{isOpen:C,toggle:j,credit:S,onDone:e=>e1(e,D,R)}),_&&N&&(0,a.jsx)(eZ.A,{children:(0,a.jsx)(eK.A,{mode:"useServiceCredit",isOpen:_,toggle:w,credit:N})})]})};e4.propTypes={allCredits:s().arrayOf(s().object),refetch:s().func},e4.defaultProps={allCredits:[],refetch:void 0};var e3=e4},9321:function(e,i,n){n.d(i,{R:function(){return d}});var t=n(71893),a=n(55456);n(45336),n(79936),n(23446);var r=n(93229),o=n(34262),s=n(18650),l=n(39124),c=n(44123),d=(0,r.A)({dataLabel:"people",customGetOptions:e=>e[0].subscriptions.filter(i=>e[0].id===i.client.id),defaultVariables:{},requiredQueryParams:["clientId"],query:l.kD,queryMiddleware:e=>(e||[]).map(e=>(0,a._)((0,t._)({},e),{id:e.id})),selectProps:{instanceId:c.yn,components:{Option:o.A,SingleValue:s.A},getOptionLabel:e=>{var i;return null==(i=e.plan)?void 0:i.name},getOptionValue:e=>e.id,cacheOptions:!1}})},31471:function(e,i,n){n.d(i,{OA:function(){return b},oz:function(){return y},wQ:function(){return g}}),n(45336),n(23446);var t=n(19919),a=n.n(t),r=n(6251),o=n(78738),s=n(61179),l=n(7232),c=n(84678),d=n(90089),u=n(9321),p=n(38821),v=n(77999),f=n(39343),m=n(65802),h=a()({allowLeadingZeroes:!0,includeThousandsSeparator:!1,allowDecimal:!1,requireDecimal:!1,prefix:"",suffix:""}),g={type:"object",required:["name"],properties:{subscription:{type:"object",title:"Ap
1ply to subscription",default:{}},name:{type:"string",title:"Reason",minLength:2,maxLength:32},notValidBefore:{type:"object",title:"Not valid before"},validUntil:{type:"object",title:"Valid until"},neverExpires:{type:"boolean",title:"Never expires",default:!0},onlyValidOncePaid:{type:"boolean",title:"Only valid once paid"},visitCount:{type:"integer",title:"Visit count",minimum:1,maximum:99},amount:{type:"number",title:"Amount",default:0,minimum:.5},client:{type:"object",title:"Client",default:{}},staff:{type:"array",title:"Staff",default:[]},service:{type:"object",title:"Service",default:{}},isServiceCredit:{type:"boolean",title:"Service credit",default:!1},creationReason:{title:"Count towards cancellation policy"}}},b={layout_grid:o.A},y=(e,i,n,t)=>{var a,o,g=null==(o=i.formData)||null==(a=o.client)?void 0:a.id;return{"ui:field":"layout_grid","ui:layout_grid":n||{"ui:row":[{"ui:col":{md:12,children:[{"ui:row":[{"ui:col":{md:12,children:["client"]}}]},{"ui:row":[{"ui:col":{md:12,children:["staff"]}}]},{"ui:row":[{"ui:col":{md:12,children:["name"]}}]},{"ui:row":[{"ui:col":{md:7,children:["notValidBefore"]}}]},{"ui:row":[{"ui:col":{md:5,children:["neverExpires"]}}]},{"ui:row":[{"ui:col":{md:7,children:["validUntil"]}}]},{"ui:row":[{"ui:col":{md:5,children:["onlyValidOncePaid"]}}]},{"ui:row":[{"ui:col":{md:12,children:["visitCount"]}}]},{"ui:row":[{"ui:col":{md:5,children:["amount"]}}]},{"ui:row":[{"ui:col":{md:12,children:["service"]}}]},{"ui:row":[{"ui:col":{md:12,children:["subscription"]}}]},{"ui:row":[{"ui:col":{md:12,children:["creationReason"]}}]}]}}]}
1,subscription:{"ui:placeholder":"Apply to subscription (optional)","ui:field":s.qd,"ui:options":{ApolloSelect:u.R,params:{queryParams:{clientId:g},isMulti:!1,icon:"content_paste"}}},name:{"ui:placeholder":"Reason"},notValidBefore:{"ui:placeholder":"Not valid before date:","ui:field":m.A,"ui:options":{params:{inputId:"credit-not-valid-before",icon:"calendar-alt"}}},validUntil:{"ui:placeholder":"Expiration Date","ui:field":m.A,"ui:options":{params:{inputId:"credit-valid-until",icon:"calendar-alt",allowPast:!1}}},neverExpires:{"ui:field":s.RF,"ui:options":{params:{},id:"never-expires"}},onlyValidOncePaid:{"ui:field":s.RF,"ui:options":{params:{},id:"only-valid-once-paid"}},isServiceCredit:{"ui:field":s.RF,"ui:options":{params:{},id:"service-credit",toggleId:"service-credit"}},visitCount:{"ui:placeholder":"Visit Count","ui:field":s.u$,"ui:options":{params:{mask:h,icon:"trending_up"},id:"input-visit-count"}},amount:{"ui:placeholder":"Amount","ui:field":s.u$,"ui:options":{params:{mask:(0,f.PH)(t),icon:"attach_money",trigger:(i.formData||{}).currency},id:"input-credit-amount"}},currency:{"ui:placeholder":"Currency","ui:field":s.qd,"ui:disabled":!0,"ui:options":{ApolloSelect:r.Ay,params:{options:p.S6.map(e=>({name:e,value:e})),getOptionLabel:e=>e.name,getOptionValue:e=>e.value,styles:v.K6,icon:"local_atm",id:"react-select-currency",classNamePrefix:"react-select"},isString:!0}},client:{"ui:placeholder":"Client to credit","ui:field":s.qd,"ui:options":{ApolloSelect:l.vI,params:{defaultVariables:{id:g},isMulti:!1,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,icon:"person",isClearable:!1}}},staff:{"ui:placeholder":"Staff","ui:help":"Applicable staff applied to this credit. See service settings to restrict usage of credit with these staff only.","ui:field":s.qd,"ui:options":{ApolloSelect:c.kS,params:{defaultVariables:{id:g},isMulti:!0,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,icon:"person",isClearable:!0}}},service:{"ui:placeholder":"Service","ui:field":s.qd,"ui:options":{ApolloSelect:d.fi,params:{isMulti:!1,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,icon:"content_paste",isClearable:!1}}},creationReason:{"ui:placeholder":"Count towards cancellation policy (optional)","ui:field":s.qd,"ui:help":"This is used to determine if the credit counts against a cancellation policy limit of the applied subscription.","ui:options":{ApolloSelect:r.Ay,isString:!0,params:{getOptionLabel:e=>e.label,getOptionValue:e=>e.value,options:[{label:"Client cancellation",value:"CLIENT_CANCELLATION"},{label:"Late client cancellation",value:"LATE_CLIENT_CANCELLATION"},{label:"Staff cancellation",value:"STAFF_CANCELLATION"}]}}}}}},24988:function(e,i,n){var t=n(84577),a=n(74848),r=n(96540),o=n(5556),s=n.n(o),l=n(17378),c=n(95093),d=n.n(c),u=n(52956),p=n(60597),v=n(42479),f=n(4301),m=n(20615),h=n(26871),g=n(89511),b=n(7091),y=n(48689),x=n(18258),A=n(16517),I=n(6702),C=n(53894),S=n(48810),j=n(70537),_=n(60411);function N(){var e=(0,t._)(["\n        font-size: 12px;\n    "]);return N=function(){return e},e}function w(){var e=(0,t._)(["\n    font-family: 'Montserrat', tahoma;\n    font-size: 14px;\n    color: #c0c6d2;\n    font-weight: 500;\n    :hover {\n        color: #c0c6d2;\n    }\n    ",";\n"]);return w=function(){return e},e}function E(){var e=(0,t._)(["\n    font-family: 'Montserrat', tahoma;\n    font-size: 20px;\n    line-height: 24px;\n    color: #4752a9;\n    font-weight: 600;\n"]);return E=function(){return e},e}function O(){var e=(0,t._)(["\n    box-sizing: border-box;\n    width: 100%;\n    height: unset;\n    display: flex;\n    flex-direction: row;\n"]);return O=function(){return e},e}function D(){var e=(0,t._)(["\n    width: 50%;\n    display: flex;\n    flex-direction: column;\n    padding-right: 0px !important;\n    margin-right: 5px;\n    flex-grow: 1;\n"]);return D=function(){return e},e}function U(){var e=(0,t._)(["\n    display: flex;\n    flex-direction: column;\n    align-items: start !important;\n    justify-content: end;\n    padding-left: 0px !important;\n    padding-right: 0px !important;\n"]);return U=function(){return e},e}function R(){var e=(0,t._)(["\n    display: flex;\n    flex-direction: row;\n    flex-wrap: wrap;\n"]);return R=function(){return e},e}function T(){var e=(0,t._)(["\n    margin-left: 10px;\n"]);return T=function(){return e},e}function k(){var e=(0,t._)(["\n    padding: 0px;\n    padding-top: 15px;\n    padding-bottom: 15px;\n    border-bottom: 1px solid #e9eef3;\n"]);return k=function(){return e},e}var P=(0,l.Ay)(v.sS)(w(),m.$_.mobile(N())),M=l.Ay.p(E()),V=l.Ay.div(O()),q=l.Ay.div(D()),F=l.Ay.div(U()),z=l.Ay.div(R()),B=(0,l.Ay)(f.Sh)(T()),$=e=>
1{var{onUse:i,credit:n,className:t,onMoreInfo:o,onUpdate:s,onDelete:l,onClickClient:c,selfBookRoute:v,index:f}=e,m=(0,C.A)(),N=(0,u.useSelector)(e=>e.app.business.defaultCurrency),w=(0,u.useSelector)(e=>e.app.business.emailFrom),E=(0,u.useSelector)(e=>e.app.business.contactEmail),{validUntil:O,amount:D,visitCount:U,createdAt:R,service:T,client:k,event:$,subscription:L,notValidBefore:Y,paid:Q,onlyValidOncePaid:W}=n||{},H=!!(null==T?void 0:T.hiddenAt),J=(0,r.useCallback)(()=>{H?(0,S.UG)({title:"Credit is invalid",message:(0,h.oz)(y.ACTION_READ,b.RESOURCE_CREDIT)?"Service for this credit is deleted":"This credit is currently unavailable - Please contact ".concat(w||E)}):n.status!==A.vi||(0,h.oz)(y.ACTION_READ,b.RESOURCE_CREDIT)?i(n,v):(0,S.UG)({title:"Credit is invalid",message:"This credit is currently unavailable - Please contact ".concat(w||E)})},[n,i,v,H,w,E]);if(!n)return null;var G=n.client,K=!0,Z=!0,X=!0,ee=T?T.name:n.name;switch(n.status){case A.FM:ee="(deleted) ".concat(ee),K=!1,Z=!1,X=!1;break;case A.Dt:ee="(expired) ".concat(ee),K=!1,Z=!0,X=!1;break;case A.zF:ee="(used) ".concat(ee),K=!1,Z=!1,X=!1;break;case A.Xn:ee="(not yet valid) ".concat(ee),K=!1,Z=!0,X=!0;break;case A.vi:ee=(0,a.jsxs)("span",{className:"d-flex align-items-center",children:[(0,a.jsx)(j.A,{fasIcon:"exclamation-triangle mr-1 text-danger",tooltip:"Invoice payment status for this credit cannot be verified because the appointment / class date linked to this credit has been deleted."}),ee]}),K=!0,Z=!0,X=!0}return(0,a.jsxs)("div",{className:"col-lg-12 credit-item ".concat(t||""),id:"credit-item-".concat(f),children:[(0,a.jsxs)(V,{children:[(0,a.jsx)(p.H8,{showTooltip:!0,user:G,route:g.BK,index:"credit-item-".concat(f)}),(0,a.jsxs)(q,{children:[(0,a.jsxs)(x.QP,{id:"credit-item-title-".concat(f),route:(()=>{if((0,h.oz)(y.ACTION_READ,b.RESOURCE_EVENT)&&n){var e=n.id;return"/credits/".concat(e)}return null})(),isActive:K,className:"d-flex align-items-center credit-item-title",children:[H&&(0,a.jsx)(_.A,{action:y.ACTION_READ,resource:b.RESOURCE_CREDIT,children:(0,a.jsx)(j.A,{className:"credit-warning text-danger mr-2",farIcon:"exclamation-triangle",tooltip:"This credit is currently unavailable"})}),ee]}),(0,a.jsxs)(z,{children:[D&&(0,a.jsx)(P,{className:"d-sm-none amount",iconClass:"fa fa-money-bill-wave",text:(0,I.og)(N,D)}),"number"==typeof U&&(0,a.jsx)(P,{className:"d-sm-none visits",iconClass:"fal fa-ticket-alt",text:"".concat(U," visits")}),T&&(0,a.jsx)(P,{className:"credit-reason",falIcon:"bookmark",text:n.name}),R&&(0,a.jsx)(P,{className:"created-at",falIcon:"calendar",text:"created at ".concat(m(R).format("ll"))}),Y&&d()(Y)>d()()&&(0,a.jsx)(P,{className:"notValidBefore",falIcon:"calendar",text:"not valid before ".concat(m(Y).format("ll"))}),O&&(0,a.jsx)(P,{className:"expiration",falIcon:"calendar",text:"valid until ".concat(m(O).format("ll"))}),L&&(0,a.jsx)(P,{className:"subscription",falIcon:"repeat",text:L.plan.name}),k&&(0,a.jsx)(P,{className:"client",falIcon:"user",text:(k||{}).name}),$&&(0,a.jsx)(P,{className:"from-event",falIcon:"tag",text:"From: ".concat(null==$?void 0:$.name," - ").concat(m(null==$?void 0:$.startAt).format("ll"))}),W&&!Q&&(0,a.jsx)(P,{className:"unpaid",falIcon:"tag",text:"Cancelled event must be paid before use"})]})]}),(0,a.jsxs)(F,{className:"d-none d-sm-block text-right",children:[D&&(0,a.jsx)(M,{className:"amount",id:"credit-value-".concat(f),children:(0,I.og)(N,D)}),[null,void 0].includes(U)?null:(0,a.jsx)(M,{className:"visits",id:"credit-value-".concat(f),children:"".concat(U," visit").concat(U>1?"s":"")})]})]}),(0,a.jsxs)("div",{className:"d-flex flex-row justify-content-end",children:[X&&l&&(0,a.jsx)(B,{className:"btn-delete",id:"credit-item-delete-".concat(f),onClick:()=>l(n),onMouseDown:e=>e.preventDefault(),children:"Delete"}),Z&&s&&(0,a.jsx)(B,{className:"btn-update",id:"credit-item-update-".concat(f),onClick:()=>s(n),onMouseDown:e=>e.preventDefault(),children:"Update"}),K&&o&&(0,a.jsx)(B,{className:"btn-details",id:"credit-item-details-".concat(f),onClick:()=>o(n),onMouseDown:e=>e.preventDefault(),children:"Details"}),K&&i&&(0,a.jsx)(B,{className:"btn-use",id:"credit-item-use-".concat(f),onClick:J,onMouseDown:e=>e.preventDefault(),children:"Use"})]})]})};$.defaultProps={selfBookRoute:null,credit:void 0,className:"",onMoreInfo:void 0,onUpdate:void 0,onDelete:void 0,onUse:void 0,index:void 0}
1,$.propTypes={selfBookRoute:s().string,credit:s().object,className:s().string,onMoreInfo:s().func,onUpdate:s().func,onDelete:s().func,onUse:s().func,index:s().number},i.A=(0,l.Ay)($)(k())},30205:function(e,i,n){n.d(i,{t:function(){return r}});var t=n(74848);n(96540);var a=n(27045),r=e=>{var{isServiceCredit:i}=e;return(0,t.jsx)(a.c,{text:i?"Service Credits should be issued to clients (Account Manager or Dependent who will be using the service) and can be used to book appointments or enroll in classes. Service Credit can also be applied to one of the client's subscription and count against their cap. Service Credits without Subscription applied do not count against cancellation policy caps.":"Monetary Credits should be issued to payers (usually Account Managers) and can later be used when paying invoices (by a client or as a staff)."})}}}]);
2//# sourceMappingURL=11846.5daf60ec.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.