\n
Aguarde, em alguns minutos entraremos em contato.
\nEstamos conectando...
\nCarregando...
\",\n hash: \"\",\n vinculos: [{ label: \"Saúde - Associado\", value: 1 }],\n vinculoAdicionado: false,\n cpf: \"\",\n credNumber: \"\",\n newEmail: \"\",\n emails: [],\n name: \"\",\n error: \"\"\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async accpetTerms(context) {\n const ret = await pa.AceitarTermo({ hash: context.state.hash });\n return ret && ret.Data;\n },\n async fetchTerms(context, { device }) {\n const terms = await pa.TermoAceiteAtual({ device });\n\n await context.commit(\"SET_TERM\", terms.Data.Termo);\n await context.commit(\"SET_HASH\", terms.Data.Hash);\n },\n async fetchVinculos(context) {\n let vincs = {};\n\n if (context.state.cpf !== \"\") {\n vincs = await pa.ValidarVinculoPorCPF({\n hash: context.state.hash,\n cpf: context.state.cpf\n });\n } else if (context.state.credNumber !== \"\") {\n vincs = await pa.ValidarVinculo({\n hash: context.state.hash,\n vinculo: context.state.credNumber\n });\n } else {\n return;\n }\n if (vincs && vincs.Data) {\n await context.commit(\"SET_VINCULO_ADICIONADO\", vincs.Data.ApenasAdicionarVinculo ?? false);\n await context.commit(\"SET_EMAILS\", vincs.Data.EmailsOfuscados ?? vincs.Data.Emails);\n if (vincs.Data.PerfilVinculo) {\n await context.commit(\"SET_NAME\", vincs.Data.PerfilVinculo.DescricaoIdentificacaoVinculo);\n await context.commit(\"SET_CPF\", vincs.Data.PerfilVinculo.NumeroDocumento);\n }\n return \"\";\n } else {\n await context.commit(\"SET_EMAILS\", []);\n await context.commit(\"SET_NAME\", \"\");\n await context.commit(\"SET_CPF\", \"\");\n return vincs && vincs instanceof Error ? vincs.message : \"Serviço temporariamente indisponível\";\n }\n },\n async addEmail(context, { email }) {\n const ret = await pa.CadastrarEmail({\n hash: context.state.hash,\n cpf: context.state.cpf,\n email\n });\n return ret && ret.Data ? \"\" : ret && ret instanceof Error ? ret.message : \"Serviço temporariamente indisponível\";\n },\n async checkCode(context, { codigo }) {\n const ret = await pa.InformarConfirmacao({ hash: context.state.hash, codigo });\n return ret && ret.Data ? \"\" : ret && ret instanceof Error ? ret.message : \"Serviço temporariamente indisponível\";\n },\n async createUser(context, { senha }) {\n const ret = await pa.CadastrarUsuarioOmint({ hash: context.state.hash, senha });\n return ret && ret.Data ? \"\" : ret && ret instanceof Error ? ret.message : \"Serviço temporariamente indisponível\";\n },\n async sendCode(context, { email }) {\n const ret = await pa.EnviarConfirmacao({\n hash: context.state.hash,\n email\n });\n return ret && ret.Data ? \"\" : ret && ret instanceof Error ? ret.message : \"Serviço temporariamente indisponível\";\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_VINCULO_ADICIONADO: (state, nextValue) => {\n Vue.set(state, \"vinculoAdicionado\", nextValue);\n },\n SET_TERM: (state, nextTerm) => {\n Vue.set(state, \"term\", nextTerm);\n },\n SET_HASH: (state, nextTerm) => {\n Vue.set(state, \"hash\", nextTerm);\n },\n SET_CPF: (state, nextCPF) => {\n Vue.set(state, \"cpf\", nextCPF);\n },\n SET_CRED: (state, nextCred) => {\n Vue.set(state, \"credNumber\", nextCred);\n },\n SET_EMAILS: (state, nextEmails) => {\n Vue.set(state, \"emails\", nextEmails);\n },\n SET_NAME: (state, nextName) => {\n Vue.set(state, \"name\", nextName);\n }\n }\n};\n","import Vue from \"vue\";\nimport { MeusDocumentos } from \"../api/associado\";\nimport { getStorageData, setStorageData } from \"@/utils/storageUtil\";\n\nlet initialState = {\n myFiles: null,\n doc: {}\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async listFiles(context) {\n if (!context.state.myFiles) {\n const filesStorage = getStorageData(\"myFiles\", []);\n if (filesStorage && filesStorage.length > 0) {\n await context.commit(\"SET_FILES\", filesStorage);\n } else {\n const files = await MeusDocumentos({\n vinculo: context.rootState.saude.vinculo\n });\n if (files.Data) {\n await context.commit(\"SET_FILES\", files.Data);\n }\n return;\n }\n }\n MeusDocumentos({\n vinculo: context.rootState.saude.vinculo\n }).then(files => {\n if (files.Data) {\n context.commit(\"SET_FILES\", files.Data);\n }\n });\n }\n },\n mutations: {\n LOGOUT_USER: state => {\n Object.keys(state).forEach(p => {\n Vue.set(state, p, initialState[p]);\n setStorageData(p, null);\n });\n },\n RESET_CONTEXT: state => {\n Object.keys(state).forEach(p => {\n Vue.set(state, p, initialState[p]);\n setStorageData(p, null);\n });\n },\n SET_FILES: (state, files) => {\n const prop = \"myFiles\";\n const newData = Vue.set(state, prop, files);\n setStorageData(prop, newData);\n },\n SET_DOC: (state, { name, url }) => {\n const doc = { name, url };\n Vue.set(state, \"doc\", doc);\n }\n }\n};\n","import Vue from \"vue\";\nimport { ListarFaturas, ObterFatura } from \"@/api/associado\";\n\nconst initialState = {\n statements: []\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async listStatements(context) {\n const statements = await ListarFaturas({\n vinculo: context.rootState.saude.vinculo\n });\n if (statements.Data !== null) {\n await statements.Data.forEach(s =>\n ObterFatura({\n vinculo: context.rootState.saude.vinculo,\n nrTitulo: s.NrTitulo\n }).then(url => (s.url = url))\n );\n await context.commit(\"SET_STATEMENTS\", statements.Data);\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_STATEMENTS: (state, next) => Vue.set(state, \"statements\", next)\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/Reembolso`;\n\nexport async function HistoricoReembolso({ vinculo, reembolso }) {\n return await window.$axios\n .get({\n url: `${baseURL}/Historico`,\n query: {\n vinculo,\n reembolso\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"HistoricoReembolso\", error.message);\n return error;\n });\n}\n\nexport async function ValidarBeneficiarioReembolsoDigital({ vinculo }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ValidarBeneficiarioReembolsoDigital`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ValidarBeneficiarioReembolsoDigital\", error.message);\n return error;\n });\n}\n\nexport async function ObterLimiteArquivosPedido({ vinculo }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ObterLimiteArquivosPedido`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterLimiteArquivosPedido\", error.message);\n return error;\n });\n}\n\nexport async function DetalheProtocolo({ vinculo, protocolo }) {\n return await window.$axios\n .get({\n url: `${baseURL}/DetalheProtocolo`,\n query: {\n vinculo,\n protocolo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"DetalheProtocolo\", error.message);\n throw error;\n });\n}\n\nexport async function ObterProtocolos({ vinculo, periodo, protocolo, chamado }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ObterProtocolos`,\n query: {\n vinculo,\n periodo,\n protocolo: protocolo || \"\",\n chamado: chamado || 0\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterProtocolos\", error.message);\n throw error;\n });\n}\n\nexport async function ObterImagem({ vinculo, documento, original }) {\n const key = `${vinculo};${documento};${original ? \"T\" : \"F\"}`;\n const chave = `${window.$jse.encrypt(key)}`;\n return await window.$axios\n .get({\n url: `${baseURL}/ObterImagem`,\n query: {\n vinculo,\n chave,\n original\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterImagem\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport function ObterDocumento({ vinculo, documento }) {\n const key = `${vinculo};${documento}`;\n const chave = `${window.$jse.encrypt(key)}`;\n\n const queryString = new URLSearchParams({\n vinculo,\n chave,\n tipo: \".pdf\"\n }).toString();\n\n return `${baseURL}/ObterDocumento?${queryString}`;\n}\n\nexport function ObterDemonstrativo({ vinculo, protocolo, documento }) {\n const key = `${vinculo};${protocolo};${documento}`;\n const chave = `${window.$jse.encrypt(key)}`;\n\n const queryString = new URLSearchParams({\n vinculo,\n chave,\n tipo: \".pdf\"\n }).toString();\n\n return `${baseURL}/ObterDemonstrativo?${queryString}`;\n}\n\nexport async function ObterTiposAnexos({ vinculo }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ObterTiposAnexos`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterTiposAnexos\", error.message);\n throw error;\n });\n}\n\nexport async function ObterPerguntaAuditoria({ vinculo, autenticacao, chamado, protocolo, pergunta }) {\n return window.$axios\n .post({\n url: `${baseURL}/ObterPerguntaAuditoria`,\n query: {\n vinculo\n },\n data: {\n autenticacao,\n chamado,\n protocolo,\n pergunta\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function ResponderAuditoria({ vinculo, autenticacao, chamado, protocolo, auditoria, pergunta, resposta }) {\n return window.$axios\n .post({\n url: `${baseURL}/ResponderAuditoria`,\n query: {\n vinculo\n },\n data: {\n id: auditoria,\n autenticacao,\n pergunta,\n resposta,\n chamado,\n protocolo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function EncerrarAuditoria({\n vinculo,\n autenticacao,\n chamado,\n protocolo,\n auditoria,\n anexos,\n observacao,\n solicitacaoCancelamento\n}) {\n return window.$axios\n .post({\n url: `${baseURL}/EncerrarAuditoria`,\n query: {\n vinculo\n },\n data: {\n id: auditoria,\n autenticacao,\n chamado,\n protocolo,\n anexos,\n observacao,\n solicitacaoCancelamento\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n","import Vue from \"vue\";\nimport * as api from \"@/api/reembolso\";\nimport { ListarBeneficiarioContaCredito } from \"@/api/associado\";\nimport * as atendimento from \"@/api/atendimento\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst mapProtocolState = {\n L: {\n name: \"released\",\n color: \"var(--colors-light-support-success)\",\n docName: \"Recibo/NF\"\n },\n D: {\n name: \"refused\",\n color: \"var(--colors-light-support-error)\",\n docName: null\n },\n C: {\n name: \"canceled\",\n color: \"var(--colors-light-support-error)\",\n docName: null\n },\n P: {\n name: \"waitingForRegularization\",\n color: \"var(--colors-light-support-warning)\",\n docName: null\n },\n E: {\n name: \"entrada\",\n color: \"var(--colors-light-primary-dark-blue)\",\n docName: null\n },\n A: {\n name: \"inAnalysis\",\n color: \"var(--colors-light-primary-dark-blue)\",\n docName: null\n },\n U: {\n name: \"audit\",\n color: \"var(--colors-light-support-error)\",\n docName: null\n }\n};\n\nconst initialState = {\n refunds: [],\n filters: [],\n sorts: [\"Mais recentes\", \"Mais antigos\"],\n activedSort: \"\",\n protocols: [],\n beneficiaries: null,\n addPermission: false,\n options: [{ label: \"Últimos 30\", value: 0 }],\n pendencies: [],\n terms: \"\",\n attachmentTypes: {},\n lastFetch: 0,\n maxFiles: 0,\n newRefund: null,\n authorizationId: null,\n audit: {}\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n getters: {\n getNewRefundType: context => {\n return context.newRefund?.type;\n },\n hasActivedFilter: context => {\n const activedFilters = context.filters.filter(filter => !!filter.isActive);\n return activedFilters.length > 0;\n },\n beneficiariesList: context =>\n Object.keys(context.beneficiaries ?? []).map(bName => ({\n label: bName,\n value: bName\n })),\n filteredRefunds: context => {\n let sortedRefunds = [];\n\n const activedFilters = context.filters.filter(filter => filter.isActive);\n if (activedFilters.length) {\n activedFilters.forEach(filter => {\n sortedRefunds.push(\n ...context.protocols.filter(\n refund => !!refund.resumeDocTypes.find(type => type.description === filter.label)\n )\n );\n });\n } else {\n sortedRefunds = JSON.parse(JSON.stringify(context.protocols));\n }\n\n const sorts = {\n dateToNum(d) {\n d = d.split(\"/\");\n return new Date(d[2], Number(d[1]) - 1, d[0]).getTime();\n },\n \"Mais recentes\"() {\n sortedRefunds.sort((a, b) => {\n return this.dateToNum(b.createdAt) - this.dateToNum(a.createdAt);\n });\n },\n \"Mais antigos\"() {\n sortedRefunds.sort((a, b) => {\n return this.dateToNum(a.createdAt) - this.dateToNum(b.createdAt);\n });\n }\n };\n\n if (context.activedSort) sorts[context.activedSort]();\n\n return sortedRefunds;\n }\n },\n actions: {\n async fetchAddPermission(context) {\n const infos = await api.ValidarBeneficiarioReembolsoDigital({\n vinculo: context.rootState.saude.vinculo\n });\n let refundNewPermission = false;\n if (infos && infos.Data && infos.Data.length > 0) {\n refundNewPermission = infos.Data[0].AtReembolsoDigital === 1;\n }\n context.commit(\"SET_ADD_PERMISSION\", refundNewPermission);\n },\n async fetchBeneficiaries(context) {\n const resp = await ListarBeneficiarioContaCredito({\n vinculo: context.rootState.saude.vinculo,\n servico: 0\n });\n resp.Data.forEach(r => context.commit(\"SET_BENEFICIARY\", r));\n },\n async fetchDetail(context, refundId) {\n if (context.state.refunds.length === 0) {\n await context.dispatch(\"fetchList\", true);\n }\n const id = Number.parseInt(refundId);\n const refund = context.state.refunds.filter(r => r.IdReembolso === id);\n if (refund.length > 0) {\n return refund[0];\n }\n },\n async fetchDetailHistory(context, refundId) {\n return api.HistoricoReembolso({\n vinculo: context.rootState.saude.vinculo,\n reembolso: refundId\n });\n },\n async fetchMaxFiles(context) {\n if (context.state.maxFiles > 0) return context.state.maxFiles;\n\n const response = await api.ObterLimiteArquivosPedido({\n vinculo: context.rootState.saude.vinculo\n });\n if (response?.Data > 0) {\n context.commit(\"SET_MAX_FILES\", response.Data);\n return response.Data;\n }\n return 6; // padrão para pedidos de reembolso\n },\n async fetchProtocols(context, options) {\n const protocolo = context.state.protocols.length > 0 ? options?.protocol ?? \"\" : \"\";\n const chamado = context.state.protocols.length > 0 ? options?.ticket ?? 0 : 0;\n\n const resolveProtocolData = data => ({\n protocol: data.Protocolo,\n ticket: data.Chamado,\n createdAt: data.DtInicio,\n canEvaluate: data.NotaAvaliacao === null,\n resumeDocTypes: data.Resumo.map(t => ({\n type: t.Tipo,\n description: t.Dsc,\n color: mapProtocolState[t.Tipo]?.color ?? \"var(--colors-light-primary-dark-blue)\",\n total:\n (t.Tipo === \"A\" && t.Dsc === \"Em triagem\") ||\n t.Tipo === \"E\" ||\n t.Tipo === \"L\" ||\n (t.Tipo === \"A\" && t.Val === \"R$ 0,00\")\n ? null\n : t.Val,\n count: t.Qtd\n }))\n });\n const response = await api.ObterProtocolos({\n vinculo: context.rootState.saude.vinculo,\n periodo: 3,\n protocolo,\n chamado\n });\n if (response?.Data?.length) {\n let protocols = [];\n if (chamado > 0 || protocolo !== \"\") {\n context.commit(\"SET_NEW_REFUND\", null);\n // adicionar o que falta, atualiza o que existe\n let novoProtocolo = true;\n protocols = context.state.protocols.map(p => {\n if (p.ticket === chamado || p.protocol === protocolo) {\n novoProtocolo = false;\n return resolveProtocolData(response.Data[0]);\n } else {\n return p;\n }\n });\n if (novoProtocolo) {\n protocols = [resolveProtocolData(response.Data[0])].concat(protocols);\n }\n } else {\n protocols = response.Data.map(p => resolveProtocolData(p));\n }\n context.commit(\"SET_PROTOCOLS\", protocols);\n }\n },\n async fetchProtocolDetail(context, { protocol }) {\n const response = await api.DetalheProtocolo({\n vinculo: context.rootState.saude.vinculo,\n protocolo: protocol\n });\n const resolveDocuments = (situacao, documento, ehFiscal, temImagem) => {\n const docs = [];\n if (!documento) return docs;\n docs.push({\n id: documento,\n label: ehFiscal ? mapProtocolState[situacao]?.docName ?? \"Recibo/NF\" : \"Documento\",\n source: temImagem\n ? api.ObterDocumento({\n vinculo: context.rootState.saude.vinculo,\n documento\n })\n : null\n });\n return docs;\n };\n const resolveDemonstrativo = (situacao, descricaoSituacao, protocolo, documento) => {\n if (situacao === \"L\" && descricaoSituacao?.toLowerCase() === \"crédito liberado\") {\n return {\n id: documento,\n label: \"Demonstrativo de pagamento\",\n source: api.ObterDemonstrativo({\n vinculo: context.rootState.saude.vinculo,\n protocolo,\n documento\n })\n };\n }\n return null;\n };\n const obsHistory = obs => {\n if (!obs?.length) return [];\n return obs.map(o => ({\n Data: o.Data,\n Obs: o.Obs ? o.Obs.split(\"\\n\") : []\n }));\n };\n const respData = response.Data;\n respData.Situacao = respData.Situacao.map(s => ({\n ...s,\n emTriagem: (s.Tipo === \"A\" && s.Dsc === \"Em triagem\") || s.Tipo === \"E\"\n }));\n respData.showValues = !respData.Situacao.find(s => s.emTriagem);\n return {\n protocol: respData.Protocolo,\n obsProtocol: respData.ObservacaoProtocolo,\n obsHistory: obsHistory(respData.Observacoes),\n beneficiary: respData.Beneficiario,\n createdAt: respData.DtInicio,\n totalAmount: respData.Total,\n showValues: respData.showValues,\n docsLabel: respData.Situacao.find(s => s.emTriagem || s.Documentos.find(d => !d.DocFiscal))\n ? \"Documento(s)\"\n : \"Documentos Fiscais\",\n accountDetails: {\n name: respData.Favorecido,\n account: respData.Conta,\n agency: respData.Agencia,\n bank: respData.Banco\n },\n refunds: respData.Situacao.map(s => ({\n status: s.Tipo,\n description: s.Dsc,\n color: mapProtocolState[s.Tipo]?.color ?? \"var(--colors-light-primary-dark-blue)\",\n total: s.Tipo !== \"L\" && s.Tipo !== \"D\" && !s.Documentos.find(d => d.DocFiscal) ? null : s.Total,\n showValues: !(s.emTriagem || (s.Tipo !== \"L\" && s.Tipo !== \"D\" && !s.Documentos.find(d => d.DocFiscal))),\n pictures: s.emTriagem ? s.Documentos.map(d => ({ id: d.Documento })) ?? [] : [],\n list: s.Chamados.map(c => ({\n ticket: c.Chamado,\n dueDate: c.DtLimite,\n pendencies: c.Pendencias,\n devolutionGroups: c.GruposDevolucao,\n docs: c.Docs.map(d => ({\n ticket: d.Chamado,\n provider: d.Prestador,\n createdAt: d.DocFiscal ? d.DtAtendimento : null,\n creditedAt: d.DocFiscal ? d.DtLiberacao : null,\n requestedValue: d.DocFiscal ? d.VlApresentado : null,\n refundedValue: d.DocFiscal ? d.VlReembolsoTotalProtocolo : null,\n dscCompl: d.DocFiscal ? null : \"Documento complementar\",\n reasonsPendencieRefused: d.Motivos,\n receipts: resolveDocuments(s.Tipo, d.Documento, d.DocFiscal, d.DocImagem),\n demonstrativo: resolveDemonstrativo(s.Tipo, s.Dsc, respData.Protocolo, d.Documento)\n })).sort((a, b) => {\n if (a.dscCompl && !b.dscCompl) return 1;\n if (!a.dscCompl && b.dscCompl) return -1;\n return 0;\n })\n }))\n })),\n pictures: respData.Imagens.map(i => ({\n id: i\n }))\n };\n },\n async fetchProtocolDetailImage(context, { documento, original }) {\n return await api.ObterImagem({\n vinculo: context.rootState.saude.vinculo,\n documento,\n original\n });\n },\n async fetchTerms(context) {\n await context.dispatch(\"fetchAttachmentTypes\");\n const refundTermId = 1;\n const refundTerms = await atendimento.OperacaoPerfilOmintTermoAceiteWeb({\n vinculo: context.rootState.saude.vinculo,\n termo: refundTermId\n });\n if (refundTerms.Data) {\n context.commit(\"SET_TERMS\", refundTerms.Data);\n }\n },\n async fetchAttachmentTypes(context) {\n const response = await api.ObterTiposAnexos({\n vinculo: context.rootState.saude.vinculo\n });\n if (response?.Data) {\n context.commit(\"SET_ATTACHMENT_TYPES\", response.Data);\n }\n },\n async getDocument(context, infos) {\n return await atendimento.ObterDocumento({\n vinculo: context.rootState.saude.vinculo,\n chamado: infos.ticket,\n documento: infos.document\n });\n },\n updateRefundData(context) {\n // monta as opções de filtro\n const options = context.state.refunds.map(r => {\n return new Date(r.DataEntrada).getFullYear();\n });\n const filter = options.filter((d, i) => options.indexOf(d) === i);\n const ops = filter.map(o => ({ label: `${o}`, value: o }));\n context.commit(\"SET_OPTIONS\", ops);\n },\n returnRefundTicket: async (context, { protocolo, observacao, arquivos }) => {\n checkUpdatePermission();\n return await atendimento.RetornoPendenciaReembolso({\n vinculo: context.rootState.saude.vinculo,\n protocolo,\n observacao,\n arquivos\n });\n },\n createRefundTicket: async (context, { arquivos, beneficiario, contacorrente, observacao }) => {\n checkUpdatePermission();\n return await atendimento.NovaSolicitacaoReembolso({\n vinculo: context.rootState.saude.vinculo,\n arquivos,\n beneficiario,\n contacorrente,\n observacao,\n autenticacao: context.state.authorizationId\n });\n },\n checkRefundTicket: async (context, { beneficiario }) => {\n return await atendimento.ConsultaChamadoReembolsoAtual({\n vinculo: context.rootState.saude.vinculo,\n beneficiario\n });\n },\n fetchAuditQuestion: async (context, { ticket, protocol, questionTypeId }) => {\n const audit =\n context.state.audit?.ticket === ticket\n ? JSON.parse(JSON.stringify(context.state.audit))\n : {\n id: 0,\n ticket,\n protocol,\n cancel: false,\n files: false,\n finish: false\n };\n if (audit[questionTypeId]) return;\n try {\n const response = await api.ObterPerguntaAuditoria({\n vinculo: context.rootState.saude.vinculo,\n autenticacao: context.state.authorizationId,\n chamado: ticket,\n protocolo: protocol,\n pergunta: questionTypeId\n });\n audit[questionTypeId] = {\n text: response.Data.DsPergunta,\n options: response.Data.Opcoes.map(o => ({ id: o.Id, label: o.Texto })),\n response: 0\n };\n context.commit(\"SET_AUDIT\", audit);\n } catch (error) {\n throw new Error(error.message);\n }\n },\n saveAuditResponse: async (context, { questionTypeId, option }) => {\n checkUpdatePermission();\n try {\n const response = await api.ResponderAuditoria({\n vinculo: context.rootState.saude.vinculo,\n autenticacao: context.state.authorizationId,\n chamado: context.state.audit.ticket,\n protocolo: context.state.audit.protocol,\n auditoria: context.state.audit.id,\n pergunta: questionTypeId,\n resposta: option\n });\n const audit = JSON.parse(JSON.stringify(context.state.audit));\n const data = response.Data;\n audit.id = data.Id;\n audit.cancel = data.CancelarProtocolo;\n audit.files = data.AnexarComplementos;\n audit.finish = data.EncerrarFluxo;\n audit[questionTypeId].response = option;\n if (!audit.finish) {\n audit[data.IdPergunta] = {\n text: data.DsPergunta,\n options: data.Opcoes.map(o => ({ id: o.Id, label: o.Texto }))\n };\n }\n context.commit(\"SET_AUDIT\", audit);\n return data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n cancelAudit: async (context, { ticket, protocol, obs }) => {\n checkUpdatePermission();\n try {\n const response = await api.EncerrarAuditoria({\n vinculo: context.rootState.saude.vinculo,\n autenticacao: context.state.authorizationId,\n chamado: ticket,\n protocolo: protocol,\n auditoria: 0,\n anexos: [],\n observacao: obs,\n solicitacaoCancelamento: true\n });\n return response.Data.ProtocoloANS;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n finishAudit: async (context, { files, obs }) => {\n checkUpdatePermission();\n try {\n const response = await api.EncerrarAuditoria({\n vinculo: context.rootState.saude.vinculo,\n autenticacao: context.state.authorizationId,\n chamado: context.state.audit.ticket,\n protocolo: context.state.audit.protocol,\n auditoria: context.state.audit.id,\n anexos: files,\n observacao: obs,\n solicitacaoCancelamento: false\n });\n return response.Data.ProtocoloANS;\n } catch (error) {\n throw new Error(error.message);\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_ADD_PERMISSION: (state, permission) => Vue.set(state, \"addPermission\", permission),\n SET_BENEFICIARY: (state, ben) => {\n if (ben === undefined) return;\n Vue.set(state, \"beneficiaries\", { ...state.beneficiaries, [ben.Nome]: ben });\n },\n SET_OPTIONS: (state, opts) => Vue.set(state, \"options\", [{ label: \"Últimos 30\", value: 0 }, ...opts]),\n SET_PROTOCOLS: (state, protocols) => {\n Vue.set(state, \"protocols\", protocols);\n\n const filters = [];\n protocols.forEach(r => r.resumeDocTypes.forEach(t => filters.push(t.description)));\n\n Vue.set(\n state,\n \"filters\",\n [...new Set(filters)].sort().map(f => ({\n label: f,\n isActive: state.filters.find(current => current.label === f)?.isActive ?? false\n }))\n );\n },\n SET_PENDENCIES: (state, pendencies) => Vue.set(state, \"pendencies\", pendencies),\n SET_REFUNDS: (state, refunds) => {\n let cache = {};\n // retira Ids duplicados\n const rfs = refunds.filter(r => {\n if (cache[r.IdReembolso]) {\n return false;\n }\n cache[r.IdReembolso] = true;\n return true;\n });\n\n Vue.set(state, \"refunds\", rfs);\n },\n SET_TERMS: (state, terms) => Vue.set(state, \"terms\", terms),\n SET_ATTACHMENT_TYPES: (state, attachmentTypes) => Vue.set(state, \"attachmentTypes\", attachmentTypes),\n SET_LAST_FETCH: (state, ticks) => Vue.set(state, \"lastFetch\", ticks),\n SET_MAX_FILES: (state, maxFiles) => Vue.set(state, \"maxFiles\", maxFiles),\n SET_NEW_REFUND: (state, newRefund) => Vue.set(state, \"newRefund\", newRefund),\n SET_ACTIVED_SORT: (state, activedSort) => Vue.set(state, \"activedSort\", activedSort),\n SET_FILTERS: (state, filters) => Vue.set(state, \"filters\", filters),\n SET_AUTHORIZATION_ID: (state, authorizationId) => Vue.set(state, \"authorizationId\", authorizationId),\n SET_AUDIT: (state, audit) => Vue.set(state, \"audit\", audit)\n }\n};\n","import Vue from \"vue\";\nimport * as api from \"../api/atendimento\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n tickets: [],\n listOption: \"30\",\n ratingRoute: \"\",\n ratingType: 0\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async listTickets(context) {\n const tickets = await api.Lista({\n vinculo: context.rootState.saude.vinculo,\n situacao: null,\n chamado: 0,\n classificacao: -1,\n demanda: -1,\n tipoCliente: 1,\n cpf: null\n });\n if (tickets && tickets.Data && tickets.Data.Atendimentos) {\n await context.commit(\"SET_TICKETS\", tickets.Data.Atendimentos);\n }\n },\n async fetchTicketDocuments(context, { ticket }) {\n const response = await api.ListarDocumentos({\n vinculo: context.rootState.saude.vinculo,\n chamado: ticket\n });\n return response && response instanceof Error ? [] : response?.Data ?? [];\n },\n async setListOption(context, option) {\n context.commit(\"SET_LIST_OPTION\", option);\n },\n async getDocument(context, infos) {\n return await api.ObterDocumento({\n vinculo: context.rootState.saude.vinculo,\n chamado: infos.ticket,\n documento: infos.document\n });\n },\n async findTicket(context, ticket) {\n if (context.state.tickets.length > 0) {\n const ticketInfos = context.state.tickets.filter(r => r.IdChamado === ticket);\n if (ticketInfos && ticketInfos.length > 0) {\n const detalheChamado = await api.DetalharChamado({\n vinculo: context.rootState.saude.vinculo,\n chamado: ticket\n });\n\n if (detalheChamado && detalheChamado.Data) {\n ticketInfos[0].Imagens = detalheChamado.Data.Imagens;\n ticketInfos[0].Observacoes = detalheChamado.Data.Observacoes;\n }\n\n return ticketInfos[0];\n }\n }\n const tickets = await api.Lista({\n vinculo: context.rootState.saude.vinculo,\n situacao: null,\n chamado: ticket,\n classificacao: -1,\n demanda: -1,\n tipoCliente: 1,\n cpf: null\n });\n if (tickets && tickets.Data && tickets.Data.Atendimentos) {\n tickets.Data.Atendimentos.push(...context.state.tickets);\n context.commit(\"SET_TICKETS\", tickets.Data.Atendimentos);\n\n const detalheChamado = await api.DetalharChamado({\n vinculo: context.rootState.saude.vinculo,\n chamado: tickets.Data.Atendimentos[0].IdChamado\n });\n\n if (detalheChamado && detalheChamado.Data) {\n tickets.Data.Atendimentos[0].Imagens = detalheChamado.Data.Imagens;\n tickets.Data.Atendimentos[0].Observacoes = detalheChamado.Data.Observacoes;\n }\n\n return tickets.Data.Atendimentos[0];\n }\n return null;\n },\n async createNewTicket(context, { obs, files, refTicket, classification }) {\n checkUpdatePermission();\n return api.NovoAtendimento({\n vinculo: context.rootState.saude.vinculo,\n observacao: obs,\n arquivos: files,\n chamadoReferenciado: refTicket,\n classificacao: classification\n });\n },\n async fetchQuestionsExpRating(context, { ticket, type, stage }) {\n const response = await api.ObterPerguntasAvaliacao({\n vinculo: context.rootState.saude.vinculo,\n atendimento: ticket,\n tipo: type,\n etapa: stage\n });\n const rules = response instanceof Error ? {} : response.Data ?? {};\n return {\n label: rules.RotuloTextoLivre,\n questions:\n rules.Perguntas?.map(q => ({\n value: q.Id,\n label: q.Dsc,\n maxRating: q.NotaMaximaExibicao,\n required: q.Obrigatorio,\n options:\n q.Opcoes.map(o => ({\n value: o.Id,\n label: o.Dsc\n })) ?? [],\n exceptions:\n q.Excecoes?.map(e => ({\n question: e.Pergunta,\n option: e.Opcao\n })) ?? []\n })) ?? []\n };\n },\n async fetchResponsesExpRating(context, { ticket, type, stage }) {\n const response = await api.ObterRespostasAvaliacao({\n vinculo: context.rootState.saude.vinculo,\n atendimento: ticket,\n tipo: type,\n etapa: stage\n });\n return response instanceof Error ? {} : response.Data ?? {};\n },\n async saveExpRating(context, { ticket, type, step, acknowledged, rating, obs, responses }) {\n checkUpdatePermission();\n const response = await api.AvaliacaoAtendimento({\n vinculo: context.rootState.saude.vinculo,\n atendimento: ticket,\n tipo: type,\n etapa: step,\n confirma: acknowledged,\n nota: rating,\n obs,\n respostas: responses\n });\n if (response instanceof Error) throw response;\n return response;\n },\n async fetchAuthType(context, { service, type, rules }) {\n let tipo = \"S\";\n if (service && !service.startsWith(\"/\")) {\n try {\n service = context.rootGetters[service];\n } catch (error) {\n window.$log.message(`using service ${service}`);\n }\n }\n if (type) {\n try {\n const stateType = context.rootGetters[type];\n if (stateType === false) {\n tipo = \"N\";\n }\n } catch (error) {\n // não funcionou o get\n tipo = \"S\";\n }\n }\n\n const response = await api.ObterAutorizador({\n vinculo: context.rootState.saude.vinculo,\n servico: service,\n tipo,\n regras: rules\n });\n if (response instanceof Error) throw new Error(\"Não foi possível obter o tipo de autenticação necessária\");\n return response.Data ?? { Autorizador: \"\", Id: 0, Autorizadores: [] };\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_TICKETS: (state, nextTickets) => {\n Vue.set(state, \"tickets\", nextTickets);\n },\n SET_LIST_OPTION: (state, option) => {\n Vue.set(state, \"listOption\", option);\n },\n SET_RATING_INFOS: (state, { ratingRoute, ratingType }) => {\n Vue.set(state, \"ratingRoute\", ratingRoute);\n Vue.set(state, \"ratingType\", ratingType);\n }\n }\n};\n","export function recuperarDadosVinculo(vinculo) {\n const codigo = vinculo.substr(0, 8);\n const sequencia = vinculo.substr(8, 2);\n return { codigo, sequencia };\n}\n","import { recuperarDadosVinculo } from \"@/utils/vinculoUtil\";\n\nconst baseURL = `${process.env.VUE_APP_SERVER_URL}/Voucher`;\n\nexport async function CancelarAgendamento({ agendamento, vinculo }) {\n return window.$axios\n .post({\n url: `${baseURL}/CancelarAgendamento`,\n query: {\n numeroOPS: agendamento,\n idBeneficiario: vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterCredencialEletronica\", error.message);\n return error;\n });\n}\n\nexport async function ConfirmarAgendamento({\n vinculo,\n dataAgendamento,\n prestador,\n tipoVoucher,\n dataValidade,\n endereco\n}) {\n const dadosVinculo = recuperarDadosVinculo(vinculo);\n //precisa estar formatado com 8 posições\n prestador = `00000000${prestador}`;\n prestador = prestador.substr(prestador.length - 8);\n const ano = dataAgendamento.getFullYear();\n let mes = `${dataAgendamento.getMonth() + 1}`;\n if (mes.length < 2) mes = `0${mes}`;\n let dia = `${dataAgendamento.getDate()}`;\n if (dia.length < 2) dia = `0${dia}`;\n\n return window.$axios\n .post({\n url: `${baseURL}/ConfirmarAgendamento`,\n data: {\n CodigoTitulo: dadosVinculo.codigo,\n SequenciaBeneficiario: dadosVinculo.sequencia,\n DataAgendamento: `${ano}-${mes}-${dia}`,\n CodigoPrestador: prestador,\n TipoVoucher: tipoVoucher,\n DataValidadeVoucher: dataValidade,\n EnderecoId: endereco\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ConfirmarAgendamento\", error.message);\n });\n}\n\nexport async function ConsultarAgendamento({ agendamento }) {\n return window.$axios\n .get({\n url: `${baseURL}/GetConsultar`,\n query: {\n id: agendamento\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ConsultarAgendamento\", error.message);\n });\n}\n\nexport async function Listar({ vinculo }) {\n const dadosVinculo = recuperarDadosVinculo(vinculo);\n\n return window.$axios\n .get({\n url: `${baseURL}/ListarOPSs`,\n query: {\n codigoTituloAssociado: dadosVinculo.codigo,\n sequenciaBeneficiario: dadosVinculo.sequencia\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"Listar\", error.message);\n });\n}\n\nexport async function ObterPrestadores({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterListaPrestadoresVoucher`,\n query: {\n idBeneficiario: vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterPrestadores\", error.message);\n });\n}\n\nexport async function ObterProtocoloVoucher({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterProtocoloVoucher`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterProtocoloVoucher\", error.message);\n });\n}\n\nexport async function ObterVoucher({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterVoucher`,\n query: {\n idBeneficiario: vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterVoucher\", error.message);\n });\n}\n\nexport async function ObterBeneficiarios({ vinculo, tipo, cnpj }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterBeneficiarios`,\n query: {\n vinculo,\n tipo,\n cnpj\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterBeneficiarios\", error.message);\n });\n}\n\nexport async function ObterTiposVacina({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterTiposVacina`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterTiposVacina\", error.message);\n });\n}\n\nexport async function ObterPrestadoresVoucherVacina({ vinculo, tipo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterPrestadoresVoucherVacina`,\n query: {\n vinculo,\n tipo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterPrestadoresVoucherVacina\", error.message);\n });\n}\n\nexport async function GerarVoucher({ vinculo, tipo, beneficiarios, cnpj }) {\n return window.$axios\n .post({\n url: `${baseURL}/GerarVoucher`,\n query: {\n vinculo,\n tipo,\n cnpj\n },\n data: beneficiarios\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"GerarVoucher\", error.message);\n });\n}\n\nexport async function ObterDocumento({ key }) {\n const type = \".pdf\";\n const queryString = new URLSearchParams({\n key,\n type\n }).toString();\n\n return `${baseURL}/ObterDocumento?${queryString}`;\n}\n","import Vue from \"vue\";\nimport {\n ConfirmarAgendamento,\n Listar,\n ObterPrestadores,\n ObterVoucher,\n ConsultarAgendamento,\n CancelarAgendamento,\n ObterBeneficiarios,\n ObterTiposVacina,\n GerarVoucher,\n ObterDocumento,\n ObterPrestadoresVoucherVacina\n} from \"@/api/voucher\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n scheduled: {},\n providers: [],\n selectedCity: \"\",\n selectedProviderId: \"\",\n selectedAddressId: \"\",\n vaccineStep: 1,\n vaccineType: \"\",\n vaccineTypes: [],\n voucherType: \"\",\n date: null,\n protocol: \"\",\n authId: \"\",\n soliticationDate: new Date(),\n schdeuleDate: new Date(),\n valid: new Date(),\n voucherId: \"\",\n serviceProviderDesc: \"\",\n status: \"\",\n expDate: new Date(),\n vaccineBeneficiaries: [],\n vaccineProviders: [],\n vaccineProvider: \"\"\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n getters: {\n providersByCity: state =>\n state.providers.reduce((map, prov) => {\n if (!map[prov.Cidade]) {\n map = { ...map, [prov.Cidade]: [prov] };\n } else {\n map[prov.Cidade] = [...map[prov.Cidade], prov];\n }\n return map;\n }, {}),\n providersForCity: state => state.providers.filter(p => p.Cidade === state.selectedCity),\n adressForProvider: state =>\n state.providers.filter(p => p.Cidade === state.selectedCity && p.IdPrestadorVoucher === state.selectedProviderId),\n phone: state =>\n state.providers\n .filter(p => p.IdPrestadorVoucher === state.selectedProviderId && p.SrEndereco === state.selectedAddressId)\n .map(p => p.Telefone)\n .pop() || \"\"\n },\n actions: {\n async init(context) {\n await this.fetchScheduled(context);\n await this.fetchServiceProviders(context);\n },\n async cancelVoucher(context) {\n checkUpdatePermission();\n await CancelarAgendamento({\n agendamento: context.state.authId,\n vinculo: context.rootState.saude.vinculo\n });\n },\n async fetchScheduled(context) {\n const scheduled = await Listar({\n vinculo: context.rootState.saude.vinculo\n });\n if (scheduled && scheduled.length > 0) {\n const s = scheduled.pop();\n await context.commit(\"SET_SCHEDULED\", s);\n await context.commit(\"SET_AUTH_ID\", s.autorizacaoId);\n return true;\n }\n return false;\n },\n async checkSchduled(context) {\n const detail = await ConsultarAgendamento({\n agendamento: context.state.authId\n });\n\n if (detail) {\n await context.commit(\"SET_SOLICITATION_DATE\", new Date(detail.dataSolicitacao));\n await context.commit(\"SET_SCHEDULED_DATE\", new Date(detail.dataAgendamento));\n await context.commit(\"SET_VALID\", new Date(detail.dataValidadeVoucher));\n await context.commit(\"SET_STATUS\", detail.status);\n const codigoPrestador = Number(detail.codigoPrestador);\n for (let i = 0; i < context.state.providers.length; i++) {\n let provider = context.state.providers[i];\n if (Number(provider.IdPrestadorVoucher) === codigoPrestador) {\n await context.commit(\"SET_SERVICE_PROVIDER_DESC\", provider.NomePrestador);\n break;\n }\n }\n }\n },\n async fetchServiceProviders(context) {\n const providers = await ObterPrestadores({\n vinculo: context.rootState.saude.vinculo\n });\n\n if (providers.Data) {\n try {\n if (providers.Data.length > 0) {\n for (let i = 0; i < providers.Data.length; i++) {\n let provider = providers.Data[i];\n provider.Cidade = provider.Cidade.trim();\n if (provider.Cidade === \"SAO PAULO\" || provider.Cidade === \"SAO PAULO/SP\") {\n provider.Cidade = \"SÃO PAULO/SP\";\n }\n }\n }\n } finally {\n await context.commit(\"SET_PROVIDERS\", providers.Data);\n }\n }\n },\n async fetchExpDate(context) {\n const voucher = await ObterVoucher({\n vinculo: context.rootState.saude.vinculo\n });\n await context.commit(\"SET_EXP_DATE\", voucher?.Data?.DataExpiracao || new Date());\n },\n async confirm(context) {\n checkUpdatePermission();\n const protocol = await ConfirmarAgendamento({\n vinculo: context.rootState.saude.vinculo,\n dataAgendamento: context.state.date,\n prestador: context.state.selectedProviderId,\n tipoVoucher: context.state.voucherType,\n dataValidade: context.state.expDate,\n endereco: context.state.selectedAddressId\n });\n if (!protocol) return false;\n if (protocol instanceof Error) return false;\n context.commit(\"SET_PROTOCOL\", protocol);\n return true;\n },\n async clear(context) {\n await context.commit(\"CLEAR\");\n },\n async fetchVaccineBeneficiaries(context) {\n if (!context.state.vaccineType || !context.state.vaccineProvider || context.state.vaccineBeneficiaries?.length) {\n return;\n }\n\n const response = await ObterBeneficiarios({\n vinculo: context.rootState.saude.vinculo,\n tipo: context.state.vaccineType,\n cnpj: context.state.vaccineProvider\n });\n if (response?.Data) {\n context.commit(\n \"SET_VACCINE_BENEFICIARIES\",\n response.Data.map(t => ({\n value: t.Sequencia,\n label: t.Nome\n }))\n );\n }\n },\n async fetchVaccineTypes(context) {\n if (context.state.vaccineTypes?.length) return;\n\n const response = await ObterTiposVacina({\n vinculo: context.rootState.saude.vinculo\n });\n if (response?.Data) {\n context.commit(\n \"SET_VACCINE_TYPES\",\n response.Data.map(t => ({\n value: t.Codigo,\n label: t.Descricao\n }))\n );\n }\n },\n async fetchProvidersVaccine(context) {\n if (!context.state.vaccineType || context.state.vaccineProviders?.length) return;\n\n const response = await ObterPrestadoresVoucherVacina({\n vinculo: context.rootState.saude.vinculo,\n tipo: context.state.vaccineType\n });\n\n if (response?.Data) {\n context.commit(\n \"SET_VACCINE_PROVIDERS\",\n response.Data.map(p => ({ value: p.Cnpj, label: p.Nome }))\n );\n } else {\n return \"\";\n }\n },\n async createVaccineVoucher(context, { beneficiaries }) {\n if (!context.state.vaccineType) return \"\";\n\n const response = await GerarVoucher({\n vinculo: context.rootState.saude.vinculo,\n tipo: context.state.vaccineType,\n beneficiarios: beneficiaries,\n cnpj: context.state.vaccineProvider\n });\n if (response?.Data) {\n return ObterDocumento({ key: response.Data });\n } else {\n return \"\";\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n CLEAR: state => Object.assign(state, initialState),\n SET_SCHEDULED: (state, next) => Vue.set(state, \"scheduled\", next),\n SET_PROVIDERS: (state, next) => Vue.set(state, \"providers\", next),\n SET_SELECTED_CITY: (state, next) => Vue.set(state, \"selectedCity\", next),\n SET_SELECTED_PROVIDER: (state, next) => Vue.set(state, \"selectedProviderId\", next),\n SET_SELECTED_ADDRESS: (state, next) => Vue.set(state, \"selectedAddressId\", next),\n SET_VOUCHER_TYPE: (state, next) => Vue.set(state, \"voucherType\", next),\n SET_DATE: (state, next) => Vue.set(state, \"date\", next),\n SET_AUTH_ID: (state, next) => Vue.set(state, \"authId\", next),\n SET_PROTOCOL: (state, next) => Vue.set(state, \"protocol\", next),\n SET_SOLICITATION_DATE: (state, next) => Vue.set(state, \"soliticationDate\", next),\n SET_SCHEDULED_DATE: (state, next) => Vue.set(state, \"schdeuleDate\", next),\n SET_VALID: (state, next) => Vue.set(state, \"valid\", next),\n SET_VOUCHER_ID: (state, next) => Vue.set(state, \"voucherId\", next),\n SET_SERVICE_PROVIDER_DESC: (state, next) => Vue.set(state, \"serviceProviderDesc\", next),\n SET_STATUS: (state, next) => Vue.set(state, \"status\", next),\n SET_EXP_DATE: (state, next) => Vue.set(state, \"expDate\", next),\n SET_VACCINE_STEP: (state, next) => Vue.set(state, \"vaccineStep\", next),\n SET_VACCINE_TYPE: (state, next) => Vue.set(state, \"vaccineType\", next),\n SET_VACCINE_TYPES: (state, next) => Vue.set(state, \"vaccineTypes\", next),\n SET_VACCINE_BENEFICIARIES: (state, next) => Vue.set(state, \"vaccineBeneficiaries\", next),\n SET_VACCINE_PROVIDERS: (state, next) => Vue.set(state, \"vaccineProviders\", next),\n SET_VACCINE_PROVIDER: (state, next) => Vue.set(state, \"vaccineProvider\", next)\n }\n};\n","import * as geoUtils from \"@/utils/geoDistance\";\nimport { getStorageData } from \"@/utils/storageUtil\";\n\nconst baseURL = process.env.VUE_APP_SERVER_URL;\n\nexport async function ObterServicosDisponiveis({ vinculo, login, perfil, operacao }) {\n return window.$axios\n .get({\n url: `${baseURL}/Menu/ObterServicosDisponiveisPWA`,\n query: {\n vinculo,\n versaoMenu: process.env.VUE_APP_MENU_VERSION,\n login,\n perfil,\n operacao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterServicosDisponiveis\", error.message);\n return error;\n });\n}\n\nexport async function EnviarCodigoRecuperarSenha({ email }) {\n return window.$axios\n .post({\n url: `${baseURL}/RecuperarSenha/EnviarCodigo`,\n query: {\n email\n }\n })\n .then(resp => {\n return resp.data;\n })\n .catch(error => {\n window.$log.error(\"EnviarCodigo\", error.message);\n return error;\n });\n}\n\nexport async function InformarCodigoRecuperarSenha({ codigo, email, password }) {\n const senhaEncrypted = window.$jse.encrypt(password);\n return window.$axios\n .post({\n url: `${baseURL}/RecuperarSenha/InformarCodigo`,\n query: {\n codigo,\n email,\n senhaEncrypted\n }\n })\n .then(resp => {\n return resp.data;\n })\n .catch(error => {\n window.$log.error(\"InformarCodigo\", error.message);\n return error;\n });\n}\n\nexport function GerarUrlWallet({ vinculo, tipoCredencial }) {\n const queryString = new URLSearchParams({\n nrVinculo: vinculo,\n tipoCredencial\n }).toString();\n\n return `/wallet/ObterWallet?${queryString}`;\n}\n\nexport async function AutorizacaoListar({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/Autorizacao/Listar`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"Listar\", error.message);\n return error;\n });\n}\n\nexport async function AutorizacaoObterDocumento({ vinculo, idAutorizacao }) {\n const chave = `${vinculo};${idAutorizacao}`;\n const key = `${window.$jse.encrypt(chave)}`;\n const type = \".pdf\";\n const queryString = new URLSearchParams({\n key,\n type\n }).toString();\n\n return `${baseURL}/Autorizacao/ObterAutorizacaoPWA?${queryString}`;\n}\n\nexport async function ObterDadosChatBot({ vinculo, email }) {\n return window.$axios\n .get({\n url: `${baseURL}/Util/ObterDadosChatBot`,\n query: {\n vinculo,\n email\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterDadosChatBot\", error.message);\n return error;\n });\n}\n\nexport async function PWAVersion() {\n return window.$axios\n .get({\n url: `${baseURL}/Home/PWAVersion`\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"PWAVersion\", error.message);\n return error;\n });\n}\n\nexport async function BuscarDocumento({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/Home/BuscarDocumento`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"BuscarDocumento\", error.message);\n return error;\n });\n}\n\nexport async function ObterServicosUsuario({ operacao, perfil, login, usuario }) {\n return window.$axios\n .get({\n url: `${baseURL}/Menu/ObterServicosUsuario`,\n query: {\n operacao,\n perfil,\n login,\n usuario\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterServicosUsuario\", error.message);\n return error;\n });\n}\n\nexport async function RequestWallet(walletUrl) {\n return window.$axios\n .get({\n url: walletUrl,\n responseType: \"blob\"\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RequestWallet\", error.message);\n return null;\n });\n}\n\nexport async function RemoveAccount({ vinculo }) {\n const coords: any = await geoUtils.GetLocation().catch(() => null);\n return window.$axios\n .post({\n url: `${baseURL}/MinhaConta/ApagarConta`,\n query: {\n vinculo,\n dsUsuario: getStorageData(\"username\", \"\"),\n lat: coords?.latitude,\n lng: coords?.longitude\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterServicosUsuario\", error.message);\n return error;\n });\n}\n\nexport async function ObterMenusFavoritos({ vinculo, retornarAtalhos }) {\n return await window.$axios\n .get({\n url: `${baseURL}/Menu/ObterMenusFavoritos`,\n query: {\n vinculo,\n retornarAtalhos\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterMenusFavoritos\", error.message);\n return error;\n });\n}\n\nexport async function GravarMenusFavoritos({ vinculo, menus }) {\n return await window.$axios\n .post({\n url: `${baseURL}/Menu/GravarMenusFavoritos`,\n query: {\n vinculo\n },\n data: menus\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"GravarMenusFavoritos\", error.message);\n return error;\n });\n}\n","// source https://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-details-using-javascript\nexport function obterDadosNavigator() {\n const unknown = \"Unknown\";\n\n //browser\n const nVer = navigator.userAgent;\n const nAgt = navigator.userAgent;\n let browser = unknown;\n let version = \"\";\n let verOffset, ix;\n\n // Opera\n if ((verOffset = nAgt.indexOf(\"Opera\")) !== -1) {\n browser = \"Opera\";\n version = nAgt.substring(verOffset + 6);\n if ((verOffset = nAgt.indexOf(\"Version\")) !== -1) {\n version = nAgt.substring(verOffset + 8);\n }\n }\n // MSIE\n else if ((verOffset = nAgt.indexOf(\"MSIE\")) !== -1) {\n browser = \"IE\";\n version = nAgt.substring(verOffset + 5);\n }\n\n //IE 11 no longer identifies itself as MS IE, so trap it\n //http://stackoverflow.com/questions/17907445/how-to-detect-ie11\n else if (browser === \"Netscape\" && nAgt.indexOf(\"Trident/\") !== -1) {\n browser = \"IE\";\n version = nAgt.substring(verOffset + 5);\n if ((verOffset = nAgt.indexOf(\"rv:\")) !== -1) {\n version = nAgt.substring(verOffset + 3);\n }\n }\n\n // Chrome\n else if ((verOffset = nAgt.indexOf(\"Chrome\")) !== -1) {\n browser = \"Chrome\";\n version = nAgt.substring(verOffset + 7);\n }\n // Safari\n else if ((verOffset = nAgt.indexOf(\"Safari\")) !== -1) {\n browser = \"Safari\";\n version = nAgt.substring(verOffset + 7);\n if ((verOffset = nAgt.indexOf(\"Version\")) !== -1) {\n version = nAgt.substring(verOffset + 8);\n }\n\n // Chrome on iPad identifies itself as Safari. Actual results do not match what Google claims\n // at: https://developers.google.com/chrome/mobile/docs/user-agent?hl=ja\n // No mention of chrome in the user agent string. However it does mention CriOS, which presumably\n // can be keyed on to detect it.\n if (nAgt.indexOf(\"CriOS\") !== -1) {\n //Chrome on iPad spoofing Safari...correct it.\n browser = \"Chrome\";\n //Don't believe there is a way to grab the accurate version number, so leaving that for now.\n }\n }\n // Firefox\n else if ((verOffset = nAgt.indexOf(\"Firefox\")) !== -1) {\n browser = \"Firefox\";\n version = nAgt.substring(verOffset + 8);\n }\n // trim the version string\n if ((ix = version.indexOf(\";\")) !== -1) version = version.substring(0, ix);\n if ((ix = version.indexOf(\" \")) !== -1) version = version.substring(0, ix);\n if ((ix = version.indexOf(\")\")) !== -1) version = version.substring(0, ix);\n\n // system\n let os = unknown;\n const clientStrings = [\n { s: \"Windows 10\", r: /(Windows 10.0|Windows NT 10.0)/ },\n { s: \"Windows 8.1\", r: /(Windows 8.1|Windows NT 6.3)/ },\n { s: \"Windows 8\", r: /(Windows 8|Windows NT 6.2)/ },\n { s: \"Windows 7\", r: /(Windows 7|Windows NT 6.1)/ },\n { s: \"Windows Vista\", r: /Windows NT 6.0/ },\n { s: \"Windows Server 2003\", r: /Windows NT 5.2/ },\n { s: \"Windows XP\", r: /(Windows NT 5.1|Windows XP)/ },\n { s: \"Windows 2000\", r: /(Windows NT 5.0|Windows 2000)/ },\n { s: \"Windows ME\", r: /(Win 9x 4.90|Windows ME)/ },\n { s: \"Windows 98\", r: /(Windows 98|Win98)/ },\n { s: \"Windows 95\", r: /(Windows 95|Win95|Windows_95)/ },\n { s: \"Windows NT 4.0\", r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/ },\n { s: \"Windows CE\", r: /Windows CE/ },\n { s: \"Windows 3.11\", r: /Win16/ },\n { s: \"Android\", r: /Android/ },\n { s: \"Open BSD\", r: /OpenBSD/ },\n { s: \"Sun OS\", r: /SunOS/ },\n { s: \"Chrome OS\", r: /CrOS/ },\n { s: \"Linux\", r: /(Linux|X11(?!.*CrOS))/ },\n { s: \"iOS\", r: /(iPhone|iPad|iPod)/ },\n { s: \"Mac OS X\", r: /Mac OS X/ },\n { s: \"Mac OS\", r: /(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ },\n { s: \"QNX\", r: /QNX/ },\n { s: \"UNIX\", r: /UNIX/ },\n { s: \"BeOS\", r: /BeOS/ },\n { s: \"OS/2\", r: /OS\\/2/ },\n { s: \"Search Bot\", r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\\/Teoma|ia_archiver)/ }\n ];\n for (const id in clientStrings) {\n const cs = clientStrings[id];\n if (cs.r.test(nAgt)) {\n os = cs.s;\n break;\n }\n }\n\n let osVersion: any = \"\";\n\n if (/Windows/.test(os)) {\n osVersion = /Windows (.*)/.exec(os)[1];\n os = \"WinNT\";\n } else {\n switch (os) {\n case \"Mac OS\":\n case \"Mac OS X\":\n case \"Android\":\n osVersion = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\\d]+)/.exec(nAgt)[1];\n break;\n\n case \"iOS\":\n osVersion = /OS (\\d+)_(\\d+)_?(\\d+)?/.exec(nVer);\n osVersion = osVersion[1] + \".\" + osVersion[2] + \".\" + (osVersion[3] | 0);\n if (browser === unknown) {\n browser = \"Safari\";\n version = osVersion;\n }\n break;\n default:\n if (osVersion === \"\") osVersion = \"0.0\";\n break;\n }\n }\n\n return {\n browser: browser,\n browserVersion: version,\n os: os,\n osVersion: osVersion\n };\n}\n","import * as geoUtils from \"@/utils/geoDistance\";\nimport { getStorageData } from \"@/utils/storageUtil\";\nimport { obterDadosNavigator } from \"@/utils/navigatorUtil\";\nconst baseURL = `${process.env.VUE_APP_SERVER_URL}/MinhaConta`;\n\nexport async function AlterarImagemProfile({ vinculo, filename, blobFile }) {\n const data = new FormData();\n data.append(\"\", blobFile, filename);\n\n return window.$axios\n .post({\n url: `${baseURL}/AlterarImagemProfile`,\n query: {\n vinculo\n },\n contentType: \"multipart/form-data\",\n data\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"AlterarImagemProfile\", error.message);\n return error;\n });\n}\n\nexport async function AlterarSenha({ senhaAtual, novaSenha, vinculo, autenticacao }) {\n const senhaAtualEncrypted = window.$jse.encrypt(senhaAtual);\n const novaSenhaEncrypted = window.$jse.encrypt(novaSenha);\n const coords: any = await geoUtils.GetLocation().catch(() => null);\n return window.$axios\n .post({\n url: `${baseURL}/AlterarSenha`,\n query: {\n vinculo,\n autenticacao,\n dsUsuario: getStorageData(\"username\", \"\"),\n lat: coords?.latitude,\n lng: coords?.longitude,\n senhaAtualEncrypted,\n novaSenhaEncrypted\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"AlterarSenha\", error.message);\n return error;\n });\n}\n\nexport async function ObterImagemProfile({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterImagemProfile`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterImagemProfile\", error.message);\n return error;\n });\n}\n\nexport async function ObterAvisos({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterAvisos`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterAvisos\", error.message);\n return error;\n });\n}\n\nexport async function ObterOptin({ login }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterOptin`,\n query: {\n login\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterOptin\", error.message);\n return error;\n });\n}\n\nexport async function AceiteOptinUsuario({ termo, aceite, login }) {\n return window.$axios\n .post({\n url: `${baseURL}/AceiteOptinUsuario`,\n query: {\n termo,\n aceite,\n login\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"AceiteOptinUsuario\", error.message);\n return error;\n });\n}\n\nexport async function ProgramaScreening({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ProgramaScreening`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ProgramaScreening\", error.message);\n return error;\n });\n}\n\nexport async function ProgramaScreeningAceite({ vinculo, login }) {\n return window.$axios\n .post({\n url: `${baseURL}/ProgramaScreeningAceite`,\n query: {\n vinculo,\n login\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ProgramaScreeningAceite\", error.message);\n return error;\n });\n}\n\nexport async function SituacaoSessao({ vinculo }) {\n if (!vinculo) return;\n\n return window.$axios\n .get({\n url: `${baseURL}/SituacaoSessao`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"SituacaoSessao\", error.message);\n return error;\n });\n}\n\nexport async function EnviarTokenValidacao({ vinculo, telefone, email, id, chave, servico }) {\n return window.$axios\n .post({\n url: `${baseURL}/EnviarTokenValidacao`,\n query: {\n vinculo\n },\n data: {\n telefone,\n email,\n id,\n chave,\n servico\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"EnviarTokenValidacao\", error.message);\n return error;\n });\n}\n\nexport async function InformarCodigoValidacao({ vinculo, telefone, email, id, chave, codigo, autenticacao, servico }) {\n return window.$axios\n .post({\n url: `${baseURL}/InformarCodigoValidacao`,\n query: {\n vinculo\n },\n data: {\n telefone,\n email,\n id,\n chave,\n codigo,\n autenticacao,\n servico\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"InformarCodigoValidacao\", error.message);\n return error;\n });\n}\n\nexport async function PermissaoFuncionalidade({ vinculo, funcionalidade, permissao }) {\n return window.$axios\n .get({\n url: `${baseURL}/PermissaoFuncionalidade`,\n query: {\n vinculo,\n funcionalidade,\n permissao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"PermissaoFuncionalidade\", error.message);\n return error;\n });\n}\n\nexport async function RegistrarAcesso({ vinculo, servico, funcionalidade, dsUsuario, id }) {\n const coords: any = await geoUtils.GetLocation().catch(() => null);\n return window.$axios\n .post({\n url: `${baseURL}/RegistrarAcesso`,\n query: {\n vinculo\n },\n data: {\n id,\n servico,\n funcionalidade,\n dsUsuario,\n lat: coords?.latitude,\n lng: coords?.longitude\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RegistrarAcesso\", error.message);\n return error;\n });\n}\n\nexport async function AtualizarVinculo({ vinculo, operacao, perfil, grupo, sistemaOperacional, versaoSO }) {\n let navegador = \"\";\n let versaoNavegador = \"\";\n let dsNavegador = \"\";\n try {\n const dadosNavigator = obterDadosNavigator();\n navegador = dadosNavigator.browser;\n versaoNavegador = dadosNavigator.browserVersion;\n if (!sistemaOperacional || sistemaOperacional === \"web\") {\n sistemaOperacional = dadosNavigator.os;\n versaoSO = dadosNavigator.osVersion;\n }\n } catch (error) {\n window.$log.error(\"AtualizarVinculo\", error.message);\n }\n if (\n !navegador ||\n navegador === \"Unknown\" ||\n versaoNavegador === \"Unknown\" ||\n !sistemaOperacional ||\n sistemaOperacional === \"Unknown\" ||\n versaoSO === \"Unknown\"\n ) {\n dsNavegador = navigator.userAgent;\n }\n return window.$axios\n .post({\n url: `${baseURL}/AtualizarVinculo`,\n query: {\n vinculo\n },\n data: {\n operacao,\n perfil,\n grupo,\n sistemaOperacional,\n versaoSO,\n navegador,\n versaoNavegador,\n dsNavegador\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"AtualizarVinculo\", error.message);\n return error;\n });\n}\n\nexport async function ObterBlogPosts({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterBlogPosts`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterBlogPosts\", error.message);\n return error;\n });\n}\n\nexport async function ObtemOptinPendente({ vinculo, template, sistema }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObtemOptinPendente`,\n query: {\n vinculo,\n template,\n sistema\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObtemOptinPendente\", error.message);\n return error;\n });\n}\n\nexport async function VerificarAlteracaoSenhaPendente({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/VerificarAlteracaoSenhaPendente`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"VerificarAlteracaoSenhaPendente\", error.message);\n return error;\n });\n}\n\nexport async function ObterImagem({ vinculo, documento, original }) {\n const key = `${vinculo};${documento};${original ? \"T\" : \"F\"}`;\n const chave = `${window.$jse.encrypt(key)}`;\n return await window.$axios\n .get({\n url: `${baseURL}/ObterImagem`,\n query: {\n vinculo,\n chave,\n original\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterImagem\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport async function OnBoardTourPendente({ vinculo, configuracoes }) {\n return await window.$axios\n .post({\n url: `${baseURL}/OnBoardTourPendente`,\n query: {\n vinculo\n },\n data: {\n configuracoes\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"OnBoardTourPendente\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport async function ObterRegrasOnBoardTour({ vinculo, configuracoes, rotas }) {\n return await window.$axios\n .post({\n url: `${baseURL}/ObterRegrasOnBoardTour`,\n query: {\n vinculo\n },\n data: {\n configuracoes,\n rotas\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterRegrasOnBoardTour\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport async function RespostaOnBoardTour({ vinculo, codigo, id, resposta }) {\n return await window.$axios\n .post({\n url: `${baseURL}/RespostaOnBoardTour`,\n query: {\n vinculo\n },\n data: {\n codigo,\n id,\n resposta\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RespostaOnBoardTour\", error.message);\n throw new Error(error.message);\n });\n}\n","export const PLANO_MEDICO: string = \"Plano Médico\";\nexport const PLANO_ODONTO: string = \"Plano Odontologia\";\nexport const PLANO_TERCEIRO: string = \"Rede Terceira\";\n","import Vue from \"vue\";\nimport Vuex from \"vuex\";\nimport { ObterVinculos } from \"@/api/auth\";\nimport * as api from \"@/api/api\";\nimport * as associado from \"@/api/associado\";\nimport * as atendimento from \"@/api/atendimento\";\nimport { loginUser, logoutUser, setAuthToken } from \"@/utils/authUtil\";\nimport { getStorageData, setStorageData } from \"@/utils/storageUtil\";\nimport * as minhaConta from \"@/api/minhaConta\";\nimport {\n getRouteByPerfilNumber,\n isAssociado,\n PERFIL_ASSOCIADO_KIPP,\n ROTA_ALTERAR_SENHA,\n ROTA_OPTIN,\n ROTA_AVISO_ATRASO,\n ROTA_PADRAO,\n ROTA_WELCOME_ONBOARD_TOUR\n} from \"@/utils/perfilRouteUtil\";\nimport { PLANO_MEDICO, PLANO_ODONTO, PLANO_TERCEIRO } from \"@/utils/credentialUtil\";\n\nVue.use(Vuex);\n\nconst initialState = {\n header: 0,\n isAppLoaded: false,\n isReadonlyAccess: false,\n profile: getStorageData(\"profile\", {\n profilePic: \"\",\n messages: []\n }),\n menu: getStorageData(\"menu\", [], true),\n credentials: getStorageData(\"credentials\", [], true),\n userId: getStorageData(\"userId\", \"\", false),\n profileName: getStorageData(\"profileName\", \"\", true),\n credentialName: getStorageData(\"credentialName\", \"\", true),\n vinculo: getStorageData(\"vinculo\", \"\", false),\n vinculos: [],\n username: getStorageData(\"username\", \"\", false),\n titular: false,\n contratType: \"\",\n bigFontSize: getStorageData(\"bigFontSize\", false, false),\n theme: getStorageData(\"theme\", \"light\", false),\n hydrated: false,\n hydrating: false,\n disableBiometric: false,\n pwaVersion: getStorageData(\"pwaVersion\", \"\", false),\n route: \"/login\",\n operacao: getStorageData(\"operacao\", 1, false),\n perfil: getStorageData(\"perfil\", 1, false),\n chamadoRef: getStorageData(\"chamadoRef\", false),\n protocoloAvalicaoApp: \"\",\n hasMedicCredentials: false,\n hasOdontoCredentials: false,\n menusFavoritos: [],\n closedOnboards: []\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n mutations: {\n RESET_CONTEXT: state => {\n var newState = {\n profile: {\n profilePic: \"\",\n messages: []\n },\n menu: [],\n menusFavoritos: [],\n titular: false,\n hydrated: false\n };\n Object.keys(newState).forEach(p => {\n Vue.set(state, p, newState[p]);\n setStorageData(p, null);\n });\n },\n LOGOUT_USER: state => {\n const newState = {\n profile: {\n profilePic: \"\",\n messages: []\n },\n isReadonlyAccess: false,\n menu: [],\n menusFavoritos: [],\n credentials: [],\n userId: \"\",\n profileName: \"\",\n credentialName: \"\",\n vinculo: \"\",\n vinculos: [],\n username: \"\",\n titular: false,\n contratType: \"\",\n bigFontSize: false,\n theme: getStorageData(\"theme\", \"light\"),\n hydrated: false,\n hydrating: false,\n disableBiometric: false,\n route: \"/login\",\n operacao: 1,\n perfil: 1,\n chamadoRef: null,\n protocoloAvalicaoApp: \"\",\n closedOnboards: [],\n hasMedicCredentials: false,\n hasOdontoCredentials: false\n };\n Object.keys(newState).forEach(p => {\n Vue.set(state, p, newState[p]);\n setStorageData(p, null);\n });\n },\n SAVE_NEW_PROPS(state) {\n const statesToSave = [\n \"userId\",\n \"username\",\n \"vinculo\",\n \"operacao\",\n \"perfil\",\n \"chamadoRef\",\n \"menusFavoritos\",\n \"menu\",\n \"credentialName\",\n \"profileName\",\n \"profile\"\n ];\n statesToSave.forEach(p => {\n const val = state[p];\n Vue.set(state, p, val);\n if (!state.isReadonlyAccess) setStorageData(p, val);\n });\n // salva as credenciais (separado pois pode estourar limite do storage)\n const credenciais = JSON.parse(JSON.stringify(state.credentials ?? []));\n while (credenciais?.length && !setStorageData(\"credentials\", credenciais)) {\n credenciais.pop();\n }\n },\n SET_PROP(state, { payload, prop }) {\n Vue.set(state, prop, payload);\n },\n PUSH_CLOSE_ONBOARD(state, payload) {\n state.closedOnboards.push(payload);\n }\n },\n getters: {\n baseApi: () => process.env.VUE_APP_SERVER_URL,\n baseUrl: () =>\n process.env.VUE_APP_BASE_URL === \"/\"\n ? \"\"\n : process.env.VUE_APP_BASE_URL.substring(0, process.env.VUE_APP_BASE_URL.length - 1),\n defaultRoute: state =>\n state.route === ROTA_PADRAO ? getRouteByPerfilNumber(state.operacao, state.perfil) : state.route,\n pwaVersion: () => process.env.VUE_APP_PWA_VERSION,\n onboardWasAlreadyClosed: state => onboard => state.closedOnboards.findIndex(_onboard => _onboard === onboard) !== -1\n },\n actions: {\n appLoaded: context => {\n if (!context.state.isAppLoaded) {\n context.commit(\"SET_PROP\", { payload: true, prop: \"isAppLoaded\" });\n }\n },\n hydrate: async context => {\n if (context.state.hydrated) return;\n if (context.state.hydrating) return;\n if (!context.state.userId || !context.state.username || !context.state.vinculo) return;\n const vinculo = context.state.vinculo;\n context.commit(\"SET_PROP\", { payload: true, prop: \"hydrating\" });\n window.$log.message(\"Atualizando informações de menu, credenciais e profile...\");\n try {\n if (getRouteByPerfilNumber(context.state.operacao, context.state.perfil) === ROTA_PADRAO) {\n context.commit(\"SET_PROP\", { payload: route, prop: \"route\" });\n context.commit(\"SET_PROP\", { payload: false, prop: \"hydrating\" });\n context.commit(\"SET_PROP\", { payload: true, prop: \"hydrated\" });\n return;\n }\n // serviços iniciais, obrigatórios\n const initialServices = [\n context.dispatch(\"myAccount/fetchTerms\", null, { root: true }),\n context.dispatch(\"accessManagement/fetchNonpaymentWarning\", null, { root: true }),\n context.dispatch(\"myAccount/fetchChangePasswordRequired\", null, { root: true })\n ];\n if (isAssociado(context.state.perfil)) {\n initialServices.push(context.dispatch(\"myAccount/fetchWelcomeOnBoardTour\", null, { root: true }));\n }\n await Promise.all(initialServices);\n // regra para caso exista fluxo de bem vindo (carregar o menu no login passa a ser obrigatório)\n let menuLoaded = false;\n if (isAssociado(context.state.perfil)) {\n const hasWelcomeTour = context.rootState.myAccount?.hasWelcomeOnboard ?? false;\n if (hasWelcomeTour) {\n await Promise.all([\n context.dispatch(\"fetchMenuData\"),\n context.dispatch(\"fetchFavoriteMenus\", { retornarAtalhos: true })\n ]);\n await context.dispatch(\"myAccount/checkhWelcomeOnBoardTourPages\", null, { root: true });\n menuLoaded = true;\n }\n }\n\n const route = getRouteByPerfilNumber(context.state.operacao, context.state.perfil);\n context.commit(\"SET_PROP\", { payload: route, prop: \"route\" });\n\n const servicosBase = [];\n if (isAssociado(context.state.perfil)) {\n servicosBase.push(context.dispatch(\"checkAppRating\"));\n servicosBase.push(context.dispatch(\"fetchProfileImage\"));\n servicosBase.push(context.dispatch(\"fetchCredentials\"));\n servicosBase.push(context.dispatch(\"fetchProfileMessages\"));\n if (!menuLoaded) {\n servicosBase.push(context.dispatch(\"fetchMenuData\"));\n servicosBase.push(context.dispatch(\"fetchFavoriteMenus\", { retornarAtalhos: true }));\n }\n }\n if (!context.state.vinculos?.length) {\n servicosBase.push(context.dispatch(\"fetchVinculos\"));\n }\n Promise.all(servicosBase).then(() => {\n if (vinculo === context.state.vinculo) {\n context.dispatch(\"fetchVinculoInfos\");\n context.commit(\"SET_PROP\", { payload: false, prop: \"hydrating\" });\n context.commit(\"SET_PROP\", { payload: true, prop: \"hydrated\" });\n context.commit(\"SAVE_NEW_PROPS\");\n if (context.state.disableBiometric) {\n context.dispatch(\"biometrics/disableBiometric\", null, { root: true });\n }\n }\n });\n } catch (err) {\n window.$log.error(\"Não foi aplicar as regras de hydrate\", err);\n }\n },\n createHeader: context => {\n const newValue = context.state.header++;\n context.commit(\"SET_PROP\", { payload: newValue, prop: \"header\" });\n return newValue === 1;\n },\n destroyHeader: context => {\n const newValue = context.state.header--;\n context.commit(\"SET_PROP\", { payload: newValue, prop: \"header\" });\n return newValue === 0;\n },\n changeTheme: context => {\n const newThema = context.state.theme === \"light\" ? \"dark\" : \"light\";\n context.commit(\"SET_PROP\", { payload: newThema, prop: \"theme\" });\n },\n async loginUser(context, { username, password, type }) {\n let isReadonlyAccess = false;\n if (type === \"readonly-access\") {\n type = \"Omint\";\n isReadonlyAccess = true;\n }\n username = username?.trim();\n const changingUser = username?.toLowerCase() !== context.state.username?.trim()?.toLowerCase();\n const oldUserId = context.state.userId;\n\n const appLocked = context.rootState.accessManagement.appLocked;\n const loginData = await loginUser(type ?? username, password);\n if (loginData === null || !loginData.Login) {\n return \"\";\n }\n\n await context.dispatch(\"accessManagement/unlockApp\", null, { root: true });\n if (changingUser) {\n if (context.state.username) {\n logoutUser();\n context.commit(\"LOGOUT_USER\");\n }\n setAuthToken(loginData);\n }\n if (changingUser && oldUserId !== \"\" && oldUserId !== loginData.IdUsuario) {\n context.commit(\"SET_PROP\", { payload: true, prop: \"disableBiometric\" });\n }\n context.commit(\"SET_PROP\", { payload: isReadonlyAccess, prop: \"isReadonlyAccess\" });\n context.commit(\"SET_PROP\", { payload: false, prop: \"hydrated\" });\n context.commit(\"SET_PROP\", { payload: false, prop: \"hydrating\" });\n\n if (appLocked && context.state.vinculos.length === 1) {\n if (context.state.vinculos[0].Vinculos.length === 1) {\n await context.dispatch(\"hydrate\");\n return await context.dispatch(\"fetchInitRoute\");\n } else {\n return \"/vinculos\";\n }\n }\n\n username = loginData.Login.trim();\n context.commit(\"SET_PROP\", { payload: loginData.IdUsuario, prop: \"userId\" });\n context.commit(\"SET_PROP\", { payload: username, prop: \"username\" });\n await context.dispatch(\"fetchVinculos\");\n const vinculos = context.state.vinculos;\n if (vinculos?.length) {\n context.dispatch(\n \"myAccount/registerAccess\",\n {\n servico: \"Login\",\n funcionalidade: \"Operação de login\",\n id: null\n },\n { root: true }\n );\n if (vinculos.length === 1) {\n const operacaoVinculo = vinculos[0];\n if (operacaoVinculo.Vinculos.length === 1) {\n await context.dispatch(\"setVinculo\", {\n operacao: operacaoVinculo.IdOperacaoOmint,\n perfil: operacaoVinculo.IdPerfilOmint,\n vinculo: operacaoVinculo.Vinculos[0].NumeroIdentificacaoVinculo\n });\n return await context.dispatch(\"fetchInitRoute\");\n }\n }\n return \"/vinculos\";\n }\n return \"\";\n },\n async setVinculo(context, { operacao, perfil, vinculo }) {\n context.dispatch(\"resetContext\", {}, { root: true });\n let grupo = 0;\n const vinculos = context.state.vinculos;\n if (operacao === 0 && perfil === 0) {\n if (vinculo) {\n vinculos.every(g =>\n g.Vinculos.every(v => {\n if (v.NumeroIdentificacaoVinculo === vinculo) {\n operacao = g.IdOperacaoOmint;\n perfil = g.IdPerfilOmint;\n grupo = v.IdGrupoOmint;\n return false;\n }\n return true;\n })\n );\n }\n }\n if (vinculo && grupo === 0) {\n vinculos.every(g =>\n g.Vinculos.every(v => {\n if (\n v.NumeroIdentificacaoVinculo === vinculo &&\n operacao === g.IdOperacaoOmint &&\n perfil === g.IdPerfilOmint\n ) {\n grupo = v.IdGrupoOmint;\n return false;\n }\n return true;\n })\n );\n }\n minhaConta.AtualizarVinculo({\n vinculo,\n operacao,\n perfil,\n grupo,\n sistemaOperacional: context.rootState.pushToken.system,\n versaoSO: context.rootState.pushToken.systemVersion\n });\n const route = getRouteByPerfilNumber(operacao, perfil);\n\n context.commit(\"SET_PROP\", { payload: route, prop: \"route\" });\n context.commit(\"SET_PROP\", { payload: vinculo, prop: \"vinculo\" });\n context.commit(\"SET_PROP\", { payload: operacao, prop: \"operacao\" });\n context.commit(\"SET_PROP\", { payload: perfil, prop: \"perfil\" });\n\n // reseta dados do vinculo\n const newState = {\n profile: {\n profilePic: \"\",\n messages: []\n },\n menu: [],\n menusFavoritos: [],\n credentials: [],\n profileName: \"\",\n credentialName: \"\",\n titular: false,\n contratType: \"\",\n hydrated: false,\n hydrating: false,\n protocoloAvalicaoApp: \"\",\n closedOnboards: [],\n hasMedicCredentials: false,\n hasOdontoCredentials: false\n };\n Object.keys(newState).forEach(p => {\n context.commit(\"SET_PROP\", { payload: newState[p], prop: p });\n });\n\n if (isAssociado(perfil)) {\n context.dispatch(\"createTicket\");\n }\n await context.dispatch(\"hydrate\");\n },\n fetchVinculoInfos: context => {\n try {\n const operacao = context.state.operacao;\n const perfil = context.state.perfil;\n const operacaoVinculo = context.state.vinculos.find(\n v => v.IdOperacaoOmint === operacao && v.IdPerfilOmint === perfil\n );\n const vinculoData = operacaoVinculo.Vinculos.find(v => v.NumeroIdentificacaoVinculo === context.state.vinculo);\n const userName = vinculoData.DescricaoIdentificacaoVinculo?.toLowerCase().replace(/\\b\\w/g, match =>\n match.toUpperCase()\n );\n const firstName = userName && userName.indexOf(\" \") > 0 ? userName.split(\" \")[0] : userName;\n context.commit(\"SET_PROP\", { payload: vinculoData.Tipo, prop: \"contratType\" });\n context.commit(\"SET_PROP\", { payload: vinculoData.Titular, prop: \"titular\" });\n context.commit(\"SET_PROP\", {\n payload: userName,\n prop: \"credentialName\"\n });\n context.commit(\"SET_PROP\", {\n payload: firstName,\n prop: \"profileName\"\n });\n } catch (err) {\n window.$log.error(\"Não foi possível recuperar os dados do vinculo\", err);\n }\n },\n fetchInitRoute: async context => {\n try {\n const defaultRoute = getRouteByPerfilNumber(context.state.operacao, context.state.perfil);\n if (defaultRoute === ROTA_PADRAO) {\n const services = await api.ObterServicosUsuario({\n operacao: context.state.operacao,\n perfil: context.state.perfil,\n usuario: context.state.userId,\n login: context.state.username\n });\n const link = services && services.Data && services.Data.length > 0 ? services.Data[0].DsServicoURL : \"\";\n if (link) {\n return link;\n }\n }\n const terms = context.rootState.myAccount?.terms;\n if (terms?.length) return ROTA_OPTIN;\n const nonPaymentWarning = context.rootState.myAccount?.changePasswordRequired;\n if (nonPaymentWarning) return ROTA_AVISO_ATRASO;\n const changePasswordRequired = context.rootState.myAccount?.changePasswordRequired;\n if (changePasswordRequired) return ROTA_ALTERAR_SENHA;\n const onNative = context.rootGetters[\"biometrics/onNative\"];\n if (!onNative) return defaultRoute;\n const welcomeOnBoardTour = context.rootState.myAccount?.welcomeOnBoardTour ?? [];\n const nextTour = welcomeOnBoardTour.find(b => !b.currentResponse);\n if (nextTour?.id) {\n return ROTA_WELCOME_ONBOARD_TOUR;\n }\n return defaultRoute;\n } catch (err) {\n window.$log.error(\"Não foi possível resolver a rota inicial\", err);\n return ROTA_PADRAO;\n }\n },\n async createTicket(context) {\n const chamadoInicial = await atendimento.RegistroNavegacao({\n vinculo: context.state.vinculo,\n classificacao: 4722\n });\n if (chamadoInicial && chamadoInicial.Data) {\n context.commit(\"SET_PROP\", { payload: chamadoInicial.Data, prop: \"chamadoRef\" });\n }\n },\n clearProtocoloAvalicaoApp(context) {\n context.commit(\"SET_PROP\", {\n payload: \"\",\n prop: \"protocoloAvalicaoApp\"\n });\n },\n async checkAppRating(context) {\n if (context.state.chamadoRef) {\n const protocoloAvalicaoApp = await atendimento.VerificarAvaliacaoAplicativo({\n vinculo: context.state.vinculo,\n chamado: context.state.chamadoRef\n });\n context.commit(\"SET_PROP\", {\n payload: protocoloAvalicaoApp?.Data ?? \"\",\n prop: \"protocoloAvalicaoApp\"\n });\n }\n },\n async refreshContext(context) {\n const userId = getStorageData(\"userId\", \"\");\n const vinculo = getStorageData(\"vinculo\", \"\");\n const username = getStorageData(\"username\", \"\");\n if (userId === \"\" && vinculo === \"\" && username === \"\") {\n return \"\";\n }\n const redirectTo = await context.dispatch(\"loginUser\", {\n username,\n password: `${username};${userId};${vinculo}`,\n type: \"Omint\"\n });\n if (redirectTo === \"/vinculos\") {\n await context.dispatch(\"setVinculo\", {\n operacao: context.state.operacao,\n perfil: context.state.perfil,\n vinculo: context.state.vinculo\n });\n }\n\n return await context.dispatch(\"fetchInitRoute\");\n },\n fetchVinculos: async context => {\n const usuario = context.state.userId;\n const vinculos = await ObterVinculos({ usuario });\n if (vinculos && vinculos.Data) {\n context.commit(\"SET_PROP\", { payload: vinculos.Data, prop: \"vinculos\" });\n } else {\n context.commit(\"SET_PROP\", { payload: [], prop: \"vinculos\" });\n }\n },\n fetchMenuData: async context => {\n let menus = [];\n const services = await api.ObterServicosDisponiveis({\n vinculo: context.state.vinculo,\n login: context.state.username,\n operacao: context.state.operacao,\n perfil: context.state.perfil\n });\n if (services?.Data) {\n const allMenus = services.Data.Menu.filter(m => !m.Shortcut);\n allMenus.forEach(a => {\n if (a.View) {\n a.View = a.View.replace(\"views/restrito\", \"\").replace(\".html\", \"\");\n }\n if (!menus.find(m => m.Label === a.Label)) {\n const seguroViagemLegado = a.View.includes(\"Associados/CartaViagem/FormSolicitacao.aspx\");\n if (!seguroViagemLegado || (seguroViagemLegado && context.state.perfil !== PERFIL_ASSOCIADO_KIPP)) {\n menus.push(a);\n }\n }\n });\n }\n context.commit(\"SET_PROP\", { payload: menus, prop: \"menu\" });\n },\n fetchProfileImage: async context => {\n const vinculo = context.state.vinculo;\n const dadosImagem = await minhaConta.ObterImagemProfile({\n vinculo\n });\n let profilePic = \"\";\n if (dadosImagem?.Data) {\n profilePic = `data:image/${dadosImagem.Data.Extensao};base64,${dadosImagem.Data.ImagemB64}`;\n }\n if (vinculo !== context.state.vinculo) return;\n context.commit(\"SET_PROP\", {\n payload: {\n profilePic,\n messages: context.state.profile?.messages ?? []\n },\n prop: \"profile\"\n });\n },\n fetchProfileMessages: async context => {\n const vinculo = context.state.vinculo;\n const welcomeOnBoardTour = context.rootState.myAccount?.welcomeOnBoardTour ?? [];\n const nextTour = welcomeOnBoardTour.find(b => !b.currentResponse);\n let messages = context.state.profile?.messages ?? [];\n messages = messages.filter(\n m =>\n !(\n m.TipoAviso === 1 &&\n m.Cor === \"support-warning\" &&\n m.Icone === \"pen-to-square\" &&\n m.Mensagem === \"Conclua o cadastro das suas informações no app\"\n )\n );\n let onboardTourMessage = null;\n if (nextTour?.id) {\n onboardTourMessage = {\n TipoAviso: 1,\n Alerta: \"N\",\n Cor: \"support-warning\",\n Icone: \"pen-to-square\",\n MensagemPopUp: \"\",\n Mensagem: \"Conclua o cadastro das suas informações no app\",\n Link: ROTA_WELCOME_ONBOARD_TOUR\n };\n messages = [onboardTourMessage, ...messages];\n }\n context.commit(\"SET_PROP\", {\n payload: {\n profilePic: context.state.profile?.profilePic ?? \"\",\n messages\n },\n prop: \"profile\"\n });\n\n const avisos = await minhaConta.ObterAvisos({\n vinculo\n });\n if (avisos?.Data) {\n messages = onboardTourMessage ? [onboardTourMessage] : [];\n if (avisos.Data.length) {\n avisos.Data.forEach((aviso, index) => {\n aviso.index = `${aviso.TipoAviso}-${index}`;\n if (aviso.Link === \"/notifications\") {\n aviso.Link = `${aviso.Link}/${aviso.index}`;\n }\n messages.push(aviso);\n });\n }\n if (vinculo !== context.state.vinculo) return;\n context.commit(\"SET_PROP\", {\n payload: {\n profilePic: context.state.profile?.profilePic ?? \"\",\n messages\n },\n prop: \"profile\"\n });\n }\n },\n fetchCredentials: async context => {\n const vinc = context.state.vinculo;\n let credData = await associado.ObterCredencialEletronica({\n codigoTitulo: vinc\n });\n if (!credData?.Data?.length) return;\n let credenciais = [];\n for (let index = 0; index < credData.Data.length; index++) {\n const element = credData.Data[index];\n\n let credencialMediService = null;\n if (element.BeneficiarioPlanoMedicina > 0) {\n let credTypeMedicina = \"\";\n let codigoCredencialMedicina = element.CodigoCredencialMedicina ?? \"\";\n if (codigoCredencialMedicina.length > 1) {\n codigoCredencialMedicina = codigoCredencialMedicina.substring(0, 1);\n }\n switch (codigoCredencialMedicina) {\n case \"P\":\n credTypeMedicina = \"prata\";\n break;\n case \"S\":\n credTypeMedicina = \"azul\";\n break;\n default:\n credTypeMedicina = context.state.perfil === PERFIL_ASSOCIADO_KIPP ? \"branco\" : \"ouro\";\n break;\n }\n\n credenciais.push({\n id: `med ${index}`,\n cns: element.NumeroCns,\n birth: element.StrDataNascimento,\n bg: element.CaminhoImagemCredenciaMedicina,\n posBg: element.CaminhoImagemCredenciaMedicina\n ? credenciais.length\n : credenciais.find(c => c.id === `med ${element.PosImagemCredenciaMedicina}`).posBg,\n plan: element.CodigoPlanoMedicina,\n valid: element.StrDataFimCredencialMedicina,\n ingress: element.StrDataIngresso,\n number: element.NumeroCredenciaMedicina,\n name: element.NomeBeneficiario,\n credType: credTypeMedicina,\n shareUrl: element.ChaveMedicina,\n numberT: null,\n sex: element.Sexo,\n tipoDocumento: element.TipoDocumento,\n numeroDocumento: element.NumeroDocumento,\n descCreMed: element.DescricaoCredencialMedicina,\n dobIso: element.DataNascimento,\n titular: element.Titular,\n CorBarra: element.CorBarraMedicina,\n CorCredencial: element.CorCredencialMedicina,\n CorFonte: element.CorFonteMedicina,\n typePlan: PLANO_MEDICO,\n vinculo: element.Vinculo\n });\n if (element.NumeroTerceira !== null) {\n credencialMediService = {\n id: `mdsv ${index}`,\n cns: element.NumeroCns,\n birth: element.StrDataNascimento,\n bg: element.CaminhoImagemCredenciaTerc,\n plan: element.IdPlanoTerceira,\n valid: element.StrDataFimCredencialMedicina,\n ingress: element.StrDataIngresso,\n number: element.NumeroCredenciaMedicina,\n name: element.NomeBeneficiario,\n credType: credTypeMedicina,\n shareUrl: element.ChaveTerc,\n numberT: element.NumeroTerceira,\n planT: element.PlanoTerceira,\n accT: element.AcomodacaoTerceira,\n accTp: element.TpAssistencia,\n abrT: element.AbrangenciaTerceira,\n isMdSv: true,\n titular: element.Titular,\n CorBarra: element.CorBarraTerceira,\n CorCredencial: element.CorCredencialTerceira,\n CorFonte: element.CorFonteTerceira,\n typePlan: PLANO_TERCEIRO,\n vinculo: element.Vinculo\n };\n }\n }\n\n if (element.BeneficiarioPlanoOdonto > 0) {\n let credTypeOdonto = \"ouro\";\n if (element.CodigoCredencialOdonto === \"P\") {\n credTypeOdonto = \"prata\";\n } else if (element.CodigoCredencialOdonto === \"S\" || element.CodigoCredencialOdonto === \"O\") {\n credTypeOdonto = \"azul\";\n }\n\n credenciais.push({\n id: `odn ${index}`,\n cns: element.NumeroCns,\n birth: element.StrDataNascimento,\n bg: element.CaminhoImagemCredenciaOdonto,\n posBg: element.CaminhoImagemCredenciaOdonto\n ? credenciais.length\n : credenciais.find(c => c.id === `odn ${element.PosImagemCredenciaOdonto}`).posBg,\n plan: element.CodigoPlanoOdonto,\n valid: element.StrDataFimCredencialOdonto,\n ingress: element.StrDataIngresso,\n number: element.NumeroCredenciaOdonto,\n name: element.NomeBeneficiario,\n credType: credTypeOdonto,\n shareUrl: element.ChaveOdonto,\n numberT: null,\n sex: element.Sexo,\n tipoDocumento: element.TipoDocumento,\n numeroDocumento: element.NumeroDocumento,\n dobIso: element.DataNascimento,\n typePlan: PLANO_ODONTO,\n descCreMed: element.DescricaoCredencialOdonto,\n titular: element.Titular,\n CorBarra: element.CorBarraOdonto,\n CorCredencial: element.CorCredencialOdonto,\n CorFonte: element.CorFonteOdonto,\n isOdonto: true,\n vinculo: element.Vinculo\n });\n }\n\n if (credencialMediService) {\n (credencialMediService.posBg = element.CaminhoImagemCredenciaTerc\n ? credenciais.length\n : credenciais.find(c => c.id === `mdsv ${element.PosImagemCredenciaTerc}`).posBg),\n credenciais.push(credencialMediService);\n }\n }\n\n credenciais.forEach(c => {\n const n = c.number.split(\" \");\n const vinculo = `${n[0]}${n[1]}`;\n const tipoCredencial = c.id.substring(0, 1).toUpperCase();\n c.urlWallet = api.GerarUrlWallet({ vinculo, tipoCredencial });\n });\n\n const hasSmaxPlan = !!credenciais.find(c => c.plan === \"SMAX\");\n if (!hasSmaxPlan) {\n credenciais.forEach(c => {\n c.CorFonte = \"#FFF\";\n });\n }\n\n context.commit(\"SET_PROP\", { payload: credenciais, prop: \"credentials\" });\n\n const loggedUserCredential = credData?.Data?.find(credential => credential.Vinculo === vinc);\n context.commit(\"SET_PROP\", {\n payload: loggedUserCredential?.BeneficiarioPlanoMedicina > 0,\n prop: \"hasMedicCredentials\"\n });\n context.commit(\"SET_PROP\", {\n payload: loggedUserCredential?.BeneficiarioPlanoOdonto > 0,\n prop: \"hasOdontoCredentials\"\n });\n\n context.dispatch(\"checkCredentialAppVersion\");\n },\n checkCredentialAppVersion: async context => {\n if (context.rootGetters[\"biometrics/onNative\"]) {\n // aguardar definição de versão do app preparada para a alteração das credenciais\n if (Number.parseInt(localStorage.getItem(\"native_version\") || \"0\") < 999) {\n let credenciais = context.state.credentials.map(c => {\n if (c.bg) {\n return c;\n } else {\n let copy = {};\n for (var attr in c) {\n copy[attr] = c[attr];\n }\n copy.bg = context.state.credentials[c.posBg].bg;\n return copy;\n }\n });\n while (credenciais !== null && credenciais.length > 0 && !setStorageData(\"credentials\", credenciais)) {\n credenciais.pop();\n }\n }\n }\n },\n async fetchCredentialsLinks(context, id) {\n if (!id) return;\n const credenciais = context.state.credentials;\n const c = credenciais.find(c => c.id === id);\n if (c.shareUrl && c.urlWallet)\n return {\n shareUrl: c.shareUrl,\n urlWallet: c.urlWallet\n };\n try {\n const n = c.number.split(\" \");\n const vinculo = `${n[0]}${n[1]}`;\n const tipoCredencial = c.id.substring(0, 1).toUpperCase();\n c.urlWallet = await api.GerarUrlWallet({ vinculo, tipoCredencial });\n const chave = await associado.GerarCredencialEletronicaCompartilhada({\n vinculo,\n tipoCredencial\n });\n c.shareUrl = chave.Data;\n context.commit(\"SET_PROP\", { payload: credenciais, prop: \"credentials\" });\n return {\n shareUrl: c.shareUrl,\n urlWallet: c.urlWallet\n };\n } catch (error) {\n return {\n shareUrl: c.shareUrl,\n urlWallet: c.urlWallet\n };\n }\n },\n setBigFontSize: async (context, bigFontSize) => {\n context.commit(\"SET_PROP\", { payload: bigFontSize, prop: \"bigFontSize\" });\n },\n uploadFile: async (context, { filename, blobFile }) => {\n return await atendimento.FileUpload({\n vinculo: context.state.vinculo,\n filename,\n blobFile\n });\n },\n changeProfilePick: async (context, { blobFile }) => {\n await minhaConta.AlterarImagemProfile({\n vinculo: context.state.vinculo,\n filename: \"tests/logo-omint.jpg\",\n blobFile\n });\n },\n async registerAlertNotification(context, { classificacao, tipoAviso, chamadoReferenciado }) {\n const registro = await atendimento.RegistroCienteAviso({\n vinculo: context.state.vinculo,\n classificacao,\n tipoAviso,\n chamadoReferenciado\n });\n if (registro && registro.Data) {\n await context.dispatch(\"fetchProfileMessages\");\n }\n },\n async forceSWupdate(context) {\n if (!navigator.onLine) {\n return false;\n }\n //verifica se mudou a versão do pwa\n var pwaVersion = await api.PWAVersion();\n if (!pwaVersion || !pwaVersion.Data || pwaVersion.Data === context.state.pwaVersion) {\n return false;\n }\n context.commit(\"SET_PROP\", { payload: pwaVersion.Data, prop: \"pwaVersion\" });\n setStorageData(\"pwaVersion\", pwaVersion.Data);\n return true;\n },\n async testSession(context) {\n try {\n const situacao = await minhaConta.SituacaoSessao({\n vinculo: context.state.vinculo\n });\n return situacao?.Data ?? true;\n } catch {\n return true;\n }\n },\n async removeUserAccount(context) {\n const response = await api.RemoveAccount({ vinculo: context.state.vinculo });\n return !(response instanceof Error);\n },\n fetchFavoriteMenus: async (context, { retornarAtalhos }) => {\n const vinculo = context.state.vinculo;\n\n const favoritos = await api.ObterMenusFavoritos({ vinculo, retornarAtalhos });\n if (favoritos?.length) {\n favoritos.forEach(a => {\n if (a.View) {\n a.View = a.View.replace(\"views/restrito\", \"\").replace(\".html\", \"\");\n }\n });\n }\n if (retornarAtalhos) {\n context.commit(\"SET_PROP\", { payload: favoritos, prop: \"menusFavoritos\" });\n }\n return favoritos;\n },\n saveFavoriteMenus: async (context, { menus }) => {\n const vinculo = context.state.vinculo;\n return await api.GravarMenusFavoritos({ vinculo, menus });\n },\n getOnboardOptin: async (context, { template }) => {\n if (!template || template === \"0\") return;\n return await minhaConta.ObtemOptinPendente({\n vinculo: context.state.vinculo,\n template,\n sistema: \"PWA OMINT ONBOARD\"\n });\n },\n saveClosedOnboard: async (context, { onboard, sendToServer, template }) => {\n context.commit(\"PUSH_CLOSE_ONBOARD\", onboard);\n\n if (sendToServer) {\n const vinculo = context.state.vinculo;\n const login = context.state.username;\n\n try {\n await associado.AceitaOptin({\n vinculo,\n template,\n login\n });\n } catch (error) {\n throw new Error(error);\n }\n }\n }\n }\n};\n","import {\n ObterOptin,\n AceiteOptinUsuario,\n AlterarSenha,\n ProgramaScreening,\n ProgramaScreeningAceite,\n ObterBlogPosts,\n ObterImagem,\n OnBoardTourPendente,\n ObterRegrasOnBoardTour,\n EnviarTokenValidacao,\n InformarCodigoValidacao,\n SituacaoSessao,\n PermissaoFuncionalidade,\n RegistrarAcesso,\n RespostaOnBoardTour,\n VerificarAlteracaoSenhaPendente\n} from \"@/api/minhaConta\";\nimport { EnviarCodigoRecuperarSenha, InformarCodigoRecuperarSenha } from \"../api/api\";\nimport { ExisteChamadoPendenteProcessamento, RegistroNavegacaoRef } from \"@/api/atendimento\";\nimport { checkUpdatePermission, allowUpdate } from \"@/utils/checkReadonlyUtil\";\nimport { ROTA_BASE, ROTA_WELCOME_ONBOARD_TOUR } from \"@/utils/perfilRouteUtil\";\nimport { isMobile } from \"@/utils/utils\";\n\n/**\n * terms: {Descricao: String, Id: Int, Link: String}\n * acceptance: {[Id]: 'S' | 'N'}\n * */\nconst initialState = {\n terms: [],\n acceptance: {},\n resetPassword: {},\n screeningTerms: {},\n blogPosts: [],\n hasWelcomeOnboard: false,\n welcomeOnBoardTour: [],\n welcomeOnBoardTourStep: 0,\n welcomeOnBoardTourCode: \"\",\n welcomeOnBoardTourAuth: 0,\n welcomeOnBoardTourRules: {},\n changePasswordRequired: false\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async fetchTerms(context) {\n const terms = await ObterOptin({\n login: context.rootState.saude.username\n });\n\n if (terms && terms.Data) {\n context.commit(\"SET_TERMS\", terms.Data);\n }\n },\n async saveAndCheckNextWelcomeOnBoardTour(context) {\n await context.dispatch(context.state.welcomeOnBoardTourRules.action, null, { root: true });\n return await context.dispatch(\"checkNextWelcomeOnBoardTour\");\n },\n async checkNextWelcomeOnBoardTour(context) {\n const idx = context.state.welcomeOnBoardTourStep;\n if (idx !== null) {\n await context.dispatch(\"submitWelcomeOnBoardTour\", {\n id: context.state.welcomeOnBoardTour[idx].id,\n option: false\n });\n } else {\n context.commit(\"SET_WELCOME_ONBOARD_TOUR_STEP\", null);\n return ROTA_BASE;\n }\n const nextBoard = context.state.welcomeOnBoardTour.find(b => b.idx > idx && !b.currentResponse);\n if (nextBoard) {\n return nextBoard.pathTo\n ? `${ROTA_WELCOME_ONBOARD_TOUR}${nextBoard.pathTo}/resume`\n : `${ROTA_WELCOME_ONBOARD_TOUR}?id=${nextBoard.id}`; //avoid redundance\n }\n context.commit(\"SET_WELCOME_ONBOARD_TOUR_STEP\", null);\n return ROTA_BASE;\n },\n async fetchWelcomeOnBoardTour(context) {\n if (!allowUpdate()) {\n context.commit(\"SET_HAS_WELCOME_TOUR\", false);\n return;\n }\n // fluxo aparece apenas em mobile\n if (!isMobile()) {\n context.commit(\"SET_HAS_WELCOME_TOUR\", false);\n return;\n }\n\n const v25 = Number.parseInt(localStorage.getItem(\"native_version\")) >= 25;\n const onNative = context.rootGetters[\"biometrics/onNative\"];\n const hasBiometric = context.rootState.biometrics.hasBiometric;\n const allowSettings = (v25 && onNative) || hasBiometric;\n // verifica se existe alguma etapa do fluxo pendente\n try {\n const hasOnBoardTour = await OnBoardTourPendente({\n vinculo: context.rootState.saude.vinculo,\n configuracoes: allowSettings\n });\n context.commit(\"SET_HAS_WELCOME_TOUR\", hasOnBoardTour?.Data ?? false);\n } catch {\n context.commit(\"SET_HAS_WELCOME_TOUR\", false);\n }\n },\n async checkhWelcomeOnBoardTourPages(context) {\n try {\n if (!context.state.hasWelcomeOnboard) return;\n let rotas = [];\n (context.rootState.saude.menu ?? []).forEach(m => {\n if (m.View) rotas.push(m.View);\n });\n (context.rootState.saude.menusFavoritos ?? []).forEach(m => {\n if (m.View) rotas.push(m.View);\n });\n rotas = [...new Set(rotas)];\n const v25 = Number.parseInt(localStorage.getItem(\"native_version\")) >= 25;\n const onNative = context.rootGetters[\"biometrics/onNative\"];\n const hasBiometric = context.rootState.biometrics.hasBiometric;\n const allowSettings = (v25 && onNative) || hasBiometric;\n // verifica se existe alguma etapa do fluxo pendente\n const rules = await ObterRegrasOnBoardTour({\n vinculo: context.rootState.saude.vinculo,\n configuracoes: allowSettings,\n rotas\n });\n const welcomeOnBoardTourCode = rules?.Data?.Grupo ?? \"\";\n const welcomeOnBoardTour = (rules?.Data?.Regras ?? []).map((b, index) => ({\n id: b.Id,\n idx: index,\n order: b.Ordem,\n title: b.Titulo,\n icon: b.Icone,\n subtitle: b.Subtitulo,\n description: b.Descricao,\n pathTo: b.Rota,\n accessLabel: b.AcaoAcessar,\n nextLabel: b.AcaoPular,\n currentResponse: b.Resposta,\n changeOnlyWithAuth: b.RequerAutorizacao\n }));\n context.commit(\"SET_WELCOME_ONBOARD_TOUR_CODE\", welcomeOnBoardTourCode);\n context.commit(\"SET_WELCOME_ONBOARD_TOUR\", welcomeOnBoardTour);\n } catch {\n context.commit(\"SET_WELCOME_ONBOARD_TOUR_CODE\", \"\");\n context.commit(\"SET_WELCOME_ONBOARD_TOUR\", []);\n }\n },\n async fetchScreeningTerms(context) {\n const terms = await ProgramaScreening({\n vinculo: context.rootState.saude.vinculo\n });\n\n if (terms && terms.Data) {\n context.commit(\"SET_SCREENING_TERMS\", terms.Data);\n }\n },\n async acceptScreeningTerms(context) {\n checkUpdatePermission();\n return await ProgramaScreeningAceite({\n vinculo: context.rootState.saude.vinculo,\n login: context.rootState.saude.username\n });\n },\n async answerToTerms(context, { id, ans }) {\n context.commit(\"ANSWER_TERM\", { id, ans });\n },\n async updateWelcomeOnBoardTourCompl(context, { pathTo, option }) {\n const step = context.state.welcomeOnBoardTour.find(t => t.pathTo === pathTo);\n if (!step) return;\n await context.dispatch(\"submitWelcomeOnBoardTour\", { id: step.id, option });\n },\n async submitWelcomeOnBoardTour(context, { id, option }) {\n const newResponse = option ? \"A\" : \"P\";\n let changedOnBoard = {};\n const respondidos = [];\n const pendentes = [];\n context.state.welcomeOnBoardTour.forEach(b => {\n const newObBoard = { ...b };\n if (b.id === id) {\n newObBoard.currentResponse = newResponse;\n changedOnBoard = newObBoard;\n }\n if (newObBoard.currentResponse) {\n respondidos.push(newObBoard);\n } else {\n pendentes.push(newObBoard);\n }\n });\n const welcomeOnBoardTour = [...respondidos, ...pendentes];\n welcomeOnBoardTour.forEach((b, index) => (b.idx = index));\n const currentStep = changedOnBoard.order === 0 && newResponse === \"P\" ? 0 : changedOnBoard.idx;\n context.commit(\"SET_WELCOME_ONBOARD_TOUR\", welcomeOnBoardTour);\n if (pendentes.length > 0) {\n context.commit(\"SET_WELCOME_ONBOARD_TOUR_STEP\", currentStep);\n } else {\n context.commit(\"SET_WELCOME_ONBOARD_TOUR_STEP\", null);\n await context.dispatch(\"saude/fetchProfileMessages\", null, { root: true });\n }\n\n checkUpdatePermission();\n await RespostaOnBoardTour({\n vinculo: context.rootState.saude.vinculo,\n codigo: context.state.welcomeOnBoardTourCode,\n id,\n resposta: newResponse\n });\n },\n async submitTerms(context) {\n if (!allowUpdate()) {\n context.commit(\"SET_TERMS\", []);\n return;\n }\n\n const login = context.rootState.saude.username;\n const promisses = [];\n Object.keys(context.state.acceptance).forEach(k => {\n promisses.push(\n AceiteOptinUsuario({\n termo: k,\n aceite: context.state.acceptance[k],\n login\n })\n );\n });\n if (promisses.length > 0) {\n await await Promise.all(promisses);\n }\n await context.dispatch(\"fetchTerms\");\n },\n async changePassword(context, { currentPassword, newPassword, auth }) {\n checkUpdatePermission();\n const result = await AlterarSenha({\n vinculo: context.rootState.saude.vinculo,\n senhaAtual: currentPassword,\n novaSenha: newPassword,\n autenticacao: auth\n });\n if (result && result.Data) {\n if (result.Data) {\n context.commit(\"SET_CHANGE_PASSWORD_REQUIRED\", false);\n }\n return result.Data;\n }\n return false;\n },\n async sendResetPassordCode(context, { email }) {\n const resp = await EnviarCodigoRecuperarSenha({\n email\n });\n if (resp && resp.Data) {\n context.commit(\"SET_RESET_PASSWORD\", resp.Data);\n return { success: true };\n }\n return { success: false, msg: \"Não foi possível encontrar o usuário informado.\" };\n },\n async checkCodeAndChangePassword(_, { codigo, email, password }) {\n return await InformarCodigoRecuperarSenha({\n codigo,\n email,\n password\n });\n },\n async hasActiveTicket(context, { beneficiaryCode }) {\n if (!beneficiaryCode) return false;\n\n const response = await ExisteChamadoPendenteProcessamento({\n vinculo: context.rootState.saude.vinculo,\n beneficiario: beneficiaryCode,\n servico: 1\n });\n return !!(response instanceof Error ? false : response?.Data);\n },\n async fetchImage(context, { documento, original }) {\n return await ObterImagem({\n vinculo: context.rootState.saude.vinculo,\n documento,\n original\n });\n },\n async sendValidationCode(context, { phone, email, id, key, service }) {\n if (service && !service.startsWith(\"/\")) {\n try {\n service = context.rootGetters[service];\n } catch (error) {\n window.$log.message(`using service ${service}`);\n }\n }\n const telefone = phone?.replace(\"(\", \"\").replace(\") \", \"-\");\n const response = await EnviarTokenValidacao({\n vinculo: context.rootState.saude.vinculo,\n telefone,\n email,\n id,\n chave: key,\n servico: service\n });\n if (response instanceof Error || !response?.Data)\n return {\n enviado: false\n };\n return response.Data;\n },\n async validateCode(context, { phone, email, id, key, code, auth, service }) {\n if (service && !service.startsWith(\"/\")) {\n try {\n service = context.rootGetters[service];\n } catch (error) {\n window.$log.message(`using service ${service}`);\n }\n }\n const telefone = phone?.replace(\"(\", \"\").replace(\") \", \"-\");\n const response = await InformarCodigoValidacao({\n vinculo: context.rootState.saude.vinculo,\n telefone,\n email,\n id,\n chave: key,\n codigo: code,\n autenticacao: auth,\n servico: service\n });\n return response instanceof Error ? false : response?.Data ?? false;\n },\n async sessionState(context) {\n try {\n if (!context.rootState.saude.vinculo) return true;\n\n const situacao = await SituacaoSessao({\n vinculo: context.rootState.saude.vinculo\n });\n return situacao instanceof Error ? true : situacao?.Data ?? true;\n } catch {\n return true;\n }\n },\n async registerAccess(context, { servico, funcionalidade, id }) {\n try {\n let vinculo = context.rootState.saude.vinculo;\n if (!vinculo && context.rootState.saude.vinculos?.length) {\n vinculo = context.rootState.saude.vinculos[0].Vinculos[0].NumeroIdentificacaoVinculo;\n }\n if (!vinculo) return true;\n if (!allowUpdate()) return true;\n\n RegistrarAcesso({\n vinculo,\n dsUsuario: context.rootState.saude.username,\n servico,\n funcionalidade,\n id\n });\n return true;\n } catch {\n return false;\n }\n },\n async registerNavigation(context, { classificacao }) {\n try {\n let vinculo = context.rootState.saude.vinculo;\n if (!vinculo && context.rootState.saude.vinculos?.length) {\n vinculo = context.rootState.saude.vinculos[0].Vinculos[0].NumeroIdentificacaoVinculo;\n }\n if (!vinculo) return true;\n if (!allowUpdate()) return true;\n\n RegistroNavegacaoRef({\n vinculo: context.rootState.saude.vinculo,\n chamadoReferenciado: context.rootState.saude.chamadoRef,\n classificacao\n });\n return true;\n } catch {\n return false;\n }\n },\n async fetchAccessResource(context, { funcionalidade, permissao }) {\n const response = await PermissaoFuncionalidade({\n vinculo: context.rootState.saude.vinculo,\n funcionalidade,\n permissao\n });\n return response instanceof Error ? false : response?.Data ?? false;\n },\n async fetchBlogPosts(context) {\n if (context.state.blogPosts?.length) return;\n const response = await ObterBlogPosts({\n vinculo: context.rootState.saude.vinculo\n });\n const blogPosts = response instanceof Error ? [] : response?.Data ?? [];\n context.commit(\"SET_BLOG_POSTS\", blogPosts);\n },\n async fetchChangePasswordRequired(context) {\n if (!allowUpdate()) return;\n const response = await VerificarAlteracaoSenhaPendente({\n vinculo: context.rootState.saude.vinculo\n });\n const changePasswordRequired = response instanceof Error ? false : response?.Data ?? false;\n context.commit(\"SET_CHANGE_PASSWORD_REQUIRED\", changePasswordRequired);\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => (state[p] = initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => (state[p] = initialState[p])),\n SET_TERMS: (state, next) => (state.terms = next),\n SET_SCREENING_TERMS: (state, next) => (state.screeningTerms = next),\n SET_RESET_PASSWORD: (state, next) => (state.resetPassword = next),\n SET_BLOG_POSTS: (state, blogPosts) => (state.blogPosts = blogPosts),\n SET_CHANGE_PASSWORD_REQUIRED: (state, next) => (state.changePasswordRequired = next),\n SET_HAS_WELCOME_TOUR: (state, next) => (state.hasWelcomeOnboard = next),\n SET_WELCOME_ONBOARD_TOUR: (state, next) => (state.welcomeOnBoardTour = next),\n SET_WELCOME_ONBOARD_TOUR_STEP: (state, next) => (state.welcomeOnBoardTourStep = next),\n SET_WELCOME_ONBOARD_TOUR_CODE: (state, next) => (state.welcomeOnBoardTourCode = next),\n SET_WELCOME_ONBOARD_TOUR_AUTH: (state, next) => (state.welcomeOnBoardTourAuth = next),\n SET_WELCOME_ONBOARD_TOUR_AUTH_RULES: (state, next) => (state.welcomeOnBoardTourRules = next),\n ANSWER_TERM: (state, { id, ans }) => (state.acceptance[id] = ans)\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/PushNotification`;\n\nexport async function RegistrarDevice({ vinculo, perfil, token, system, systemVersion }) {\n return window.$axios\n .post({\n url: `${baseURL}/RegistrarDevice`,\n query: {\n idOperacaoPerfilOmint: perfil,\n nrVinculo: vinculo,\n deviceId: token,\n sistemaOperacional: system,\n versaoSistemaOperacional: systemVersion\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RegistrarDevice\", error.message);\n return error;\n });\n}\n","import Vue from \"vue\";\nimport { RegistrarDevice } from \"../api/pushNotification\";\nimport { allowUpdate } from \"@/utils/checkReadonlyUtil\";\n\nlet initialState = {\n token: \"\",\n system: \"\",\n systemVersion: \"\",\n isTokenUpdated: false\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n getters: {\n initialized: state => state.token !== \"\" && state.system !== \"\" && state.systemVersion !== \"\"\n },\n actions: {\n async LoadTokenData(context) {\n const rawToken = localStorage.getItem(\"mobile_token\");\n if (rawToken && rawToken !== \"\") {\n const tokenData = JSON.parse(rawToken);\n await context.commit(\"SET_TOKEN\", tokenData.token);\n await context.commit(\"SET_SYSTEM\", tokenData.system);\n await context.commit(\"SET_SYSTEM_VERSION\", tokenData.systemVersion);\n const oldToken = localStorage.getItem(\"mobile_token_saved\");\n await context.commit(\"SET_IS_TOKEN_UPDATED\", oldToken === rawToken);\n } else {\n await context.commit(\"SET_IS_TOKEN_UPDATED\", true);\n }\n },\n async SyncToken(context) {\n if (!context.rootState.saude.vinculo) return;\n if (context.state.isTokenUpdated) return;\n if (!allowUpdate()) return;\n await RegistrarDevice({\n vinculo: context.rootState.saude.vinculo,\n perfil: context.rootState.saude.perfil || 1,\n token: context.state.token,\n system: context.state.system,\n systemVersion: context.state.systemVersion\n });\n\n const { token, system, systemVersion } = context.state;\n localStorage.setItem(\n \"mobile_token_saved\",\n JSON.stringify({\n token,\n system,\n systemVersion\n })\n );\n }\n },\n mutations: {\n LOGOUT_USER: state => state,\n RESET_CONTEXT: state => state,\n SET_TOKEN: (state, token) => Vue.set(state, \"token\", token),\n SET_SYSTEM: (state, system) => Vue.set(state, \"system\", system),\n SET_SYSTEM_VERSION: (state, systemVersion) => Vue.set(state, \"systemVersion\", systemVersion),\n SET_IS_TOKEN_UPDATED: (state, isTokenUpdated) => Vue.set(state, \"isTokenUpdated\", isTokenUpdated)\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/Biometria`;\n\nexport async function Cadastrar({ vinculo, selfie }) {\n return window.$axios\n .post({\n url: `${baseURL}/Cadastrar`,\n query: {\n vinculo\n },\n data: {\n selfie\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"Cadastrar\", error.message);\n return error;\n });\n}\n\nexport async function VerificarCadastro({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/VerificarCadastro`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"VerificarCadastro\", error.message);\n return error;\n });\n}\n\nexport async function Autenticar({ vinculo, servico, selfie }) {\n return window.$axios\n .post({\n url: `${baseURL}/Autenticar`,\n query: {\n vinculo\n },\n data: {\n servico,\n selfie\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"Autenticar\", error.message);\n return error;\n });\n}\n\nexport async function GerarQRCode({ vinculo, servico, telefone }) {\n return window.$axios\n .post({\n url: `${baseURL}/GerarQRCode`,\n query: {\n vinculo\n },\n data: {\n servico,\n telefone\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"GerarQRCode\", error.message);\n return error;\n });\n}\n\nexport async function VerificarQRCode({ vinculo, servico, token, id }) {\n return window.$axios\n .post({\n url: `${baseURL}/VerificarQRCode`,\n query: {\n vinculo\n },\n data: {\n servico,\n token,\n id\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"VerificarQRCode\", error.message);\n return error;\n });\n}\n\nexport async function RegistrarErro({ vinculo, codigo, descricao }) {\n return window.$axios\n .post({\n url: `${baseURL}/RegistrarErro`,\n query: {\n vinculo\n },\n data: {\n codigo,\n descricao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RegistrarErro\", error.message);\n return error;\n });\n}\n","import Vue from \"vue\";\nimport { app, bus } from \"../main\";\nimport store from \"../store\";\nimport {\n Cadastrar,\n VerificarCadastro,\n Autenticar,\n GerarQRCode,\n VerificarQRCode,\n RegistrarErro\n} from \"../api/biometria\";\n\nconst getInitialState = () => {\n const initialState = {\n hasBiometric: false,\n shoudUseBiometric: false,\n isUserAuthenticated: false,\n listenersRegistred: false,\n nativeShareEnabled: false,\n storage: \"\",\n camera: \"\",\n microfone: \"\",\n location: \"\"\n };\n const rawShouldUseBiometric = localStorage.getItem(\"biometrics/shouldUseBiometric\");\n if (rawShouldUseBiometric === \"yes\") {\n initialState.shoudUseBiometric = true;\n }\n return initialState;\n};\n\nconst OnUserAuth = globalStore => message => {\n const { auth } = JSON.parse(message);\n if (auth) {\n globalStore.dispatch(\"biometrics/setAuthenticated\");\n }\n};\n\nconst OnEnableBiometric = globalStore => message => {\n const { status } = JSON.parse(message);\n globalStore.dispatch(\"biometrics/setBiometricEnabled\", status);\n};\n\nconst OnIsAvailable = globalStore => message => {\n const { available } = JSON.parse(message);\n globalStore.dispatch(\"biometrics/setBiometric\", available);\n};\n\nconst onNativeShareIsAvailable = globalStore => message => {\n const { available } = JSON.parse(message);\n globalStore.dispatch(\"biometrics/setNativeShare\", available);\n};\n\nconst onResourceStatusChange = globalStore => message => {\n const { storageState, cameraState, microfoneState, locationState } = JSON.parse(message);\n if (storageState) {\n globalStore.dispatch(\"biometrics/setStorageState\", storageState);\n }\n if (cameraState) {\n globalStore.dispatch(\"biometrics/setCameraState\", cameraState);\n }\n if (microfoneState) {\n globalStore.dispatch(\"biometrics/setMicrofoneState\", microfoneState);\n }\n if (locationState) {\n globalStore.dispatch(\"biometrics/setLocationState\", locationState);\n }\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: getInitialState,\n getters: {\n onNative: () => {\n if (process.env.VUE_APP_FORCE_NATIVE === \"true\") return true;\n return !!app?.$native || false;\n }\n },\n actions: {\n registerListeners(context) {\n if (!context.state.listenersRegistred && app.$native) {\n bus.$on(\"biometrics:isAvailable\", OnIsAvailable(store));\n bus.$on(\"biometrics:enable\", OnEnableBiometric(store));\n bus.$on(\"biometrics:auth\", OnUserAuth(store));\n bus.$on(\"native_share:isAvailable\", onNativeShareIsAvailable(store));\n bus.$on(\"resource_status\", onResourceStatusChange(store));\n context.commit(\"SET_LISTENERS_REGISTRED\", true);\n }\n },\n cleanStorage() {\n if (!app.$native) return;\n app.$native.postMessage(JSON.stringify({ type: \"clean_storage\" }));\n },\n authenticateUser(context) {\n if (!app.$native) return;\n context.commit(\"SET_IS_USER_AUTHENTICATED\", false);\n app.$native.postMessage(JSON.stringify({ type: \"biometrics:auth\" }));\n },\n enableBiometric() {\n if (!app.$native) return;\n app.$native.postMessage(JSON.stringify({ type: \"biometrics:enable\" }));\n },\n checkForBiometric(context) {\n if (!app.$native) return;\n if (!context.state.hasBiometric) {\n app.$native.postMessage(JSON.stringify({ type: \"biometrics:isAvailable\" }));\n }\n },\n checkForNativeShare(_) {\n if (!app.$native) return;\n app.$native.postMessage(JSON.stringify({ type: \"native_share:isAvailable\" }));\n },\n setAuthenticated(context) {\n if (!app.$native) return;\n context.commit(\"SET_IS_USER_AUTHENTICATED\", true);\n },\n setBiometric(context, hasBiometric) {\n if (!app.$native) return;\n context.commit(\"SET_HAS_BIOMETRIC\", hasBiometric);\n },\n setBiometricEnabled(context, status) {\n if (!app.$native) return;\n context.commit(\"SET_SHOULD_USE_BIOMETRIC\", status);\n context.commit(\"SET_IS_USER_AUTHENTICATED\", status);\n },\n disableBiometric(context) {\n if (!app.$native) return;\n context.commit(\"SET_SHOULD_USE_BIOMETRIC\", false);\n context.commit(\"SET_IS_USER_AUTHENTICATED\", false);\n },\n shareImage(context, { title, data }) {\n if (!app.$native) return false;\n if (context.state.nativeShareEnabled) {\n app.$native.postMessage(JSON.stringify({ type: \"share_image_binary\", payload: { title, data } }));\n }\n return context.state.nativeShareEnabledue;\n },\n setNativeShare(context, status) {\n if (!app.$native) return;\n context.commit(\"SET_HAS_NATIVE_SHARE\", status);\n },\n setUserAuthenticationState(_, authenticated) {\n if (!this.$native) return;\n this.$native.postMessage(\n JSON.stringify({\n type: authenticated ? \"authenticated:true\" : \"authenticated:false\"\n })\n );\n },\n requestPermissionForResource(_, resource) {\n if (!app.$native) return false;\n app.$native.postMessage(JSON.stringify({ type: \"request_permission\", payload: { resource } }));\n return true;\n },\n openAppSettings() {\n if (!app.$native) return false;\n app.$native.postMessage(JSON.stringify({ type: \"open_app_settings\", payload: {} }));\n return true;\n },\n checkPermissionForResource(_, resource) {\n if (!app.$native) return false;\n app.$native.postMessage(JSON.stringify({ type: \"check_permission\", payload: { resource } }));\n return true;\n },\n setStorageState(context, state) {\n context.commit(\"SET_STORAGE_STATE\", state);\n },\n setMicrofoneState(context, state) {\n context.commit(\"SET_MICROFONE_STATE\", state);\n },\n setCameraState(context, state) {\n context.commit(\"SET_CAMERA_STATE\", state);\n },\n setLocationState(context, state) {\n context.commit(\"SET_LOCATION_STATE\", state);\n },\n async authFace(context, { service, selfie }) {\n if (service && !service.startsWith(\"/\")) {\n try {\n service = context.rootGetters[service];\n } catch (error) {\n window.$log.message(`using service ${service}`);\n }\n }\n const response = await Autenticar({\n vinculo: context.rootState.saude.vinculo,\n servico: service,\n selfie\n });\n if (response instanceof Error) throw new Error(response.message ?? \"Não foi possível realizar a autenticação\");\n return response.Data;\n },\n async saveFace(context, { selfie }) {\n const response = await Cadastrar({\n vinculo: context.rootState.saude.vinculo,\n selfie\n });\n if (response instanceof Error)\n throw new Error(response.message ?? \"Não foi possível realizar o cadastro da biometria\");\n return response.Data;\n },\n async fetchFaceStatus(context, _) {\n const response = await VerificarCadastro({\n vinculo: context.rootState.saude.vinculo\n });\n if (response instanceof Error)\n throw new Error(response.message ?? \"Não foi possível verificar a situação do cadastro\");\n return response.Data;\n },\n async registerError(context, { cod, dsc }) {\n const response = await RegistrarErro({\n vinculo: context.rootState.saude.vinculo,\n codigo: cod,\n descricao: dsc\n });\n return response?.Data ?? {};\n },\n async createAuthQRCode(context, { service, phone }) {\n const response = await GerarQRCode({\n vinculo: context.rootState.saude.vinculo,\n servico: service,\n telefone: phone\n });\n if (response instanceof Error) throw new Error(response.message ?? \"Não foi possível gerar o QRCode\");\n return response.Data;\n },\n async fetchQRCodeStatus(context, { service, token, id }) {\n const response = await VerificarQRCode({\n vinculo: context.rootState.saude.vinculo,\n servico: service,\n token,\n id\n });\n if (response instanceof Error)\n throw new Error(response.message ?? \"Não foi possível verificar a situação do QRCode\");\n return response.Data;\n }\n },\n mutations: {\n LOGOUT_USER: state => state,\n RESET_CONTEXT: state => state,\n SET_HAS_BIOMETRIC: (state, value) => {\n Vue.set(state, \"hasBiometric\", value);\n },\n SET_SHOULD_USE_BIOMETRIC: (state, value) => {\n localStorage.setItem(\"biometrics/shouldUseBiometric\", value ? \"yes\" : \"no\");\n Vue.set(state, \"shoudUseBiometric\", value);\n },\n SET_IS_USER_AUTHENTICATED: (state, value) => {\n localStorage.setItem(\"biometrics/isUserAuthenticated\", value ? \"yes\" : \"no\");\n Vue.set(state, \"isUserAuthenticated\", value);\n },\n SET_LISTENERS_REGISTRED: (state, value) => {\n Vue.set(state, \"listenersRegistred\", value);\n },\n SET_HAS_NATIVE_SHARE: (state, value) => {\n Vue.set(state, \"nativeShareEnabled\", value);\n },\n SET_STORAGE_STATE: (state, value) => {\n Vue.set(state, \"storage\", value);\n },\n SET_MICROFONE_STATE: (state, value) => {\n Vue.set(state, \"microfone\", value);\n },\n SET_CAMERA_STATE: (state, value) => {\n Vue.set(state, \"camera\", value);\n },\n SET_LOCATION_STATE: (state, value) => {\n Vue.set(state, \"location\", value);\n }\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/Formulario`;\n\nexport async function BuscarPergunta({ vinculo, formulario }) {\n return window.$axios\n .get({\n url: `${baseURL}/BuscarPergunta`,\n query: {\n vinculo,\n formulario\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"BuscarPergunta\", error.message);\n return error;\n });\n}\n\nexport async function Responder({ vinculo, identificacao, formulario, pergunta, resposta, subRespostas }) {\n return window.$axios\n .post({\n url: `${baseURL}/Responder`,\n query: {\n vinculo,\n identificacao,\n formulario,\n pergunta,\n resposta\n },\n data: subRespostas\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"Responder\", error.message);\n return error;\n });\n}\n\nexport async function LigarDrOmint({ vinculo, identificacao, telefone }) {\n return window.$axios\n .post({\n url: `${baseURL}/LigarDrOmint`,\n query: {\n vinculo,\n identificacao,\n telefone\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"LigarDrOmint\", error.message);\n return error;\n });\n}\n\nexport async function RegistrarAgenda({\n vinculo,\n id,\n prestador,\n telefone,\n email,\n inicioDisponibilidade,\n terminoDisponibilidade\n}) {\n return window.$axios\n .post({\n url: `${baseURL}/RegistrarAgenda`,\n query: {\n vinculo,\n id,\n prestador,\n telefone,\n email,\n inicioDisponibilidade: inicioDisponibilidade.toJSON(),\n terminoDisponibilidade: terminoDisponibilidade.toJSON()\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RegistrarAgenda\", error.message);\n return error;\n });\n}\n\nexport async function ListarAgenda({ vinculo, referencia }) {\n return window.$axios\n .get({\n url: `${baseURL}/ListarAgenda`,\n query: {\n vinculo,\n referencia: referencia.toJSON()\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ListarAgenda\", error.message);\n return error;\n });\n}\n","import Vue from \"vue\";\nimport * as apiFormulario from \"@/api/formulario\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nlet initialState = {\n formulario: 0,\n questionario: null,\n agenda: [],\n horarios: [],\n prestadores: []\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async perguntaInicial(context, { formulario }) {\n await context.commit(\"SET_FORMULARIO\", formulario);\n const novoQuestionario = await apiFormulario.BuscarPergunta({\n vinculo: context.rootState.saude.vinculo,\n formulario\n });\n if (novoQuestionario && novoQuestionario.Data) {\n await context.commit(\"SET_QUESTIONARIO\", novoQuestionario.Data);\n }\n },\n async responder(context, { resposta, subRespostas }) {\n checkUpdatePermission();\n const identificacao = context.state.questionario.Identificacao ? context.state.questionario.Identificacao : 0;\n const novoQuestionario = await apiFormulario.Responder({\n vinculo: context.rootState.saude.vinculo,\n identificacao,\n formulario: context.state.formulario,\n pergunta: context.state.questionario.Pergunta.Id,\n resposta,\n subRespostas\n });\n if (novoQuestionario && novoQuestionario.Data) {\n await context.commit(\"SET_QUESTIONARIO\", novoQuestionario.Data);\n }\n },\n async ligarDrOmint(context, { telefone }) {\n checkUpdatePermission();\n const identificacao = context.state.questionario.Identificacao ? context.state.questionario.Identificacao : 0;\n return await apiFormulario.LigarDrOmint({\n vinculo: context.rootState.saude.vinculo,\n identificacao,\n telefone\n });\n },\n async registrarAgenda(context, { id, prestador, telefone, email, inicioDisponibilidade, terminoDisponibilidade }) {\n checkUpdatePermission();\n const agendaAtualizada = await apiFormulario.RegistrarAgenda({\n vinculo: context.rootState.saude.vinculo,\n id,\n prestador,\n telefone,\n email,\n inicioDisponibilidade,\n terminoDisponibilidade\n });\n if (agendaAtualizada && agendaAtualizada.Data) {\n return true;\n }\n return false;\n },\n\n async listarAgenda(context, { referencia }) {\n const agendaAtualizada = await apiFormulario.ListarAgenda({\n vinculo: context.rootState.saude.vinculo,\n referencia\n });\n await context.commit(\n \"SET_AGENDA\",\n agendaAtualizada && agendaAtualizada.Data ? agendaAtualizada && agendaAtualizada.Data : []\n );\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_FORMULARIO: (state, next) => Vue.set(state, \"formulario\", next),\n SET_QUESTIONARIO: (state, next) => Vue.set(state, \"questionario\", next),\n SET_AGENDA: (state, next) => Vue.set(state, \"agenda\", next)\n }\n};\n","import * as geoUtils from \"@/utils/geoDistance\";\n\nconst baseURL = `${process.env.VUE_APP_SERVER_URL}/FormasContato`;\n\nexport async function ObterParametrosEndereco({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterParametrosEndereco`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"ObterParametrosEndereco\", error.message);\n return error;\n });\n}\n\nexport async function ObterFormasContato({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterFormasContato`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"ObterFormasContato\", error);\n return error;\n });\n}\n\nexport async function SolicitarAlteracaoGeral({ vinculo, usuario, emails, endereco, telefones, autenticacao }) {\n const coords: any = await geoUtils.GetLocation().catch(() => null);\n return window.$axios\n .post({\n url: `${baseURL}/SolicitarAlteracaoGeral`,\n query: {\n vinculo\n },\n data: {\n usuario,\n emails,\n endereco,\n telefones,\n autenticacao,\n lat: coords?.latitude,\n lng: coords?.longitude\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"SolicitarAlteracaoGeral\", error.message);\n return error;\n });\n}\n\nexport async function ValidarAlteracaoGeral({ vinculo, emails, endereco, telefones, permitirSemAlteracao }) {\n return window.$axios\n .post({\n url: `${baseURL}/ValidarAlteracaoGeral`,\n query: {\n vinculo\n },\n data: {\n emails,\n endereco,\n telefones,\n permitirSemAlteracao\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"ValidarAlteracao\", error.message);\n return error;\n });\n}\n\nexport async function ConsultarRequisicaoAlteracao({ chave }) {\n return window.$axios\n .get({\n url: `${baseURL}/ConsultarRequisicaoAlteracao`,\n query: {\n chave\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"ConsultarRequisicaoAlteracao\", error.message);\n return error;\n });\n}\n\nexport async function ObterMunicipios({ vinculo, uf }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterMunicipios`,\n query: {\n vinculo,\n uf\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"ObterMunicipios\", error.message);\n return error;\n });\n}\n\nexport function ObterLogradouros({ vinculo, cep }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterLogradouros`,\n query: {\n vinculo,\n cep\n }\n })\n .then(resp => resp.data.Data)\n .catch(error => {\n window.$log.error(\"ObterLogradouros\", error.message);\n return error;\n });\n}\n\nexport function ObterResumoFormasContato({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterResumoFormasContato`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterResumoFormasContato\", error.message);\n return error;\n });\n}\n","import Vue from \"vue\";\nimport {\n ObterLogradouros,\n ObterParametrosEndereco,\n ObterResumoFormasContato,\n SolicitarAlteracaoGeral,\n ConsultarRequisicaoAlteracao,\n ValidarAlteracaoGeral,\n ObterMunicipios\n} from \"@/api/formasContato\";\nimport { ExisteChamadoPendenteProcessamento } from \"@/api/atendimento\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n paramsAddress: {},\n contacts: [],\n resumeContacts: {},\n changesResume: {},\n changeRequest: {},\n contactsToReceiveChanges: {},\n existChangeRequest: false,\n newAddress: null,\n newEmails: null,\n newPhones: null,\n newWhatsapp: null\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async fetchAddressInfos(context, { cep }) {\n return await ObterLogradouros({\n vinculo: context.rootState.saude.vinculo,\n cep\n });\n },\n async fetchCities(context, { uf }) {\n return await ObterMunicipios({\n vinculo: context.rootState.saude.vinculo,\n uf\n });\n },\n async fetchParamsAddress(context) {\n const paramsAddress = await ObterParametrosEndereco({\n vinculo: context.rootState.saude.vinculo\n });\n context.commit(\"SET_NEW_STATE\", {\n key: \"paramsAddress\",\n value: paramsAddress\n });\n },\n async fetchResumeContacts(context) {\n try {\n const response = await ObterResumoFormasContato({\n vinculo: context.rootState.saude.vinculo\n });\n if (!response?.Data) {\n context.commit(\"SET_NEW_STATE\", {\n key: \"resumeContacts\",\n value: {}\n });\n return;\n }\n const infos = response.Data;\n const tels = [];\n const countryCodeRegex = /^\\+(\\d+)\\s*/;\n infos.Telefones.forEach((tel, id) => {\n const match = tel.Numero.match(countryCodeRegex);\n\n let countryCode = \"\";\n\n if (match && match[1]) {\n countryCode = \"+\" + match[1];\n }\n\n tels[id] = {\n Numero: tel.Numero.replace(countryCodeRegex, \"\"),\n Tipo: tel.Tipo,\n countryCode\n };\n });\n\n context.commit(\"SET_NEW_STATE\", {\n key: \"resumeContacts\",\n value: {\n Empresarial: infos.Empresarial ?? true,\n Endereco: {\n CEP: infos.Endereco?.CEP ?? \"\",\n TipoLogradouro: infos.Endereco?.TipoLogradouro ?? \"\",\n IdLogradouro: infos.Endereco?.IdLogradouro ?? 0,\n Logradouro: infos.Endereco?.Logradouro ?? \"\",\n Numero: infos.Endereco?.Numero ?? \"\",\n Complemento: infos.Endereco?.Complemento ?? \"\",\n Bairro: infos.Endereco?.Bairro ?? \"\",\n Cidade: infos.Endereco?.Cidade ?? \"\",\n UF: infos.Endereco?.UF ?? \"\"\n },\n Emails: {\n Pessoal: infos.Emails?.Pessoal ?? \"\",\n Fatura: infos.Emails?.Fatura ?? \"\"\n },\n Telefones: tels\n }\n });\n } catch (error) {\n throw Error(error);\n }\n },\n async validadeChanges(context, { allowWithoutChanges }) {\n const telefones =\n context.state.newPhones?.map(phone => ({\n Numero: `${phone.countryCode} ${phone.Numero}`,\n Tipo: phone.Tipo\n })) || [];\n const changes = await ValidarAlteracaoGeral({\n vinculo: context.rootState.saude.vinculo,\n emails: context.state.newEmails || [],\n endereco: context.state.newAddress,\n telefones,\n permitirSemAlteracao: allowWithoutChanges ?? false\n });\n if (!changes)\n return {\n MsgValidacao: \"Serviço temporariamente indisponível\",\n Enderecos: [],\n Telefones: [],\n Emails: {}\n };\n if (changes instanceof Error)\n return {\n MsgValidacao: changes.message,\n Enderecos: [],\n Telefones: [],\n Emails: {}\n };\n\n return changes;\n },\n async createChangeRequestFromTour(context) {\n await context.dispatch(\"createChangeRequest\", { auth: context.rootState.myAccount.welcomeOnBoardTourAuth });\n const infos = context.state.resumeContacts;\n context.commit(\"SET_NEW_STATE\", {\n key: \"resumeContacts\",\n value: {\n Empresarial: infos.Empresarial ?? true,\n Endereco: context.state.newAddress ? { ...context.state.newAddress } : { ...infos.Endereco },\n Emails: context.state.newEmails ? { ...context.state.newEmails } : { ...infos.Emails },\n Telefones: context.state.newPhones?.length ? context.state.newPhones : infos.Telefones\n }\n });\n context.commit(\"SET_NEW_STATE\", { key: \"existChangeRequest\", value: true });\n if (context.state.newWhatsapp) {\n await context.dispatch(\n \"atendimento/ativarAtendimentoWhatsApp\",\n { phoneNumber: context.state.newWhatsapp, auth: context.rootState.myAccount.welcomeOnBoardTourAuth },\n { root: true }\n );\n } else if (!context.state.resumeContacts?.Telefones?.find(t => t.Tipo === \"Celular\" || t.Tipo === \"Comercial\")) {\n // teve alteração das formas de contato mas não cadastrou nenhum telefone, não pode acessa a trilha de whatsapp\n await context.dispatch(\n \"myAccount/updateWelcomeOnBoardTourCompl\",\n { pathTo: \"/whatsapp\", option: true },\n { root: true }\n );\n }\n context.commit(\"RESET_NEW_CONTACTS\");\n },\n async createChangeRequest(context, { auth }) {\n checkUpdatePermission();\n\n const telefones =\n context.state.newPhones?.map(phone => ({\n Numero: `${phone.countryCode} ${phone.Numero}`,\n Tipo: phone.Tipo\n })) || [];\n const response = await SolicitarAlteracaoGeral({\n vinculo: context.rootState.saude.vinculo,\n usuario: context.rootState.saude.username,\n emails: context.state.newEmails || [],\n endereco: context.state.newAddress,\n telefones,\n autenticacao: auth\n });\n\n if (response instanceof Error) throw Error(response);\n\n context.commit(\"SET_NEW_STATE\", {\n key: \"changeRequest\",\n value: response.Data ? { ...response.Data } : { ...response }\n });\n\n return response;\n },\n async fetchChangesResume(context, { chave }) {\n const changes = await ConsultarRequisicaoAlteracao({ chave });\n context.commit(\"SET_NEW_STATE\", {\n key: \"changesResume\",\n value: { ...changes }\n });\n },\n async validateActiveTicket(context) {\n if (!context.rootState.saude.vinculo) return false;\n\n const existChangeRequest = await ExisteChamadoPendenteProcessamento({\n vinculo: context.rootState.saude.vinculo,\n beneficiario: context.rootState.saude.vinculo,\n servico: 5\n });\n\n context.commit(\"SET_NEW_STATE\", { key: \"existChangeRequest\", value: existChangeRequest.Data });\n }\n },\n mutations: {\n SET_NEW_STATE: (state, { key, value }) => Vue.set(state, key, value),\n LOGOUT_USER: state => Object.keys(state).forEach(key => (state[key] = initialState[key])),\n RESET_CONTEXT: state => Object.keys(state).forEach(key => (state[key] = initialState[key])),\n RESET_NEW_CONTACTS: state => {\n [\"newAddress\", \"newEmails\", \"newPhones\"].forEach(key => {\n state[key] = null;\n });\n }\n },\n getters: {\n hasNewChanges(state) {\n return state.newAddress || state.newEmails || state.newPhones;\n }\n }\n};\n","import Vue from \"vue\";\nimport {\n ListarAcessosFuncionalidades,\n AtualizarAcessoPermissao,\n AtualizarAcessoFuncionalidades,\n AceitaOptin,\n VerificarAvisoInadimplencia,\n RegistarCienteAvisoInadimplencia\n} from \"@/api/associado\";\nimport { allowUpdate, checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n permissions: [],\n appLocked: false,\n nonpaymentWarn: {}\n};\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async lockApp(context) {\n context.commit(\"SET_LOCKED\", true);\n },\n async unlockApp(context) {\n context.commit(\"SET_LOCKED\", false);\n },\n async fetchPermissions(context) {\n const permissions = await ListarAcessosFuncionalidades({\n vinculo: context.rootState.saude.vinculo\n });\n await context.commit(\n \"SET_PERMISSIONS\",\n permissions && permissions.length > 0 ? permissions.map(p => p.Permissao) : []\n );\n },\n async updateAccessPermitions(context, { permissions }) {\n checkUpdatePermission();\n let ocorreuAlteracao = false;\n const permissoesAlteradas = [];\n for (let p = 0; p < permissions.length; p++) {\n const permissao = permissions[p];\n if ((permissao.ativa && permissao.id === 0) || (!permissao.ativa && permissao.id > 0)) {\n const newId = await AtualizarAcessoPermissao({\n vinculoDestinatario: permissao.vinculo,\n ativar: permissao.ativa,\n idPermissao: permissao.id,\n vinculo: context.rootState.saude.vinculo\n });\n if (permissao.ativa) {\n permissao.id = newId;\n } else {\n permissao.id = 0;\n }\n ocorreuAlteracao = true;\n }\n const permissoesAlteradasVinculo = [];\n permissao.funcionalidades.forEach(f =>\n f.permissoes.forEach(p => {\n if (p.ativa !== p.original) {\n permissoesAlteradasVinculo.push({\n IdFuncionalidade: p.id,\n Ativa: p.ativa\n });\n }\n })\n );\n if (permissoesAlteradasVinculo.length > 0) {\n permissoesAlteradas.push({\n IdPermissao: permissao.id,\n ListaFuncionalidades: permissoesAlteradasVinculo\n });\n }\n }\n let protocolo = \"\";\n if (permissoesAlteradas.length > 0) {\n const response = await AtualizarAcessoFuncionalidades({\n vinculo: context.rootState.saude.vinculo,\n permissoes: permissoesAlteradas\n });\n if (response && response.protocoloANS) {\n protocolo = response.protocoloANS;\n }\n }\n if (ocorreuAlteracao) {\n await context.dispatch(\"fetchPermissions\");\n }\n return protocolo;\n },\n async optinAccept(context) {\n checkUpdatePermission();\n await AceitaOptin({\n vinculo: context.rootState.saude.vinculo,\n template: 13,\n login: context.rootState.saude.username\n });\n },\n async fetchNonpaymentWarning(context) {\n const response = await VerificarAvisoInadimplencia({\n vinculo: context.rootState.saude.vinculo,\n template: 13,\n login: context.rootState.saude.username\n });\n if (response.Data?.Texto) {\n context.commit(\"SET_NOPAYMENT_WARNING\", {\n title: response.Data.Titulo,\n text: response.Data.Texto,\n key: response.Data.Chave\n });\n } else {\n context.commit(\"SET_NOPAYMENT_WARNING\", {});\n }\n },\n async nonpaymentAware(context) {\n if (!context.state.nonpaymentWarning?.key) return;\n if (!allowUpdate()) {\n context.commit(\"SET_NOPAYMENT_WARNING\", {});\n return;\n }\n await RegistarCienteAvisoInadimplencia({\n vinculo: context.rootState.saude.vinculo,\n chave: context.state.nonpaymentWarning.key\n });\n context.commit(\"SET_NOPAYMENT_WARNING\", {});\n }\n },\n mutations: {\n SET_PERMISSIONS: (state, permissions) => {\n Vue.set(state, \"permissions\", permissions);\n },\n SET_LOCKED: (state, locked) => {\n Vue.set(state, \"appLocked\", locked);\n },\n SET_NOPAYMENT_WARNING: (state, nonpaymentWarning) => {\n Vue.set(state, \"nonpaymentWarning\", nonpaymentWarning);\n },\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p]))\n }\n};\n","import Vue from \"vue\";\nimport Vuex from \"vuex\";\nimport {\n AtivarAtendimentoWhatsApp,\n ObterAtendimentosAvaliacao,\n ObterDetalheAvaliacaoPrestador,\n ValidarAtendimentoWhatsApp\n} from \"@/api/atendimento\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nVue.use(Vuex);\n\nconst initialState = {\n WhatsAppAtivo: false,\n TelefonesDisponiveis: null,\n NumeroCelular: null,\n NumeroFormatado: null,\n DDD: null,\n DDI: null,\n evaluationList: []\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_WHATSAPP_ATIVO: (state, newState) => {\n Vue.set(state, \"WhatsAppAtivo\", newState?.WhatsAppAtivo ?? false);\n Vue.set(state, \"TelefonesDisponiveis\", newState?.TelefonesDisponiveis);\n Vue.set(state, \"NumeroCelular\", newState?.NumeroCelular);\n Vue.set(state, \"NumeroFormatado\", newState?.NumeroFormatado);\n Vue.set(state, \"DDD\", newState?.DDD);\n Vue.set(state, \"DDI\", newState?.DDI);\n },\n SET_EVALUATIONS_LIST: (state, newState) => {\n const setDescription = item => ({\n ...item,\n description:\n item.Especialidade?.toUpperCase()?.trim() === \"ATENDIMENTIO SEM PAPEL\"\n ? item.DataAtendimento\n : `${item.DataAtendimento} • ${item.Especialidade}`\n });\n const mapDescription = list => {\n if (!list) return [];\n return list.map(item => setDescription(item));\n };\n Vue.set(state, \"evaluationList\", {\n atendimentosAvaliados: mapDescription(newState?.atendimentosAvaliados),\n atendimentosNaoAvaliados: mapDescription(newState?.atendimentosNaoAvaliados)\n });\n }\n },\n getters: {},\n actions: {\n async validarAtendimentoWhatsApp(context) {\n if (context.state.WhatsAppAtivo) return;\n const validar = await ValidarAtendimentoWhatsApp({\n vinculo: context.rootState.saude.vinculo\n });\n await context.commit(\n \"SET_WHATSAPP_ATIVO\",\n validar ?? {\n WhatsAppAtivo: false,\n TelefonesDisponiveis: null,\n NumeroCelular: null,\n NumeroFormatado: null,\n DDD: null,\n DDI: null\n }\n );\n },\n async ativarAtendimentoWhatsApp(context, { phoneNumber, auth }) {\n checkUpdatePermission();\n let celularCompleto = phoneNumber;\n if (!auth && phoneNumber?.startsWith(\"+\")) {\n const parts = phoneNumber.replace(\"+\", \"\").replace(\"(\", \"\").replace(\")\", \"\").split(\" \");\n celularCompleto = `${parts[0]}${parts[1]}${parts[2].replace(\"-\", \"\")}`;\n }\n const response = await AtivarAtendimentoWhatsApp({\n idUsuario: context.rootState.saude.userId ?? 0,\n vinculo: context.rootState.saude.vinculo,\n email: context.rootState.saude.username,\n celularCompleto,\n autenticacao: auth\n });\n if (response?.Data && phoneNumber?.startsWith(\"+\")) {\n const parts = phoneNumber.replace(\"+\", \"\").replace(\"(\", \"\").replace(\")\", \"\").split(\" \");\n const infos = {\n WhatsAppAtivo: true,\n TelefonesDisponiveis: [],\n NumeroCelular: phoneNumber,\n NumeroFormatado: parts[2],\n DDD: parts[1],\n DDI: parts[0]\n };\n context.commit(\"SET_WHATSAPP_ATIVO\", infos);\n await context.dispatch(\n \"myAccount/updateWelcomeOnBoardTourCompl\",\n { pathTo: \"/whatsapp\", option: true },\n { root: true }\n );\n }\n },\n async fetchAtendimentosAvaliacao(context) {\n const response = await ObterAtendimentosAvaliacao({\n vinculo: context.rootState.saude.vinculo\n });\n\n await context.commit(\"SET_EVALUATIONS_LIST\", response instanceof Error ? {} : response);\n },\n async fetchDetalheAvaliacaoPrestador(context, { atendimento }) {\n const response = await ObterDetalheAvaliacaoPrestador({\n vinculo: context.rootState.saude.vinculo,\n atendimento\n });\n\n return response instanceof Error ? [] : response?.Data ?? [];\n }\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/Agenda`;\n\nexport async function ListarTarefas({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ListarTarefas`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ListarTarefas\", error.message);\n return error;\n });\n}\n\nexport async function DetalheTarefa({ vinculo, chamado }) {\n return window.$axios\n .post({\n url: `${baseURL}/DetalheTarefa`,\n query: {\n vinculo\n },\n data: {\n chamado\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"DetalheTarefa\", error.message);\n return error;\n });\n}\n\nexport async function ObterRegrasAgenda({ vinculo, chamado, prestador, tipo, vinculoBeneficiario }) {\n return window.$axios\n .post({\n url: `${baseURL}/ObterRegrasAgenda`,\n query: {\n vinculo\n },\n data: {\n chamado,\n prestador,\n tipo,\n vinculoBeneficiario\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterRegrasAgenda\", error.message);\n return error;\n });\n}\n\nexport async function ObterAgenda({ vinculo, beneficiario, local, especialidade, staff }) {\n return window.$axios\n .post({\n url: `${baseURL}/ObterAgenda`,\n query: {\n vinculo\n },\n data: {\n beneficiario,\n local,\n especialidade,\n staff\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterAgenda\", error.message);\n return error;\n });\n}\n\nexport async function NovaTarefa({\n vinculo,\n beneficiario,\n local,\n especialidade,\n staff,\n dia,\n mes,\n ano,\n hora,\n duracao,\n dispositivo,\n chamado,\n reserva,\n slot,\n tipo\n}) {\n return window.$axios\n .post({\n url: `${baseURL}/NovaTarefa`,\n query: {\n vinculo\n },\n data: {\n beneficiario,\n local,\n especialidade,\n staff,\n dia,\n mes,\n ano,\n hora,\n duracao,\n dispositivo,\n chamado,\n reserva,\n slot,\n tipo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"NovaTarefa\", error.message);\n return error;\n });\n}\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/VideoConferencia`;\n\nexport async function GravaAcessos({ vinculo, idSalaPessoa, tpPessoa }) {\n return await window.$axios\n .post({\n url: `${baseURL}/GravaAcessos`,\n query: {\n vinculo,\n idSalaPessoa,\n tpPessoa\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"GravaAcessos\", error.message);\n return error;\n });\n}\n\nexport async function ObterToken({ vinculo, idChamado, tpPessoa }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ObterToken`,\n query: {\n vinculo,\n idChamado,\n tpPessoa\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterToken\", error.message);\n return error;\n });\n}\n\nexport async function ObterPessoasOnline({ vinculo, idSalaPessoa }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ObterPessoasOnline`,\n query: {\n vinculo,\n idSalaPessoa\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterPessoasOnline\", error.message);\n return error;\n });\n}\n\nexport async function ObterImagemProfile({ vinculo, pessoa }) {\n return await window.$axios\n .get({\n url: `${baseURL}/ObterImagemProfile`,\n query: {\n vinculo,\n pessoa\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterImagemProfile\", error.message);\n return error;\n });\n}\n","export function getUA() {\n let device = \"Unknown\";\n const ua = {\n \"Generic Linux\": /Linux/i,\n Android: /Android/i,\n BlackBerry: /BlackBerry/i,\n Bluebird: /EF500/i,\n \"Chrome OS\": /CrOS/i,\n Datalogic: /DL-AXIS/i,\n Honeywell: /CT50/i,\n iPad: /iPad/i,\n iPhone: /iPhone/i,\n iPod: /iPod/i,\n macOS: /Macintosh/i,\n Windows: /IEMobile|Windows/i,\n Zebra: /TC70|TC55/i\n };\n Object.keys(ua).map(v => navigator.userAgent.match(ua[v]) && (device = v));\n return device;\n}\n","import Vue from \"vue\";\nimport { CancelarTarefa, ObterProtocoloANS } from \"@/api/atendimento\";\nimport { ListarTarefas, DetalheTarefa, ObterRegrasAgenda, ObterAgenda, NovaTarefa } from \"@/api/agenda\";\nimport { ObterToken, GravaAcessos, ObterPessoasOnline, ObterImagemProfile } from \"@/api/videoConferencia\";\nimport { getUA } from \"@/utils/deviceName\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n taskList: [],\n callInfos: {}\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async createTask(\n context,\n { beneficiario, local, especialidade, staff, dia, mes, ano, hora, duracao, chamado, reserva, slot, tipo }\n ) {\n checkUpdatePermission();\n const dispositivo = getUA();\n const response = await NovaTarefa({\n vinculo: context.rootState.saude.vinculo,\n beneficiario,\n local,\n especialidade,\n staff,\n dia,\n mes,\n ano,\n hora,\n duracao,\n dispositivo,\n chamado,\n reserva,\n slot,\n tipo\n });\n if (response instanceof Error) throw response;\n\n return response?.Data;\n },\n async featchTasks(context) {\n const response = await ListarTarefas({\n vinculo: context.rootState.saude.vinculo\n });\n if (response && response.Data) {\n await context.commit(\"SET_TASK_LIST\", response.Data);\n }\n },\n async featchTaskDetail(context, { chamado }) {\n const response = await DetalheTarefa({\n vinculo: context.rootState.saude.vinculo,\n chamado\n });\n return response?.Data;\n },\n async featchTaskRules(context, { chamado, prestador, tipo, vinculoBeneficiario }) {\n const response = await ObterRegrasAgenda({\n vinculo: context.rootState.saude.vinculo,\n chamado,\n prestador,\n tipo,\n vinculoBeneficiario\n });\n return response?.Data;\n },\n async featchCalendar(context, { beneficiario, local, especialidade, staff }) {\n const response = await ObterAgenda({\n vinculo: context.rootState.saude.vinculo,\n beneficiario,\n local,\n especialidade,\n staff\n });\n return response?.Data;\n },\n async cancelTask(context, { chamado }) {\n checkUpdatePermission();\n const response = await CancelarTarefa({\n vinculo: context.rootState.saude.vinculo,\n chamadoRef: chamado\n });\n const sucess = !(response instanceof Error);\n if (sucess) {\n //atualiza a lista de tarefas\n await context.dispatch(\"featchTasks\");\n }\n return sucess;\n },\n async featchVideoCallTokens(context, { chamado, tpPessoa }) {\n const vinculo = context.rootState.saude.vinculo;\n const tokenResponse = await ObterToken({\n vinculo,\n idChamado: chamado,\n tpPessoa\n });\n const callInfos = tokenResponse instanceof Error ? {} : tokenResponse.Data[0];\n context.commit(\"SET_CALL_INFOS\", callInfos);\n return !(tokenResponse instanceof Error);\n },\n async registerRoomAccess(context, { tpPessoa }) {\n checkUpdatePermission();\n const vinculo = context.rootState.saude.vinculo;\n const callInfos = context.state.callInfos;\n if (callInfos.idSalaPessoa) {\n const accessResponse = await GravaAcessos({\n vinculo,\n idSalaPessoa: callInfos.idSalaPessoa,\n tpPessoa\n });\n return !(accessResponse instanceof Error);\n } else {\n return false;\n }\n },\n async featchImagemProfile(context, { staff }) {\n const vinculo = context.rootState.saude.vinculo;\n const imagemProfile = await ObterImagemProfile({\n vinculo,\n pessoa: staff\n });\n return imagemProfile?.Data ?? \"\";\n },\n async featchOnlinePeople(context) {\n if (!context.state.callInfos?.idSalaPessoa) {\n return {};\n }\n const response = await ObterPessoasOnline({\n vinculo: context.rootState.saude.vinculo,\n idSalaPessoa: context.state.callInfos.idSalaPessoa\n });\n return response instanceof Error ? {} : response.Data;\n },\n async fetchANSProtocol(context, { chamado }) {\n const response = await ObterProtocoloANS({\n vinculo: context.rootState.saude.vinculo,\n idChamado: chamado\n });\n return response instanceof Error ? \"\" : response;\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_TASK_LIST: (state, tasks) => {\n Vue.set(state, \"taskList\", tasks);\n },\n SET_CALL_INFOS: (state, data) => {\n Vue.set(state, \"callInfos\", data);\n }\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/Terceiros`;\n\nexport async function AdicionarBeneficiario({ vinculo, autenticacao, idPessoa, tpRevalidacao }) {\n return window.$axios\n .post({\n url: `${baseURL}/AdicionarBeneficiario`,\n query: {\n vinculo\n },\n data: {\n autenticacao,\n idPessoa,\n tipoRevalidacao: tpRevalidacao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function AdicionarNomeado({\n vinculo,\n autenticacao,\n nome,\n cpf,\n rne,\n rg,\n emissorRg,\n dtEmissaoRg,\n dtNascimento,\n idLocalNascimento,\n ufLocalNascimento,\n nomeLocalNascimento,\n sexo,\n nomeMae,\n idGrauRelacionamento,\n dsGrauRelacionamento,\n complementoGrauRelacionamento,\n nrCelular,\n smsCelular,\n nrFixo,\n tpFixo,\n tpEmail,\n email,\n avisoEmail,\n tpRevalidacao\n}) {\n return window.$axios\n .post({\n url: `${baseURL}/AdicionarNomeado`,\n query: {\n vinculo\n },\n data: {\n autenticacao,\n nome,\n cpf,\n estrangeiro: rg ? false : true,\n documento: { numero: rg ? rg : rne, emissor: emissorRg, strDataEmissao: dtEmissaoRg },\n strDataNascimento: dtNascimento,\n localNascimento: {\n id: idLocalNascimento,\n uf: ufLocalNascimento,\n nome: nomeLocalNascimento\n },\n sexo,\n nomeMae,\n GrauRelacionamento: {\n id: idGrauRelacionamento,\n descricao: dsGrauRelacionamento,\n complemento: complementoGrauRelacionamento\n },\n telefoneCelular: {\n formatado: nrCelular,\n tipo: \"CEL\",\n receberSms: smsCelular\n },\n telefoneFixo: {\n formatado: nrFixo,\n tipo: tpFixo,\n receberSms: false\n },\n email: {\n tipo: tpEmail,\n endereco: email,\n receberAviso: avisoEmail\n },\n tipoRevalidacao: tpRevalidacao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function EditarNomeado({\n vinculo,\n idPessoa,\n nome,\n cpf,\n rne,\n rg,\n emissorRg,\n dtEmissaoRg,\n dtNascimento,\n idLocalNascimento,\n ufLocalNascimento,\n nomeLocalNascimento,\n sexo,\n nomeMae,\n idGrauRelacionamento,\n dsGrauRelacionamento,\n complementoGrauRelacionamento,\n nrCelular,\n smsCelular,\n nrFixo,\n tpFixo,\n tpEmail,\n email,\n avisoEmail,\n tpRevalidacao\n}) {\n return window.$axios\n .post({\n url: `${baseURL}/EditarNomeado`,\n query: {\n vinculo\n },\n data: {\n idPessoa,\n nome,\n cpf,\n estrangeiro: rg ? false : true,\n documento: { numero: rg ? rg : rne, emissor: emissorRg, strDataEmissao: dtEmissaoRg },\n strDataNascimento: dtNascimento,\n localNascimento: {\n id: idLocalNascimento,\n uf: ufLocalNascimento,\n nome: nomeLocalNascimento\n },\n sexo,\n nomeMae,\n GrauRelacionamento: {\n id: idGrauRelacionamento,\n descricao: dsGrauRelacionamento,\n complemento: complementoGrauRelacionamento\n },\n telefoneCelular: {\n formatado: nrCelular,\n tipo: \"CEL\",\n receberSms: smsCelular\n },\n telefoneFixo: {\n formatado: nrFixo,\n tipo: tpFixo,\n receberSms: false\n },\n email: {\n tipo: tpEmail,\n endereco: email,\n receberAviso: avisoEmail\n },\n tipoRevalidacao: tpRevalidacao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function ObterCadastroNomeado({ vinculo, id }) {\n return window.$axios\n .post({\n url: `${baseURL}/ObterCadastroNomeado`,\n query: {\n vinculo\n },\n data: {\n id\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function ObterMunicipios({ vinculo, uf }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterMunicipios`,\n query: {\n vinculo,\n uf\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function ObterNomeados({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterNomeados`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function ObterParametros({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterParametros`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function Prorrogar({ vinculo, autenticacao, idPessoa, tpRevalidacao }) {\n return window.$axios\n .post({\n url: `${baseURL}/Prorrogar`,\n query: {\n vinculo\n },\n data: {\n autenticacao,\n idPessoa,\n tipoRevalidacao: tpRevalidacao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function Reativar({ vinculo, autenticacao, idPessoa, tpRevalidacao }) {\n return window.$axios\n .post({\n url: `${baseURL}/Reativar`,\n query: {\n vinculo\n },\n data: {\n autenticacao,\n idPessoa,\n tipoRevalidacao: tpRevalidacao\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n\nexport async function Revogar({ vinculo, autenticacao, idPessoa }) {\n return window.$axios\n .post({\n url: `${baseURL}/Revogar`,\n query: {\n vinculo\n },\n data: {\n autenticacao,\n idPessoa\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n throw new Error(error.message);\n });\n}\n","import Vue from \"vue\";\nimport {\n AdicionarBeneficiario,\n AdicionarNomeado,\n EditarNomeado,\n ObterCadastroNomeado,\n ObterMunicipios,\n ObterNomeados,\n ObterParametros,\n Prorrogar,\n Reativar,\n Revogar\n} from \"../api/terceiros\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n dadosTitular: null,\n nomeados: [],\n parametros: {}\n};\n\n// vuex module\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async createBeneficiary(context, { autenticacao, idPessoa, tpRevalidacao }) {\n checkUpdatePermission();\n try {\n const response = await AdicionarBeneficiario({\n vinculo: context.rootState.saude.vinculo,\n autenticacao,\n idPessoa,\n tpRevalidacao\n });\n return response?.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async createNominee(\n context,\n {\n autenticacao,\n nome,\n cpf,\n rne,\n rg,\n emissorRg,\n dtEmissaoRg,\n dtNascimento,\n idLocalNascimento,\n ufLocalNascimento,\n nomeLocalNascimento,\n sexo,\n nomeMae,\n idGrauRelacionamento,\n dsGrauRelacionamento,\n complementoGrauRelacionamento,\n nrCelular,\n smsCelular,\n nrFixo,\n tpFixo,\n tpEmail,\n email,\n avisoEmail,\n tpRevalidacao\n }\n ) {\n checkUpdatePermission();\n try {\n const response = await AdicionarNomeado({\n vinculo: context.rootState.saude.vinculo,\n autenticacao,\n nome,\n cpf,\n rne,\n rg,\n emissorRg,\n dtEmissaoRg,\n dtNascimento,\n idLocalNascimento,\n ufLocalNascimento,\n nomeLocalNascimento,\n sexo,\n nomeMae,\n idGrauRelacionamento,\n dsGrauRelacionamento,\n complementoGrauRelacionamento,\n nrCelular,\n smsCelular,\n nrFixo,\n tpFixo,\n tpEmail,\n email,\n avisoEmail,\n tpRevalidacao\n });\n return response?.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async fetchCities(context, { uf }) {\n try {\n const response = await ObterMunicipios({\n vinculo: context.rootState.saude.vinculo,\n uf\n });\n return response.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async fetchNomineeDetails(context, { id }) {\n try {\n const response = await ObterCadastroNomeado({\n vinculo: context.rootState.saude.vinculo,\n id\n });\n return response.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async fetchNomineesInfos(context) {\n try {\n const response = await ObterNomeados({\n vinculo: context.rootState.saude.vinculo\n });\n if (response.Data) {\n if (!context.state.dadosTitular?.Tipo && response.Data.Titular) {\n await context.commit(\"SET_DADOS_TITULAR\", response.Data.Titular);\n }\n if (response.Data.Nomeados) {\n await context.commit(\"SET_NOMEADOS\", response.Data.Nomeados);\n }\n return;\n }\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async fetchParams(context) {\n if (Object.keys(context.state.parametros).length > 0) return;\n try {\n const response = await ObterParametros({\n vinculo: context.rootState.saude.vinculo\n });\n if (response.Data) {\n await context.commit(\"SET_PARAMETROS\", response.Data);\n return;\n }\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async reactivateNomiee(context, { autenticacao, idPessoa, tpRevalidacao }) {\n checkUpdatePermission();\n try {\n const response = await Reativar({\n vinculo: context.rootState.saude.vinculo,\n autenticacao,\n idPessoa,\n tpRevalidacao\n });\n return response?.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async removeNomieePeriod(context, { autenticacao, idPessoa }) {\n checkUpdatePermission();\n try {\n const response = await Revogar({\n vinculo: context.rootState.saude.vinculo,\n autenticacao,\n idPessoa\n });\n return response?.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async updateNomineeDetails(\n context,\n {\n idPessoa,\n nome,\n cpf,\n rne,\n rg,\n emissorRg,\n dtEmissaoRg,\n dtNascimento,\n idLocalNascimento,\n ufLocalNascimento,\n nomeLocalNascimento,\n sexo,\n nomeMae,\n idGrauRelacionamento,\n dsGrauRelacionamento,\n complementoGrauRelacionamento,\n nrCelular,\n smsCelular,\n nrFixo,\n tpFixo,\n tpEmail,\n email,\n avisoEmail,\n tpRevalidacao\n }\n ) {\n checkUpdatePermission();\n try {\n const response = await EditarNomeado({\n vinculo: context.rootState.saude.vinculo,\n idPessoa,\n nome,\n cpf,\n rne,\n rg,\n emissorRg,\n dtEmissaoRg,\n dtNascimento,\n idLocalNascimento,\n ufLocalNascimento,\n nomeLocalNascimento,\n sexo,\n nomeMae,\n idGrauRelacionamento,\n dsGrauRelacionamento,\n complementoGrauRelacionamento,\n nrCelular,\n smsCelular,\n nrFixo,\n tpFixo,\n tpEmail,\n email,\n avisoEmail,\n tpRevalidacao\n });\n return response?.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n },\n async updateNomieePeriod(context, { autenticacao, idPessoa, tpRevalidacao }) {\n checkUpdatePermission();\n try {\n const response = await Prorrogar({\n vinculo: context.rootState.saude.vinculo,\n autenticacao,\n idPessoa,\n tpRevalidacao\n });\n return response?.Data;\n } catch (error) {\n throw new Error(error.message);\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_DADOS_TITULAR: (state, dadosTitular) => {\n Vue.set(state, \"dadosTitular\", dadosTitular);\n },\n SET_NOMEADOS: (state, nomeados) => {\n Vue.set(state, \"nomeados\", nomeados);\n },\n SET_PARAMETROS: (state, parametros) => {\n Vue.set(state, \"parametros\", parametros);\n }\n }\n};\n","import Vue from \"vue\";\nimport {\n AceiteTermoSimualacaoCopay,\n BuscarEnderecoReferenciaV2,\n BuscarPrestadorSimulacaoCopay,\n ExameGrupoCopay,\n ListarExameSimulacaoCopay,\n ObterExamesProcuradosSimulacaoCopay,\n ObterLimiteExames,\n ObterModeloCopay,\n ObterPrestadoresProcuradosSimulacaoCopay,\n ObterSimulacaoCopay,\n ObterSimulacoesCopay,\n ObterTermoSimualacaoCopay,\n PodeSimularCopay,\n SimularCopay,\n SinonimosExameCopay\n} from \"@/api/redeCredenciada\";\nimport { ObterResumoExtratoCopay, ObterDetalheExtratoCopay, ObterFaturaCoparticiapacao } from \"@/api/atendimento\";\n\nimport _ from \"lodash\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n allowSimulations: false,\n activeSort: \"\",\n sorts: [\"Mais recentes\", \"Mais antigos\", \"Últimos 30 dias\"],\n simulations: [],\n initialSimulations: [],\n simulationValuesDateRef: \"\",\n simulationCreationDate: \"\",\n terms: {},\n mostSearchedExamsTerms: [],\n mostSearchedExams: [],\n searchedExams: [],\n selectedExams: [],\n address: {},\n mostSearchedLaboratoriesTerms: [],\n mostSearchedLaboratories: [],\n searchedLaboratories: [],\n selectedLaboratories: [],\n copayModel: [],\n copayStatementResume: {},\n copayStatement: [],\n examsLimit: 0\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async fetchBaseAddress(context, { type }) {\n if (!type) type = \"R\";\n if (context.state.address?.type === type) return;\n const result = await BuscarEnderecoReferenciaV2({\n vinculo: context.rootState.saude.vinculo,\n tipoEndereco: type\n });\n const address = result.Data?.CEP ? { type, infos: result.Data } : {};\n context.commit(\"SET_PROP\", { payload: address, prop: \"address\" });\n },\n async fetchCopayModel(context) {\n if (context.state.copayModel?.models?.length) return;\n const resp = await ObterModeloCopay({\n vinculo: context.rootState.saude.vinculo\n });\n if (resp?.Data?.Modelos?.length) {\n const copayModel = resp?.Data?.Modelos.map(m => ({\n icon: m.Icone,\n title: m.Nome,\n values: (m.Valores ?? []).map(v => ({\n label: v.Descricao,\n affiliate: v.Prestador,\n value: v.ValorPercentual,\n limit: v.Limite\n }))\n }));\n context.commit(\"SET_PROP\", { payload: copayModel, prop: \"copayModel\" });\n }\n },\n async fetchCopayStatements(context) {\n const response = await ObterResumoExtratoCopay({\n vinculo: context.rootState.saude.vinculo\n });\n if (response?.Data) {\n context.commit(\"SET_PROP\", {\n payload: {\n code: response.Data.Titulo,\n name: response.Data.NomeTitular\n },\n prop: \"copayStatementResume\"\n });\n } else {\n context.commit(\"SET_PROP\", { payload: { code: \"\", name: \"\" }, prop: \"copayStatementResume\" });\n }\n if (response?.Data?.Lancamentos) {\n const statements = response.Data.Lancamentos.map(s => ({\n id: s.Fatura,\n date: s.Periodo,\n value: s.ValorTotal,\n allowDownload: !!s.Documento && s.Documento !== 0,\n downloadUrl: ObterFaturaCoparticiapacao({\n vinculo: context.rootState.saude.vinculo,\n fatura: s.Fatura,\n documento: s.Documento\n })\n }));\n context.commit(\"SET_PROP\", { payload: statements, prop: \"copayStatement\" });\n } else {\n context.commit(\"SET_PROP\", { payload: [], prop: \"copayStatement\" });\n }\n },\n async fetchCopayStatementsDetail(context, { id }) {\n if (!context.state.copayStatement?.length) {\n await context.dispatch(\"fetchCopayStatements\");\n }\n let statement = context.state.copayStatement.find(s => s.id === id);\n if (!statement) return {};\n if (statement.details) return statement;\n\n const response = await ObterDetalheExtratoCopay({\n vinculo: context.rootState.saude.vinculo,\n fatura: id\n });\n\n statement = _.cloneDeep(statement);\n statement.details = (response?.Data ?? []).map(s => ({\n name: s.Beneficiario,\n affiliate: s.Prestador,\n service: s.Servico,\n date: s.DataUtilizacao,\n value: s.Valor\n }));\n context.commit(\"SET_PROP\", {\n payload: _.cloneDeep(context.state.copayStatement).map(s => (s.id === id ? statement : s)),\n prop: \"copayStatement\"\n });\n return statement;\n },\n async fetchPermition(context) {\n const regra = await PodeSimularCopay({\n vinculo: context.rootState.saude.vinculo\n });\n context.commit(\"SET_PROP\", { payload: regra?.Data ?? false, prop: \"allowSimulations\" });\n },\n async acceptTermsCopay(context) {\n context.commit(\"CLEAN_SIMULATION\");\n await AceiteTermoSimualacaoCopay({\n vinculo: context.rootState.saude.vinculo\n });\n },\n async fetchTermsCopay(context) {\n if (context.state.terms?.text) return;\n const termos = await ObterTermoSimualacaoCopay({\n vinculo: context.rootState.saude.vinculo\n });\n if (termos?.Data?.Texto && termos?.Data?.Titulo) {\n context.commit(\"SET_PROP\", { payload: { title: termos.Data.Titulo, text: termos.Data.Texto }, prop: \"terms\" });\n }\n },\n async fetchSimulations(context) {\n const simulacoes = await ObterSimulacoesCopay({\n vinculo: context.rootState.saude.vinculo\n });\n if (simulacoes?.Data?.length) {\n const simulations = simulacoes.Data.map(s => ({\n id: s.Id,\n title: s.Titulo,\n date: s.DataSimulacao,\n qty: s.ExamesSimulados\n }));\n context.commit(\"SET_PROP\", { payload: _.cloneDeep(simulations), prop: \"simulations\" });\n context.commit(\"SET_PROP\", { payload: _.cloneDeep(simulations), prop: \"initialSimulations\" });\n }\n },\n async fetchSimulationDetail(context, { id }) {\n const simulacao = await ObterSimulacaoCopay({\n vinculo: context.rootState.saude.vinculo,\n id\n });\n if (simulacao?.Data?.Prestadores?.length && simulacao?.Data?.Exames?.length) {\n const selectedLaboratories = simulacao.Data.Prestadores.map(p => ({\n CodigoRede: p.CodigoRede,\n CodigoPrestador: p.CodigoPrestador,\n SrEndereco: p.SrEndereco,\n name: p.DescricaoPrestador,\n distance: p.Distancia ? `${Math.round(p.Distancia * 100) / 100}km`.replaceAll(\".\", \",\") : \"\",\n price: p.ValorFormatado,\n logo: p.Logo ?? \"https://picsum.photos/24/24\",\n address: p.EnderecoCompleto\n }));\n context.commit(\"SET_PROP\", { payload: selectedLaboratories, prop: \"selectedLaboratories\" });\n const selectedExams = simulacao.Data.Exames.map(e => ({\n name: e\n }));\n context.commit(\"SET_PROP\", { payload: selectedExams, prop: \"selectedExams\" });\n context.commit(\"SET_PROP\", { payload: simulacao.Data.DataTabelaVigente, prop: \"simulationValuesDateRef\" });\n context.commit(\"SET_PROP\", { payload: simulacao.Data.DataSimulacao, prop: \"simulationCreationDate\" });\n return true;\n } else {\n context.commit(\"CLEAN_SIMULATION\");\n return false;\n }\n },\n triggerExam(context, { isActive, name }) {\n if (isActive && context.state.selectedExams.length >= context.state.examsLimit) {\n return false;\n }\n\n const exam = context.state.searchedExams.find(e => e.name === name);\n if (isActive) {\n context.commit(\"SET_PROP\", {\n prop: \"selectedExams\",\n payload: [\n ...context.state.selectedExams,\n {\n id: exam.id,\n name: exam.name,\n group: exam.group ?? \"\"\n }\n ]\n });\n } else {\n const selectedExams = context.state.selectedExams.filter(e => e.name !== name);\n context.commit(\"SET_PROP\", { prop: \"selectedExams\", payload: [...selectedExams] });\n }\n\n context.dispatch(\"checkActiveExam\");\n context.commit(\"CLEAN_LABS\");\n return true;\n },\n checkActiveExam(context) {\n const searchedExams = JSON.parse(JSON.stringify(context.state.searchedExams));\n searchedExams.forEach(e => {\n if (e.options?.length) {\n e.options.forEach(o => (o.isActive = !!context.state.selectedExams.find(s => s.name === o.name)));\n e.isActive = !!context.state.selectedExams.find(s => s.name === e.name) || e.options.find(o => o.isActive);\n } else {\n e.isActive = !!context.state.selectedExams.find(s => s.name === e.name);\n }\n });\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: searchedExams });\n },\n async searchExamGroup(context, { exam }) {\n if (!exam || !exam?.group || exam.options?.length) return exam;\n const result = await ExameGrupoCopay({\n vinculo: context.rootState.saude.vinculo,\n grupo: exam.group\n });\n if (result?.Data?.length) {\n const searchedExams = JSON.parse(JSON.stringify(context.state.searchedExams));\n exam = searchedExams.find(e => e.group === exam.group);\n exam.options = result.Data.map(r => ({ id: r.Codigo, label: r.Nome, isActive: false }));\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: searchedExams });\n context.dispatch(\"checkActiveExam\");\n }\n return exam;\n },\n async searchExamSynonym(context, { exam }) {\n if (!exam || !exam.id || !exam.hasSynonym || !!exam.description) return exam;\n const result = await SinonimosExameCopay({\n vinculo: context.rootState.saude.vinculo,\n exame: exam.id\n });\n if (result?.Data) {\n const searchedExams = JSON.parse(JSON.stringify(context.state.searchedExams));\n exam = searchedExams.find(e => e.id === exam.id);\n exam.description = result.Data;\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: searchedExams });\n }\n return exam;\n },\n async searchExam(context, { search }) {\n if (!search) {\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: context.state.mostSearchedExams });\n context.dispatch(\"checkActiveExam\");\n return;\n }\n const result = await ListarExameSimulacaoCopay({\n vinculo: context.rootState.saude.vinculo,\n exame: search\n });\n\n if (result?.Data?.length) {\n const exames = result.Data.map(e => ({\n id: e.Codigo,\n name: e.Nome,\n isActive: false,\n hasSynonym: e.UsaSinonimos,\n description: e.DescricaoSinonimos,\n group: e.Grupo,\n options: (e.ExamesGrupo ?? []).map(g => ({ id: g.Codigo, label: g.Nome, isActive: false }))\n }));\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: exames });\n context.dispatch(\"checkActiveExam\");\n } else {\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: [] });\n }\n },\n async fetchMostSearchedExams(context) {\n if (context.state.mostSearchedExams?.length) {\n context.dispatch(\"searchExam\", { search: \"\" });\n return;\n }\n const result = await ObterExamesProcuradosSimulacaoCopay({\n vinculo: context.rootState.saude.vinculo,\n incluirTermos: false\n });\n\n if (result?.Data?.Termos?.length || result?.Data?.Exames?.length) {\n const exames = result.Data.Exames.map(e => ({\n id: e.Codigo,\n name: e.Nome,\n isActive: !!context.state.selectedExams.find(s => s.id === e.Codigo),\n hasSynonym: e.UsaSinonimos,\n description: e.DescricaoSinonimos,\n group: e.Grupo,\n options: (e.ExamesGrupo ?? []).map(g => ({ id: g.Codigo, label: g.Nome, isActive: false }))\n }));\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: exames });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedExamsTerms\", payload: [\"Todos\", ...result.Data.Termos] });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedExams\", payload: exames });\n } else {\n context.commit(\"SET_PROP\", { prop: \"searchedExams\", payload: [] });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedExamsTerms\", payload: [] });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedExams\", payload: [] });\n }\n },\n triggerLaboratory(context, { isActive, lab }) {\n if (!lab.CodigoPrestador || !lab.SrEndereco) return;\n const selectedLaboratories = context.state.selectedLaboratories.filter(\n l => !(l.CodigoPrestador === lab.CodigoPrestador && l.SrEndereco === lab.SrEndereco)\n );\n if (isActive) {\n selectedLaboratories.push(JSON.parse(JSON.stringify(lab)));\n }\n context.commit(\"SET_PROP\", { prop: \"selectedLaboratories\", payload: selectedLaboratories });\n context.dispatch(\"checkActiveLaboratory\");\n },\n checkActiveLaboratory(context) {\n const searchedLaboratories = JSON.parse(JSON.stringify(context.state.searchedLaboratories));\n searchedLaboratories.forEach(lab => {\n lab.isActive = !!context.state.selectedLaboratories.find(\n l => l.CodigoPrestador === lab.CodigoPrestador && l.SrEndereco === lab.SrEndereco\n );\n });\n context.commit(\"SET_PROP\", { prop: \"searchedLaboratories\", payload: searchedLaboratories });\n },\n async searchLaboratory(context, { search }) {\n if (!search) {\n context.commit(\"SET_PROP\", { prop: \"searchedLaboratories\", payload: context.state.mostSearchedLaboratories });\n context.dispatch(\"checkActiveLaboratory\");\n return;\n }\n const exames = context.state.selectedExams.map(e => e.id);\n const result = await BuscarPrestadorSimulacaoCopay({\n vinculo: context.rootState.saude.vinculo,\n exames,\n tipoEndereco: context.state.address?.type,\n nome: search\n });\n\n if (result?.Data?.Prestadores?.length) {\n const laboratories = result.Data.Prestadores.map(p => ({\n CodigoRede: p.CodigoRede,\n CodigoPrestador: p.CodigoPrestador,\n SrEndereco: p.SrEndereco,\n name: p.DescricaoPrestador,\n distance: p.Distancia ? `${Math.round(p.Distancia * 100) / 100}km`.replaceAll(\".\", \",\") : \"\",\n price: p.ValorFormatado,\n logo: p.Logo ?? \"https://picsum.photos/24/24\",\n address: p.EnderecoCompleto\n }));\n context.commit(\"SET_PROP\", { prop: \"searchedLaboratories\", payload: laboratories });\n context.dispatch(\"checkActiveLaboratory\");\n } else {\n context.commit(\"SET_PROP\", { prop: \"searchedLaboratories\", payload: [] });\n }\n },\n async fetchMostSearchedLaboratories(context) {\n if (context.state.mostSearchedLaboratories?.length) {\n context.dispatch(\"searchLaboratory\", { search: \"\" });\n return;\n }\n const exames = context.state.selectedExams.map(e => e.id);\n const result = await ObterPrestadoresProcuradosSimulacaoCopay({\n vinculo: context.rootState.saude.vinculo,\n exames,\n tipoEndereco: context.state.address?.type,\n incluirTermos: false\n });\n\n if (result?.Data?.Termos?.length || result?.Data?.Prestadores?.length) {\n const laboratories = result.Data.Prestadores.map(p => ({\n CodigoRede: p.CodigoRede,\n CodigoPrestador: p.CodigoPrestador,\n SrEndereco: p.SrEndereco,\n name: p.DescricaoPrestador,\n distance: p.Distancia ? `${Math.round(p.Distancia * 100) / 100}km`.replaceAll(\".\", \",\") : \"\",\n price: p.ValorFormatado,\n logo: p.Logo ?? \"https://picsum.photos/24/24\",\n address: p.EnderecoCompleto\n }));\n context.commit(\"SET_PROP\", { prop: \"searchedLaboratories\", payload: laboratories });\n context.commit(\"SET_PROP\", {\n prop: \"mostSearchedLaboratoriesTerms\",\n payload: [\"Todos\", ...result.Data.Termos]\n });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedLaboratories\", payload: laboratories });\n } else {\n context.commit(\"SET_PROP\", { prop: \"searchedLaboratories\", payload: [] });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedLaboratoriesTerms\", payload: [] });\n context.commit(\"SET_PROP\", { prop: \"mostSearchedLaboratories\", payload: [] });\n }\n },\n async submitSimulation(context) {\n checkUpdatePermission();\n const exames = context.state.selectedExams.map(e => ({\n Codigo: e.id,\n Nome: e.name\n }));\n const prestadores = context.state.selectedLaboratories.map(p => ({\n CodigoPrestador: p.CodigoPrestador,\n SrEndereco: p.SrEndereco\n }));\n const simulacao = await SimularCopay({ vinculo: context.rootState.saude.vinculo, exames, prestadores });\n if (!simulacao) return \"Não foi possível realizar a simulação\";\n if (simulacao instanceof Error) return simulacao.message;\n if (simulacao?.Data?.Prestadores?.length) {\n const selectedLaboratories = JSON.parse(JSON.stringify(context.state.selectedLaboratories));\n selectedLaboratories.forEach(p => {\n p.price = simulacao.Data.Prestadores.find(\n r => r.CodigoPrestador === p.CodigoPrestador && r.SrEndereco === p.SrEndereco\n )?.ValorFormatado;\n });\n context.commit(\"SET_PROP\", { payload: selectedLaboratories, prop: \"selectedLaboratories\" });\n context.commit(\"SET_PROP\", { payload: simulacao.Data.DataTabelaVigente, prop: \"simulationValuesDateRef\" });\n context.commit(\"SET_PROP\", { payload: simulacao.Data.DataSimulacao, prop: \"simulationCreationDate\" });\n return \"\";\n } else {\n return \"Não foi possível realizar a simulação\";\n }\n },\n async fetchExamsLimit(context) {\n const limite = await ObterLimiteExames({ vinculo: context.rootState.saude.vinculo });\n if (limite.Data) {\n context.commit(\"SET_PROP\", { prop: \"examsLimit\", payload: limite.Data });\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_PROP(state, { payload, prop }) {\n Vue.set(state, prop, payload);\n },\n SORT_SIMULATIONS(state, sort) {\n state.activeSort = sort;\n\n if (!sort) {\n state.simulations = _.cloneDeep(state.initialSimulations);\n return;\n }\n\n if (sort === \"Mais recentes\") {\n state.simulations.sort(\n (a, b) => new Date(b.date.split(\"/\").reverse().join(\"/\")) - new Date(a.date.split(\"/\").reverse().join(\"/\"))\n );\n } else if (sort === \"Mais antigos\") {\n state.simulations.sort(\n (a, b) => new Date(a.date.split(\"/\").reverse().join(\"/\")) - new Date(b.date.split(\"/\").reverse().join(\"/\"))\n );\n } else if (sort === \"Últimos 30 dias\") {\n const thirtyDaysAgo = new Date();\n thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);\n state.simulations = state.simulations.filter(\n simulation => new Date(simulation.date.split(\"/\").reverse().join(\"/\")) >= thirtyDaysAgo\n );\n }\n },\n CLEAN_SORTS(state) {\n state.simulations = _.cloneDeep(state.initialSimulations);\n state.activeSort = \"\";\n },\n CLEAN_LABS(state) {\n state.selectedLaboratories = [];\n state.searchedLaboratories = [];\n state.mostSearchedLaboratoriesTerms = [];\n state.mostSearchedLaboratories = [];\n },\n CLEAN_SIMULATION(state) {\n state.selectedExams = [];\n state.searchedExams = [];\n state.mostSearchedExamsTerms = [];\n state.mostSearchedExams = [];\n state.selectedLaboratories = [];\n state.searchedLaboratories = [];\n state.mostSearchedLaboratoriesTerms = [];\n state.mostSearchedLaboratories = [];\n }\n }\n};\n","import * as geoUtils from \"@/utils/geoDistance\";\n\nconst baseURL = `${process.env.VUE_APP_SERVER_URL}/Solicitacao`;\n\nexport async function DetalheProtocolo({ vinculo, protocolo }) {\n return window.$axios\n .get({\n url: `${baseURL}/DetalheProtocolo`,\n query: {\n vinculo,\n protocolo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"DetalheProtocolo\", error.message);\n return error;\n });\n}\n\nexport async function NovaSolicitacao({ vinculo, beneficiario, tipo, observacao, arquivos, autenticacao }) {\n const data = new FormData();\n data.append(\"beneficiario\", beneficiario);\n data.append(\"tipo\", tipo);\n data.append(\"observacao\", observacao);\n data.append(\"autenticacao\", autenticacao);\n for (let index = 0; index < arquivos.length; index++) {\n const arquivo = arquivos[index];\n data.append(`anexo${index + 1}`, arquivo);\n }\n const coords: any = await geoUtils.GetLocation().catch(() => null);\n data.append(\"lat\", coords?.latitude ?? \"\");\n data.append(\"lng\", coords?.longitude ?? \"\");\n return window.$axios\n .post({\n url: `${baseURL}/NovaSolicitacao`,\n query: {\n vinculo\n },\n contentType: \"multipart/form-data\",\n data\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"NovaSolicitacao\", error.message);\n return error;\n });\n}\n\nexport function ObterDocumento({ vinculo, protocolo }) {\n const key = `${vinculo};${protocolo}`;\n const chave = `${window.$jse.encrypt(key)}`;\n\n const queryString = new URLSearchParams({\n vinculo,\n chave,\n tipo: \".pdf\"\n }).toString();\n\n return `${baseURL}/ObterDocumento?${queryString}`;\n}\n\nexport async function ObterImagem({ vinculo, documento, original }) {\n const key = `${vinculo};${documento};${original ? \"T\" : \"F\"}`;\n const chave = `${window.$jse.encrypt(key)}`;\n return await window.$axios\n .get({\n url: `${baseURL}/ObterImagem`,\n query: {\n vinculo,\n chave,\n original\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterImagem\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport async function ObterProtocolos({ vinculo, protocolo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterProtocolos`,\n query: {\n vinculo,\n protocolo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterProtocolos\", error.message);\n return error;\n });\n}\n\nexport async function ObterTiposSolicitacao({ vinculo }) {\n return window.$axios\n .get({\n url: `${baseURL}/ObterTiposSolicitacao`,\n query: {\n vinculo\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterTiposSolicitacao\", error.message);\n return error;\n });\n}\n\nexport async function RetornoPendencia({ vinculo, protocolo, observacao, arquivos }) {\n const data = new FormData();\n data.append(\"protocolo\", protocolo);\n data.append(\"observacao\", observacao);\n for (let index = 0; index < arquivos.length; index++) {\n data.append(`anexo${index + 1}`, arquivos[index]);\n }\n\n return window.$axios\n .post({\n url: `${baseURL}/RetornoPendencia`,\n query: {\n vinculo\n },\n contentType: \"multipart/form-data\",\n data\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"RetornoPendencia\", error.message);\n return error;\n });\n}\n","import Vue from \"vue\";\nimport {\n DetalheProtocolo,\n NovaSolicitacao,\n ObterDocumento,\n ObterImagem,\n ObterProtocolos,\n ObterTiposSolicitacao,\n RetornoPendencia\n} from \"@/api/solicitacao\";\nimport { ObterBeneficiariosTitulo } from \"@/api/associado\";\nimport { checkUpdatePermission } from \"@/utils/checkReadonlyUtil\";\n\nconst initialState = {\n activedSort: \"\",\n addPermission: true,\n beneficiaries: [],\n filters: {},\n lastFetch: null,\n limitFiles: 20,\n newRequest: {},\n protocols: [],\n sorts: [\"Mais recentes\", \"Mais antigos\"],\n subjectOptions: []\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n getters: {\n getAuthorizationService: context => {\n const subject = context.subjectOptions.find(s => s.value === context.newRequest.subject);\n\n return subject?.authorizationService;\n },\n filteredRequests: context => {\n let protocols = context.protocols?.length ? JSON.parse(JSON.stringify(context.protocols)) : [];\n if (protocols.length === 0) return [];\n\n const beneficiaries = context.filters?.beneficiary.filter(f => f.isActive) ?? [];\n if (beneficiaries?.length) {\n protocols = protocols.filter(p => !!beneficiaries.find(f => f.label === p.beneficiaryName));\n if (protocols.length === 0) return [];\n }\n const status = context.filters?.status.filter(f => f.isActive) ?? [];\n if (status?.length) {\n protocols = protocols.filter(p => !!status.find(f => f.label === p.statusDsc));\n if (protocols.length === 0) return [];\n }\n const titles = context.filters?.title.filter(f => f.isActive) ?? [];\n if (titles?.length) {\n protocols = protocols.filter(p => !!titles.find(f => f.label === p.title));\n if (protocols.length === 0) return [];\n }\n\n const sorts = {\n dateToNum(d) {\n if (!d || !d.includes(\"/\")) return 0;\n d = d.split(\"/\");\n return new Date(d[2], Number(d[1]) - 1, d[0]).getTime();\n },\n \"Mais recentes\"() {\n protocols.sort((a, b) => {\n return this.dateToNum(b.createdAt) - this.dateToNum(a.createdAt);\n });\n },\n \"Mais antigos\"() {\n protocols.sort((a, b) => {\n return this.dateToNum(a.createdAt) - this.dateToNum(b.createdAt);\n });\n }\n };\n\n if (context.activedSort) sorts[context.activedSort]();\n\n return protocols;\n }\n },\n actions: {\n async getDocumentUrl(context, { protocol }) {\n return await ObterDocumento({\n vinculo: context.rootState.saude.vinculo,\n protocolo: protocol\n });\n },\n async createRequestTicket(context, { obs }) {\n checkUpdatePermission();\n const newRequest = context.state.newRequest;\n const pictures = (newRequest.pictures ?? []).filter(p => p.source).map(p => p.source);\n return await NovaSolicitacao({\n vinculo: context.rootState.saude.vinculo,\n arquivos: pictures,\n beneficiario: newRequest.beneficiary,\n tipo: newRequest.subject,\n observacao: obs,\n autenticacao: newRequest.authorizationId\n });\n },\n async fetchBeneficiaries(context) {\n if (context.state.beneficiaries.length > 0) return;\n const resp = await ObterBeneficiariosTitulo({\n vinculo: context.rootState.saude.vinculo,\n dependentes: true,\n servico: 0\n });\n if (resp?.Data?.length) {\n const beneficiaries = resp.Data.map(b => ({\n value: b.Sequencia,\n label: b.Nome\n }));\n context.commit(\"SET_BENEFICIARIES\", beneficiaries);\n }\n },\n async fetchProtocols(context, options) {\n const protocolFilter = options?.protocol ?? \"\";\n const forceFetch = options?.force ?? false;\n if (!forceFetch && !protocolFilter && context.state.lastFetch) return;\n\n const response = await ObterProtocolos({\n vinculo: context.rootState.saude.vinculo,\n protocolo: protocolFilter\n });\n if (response?.Data?.length) {\n let protocols = response.Data.map(p => ({\n protocol: p.ProtocoloANS,\n ticket: p.Chamado,\n title: p.TipoSolicitacao,\n beneficiaryCode: p.CdUtilizacao,\n beneficiaryName: p.DsUtilizacao,\n statusCode: p.CdSituacao,\n statusDsc: p.DsSituacao,\n createdAt: p.DtSolicitacao,\n canEvaluate: p.Nota === null\n }));\n if (protocolFilter)\n protocols = [...protocols, ...(context.state.protocols ?? []).filter(p => p.protocol !== protocolFilter)];\n context.commit(\"SET_PROTOCOLS\", protocols);\n }\n },\n async fetchProtocolDetail(context, { protocol }) {\n const response = await DetalheProtocolo({\n vinculo: context.rootState.saude.vinculo,\n protocolo: protocol\n });\n if (response.Data)\n return {\n protocol: response.Data.ProtocoloANS,\n ticket: response.Data.Chamado,\n title: response.Data.TipoSolicitacao,\n beneficiaryCode: response.Data.CdUtilizacao,\n beneficiaryName: response.Data.DsUtilizacao,\n statusCode: response.Data.CdSituacao,\n statusDsc: response.Data.DsSituacao,\n doc: {\n id: response.Data.Documento.Id ?? 0,\n title: response.Data.Documento.Descricao,\n createdAt: response.Data.Documento.Data,\n resp: response.Data.Documento.Resposta ?? []\n },\n pendency: {\n ticket: response.Data.Pendencia?.Chamado ?? 0,\n reasons: response.Data.Pendencia?.Motivos ?? [],\n days: response.Data.Pendencia.DiasResposta ?? 20\n },\n createdAt: response.Data.DtSolicitacao,\n score: response.Data.Nota,\n pictures: response.Data.Imagens\n };\n return null;\n },\n async fetchProtocolDetailImage(context, { documento, original }) {\n return await ObterImagem({\n vinculo: context.rootState.saude.vinculo,\n documento,\n original\n });\n },\n async fetchSubjectOptions(context) {\n if (context.state.subjectOptions.length > 0) return;\n const resp = await ObterTiposSolicitacao({\n vinculo: context.rootState.saude.vinculo\n });\n if (resp?.Data?.length) {\n const subjectOptions = resp.Data.map(t => ({\n value: t.Id,\n label: t.Nome,\n daysAnalizy: t.PrazoAnalise,\n daysPendency: t.PrazoPendencia,\n orientation: t.Orientacao,\n warningDays: t.AvisoPrazo,\n warningOrientation: t.AvisoOrientacao,\n attchamentType: t.TipoAnexo,\n beneficiaryType: t.TipoBeneficiario,\n authorizationService: t.ServicoAutenticacao,\n attchamentDsc: (t.Anexos ?? []).map(a => ({\n id: a.Id,\n dsc: a.Nome\n }))\n }));\n context.commit(\"SET_SUBJECT_OPTIONS\", subjectOptions);\n }\n },\n returnRequestTicket: async (context, { protocol, obs, pictures }) => {\n checkUpdatePermission();\n const picturesSource = (pictures ?? []).filter(p => p.source).map(p => p.source);\n return await RetornoPendencia({\n vinculo: context.rootState.saude.vinculo,\n protocolo: protocol,\n observacao: obs,\n arquivos: picturesSource\n });\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n CLEAN_SORT_AND_FILTERS: state => {\n var filters = JSON.parse(JSON.stringify(state.filters));\n if (filters.beneficiary) filters.beneficiary.forEach(f => (f.isActive = false));\n if (filters.status) filters.status.forEach(f => (f.isActive = false));\n if (filters.title) filters.title.forEach(f => (f.isActive = false));\n filters.totalActived = 0;\n filters.selectedBeneficiary = \"\";\n Vue.set(state, \"filters\", filters);\n Vue.set(state, \"activedSort\", \"\");\n },\n RESET_NEW_REQUEST: state => Vue.set(state, \"newRequest\", {}),\n SET_ACTIVED_SORT: (state, activedSort) => Vue.set(state, \"activedSort\", activedSort),\n SET_AUTHORIZATION_ID: (state, authorizationId) => {\n var newRequest = JSON.parse(JSON.stringify(state.newRequest));\n newRequest.authorizationId = authorizationId;\n Vue.set(state, \"newRequest\", newRequest);\n },\n SET_BENEFICIARY: (state, beneficiary) => {\n var newRequest = JSON.parse(JSON.stringify(state.newRequest));\n newRequest.beneficiary = beneficiary;\n Vue.set(state, \"newRequest\", newRequest);\n },\n SET_BENEFICIARIES: (state, beneficiaries) => Vue.set(state, \"beneficiaries\", beneficiaries),\n SET_FILTERS: (state, filters) => Vue.set(state, \"filters\", filters),\n SET_PICTURES: (state, pictures) => {\n var newRequest = JSON.parse(JSON.stringify(state.newRequest));\n newRequest.pictures = pictures;\n Vue.set(state, \"newRequest\", newRequest);\n },\n SET_PROTOCOLS: (state, protocols) => {\n Vue.set(state, \"lastFetch\", new Date().getTime());\n Vue.set(state, \"protocols\", protocols);\n\n const beneficiaryFilters = [...new Set(protocols.map(p => p.beneficiaryName))].sort();\n const statusFilters = [...new Set(protocols.map(p => p.statusDsc))].sort();\n const titleFilters = [...new Set(protocols.map(p => p.title))].sort();\n\n const filters = {\n beneficiary: beneficiaryFilters.map(f => ({\n label: f,\n isActive: state.filters.beneficiary?.find(current => current.label === f)?.isActive ?? false\n })),\n status: statusFilters.map(f => ({\n label: f,\n isActive: state.filters.status?.find(current => current.label === f)?.isActive ?? false\n })),\n title: titleFilters.map(f => ({\n label: f,\n isActive: state.filters.title?.find(current => current.label === f)?.isActive ?? false\n }))\n };\n\n const beneficiaries = filters.beneficiary.filter(f => f.isActive) ?? [];\n const status = filters.status.filter(f => f.isActive) ?? [];\n const titles = filters.title.filter(f => f.isActive) ?? [];\n filters.totalActived = beneficiaries.length + status.length + titles.length;\n\n Vue.set(state, \"filters\", filters);\n },\n SET_SUBJECT: (state, subject) => {\n var newRequest = JSON.parse(JSON.stringify(state.newRequest));\n newRequest.subject = subject;\n Vue.set(state, \"newRequest\", newRequest);\n },\n SET_SUBJECT_OPTIONS: (state, types) => Vue.set(state, \"subjectOptions\", types)\n }\n};\n","import Vue from \"vue\";\nimport { ObterBeneficiariosAcessoFuncionalidade } from \"@/api/associado\";\nimport { ObterPeriodosExtratoUtilizacao, ObterExtratoUtilizacao, ExtratoServicoPDF } from \"@/api/atendimento\";\nimport { recuperarDadosVinculo } from \"@/utils/vinculoUtil\";\n\nconst initialState = {\n beneficiaries: [],\n semesters: [],\n services: []\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n actions: {\n async initBeneficiaries(context) {\n try {\n const response = await ObterBeneficiariosAcessoFuncionalidade({\n vinculo: context.rootState.saude.vinculo,\n funcionalidade: 2\n });\n\n const beneficiaries = response instanceof Error ? [] : response;\n await context.commit(\"SET_BENEFICIARIES\", beneficiaries);\n } catch (error) {\n throw Error(error);\n }\n },\n async fetchSemesters(context, { vinculo }) {\n try {\n const { sequencia } = recuperarDadosVinculo(vinculo);\n\n const response = await ObterPeriodosExtratoUtilizacao({\n vinculo: context.rootState.saude.vinculo,\n beneficiario: sequencia\n });\n const semesters = response instanceof Error ? [] : response;\n await context.commit(\"SET_SEMESTERS\", semesters);\n await context.commit(\"SET_SERVICES\", []);\n } catch (error) {\n throw Error(error);\n }\n },\n async fetchServices(context, { ano, semestre, vinculoBeneficiario }) {\n try {\n if (!ano || !semestre) {\n await context.commit(\"SET_SERVICES\", []);\n return;\n }\n\n const { sequencia } = recuperarDadosVinculo(vinculoBeneficiario);\n\n const response = await ObterExtratoUtilizacao({\n vinculo: context.rootState.saude.vinculo,\n semestre,\n ano,\n beneficiario: sequencia\n });\n\n const extratos = response instanceof Error ? [] : response;\n await context.commit(\"SET_SERVICES\", extratos);\n } catch (error) {\n throw Error(error);\n }\n },\n async getExtractUrl(context, { ano, semestre, vinculoBeneficiario }) {\n try {\n const { sequencia } = recuperarDadosVinculo(vinculoBeneficiario);\n const result = ExtratoServicoPDF({\n vinculo: context.rootState.saude.vinculo,\n semestre,\n ano,\n beneficiario: sequencia\n });\n return result;\n } catch (error) {\n throw Error(error);\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_BENEFICIARIES: (state, beneficiaries) => Vue.set(state, \"beneficiaries\", beneficiaries),\n SET_SEMESTERS: (state, semesters) => Vue.set(state, \"semesters\", semesters),\n SET_SERVICES: (state, services) => Vue.set(state, \"services\", services)\n }\n};\n","const baseURL = `${process.env.VUE_APP_SERVER_URL}/SeguroViagem`;\n\nexport async function ObterSolicitacoes({ vinculo, idChamado = null, idioma = null, protocolo = null }) {\n const query = {\n vinculo,\n ...(idChamado && { idChamado }),\n ...(idioma && { idioma }),\n ...(protocolo && { protocolo })\n };\n\n return window.$axios\n .get({\n url: `${baseURL}/ObterSolicitacoes`,\n query\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterSolicitacoes\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport async function ObterDadosRelatorio({ vinculo }) {\n const query = {\n vinculo\n };\n\n return window.$axios\n .get({\n url: `${baseURL}/ObterDadosRelatorio`,\n query\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"ObterDadosRelatorio\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport async function EnviarCarta({ vinculo, idiomas, beneficiarios }) {\n return window.$axios\n .post({\n url: `${baseURL}/EnviarCarta`,\n query: {\n vinculo\n },\n data: {\n Idiomas: idiomas,\n Beneficiarios: beneficiarios\n }\n })\n .then(resp => resp.data)\n .catch(error => {\n window.$log.error(\"EnviarCarta\", error.message);\n throw new Error(error.message);\n });\n}\n\nexport function DownloadCartaSeguroViagem({ vinculo, documento }) {\n const queryParams = new URLSearchParams({\n vinculo: vinculo,\n key: documento,\n tipo: \".pdf\"\n }).toString();\n return `${baseURL}/DownloadCartaSeguroViagem?${queryParams}`;\n}\n","import Vue from \"vue\";\nimport { ObterSolicitacoes, ObterDadosRelatorio, EnviarCarta, DownloadCartaSeguroViagem } from \"@/api/seguroViagem\";\n\nconst initialState = {\n filters: { beneficiarios: [], idiomas: [] },\n sorts: [\"Mais recentes\", \"Mais antigos\"],\n activedSort: \"\",\n solicitacoes: [],\n lastFetch: 0,\n beneficiarios: [],\n idiomas: []\n};\n\nexport default {\n namespaced: true,\n state: () => ({ ...initialState }),\n getters: {\n solicitacoesFiltradas: context => {\n let filtradas = [];\n\n const fb = context.filters.beneficiarios;\n const beneficiarios = Object.keys(fb).filter(f => fb[f]) ?? [];\n const fi = context.filters.idiomas;\n const idiomas = Object.keys(fi).filter(f => fi[f]) ?? [];\n const solicitacoes = JSON.parse(JSON.stringify(context.solicitacoes));\n if (beneficiarios.length || idiomas.length) {\n solicitacoes.forEach(s => {\n const validB = beneficiarios.length ? !!s.beneficiarios.find(f => beneficiarios.includes(f.nome)) : true;\n const validI = idiomas.length ? idiomas.includes(s.idioma) : true;\n if (validB && validI) filtradas.push(s);\n });\n } else {\n filtradas = solicitacoes;\n }\n\n const sorts = {\n dateToNum(d) {\n d = d.split(\"/\");\n return new Date(d[2], Number(d[1]) - 1, d[0]).getTime();\n },\n \"Mais recentes\"() {\n filtradas.sort((a, b) => {\n return this.dateToNum(b.data) - this.dateToNum(a.data);\n });\n },\n \"Mais antigos\"() {\n filtradas.sort((a, b) => {\n return this.dateToNum(a.data) - this.dateToNum(b.data);\n });\n }\n };\n\n if (context.activedSort) sorts[context.activedSort]();\n\n return filtradas;\n }\n },\n actions: {\n async fetchSolicitacoes(context, options) {\n const protocolFilter = options?.protocol ?? \"\";\n const forceFetch = options?.force ?? false;\n if (!forceFetch && !protocolFilter && context.state.lastFetch) {\n const fetchCacheLimit = new Date().getTime() - 900000; // 15min\n if (context.state.lastFetch > fetchCacheLimit) return;\n }\n\n try {\n const response = await ObterSolicitacoes({\n vinculo: context.rootState.saude.vinculo\n });\n const solicitacoes = [];\n const idiomas = {};\n const beneficiarios = {};\n (response?.Data ?? []).forEach(s =>\n (s.Idiomas ?? []).forEach(i => {\n const solicitacao = {\n data: s.DataInclusao,\n protocolo: s.Protocolo,\n idioma: i.Idioma,\n urlDownload: DownloadCartaSeguroViagem({\n vinculo: context.rootState.saude.vinculo,\n documento: i.Documento\n }),\n beneficiarios: []\n };\n if (!idiomas[i.Idioma]) idiomas[i.Idioma] = context.state.filters.idiomas[i.Idioma] ?? false;\n (i.Beneficiarios ?? []).forEach(b => {\n solicitacao.beneficiarios.push({\n nome: b.Beneficiario,\n parentesco: b.Parentesco\n });\n if (!beneficiarios[b.Beneficiario])\n beneficiarios[b.Beneficiario] = context.state.filters.beneficiarios[b.Beneficiario] ?? false;\n });\n solicitacoes.push(solicitacao);\n })\n );\n\n context.commit(\"SET_SOLICITACOES\", { solicitacoes, idiomas, beneficiarios });\n return true;\n } catch {\n return false;\n }\n },\n async fetchBeneficiarios(context) {\n if (context.state.beneficiarios?.lenght && context.state.idiomas?.lenght) return;\n try {\n const resp = await ObterDadosRelatorio({\n vinculo: context.rootState.saude.vinculo\n });\n const baseUrl = context.rootGetters[\"saude/baseUrl\"];\n context.commit(\n \"SET_BENEFICIARIOS\",\n (resp.Data?.Beneficiarios ?? []).map(b => ({\n nome: b.Beneficiario,\n seq: b.Sequencia,\n med: b.PlanoMedico,\n odo: b.PlanoOdonto,\n parentesco: b.Parentesco\n }))\n );\n context.commit(\n \"SET_IDIOMAS\",\n (resp.Data?.Idiomas ?? []).map(i => ({\n id: i.Id,\n label: i.Texto,\n img: `${baseUrl}/images/bandeiras/${i.Id}.png`\n }))\n );\n return true;\n } catch {\n return false;\n }\n },\n async postEnviarCarta(context, { idiomas, beneficiarios }) {\n try {\n const resp = await EnviarCarta({\n vinculo: context.rootState.saude.vinculo,\n idiomas,\n beneficiarios\n });\n const sucesso = !!resp?.Data;\n if (sucesso) context.dispatch(\"fetchSolicitacoes\", { force: true });\n const docs = resp.Data.Documentos ?? {};\n return {\n sucesso,\n erro: sucesso ? \"\" : \"Não foi possível gerar a carta. Tente novamente em alguns minutos.\",\n protocolo: sucesso\n ? {\n email: resp.Data.Email,\n protocoloANS: resp.Data.Protocolo,\n documentos: Object.keys(docs).map(d => ({\n label: d,\n urlDownload: DownloadCartaSeguroViagem({\n vinculo: context.rootState.saude.vinculo,\n documento: docs[d]\n })\n }))\n }\n : {}\n };\n } catch (error) {\n return {\n sucesso: false,\n erro: error.message,\n protocolo: {}\n };\n }\n }\n },\n mutations: {\n LOGOUT_USER: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n RESET_CONTEXT: state => Object.keys(state).forEach(p => Vue.set(state, p, initialState[p])),\n SET_ACTIVED_SORT: (state, activedSort) => Vue.set(state, \"activedSort\", activedSort),\n SET_FILTERS: (state, filters) => Vue.set(state, \"filters\", filters),\n SET_SOLICITACOES: (state, { solicitacoes, idiomas, beneficiarios }) => {\n Vue.set(state, \"solicitacoes\", solicitacoes);\n Vue.set(state, \"lastFetch\", new Date().getTime());\n Vue.set(state, \"filters\", {\n idiomas,\n beneficiarios\n });\n },\n SET_BENEFICIARIOS: (state, beneficiarios) => Vue.set(state, \"beneficiarios\", beneficiarios),\n SET_IDIOMAS: (state, idiomas) => Vue.set(state, \"idiomas\", idiomas)\n }\n};\n","import Vuex from \"vuex\";\nimport Affiliate from \"@/store/affiliate\";\nimport Auths from \"@/store/auths\";\nimport BankAccount from \"@/store/bankAccount\";\nimport FirstAccess from \"@/store/firstAccess\";\nimport MyFiles from \"@/store/myFiles\";\nimport Statement from \"@/store/statement\";\nimport Refund from \"@/store/refund\";\nimport Ticket from \"@/store/ticket\";\nimport Voucher from \"@/store/voucher\";\nimport Saude from \"@/store/saude\";\nimport MyAccount from \"@/store/myAccount\";\nimport PushToken from \"@/store/pushToken\";\nimport Biometrics from \"@/store/biometrics\";\nimport Forms from \"@/store/forms\";\nimport MyContacts from \"@/store/myContacts\";\nimport AccessManagement from \"@/store/accessManagement\";\nimport Atendimento from \"@/store/atendimento\";\nimport Tasks from \"@/store/tasks\";\nimport Nominees from \"@/store/nominees\";\nimport Copay from \"@/store/copay\";\nimport Request from \"@/store/request\";\nimport ServicesExtract from \"@/store/servicesExtract\";\nimport SafeLetter from \"./store/safeLetter\";\n\nimport { logoutUser } from \"@/utils/authUtil\";\n\nconst store = new Vuex.Store({\n namespaced: true,\n state: {},\n actions: {\n async resetContext({ commit }) {\n // solicita a limpeza do contexto do módulo (sessão expirou)\n for (let i = 0; i < modules.length; i++) {\n await commit(`${modules[i].name}/RESET_CONTEXT`);\n }\n },\n\n async logoutUser({ commit }) {\n logoutUser();\n // solicita a limpeza do contexto do módulo (usuário solicitou logout)\n for (let i = 0; i < modules.length; i++) {\n await commit(`${modules[i].name}/LOGOUT_USER`);\n }\n }\n }\n});\n\nconst modules = [\n { name: \"affiliate\", component: Affiliate },\n { name: \"auths\", component: Auths },\n { name: \"bankAccount\", component: BankAccount },\n { name: \"firstAccess\", component: FirstAccess },\n { name: \"myFiles\", component: MyFiles },\n { name: \"statement\", component: Statement },\n { name: \"refund\", component: Refund },\n { name: \"ticket\", component: Ticket },\n { name: \"voucher\", component: Voucher },\n { name: \"saude\", component: Saude },\n { name: \"myAccount\", component: MyAccount },\n { name: \"pushToken\", component: PushToken },\n { name: \"biometrics\", component: Biometrics },\n { name: \"forms\", component: Forms },\n { name: \"myContacts\", component: MyContacts },\n { name: \"accessManagement\", component: AccessManagement },\n { name: \"atendimento\", component: Atendimento },\n { name: \"tasks\", component: Tasks },\n { name: \"nominees\", component: Nominees },\n { name: \"copay\", component: Copay },\n { name: \"request\", component: Request },\n { name: \"servicesExtract\", component: ServicesExtract },\n { name: \"safeLetter\", component: SafeLetter }\n];\n// inicia os módulos\nmodules.forEach(m => {\n store.registerModule(m.name, m.component);\n});\n\nexport default store;\n","import store from \"@/store\";\n\nfunction afterEachRouteGuard(to, from) {\n const name = \"/\" + to.name;\n const url = location.protocol + \"//\" + location.host + to.fullPath;\n if (window.$appInsights) {\n window.$appInsights.stopTrackPage(name, url);\n window.$appInsights.flush();\n }\n if (from?.name === null) {\n store.dispatch(\"saude/appLoaded\");\n }\n}\n\nexport default afterEachRouteGuard;\n","import { getAuthToken, isLoggedIn } from \"@/utils/authUtil\";\nimport {\n getRouteByPerfilNumber,\n ROTA_ALTERAR_SENHA,\n ROTA_OPTIN,\n ROTA_AVISO_ATRASO,\n ROTA_PADRAO\n} from \"@/utils/perfilRouteUtil\";\n\nimport store from \"@/store\";\n\nconst hasAccessPermition = async to => {\n if (to.meta.allowAnonymous) return true;\n if (to.meta.checkPathDisabled) return true;\n const menu = store.state.saude.menu ?? [];\n let toPath = to.path;\n if (toPath.includes(\"?\")) {\n toPath = toPath.substring(0, toPath.indexOf(\"?\"));\n }\n if (toPath.endsWith(\"/\")) {\n toPath = toPath.substring(0, toPath.length - 1);\n }\n const validPath = to.meta.validPath?.length ? to.meta.validPath : [toPath];\n let valid = !!validPath.find(p => !!menu.find(m => m.View && m.View.startsWith(p)));\n if (!valid) {\n const menusFavoritos = store.state.saude.menusFavoritos ?? [];\n valid = !!validPath.find(p => !!menusFavoritos.find(m => m.View && m.View.startsWith(p)));\n }\n if (valid && to.meta.validAction) {\n valid = await store.dispatch(to.meta.validAction);\n }\n return valid;\n};\n\nasync function beforeEachRouteGuard(to, from, next) {\n if (!to.meta.offline && !navigator.onLine) {\n // rota permite apenas navegação online e está sem conexão com a internet\n window.dispatchEvent(new Event(\"offline\"));\n next(false);\n return;\n }\n\n if (to.name === \"logout\") {\n // sem regra para sair da aplicação\n next();\n return;\n }\n\n const appLocked = store.state.accessManagement.appLocked;\n if (to.name === \"login\" && appLocked) {\n return next();\n }\n\n const vinculo = store.state.saude.vinculo;\n const operacao = store.state.saude.operacao;\n const perfil = store.state.saude.perfil;\n const routeByPerfil = operacao > 0 && perfil > 0 ? getRouteByPerfilNumber(operacao, perfil) : \"\";\n if (to.name === \"login\" && isLoggedIn(true)) {\n // login foi realizado (existe token de autenticação)\n if (vinculo === \"\" || perfil === 0 || operacao === 0) {\n // vinculo não foi selecionado, solicitado novo login\n next();\n } else {\n // autenticação realizada e vinculo do associado foi selecionado\n next({ path: routeByPerfil });\n }\n return;\n }\n\n const isLogged = isLoggedIn();\n if (isLogged && to.name === \"vinculos\" && (vinculo === \"\" || perfil === 0 || operacao === 0)) {\n next();\n return;\n }\n\n if (\n to.name !== \"redirect\" &&\n to.name !== \"readonly.access\" &&\n ((to.query.vinculo && to.query.login && to.query.usuario) || (to.query.cd1 && to.query.cd2 && to.query.cd4))\n ) {\n await store.dispatch(\"logoutUser\");\n const authQuery = {\n nextUrl: to.path\n };\n Object.keys(to.query).map(k => {\n authQuery[k] = to.query[k];\n });\n next({\n name: \"redirect\",\n params: authQuery\n });\n return;\n }\n\n if (!to.meta.allowAnonymous && (!isLogged || vinculo === \"\" || perfil === 0 || operacao === 0)) {\n // será solicitada a autenticação se página de destino será exibida após o login\n if (to.fullPath === \"\" || to.fullPath === \"/\" || to.fullPath === \"/vinculos\" || to.fullPath === routeByPerfil) {\n next({\n path: ROTA_PADRAO\n });\n } else {\n next({\n path: ROTA_PADRAO,\n query: {\n nextUrl: to.fullPath\n }\n });\n }\n return;\n }\n\n if (isLogged) {\n if (!window.$axios.hasAuthToken()) {\n window.$axios.setAuthToken(getAuthToken());\n }\n if (!store.state.saude.hydrated && !store.state.saude.hydrating) {\n await store.dispatch(\"saude/hydrate\");\n }\n const sessaoValida = await store.dispatch(\"myAccount/sessionState\");\n if (sessaoValida) {\n if (\n store.state.myAccount?.terms?.length &&\n !to.path.includes(ROTA_OPTIN) &&\n !to.path.includes(ROTA_PADRAO) &&\n to.name !== \"logout\"\n ) {\n next({\n path: ROTA_OPTIN,\n query: {\n nextUrl: to.fullPath\n }\n });\n return;\n }\n\n if (store.state.accessManagement?.nonpaymentWarning?.key && to.path !== ROTA_AVISO_ATRASO) {\n next({ path: ROTA_AVISO_ATRASO });\n return;\n }\n\n if (store.state.myAccount?.changePasswordRequired && to.path !== ROTA_ALTERAR_SENHA) {\n next({ path: ROTA_ALTERAR_SENHA });\n return;\n }\n\n const hasPermition = await hasAccessPermition(to);\n if (!hasPermition) {\n next(await store.dispatch(\"saude/fetchInitRoute\"));\n return;\n }\n\n const registroNavegacao =\n vinculo !== \"\" &&\n to?.name &&\n from?.name &&\n (from.fullPath === \"/\" ||\n from.fullPath === routeByPerfil ||\n (to.name.indexOf(from.name) < 0 && from.name.indexOf(to.name) < 0));\n if (registroNavegacao) {\n if (to.meta?.registerAccess?.servico && to.meta?.registerAccess?.funcionalidade) {\n // registra acesso usuario (independente de idClassifica)\n store.dispatch(\"myAccount/registerAccess\", {\n servico: to.meta.registerAccess.servico,\n funcionalidade: to.meta.registerAccess.funcionalidade,\n id: null\n });\n }\n if (to.meta?.idClassifica) {\n // registro de chamado de navegação\n // apenas para usuários autenticados e com vínculo selecionado\n // apenas rotas com classificação de rastreio (idClassifica)\n store.dispatch(\"myAccount/registerNavigation\", {\n classificacao: to.meta?.idClassifica\n });\n }\n }\n next();\n } else {\n next(\"/logout\");\n }\n next();\n } else {\n next();\n }\n}\n\nexport default beforeEachRouteGuard;\n","var render = function () {\nvar this$1 = this;\nvar _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"page\",attrs:{\"id\":\"page\"}},[(!_vm.isAppUpdated)?_c('div',{staticClass:\"app-loading\"},[_c('img',{attrs:{\"src\":_vm.logoImg}}),_c('p',[_vm._v(\"Verificando atualizações...\")])]):[_c('form',{staticClass:\"cover\"},[_c('div',{staticClass:\"form\"},[_c('CFlex',{attrs:{\"justifyContent\":\"center\",\"mb\":\"50px\"}},[_c('img',{attrs:{\"src\":_vm.logoLogin}})]),_c('CFlex',{attrs:{\"mb\":\"3\",\"justifyContent\":\"center\"}},[_c('OmtTypography',{attrs:{\"fontSize\":\"22px\",\"fontWeight\":\"700\",\"as\":\"p1\",\"color\":\"var(--colors-light-primary-navy-blue)\",\"mr\":\"1\"}},[_vm._v(\"Olá,\")]),_c('OmtTypography',{attrs:{\"fontSize\":\"22px\",\"fontWeight\":\"400\",\"as\":\"p1\"}},[_vm._v(\"é bom te ver aqui!\")])],1),_c('CFlex',{attrs:{\"justifyContent\":\"center\"}},[_c('OmtTypography',{attrs:{\"as\":\"h2-regular\",\"mb\":\"5\",\"color\":\"var(--colors-light-primary-gray2)\"}},[_vm._v(\"Insira seus dados para acessar o APP\")])],1),_c('div',{staticClass:\"form-group\"},[_c('OmtInput',{staticClass:\"InputLogin\",attrs:{\"data-cy\":\"login\",\"autocapitalize\":\"none\",\"autocomplete\":\"username\",\"placeholder\":\"CPF\",\"type\":\"text\",\"borderColor\":\"var(--colors-light-secondary-divider)\",\"px\":\"2\"},on:{\"input\":_vm.toLowerCase,\"keydown\":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,\"enter\",13,$event.key,\"Enter\")){ return null; }$event.preventDefault();return _vm.checkEnter.apply(null, arguments)}},model:{value:(_vm.input.username),callback:function ($$v) {_vm.$set(_vm.input, \"username\", $$v)},expression:\"input.username\"}}),_c('span',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.input.username === ''),expression:\"input.username === ''\"}],staticClass:\"required\"},[_vm._v(\"(obrigatório)\")])],1),_c('div',{staticClass:\"form-group\"},[_c('OmtInput',{staticClass:\"InputLogin\",attrs:{\"data-cy\":\"password\",\"type\":_vm.passwordShow ? 'text' : 'password',\"autocapitalize\":\"off\",\"autocomplete\":\"current-password\",\"autocorrect\":\"off\",\"placeholder\":\"Senha\",\"px\":\"2\"},on:{\"keyup\":function () {\n this$1.invalidPwd = false;\n },\"keydown\":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,\"enter\",13,$event.key,\"Enter\")){ return null; }$event.preventDefault();return _vm.checkEnter.apply(null, arguments)}},model:{value:(_vm.input.password),callback:function ($$v) {_vm.$set(_vm.input, \"password\", $$v)},expression:\"input.password\"}}),_c('OmtIcons',{attrs:{\"size\":\"lg\",\"name\":_vm.passwordShow ? 'eye-slash' : 'eye',\"color\":\"var(--colors-light-primary-navy-blue)\",\"position\":\"absolute\",\"right\":\".5rem\",\"zIndex\":\"2\"},on:{\"click\":function($event){$event.preventDefault();_vm.passwordShow = !_vm.passwordShow}}}),_c('span',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.input.password === ''),expression:\"input.password === ''\"}],staticClass:\"required\"},[_vm._v(\"(obrigatório)\")])],1),_c('CFlex',{attrs:{\"mt\":\"5\",\"mb\":\"8\",\"justifyContent\":\"space-between\"}},[_c('CBox',[_c('router-link',{attrs:{\"to\":\"/first-access/terms\"}},[_c('OmtTypography',{attrs:{\"as\":\"h3-bold\",\"color\":\"var(--colors-light-primary-navy-blue)\",\"cursor\":\"pointer\"}},[_vm._v(\" Primeiro acesso \")])],1)],1),_c('CBox',[_c('router-link',{attrs:{\"to\":\"/forgot/reset\"}},[_c('OmtTypography',{attrs:{\"as\":\"h3-bold\",\"color\":\"var(--colors-light-primary-navy-blue)\",\"cursor\":\"pointer\"}},[_vm._v(\" Esqueci minha senha \")])],1)],1)],1),_c('OmtButton',{attrs:{\"variant\":\"solid\",\"width\":\"100%\",\"height\":\"50px\",\"border\":\"0.5px solid var(--colors-light-secondary-divider)\",\"borderRadius\":\"40px\",\"disabled\":_vm.isLoading,\"data-cy\":\"button-entrar\"},on:{\"click\":function($event){$event.preventDefault();$event.stopPropagation();return _vm.login.apply(null, arguments)}}},[_c('OmtTypography',{attrs:{\"as\":\"h1-bold\",\"color\":\"white\"}},[_vm._v(\"Entrar\")])],1),(_vm.credentials.length)?_c('CFlex',{attrs:{\"mt\":\"5\",\"mb\":\"8\",\"justifyContent\":\"center\"}},[_c('router-link',{attrs:{\"to\":\"/offlinecredential\"}},[_c('OmtTypography',{attrs:{\"as\":\"h3-bold\",\"color\":\"var(--colors-light-primary-navy-blue)\",\"cursor\":\"pointer\"}},[_vm._v(\" Credencial Offline \")])],1)],1):_vm._e(),(_vm.shoudUseBiometric)?_c('CFlex',{attrs:{\"mt\":\"50px\"}},[_c('CBox',{attrs:{\"justifyContent\":\"center\",\"textAlign\":\"center\",\"w\":\"100%\"},on:{\"click\":function($event){return _vm.authenticateUser()}}},[_c('OmtIcons',{attrs:{\"size\":\"lg\",\"name\":\"expand\",\"color\":\"var(--colors-light-primary-gray1)\"}}),_c('OmtTypography',{attrs:{\"as\":\"h3-bold\"}},[_vm._v(\"Entrar\"),_c('br'),_vm._v(\"com biometria\")])],1)],1):_vm._e(),_c('div',{staticClass:\"margin-head\"})],1)]),_c('InstallPWA')]],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.show && !_vm.closeWindow)?_c('div',{staticClass:\"install-hider\"},[_c('div',{class:_vm.myClass},[_vm._m(0),(_vm.displayInstallButton)?_c('omt-buttons-bar',[_c('omt-button',{attrs:{\"onClick\":_vm.installer,\"bigSize\":true}},[_vm._v(\" Instalar na tela inicial \")])],1):(_vm.iOS)?_c('omt-p',[_vm._v(\" Instale OMINT APP na sua tela inicial! Abrir o Safari e no menu selecione a opção \\\"Adicionar a tela iniciar\\\". \")]):_vm._e(),_c('br'),_c('omt-divider',{attrs:{\"onlyClear\":true}}),_c('a',{staticClass:\"pwa-dismiss\",attrs:{\"href\":\"#\"},on:{\"click\":function($event){$event.preventDefault();return _vm.close.apply(null, arguments)}}},[_vm._v(\" Melhor mais tarde... \")]),_c('i',{staticClass:\"fa fa-caret-down fa-2x\"})],1)]):_vm._e()}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{\"display\":\"flex\",\"justify-content\":\"center\"}},[_c('img',{staticClass:\"round-medium\",attrs:{\"src\":\"app/omint-icons/icon075x075.png\",\"width\":\"90\",\"alt\":\"Logo Omint APP\"}})])}]\n\nexport { render, staticRenderFns }","\nVerificando atualizações...
\n{{ step }}
\n{{ DescricaoPrestador }}
\n\n {{ especialidades }}\n
\n\n{{ getNotaFormatada }}
\n\n •\n
\n{{ getDistanciaFormatada }} km
\n\n •\n
\n\n •\n
\n\n •\n
\n\n {{ TipoLogradouro ? TipoLogradouro : \"\" }} {{ EnderecoRua }}, {{ EnderecoNumero }} - {{ EnderecoBairro }} -\n {{ EnderecoCidade }} / {{ CodigoEstado }}\n
\nProtocolo {{ protocol }}
\n\nSolicitada em {{ createdAt }}
\n\n\n {{ name }}\n
\n\n\n {{ dsStatus }}\n
\n{{ selectedAddress }}
\n\nSeu agendamento foi realizado com sucesso e já está disponível na área Minhas Atividades.
\n\n Caso seja necessário cancelar ou reagendá-lo, clique em Ver detalhes e escolha a nova data para\n atendimento.\n
\n{{ task.Beneficiario }}
\n Associado do atendimento\n{{ task.Staff }}
\n {{ task.Especialidade }}\n{{ task.Local }}
\n {{ task.Endereco }}\n{{ task.DisMesAgendamentoExtenso }}
\n {{ task.DiaSemanaAgendamento }}\n{{ task.Hora }}
\n {{ \" \" }}\nIniciando a aplicação...
\n