fix: capture doc creation event

This commit is contained in:
Shariq Ansari 2024-08-16 19:21:03 +05:30
parent 4159bb6196
commit f1bef0ad75
10 changed files with 21 additions and 9 deletions

View File

@ -220,7 +220,7 @@ async function submitEmail() {
newEmail.value = '' newEmail.value = ''
reload.value = true reload.value = true
emit('scroll') emit('scroll')
capture('email_sent', { doctype: props.doctype, name: doc.value.data.name }) capture('email_sent', { doctype: props.doctype })
} }
async function submitComment() { async function submitComment() {
@ -230,7 +230,7 @@ async function submitComment() {
newComment.value = '' newComment.value = ''
reload.value = true reload.value = true
emit('scroll') emit('scroll')
capture('comment_sent', { doctype: props.doctype, name: doc.value.data.name }) capture('comment_sent', { doctype: props.doctype })
} }
function toggleEmailBox() { function toggleEmailBox() {

View File

@ -274,7 +274,7 @@ async function applyEmailTemplate(template) {
editor.value.commands.setContent(data.message) editor.value.commands.setContent(data.message)
} }
showEmailTemplateSelectorModal.value = false showEmailTemplateSelectorModal.value = false
capture('email_template_applied', { email_template: template.name }) capture('email_template_applied', { doctype: props.doctype })
} }
function appendEmoji() { function appendEmoji() {

View File

@ -92,6 +92,7 @@ import CertificateIcon from '@/components/Icons/CertificateIcon.vue'
import EditIcon from '@/components/Icons/EditIcon.vue' import EditIcon from '@/components/Icons/EditIcon.vue'
import Dropdown from '@/components/frappe-ui/Dropdown.vue' import Dropdown from '@/components/frappe-ui/Dropdown.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { capture } from '@/telemetry'
import { call, createResource } from 'frappe-ui' import { call, createResource } from 'frappe-ui'
import { ref, nextTick, watch, computed } from 'vue' import { ref, nextTick, watch, computed } from 'vue'
import { createToast } from '@/utils' import { createToast } from '@/utils'
@ -160,7 +161,10 @@ async function callInsertDoc() {
..._contact.value, ..._contact.value,
}, },
}) })
doc.name && handleContactUpdate(doc) if (doc.name) {
capture('contact_created')
handleContactUpdate(doc)
}
} }
function handleContactUpdate(doc) { function handleContactUpdate(doc) {

View File

@ -61,6 +61,7 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
import Fields from '@/components/Fields.vue' import Fields from '@/components/Fields.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { capture } from '@/telemetry'
import { Switch, createResource } from 'frappe-ui' import { Switch, createResource } from 'frappe-ui'
import { computed, ref, reactive, onMounted, nextTick } from 'vue' import { computed, ref, reactive, onMounted, nextTick } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@ -201,6 +202,7 @@ function createDeal() {
isDealCreating.value = true isDealCreating.value = true
}, },
onSuccess(name) { onSuccess(name) {
capture('deal_created')
isDealCreating.value = false isDealCreating.value = false
show.value = false show.value = false
router.push({ name: 'Deal', params: { dealId: name } }) router.push({ name: 'Deal', params: { dealId: name } })

View File

@ -173,7 +173,7 @@ async function callInsertDoc() {
}, },
}) })
if (doc.name) { if (doc.name) {
capture('email_template_created', { email_template: doc.name }) capture('email_template_created', { doctype: doc.reference_doctype })
handleEmailTemplateUpdate(doc) handleEmailTemplateUpdate(doc)
} }
} }

View File

@ -46,6 +46,7 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
import Fields from '@/components/Fields.vue' import Fields from '@/components/Fields.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { capture } from '@/telemetry'
import { createResource } from 'frappe-ui' import { createResource } from 'frappe-ui'
import { computed, onMounted, ref, reactive, nextTick } from 'vue' import { computed, onMounted, ref, reactive, nextTick } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@ -153,6 +154,7 @@ function createNewLead() {
isLeadCreating.value = true isLeadCreating.value = true
}, },
onSuccess(data) { onSuccess(data) {
capture('lead_created')
isLeadCreating.value = false isLeadCreating.value = false
show.value = false show.value = false
router.push({ name: 'Lead', params: { leadId: data.name } }) router.push({ name: 'Lead', params: { leadId: data.name } })

View File

@ -125,7 +125,7 @@ async function updateNote() {
}, },
}) })
if (d.name) { if (d.name) {
capture('note_created', { note: d.name }) capture('note_created')
notes.value?.reload() notes.value?.reload()
emit('after', d, true) emit('after', d, true)
} }

View File

@ -67,6 +67,7 @@ import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
import TerritoryIcon from '@/components/Icons/TerritoryIcon.vue' import TerritoryIcon from '@/components/Icons/TerritoryIcon.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { formatNumberIntoCurrency } from '@/utils' import { formatNumberIntoCurrency } from '@/utils'
import { capture } from '@/telemetry'
import { call, FeatherIcon, createResource } from 'frappe-ui' import { call, FeatherIcon, createResource } from 'frappe-ui'
import { ref, nextTick, watch, computed, h } from 'vue' import { ref, nextTick, watch, computed, h } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@ -157,7 +158,10 @@ async function callInsertDoc() {
}, },
}) })
loading.value = false loading.value = false
doc.name && handleOrganizationUpdate(doc) if (doc.name) {
capture('organization_created')
handleOrganizationUpdate(doc)
}
} }
function handleOrganizationUpdate(doc, renamed = false) { function handleOrganizationUpdate(doc, renamed = false) {

View File

@ -200,7 +200,7 @@ async function updateTask() {
}, },
}) })
if (d.name) { if (d.name) {
capture('task_created', { task: d.name }) capture('task_created')
tasks.value.reload() tasks.value.reload()
} }
} }

View File

@ -588,7 +588,7 @@ async function convertToDeal(updated) {
}, },
) )
if (deal) { if (deal) {
capture('convert_lead_to_deal', { lead: lead.data.name, deal }) capture('convert_lead_to_deal')
if (updated) { if (updated) {
await organizations.reload() await organizations.reload()
await contacts.reload() await contacts.reload()