\r\n\t\r\n\t\t\r\n\t\t\tImpersonating {{ $store.state.citizenMember.user.email }}\r\n\t\t\t\r\n\t\t\tExit & Return to Self\r\n\t\t\r\n\t\t\r\n\t
\r\n\r\n\r\n\r\n","import mod from \"-!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./citizenRouterViewWrapper.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./citizenRouterViewWrapper.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./citizenRouterViewWrapper.vue?vue&type=template&id=078003c8\"\nimport script from \"./citizenRouterViewWrapper.vue?vue&type=script&lang=js\"\nexport * from \"./citizenRouterViewWrapper.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import { standardizeParcelId } from '@/services/citizen/citizenHelper';\r\nimport citizenRouterViewWrapper from '@/views/citizen/_shared/citizenRouterViewWrapper';\r\n\r\nconst routes = [\r\n\t{\r\n\t\tpath: '/citizen',\r\n\t\tcomponent: citizenRouterViewWrapper,\r\n\t\tprops: true,\r\n\t\tmeta: {\r\n\t\t\tcitizenAuth: {\r\n\t\t\t\trequired: false,\r\n\t\t\t\troles: []\r\n\t\t\t}\r\n\t\t},\r\n\t\tchildren: [\r\n\t\t\t{\r\n\t\t\t\tpath: '',\r\n\t\t\t\tname: 'citizen.dashboard',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.dashboard\" */ '@/views/citizen/dashboard'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//AUTH\r\n\t\t\t{\r\n\t\t\t\tpath: 'auth/sign-in',\r\n\t\t\t\tname: 'citizen.auth.signIn',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.auth.signIn\" */ '@/views/citizen/auth/signIn'),\r\n\t\t\t\tprops: ( route ) => ( {\r\n\t\t\t\t\tcode: route.query.code,\r\n\t\t\t\t\tstate: route.query.state,\r\n\t\t\t\t\tshowAccountCreated: route.params.showAccountCreated,\r\n\t\t\t\t\tverifyEmailAddress: route.params.verifyEmailAddress\r\n\t\t\t\t} ),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'auth/sign-out',\r\n\t\t\t\tname: 'citizen.auth.signOut',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.auth.signOut\" */ '@/views/citizen/auth/signOut.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'auth/forgot-password',\r\n\t\t\t\tname: 'citizen.auth.forgotPassword',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.auth.forgotPassword\" */ '@/views/citizen/auth/forgotPassword.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'auth/create-account',\r\n\t\t\t\tname: 'citizen.auth.createAccount',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.auth.createAccount\" */ '@/views/citizen/auth/createAccount.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'auth/error',\r\n\t\t\t\tname: 'citizen.auth.error',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.auth.error\" */ '@/views/citizen/auth/error.vue'),\r\n\t\t\t\tprops: ( route ) => ( { code: route.query.code, message: route.query.message } ),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//VERIFICATION URLs\r\n\t\t\t{\r\n\t\t\t\tpath: 'verify/changeEmail/:memberId/:changeRequestId/:requestVerificationCode',\r\n\t\t\t\tname: 'citizen.verify.changeEmail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.verify.changeEmail\" */ '@/views/citizen/verify/page.changeEmail.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'verify/account/:memberId/:verificationCode',\r\n\t\t\t\tname: 'citizen.verify.account',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.verify.account\" */ '@/views/citizen/verify/page.verifyAccount.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//ADMIN\r\n\t\t\t{\r\n\t\t\t\tpath: 'admin/status',\r\n\t\t\t\tname: 'citizen.admin.status',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.admin\" */ '@/views/citizen/admin/page.adminStatus.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: [ 'permission_manage_status' ]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'admin/member',\r\n\t\t\t\tname: 'citizen.admin.member',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.admin\" */ '@/views/citizen/admin/page.adminMember.vue'),\r\n\t\t\t\tprops: route => ({account: route.query.account ?? '', email:route.query.email ?? '', id:route.query.id ?? null }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: [ 'permission_impersonate' ]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//ACCOUNT SEARCH\r\n\t\t\t{\r\n\t\t\t\tpath: 'search',\r\n\t\t\t\tcomponent: citizenRouterViewWrapper,\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tchildren: [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: '',\r\n\t\t\t\t\t\tname: 'citizen.search',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.search\" */ '@/views/citizen/search/page.taxsearch.vue'),\r\n\t\t\t\t\t\tprops: false,\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: 'tax',\r\n\t\t\t\t\t\tname: 'citizen.search.tax',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.search\" */ '@/views/citizen/search/page.taxsearch.vue'),\r\n\t\t\t\t\t\tprops: false,\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: 'utilities',\r\n\t\t\t\t\t\tname: 'citizen.search.utility',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.search\" */ '@/views/citizen/search/page.utilitiessearch.vue'),\r\n\t\t\t\t\t\tprops: false,\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t},\r\n\r\n\t\t\t//TAX\r\n\t\t\t{\r\n\t\t\t\tpath: 'tax',\r\n\t\t\t\tname: 'citizen.tax.overview',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.tax\" */ '@/views/citizen/tax/page.taxOverview.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t//Tax Open Accounts\r\n\t\t\t{\r\n\t\t\t\tpath: 'tax/open-accounts',\r\n\t\t\t\tname: 'citizen.tax.openAccounts',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.taxOpenAccounts\" */ '@/views/citizen/tax/page.taxOpenAccounts.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: [ 'taxingservice' ]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'tax/:accountNumber',\r\n\t\t\t\tname: 'citizen.tax.detail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.tax\" */ '@/views/citizen/tax/page.taxDetail.vue'),\r\n\t\t\t\tprops: route => ({accountNumber:standardizeParcelId( route.params.accountNumber ), search:route.query.search==='true' || route.query.search==1 }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//UTILITY\r\n\t\t\t{\r\n\t\t\t\tpath: 'utility',\r\n\t\t\t\tname: 'citizen.utility.overview',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.utility\" */ '@/views/citizen/utility/page.utilityOverview.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'utility/:accountNumber',\r\n\t\t\t\tname: 'citizen.utility.detail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.utility\" */ '@/views/citizen/utility/page.utilityDetail.vue'),\r\n\t\t\t\tprops: route => ({ accountNumber:route.params.accountNumber }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//Landfill RESIDENTIAL\r\n\t\t\t{\r\n\t\t\t\tpath: 'trash',\r\n\t\t\t\tname: 'citizen.landfillResidential.overview',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.landfillResidential\" */ '@/views/citizen/landfillResidential/page.landfillResidentialOverview.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'trash/:customerId',\r\n\t\t\t\tname: 'citizen.landfillResidential.detail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.landfillResidential\" */ '@/views/citizen/landfillResidential/page.landfillResidentialDetail.vue'),\r\n\t\t\t\tprops: route => ({ customerId:route.params.customerId+'' }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//Landfill COMMERCIAL\r\n\t\t\t{\r\n\t\t\t\tpath: 'landfill-commercial/request-access/:type',\r\n\t\t\t\tname: 'citizen.landfillCommercial.requestAccess',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.landfillCommercial\" */ '@/views/citizen/landfillCommercial/page.landfillCommercialRequestAccess.vue'),\r\n\t\t\t\tprops: route => ({ type:route.params.type }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: [ ]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'landfill-commercial/:type',\r\n\t\t\t\tname: 'citizen.landfillCommercial.overview',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.landfillCommercial\" */ '@/views/citizen/landfillCommercial/page.landfillCommercialOverview.vue'),\r\n\t\t\t\tprops: route => ({ type:route.params.type }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: [ 'wasteworks' ]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'landfill-commercial/:type/:customerId',\r\n\t\t\t\tname: 'citizen.landfillCommercial.detail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.landfillCommercial\" */ '@/views/citizen/landfillCommercial/page.landfillCommercialDetail.vue'),\r\n\t\t\t\tprops: route => ({ customerId:route.params.customerId+'', type:route.params.type }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: [ 'wasteworks' ]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\r\n\t\t\t//ATV\r\n\t\t\t{\r\n\t\t\t\tpath: 'atv',\r\n\t\t\t\tname: 'citizen.atv.overview',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.atv\" */ '@/views/citizen/atv/page.atvOverview.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'atv/:customerId/:editType?/:vehicleId?',\r\n\t\t\t\tname: 'citizen.atv.detail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.atv\" */ '@/views/citizen/atv/page.atvDetail.vue'),\r\n\t\t\t\tprops: route => ({ customerId:route.params.customerId+'', editType:route.params.editType, vehicleId:route.params.vehicleId!==null ? route.params.vehicleId+'' : null }),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\r\n\t\t\t//PERMIT\r\n\t\t\t{\r\n\t\t\t\tpath: 'permit',\r\n\t\t\t\tname: 'citizen.permit.overview',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit\" */ '@/views/citizen/permit/page.permitOverview.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'permit/apply/:projectRequestId?',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit.new\" */ '@/views/citizen/permit/page.permitApply.vue'),\r\n\t\t\t\tprops: route => ( { projectRequestId: route.params.projectRequestId ? route.params.projectRequestId : 'new' } ),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tchildren: [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: '',\r\n\t\t\t\t\t\tname: 'citizen.permit.apply',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit.new\" */ '@/views/citizen/permit/requestDetailViews/requestDetail.dashboard.vue'),\r\n\t\t\t\t\t\tprops: route => ( { projectRequestId: route.params.projectRequestId ? route.params.projectRequestId : 'new' } ),\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'permit/:projectId',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit\" */ '@/views/citizen/permit/page.permitDetail.vue'),\r\n\t\t\t\tprops: route => ( { projectId: route.params.projectId } ),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tchildren: [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: '',\r\n\t\t\t\t\t\tname: 'citizen.permit.detail',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit\" */ '@/views/citizen/permit/detailViews/permitDetail.dashboard.vue'),\r\n\t\t\t\t\t\tprops: (route)=>({ projectId:route.params.projectId }),\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: ':permitType/:permitId',\r\n\t\t\t\t\t\tname: 'citizen.permit.detail.permit',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit\" */ '@/views/citizen/permit/detailViews/permitDetail.permit.vue'),\r\n\t\t\t\t\t\tprops: (route)=>({ projectId:route.params.projectId, permitType:route.params.permitType, permitId:route.params.permitId }),\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpath: ':permitType/:permitId/inspections/:inspectionGroupId/:inspectionId',\r\n\t\t\t\t\t\tname: 'citizen.permit.detail.inspection',\r\n\t\t\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.permit\" */ '@/views/citizen/permit/detailViews/permitDetail.inspection.vue'),\r\n\t\t\t\t\t\tprops: (route)=>({ projectId:route.params.projectId, permitType:route.params.permitType, permitId:route.params.permitId, inspectionGroupId:route.params.inspectionGroupId, inspectionId:route.params.inspectionId }),\r\n\t\t\t\t\t\tmeta: {\r\n\t\t\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\t\t\troles: []\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\r\n\t\t\t\t]\r\n\t\t\t},\r\n\r\n\t\t\t//ACCOUNT\r\n\t\t\t{\r\n\t\t\t\tpath: 'account',\r\n\t\t\t\tname: 'citizen.account',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'account/historical-transactions',\r\n\t\t\t\tname: 'citizen.account.historicalTransactions',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.historicalTransactions.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'account/scheduled-transactions',\r\n\t\t\t\tname: 'citizen.account.scheduledTransactions',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.scheduledTransactions.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'account/autopay',\r\n\t\t\t\tname: 'citizen.account.autopay',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.autopay.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'account/saved-payment-methods',\r\n\t\t\t\tname: 'citizen.account.paymentMethods',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.paymentMethods.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'account/change-password',\r\n\t\t\t\tname: 'citizen.account.changePassword',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.password.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'account/change-email',\r\n\t\t\t\tname: 'citizen.account.changeEmail',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.account\" */ '@/views/citizen/account/page.account.email.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//REVERSE 911\r\n\t\t\t{\r\n\t\t\t\tpath: 'notifications-emergency-alerts',\r\n\t\t\t\tname: 'citizen.reverse911',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.reverse911\" */ '@/views/citizen/reverse911/page.reverse911.vue'),\r\n\t\t\t\tprops: false,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t//PAYMENT\r\n\t\t\t{\r\n\t\t\t\tpath: 'payment',\r\n\t\t\t\tname: 'citizen.payment',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.payment\" */ '@/views/citizen/payment.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'transaction/:transactionUiId',\r\n\t\t\t\tname: 'citizen.transaction',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.payment\" */ '@/views/citizen/transaction.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tpath: 'feedback',\r\n\t\t\t\tname: 'citizen.feedback',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.feedback\" */ '@/views/citizen/feedback.vue'),\r\n\t\t\t\tprops: true,\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: true,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\r\n\t\t\t{\r\n\t\t\t\tpath: '*',\r\n\t\t\t\tname: 'citizen.generic.error',\r\n\t\t\t\tcomponent: () => import(/* webpackChunkName: \"citizen.error\" */ '@/views/errorPage.vue'),\r\n\t\t\t\tmeta: {\r\n\t\t\t\t\tcitizenAuth: {\r\n\t\t\t\t\t\trequired: false,\r\n\t\t\t\t\t\troles: []\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t]\r\n\t},\r\n\r\n\t{\r\n\t\tpath: '*',\r\n\t\tname: 'generic.error',\r\n\t\tcomponent: () => import(/* webpackChunkName: \"error\" */ '@/views/errorPage.vue'),\r\n\t\tmeta: {\r\n\t\t\tcitizenAuth: {\r\n\t\t\t\trequired: false,\r\n\t\t\t\troles: []\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n]\r\n\r\nexport default routes;\r\n","import Vue from 'vue';\r\nimport VueRouter from 'vue-router';\r\n\r\nimport routes from '@/router/routes';\r\nimport store from '@/store/index.js';\r\n\r\nVue.use( VueRouter )\r\n\r\n\r\nconst router = new VueRouter( {\r\n\tmode: 'history',\r\n\tbase: '/',\r\n\troutes,\r\n\tscrollBehavior (to, from, savedPosition) {\r\n\t\tif (savedPosition) {\r\n\t\t\treturn { x:savedPosition.x, y:savedPosition.y, behavior: 'smooth' }\r\n\t\t} else {\r\n\t\t\tlet y = ((document.getElementById('vue-app')?.getBoundingClientRect()?.top ?? 0) + window.scrollY )-160\r\n\t\t\treturn { x: 0, y: y, behavior: 'smooth' }\r\n\t\t}\r\n\t}\r\n} )\r\n\r\n\r\nrouter.beforeEach( async ( to, from, next ) => {\r\n\r\n\t//warn and bail if needed\r\n\tif(store.getters['route/warnOnRouteChange']) {\r\n\t\tif(!confirm('Are you sure you want to navigate away? You will lose any unsaved changes.')) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\t//VISUAL: START ROUTING LOADING\r\n\tstore.commit('route/routing', true);\r\n\tstore.commit('route/to', to);\r\n\r\n\t//AUTHENTICATION GUARD\r\n\tif( to.meta.citizenAuth.required && !store.getters[ 'citizenMember/isSignedIn' ] && store.getters[ 'citizenMember/tryRefreshToken' ] ) {\r\n\t\tawait store.dispatch( 'citizenMember/getAccessToken' );\r\n\t}\r\n\telse if( to.meta.citizenAuth.required && !store.getters[ 'citizenMember/isSignedIn' ] ) {\r\n\t\tawait store.dispatch( 'citizenMember/reset' )\r\n\t\tawait router.push( { name: 'citizen.auth.signIn' } )\r\n\t\treturn\r\n\t}\r\n\r\n\t//verify roles allow access\r\n\tif( to.meta.citizenAuth.required && to.meta.citizenAuth.roles.length>0 ) {\r\n\t\tfor( let i in to.meta.citizenAuth.roles ) {\r\n\t\t\tif( !store.state.citizenMember.roles.includes( to.meta.citizenAuth.roles[ i ] ) ) {\r\n\t\t\t\tstore.dispatch( 'sendSnackbar', { color: 'error', message: 'Access denied' } )\r\n\t\t\t\tawait router.push( { name: 'citizen.dashboard' } )\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tnext()\r\n} );\r\n\r\nrouter.onError( () => {\r\n\t//VISUAL: END ROUTING LOADING\r\n\tstore.commit( 'route/routing', false );\r\n} )\r\n\r\nrouter.afterEach( ( to, from, failure ) => {\r\n\r\n\tif( failure ) {\r\n\t\t//console.log( 'fail' )\r\n\t}\r\n\r\n\t//VISUAL: END ROUTING LOADING\r\n\tstore.commit( 'route/routing', false );\r\n\r\n} )\r\n\r\nexport default router\r\n","import { padStart } from \"lodash\"\r\n\r\nexport function standardizeParcelId( parcelId ) {\r\n\treturn padStart( parcelId, 8, '0' );\r\n}\r\n\r\nexport function sdatLink( parcelId ) {\r\n\tparcelId = standardizeParcelId( parcelId );\r\n\t//https://sdat.dat.maryland.gov/RealProperty/Pages/viewdetails.aspx?County=12&SearchType=ACCT&District=01&AccountNumber=001612\r\n\tlet link = 'https://sdat.dat.maryland.gov/RealProperty/Pages/viewdetails.aspx?County=12&SearchType=ACCT&District=';\r\n\tlink += parcelId.substring( 0, 2 );\r\n\tlink += '&AccountNumber=' + parcelId.substring( 2 );\r\n\treturn link;\r\n}","export const PAYMENT_TYPE_TAX_CODE = 'tax';\r\nexport const PAYMENT_TYPE_TAX_LABEL = 'Taxes';\r\n\r\nexport const PAYMENT_TYPE_UTILITY_CODE = 'utility';\r\nexport const PAYMENT_TYPE_UTILITY_LABEL = 'Water and Sewer';\r\n\r\nexport const PAYMENT_TYPE_LANDFILL_CODE = 'landfill';\r\nexport const PAYMENT_TYPE_LANDFILL_LABEL = 'Trash Permits';\r\n\r\nexport const PAYMENT_TYPE_ATV_CODE = 'atv';\r\nexport const PAYMENT_TYPE_ATV_LABEL = 'ATV/Snowmobile Permits';\r\n\r\nexport const PAYMENT_TYPE_PERMIT_CODE = 'permit';\r\nexport const PAYMENT_TYPE_PERMIT_LABEL = 'Permits and Inspections';\r\n\r\nexport const PAYMENT_TYPE_PERMIT_REQUEST_CODE = 'permitRequest';\r\nexport const PAYMENT_TYPE_PERMIT_REQUEST_LABEL = 'Permits and Inspections';\r\n\r\nexport const PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE = 'commercialLandfillWaste';\r\nexport const PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_API_CODE = 'scales';\r\nexport const PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_LABEL = 'Commercial Solid Waste';\r\n\r\nexport const PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE = 'commercialLandfillRecycling';\r\nexport const PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_API_CODE = 'misc';\r\nexport const PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_LABEL = 'Commercial Recycling';\r\n\r\nexport const CITIZEN_PAGE_ACCOUNT_SETTINGS = 'Account & Payment Settings'\r\nexport const CITIZEN_PAGE_ACCOUNT_HISTORICAL_TRANSACTIONS = 'Online Payment History'\r\nexport const CITIZEN_PAGE_ACCOUNT_AUTOPAY = 'Autopay Manager'\r\nexport const CITIZEN_PAGE_ACCOUNT_SAVED_PAYMENTS = 'Saved Payment Methods'\r\nexport const CITIZEN_PAGE_ACCOUNT_SCHEDULED_PAYMENTS = 'Scheduled Payments'\r\nexport const CITIZEN_PAGE_ACCOUNT_CHANGE_PASSWORD = 'Change Password'\r\nexport const CITIZEN_PAGE_ACCOUNT_CHANGE_EMAIL = 'Change Email Address'\r\n\r\n\r\nexport const PERMIT_STATUS_TEXT_APPLICATION = 'Application';\r\nexport const PERMIT_STATUS_ID_APPLICATION = '602584c7f4150000ce006b61';\r\nexport const PERMIT_STATUS_ICON_APPLICATION = 'mdi-pencil';\r\nexport const PERMIT_STATUS_COLOR_APPLICATION = 'grey';\r\n\r\nexport const PERMIT_STATUS_TEXT_SIGNATURES_AND_PAYMENT = 'Signatures and Payment';\r\nexport const PERMIT_STATUS_ID_SIGNATURES_AND_PAYMENT = '602584c7f4150000ce006b62';\r\nexport const PERMIT_STATUS_ICON_SIGNATURES_AND_PAYMENT = 'mdi-signature-freehand';\r\nexport const PERMIT_STATUS_COLOR_SIGNATURES_AND_PAYMENT = 'light-blue';\r\n\r\nexport const PERMIT_STATUS_TEXT_APPROVED = 'Approved';\r\nexport const PERMIT_STATUS_ID_APPROVED = '60dcdce9547700001e004457';\r\nexport const PERMIT_STATUS_ICON_APPROVED = 'mdi-check';\r\nexport const PERMIT_STATUS_COLOR_APPROVED = 'success';\r\n\r\nexport const PERMIT_STATUS_TEXT_COMPLETE = 'Complete';\r\nexport const PERMIT_STATUS_ID_COMPLETE = '602584c7f4150000ce006b64';\r\nexport const PERMIT_STATUS_ICON_COMPLETE = 'mdi-archive-arrow-down';\r\nexport const PERMIT_STATUS_COLOR_COMPLETE = 'blue-grey';\r\n\r\nexport const PERMIT_STATUS_TEXT_INACTIVE = 'Inactive';\r\nexport const PERMIT_STATUS_ID_INACTIVE = '602584c7f4150000ce006b63';\r\nexport const PERMIT_STATUS_ICON_INACTIVE = 'mdi-minus-circle';\r\nexport const PERMIT_STATUS_COLOR_INACTIVE = 'warning';\r\n\r\nexport const PERMITTYPE_LABEL = {\r\n\t'assessment': 'Assessment Data',\r\n\t'construction': 'Construction Release',\r\n\t'building': 'Building Permit',\r\n\t'electrical': 'Electrical Permit',\r\n\t'entrance': 'Entrance Permit',\r\n\t'fire': 'Fire Protection',\r\n\t'floodplain': 'Floodplain Permit',\r\n\t'grading': 'Grading Permit',\r\n\t'mechanical': 'Mechanical Permit',\r\n\t'occupancy': 'Use/Occupancy Release',\r\n\t'plumbing': 'Plumbing Permit',\r\n\t'utility': 'Utility Data',\r\n\t'zoning': 'Zoning Permit',\r\n\t'timberHarvest': 'Timber Harvest Permit',\r\n\t'subdivision': 'Subdivision',\r\n}\r\n\r\nexport const PERMIT_EXTERNAL_STATUS_TEXT_NOT_SUBMITTED = 'Not Submitted';\r\nexport const PERMIT_EXTERNAL_STATUS_ID_NOT_SUBMITTED = '641b5a64995883c43f0ebd7c';\r\nexport const PERMIT_EXTERNAL_STATUS_ICON_NOT_SUBMITTED = 'mdi-pencil';\r\nexport const PERMIT_EXTERNAL_STATUS_COLOR_NOT_SUBMITTED = 'grey';\r\n\r\nexport const PERMIT_EXTERNAL_STATUS_TEXT_SUBMITTED = 'Pending Review';\r\nexport const PERMIT_EXTERNAL_STATUS_ID_SUBMITTED = '641b5a87995883c43f0ebd7e';\r\nexport const PERMIT_EXTERNAL_STATUS_ICON_SUBMITTED = 'mdi-human-greeting-proximity';\r\nexport const PERMIT_EXTERNAL_STATUS_COLOR_SUBMITTED = 'success';\r\n\r\nexport const PERMIT_EXTERNAL_STATUS_TEXT_CONVERTED = 'Converted';\r\nexport const PERMIT_EXTERNAL_STATUS_ID_CONVERTED = '641b5aa5995883c43f0ebd80';\r\nexport const PERMIT_EXTERNAL_STATUS_ICON_CONVERTED = 'mdi-archive-arrow-down';\r\nexport const PERMIT_EXTERNAL_STATUS_COLOR_CONVERTED = 'blue-grey';\r\n\r\nexport const PERMIT_EXTERNAL_STATUS_TEXT_REJECTED = 'Rejected';\r\nexport const PERMIT_EXTERNAL_STATUS_ID_REJECTED = '641b5abb995883c43f0ebd82';\r\nexport const PERMIT_EXTERNAL_STATUS_ICON_REJECTED = 'mdi-minus-circle';\r\nexport const PERMIT_EXTERNAL_STATUS_COLOR_REJECTED = 'error';\r\n\r\n\r\nexport const waitUntil = ( condition ) => {\r\n\treturn new Promise( ( resolve ) => {\r\n\t\tlet interval = setInterval( () => {\r\n\t\t\tif( !condition() ) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\tclearInterval( interval )\r\n\t\t\tresolve()\r\n\t\t}, 100 )\r\n\t} )\r\n}\r\n\r\nexport const delay = function( time ) {\r\n\treturn new Promise( resolve => setTimeout( resolve, time ) );\r\n}\r\n\r\nexport const paymentTypeToRoutePrepend = ( paymentType ) => {\r\n\tif(paymentType=='public_utilites') {\r\n\t\treturn 'citizen.utility.'\r\n\t}\r\n\telse if(paymentType=='taxes') {\r\n\t\treturn 'citizen.tax.'\r\n\t}\r\n\telse if(paymentType=='landfill') {\r\n\t\treturn 'citizen.landfillResidential.'\r\n\t}\r\n\telse if(paymentType=='wasteWorks') {\r\n\t\treturn 'citizen.landfillCommercial.'\r\n\t}\r\n\telse if(paymentType=='atv') {\r\n\t\treturn 'citizen.atv.'\r\n\t}\r\n\telse if(paymentType=='permits') {\r\n\t\treturn 'citizen.permits.'\r\n\t}\r\n\treturn 'citizen.dashboard';\r\n}\r\n\r\nexport const states = {\r\n\t'AL': 'ALABAMA',\r\n\t'AK': 'ALASKA',\r\n\t'AS': 'AMERICAN SAMOA',\r\n\t'AZ': 'ARIZONA',\r\n\t'AR': 'ARKANSAS',\r\n\t'CA': 'CALIFORNIA',\r\n\t'CO': 'COLORADO',\r\n\t'CT': 'CONNECTICUT',\r\n\t'DE': 'DELAWARE',\r\n\t'DC': 'DISTRICT OF COLUMBIA',\r\n\t'FL': 'FLORIDA',\r\n\t'GA': 'GEORGIA',\r\n\t'GU': 'GUAM',\r\n\t'HI': 'HAWAII',\r\n\t'ID': 'IDAHO',\r\n\t'IL': 'ILLINOIS',\r\n\t'IN': 'INDIANA',\r\n\t'IA': 'IOWA',\r\n\t'KS': 'KANSAS',\r\n\t'KY': 'KENTUCKY',\r\n\t'LA': 'LOUISIANA',\r\n\t'ME': 'MAINE',\r\n\t'MD': 'MARYLAND',\r\n\t'MA': 'MASSACHUSETTS',\r\n\t'MI': 'MICHIGAN',\r\n\t'MN': 'MINNESOTA',\r\n\t'MS': 'MISSISSIPPI',\r\n\t'MO': 'MISSOURI',\r\n\t'MT': 'MONTANA',\r\n\t'NE': 'NEBRASKA',\r\n\t'NV': 'NEVADA',\r\n\t'NH': 'NEW HAMPSHIRE',\r\n\t'NJ': 'NEW JERSEY',\r\n\t'NM': 'NEW MEXICO',\r\n\t'NY': 'NEW YORK',\r\n\t'NC': 'NORTH CAROLINA',\r\n\t'ND': 'NORTH DAKOTA',\r\n\t'MP': 'NORTHERN MARIANA IS',\r\n\t'OH': 'OHIO',\r\n\t'OK': 'OKLAHOMA',\r\n\t'OR': 'OREGON',\r\n\t'PA': 'PENNSYLVANIA',\r\n\t'PR': 'PUERTO RICO',\r\n\t'RI': 'RHODE ISLAND',\r\n\t'SC': 'SOUTH CAROLINA',\r\n\t'SD': 'SOUTH DAKOTA',\r\n\t'TN': 'TENNESSEE',\r\n\t'TX': 'TEXAS',\r\n\t'UT': 'UTAH',\r\n\t'VT': 'VERMONT',\r\n\t'VA': 'VIRGINIA',\r\n\t'VI': 'VIRGIN ISLANDS',\r\n\t'WA': 'WASHINGTON',\r\n\t'WV': 'WEST VIRGINIA',\r\n\t'WI': 'WISCONSIN',\r\n\t'WY': 'WYOMING',\r\n};\r\n","class CustomError\r\n\textends Error {\r\n\tconstructor(message, code=0, data={}, guid='') {\r\n\t\t// Pass remaining arguments (including vendor specific ones) to parent constructor\r\n\t\tsuper(message)\r\n\t\tthis.name = this.constructor.name;\r\n\r\n\t\t// Maintains proper stack trace for where our error was thrown (only available on V8)\r\n\t\tif (Error.captureStackTrace) {\r\n\t\t\tError.captureStackTrace(this, CustomError)\r\n\t\t}\r\n\r\n\t\t// Custom debugging information\r\n\t\tthis.message = message\r\n\t\tthis.code = code\r\n\t\tthis.data = data\r\n\t\tthis.guid = guid\r\n\t}\r\n}\r\nexport default CustomError;","import { DateTime } from 'luxon';\r\nimport Vue from 'vue';\r\n\r\nimport * as constants from '@/constants';\r\nimport CitizenApiError from '@/errors/citizen/CitizenApiError';\r\nimport CitizenMaintenanceError from '@/errors/citizen/CitizenMaintenanceError';\r\nimport CitizenConnectApiService from '@/services/citizen/CitizenConnectApiService';\r\n\r\nconst storeKey = 'citizen.store.atv';\r\n\r\nconst getDefaultState = () => {\r\n\tlet now = new Date();\r\n\treturn {\r\n\t\taccounts: {},\r\n\t\tpaymentClient: null,\r\n\t\tcurrentFiscalYear: now.getMonth()<=5 ? now.getFullYear() : now.getFullYear() + 1,\r\n\t\tcurrentPermitYear: now.getMonth()<9 ? now.getFullYear() : now.getFullYear() + 1,\r\n\t\trunningGetMemberAccounts: false,\r\n\t\tvehicleTypes: [],\r\n\t\tnewVehicle: {},\r\n\t\tengineSizeUnitOfMeasurement: [\r\n\t\t\t{\r\n\t\t\t\tvalue: 'CC',\r\n\t\t\t\ttext: 'CC (Cubic Centimetres)'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'KW',\r\n\t\t\t\ttext: 'KW (Kilowatts)'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'HP',\r\n\t\t\t\ttext: 'HP (Horse Power)'\r\n\t\t\t},\r\n\t\t],\r\n\t\tvehicleColors:[\r\n\t\t\t{\r\n\t\t\t\tvalue: 'camo',\r\n\t\t\t\ttext: 'Camo'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'white',\r\n\t\t\t\ttext: 'White'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'silver',\r\n\t\t\t\ttext: 'Silver'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'black',\r\n\t\t\t\ttext: 'Black'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'gray',\r\n\t\t\t\ttext: 'Gray'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'blue',\r\n\t\t\t\ttext: 'Blue'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'red',\r\n\t\t\t\ttext: 'Red'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'green',\r\n\t\t\t\ttext: 'Green'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'brown',\r\n\t\t\t\ttext: 'Brown'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'yellow',\r\n\t\t\t\ttext: 'Yellow'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'purple',\r\n\t\t\t\ttext: 'Purple'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'maroon',\r\n\t\t\t\ttext: 'Maroon'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'orange',\r\n\t\t\t\ttext: 'Orange'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tvalue: 'pink',\r\n\t\t\t\ttext: 'Pink'\r\n\t\t\t},\r\n\t\t]\r\n\t}\r\n}\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\r\n\tcurrentFiscalYear:function(state) {\r\n\t\treturn state.currentFiscalYear;\r\n\t},\r\n\r\n\tcurrentPermitYear:function(state) {\r\n\t\treturn state.currentPermitYear;\r\n\t},\r\n\r\n\taccounts:function(state){\r\n\t\treturn state.accounts;\r\n\t},\r\n\r\n\tvehicleTypes:function(state){\r\n\t\treturn state.vehicleTypes;\r\n\t},\r\n\r\n\tvehicleColors:function(state){\r\n\t\treturn state.vehicleColors;\r\n\t},\r\n\r\n\tnewVehicle:function(state){\r\n\t\treturn state.newVehicle;\r\n\t},\r\n\r\n\tengineSizeUnitOfMeasurement:function(state){\r\n\t\treturn state.engineSizeUnitOfMeasurement;\r\n\t},\r\n\r\n\tmemberAccounts: function ( state, getters, rootState, rootGetters ) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_ATV_CODE);\r\n\t\tlet memberAccounts = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) ) {\r\n\t\t\t\tmemberAccounts.push( state.accounts[ accountNumbers[ i ] ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberAccounts;\r\n\t},\r\n\r\n\tmemberNotices:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_ATV_CODE);\r\n\t\tlet memberNotices = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberNotices = memberNotices.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.notices );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberNotices;\r\n\t},\r\n\r\n\tmemberWarnings:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_ATV_CODE);\r\n\t\tlet memberWarnings = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberWarnings = memberWarnings.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.warnings );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberWarnings;\r\n\t},\r\n\r\n\r\n}\r\n\r\nconst actions = {\r\n\r\n\tinitialize: async function ( { dispatch, commit, rootGetters } ) {\r\n\t\t//console.log( 'citizen atv initialize' )\r\n\t\tawait commit( 'setModuleStateFromLocalStorage' );\r\n\t\tcommit( 'defineAccountShells', rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_ATV_CODE) );\r\n\r\n\t\tif( rootGetters[\"citizenMember/isSignedIn\"] ) {\r\n\t\t\tlet tasks = [\r\n\t\t\t\tdispatch( 'fetchVehicleTypes' ),\r\n\t\t\t\t\tdispatch( 'fetchNewVehicle', rootGetters[\"citizenMember/userId\"] )\r\n\t\t\t]\r\n\t\t\ttry {\r\n\t\t\t\tawait Promise.all( tasks )\r\n\t\t\t}\r\n\t\t\tcatch(e) {\r\n\t\t\t\tconsole.log(e)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\treset: async function ( {commit} ) {\r\n\t\t//console.log( 'citizen atv residential reset' )\r\n\t\tawait commit( 'reset' );\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlocalStorage.removeItem( storeKey );\r\n\t\t}\r\n\t},\r\n\r\n\tgetMemberAccounts: async function ( { state, commit, dispatch, rootState, rootGetters } ) {\r\n\t\tif(state.runningGetMemberAccounts) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//set the running state so that we don't double fetch on navigation\r\n\t\tcommit('setRunningGetMemberAccounts', true );\r\n\r\n\t\tlet startingMemberAccountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_ATV_CODE);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', startingMemberAccountNumbers );\r\n\t\tcommit('setAccountFetchingTrue', startingMemberAccountNumbers);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/atv/accounts/' + rootState.citizenMember.user.userId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setAccountFetchingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setRunningGetMemberAccounts', false );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, 'A7017003-C735-4678-9305-F97439B4072E' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '4456CF3D-78C2-416F-B4D9-F6667BB09E52' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\t\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the accounts or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, 'CA2D4F94-6796-4652-BFA0-6C59D08218BC' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tlet updatedMemberAccountNumbers = [];\r\n\t\tfor( let i in apiResponse.data.data.accounts ) {\r\n\t\t\tif(apiResponse.data.data.accounts[ i ].account) {\r\n\t\t\t\tupdatedMemberAccountNumbers.push( apiResponse.data.data.accounts[ i ].account.customerId );\r\n\t\t\t\tcommit( 'updateAppendAccount', apiResponse.data.data.accounts[ i ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\tdispatch('citizenMember/setAccounts', { accounts:updatedMemberAccountNumbers, type:constants.PAYMENT_TYPE_ATV_CODE }, { root:true } );\r\n\r\n\t\tcommit('setPaymentClient', apiResponse.data.data.payment );\r\n\r\n\t\t//set loading state of the accounts we touched\r\n\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\r\n\t\t//end the running state to allow fetching again\r\n\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t},\r\n\r\n\tgetAccount: async function ( {commit}, customerId ) {\r\n\t\t//shell the account in case it's not saved yet\r\n\t\tcommit('defineAccountShells', [ customerId ]);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', customerId);\r\n\t\tcommit('setAccountFetchingTrue', customerId);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/atv/detail/' + customerId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', customerId );\r\n\t\t\tcommit( 'setAccountFetchingFalse', customerId );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, '3F0BA787-7E56-46ED-967E-68DB8C096E2A' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '42F83DC9-A40C-4CFA-BD87-9F58DAA0476C' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the account or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, 'E19497B5-42DB-41C4-9F39-2326417B02E9' );\r\n\t\t}\r\n\r\n\t\t//standardize date fields\r\n\t\tif(apiResponse.data.data.customer.dob && apiResponse.data.data.customer.dob.includes('/')) {\r\n\t\t\tlet d = DateTime.fromFormat(apiResponse.data.data.customer.dob, \"MM/dd/yyyy\")\r\n\t\t\tif(d.isValid) {\r\n\t\t\t\tapiResponse.data.data.customer.dob = d.toISODate();\r\n\t\t\t}\r\n\t\t}\r\n\t\t//standardize date fields\r\n\t\tif(apiResponse.data.data.customer.co_dob && apiResponse.data.data.customer.co_dob.includes('/')) {\r\n\t\t\tlet d = DateTime.fromFormat(apiResponse.data.data.customer.co_dob, \"MM/dd/yyyy\")\r\n\t\t\tif(d.isValid) {\r\n\t\t\t\tapiResponse.data.data.customer.co_dob = d.toISODate();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tcommit( 'updateAppendAccount', apiResponse.data.data );\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t},\r\n\r\n\taddAccount: async function ( { commit, dispatch, rootState }, { account, year, customerId } ) {\r\n\t\t//account = permit number\r\n\t\tlet url = ''\r\n\t\tif(account) {\r\n\t\t\turl = 'v2/atv/add/'+rootState.citizenMember.user.userId+'/'+account+'/'+year\r\n\t\t}\r\n\t\telse if(customerId) {\r\n\t\t\turl = 'v2/atv/add_by_customer_id/'+rootState.citizenMember.user.userId+'/'+customerId\r\n\t\t}\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.post( url, {} );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'BE966746-B6FE-4A7C-AF61-DACC8BF280AB' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tthrow new CitizenApiError( 'Failed to add account. Try again.', 404, {}, '62788615-5D5C-4EA4-B7E1-5D8F6CBF0947' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error && apiResponse.data.status=== 503) {\r\n\t\t\tthrow new CitizenMaintenanceError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, 'CBF6E3B9-415F-42C6-9D7C-5596C1A5269F' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error ) {\r\n\t\t\tthrow new CitizenApiError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, 'FEB99622-CD25-4BE5-9D11-8C4FB31FEF11' );\r\n\t\t}\r\n\r\n\t\t//add the type to member\r\n\t\tawait dispatch( 'citizenMember/addAccount', { type:constants.PAYMENT_TYPE_ATV_CODE, account:apiResponse.data.data.account }, { root:true } );\r\n\r\n\t\tcommit('defineAccountShells', [ apiResponse.data.data.account ]);\r\n\r\n\t\t//get account data\r\n\t\tawait dispatch('getAccount', apiResponse.data.data.account);\r\n\r\n\t\t//return the new account\r\n\t\treturn apiResponse.data.data.account;\r\n\r\n\t},\r\n\r\n\tremoveAccount: async function ( { dispatch, commit, rootState }, customerId ) {\r\n\t\t//set removing state\r\n\t\tcommit('setAccountRemovingTrue', customerId);\r\n\r\n\t\t//tell api to remove account\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.delete( 'v2/atv/remove/'+rootState.citizenMember.user.userId+'/'+customerId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '5FA6AE43-E5AC-419E-889E-8B66CE26C828' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'Failed to remove account. Try again.', 404, {}, '65594236-B05C-410E-880A-09C584901485' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error && apiResponse.data.status=== 503) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenMaintenanceError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '3778B075-69E2-4574-87C3-1BF6392B865F' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error ) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '4AAFF4C0-4486-473F-B2DA-F5AD10F0B02E' );\r\n\t\t}\r\n\r\n\t\t//remove the type from member store\r\n\t\tawait dispatch( 'citizenMember/removeAccount', { type:constants.PAYMENT_TYPE_ATV_CODE, account:apiResponse.data.data.account }, { root:true } );\r\n\r\n\t\t//set removing state\r\n\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t},\r\n\r\n\tfetchVehicleTypes:async function( { commit } ) {\r\n\r\n\t\t//tell api to remove account\r\n\t\ttry {\r\n\t\t\tlet apiResponse = await CitizenConnectApiService.get( 'v2/atv/vehicle_types' );\r\n\t\t\tcommit('setVehicleTypes', apiResponse.data.data)\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '9A532380-9892-493A-9D98-A4E2804ECF1E' );\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tfetchNewVehicle:async function( { commit }, customerId) {\r\n\r\n\t\ttry {\r\n\t\t\tlet apiResponse = await CitizenConnectApiService.get( 'v2/atv/vehicle/' + customerId + '/0' );\r\n\t\t\tcommit('setNewVehicle', apiResponse.data.data)\r\n\t\t\treturn apiResponse.data.data;\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'B914CE03-AF4F-4D91-AABA-4446B90688EA' );\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n\r\n\r\nconst mutations = {\r\n\r\n\tsetModuleStateFromLocalStorage: function ( state ) {\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlet now = new Date();\r\n\t\t\t// Replace the state object with the stored item\r\n\t\t\tlet data = JSON.parse( localStorage.getItem( storeKey ) );\r\n\t\t\tif( data !== null ) {\r\n\t\t\t\tObject.assign( state, data )\r\n\r\n\t\t\t\tstate.currentFiscalYear = now.getMonth()<=5 ? now.getFullYear() : now.getFullYear() + 1\r\n\t\t\t\tstate.currentPermitYear = now.getMonth()<9 ? now.getFullYear() : now.getFullYear() + 1\r\n\r\n\t\t\t\t//this is a page refresh so force the accounts to not be loading (in case a refresh started when the account was loading)\r\n\t\t\t\tstate.runningGetMemberAccounts = false;\r\n\t\t\t\tfor( let i in state.accounts ) {\r\n\t\t\t\t\tstate.accounts[ i ]._meta.fetching = false;\r\n\t\t\t\t\tstate.accounts[ i ]._meta.loading = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\treset: function ( state ) {\r\n\t\tObject.assign(state, getDefaultState())\r\n\t},\r\n\r\n\tsetNewVehicle:function ( state, newVehicle ) {\r\n\t\tstate.newVehicle = newVehicle;\r\n\t},\r\n\r\n\tsetRunningGetMemberAccounts:function( state, running ) {\r\n\t\tstate.runningGetMemberAccounts = running;\r\n\t},\r\n\r\n\tsetAccountLoadingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountLoadingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountFetchingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountFetchingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountRemovingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountRemovingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetPaymentClient:function( state, paymentClient) {\r\n\t\tstate.paymentClient = paymentClient;\r\n\t},\r\n\r\n\tupdateAppendAccount: function ( state, newAccount ) {\r\n\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, newAccount.account.customerId)) {\r\n\t\t\tObject.assign(state.accounts[ newAccount.account.customerId ], newAccount)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tVue.set(state.accounts, newAccount.account.customerId, newAccount)\r\n\t\t}\r\n\t},\r\n\r\n\tupdateAppendVehicle: function ( state, { customerId, vehicle } ) {\r\n\r\n\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerId)) {\r\n\t\t\tlet updated = false;\r\n\t\t\tfor( let i in state.accounts[customerId].customer.vehicles ) {\r\n\t\t\t\tif(state.accounts[ customerId ].customer.vehicles[i].id==vehicle.id) {\r\n\t\t\t\t\tObject.assign(state.accounts[ customerId ].customer.vehicles[i], vehicle)\r\n\t\t\t\t\tupdated = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(!updated) {\r\n\t\t\t\tstate.accounts[ customerId ].customer.vehicles.push( vehicle );\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// Vue.set(state.accounts, customerId, newAccount)\r\n\t\t\t//console.warn('No customer with this id in state store')\r\n\t\t}\r\n\t},\r\n\r\n\tdefineAccountShells: function ( state, customerIds ) {\r\n\t\tlet now = new Date();\r\n\t\tfor( let i in customerIds) {\r\n\t\t\tlet customerId = customerIds[i];\r\n\t\t\tif( !Object.prototype.hasOwnProperty.call(state.accounts, customerId)) {\r\n\t\t\t\tlet accountShell = {\r\n\t\t\t\t\taccount:{\r\n\t\t\t\t\t\tcustomerId:customerId\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcustomer:{},\r\n\t\t\t\t\toverview:{\r\n\t\t\t\t\t\tstatus:-1\r\n\t\t\t\t\t},\r\n\t\t\t\t\t_meta:{\r\n\t\t\t\t\t\tloading:true,\r\n\t\t\t\t\t\tremoving:false,\r\n\t\t\t\t\t\tfetched:null,\r\n\t\t\t\t\t\tfetching:false,\r\n\t\t\t\t\t\tyear:{\r\n\t\t\t\t\t\t\tcurrent:now.getMonth()<10 ? now.getFullYear() : now.getFullYear()+1,\r\n\t\t\t\t\t\t\tnext:now.getMonth()<10 ? now.getFullYear()+1 : now.getFullYear()+2\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tVue.set(state.accounts, customerId, accountShell)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tsetVehicleTypes:function( state, vehicleTypes ) {\r\n\t\tstate.vehicleTypes = vehicleTypes\r\n\t}\r\n}\r\n\r\nexport default {\r\n\tnamespaced: true,\r\n\tstate,\r\n\tgetters,\r\n\tactions,\r\n\tmutations\r\n}\r\n","import { isEqual } from 'lodash';\r\n\r\nconst getDefaultState = () => {\r\n\treturn {\r\n\t\tbreadcrumbs:[\r\n\t\t\t{\r\n\t\t\t\ttext: 'Citizen Connect',\r\n\t\t\t\tdisabled: false,\r\n\t\t\t\texact: true,\r\n\t\t\t\tto: {\r\n\t\t\t\t\tname: 'citizen.dashboard'\r\n\t\t\t\t},\r\n\t\t\t}\r\n\t\t]\r\n\t}\r\n}\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\tbreadcrumbs:function ( state ) {\r\n\t\treturn state.breadcrumbs;\r\n\t}\r\n}\r\n\r\n\r\nconst actions = {\r\n\treset:function( { commit } ) {\r\n\t\tcommit( 'reset' )\r\n\t},\r\n\r\n\tnew:function( { commit }, breadcrumbs ) {\r\n\t\tcommit( 'new', breadcrumbs )\r\n\t},\r\n\r\n\tpush:function( { commit }, breadcrumbs ) {\r\n\t\tcommit( 'push', breadcrumbs )\r\n\t},\r\n\r\n\tpop:function( { commit }, breadcrumbs ) {\r\n\t\tcommit( 'pop', breadcrumbs )\r\n\t},\r\n}\r\n\r\nconst mutations = {\r\n\r\n\treset:function ( state ) {\r\n\t\tObject.assign( state, getDefaultState() )\r\n\t},\r\n\r\n\tnew: function ( state, breadcrumbs ) {\r\n\t\tif( !Array.isArray( breadcrumbs )) {\r\n\t\t\tbreadcrumbs = [ breadcrumbs ];\r\n\t\t}\r\n\t\tObject.assign( state, getDefaultState() );\r\n\t\tstate.breadcrumbs = state.breadcrumbs.concat( breadcrumbs );\r\n\t},\r\n\r\n\tpush: function ( state, breadcrumbs ) {\r\n\t\tif( !Array.isArray( breadcrumbs )) {\r\n\t\t\tbreadcrumbs = [ breadcrumbs ];\r\n\t\t}\r\n\r\n\t\tstateLoop:\r\n\t\tfor( let i in state.breadcrumbs ) {\r\n\t\t\tfor( let j in breadcrumbs ) {\r\n\t\t\t\tif( breadcrumbs[j].to.name===state.breadcrumbs[i].to.name && isEqual(breadcrumbs[j].to.params, state.breadcrumbs[i].to.params)) {\r\n\t\t\t\t\tstate.breadcrumbs.splice( i );\r\n\t\t\t\t\tbreak stateLoop;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tstate.breadcrumbs = state.breadcrumbs.concat( breadcrumbs );\r\n\t},\r\n\r\n\tpop: function ( state ) {\r\n\t\tstate.breadcrumbs.pop();\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default {\r\n\tnamespaced: true,\r\n\tstate,\r\n\tgetters,\r\n\tactions,\r\n\tmutations\r\n}\r\n","import Vue from 'vue';\r\n\r\nimport * as constants from '@/constants';\r\nimport CitizenApiError from '@/errors/citizen/CitizenApiError';\r\nimport CitizenMaintenanceError from '@/errors/citizen/CitizenMaintenanceError';\r\nimport CitizenConnectApiService from '@/services/citizen/CitizenConnectApiService';\r\n\r\nconst storeKey = 'citizen.store.landfillCommercialRecycling';\r\n\r\nconst getDefaultState = () => {\r\n\tlet now = new Date();\r\n\treturn {\r\n\t\taccounts: {},\r\n\t\tpaymentClient: null,\r\n\t\tcurrentFiscalYear: now.getMonth()<=5 ? now.getFullYear() : now.getFullYear() + 1,\r\n\t\trunningGetMemberAccounts: false\r\n\t}\r\n}\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\r\n\tcurrentFiscalYear:function(state) {\r\n\t\treturn state.currentFiscalYear;\r\n\t},\r\n\r\n\taccounts:function(state){\r\n\t\treturn state.accounts;\r\n\t},\r\n\r\n\tmemberAccounts: function ( state, getters, rootState, rootGetters ) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE);\r\n\t\tlet memberAccounts = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) ) {\r\n\t\t\t\tmemberAccounts.push( state.accounts[ accountNumbers[ i ] ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberAccounts;\r\n\t},\r\n\r\n\tmemberNotices:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE);\r\n\t\tlet memberNotices = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberNotices = memberNotices.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.notices );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberNotices;\r\n\t},\r\n\r\n\tmemberWarnings:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE);\r\n\t\tlet memberWarnings = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberWarnings = memberWarnings.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.warnings );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberWarnings;\r\n\t},\r\n\r\n\r\n}\r\n\r\nconst actions = {\r\n\r\n\tinitialize: async function ( { commit, rootGetters } ) {\r\n\t\t//console.log( 'citizen landfill residential initialize' )\r\n\t\tawait commit( 'setModuleStateFromLocalStorage' );\r\n\t\tcommit( 'defineAccountShells', rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE) );\r\n\t},\r\n\r\n\treset: async function ( {commit} ) {\r\n\t\t//console.log( 'citizen landfill residential reset' )\r\n\t\tawait commit( 'reset' );\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlocalStorage.removeItem( storeKey );\r\n\t\t}\r\n\t},\r\n\r\n\tgetMemberAccounts: async function ( { state, commit, dispatch, rootState, rootGetters } ) {\r\n\t\tif(state.runningGetMemberAccounts) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//set the running state so that we don't double fetch on navigation\r\n\t\tcommit('setRunningGetMemberAccounts', true );\r\n\r\n\t\tlet startingMemberAccountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', startingMemberAccountNumbers );\r\n\t\tcommit('setAccountFetchingTrue', startingMemberAccountNumbers);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/wasteworks/' + constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_API_CODE + '/accounts/' + rootState.citizenMember.user.userId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setAccountFetchingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setRunningGetMemberAccounts', false );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, '622C40D5-7C91-4158-BB24-B0BD6F03AA18' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'CCCEE747-2408-4994-B150-95767DB47C19' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\t\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the accounts or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, '60D814F6-C113-469F-88A5-3DF56ACD5661' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tlet updatedMemberAccountNumbers = [];\r\n\t\tfor( let i in apiResponse.data.data.accounts ) {\r\n\t\t\tif(apiResponse.data.data.accounts[ i ].account) {\r\n\t\t\t\tupdatedMemberAccountNumbers.push( apiResponse.data.data.accounts[ i ].account.customerId );\r\n\t\t\t\tcommit( 'updateAppendAccount', apiResponse.data.data.accounts[ i ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\tdispatch('citizenMember/setAccounts', { accounts:updatedMemberAccountNumbers, type:constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_CODE }, { root:true } );\r\n\r\n\t\tcommit('setPaymentClient', apiResponse.data.data.payment );\r\n\r\n\t\t//set loading state of the accounts we touched\r\n\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\r\n\t\t//end the running state to allow fetching again\r\n\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t},\r\n\r\n\tgetAccount: async function ( {commit}, customerId ) {\r\n\t\t//shell the account in case it's not saved yet\r\n\t\tcommit('defineAccountShells', [ customerId ]);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', customerId);\r\n\t\tcommit('setAccountFetchingTrue', customerId);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/wasteworks/' + constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_RECYCLING_API_CODE + '/detail/' + customerId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', customerId );\r\n\t\t\tcommit( 'setAccountFetchingFalse', customerId );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, '73F0D978-0790-4254-81F0-30A821D2D5D4' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'D77C312C-2AB2-433F-813F-976B75D50626' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the account or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, '7A294D76-EBFA-494B-8B83-574D1D59AFB2' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tcommit( 'updateAppendAccount', apiResponse.data.data );\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t},\r\n\r\n}\r\n\r\nconst mutations = {\r\n\r\n\tsetModuleStateFromLocalStorage: function ( state ) {\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\t// Replace the state object with the stored item\r\n\t\t\tlet data = JSON.parse( localStorage.getItem( storeKey ) );\r\n\t\t\tif( data !== null ) {\r\n\t\t\t\tObject.assign( state, data )\r\n\r\n\t\t\t\t//this is a page refresh so force the accounts to not be loading (in case a refresh started when the account was loading)\r\n\t\t\t\tstate.runningGetMemberAccounts = false;\r\n\t\t\t\tfor(let i in state.accounts) {\r\n\t\t\t\t\tstate.accounts[i]._meta.fetching = false;\r\n\t\t\t\t\tstate.accounts[i]._meta.loading = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\treset: function ( state ) {\r\n\t\tObject.assign(state, getDefaultState())\r\n\t},\r\n\r\n\tsetRunningGetMemberAccounts:function( state, running ) {\r\n\t\tstate.runningGetMemberAccounts = running;\r\n\t},\r\n\r\n\tsetAccountLoadingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountLoadingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountFetchingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountFetchingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountRemovingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountRemovingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetPaymentClient:function( state, paymentClient) {\r\n\t\tstate.paymentClient = paymentClient;\r\n\t},\r\n\r\n\tupdateAppendAccount: function ( state, newAccount ) {\r\n\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, newAccount.account.customerId)) {\r\n\t\t\tObject.assign(state.accounts[ newAccount.account.customerId ], newAccount)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tVue.set(state.accounts, newAccount.account.customerId, newAccount)\r\n\t\t}\r\n\t},\r\n\r\n\tdefineAccountShells: function ( state, customerIds ) {\r\n\t\tfor( let i in customerIds) {\r\n\t\t\tlet customerId = customerIds[i];\r\n\t\t\tif( !Object.prototype.hasOwnProperty.call(state.accounts, customerId)) {\r\n\t\t\t\tlet accountShell = {\r\n\t\t\t\t\taccount:{\r\n\t\t\t\t\t\tcustomerId:customerId\r\n\t\t\t\t\t},\r\n\t\t\t\t\toverview:{\r\n\t\t\t\t\t\tstatus:-1\r\n\t\t\t\t\t},\r\n\t\t\t\t\t_meta:{\r\n\t\t\t\t\t\tloading:true,\r\n\t\t\t\t\t\tremoving:false,\r\n\t\t\t\t\t\tfetched:null,\r\n\t\t\t\t\t\tfetching:false\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tVue.set(state.accounts, customerId, accountShell)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\r\n}\r\n\r\nexport default {\r\n\tnamespaced: true,\r\n\tstate,\r\n\tgetters,\r\n\tactions,\r\n\tmutations\r\n}\r\n","import Vue from 'vue';\r\n\r\nimport * as constants from '@/constants';\r\nimport CitizenApiError from '@/errors/citizen/CitizenApiError';\r\nimport CitizenMaintenanceError from '@/errors/citizen/CitizenMaintenanceError';\r\nimport CitizenConnectApiService from '@/services/citizen/CitizenConnectApiService';\r\n\r\nconst storeKey = 'citizen.store.landfillCommercialWaste';\r\n\r\nconst getDefaultState = () => {\r\n\tlet now = new Date();\r\n\treturn {\r\n\t\taccounts: {},\r\n\t\tpaymentClient: null,\r\n\t\tcurrentFiscalYear: now.getMonth()<=5 ? now.getFullYear() : now.getFullYear() + 1,\r\n\t\trunningGetMemberAccounts: false\r\n\t}\r\n}\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\r\n\tcurrentFiscalYear:function(state) {\r\n\t\treturn state.currentFiscalYear;\r\n\t},\r\n\r\n\taccounts:function(state){\r\n\t\treturn state.accounts;\r\n\t},\r\n\r\n\tmemberAccounts: function ( state, getters, rootState, rootGetters ) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE);\r\n\t\tlet memberAccounts = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) ) {\r\n\t\t\t\tmemberAccounts.push( state.accounts[ accountNumbers[ i ] ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberAccounts;\r\n\t},\r\n\r\n\tmemberNotices:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE);\r\n\t\tlet memberNotices = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberNotices = memberNotices.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.notices );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberNotices;\r\n\t},\r\n\r\n\tmemberWarnings:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE);\r\n\t\tlet memberWarnings = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberWarnings = memberWarnings.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.warnings );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberWarnings;\r\n\t},\r\n\r\n\r\n}\r\n\r\nconst actions = {\r\n\r\n\tinitialize: async function ( { commit, rootGetters } ) {\r\n\t\t//console.log( 'citizen landfill residential initialize' )\r\n\t\tawait commit( 'setModuleStateFromLocalStorage' );\r\n\t\tcommit( 'defineAccountShells', rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE) );\r\n\t},\r\n\r\n\treset: async function ( {commit} ) {\r\n\t\t//console.log( 'citizen landfill residential reset' )\r\n\t\tawait commit( 'reset' );\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlocalStorage.removeItem( storeKey );\r\n\t\t}\r\n\t},\r\n\r\n\tgetMemberAccounts: async function ( { state, commit, dispatch, rootState, rootGetters } ) {\r\n\t\tif(state.runningGetMemberAccounts) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//set the running state so that we don't double fetch on navigation\r\n\t\tcommit('setRunningGetMemberAccounts', true );\r\n\r\n\t\tlet startingMemberAccountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', startingMemberAccountNumbers );\r\n\t\tcommit('setAccountFetchingTrue', startingMemberAccountNumbers);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/wasteworks/' + constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_API_CODE + '/accounts/' + rootState.citizenMember.user.userId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setAccountFetchingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setRunningGetMemberAccounts', false );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, '3B619248-7BF2-48A8-A8D9-D4E0A304B097' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '040EEC53-C379-4F6F-9D2B-2FBFFCBB7483' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\t\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the accounts or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, 'C4DE6DB9-50F4-4BE4-B697-16771FF32803' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tlet updatedMemberAccountNumbers = [];\r\n\t\tfor( let i in apiResponse.data.data.accounts ) {\r\n\t\t\tif(apiResponse.data.data.accounts[ i ].account) {\r\n\t\t\t\tupdatedMemberAccountNumbers.push( apiResponse.data.data.accounts[ i ].account.customerId );\r\n\t\t\t\tcommit( 'updateAppendAccount', apiResponse.data.data.accounts[ i ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\tdispatch('citizenMember/setAccounts', { accounts:updatedMemberAccountNumbers, type:constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_CODE }, { root:true } );\r\n\r\n\t\tcommit('setPaymentClient', apiResponse.data.data.payment );\r\n\r\n\t\t//set loading state of the accounts we touched\r\n\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\r\n\t\t//end the running state to allow fetching again\r\n\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t},\r\n\r\n\tgetAccount: async function ( {commit}, customerId ) {\r\n\t\t//shell the account in case it's not saved yet\r\n\t\tcommit('defineAccountShells', [ customerId ]);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', customerId);\r\n\t\tcommit('setAccountFetchingTrue', customerId);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/wasteworks/' + constants.PAYMENT_TYPE_COMMERCIAL_LANDFILL_WASTE_API_CODE + '/detail/' + customerId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', customerId );\r\n\t\t\tcommit( 'setAccountFetchingFalse', customerId );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, '099C8454-47F9-4519-A1B6-87E829785EB7' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'A550E15B-2726-4ADB-B4AA-DA02BE737D26' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the account or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, 'B164EA38-39C8-4D96-8396-018E07B949E8' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tcommit( 'updateAppendAccount', apiResponse.data.data );\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t},\r\n\r\n}\r\n\r\nconst mutations = {\r\n\r\n\tsetModuleStateFromLocalStorage: function ( state ) {\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\t// Replace the state object with the stored item\r\n\t\t\tlet data = JSON.parse( localStorage.getItem( storeKey ) );\r\n\t\t\tif( data !== null ) {\r\n\t\t\t\tObject.assign( state, data )\r\n\r\n\t\t\t\t//this is a page refresh so force the accounts to not be loading (in case a refresh started when the account was loading)\r\n\t\t\t\tstate.runningGetMemberAccounts = false;\r\n\t\t\t\tfor(let i in state.accounts) {\r\n\t\t\t\t\tstate.accounts[i]._meta.fetching = false;\r\n\t\t\t\t\tstate.accounts[i]._meta.loading = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\treset: function ( state ) {\r\n\t\tObject.assign(state, getDefaultState())\r\n\t},\r\n\r\n\tsetRunningGetMemberAccounts:function( state, running ) {\r\n\t\tstate.runningGetMemberAccounts = running;\r\n\t},\r\n\r\n\tsetAccountLoadingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountLoadingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountFetchingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountFetchingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountRemovingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountRemovingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetPaymentClient:function( state, paymentClient) {\r\n\t\tstate.paymentClient = paymentClient;\r\n\t},\r\n\r\n\tupdateAppendAccount: function ( state, newAccount ) {\r\n\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, newAccount.account.customerId)) {\r\n\t\t\tObject.assign(state.accounts[ newAccount.account.customerId ], newAccount)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tVue.set(state.accounts, newAccount.account.customerId, newAccount)\r\n\t\t}\r\n\t},\r\n\r\n\tdefineAccountShells: function ( state, customerIds ) {\r\n\t\tfor( let i in customerIds) {\r\n\t\t\tlet customerId = customerIds[i];\r\n\t\t\tif( !Object.prototype.hasOwnProperty.call(state.accounts, customerId)) {\r\n\t\t\t\tlet accountShell = {\r\n\t\t\t\t\taccount:{\r\n\t\t\t\t\t\tcustomerId:customerId\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcustomer:{\r\n\t\t\t\t\t\tid:customerId\r\n\t\t\t\t\t},\r\n\t\t\t\t\ttickets:[],\r\n\t\t\t\t\toverview:{\r\n\t\t\t\t\t\tstatus:-1,\r\n\t\t\t\t\t\tmessages:{\r\n\t\t\t\t\t\t\twarnings:[],\r\n\t\t\t\t\t\t\tnotices:[],\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\t_meta:{\r\n\t\t\t\t\t\tloading:true,\r\n\t\t\t\t\t\tremoving:false,\r\n\t\t\t\t\t\tfetched:null,\r\n\t\t\t\t\t\tfetching:false\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tVue.set(state.accounts, customerId, accountShell)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\r\n}\r\n\r\nexport default {\r\n\tnamespaced: true,\r\n\tstate,\r\n\tgetters,\r\n\tactions,\r\n\tmutations\r\n}\r\n","import Vue from 'vue';\r\n\r\nimport * as constants from '@/constants';\r\nimport CitizenApiError from '@/errors/citizen/CitizenApiError';\r\nimport CitizenMaintenanceError from '@/errors/citizen/CitizenMaintenanceError';\r\nimport CitizenConnectApiService from '@/services/citizen/CitizenConnectApiService';\r\n\r\nconst storeKey = 'citizen.store.landfillResidential';\r\n\r\nconst getDefaultState = () => {\r\n\tlet now = new Date();\r\n\treturn {\r\n\t\taccounts: {},\r\n\t\tpaymentClient: null,\r\n\t\tcurrentFiscalYear: now.getMonth()<=5 ? now.getFullYear() : now.getFullYear() + 1,\r\n\t\tcurrentPermitYear: now.getMonth()<9 ? now.getFullYear() : now.getFullYear() + 1,\r\n\t\trunningGetMemberAccounts: false\r\n\t}\r\n}\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\r\n\tcurrentFiscalYear:function(state) {\r\n\t\treturn state.currentFiscalYear;\r\n\t},\r\n\r\n\taccounts:function(state){\r\n\t\treturn state.accounts;\r\n\t},\r\n\r\n\tmemberAccounts: function ( state, getters, rootState, rootGetters ) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_LANDFILL_CODE);\r\n\t\tlet memberAccounts = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) ) {\r\n\t\t\t\tmemberAccounts.push( state.accounts[ accountNumbers[ i ] ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberAccounts;\r\n\t},\r\n\r\n\tmemberNotices:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_LANDFILL_CODE);\r\n\t\tlet memberNotices = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberNotices = memberNotices.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.notices );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberNotices;\r\n\t},\r\n\r\n\tmemberWarnings:function(state, getters, rootState, rootGetters) {\r\n\t\tlet accountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_LANDFILL_CODE);\r\n\t\tlet memberWarnings = [];\r\n\t\tfor( let i in accountNumbers) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, accountNumbers[i] ) && !state.accounts[ accountNumbers[ i ] ]._meta.loading ) {\r\n\t\t\t\tmemberWarnings = memberWarnings.concat( state.accounts[ accountNumbers[ i ] ].overview?.messages?.warnings );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn memberWarnings;\r\n\t},\r\n\r\n\r\n}\r\n\r\nconst actions = {\r\n\r\n\tinitialize: async function ( { commit, rootGetters } ) {\r\n\t\t//console.log( 'citizen landfill residential initialize' )\r\n\t\tawait commit( 'setModuleStateFromLocalStorage' );\r\n\t\tcommit( 'defineAccountShells', rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_LANDFILL_CODE) );\r\n\t},\r\n\r\n\treset: async function ( {commit} ) {\r\n\t\t//console.log( 'citizen landfill residential reset' )\r\n\t\tawait commit( 'reset' );\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlocalStorage.removeItem( storeKey );\r\n\t\t}\r\n\t},\r\n\r\n\tgetMemberAccounts: async function ( { state, commit, dispatch, rootState, rootGetters } ) {\r\n\t\tif(state.runningGetMemberAccounts) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//set the running state so that we don't double fetch on navigation\r\n\t\tcommit('setRunningGetMemberAccounts', true );\r\n\r\n\t\tlet startingMemberAccountNumbers = rootGetters[\"citizenMember/accountNumbers\"](constants.PAYMENT_TYPE_LANDFILL_CODE);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', startingMemberAccountNumbers );\r\n\t\tcommit('setAccountFetchingTrue', startingMemberAccountNumbers);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/landfill/accounts/' + rootState.citizenMember.user.userId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setAccountFetchingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setRunningGetMemberAccounts', false );\r\n\t\t\tif( e.code==503 ) {\r\n\t\t\t\tthrow new CitizenMaintenanceError( e.message, e.code, {}, '7823A677-AAC3-4577-8079-3911115A3D45' );\r\n\t\t\t}\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '1D173C10-5A02-4D24-9BB2-93525BFFF5D9' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse==null || apiResponse=='' ) {\r\n\t\t\tcommit( 'setAccountLoadingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setAccountFetchingFalse', startingMemberAccountNumbers );\r\n\t\t\tcommit( 'setRunningGetMemberAccounts', false );\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the accounts or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, '985ED2F2-866A-465B-8A81-C16C50892866' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tlet updatedMemberAccountNumbers = [];\r\n\t\tfor( let i in apiResponse.data.data.accounts ) {\r\n\t\t\tif(apiResponse.data.data.accounts[ i ].account) {\r\n\t\t\t\tupdatedMemberAccountNumbers.push( apiResponse.data.data.accounts[ i ].account.customerId );\r\n\t\t\t\tcommit( 'updateAppendAccount', apiResponse.data.data.accounts[ i ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\tdispatch('citizenMember/setAccounts', { accounts:updatedMemberAccountNumbers, type:constants.PAYMENT_TYPE_LANDFILL_CODE }, { root:true } );\r\n\r\n\t\tcommit('setPaymentClient', apiResponse.data.data.payment );\r\n\r\n\t\t//set loading state of the accounts we touched\r\n\t\tcommit('setAccountLoadingFalse', startingMemberAccountNumbers);\r\n\t\tcommit('setAccountFetchingFalse', startingMemberAccountNumbers);\r\n\r\n\t\t//end the running state to allow fetching again\r\n\t\tcommit('setRunningGetMemberAccounts', false );\r\n\t},\r\n\r\n\tgetAccount: async function ( {commit}, customerId ) {\r\n\t\t//shell the account in case it's not saved yet\r\n\t\tcommit('defineAccountShells', [ customerId ]);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', customerId);\r\n\t\tcommit('setAccountFetchingTrue', customerId);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/landfill/detail/' + customerId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '3FAC010B-EEDA-4897-AD07-833CAB24BA28' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the account or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, '7488bd93-3fa6-4f66-917a-6513d3f6820d' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error && apiResponse.data.status=== 503) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenMaintenanceError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, 'E63AF55A-D882-4B0F-9F47-F6B77956656F' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, 'FE8913C6-4C7F-4622-B07D-4193627D252E' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tcommit( 'updateAppendAccount', apiResponse.data.data );\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\tcommit('setAccountFetchingFalse', customerId);\r\n\t},\r\n\r\n\taddAccount: async function ( { commit, dispatch, rootState }, customerId ) {\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingTrue', customerId);\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.post( 'v2/landfill/add/'+rootState.citizenMember.user.userId+'/'+customerId.trim(), {} );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '94E7180C-9B47-48AE-84F8-BCE2560A862E' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'Failed to add account. Try again.', 404, {}, 'AA0FEB22-156E-4E38-A3A1-EDB8715276F1' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error && apiResponse.data.status=== 503) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tthrow new CitizenMaintenanceError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, 'AF74326B-EDF5-44AE-B79B-81BB2B22F249' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error ) {\r\n\t\t\tcommit('setAccountLoadingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '59B0DBB5-7278-4E1E-AD83-0E3E26DBD684' );\r\n\t\t}\r\n\r\n\t\t//add the type to member\r\n\t\tawait dispatch( 'citizenMember/addAccount', { type:constants.PAYMENT_TYPE_LANDFILL_CODE, account:apiResponse.data.data.account }, { root:true } );\r\n\r\n\t\tcommit('defineAccountShells', [ apiResponse.data.data.account ]);\r\n\r\n\t\t//get account data\r\n\t\tawait dispatch('getAccount', apiResponse.data.data.account);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setAccountLoadingFalse', customerId);\r\n\r\n\t\t//return the new account\r\n\t\treturn apiResponse.data.data.account;\r\n\r\n\t},\r\n\r\n\tremoveAccount: async function ( { dispatch, commit, rootState }, customerId ) {\r\n\t\t//set removing state\r\n\t\tcommit('setAccountRemovingTrue', customerId);\r\n\r\n\t\t//tell api to remove account\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.delete( 'v2/landfill/remove/'+rootState.citizenMember.user.userId+'/'+customerId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '6E4174A7-CB8A-4C02-AF82-414FE5FB2157' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( 'Failed to remove account. Try again.', 404, {}, '209AB67B-E12C-4C1C-84F1-2518D9F656E9' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error && apiResponse.data.status=== 503) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenMaintenanceError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '60ED0961-D97C-40A7-B345-40FB03741FF7' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error ) {\r\n\t\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t\t\tthrow new CitizenApiError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '5A334837-AFB5-4F06-8BB9-1FBC451BB635' );\r\n\t\t}\r\n\r\n\t\t//remove the type from member store\r\n\t\tawait dispatch( 'citizenMember/removeAccount', { type:constants.PAYMENT_TYPE_LANDFILL_CODE, account:apiResponse.data.data.account }, { root:true } );\r\n\r\n\t\t//set removing state\r\n\t\tcommit('setAccountRemovingFalse', customerId);\r\n\t}\r\n\r\n}\r\n\r\nconst mutations = {\r\n\r\n\tsetModuleStateFromLocalStorage: function ( state ) {\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlet now = new Date();\r\n\t\t\t// Replace the state object with the stored item\r\n\t\t\tlet data = JSON.parse( localStorage.getItem( storeKey ) );\r\n\t\t\tif( data !== null ) {\r\n\t\t\t\tObject.assign( state, data )\r\n\r\n\t\t\t\tstate.currentFiscalYear = now.getMonth()<=5 ? now.getFullYear() : now.getFullYear() + 1\r\n\t\t\t\tstate.currentPermitYear = now.getMonth()<9 ? now.getFullYear() : now.getFullYear() + 1\r\n\r\n\t\t\t\t//this is a page refresh so force the accounts to not be loading (in case a refresh started when the account was loading)\r\n\t\t\t\tstate.runningGetMemberAccounts = false;\r\n\t\t\t\tfor( let i in state.accounts ) {\r\n\t\t\t\t\tstate.accounts[ i ]._meta.fetching = false;\r\n\t\t\t\t\tstate.accounts[ i ]._meta.loading = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\treset: function ( state ) {\r\n\t\tObject.assign(state, getDefaultState())\r\n\t},\r\n\r\n\tsetRunningGetMemberAccounts:function( state, running ) {\r\n\t\tstate.runningGetMemberAccounts = running;\r\n\t},\r\n\r\n\tsetAccountLoadingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountLoadingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.loading = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountFetchingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountFetchingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.fetching = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetAccountRemovingTrue: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetAccountRemovingFalse: function ( state, customerIds ) {\r\n\t\tif(!Array.isArray(customerIds)) {\r\n\t\t\tcustomerIds = [ customerIds ];\r\n\t\t}\r\n\t\tfor( let i in customerIds ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, customerIds[i] ) ) {\r\n\t\t\t\tstate.accounts[ customerIds[i] ]._meta.removing = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetPaymentClient:function( state, paymentClient) {\r\n\t\tstate.paymentClient = paymentClient;\r\n\t},\r\n\r\n\tupdateAppendAccount: function ( state, newAccount ) {\r\n\t\tif( Object.prototype.hasOwnProperty.call(state.accounts, newAccount.account.customerId)) {\r\n\t\t\tObject.assign(state.accounts[ newAccount.account.customerId ], newAccount)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tVue.set(state.accounts, newAccount.account.customerId, newAccount)\r\n\t\t}\r\n\t},\r\n\r\n\tdefineAccountShells: function ( state, customerIds ) {\r\n\t\tlet now = new Date();\r\n\t\tfor( let i in customerIds) {\r\n\t\t\tlet customerId = customerIds[i];\r\n\t\t\tif( !Object.prototype.hasOwnProperty.call(state.accounts, customerId)) {\r\n\t\t\t\tlet accountShell = {\r\n\t\t\t\t\taccount:{\r\n\t\t\t\t\t\tcustomerId:customerId\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcustomer:{},\r\n\t\t\t\t\tpermits:[],\r\n\t\t\t\t\toverview:{\r\n\t\t\t\t\t\tstatus:-1\r\n\t\t\t\t\t},\r\n\t\t\t\t\t_meta:{\r\n\t\t\t\t\t\tloading:true,\r\n\t\t\t\t\t\tremoving:false,\r\n\t\t\t\t\t\tfetched:null,\r\n\t\t\t\t\t\tfetching:false,\r\n\t\t\t\t\t\tyear:{\r\n\t\t\t\t\t\t\tcurrent:now.getMonth()<10 ? now.getFullYear() : now.getFullYear()+1,\r\n\t\t\t\t\t\t\tlandfill:now.getMonth()<10 ? now.getFullYear()-1 : now.getFullYear(),\r\n\t\t\t\t\t\t\tnext:now.getFullYear()+1\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tVue.set(state.accounts, customerId, accountShell)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\r\n}\r\n\r\nexport default {\r\n\tnamespaced: true,\r\n\tstate,\r\n\tgetters,\r\n\tactions,\r\n\tmutations\r\n}\r\n","import { isEmpty } from 'lodash';\r\nimport Vue from 'vue';\r\n\r\nimport CitizenApiError from '@/errors/citizen/CitizenApiError';\r\nimport CitizenMaintenanceError from '@/errors/citizen/CitizenMaintenanceError';\r\nimport CitizenConnectApiService from '@/services/citizen/CitizenConnectApiService';\r\n\r\nconst storeKey = 'citizen.store.payment';\r\n\r\nconst getDefaultState = () => {\r\n\treturn {\r\n\t\ttransactions: {},\r\n\r\n\t\tfetchingVaults: false,\r\n\t\tvaults: [],\r\n\r\n\t\tfetchingBlankPaymentClient:false,\r\n\t\tblankPaymentClient:[],\r\n\r\n\t\tfetchingHistoricalTransactions:false,\r\n\t\thistoricalTransactions:[],\r\n\r\n\t\tfetchingScheduledTransactions:false,\r\n\t\tscheduledTransactions:[]\r\n\t}\r\n}\r\n\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\r\n\r\n\ttransactions:function(state){\r\n\t\treturn state.transactions;\r\n\t},\r\n\r\n\tvaults:function(state){\r\n\t\treturn state.vaults;\r\n\t},\r\n\r\n\tfetchingHistoricalTransactions:function ( state ) {\r\n\t\treturn state.fetchingHistoricalTransactions;\r\n\t},\r\n\r\n\thistoricalTransactions:function ( state ) {\r\n\t\treturn state.historicalTransactions;\r\n\t},\r\n\r\n\tfetchingScheduledTransactions:function ( state ) {\r\n\t\treturn state.fetchingScheduledTransactions;\r\n\t},\r\n\r\n\tscheduledTransactions:function ( state ) {\r\n\t\treturn state.scheduledTransactions;\r\n\t}\r\n\r\n}\r\n\r\nconst actions = {\r\n\tinitialize: async function ( ) {\r\n\t\t//console.log( 'citizen payment store initialize' )\r\n\t\t//await commit( 'setModuleStateFromLocalStorage' );\r\n\t},\r\n\r\n\treset:async function({ commit }) {\r\n\t\tcommit('reset')\r\n\t\tif( localStorage.getItem( storeKey ) ) {\r\n\t\t\tlocalStorage.removeItem( storeKey );\r\n\t\t}\r\n\t},\r\n\r\n\r\n\tfetchVaults: async function({ commit, rootGetters }) {\r\n\t\tcommit('setFetchingVaults', true);\r\n\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/payment/get_vaults/' + rootGetters['citizenMember/userId'] );\r\n\t\t\t//console.log( apiResponse )\r\n\t\t\tawait commit( 'setVaults', apiResponse.data.data )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\t//console.log(e);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'B462C42D-A175-49B5-907C-0E0CAFB84C14' );\r\n\t\t}\r\n\r\n\t\tcommit('setFetchingVaults', false);\r\n\r\n\t},\r\n\r\n\tfetchBlankPaymentClient: async function({ commit }) {\r\n\t\tcommit('setFetchingBlankPaymentClient', true);\r\n\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/payment/blank_client' );\r\n\t\t\t//console.log( apiResponse )\r\n\t\t\tawait commit( 'setBlankPaymentClient', apiResponse.data.data )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\t//console.log(e);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, 'D4F3F7EF-76E9-4F8D-BAB3-BA1F4A248FD1' );\r\n\t\t}\r\n\r\n\t\tcommit('setFetchingBlankPaymentClient', false);\r\n\r\n\t},\r\n\r\n\r\n\t/**\r\n\t * @param {Object} params\r\n\t * @param {Object} params.vault - Vault object (with updated data)\r\n\t * @param {string} params.paymentType - The payment type (taxes, public_utilities, etc)\r\n\t * @param {string} params.methodType - The payment method type (credit, echeck )\r\n\t * @param {function} params.successCallback - Optional success callback function\r\n\t * @param {function} params.errorCallback - Optional error callback function\r\n\t */\r\n\tupdateVault: async function ( {dispatch, commit, rootGetters}, params ) {\r\n\r\n\t\t//console.log( 'updateVault' );\r\n\r\n\t\t//VALIDATION\r\n\t\ttry {\r\n\t\t\tif( isEmpty( params ) ) {\r\n\t\t\t\tthrow new Error( 'Cannot update vault without providing the parameters to update' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.paymentType ) != 'string' || params.paymentType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment type is required' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.methodType ) != 'string' || params.methodType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment method is required' );\r\n\t\t\t}\r\n\t\t\telse if( isEmpty( params.vault ) || typeof ( params.vault.id ) == 'undefined' || params.vault.id === null ) {\r\n\t\t\t\tthrow new Error( 'Vault is required' );\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root:true} );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//UPDATE\r\n\t\ttry {\r\n\t\t\tlet apiResponse = await CitizenConnectApiService.post( 'v2/payment/update_vault/' + rootGetters['citizenMember/userId'] + '/' + params.paymentType + '/' + params.methodType + '/' + params.vault.id, params.vault );\r\n\r\n\t\t\tif( apiResponse.data.error ) {\r\n\t\t\t\tthrow new Error( apiResponse.data.message );\r\n\t\t\t}\r\n\r\n\t\t\tif( typeof ( params.successCallback ) == 'function' ) {\r\n\t\t\t\tparams.successCallback( apiResponse.data );\r\n\t\t\t}\r\n\r\n\t\t\tcommit('updateVault', params.vault);\r\n\r\n\t\t\tdispatch( 'sendSnackbar', {\r\n\t\t\t\tmessage: 'Saved payment method updated successfully',\r\n\t\t\t\tcolor: 'success',\r\n\t\t\t}, {root: true} )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tif( typeof ( params.errorCallback ) == 'function' ) {\r\n\t\t\t\tparams.errorCallback( e );\r\n\t\t\t}\r\n\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root: true} )\r\n\t\t}\r\n\r\n\t},\r\n\r\n\t/**\r\n\t * @param {Object} params\r\n\t * @param {string} params.vaultId - Vault id to remove\r\n\t * @param {string} params.paymentType - The payment type (taxes, public_utilities, etc)\r\n\t * @param {string} params.methodType - The payment method type (credit, echeck )\r\n\t * @param {function} params.successCallback - Optional success callback function\r\n\t * @param {function} params.errorCallback - Optional error callback function\r\n\t */\r\n\tremoveVault: async function ( {dispatch, commit, rootGetters}, params ) {\r\n\r\n\t\t//console.log( 'removeVault' );\r\n\r\n\t\t//VALIDATION\r\n\t\ttry {\r\n\t\t\tif( isEmpty( params ) ) {\r\n\t\t\t\tthrow new Error( 'Cannot remove vault without providing the parameters to remove' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.paymentType ) != 'string' || params.paymentType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment type is required' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.methodType ) != 'string' || params.methodType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment method is required' );\r\n\t\t\t}\r\n\r\n\t\t\telse if( !params.vaultId ) {\r\n\t\t\t\tthrow new Error( 'Vault id is required' );\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root: true} );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//REMOVE\r\n\t\ttry {\r\n\t\t\tlet apiResponse = await CitizenConnectApiService.delete( 'v2/payment/remove_vault/' + rootGetters['citizenMember/userId'] + '/' + params.paymentType + '/' + params.methodType + '/' + params.vaultId );\r\n\r\n\t\t\tif( apiResponse.data.error ) {\r\n\t\t\t\tthrow new Error( apiResponse.data.message );\r\n\t\t\t}\r\n\r\n\t\t\tif( typeof ( params.successCallback ) == 'function' ) {\r\n\t\t\t\tparams.successCallback( apiResponse.data );\r\n\t\t\t}\r\n\r\n\t\t\tcommit('removeVault', params.vaultId);\r\n\r\n\t\t\tdispatch( 'sendSnackbar', {\r\n\t\t\t\tmessage: 'Saved payment method has been removed',\r\n\t\t\t\tcolor: 'success',\r\n\t\t\t}, {root: true} )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tif( typeof ( params.errorCallback ) == 'function' ) {\r\n\t\t\t\tparams.errorCallback( e );\r\n\t\t\t}\r\n\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root: true} )\r\n\t\t}\r\n\r\n\r\n\t},\r\n\r\n\t/**\r\n\t * @param {Object} params\r\n\t * @param {string} params.account - Account number to enable autopay for\r\n\t * @param {string} params.paymentType - The type of the account (taxes, public_utilities, etc)\r\n\t * @param {string} params.methodType - The payment method type to use for autopay for this account (credit, echeck )\r\n\t * @param {string} params.vaultId - Vault id to use for autopay\r\n\t * @param {function} params.successCallback - Optional success callback function\r\n\t * @param {function} params.errorCallback - Optional error callback function\r\n\t */\r\n\tsaveAutopay: async function ( {dispatch, rootGetters}, params ) {\r\n\t\t//console.log( 'saveAutopay' );\r\n\r\n\t\t//VALIDATION\r\n\t\ttry {\r\n\t\t\tif( isEmpty( params ) ) {\r\n\t\t\t\tthrow new Error( 'Cannot save autopay without providing the parameters to save' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.paymentType ) != 'string' || params.paymentType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment type is required' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.methodType ) != 'string' || params.methodType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment method is required' );\r\n\t\t\t}\r\n\t\t\telse if( (typeof ( params.vaultId ) != 'string' && typeof ( params.vaultId ) != 'number') || params.vaultId === '' ) {\r\n\t\t\t\tthrow new Error( 'Vault id is required' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.account ) != 'string' || params.account === '' ) {\r\n\t\t\t\tthrow new Error( 'Account is required' );\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root:true} );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//SAVE\r\n\t\ttry {\r\n\t\t\tlet apiResponse = await CitizenConnectApiService.postForm( 'v2/payment/save_autopay/' + rootGetters['citizenMember/userId'] + '/' + params.paymentType + '/' + params.account, {\r\n\t\t\t\tmethodType: params.methodType,\r\n\t\t\t\tvaultId: params.vaultId\r\n\t\t\t} );\r\n\r\n\t\t\tif( apiResponse.data.error ) {\r\n\t\t\t\tthrow new Error( apiResponse.data.message );\r\n\t\t\t}\r\n\r\n\t\t\tif( typeof ( params.successCallback ) == 'function' ) {\r\n\t\t\t\tparams.successCallback( apiResponse.data );\r\n\t\t\t}\r\n\r\n\t\t\tdispatch( 'sendSnackbar', {\r\n\t\t\t\tmessage: 'Saved autopay settings for ' + params.account,\r\n\t\t\t\tcolor: 'success',\r\n\t\t\t}, {root: true} )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tif( typeof ( params.errorCallback ) == 'function' ) {\r\n\t\t\t\tparams.errorCallback( e );\r\n\t\t\t}\r\n\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root: true} )\r\n\t\t}\r\n\r\n\r\n\t},\r\n\r\n\t/**\r\n\t * @param {Object} params\r\n\t * @param {string} params.account - Account number to enable autopay for\r\n\t * @param {string} params.paymentType - The payment type (taxes, public_utilities, etc)\r\n\t * @param {function} params.successCallback - Optional success callback function\r\n\t * @param {function} params.errorCallback - Optional error callback function\r\n\t */\r\n\tdisableAutopay: async function ( {dispatch,rootGetters}, params ) {\r\n\r\n\t\t//console.log( 'disableAutopay' );\r\n\r\n\t\t//VALIDATION\r\n\t\ttry {\r\n\t\t\tif( isEmpty( params ) ) {\r\n\t\t\t\tthrow new Error( 'Cannot disable autopay without providing parameters' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.paymentType ) != 'string' || params.paymentType === '' ) {\r\n\t\t\t\tthrow new Error( 'Payment type is required' );\r\n\t\t\t}\r\n\t\t\telse if( typeof ( params.account ) != 'string' || params.account === '' ) {\r\n\t\t\t\tthrow new Error( 'Account is required' );\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tdispatch( 'sendErrorSnackbar', e );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//DISABLE\r\n\t\ttry {\r\n\t\t\tlet apiResponse = await CitizenConnectApiService.delete( 'v2/payment/disable_autopay/' + rootGetters['citizenMember/userId'] + '/' + params.paymentType + '/' + params.account );\r\n\r\n\t\t\tif( apiResponse.data.error ) {\r\n\t\t\t\tthrow new Error( apiResponse.data.message );\r\n\t\t\t}\r\n\r\n\t\t\tif( typeof ( params.successCallback ) == 'function' ) {\r\n\t\t\t\tparams.successCallback( apiResponse.data );\r\n\t\t\t}\r\n\r\n\t\t\tdispatch( 'sendSnackbar', {\r\n\t\t\t\tmessage: 'Disabled autopay for ' + params.account,\r\n\t\t\t\tcolor: 'success',\r\n\t\t\t}, {root: true} )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tif( typeof ( params.errorCallback ) == 'function' ) {\r\n\t\t\t\tparams.errorCallback( e );\r\n\t\t\t}\r\n\r\n\t\t\tdispatch( 'sendErrorSnackbar', e, {root: true} )\r\n\t\t}\r\n\t},\r\n\r\n\tshellTransactionIfItDoesNotExist: async function({commit}, transactionUiId ) {\r\n\t\tcommit('defineTransactionShells', [ transactionUiId ]);\r\n\t},\r\n\r\n\tgetTransaction: async function ( {commit,rootGetters}, transactionUiId ) {\r\n\r\n\t\t//shell the account in case it's not saved yet\r\n\t\tcommit('defineTransactionShells', [ transactionUiId ]);\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setTransactionLoadingTrue', transactionUiId);\r\n\t\tcommit('setTransactionFetchingTrue', transactionUiId);\r\n\r\n\t\tlet isScheduledTransaction = transactionUiId.startsWith('S-');\r\n\r\n\t\t//get data from api\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tlet urlKey = 'transaction';\r\n\t\t\tif(isScheduledTransaction) {\r\n\t\t\t\turlKey = 'scheduled_transaction';\r\n\t\t\t}\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/payment/'+ urlKey +'/' + rootGetters['citizenMember/userId'] + '/' + transactionUiId );\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tcommit('setTransactionLoadingFalse', transactionUiId);\r\n\t\t\tcommit('setTransactionFetchingFalse', transactionUiId);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '518AA803-3833-442E-903E-5CC98FD9E114' );\r\n\t\t}\r\n\r\n\t\t//handle non standard errors\r\n\t\tif( apiResponse===null ) {\r\n\t\t\tcommit('setTransactionLoadingFalse', transactionUiId);\r\n\t\t\tcommit('setTransactionFetchingFalse', transactionUiId);\r\n\t\t\tthrow new CitizenApiError( 'The server didn\\'t return the transaction or an error. Try signing out and back in. If you keep getting this error, contact support.', 500, {}, '611881BC-E192-4A54-BADC-A5EC9A56F0A3' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error && apiResponse.data.status=== 503) {\r\n\t\t\tcommit('setTransactionLoadingFalse', transactionUiId);\r\n\t\t\tcommit('setTransactionFetchingFalse', transactionUiId);\r\n\t\t\tthrow new CitizenMaintenanceError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '606FCC93-60E2-4EB7-A76E-6026376F2CDD' );\r\n\t\t}\r\n\t\telse if( apiResponse.data.error ) {\r\n\t\t\tcommit('setTransactionLoadingFalse', transactionUiId);\r\n\t\t\tcommit('setTransactionFetchingFalse', transactionUiId);\r\n\t\t\tthrow new CitizenApiError( apiResponse.data.message, apiResponse.data.status, apiResponse.data.data, '05E983B3-BF38-4EF8-8B71-4F192FAC7FCE' );\r\n\t\t}\r\n\r\n\t\t//set data\r\n\t\tapiResponse.data.data.transactionUiId = transactionUiId;\r\n\t\tcommit( 'updateAppendTransaction', apiResponse.data.data );\r\n\r\n\t\t//set loading state\r\n\t\tcommit('setTransactionLoadingFalse', transactionUiId);\r\n\t\tcommit('setTransactionFetchingFalse', transactionUiId);\r\n\t},\r\n\r\n\r\n\tfetchScheduledTransactions: async function({ commit, rootGetters }) {\r\n\t\tcommit('setFetchingScheduledTransactions', true);\r\n\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/payment/scheduled_transactions/' + rootGetters['citizenMember/userId'] );\r\n\t\t\t//console.log( apiResponse )\r\n\t\t\tawait commit( 'setScheduledTransactions', apiResponse.data.data )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\t//console.log(e);\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '99C2B263-89C5-4DA1-BEF7-D0207E15D00E' );\r\n\t\t}\r\n\r\n\t\tcommit('setFetchingScheduledTransactions', false);\r\n\t},\r\n\r\n\tfetchHistoricalTransactions: async function({ commit, rootGetters }) {\r\n\t\tcommit('setFetchingHistoricalTransactions', true);\r\n\r\n\t\tlet apiResponse = null;\r\n\t\ttry {\r\n\t\t\tapiResponse = await CitizenConnectApiService.get( 'v2/payment/transactions/' + rootGetters['citizenMember/userId'] );\r\n\t\t\tawait commit( 'setHistoricalTransactions', apiResponse.data.data )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '99C2B263-89C5-4DA1-BEF7-D0207E15D00E' );\r\n\t\t}\r\n\r\n\t\tcommit('setFetchingHistoricalTransactions', false);\r\n\t},\r\n\r\n\tcancelScheduledTransaction: async function({ commit, rootGetters }, transactionId) {\r\n\t\ttry {\r\n\t\t\tawait CitizenConnectApiService.delete( 'v2/payment/scheduled_transactions/' + rootGetters['citizenMember/userId'] + '/' + transactionId );\r\n\t\t\tawait commit( 'removeScheduledTransaction', transactionId )\r\n\t\t}\r\n\t\tcatch( e ) {\r\n\t\t\tthrow new CitizenApiError( e.message, e.code, {}, '34861FBA-C297-4B7F-B3D1-815292F528F1' );\r\n\t\t}\r\n\t}\r\n}\r\n\r\nconst mutations = {\r\n\r\n\treset:function(state) {\r\n\t\tObject.assign(state, getDefaultState())\r\n\t},\r\n\r\n\tupdateVault:function( state, vault ) {\r\n\t\tfor(let i in state.vaults) {\r\n\t\t\tif(state.vaults[i].id==vault.id) {\r\n\t\t\t\tstate.vaults[i]= vault;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tremoveVault:function( state, vaultId ) {\r\n\t\tfor(let i in state.vaults) {\r\n\t\t\tif(state.vaults[i].id==vaultId) {\r\n\t\t\t\tstate.vaults.splice(i, 1);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetTransactionLoadingTrue: function ( state, transactionUiIds ) {\r\n\t\tif(!Array.isArray(transactionUiIds)) {\r\n\t\t\ttransactionUiIds = [ transactionUiIds ];\r\n\t\t}\r\n\t\tfor( let i in transactionUiIds ) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId ) ) {\r\n\t\t\t\tstate.transactions[ transactionUiId ]._meta.loading = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetTransactionLoadingFalse: function ( state, transactionUiIds ) {\r\n\t\tif(!Array.isArray(transactionUiIds)) {\r\n\t\t\ttransactionUiIds = [ transactionUiIds ];\r\n\t\t}\r\n\t\tfor( let i in transactionUiIds ) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId ) ) {\r\n\t\t\t\tstate.transactions[ transactionUiId ]._meta.loading = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetTransactionFetchingTrue: function ( state, transactionUiIds ) {\r\n\t\tif(!Array.isArray(transactionUiIds)) {\r\n\t\t\ttransactionUiIds = [ transactionUiIds ];\r\n\t\t}\r\n\t\tfor( let i in transactionUiIds ) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId ) ) {\r\n\t\t\t\tstate.transactions[ transactionUiId ]._meta.fetching = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetTransactionFetchingFalse: function ( state, transactionUiIds ) {\r\n\t\tif(!Array.isArray(transactionUiIds)) {\r\n\t\t\ttransactionUiIds = [ transactionUiIds ];\r\n\t\t}\r\n\t\tfor( let i in transactionUiIds ) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId ) ) {\r\n\t\t\t\tstate.transactions[ transactionUiId ]._meta.fetching = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tsetTransactionRemovingTrue: function ( state, transactionUiIds ) {\r\n\t\tif(!Array.isArray(transactionUiIds)) {\r\n\t\t\ttransactionUiIds = [ transactionUiIds ];\r\n\t\t}\r\n\t\tfor( let i in transactionUiIds ) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId ) ) {\r\n\t\t\t\tstate.transactions[ transactionUiId ]._meta.removing = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tsetTransactionRemovingFalse: function ( state, transactionUiIds ) {\r\n\t\tif(!Array.isArray(transactionUiIds)) {\r\n\t\t\ttransactionUiIds = [ transactionUiIds ];\r\n\t\t}\r\n\t\tfor( let i in transactionUiIds ) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId ) ) {\r\n\t\t\t\tstate.transactions[ transactionUiId ]._meta.removing = false;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tupdateAppendTransaction: function ( state, transaction ) {\r\n\t\tif( Object.prototype.hasOwnProperty.call(state.transactions, transaction.publicIdentifier)) {\r\n\t\t\tObject.assign(state.transactions[ transaction.transactionUiId ], transaction)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tVue.set(state.transactions, transaction.transactionUiId, transaction)\r\n\t\t}\r\n\t},\r\n\r\n\tdefineTransactionShells: function ( state, transactionUiIds ) {\r\n\t\tfor( let i in transactionUiIds) {\r\n\t\t\tlet transactionUiId = transactionUiIds[i];\r\n\t\t\tif( !Object.prototype.hasOwnProperty.call(state.transactions, transactionUiId)) {\r\n\t\t\t\tlet transactionShell = {\r\n\t\t\t\t\tpublicIdentifier:transactionUiId,\r\n\t\t\t\t\t_meta:{\r\n\t\t\t\t\t\tloading:true,\r\n\t\t\t\t\t\tremoving:false,\r\n\t\t\t\t\t\tfetched:null,\r\n\t\t\t\t\t\tfetching:false\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tVue.set(state.transactions, transactionUiId, transactionShell)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tsetFetchingVaults: function ( state, val ) {\r\n\t\tstate.fetchingVaults = val;\r\n\t},\r\n\r\n\tsetVaults:function(state, vaults) {\r\n\t\tstate.vaults = vaults;\r\n\t},\r\n\r\n\tsetFetchingBlankPaymentClient: function ( state, val ) {\r\n\t\tstate.fetchingBlankPaymentClient = val;\r\n\t},\r\n\r\n\tsetBlankPaymentClient:function(state, blankPaymentClient) {\r\n\t\tstate.blankPaymentClient = blankPaymentClient;\r\n\t},\r\n\r\n\tsetFetchingHistoricalTransactions: function ( state, val ) {\r\n\t\tstate.fetchingHistoricalTransactions = val;\r\n\t},\r\n\r\n\tsetHistoricalTransactions:function(state, transactions) {\r\n\t\tstate.historicalTransactions = transactions;\r\n\t},\r\n\r\n\tsetFetchingScheduledTransactions: function ( state, val ) {\r\n\t\tstate.fetchingScheduledTransactions = val;\r\n\t},\r\n\r\n\tsetScheduledTransactions:function(state, transactions) {\r\n\t\tstate.scheduledTransactions = transactions;\r\n\t},\r\n\r\n\tremoveScheduledTransaction:function(state, transactionId) {\r\n\t\tlet index = null;\r\n\t\tfor(let i in state.scheduledTransactions) {\r\n\t\t\tif(state.scheduledTransactions[i].id==transactionId) {\r\n\t\t\t\tindex = i;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(index!==null) {\r\n\t\t\tstate.scheduledTransactions.splice( index, 1 )\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n\r\nexport default {\r\n\tnamespaced: true,\r\n\tstate,\r\n\tgetters,\r\n\tactions,\r\n\tmutations\r\n}\r\n","import {ApiError} from '@gcgov/apiservice';\r\nimport jwt_decode from 'jwt-decode';\r\nimport Vue from 'vue';\r\n\r\nimport * as constants from '@/constants';\r\nimport { waitUntil } from '@/constants';\r\nimport CitizenApiError from '@/errors/citizen/CitizenApiError';\r\nimport CitizenMaintenanceError from '@/errors/citizen/CitizenMaintenanceError';\r\nimport CitizenConnectApiService from '@/services/citizen/CitizenConnectApiService';\r\nimport PermitsApiService from '@/services/citizen/PermitsApiService';\r\n\r\nconst storeKey = 'citizen.store.permit';\r\n\r\nconst getDefaultState = () => {\r\n\treturn {\r\n\t\taccessToken: '',\r\n\t\tuser: {},\r\n\t\tprojects: {},\r\n\r\n\t\tprojectRequests: {},\r\n\r\n\t\tpaymentClients: {},\r\n\r\n\t\trunningGetMemberAccounts: false,\r\n\r\n\t\tfetchingBlankPaymentClient: false,\r\n\t\tblankPaymentClient: null,\r\n\r\n\r\n\t\tfetchingKeyValueItems: false,\r\n\t\tkeyValueItems: [],\r\n\t\tkeyValueItemsLastFetched: null,\r\n\r\n\t\tmoduleStatusLastChecked: null\r\n\t}\r\n}\r\n\r\n\r\nconst state = getDefaultState()\r\n\r\nconst getters = {\r\n\r\n\tprojects: function( state ) {\r\n\t\treturn state.projects;\r\n\t},\r\n\tprojectRequests: function( state ) {\r\n\t\treturn state.projectRequests;\r\n\t},\r\n\r\n\tmemberProjects: function( state, getters, rootState, rootGetters ) {\r\n\t\tlet projectKeys = rootGetters[ \"citizenMember/accountNumbers\" ]( constants.PAYMENT_TYPE_PERMIT_CODE );\r\n\t\tlet projects = [];\r\n\t\tfor( let i in projectKeys ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call( state.projects, projectKeys[ i ].projectId ) ) {\r\n\t\t\t\tprojects.push( state.projects[ projectKeys[ i ].projectId ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn projects;\r\n\t},\r\n\r\n\tmemberProjectRequests: function( state, getters, rootState, rootGetters ) {\r\n\t\tlet projectRequestKeys = rootGetters[ \"citizenMember/accountNumbers\" ]( constants.PAYMENT_TYPE_PERMIT_REQUEST_CODE );\r\n\t\tlet projectRequests = [];\r\n\t\tfor( let i in projectRequestKeys ) {\r\n\t\t\tif( Object.prototype.hasOwnProperty.call( state.projectRequests, projectRequestKeys[ i ].projectRequestId ) ) {\r\n\t\t\t\tprojectRequests.push( state.projectRequests[ projectRequestKeys[ i ].projectRequestId ] );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn projectRequests;\r\n\t},\r\n\r\n\r\n\tkeyValueItemCollection: function( state ) {\r\n\t\tlet keyValueItemObj = {};\r\n\t\tfor( let i = 0; i