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 = ''
reload.value = true
emit('scroll')
capture('email_sent', { doctype: props.doctype, name: doc.value.data.name })
capture('email_sent', { doctype: props.doctype })
}
async function submitComment() {
@ -230,7 +230,7 @@ async function submitComment() {
newComment.value = ''
reload.value = true
emit('scroll')
capture('comment_sent', { doctype: props.doctype, name: doc.value.data.name })
capture('comment_sent', { doctype: props.doctype })
}
function toggleEmailBox() {

View File

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

View File

@ -92,6 +92,7 @@ import CertificateIcon from '@/components/Icons/CertificateIcon.vue'
import EditIcon from '@/components/Icons/EditIcon.vue'
import Dropdown from '@/components/frappe-ui/Dropdown.vue'
import { usersStore } from '@/stores/users'
import { capture } from '@/telemetry'
import { call, createResource } from 'frappe-ui'
import { ref, nextTick, watch, computed } from 'vue'
import { createToast } from '@/utils'
@ -160,7 +161,10 @@ async function callInsertDoc() {
..._contact.value,
},
})
doc.name && handleContactUpdate(doc)
if (doc.name) {
capture('contact_created')
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 { usersStore } from '@/stores/users'
import { statusesStore } from '@/stores/statuses'
import { capture } from '@/telemetry'
import { Switch, createResource } from 'frappe-ui'
import { computed, ref, reactive, onMounted, nextTick } from 'vue'
import { useRouter } from 'vue-router'
@ -201,6 +202,7 @@ function createDeal() {
isDealCreating.value = true
},
onSuccess(name) {
capture('deal_created')
isDealCreating.value = false
show.value = false
router.push({ name: 'Deal', params: { dealId: name } })

View File

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

View File

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

View File

@ -125,7 +125,7 @@ async function updateNote() {
},
})
if (d.name) {
capture('note_created', { note: d.name })
capture('note_created')
notes.value?.reload()
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 { usersStore } from '@/stores/users'
import { formatNumberIntoCurrency } from '@/utils'
import { capture } from '@/telemetry'
import { call, FeatherIcon, createResource } from 'frappe-ui'
import { ref, nextTick, watch, computed, h } from 'vue'
import { useRouter } from 'vue-router'
@ -157,7 +158,10 @@ async function callInsertDoc() {
},
})
loading.value = false
doc.name && handleOrganizationUpdate(doc)
if (doc.name) {
capture('organization_created')
handleOrganizationUpdate(doc)
}
}
function handleOrganizationUpdate(doc, renamed = false) {

View File

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

View File

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