PageSourceSearch

https://www.buildersclubnorth.com/static/js/9917.0370c8c2.chunk.js

js buildersclubnorth.com collected 2026-10-08 04:19:10 UTC 35,890 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkbcn2020=self.webpackChunkbcn2020||[]).push([[9917],{66708:(t,e,o)=>{o.d(e,{i:()=>q});var r,n,a,i,s,p,c,y,d,u,m,h,l,g,C,b,f,w,O,I,D,P,v,Z,S,A,L,z,j,N,B,U,M,T,R,E=o(43269),H=o(53229),F=o(84098),V=o(7585),x=o(79159),k=o(11895);const G="impersonating-user-id",Y="current-company";const q=new(r=F.aD.bound,n=F.aD.bound,a=F.aD.bound,i=F.aD.bound,s=F.aD.bound,p=F.aD.bound,c=F.aD.bound,y=F.aD.bound,d=F.aD.bound,u=F.aD.bound,m=F.aD.bound,h=F.aD.bound,l=F.aD.bound,g=F.aD.bound,C=F.aD.bound,b=F.aD.bound,f=class{constructor(){(0,E.Z)(this,"preImpersonationPath",w,this),(0,E.Z)(this,"myInfoLoading",O,this),(0,E.Z)(this,"myInfoLoaded",I,this),(0,E.Z)(this,"recentCompaniesLoading",D,this),(0,E.Z)(this,"recentCompaniesLoaded",P,this),(0,E.Z)(this,"shippingAdressesLoaded",v,this),(0,E.Z)(this,"shippingAddresses",Z,this),(0,E.Z)(this,"myInfo",S,this),(0,E.Z)(this,"impersonatingUserInfo",A,this),(0,E.Z)(this,"currentCompany",L,this),(0,E.Z)(this,"upcomingEventsCache",z,this),(0,E.Z)(this,"newestMembers",j,this),(0,E.Z)(this,"grandDestinationVideoInfo",N,this),(0,E.Z)(this,"pointActivityChartData",B,this),(0,E.Z)(this,"paymentHistoryChartData",U,this),(0,E.Z)(this,"balanceOverTimeChartData",M,this),(0,E.Z)(this,"recentCompanies",T,this),(0,E.Z)(this,"transactionsAreLoading",R,this),this.transactions=void 0,this.getEffectiveAdminRoles=()=>this.myInfo&&this.isAdminNotImpersonating?this.myInfo.roles:[],this.getEffectiveCompanyRole=()=>{if(this.currentCompany)return this.currentCompany.roleId},(0,F.rC)(this),this.monitorAndSaveToSessionStorage()}getSelectedCompany(t){if(0===t.companies.length)return;const e=window.sessionStorage.getItem(Y),o=e?t.companies.find(t=>t.companyId===e):void 0;return null!==o&&void 0!==o?o:t.companies[0]}get upcomingEvents(){if(!this.currentCompany)return[];const t=this.currentCompany.companyType;return this.upcomingEventsCache[t]}get displayUserType(){return this.currentCompany&&"Member"===this.currentCompany.companyType?"Member":this.currentCompany&&"Sponsor"===this.currentCompany.companyType?"Sponsor":this.myInfo&&this.myInfo.roles.length>0?"Admin":void 0}get realUserType(){return this.myInfo&&this.myInfo.roles.length>0?"Admin":this.currentCompany&&"Member"===this.currentCompany.companyType?"Member":this.currentCompany&&"Sponsor"===this.currentCompany.companyType?"Sponsor":void 0}get currentCompanyName(){return this.currentCompany?this.currentCompany.companyName:void 0}get currentCompanyPointBalance(){return this.currentCompany?this.currentCompany.pointBalance:void 0}get currentCompanyType(){return this.currentCompany?this.currentCompany.companyType:void 0}get emailAddress(){var t;return this.impersonatingUserInfo?this.impersonatingUserInfo.emailAddress:null===(t=this.myInfo)||void 0===t?void 0:t.emailAddress}get currentUserInfo(){return this.impersonatingUserInfo?this.impersonatingUserInfo:this.myInfo}get isAdmin(){return this.myInfo&&0===this.myInfo.companies.length&&this.myInfo.roles.length>0}get isAdminNotImpersonating(){return!0===this.isAdmin&&!this.impersonatingUserInfo}get canManageUsers(){return this.isAdminNotImpersonating&&this.hasAdminRole("bcn:user-account-manager")}get isCompanyAdmin(){return this.hasCompanyRole(x.Ch)||this.hasCompanyRole(x.z4)}get isSponsor(){return this.currentCompany&&(this.currentCompany.roleId===x.MI||this.currentCompany.roleId===x.YY||this.currentCompany.roleId===x.z4)}get isMember(){return this.currentCompany&&(this.currentCompany.roleId===x.Ch||this.currentCompany.roleId===x.vL)}async impersonateUser(t,e,o){k.R.unload(),this.preImpersonationPath=e;const r=await V.C.admin.users.getUserInfo(t);(0,F.z)(()=>{this.impersonatingUserInfo=r,this.currentCompany=r.companies[0]}),o(r.companies[0])}updateCurrentUserPhoneNumber(t){if(this.impersonatingUserInfo){const e=Object.assign({},this.impersonatingUserInfo,{phoneNumber:t});this.impersonatingUserInfo=e}else{const e=Object.assign({},this.myInfo,{phoneNumber:t});this.myInfo=e}}getCurrentUserPhoneNumber(){var t;return this.impersonatingUserInfo?this.impersonatingUserInfo.phoneNumber:null===(t=this.myInfo)||void 0===t?void 0:t.phoneNumber}setCurrentCompany(t){var e;const o=null===(e=this.currentUserInfo)||void 0===e?void 0:e.companies.find(e=>e.companyId===t);if(!o)throw Error("Could not find company with Id of ".concat(t));this.currentCompany=o}stopImpersonating(){k.R.unload(),this.impersonatingUserInfo=void 0,this.currentCompany=void 0,this.shippingAdressesLoaded=!1}updatePointBalance(t){if(this.currentCompany&&(this.currentCompany=Object.assign({},this.currentCompany,{pointBalance:t})),this.myInfo){var e;const o=(null!==(e=this.impersonatingUserInfo)&&void 0!==e?e:this.myInfo).companies.map(e=>{var o;return e.companyId===(null===(o=this.currentCompany)||void 0===o?void 0:o.companyId)?Object.assign({},e,{pointBalance:t}):e});this.impersonatingUserInfo?this.impersonatingUserInfo=Object.assign({},this.impersonatingUserInfo,{companies:o}):this.myInfo=Object.assign({},this.myInfo,{companies:o})}}async getMyInfo(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.myInfoLoaded&&!t)return this.myInfo;this.myInfoLoading=!0;try{var e;const t=(await V.C.members.my.getMyInfo()).data;let r;const n=window.sessionStorage.getItem(G);if(n)try{r=await V.C.admin.users.getUserInfo(n)}catch(o){window.sessionStorage.removeItem(G)}
1const a=null!==(e=r)&&void 0!==e?e:t,i=this.getSelectedCompany(a);(0,F.z)(()=>{this.myInfo=t,this.impersonatingUserInfo=r,this.currentCompany=i,this.myInfoLoaded=!0})}catch(r){console.error(r)}finally{(0,F.z)(()=>{this.myInfoLoading=!1})}return this.myInfo}async getRecentCompanies(){this.recentCompaniesLoading=!0,this.recentCompaniesLoaded=!1;try{const t=await V.C.admin.my.getRecentCompanies();(0,F.z)(()=>{this.recentCompanies=t.data,this.recentCompaniesLoaded=!0})}catch(t){console.error(t)}finally{(0,F.z)(()=>{this.recentCompaniesLoading=!1})}}async getMyShippingAddresses(){if(!this.shippingAdressesLoaded)try{const t=await V.C.members.my.getMyShippingAdresses();(0,F.z)(()=>{this.shippingAddresses=t.data,this.shippingAdressesLoaded=!0})}catch(t){console.error(t)}}async ensureEventsAreLoaded(){const t=this.currentCompany.companyType;if(!(this.upcomingEvents&&void 0!==this.upcomingEvents[t])){const e=await V.C.companies.events.getUpcomingEvents();(0,F.z)(()=>{this.upcomingEventsCache=Object.assign({},this.upcomingEvents,{[t]:e})})}}async ensureGrandDestinationVideoInfoIsLoaded(){if(this.grandDestinationVideoInfo)return;const t=await V.C.shared.grandDestinations.getGrandDestinationVideoLink();(0,F.z)(()=>{this.grandDestinationVideoInfo=t})}async loadNewestMembers(){var t;let e=this.newestMembers;return this.isAdminNotImpersonating?e=await V.C.admin.members.getNewest():this.newestMembers||(e=await V.C.sponsors.members.getNewest()),(0,F.z)(()=>{this.newestMembers=e}),null!==(t=e)&&void 0!==t?t:[]}async getSponsorPaymentHistoryChartData(t){const e=this.paymentHistoryChartData[t];if(e)return e;const o=await V.C.admin.sponsors.getPaymentHistoryChartData(t);return(0,F.z)(()=>{this.paymentHistoryChartData=Object.assign({},this.paymentHistoryChartData,{[t]:o})}),this.paymentHistoryChartData[t]}async getMemberPointHistoryChartData(t){const e=this.pointActivityChartData[t];if(e)return e;const o=await V.C.members.pointsHistory.getMemberPointHistoryChartData(t);return(0,F.z)(()=>{this.pointActivityChartData=Object.assign({},this.pointActivityChartData,{[t]:o})}),this.pointActivityChartData[t]}async getAccountBalanceOverTimeChartData(t){const e=this.balanceOverTimeChartData[t];if(e)return e;const o=await V.C.members.pointsHistory.getAccountBalanceOverTimeChartData(t);return(0,F.z)(()=>{this.balanceOverTimeChartData=Object.assign({},this.balanceOverTimeChartData,{[t]:o})}),this.balanceOverTimeChartData[t]}async getSponsorPointHistoryChartData(t){const e=this.pointActivityChartData[t];if(e)return e;const o=await V.C.sponsors.pointsHistory.getSponsorPointHistoryChartData(t);return(0,F.z)(()=>{this.pointActivityChartData=Object.assign({},this.pointActivityChartData,{[t]:o})}),this.pointActivityChartData[t]}hasAnyAdminRole(t){for(const e of t)if(this.hasAdminRole(e))return!0;return!1}hasAdminRole(t){if(!this.myInfo)return!1;return this.myInfo.roles.some(e=>e===t)}hasAnyCompanyRole(t){for(const e of t)if(this.hasCompanyRole(e))return!0;return!1}hasCompanyRole(t){if(!this.currentCompany)return!1;return this.currentCompany.roleId===t}monitorAndSaveToSessionStorage(){(0,F.N7)(this,"impersonatingUserInfo",t=>{var e;const o=null===(e=t.newValue)||void 0===e?void 0:e.userId;o?window.sessionStorage.setItem(G,o):window.sessionStorage.removeItem(G)}),(0,F.N7)(this,"currentCompany",t=>{var e;const o=null===(e=t.newValue)||void 0===e?void 0:e.companyId;o?window.sessionStorage.setItem(Y,o):window.sessionStorage.removeItem(Y)})}},(0,H.Z)(f.prototype,"upcomingEvents",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"upcomingEvents"),f.prototype),(0,H.Z)(f.prototype,"displayUserType",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"displayUserType"),f.prototype),(0,H.Z)(f.prototype,"realUserType",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"realUserType"),f.prototype),(0,H.Z)(f.prototype,"currentCompanyName",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"currentCompanyName"),f.prototype),(0,H.Z)(f.prototype,"currentCompanyPointBalance",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"currentCompanyPointBalance"),f.prototype),(0,H.Z)(f.prototype,"currentCompanyType",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"currentCompanyType"),f.prototype),(0,H.Z)(f.prototype,"emailAddress",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"emailAddress"),f.prototype),(0,H.Z)(f.prototype,"currentUserInfo",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"currentUserInfo"),f.prototype),w=(0,H.Z)(f.prototype,"preImpersonationPath",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),O=(0,H.Z)(f.prototype,"myInfoLoading",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),I=(0,H.Z)(f.prototype,"myInfoLoaded",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),D=(0,H.Z)(f.prototype,"recentCompaniesLoading",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),P=(0,H.Z)(f.prototype,"recentCompaniesLoaded",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),v=(0,H.Z)(f.prototype,"shippingAdressesLoaded",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Z=(0,H.Z)(f.prototype,"shippingAddresses",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),S=(0,H.Z)(f.prototype,"myInfo",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),A=(0,H.Z)(f.prototype,"impersonatingUserInfo",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),L=(0,H.Z)(f.prototype,"currentCompany",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),z=(0,H.Z)(f.prototype,"upcomingEventsCache",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),j=(0,H.Z)(f.prototype,"newestMembers",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),N=(0,H.Z)(f.prototype,"grandDestinationVideoInfo",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),B=(0,H.Z)(f.prototype,"pointActivityChartData",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),U=(0,H.Z)(f.prototype,"paymentHistoryChartData",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),M=(0,H.Z)(f.prototype,"balanceOverTimeChartData",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),(0,H.Z)(f.prototype,"isAdmin",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"isAdmin"),f.prototype),(0,H.Z)(f.prototype,"isAdminNotImpersonating",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"isAdminNotImpersonating"),f.prototype),(0,H.Z)(f.prototype,"canManageUsers",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"canManageUsers"),f.prototype),(0,H.Z)(f.prototype,"isCompanyAdmin",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"isCompanyAdmin"),f.prototype),(0,H.Z)(f.prototype,"isSponsor",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"isSponsor"),f.prototype),(0,H.Z)(f.prototype,"isMember",[F.Fl],Object.getOwnPropertyDescriptor(f.prototype,"isMember"),f.prototype),T=(0,H.Z)(f.prototype,"recentCompanies",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),R=(0,H.Z)(f.prototype,"transactionsAreLoading",[F.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),(0,H.Z)(f.prototype,"impersonateUser",[r],Object.getOwnPropertyDescriptor(f.prototype,"impersonateUser"),f.prototype),(0,H.Z)(f.prototype,"updateCurrentUserPhoneNumber",[
1n],Object.getOwnPropertyDescriptor(f.prototype,"updateCurrentUserPhoneNumber"),f.prototype),(0,H.Z)(f.prototype,"getCurrentUserPhoneNumber",[a],Object.getOwnPropertyDescriptor(f.prototype,"getCurrentUserPhoneNumber"),f.prototype),(0,H.Z)(f.prototype,"setCurrentCompany",[i],Object.getOwnPropertyDescriptor(f.prototype,"setCurrentCompany"),f.prototype),(0,H.Z)(f.prototype,"stopImpersonating",[s],Object.getOwnPropertyDescriptor(f.prototype,"stopImpersonating"),f.prototype),(0,H.Z)(f.prototype,"updatePointBalance",[p],Object.getOwnPropertyDescriptor(f.prototype,"updatePointBalance"),f.prototype),(0,H.Z)(f.prototype,"getMyInfo",[c],Object.getOwnPropertyDescriptor(f.prototype,"getMyInfo"),f.prototype),(0,H.Z)(f.prototype,"getRecentCompanies",[y],Object.getOwnPropertyDescriptor(f.prototype,"getRecentCompanies"),f.prototype),(0,H.Z)(f.prototype,"getMyShippingAddresses",[d],Object.getOwnPropertyDescriptor(f.prototype,"getMyShippingAddresses"),f.prototype),(0,H.Z)(f.prototype,"ensureEventsAreLoaded",[u],Object.getOwnPropertyDescriptor(f.prototype,"ensureEventsAreLoaded"),f.prototype),(0,H.Z)(f.prototype,"ensureGrandDestinationVideoInfoIsLoaded",[m],Object.getOwnPropertyDescriptor(f.prototype,"ensureGrandDestinationVideoInfoIsLoaded"),f.prototype),(0,H.Z)(f.prototype,"loadNewestMembers",[h],Object.getOwnPropertyDescriptor(f.prototype,"loadNewestMembers"),f.prototype),(0,H.Z)(f.prototype,"getSponsorPaymentHistoryChartData",[l],Object.getOwnPropertyDescriptor(f.prototype,"getSponsorPaymentHistoryChartData"),f.prototype),(0,H.Z)(f.prototype,"getMemberPointHistoryChartData",[g],Object.getOwnPropertyDescriptor(f.prototype,"getMemberPointHistoryChartData"),f.prototype),(0,H.Z)(f.prototype,"getAccountBalanceOverTimeChartData",[C],Object.getOwnPropertyDescriptor(f.prototype,"getAccountBalanceOverTimeChartData"),f.prototype),(0,H.Z)(f.prototype,"getSponsorPointHistoryChartData",[b],Object.getOwnPropertyDescriptor(f.prototype,"getSponsorPointHistoryChartData"),f.prototype),f)},11895:(t,e,o)=>{o.d(e,{R:()=>dt});var r=o(29439),n=o(1413),a=o(43269),i=o(53229),s=o(63881);var p,c,y,d,u,m,h,l,g,C,b,f,w,O,I,D,P,v,Z,S,A,L,z,j,N,B,U,M,T,R,E,H,F,V,x,k,G,Y,q,Q,_,J,K,W,X,$,tt,et,ot,rt,nt,at,it,st,pt,ct=o(84098),yt=o(7585);const dt=new(p=ct.aD.bound,c=ct.aD.bound,y=ct.aD.bound,d=ct.aD.bound,u=ct.aD.bound,m=ct.aD.bound,h=ct.aD.bound,l=ct.aD.bound,g=ct.aD.bound,C=ct.aD.bound,b=ct.aD.bound,f=ct.aD.bound,w=ct.aD.bound,O=ct.aD.bound,I=ct.aD.bound,D=ct.aD.bound,P=ct.aD.bound,v=ct.aD.bound,Z=ct.aD.bound,S=ct.aD.bound,A=ct.aD.bound,L=ct.aD.bound,z=ct.aD.bound,j=ct.aD.bound,N=ct.aD.bound,B=ct.aD.bound,U=ct.aD.bound,M=ct.aD.bound,T=ct.aD.bound,R=ct.aD.bound,E=ct.aD.bound,H=ct.aD.bound,F=ct.aD.bound,V=ct.aD.bound,x=ct.aD.bound,k=ct.aD.bound,G=ct.aD.bound,Y=ct.aD.bound,q=ct.aD.bound,Q=ct.aD.bound,_=ct.aD.bound,J=ct.aD.bound,K=class{constructor(){(0,a.Z)(this,"loading",W,this),(0,a.Z)(this,"isBusy",X,this),(0,a.Z)(this,"currentAccount",$,this),(0,a.Z)(this,"lastCompanyPage",tt,this),(0,a.Z)(this,"contacts",et,this),(0,a.Z)(this,"purchaserSuppliers",ot,this),(0,a.Z)(this,"supplierPurchasers",rt,this),(0,a.Z)(this,"getStatementsResult",nt,this),(0,a.Z)(this,"isLoadingStatements",at,this),(0,a.Z)(this,"isSavingContact",it,this),(0,a.Z)(this,"currentId",st,this),(0,a.Z)(this,"companies",pt,this),(0,ct.rC)(this)}get details(){if(this.currentId){return this.companies[this.currentId]}return this.currentId?this.companies[this.currentId]:void 0}unload(){this.companies={},this.contacts=void 0,this.purchaserSuppliers=void 0,this.supplierPurchasers=void 0,this.get
1StatementsResult=void 0,this.currentAccount=void 0}setLastCompanyPage(t){this.lastCompanyPage=t}reload(){this.details&&this.setCompanyId(this.details.id)}async setCompanyId(t,e){t!==this.currentId&&(this.getStatementsResult=void 0,this.contacts=void 0,this.purchaserSuppliers=void 0,this.supplierPurchasers=void 0,this.currentAccount=void 0),this.currentId=t,this.loading=!0;try{const o=(await yt.C.shared.company.getDetails({id:t})).data.company;(0,ct.z)(()=>{this.currentAccount=o.accounts[0],(0,ct.t8)(this.companies,t,o)}),e&&e()}catch(o){console.error(o)}finally{(0,ct.z)(()=>{this.loading=!1})}}async createCompany(t){const e=(await yt.C.admin.company.create(t)).data.company;return(0,ct.z)(()=>{(0,ct.t8)(this.companies,e.id,e)}),e.id}async updateCompany(t){this.isBusy=!0;try{const e=(await yt.C.admin.company.update(t)).data.company;(0,ct.z)(()=>{if(this.companies[t.id]){var o;const a=(0,n.Z)((0,n.Z)({},null!==(o=this.companies[t.id])&&void 0!==o?o:{}),null!==e&&void 0!==e?e:{});Object.entries(t).forEach(t=>{let e=(0,r.Z)(t,2),o=e[0],n=e[1];void 0!==n&&(a[o]=n)}),this.companies[t.id]=a}})}finally{(0,ct.z)(()=>{this.isBusy=!1})}}setCurrentAccount(t){this.currentAccount=t,this.getStatementsResult=void 0}async updateLogo(t){const e=this.details.id;await yt.C.admin.company.updateLogo({companyId:e,imageUri:t});const o=Object.assign({},this.companies[e],{imageUrl:t});(0,ct.z)(()=>{this.companies[e]=o})}async createCompanyLocation(t){this.isBusy=!0;try{const e=(await yt.C.shared.company.locationCreate(t)).data.companyLocation,o=t.companyLocation.companyId;if(this.companies[o]){const t=this.companies[o],r=[...t.locations,e];(0,ct.z)(()=>{t.locations=r})}}finally{(0,ct.z)(()=>{this.isBusy=!1})}}async addContactUser(t){this.currentId===t.companyId&&await this.loadContacts(!0)}async updateContactUser(t){this.currentId===t.companyId&&await this.loadContacts(!0)}async setLocationAsPrimary(t){if(!this.currentId)throw Error("No current company");const e=this.currentId;try{await yt.C.shared.company.setLocationAsPrimary(e,t),(0,ct.z)(()=>{this.companies[this.currentId]=Object.assign({},this.details,{primaryLocationId:t})})}catch(o){console.error(o)}}async updateCompanyLocation(t){const e=t.companyLocation.companyId,o=((t,e)=>{const o={primaryContactId:t.primaryContact?t.primaryContact.id:void 0,address:t.address,showOnInternet:t.showOnInternet},r={primaryContactId:e.companyLocation.primaryContactId,address:e.companyLocation.address,showOnInternet:e.companyLocation.showOnInternet};return(0,s.qu)(o,r)})((0,ct.ZN)(this.companies[e].locations.find(e=>e.id===t.companyLocation.id)),t),r=(await yt.C.shared.company.locationUpdate(e,t.companyLocation.id,o)).data.companyLocation;if(this.companies[e]){const t=this.companies[e],o=t.locations.map(t=>t.id===r.id?r:t);(0,ct.z)(()=>{t.locations=o})}}async updateLocationActiveStatus(t){this.isBusy=!0;try{const e=await yt.C.shared.company.updateLocationStatus(t),o=t.companyId;if(this.companies[o]){const t=this.companies[o].locations.map(t=>t.id===e.id?e:t);(0,ct.z)(()=>{this.companies[o].locations=t})}}finally{(0,ct.z)(()=>{this.isBusy=!1})}}async createContact(t){this.isSavingContact=!0;const e=t.phone,o=t.email,r={relatedContacts:[],notes:[],statementPreference:"None",associatedUsers:[],companyId:t.companyId,companyName:"",altFullName:"",email:"",isActive:!0,isEmployee:t.isEmployee,extraNewsletters:0,firstName:t.firstName,lastName:t.lastName,getNameTag:!1,getNewsletter:!1,newspaperPreference:"Never",eventEmailsStatus:"SystemControlled",excludeFromAccountantsExport:!1,id:"",altName:t.altName,phoneNumbers:e.number?[{extension:e.extension,number:e.number,type:e.type}]:[],emailAddresses:o.emailAddress?[{emailAddress:o.emailAddress,main:!0,type:o.type}]:[],title:t.title,createdOn:"",updatedOn:"",createdById:"",createdByName:""};return await this.createCompanyContact(r)}async createCompanyContact(t){this.isSavingContact=!0;try{const e=await yt.C.shared.company.createCompanyContact(t);return await this.loadContacts(!0),e.data.companyContact}finally{(0,ct.z)(()=>{this.isSavingContact=!1})}}async deleteTransaction(t){if(await yt.C.admin.transactions.deleteTrans(t),this.details){const t=await yt.C.admin.company.getInfo(this.details.id);(0,ct.z)(()=>{this.details.clubPoints=t.computedBalance})}}async createTransaction(t){const e=(await yt.C.admin.transactions.create(t)).data;(0,ct.z)(()=>{e.fromCompanyId&&this.companies[e.fromCompanyId]&&void 0!==e.fromCurrentBalance&&void 0!==e.fromAccountId&&this.updateCompanyPointBalance(this.companies[e.fromCompanyId],e.fromAccountId,e.fromCurrentBalance),e.toCompanyId&&this.companies[e.toCompanyId]&&void 0!==e.toCurrentBalance&&void 0!==e.toAccountId&&this.updateCompanyPointBalance(this.companies[e.toCompanyId],e.toAccountId,e.toCurrentBalance)})}async updateTransaction(t){await yt.C.admin.transactions.update(t)}async removeCompanyContact(t){this.isBusy=!0;try{await yt.C.shared.company.deleteCompanyContact(t),(0,ct.z)(()=>{this.isBusy=!1}),await this.loadContacts(!0)}catch(e){throw(0,ct.z)(()=>{this.isBusy=!1}),e}}async updateCompanyContact(t){this.isSavingContact=!0;try{return await yt.C.shared.company.updateCompanyContact(t),await this.loadContacts(!0),!0}catch(e){return console.error(e),!1}finally{(0,ct.z)(()=>{this.isSavingContact=!1})}}async createCategory(t){const e=(await yt.C.admin.company.companyCategoryCreate(t)).data,o=t.companyId;this.companies[o]&&(0,ct.z)(()=>{this.companies[o].categories=e})}async updateCategory(t){const e=t.companyId,o=this.companies[e].categories.find(e=>e.id===t.id);if(void 0===o)throw Error("Cannot find market category to update");const r=((t,e)=>{const o={id:t.id,categoryId:t.category.id,companyId:e.companyId,rate:t.rate,showOnInternet:t.showOnInternet,showOnReport:t.showOnReport};return(0,s.qu)(o,e)})((0,ct.ZN)(o),t),n=(await yt.C.admin.company.updateCompanyCategory(t.companyId,t.id,r)).data;this.companies[e]&&(0,ct.z)(()=>{this.companies[e].categories=n})}async removeCompanyCategory(t){await yt.C.admin.company.removeCompanyCategory(t);const e=t.companyId;if(this.companies[e]){const o=this.companies[e].categories;(0,ct.z)(()=>{this.companies[e].categories=o.filter(e=>e.id!==t.id)})}}async createBrand(t){const e=(await yt.C.admin.company.brandCreate(t)).data.companyBrand,o=t.companyId;this.companies[o]&&(0,ct.z)(()=>{this.companies[o].brands.push(e)})}async removeBrand(t){await yt.C.admin.company.brandRemove(t);const e=t.companyId;if(this.companies[e]){const o=this.companies[e].brands,r=o.findIndex(e=>e.id===t.id);r>=0&&(0,ct.z)(()=>{o.splice(r,1)})}}async createProduct(t){this.isBusy=!0;try{const e=(await yt.C.admin.company.productCreate(t)).data.companyProduct,o=t.companyId;this.companies[o]&&(0,ct.z)(()=>{this.companies[o].products.push(e)})}finally{(0,ct.z)(()=>{this.isBusy=!1})}}async removeProduct(t){await yt.C.admin.company.productRemove(t);const e=t.companyId;if(this.companies[e]){const o=this.companies[e].products,r=o.findIndex(e=>e.id===t.id);r>=0&&(0,ct.z)(()=>{o.splice(r,1)})}}async createNote(t){this.isBusy=!0;const e=(await yt.C.admin.company.noteCreate(t)).data.companyNote,o=t.companyNote.companyId;this.companies[o]&&(0,ct.z)(()=>{this.companies[o].notes.unshift(e)}),(0,ct.z)(()=>{this.isBusy=!1})}async deletePurchaserSupplierCategory(t){await yt.C.shared.purchasers.deletePurchaserSupplierCategory(t.purchaserSupplierCategoryId),this.purchaserSuppliers&&this.loadPurchaserSuppliers(),this.supplierPurchasers&&this.loadSupplierPurchasers()}async deleteSupplierPurchaser(t){this.isBusy=!0;try{if(await yt.C.shared.purchasers.deletePurchaserSupplier(t),void 0===this.supplierPurchasers)return;if(this.supplierPurchasers.find(e=>e.id===t))(0,ct.z)(()=>{this.supplierPurchasers=this.supplierPurchasers.filter(e=>e.id!==t)});else{const e=this.supplierPurchasers.find(e=>e.additionalCategories.some(e=>e.purchaserSupplierId===t));e&&(0,ct.z)(()=>{e.additionalCategories=e.additionalCategories.filter(e=>e.purchaserSupplierId!==t),this.supplierPurchasers=this.supplierPurchasers.map(t=>
1t.id===e.id?e:t)})}}catch(e){console.error(e)}(0,ct.z)(()=>{this.isBusy=!1})}async deletePurchaserSupplier(t){this.isBusy=!0;try{if(await yt.C.shared.purchasers.deletePurchaserSupplier(t),this.purchaserSuppliers){const t=await yt.C.shared.purchasers.getSuppliers(this.details.id);(0,ct.z)(()=>{this.purchaserSuppliers=t.suppliers})}}catch(e){console.error(e)}(0,ct.z)(()=>{this.isBusy=!1})}async loadContacts(t){if(void 0===this.contacts||!1!==t){this.isBusy=!0;try{const t=await yt.C.shared.company.getAllCompanyContacts(this.details.id);(0,ct.z)(()=>{this.contacts=t.data})}catch(e){console.error(e)}(0,ct.z)(()=>{this.isBusy=!1})}}async loadPurchaserSuppliers(){this.isBusy=!0;try{const t=await yt.C.shared.purchasers.getSuppliers(this.details.id);(0,ct.z)(()=>{this.purchaserSuppliers=t.suppliers})}catch(t){console.error(t)}(0,ct.z)(()=>{this.isBusy=!1})}async loadSupplierPurchasers(){this.isBusy=!0;try{const t=await yt.C.shared.suppliers.getPurchasers(this.details.id);(0,ct.z)(()=>{this.supplierPurchasers=t.members})}catch(t){console.error(t)}(0,ct.z)(()=>{this.isBusy=!1})}async addPurchaserSupplier(t,e,o,r){var n,a;if(await yt.C.shared.purchasers.addSupplier(t,e,o,r),this.purchaserSuppliers&&(null===(n=this.details)||void 0===n?void 0:n.id)===t){const e=await yt.C.shared.purchasers.getSuppliers(t);(0,ct.z)(()=>{this.purchaserSuppliers=e.suppliers})}else if(this.supplierPurchasers&&(null===(a=this.details)||void 0===a?void 0:a.id)===o){const t=await yt.C.shared.suppliers.getPurchasers(o);(0,ct.z)(()=>{this.supplierPurchasers=t.members})}}async updateNote(t,e){this.isBusy=!0;const o={content:e.content,isImportant:e.isImportant},r={content:t.companyNote.content,isImportant:t.companyNote.isImportant},n=(a=o,i=r,(0,s.qu)(a,i));var a,i;const p=(await yt.C.admin.company.noteUpdate(t.companyNote.companyId,t.companyNote.id,n)).data.companyNote,c=t.companyNote.companyId;if(this.companies[c]){const e=this.companies[c].notes,o=e.findIndex(e=>e.id===t.companyNote.id);o>=0&&(0,ct.z)(()=>{e.splice(o,1,p)})}(0,ct.z)(()=>{this.isBusy=!1})}async removeNote(t){this.isBusy=!0,await yt.C.admin.company.noteRemove(t);const e=t.companyId;if(this.companies[e]){const o=this.companies[e].notes,r=o.findIndex(e=>e.id===t.id);r>=0&&(0,ct.z)(()=>{o.splice(r,1)})}(0,ct.z)(()=>{this.isBusy=!1})}async getStatements(t){var e;let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];console.log("getStatements called");if(t===(null===(e=this.currentAccount)||void 0===e?void 0:e.id)&&void 0!==this.getStatementsResult&&!o)return;this.isLoadingStatements=!0;const r=await yt.C.shared.company.getStatementList(t);(0,ct.z)(()=>{this.getStatementsResult=r,this.isLoadingStatements=!1})}async setPrimaryCategory(t){if(!this.currentId)throw Error("No current company");try{await yt.C.admin.company.setPrimaryCategory(t);const e=this.companies[this.currentId].categories.map(e=>(e.isPrimary=e.id===t,e));(0,ct.z)(()=>{this.companies[this.currentId].categories=e})}catch(e){console.error(e)}}async updateContactStatus(t,e){if(!this.currentId)throw Error("No current company");if(!this.contacts)throw Error("No contacts");const o=await yt.C.shared.company.updateContactStatus(this.currentId,t,e),r=this.contacts.map(t=>t.id===o.id?o:t);(0,ct.z)(()=>{this.contacts=r})}setLastAwarded(t,e){if(void 0===this.contacts)return;const o=this.contacts.find(e=>e.id===t),r=Object.assign({},o,{lastAwardedBirthdayPointsOn:e});this.contacts=this.contacts.map(e=>e.id===t?r:e)}updateCompanyPointBalance(t,e,o){var r;const n=t.accounts.find(t=>t.id===e),a=Object.assign({},n,{computedBalance:o}),i=t.accounts.map(t=>t.id===a.id?a:t);t.accounts=i;const s=i.reduce((t,e)=>t+e.computedBalance,0);t.clubPoints=s,(null===(r=this.currentAccount)||void 0===r?void 0:r.id)===a.id&&(this.currentAccount=a)}},W=(0,i.Z)(K.prototype,"loading",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),X=(0,i.Z)(K.prototype,"isBusy",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),$=(0,i.Z)(K.prototype,"currentAccount",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),tt=(0,i.Z)(K.prototype,"lastCompanyPage",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),et=(0,i.Z)(K.prototype,"contacts",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ot=(0,i.Z)(K.prototype,"purchaserSuppliers",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),rt=(0,i.Z)(K.prototype,"supplierPurchasers",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),nt=(0,i.Z)(K.prototype,"getStatementsResult",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),at=(0,i.Z)(K.prototype,"isLoadingStatements",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),it=(0,i.Z)(K.prototype,"isSavingContact",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),(0,i.Z)(K.prototype,"details",[ct.Fl],Object.getOwnPropertyDescriptor(K.prototype,"details"),K.prototype),(0,i.Z)(K.prototype,"unload",[p],Object.getOwnPropertyDescriptor(K.prototype,"unload"),K.prototype),st=(0,i.Z)(K.prototype,"currentId",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),pt=(0,i.Z)(K.prototype,"companies",[ct.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}
1),(0,i.Z)(K.prototype,"setLastCompanyPage",[c],Object.getOwnPropertyDescriptor(K.prototype,"setLastCompanyPage"),K.prototype),(0,i.Z)(K.prototype,"reload",[y],Object.getOwnPropertyDescriptor(K.prototype,"reload"),K.prototype),(0,i.Z)(K.prototype,"setCompanyId",[d],Object.getOwnPropertyDescriptor(K.prototype,"setCompanyId"),K.prototype),(0,i.Z)(K.prototype,"createCompany",[u],Object.getOwnPropertyDescriptor(K.prototype,"createCompany"),K.prototype),(0,i.Z)(K.prototype,"updateCompany",[m],Object.getOwnPropertyDescriptor(K.prototype,"updateCompany"),K.prototype),(0,i.Z)(K.prototype,"setCurrentAccount",[h],Object.getOwnPropertyDescriptor(K.prototype,"setCurrentAccount"),K.prototype),(0,i.Z)(K.prototype,"updateLogo",[l],Object.getOwnPropertyDescriptor(K.prototype,"updateLogo"),K.prototype),(0,i.Z)(K.prototype,"createCompanyLocation",[g],Object.getOwnPropertyDescriptor(K.prototype,"createCompanyLocation"),K.prototype),(0,i.Z)(K.prototype,"addContactUser",[C],Object.getOwnPropertyDescriptor(K.prototype,"addContactUser"),K.prototype),(0,i.Z)(K.prototype,"updateContactUser",[b],Object.getOwnPropertyDescriptor(K.prototype,"updateContactUser"),K.prototype),(0,i.Z)(K.prototype,"setLocationAsPrimary",[f],Object.getOwnPropertyDescriptor(K.prototype,"setLocationAsPrimary"),K.prototype),(0,i.Z)(K.prototype,"updateCompanyLocation",[w],Object.getOwnPropertyDescriptor(K.prototype,"updateCompanyLocation"),K.prototype),(0,i.Z)(K.prototype,"updateLocationActiveStatus",[O],Object.getOwnPropertyDescriptor(K.prototype,"updateLocationActiveStatus"),K.prototype),(0,i.Z)(K.prototype,"createContact",[I],Object.getOwnPropertyDescriptor(K.prototype,"createContact"),K.prototype),(0,i.Z)(K.prototype,"createCompanyContact",[D],Object.getOwnPropertyDescriptor(K.prototype,"createCompanyContact"),K.prototype),(0,i.Z)(K.prototype,"deleteTransaction",[P],Object.getOwnPropertyDescriptor(K.prototype,"deleteTransaction"),K.prototype),(0,i.Z)(K.prototype,"createTransaction",[v],Object.getOwnPropertyDescriptor(K.prototype,"createTransaction"),K.prototype),(0,i.Z)(K.prototype,"updateTransaction",[Z],Object.getOwnPropertyDescriptor(K.prototype,"updateTransaction"),K.prototype),(0,i.Z)(K.prototype,"removeCompanyContact",[S],Object.getOwnPropertyDescriptor(K.prototype,"removeCompanyContact"),K.prototype),(0,i.Z)(K.prototype,"updateCompanyContact",[A],Object.getOwnPropertyDescriptor(K.prototype,"updateCompanyContact"),K.prototype),(0,i.Z)(K.prototype,"createCategory",[L],Object.getOwnPropertyDescriptor(K.prototype,"createCategory"),K.prototype),(0,i.Z)(K.prototype,"updateCategory",[z],Object.getOwnPropertyDescriptor(K.prototype,"updateCategory"),K.prototype),(0,i.Z)(K.prototype,"removeCompanyCategory",[j],Object.getOwnPropertyDescriptor(K.prototype,"removeCompanyCategory"),K.prototype),(0,i.Z)(K.prototype,"createBrand",[N],Object.getOwnPropertyDescriptor(K.prototype,"createBrand"),K.prototype),(0,i.Z)(K.prototype,"removeBrand",[B],Object.getOwnPropertyDescriptor(K.prototype,"removeBrand"),K.prototype),(0,i.Z)(K.prototype,"createProduct",[U],Object.getOwnPropertyDescriptor(K.prototype,"createProduct"),K.prototype),(0,i.Z)(K.prototype,"removeProduct",[M],Object.getOwnPropertyDescriptor(K.prototype,"removeProduct"),K.prototype),(0,i.Z)(K.prototype,"createNote",[T],Object.getOwnPropertyDescriptor(K.prototype,"createNote"),K.prototype),(0,i.Z)(K.prototype,"deletePurchaserSupplierCategory",[R],Object.getOwnPropertyDescriptor(K.prototype,"deletePurchaserSupplierCategory"),K.prototype),(0,i.Z)(K.prototype,"deleteSupplierPurchaser",[E],Object.getOwnPropertyDescriptor(K.prototype,"deleteSupplierPurchaser"),K.prototype),(0,i.Z)(K.prototype,"deletePurchaserSupplier",[H],Object.getOwnPropertyDescriptor(K.prototype,"deletePurchaserSupplier"),K.prototype),(0,i.Z)(K.prototype,"loadContacts",[F],Object.getOwnPropertyDescriptor(K.prototype,"loadContacts"),K.prototype),(0,i.Z)(K.prototype,"loadPurchaserSuppliers",[V],Object.getOwnPropertyDescriptor(K.prototype,"loadPurchaserSuppliers"),K.prototype),(0,i.Z)(K.prototype,"loadSupplierPurchasers",[x],Object.getOwnPropertyDescriptor(K.prototype,"loadSupplierPurchasers"),K.prototype),(0,i.Z)(K.prototype,"addPurchaserSupplier",[k],Object.getOwnPropertyDescriptor(K.prototype,"addPurchaserSupplier"),K.prototype),(0,i.Z)(K.prototype,"updateNote",[G],Object.getOwnPropertyDescriptor(K.prototype,"updateNote"),K.prototype),(0,i.Z)(K.prototype,"removeNote",[Y],Object.getOwnPropertyDescriptor(K.prototype,"removeNote"),K.prototype),(0,i.Z)(K.prototype,"getStatements",[q],Object.getOwnPropertyDescriptor(K.prototype,"getStatements"),K.prototype),(0,i.Z)(K.prototype,"setPrimaryCategory",[Q],Object.getOwnPropertyDescriptor(K.prototype,"setPrimaryCategory"),K.prototype),(0,i.Z)(K.prototype,"updateContactStatus",[_],Object.getOwnPropertyDescriptor(K.prototype,"updateContactStatus"),K.prototype),(0,i.Z)(K.prototype,"setLastAwarded",[J],Object.getOwnPropertyDescriptor(K.prototype,"setLastAwarded"),K.prototype),K)},79159:(t,e,o)=>{o.d(e,{Ch:()=>u,E6:()=>h,EV:()=>a,F1:()=>n,MI:()=>y,Q_:()=>s,YY:()=>d,Ye:()=>p,aQ:()=>i,eG:()=>g,jM:()=>r,vL:()=>m,xc:()=>l,z4:()=>c});const r="bcn:admin",n="bcn:monthly-report-editor",a="bcn:user-account-manager",i="bcn:catalog-order-manager",s="bcn:settings-manager",p="bcn:home-page-manager",c=201,y=202,d=203,u=101,m=102;let h=function(t){return t[t.MemberAdmin=101]="MemberAdmin",t[t.MemberUser=102]="MemberUser",t[t.SponsorAdmin=201]="SponsorAdmin",t[t.SponsorAccounting=202]="SponsorAccounting",t[t.SponsorSales=203]="SponsorSales",t}({});const l=[{label:"Member Admin",value:101}
1,{label:"Member User",value:102},{label:"Sponsor Admin",value:201},{label:"Sponsor Accounting",value:202},{label:"Sponsor Sales",value:203}],g={101:"Member Admin",102:"Member User",201:"Sponsor Admin",202:"Sponsor Accounting",203:"Sponsor Sales"}},36721:(t,e,o)=>{o.d(e,{eM:()=>a,fz:()=>n,sV:()=>i});var r=o(14659);const n=()=>"BCN"===r.an?"BuildPerks":"Builders Club",a=()=>"BCN"===r.an?"Perk Points":"Club Points",i=()=>"BCN"===r.an?"Perk Id":"Club Id"}}]);
2//# sourceMappingURL=9917.0370c8c2.chunk.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.