Skip to content

Commit

Permalink
chore: Send hubspot token to register endpoints (#4883)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Dec 6, 2024
1 parent 563010d commit fa84cda
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
52 changes: 33 additions & 19 deletions frontend/common/stores/account-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const controller = {
API.setInvite('')
API.setInviteType('')
return data
.post(`${Project.api}users/join/link/${id}/`)
.post(`${Project.api}users/join/link/${id}/`, {
hubspotutk: API.getCookie('hubspotutk'),
})
.catch((error) => {
if (
Utils.getFlagsmithHasFeature('verify_seats_limit_for_invite_links') &&
Expand All @@ -25,7 +27,9 @@ const controller = {
API.ajaxHandler(store, error)
return
}
return data.post(`${Project.api}users/join/${id}/`)
return data.post(`${Project.api}users/join/${id}/`, {
hubspotutk: API.getCookie('hubspotutk'),
})
})
.then((res) => {
store.savedId = res.id
Expand Down Expand Up @@ -87,24 +91,34 @@ const controller = {
API.postEvent(`${name}`)
}

data.post(`${Project.api}organisations/`, { name }).then((res) => {
store.model.organisations = store.model.organisations.concat([
{ ...res, role: 'ADMIN' },
])
AsyncStorage.setItem('user', JSON.stringify(store.model))
store.savedId = res.id
store.saved()
data
.post(`${Project.api}organisations/`, {
hubspotutk: API.getCookie('hubspotutk'),
name,
})
.then((res) => {
store.model.organisations = store.model.organisations.concat([
{ ...res, role: 'ADMIN' },
])
AsyncStorage.setItem('user', JSON.stringify(store.model))
store.savedId = res.id
store.saved()

const relayEventKey = Utils.getFlagsmithValue('relay_events_key')
const sendRelayEvent =
Utils.getFlagsmithHasFeature('relay_events_key') && !!relayEventKey
window.lintrk?.('track', { conversion_id: 16798338 })
if (sendRelayEvent) {
dataRelay.sendEvent(AccountStore.getUser(), {
apiKey: relayEventKey,
})
}
})
const relayEventKey = Utils.getFlagsmithValue('relay_events_key')
const sendRelayEvent =
Utils.getFlagsmithHasFeature('relay_events_key') && !!relayEventKey

if (Project.linkedinConversionId) {
window.lintrk?.('track', {
conversion_id: Project.linkedinConversionId,
})
}
if (sendRelayEvent) {
dataRelay.sendEvent(AccountStore.getUser(), {
apiKey: relayEventKey,
})
}
})
},
deleteOrganisation: () => {
API.trackEvent(Constants.events.DELETE_ORGANISATION)
Expand Down
1 change: 1 addition & 0 deletions frontend/env/project_prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = global.Project = {
hubspot: '//js-eu1.hs-scripts.com/143451822.js',
// This is used for Sentry tracking
maintenance: false,
linkedinConversionId: 16798338,
plans: {
scaleUp: { annual: 'scale-up-12-months-v2', monthly: 'scale-up-v2' },
startup: { annual: 'start-up-12-months-v2', monthly: 'startup-v2' },
Expand Down

0 comments on commit fa84cda

Please sign in to comment.