changed events to constants, instantiated analytics client at right time
This commit is contained in:
parent
184061a56b
commit
0a7512a4d9
|
@ -48,7 +48,19 @@ jobs:
|
|||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
|
||||
- name: Build/release Docker images
|
||||
run: |
|
||||
if: ${{ github.event.inputs.release_self_host != 'Y' }}
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
yarn build
|
||||
yarn build:docker
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
||||
BUDIBASE_RELEASE_VERSION: ${{ steps.previoustag.outputs.tag }}
|
||||
|
||||
- name: Build/release Docker images (Self Host)
|
||||
if: ${{ github.event.inputs.release_self_host == 'Y' }}
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
yarn build
|
||||
yarn build:docker
|
||||
|
|
|
@ -73,7 +73,7 @@ exports.ObjectStore = bucket => {
|
|||
AWS.config.update({
|
||||
accessKeyId: env.MINIO_ACCESS_KEY,
|
||||
secretAccessKey: env.MINIO_SECRET_KEY,
|
||||
region: env.AWS_REGION
|
||||
region: env.AWS_REGION,
|
||||
})
|
||||
const config = {
|
||||
s3ForcePathStyle: true,
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
<script>
|
||||
import { onMount } from "svelte"
|
||||
import { Router } from "@roxi/routify"
|
||||
import { routes } from "../.routify/routes"
|
||||
import { initialise } from "builderStore"
|
||||
import { NotificationDisplay } from "@budibase/bbui"
|
||||
import { parse, stringify } from "qs"
|
||||
import HelpIcon from "components/common/HelpIcon.svelte"
|
||||
|
||||
onMount(async () => {
|
||||
await initialise()
|
||||
})
|
||||
|
||||
const queryHandler = { parse, stringify }
|
||||
</script>
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ export default class IntercomClient {
|
|||
|
||||
return window.Intercom("boot", {
|
||||
app_id: this.token,
|
||||
...user
|
||||
...user,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,12 @@ export default class IntercomClient {
|
|||
captureEvent(event, props = {}) {
|
||||
if (!this.initialised) return
|
||||
|
||||
window.Intercom("trackEvent", event, props);
|
||||
window.Intercom("trackEvent", event, props)
|
||||
}
|
||||
|
||||
logout() {
|
||||
if (!this.initialised) return
|
||||
|
||||
window.Intercom("shutdown")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
import posthog from "posthog-js"
|
||||
import { Events } from "./constants"
|
||||
|
||||
// let analyticsEnabled
|
||||
// const posthogConfigured = process.env.POSTHOG_TOKEN && process.env.POSTHOG_URL
|
||||
|
||||
// const FEEDBACK_SUBMITTED_KEY = "budibase:feedback_submitted"
|
||||
// const APP_FIRST_STARTED_KEY = "budibase:first_run"
|
||||
// const feedbackHours = 12
|
||||
|
||||
export default class PosthogClient {
|
||||
constructor(token, url) {
|
||||
this.token = token
|
||||
|
@ -27,18 +20,6 @@ export default class PosthogClient {
|
|||
this.initialised = true
|
||||
}
|
||||
|
||||
disabled() {
|
||||
return posthog.has_opted_out_capturing()
|
||||
}
|
||||
|
||||
optIn() {
|
||||
return posthog.opt_in_capturing()
|
||||
}
|
||||
|
||||
optOut() {
|
||||
return posthog.opt_out_capturing()
|
||||
}
|
||||
|
||||
identify(id) {
|
||||
if (!this.initialised) return
|
||||
|
||||
|
@ -76,69 +57,10 @@ export default class PosthogClient {
|
|||
|
||||
posthog.capture(Events.NPS.SUBMITTED, prefixedFeedback)
|
||||
}
|
||||
|
||||
logout() {
|
||||
if (!this.initialised) return
|
||||
|
||||
posthog.reset()
|
||||
}
|
||||
}
|
||||
|
||||
// function captureEvent(eventName, props = {}) {
|
||||
// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return
|
||||
// props.sourceApp = "builder"
|
||||
// posthog.capture(eventName, props)
|
||||
// }
|
||||
|
||||
// if (!localStorage.getItem(APP_FIRST_STARTED_KEY)) {
|
||||
// localStorage.setItem(APP_FIRST_STARTED_KEY, Date.now())
|
||||
// }
|
||||
|
||||
// function submitFeedback(values) {
|
||||
// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return
|
||||
// localStorage.setItem(FEEDBACK_SUBMITTED_KEY, Date.now())
|
||||
|
||||
// const prefixedValues = Object.entries(values).reduce((obj, [key, value]) => {
|
||||
// obj[`feedback_${key}`] = value
|
||||
// return obj
|
||||
// }, {})
|
||||
|
||||
// posthog.capture("Feedback Submitted", prefixedValues)
|
||||
// }
|
||||
|
||||
// function requestFeedbackOnDeploy() {
|
||||
// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return false
|
||||
// const lastSubmittedStr = localStorage.getItem(FEEDBACK_SUBMITTED_KEY)
|
||||
// if (!lastSubmittedStr) return true
|
||||
// return isFeedbackTimeElapsed(lastSubmittedStr)
|
||||
// }
|
||||
|
||||
// function highlightFeedbackIcon() {
|
||||
// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return false
|
||||
// const lastSubmittedStr = localStorage.getItem(FEEDBACK_SUBMITTED_KEY)
|
||||
// if (lastSubmittedStr) return isFeedbackTimeElapsed(lastSubmittedStr)
|
||||
// const firstRunStr = localStorage.getItem(APP_FIRST_STARTED_KEY)
|
||||
// if (!firstRunStr) return false
|
||||
// return isFeedbackTimeElapsed(firstRunStr)
|
||||
// }
|
||||
|
||||
// Opt In/Out
|
||||
// const ifAnalyticsEnabled = func => () => {
|
||||
// if (analyticsEnabled && process.env.POSTHOG_TOKEN) {
|
||||
// return func()
|
||||
// }
|
||||
// }
|
||||
// const disabled = () => posthog.has_opted_out_capturing()
|
||||
// const optIn = () => posthog.opt_in_capturing()
|
||||
// const optOut = () => posthog.opt_out_capturing()
|
||||
|
||||
// export default {
|
||||
// init,
|
||||
// identify,
|
||||
// captureException,
|
||||
// captureEvent,
|
||||
// submitFeedback,
|
||||
// highlightFeedbackIcon,
|
||||
// disabled: () => {
|
||||
// if (analyticsEnabled == null) {
|
||||
// return true
|
||||
// }
|
||||
// return ifAnalyticsEnabled(disabled)
|
||||
// },
|
||||
// optIn: ifAnalyticsEnabled(optIn),
|
||||
// optOut: ifAnalyticsEnabled(optOut),
|
||||
// }
|
||||
|
|
|
@ -20,20 +20,10 @@ export default class SentryClient {
|
|||
}
|
||||
|
||||
identify(id) {
|
||||
if (!this.initalised) return
|
||||
|
||||
Sentry.configureScope(scope => {
|
||||
scope.setUser({ id })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// export function init() {
|
||||
// if (process.env.SENTRY_DSN) {
|
||||
// Sentry.init({ dsn: process.env.SENTRY_DSN })
|
||||
// }
|
||||
// }
|
||||
|
||||
// export function captureException(err) {
|
||||
// // if (!analyticsEnabled) return
|
||||
// Sentry.captureException(err)
|
||||
// // captureEvent("Error", { error: err.message ? err.message : err })
|
||||
// }
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
export const Events = {
|
||||
BUILDER: {
|
||||
STARTED: "Builder Started"
|
||||
},
|
||||
COMPONENT: {
|
||||
CREATED: "Added Component"
|
||||
},
|
||||
DATASOURCE: {
|
||||
CREATED: "Datasource Created",
|
||||
UPDATED: "Datasource Updated",
|
||||
},
|
||||
TABLE: {
|
||||
CREATED: "Table Created",
|
||||
},
|
||||
VIEW: {
|
||||
CREATED: "View Created",
|
||||
ADDED_FILTER: "Added View Filter",
|
||||
ADDED_CALCULATE: "Added View Calculate"
|
||||
},
|
||||
SCREEN: {
|
||||
CREATED: "Screen Created"
|
||||
},
|
||||
AUTOMATION: {
|
||||
CREATED: "Added Component",
|
||||
SAVED: "Automation Saved",
|
||||
BLOCK_ADDED: "Added Automation Block",
|
||||
},
|
||||
NPS: {
|
||||
SUBMITTED: "budibase:feedback_submitted"
|
||||
},
|
||||
APP: {
|
||||
CREATED: "budibase:app_created",
|
||||
PUBLISHED: "budibase:app_published",
|
||||
UNPUBLISHED: "budibase:app_unpublished"
|
||||
},
|
||||
ANALYTICS: {
|
||||
OPT_IN: "budibase:analytics_opt_in",
|
||||
OPT_OUT: "budibase:analytics_opt_out"
|
||||
},
|
||||
USER: {
|
||||
INVITE: "budibase:portal_user_invite"
|
||||
},
|
||||
SMTP: {
|
||||
SAVED: "budibase:smtp_saved"
|
||||
},
|
||||
SSO: {
|
||||
SAVED: "budibase:sso_saved"
|
||||
}
|
||||
BUILDER: {
|
||||
STARTED: "Builder Started",
|
||||
},
|
||||
COMPONENT: {
|
||||
CREATED: "Added Component",
|
||||
},
|
||||
DATASOURCE: {
|
||||
CREATED: "Datasource Created",
|
||||
UPDATED: "Datasource Updated",
|
||||
},
|
||||
TABLE: {
|
||||
CREATED: "Table Created",
|
||||
},
|
||||
VIEW: {
|
||||
CREATED: "View Created",
|
||||
ADDED_FILTER: "Added View Filter",
|
||||
ADDED_CALCULATE: "Added View Calculate",
|
||||
},
|
||||
SCREEN: {
|
||||
CREATED: "Screen Created",
|
||||
},
|
||||
AUTOMATION: {
|
||||
CREATED: "Automation Created",
|
||||
SAVED: "Automation Saved",
|
||||
BLOCK_ADDED: "Added Automation Block",
|
||||
},
|
||||
NPS: {
|
||||
SUBMITTED: "budibase:feedback_submitted",
|
||||
},
|
||||
APP: {
|
||||
CREATED: "budibase:app_created",
|
||||
PUBLISHED: "budibase:app_published",
|
||||
UNPUBLISHED: "budibase:app_unpublished",
|
||||
},
|
||||
ANALYTICS: {
|
||||
OPT_IN: "budibase:analytics_opt_in",
|
||||
OPT_OUT: "budibase:analytics_opt_out",
|
||||
},
|
||||
USER: {
|
||||
INVITE: "budibase:portal_user_invite",
|
||||
},
|
||||
SMTP: {
|
||||
SAVED: "budibase:smtp_saved",
|
||||
},
|
||||
SSO: {
|
||||
SAVED: "budibase:sso_saved",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,20 +3,15 @@ import PosthogClient from "./PosthogClient"
|
|||
import IntercomClient from "./IntercomClient"
|
||||
import SentryClient from "./SentryClient"
|
||||
import { Events } from "./constants"
|
||||
import { auth } from "stores/portal"
|
||||
import { get } from "svelte/store"
|
||||
|
||||
// const posthog = new PosthogClient(
|
||||
// process.env.POSTHOG_TOKEN,
|
||||
// process.env.POSTHOG_URL
|
||||
// )
|
||||
const posthog = new PosthogClient(
|
||||
"phc_yGOn4i7jWKaCTapdGR6lfA4AvmuEQ2ijn5zAVSFYPlS",
|
||||
"https://app.posthog.com"
|
||||
process.env.POSTHOG_TOKEN,
|
||||
process.env.POSTHOG_URL
|
||||
)
|
||||
// const sentry = new SentryClient(process.env.SENTRY_DSN)
|
||||
const sentry = new SentryClient("https://a34ae347621946bf8acded18e5b7d4b8@o420233.ingest.sentry.io/5338131")
|
||||
// const intercom = new IntercomClient(process.env.INTERCOM_TOKEN)
|
||||
const intercom = new IntercomClient("qz2sxfuv")
|
||||
|
||||
const sentry = new SentryClient(process.env.SENTRY_DSN)
|
||||
const intercom = new IntercomClient(process.env.INTERCOM_TOKEN)
|
||||
|
||||
class AnalyticsHub {
|
||||
constructor() {
|
||||
|
@ -24,24 +19,27 @@ class AnalyticsHub {
|
|||
}
|
||||
|
||||
async activate() {
|
||||
// Setting the analytics env var off in the backend overrides org/tenant settings
|
||||
const analyticsStatus = await api.get("/api/analytics")
|
||||
const json = await analyticsStatus.json()
|
||||
|
||||
if (json.enabled) {
|
||||
this.clients.forEach(client => client.init())
|
||||
// Multitenancy disabled on the backend
|
||||
if (!json.enabled) return
|
||||
|
||||
const tenantId = get(auth).tenantId
|
||||
|
||||
if (tenantId) {
|
||||
const res = await api.get(
|
||||
`/api/global/configs/public?tenantId=${tenantId}`
|
||||
)
|
||||
const orgJson = await res.json()
|
||||
|
||||
// analytics opted out for the tenant
|
||||
if (orgJson.config?.analytics === false) return
|
||||
}
|
||||
|
||||
this.enabled = json.enabled
|
||||
}
|
||||
|
||||
optIn() {
|
||||
this.captureEvent(Events.ANALYTICS.OPT_IN)
|
||||
this.clients.forEach(client => client.optIn())
|
||||
}
|
||||
|
||||
optOut() {
|
||||
this.captureEvent(Events.ANALYTICS.OPT_OUT)
|
||||
this.clients.forEach(client => client.optOut())
|
||||
this.clients.forEach(client => client.init())
|
||||
this.enabled = true
|
||||
}
|
||||
|
||||
identify(id, metadata) {
|
||||
|
@ -68,9 +66,14 @@ class AnalyticsHub {
|
|||
submitFeedback(values) {
|
||||
posthog.npsFeedback(values)
|
||||
}
|
||||
|
||||
async logout() {
|
||||
posthog.logout()
|
||||
intercom.logout()
|
||||
}
|
||||
}
|
||||
|
||||
const analytics = new AnalyticsHub()
|
||||
|
||||
export { Events }
|
||||
export default analytics
|
||||
export default analytics
|
||||
|
|
|
@ -3,7 +3,6 @@ import { getAutomationStore } from "./store/automation"
|
|||
import { getHostingStore } from "./store/hosting"
|
||||
import { getThemeStore } from "./store/theme"
|
||||
import { derived, writable } from "svelte/store"
|
||||
import analytics, { Events } from "analytics"
|
||||
import { FrontendTypes, LAYOUT_NAMES } from "../constants"
|
||||
import { findComponent } from "./storeUtils"
|
||||
|
||||
|
@ -55,13 +54,4 @@ export const mainLayout = derived(store, $store => {
|
|||
|
||||
export const selectedAccessRole = writable("BASIC")
|
||||
|
||||
export const initialise = async () => {
|
||||
try {
|
||||
await analytics.activate()
|
||||
analytics.captureEvent(Events.BUILDER.STARTED)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
export const screenSearchString = writable(null)
|
||||
|
|
|
@ -2,7 +2,7 @@ import { writable } from "svelte/store"
|
|||
import api from "../../api"
|
||||
import Automation from "./Automation"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
const automationActions = store => ({
|
||||
fetch: async () => {
|
||||
|
@ -110,7 +110,7 @@ const automationActions = store => ({
|
|||
state.selectedBlock = newBlock
|
||||
return state
|
||||
})
|
||||
analytics.captureEvent("Added Automation Block", {
|
||||
analytics.captureEvent(Events.AUTOMATION.BLOCK_ADDED, {
|
||||
name: block.name,
|
||||
})
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
import { fetchComponentLibDefinitions } from "../loadComponentLibraries"
|
||||
import api from "../api"
|
||||
import { FrontendTypes } from "constants"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
import {
|
||||
findComponentType,
|
||||
findComponentParent,
|
||||
|
@ -443,7 +443,7 @@ export const getFrontendStore = () => {
|
|||
})
|
||||
|
||||
// Log event
|
||||
analytics.captureEvent("Added Component", {
|
||||
analytics.captureEvent(Events.COMPONENT.CREATED, {
|
||||
name: componentInstance._component,
|
||||
})
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { automationStore } from "builderStore"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Input, ModalContent, Layout, Body, Icon } from "@budibase/bbui"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
let name
|
||||
let selectedTrigger
|
||||
|
@ -36,7 +36,7 @@
|
|||
notifications.success(`Automation ${name} created.`)
|
||||
|
||||
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
|
||||
analytics.captureEvent("Automation Created", { name })
|
||||
analytics.captureEvent(Events.AUTOMATION.CREATED, { name })
|
||||
}
|
||||
$: triggers = Object.entries($automationStore.blockDefinitions.TRIGGER)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { automationStore } from "builderStore"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Icon, Input, ModalContent, Modal } from "@budibase/bbui"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
let name
|
||||
let error = ""
|
||||
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
await automationStore.actions.save(updatedAutomation)
|
||||
notifications.success(`Automation ${name} updated successfully.`)
|
||||
analytics.captureEvent("Automation Saved", { name })
|
||||
analytics.captureEvent(Events.AUTOMATION.SAVED, { name })
|
||||
hide()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { Select, Label, notifications, ModalContent } from "@budibase/bbui"
|
||||
import { tables, views } from "stores/backend"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
import { FIELDS } from "constants/backend"
|
||||
|
||||
const CALCULATIONS = [
|
||||
|
@ -40,7 +40,7 @@
|
|||
function saveView() {
|
||||
views.save(view)
|
||||
notifications.success(`View ${view.name} saved.`)
|
||||
analytics.captureEvent("Added View Calculate", { field: view.field })
|
||||
analytics.captureEvent(Events.VIEW.ADDED_CALCULATE, { field: view.field })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import { goto } from "@roxi/routify"
|
||||
import { views as viewsStore } from "stores/backend"
|
||||
import { tables } from "stores/backend"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
let name
|
||||
let field
|
||||
|
@ -21,7 +21,7 @@
|
|||
field,
|
||||
})
|
||||
notifications.success(`View ${name} created`)
|
||||
analytics.captureEvent("View Created", { name })
|
||||
analytics.captureEvent(Events.VIEW.CREATED, { name })
|
||||
$goto(`../../view/${name}`)
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Icon,
|
||||
} from "@budibase/bbui"
|
||||
import { tables, views } from "stores/backend"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
const CONDITIONS = [
|
||||
{
|
||||
|
@ -65,7 +65,7 @@
|
|||
function saveView() {
|
||||
views.save(view)
|
||||
notifications.success(`View ${view.name} saved.`)
|
||||
analytics.captureEvent("Added View Filter", {
|
||||
analytics.captureEvent(Events.VIEW.ADDED_FILTER, {
|
||||
filters: JSON.stringify(view.filters),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import { Input, Label, ModalContent, Modal, Context } from "@budibase/bbui"
|
||||
import TableIntegrationMenu from "../TableIntegrationMenu/index.svelte"
|
||||
import CreateTableModal from "components/backend/TableNavigator/modals/CreateTableModal.svelte"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
import { getContext } from "svelte"
|
||||
|
||||
const modalContext = getContext(Context.Modal)
|
||||
|
@ -45,7 +45,7 @@
|
|||
plus,
|
||||
})
|
||||
notifications.success(`Datasource ${name} created successfully.`)
|
||||
analytics.captureEvent("Datasource Created", { name, type })
|
||||
analytics.captureEvent(Events.DATASOURCE.CREATED, { name, type })
|
||||
|
||||
// Navigate to new datasource
|
||||
$goto(`./datasource/${response._id}`)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { datasources } from "stores/backend"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Input, ModalContent, Modal } from "@budibase/bbui"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
let error = ""
|
||||
let modal
|
||||
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
await datasources.save(updatedDatasource)
|
||||
notifications.success(`Datasource ${name} updated successfully.`)
|
||||
analytics.captureEvent("Datasource Updated", updatedDatasource)
|
||||
analytics.captureEvent(Events.DATASOURCE.UPDATED, updatedDatasource)
|
||||
hide()
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Layout,
|
||||
} from "@budibase/bbui"
|
||||
import TableDataImport from "../TableDataImport.svelte"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
import screenTemplates from "builderStore/store/screenTemplates"
|
||||
import { buildAutoColumn, getAutoColumnInformation } from "builderStore/utils"
|
||||
import { NEW_ROW_TEMPLATE } from "builderStore/store/screenTemplates/newRowScreen"
|
||||
|
@ -67,7 +67,7 @@
|
|||
// Create table
|
||||
const table = await tables.save(newTable)
|
||||
notifications.success(`Table ${name} created successfully.`)
|
||||
analytics.captureEvent("Table Created", { name })
|
||||
analytics.captureEvent(Events.TABLE.CREATED, { name })
|
||||
|
||||
// Create auto screens
|
||||
if (createAutoscreens) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
throw new Error(`status ${response.status}`)
|
||||
} else {
|
||||
analytics.captureEvent(Events.APP.PUBLISHED, {
|
||||
appId: $store.appId
|
||||
appId: $store.appId,
|
||||
})
|
||||
notifications.success(`Application published successfully`)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { roles } from "stores/backend"
|
||||
import { Input, Select, ModalContent, Toggle } from "@budibase/bbui"
|
||||
import getTemplates from "builderStore/store/screenTemplates"
|
||||
import analytics from "analytics"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
const CONTAINER = "@budibase/standard-components/container"
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
if (templateIndex !== undefined) {
|
||||
const template = templates[templateIndex]
|
||||
analytics.captureEvent("Screen Created", {
|
||||
analytics.captureEvent(Events.SCREEN.CREATED, {
|
||||
template: template.id || template.name,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
import OIDCButton from "./_components/OIDCButton.svelte"
|
||||
import Logo from "assets/bb-emblem.svg"
|
||||
import { onMount } from "svelte"
|
||||
import analytics from "analytics"
|
||||
|
||||
let username = ""
|
||||
let password = ""
|
||||
|
@ -26,20 +25,11 @@
|
|||
|
||||
async function login() {
|
||||
try {
|
||||
const { user } = await auth.login({
|
||||
await auth.login({
|
||||
username,
|
||||
password,
|
||||
})
|
||||
|
||||
analytics.identify(user._id, user)
|
||||
analytics.showChat({
|
||||
email: user.email,
|
||||
created_at: Date.now(),
|
||||
name: user.name,
|
||||
user_id: user._id,
|
||||
tenant: user.tenantId
|
||||
})
|
||||
|
||||
if ($auth?.user?.forceResetPassword) {
|
||||
$goto("./reset")
|
||||
} else {
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
} from "@budibase/bbui"
|
||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||
import UpdateAppModal from "components/start/UpdateAppModal.svelte"
|
||||
import api, { del } from "builderStore/api"
|
||||
import analytics from "analytics"
|
||||
import { del } from "builderStore/api"
|
||||
import { onMount } from "svelte"
|
||||
import { apps, auth, admin } from "stores/portal"
|
||||
import download from "downloadjs"
|
||||
|
@ -66,14 +65,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
const checkKeys = async () => {
|
||||
const response = await api.get(`/api/keys/`)
|
||||
const keys = await response.json()
|
||||
// if (keys.userId) {
|
||||
// analytics.identify(keys.userId)
|
||||
// }
|
||||
}
|
||||
|
||||
const initiateAppCreation = () => {
|
||||
creationModal.show()
|
||||
creatingApp = true
|
||||
|
@ -188,7 +179,6 @@
|
|||
}
|
||||
|
||||
onMount(async () => {
|
||||
checkKeys()
|
||||
await apps.load()
|
||||
loaded = true
|
||||
})
|
||||
|
|
|
@ -48,13 +48,6 @@
|
|||
async function saveConfig() {
|
||||
loading = true
|
||||
|
||||
// Set analytics preference
|
||||
if ($values.analytics) {
|
||||
analytics.optIn()
|
||||
} else {
|
||||
analytics.optOut()
|
||||
}
|
||||
|
||||
// Upload logo if required
|
||||
if ($values.logo && !$values.logo.url) {
|
||||
await uploadLogo($values.logo)
|
||||
|
@ -64,6 +57,7 @@
|
|||
const config = {
|
||||
company: $values.company ?? "",
|
||||
platformUrl: $values.platformUrl ?? "",
|
||||
analytics: $values.analytics,
|
||||
}
|
||||
// remove logo if required
|
||||
if (!$values.logo) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { derived, writable, get } from "svelte/store"
|
||||
import api from "../../builderStore/api"
|
||||
import { admin } from "stores/portal"
|
||||
import analytics from "analytics"
|
||||
|
||||
export function createAuthStore() {
|
||||
const auth = writable({
|
||||
|
@ -49,6 +50,19 @@ export function createAuthStore() {
|
|||
}
|
||||
return store
|
||||
})
|
||||
|
||||
if (user) {
|
||||
analytics.activate().then(() => {
|
||||
analytics.identify(user._id, user)
|
||||
// TODO: check if the user is a certain org size
|
||||
// analytics.showChat({
|
||||
// email: user.email,
|
||||
// name: user.name,
|
||||
// user_id: user._id,
|
||||
// tenant: user.tenantId
|
||||
// })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function setOrganisation(tenantId) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "0.9.125-alpha.18",
|
||||
"version": "0.9.136",
|
||||
"description": "Budibase Web Server",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
|
@ -13,7 +13,7 @@
|
|||
"postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/",
|
||||
"test": "jest --coverage --maxWorkers=2",
|
||||
"test:watch": "jest --watch",
|
||||
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client",
|
||||
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../standard-components/manifest.json client",
|
||||
"build:docker": "yarn run predocker && docker build . -t app-service",
|
||||
"run:docker": "node dist/index.js",
|
||||
"dev:stack:up": "node scripts/dev/manage.js up",
|
||||
|
@ -23,10 +23,9 @@
|
|||
"format": "prettier --config ../../.prettierrc.json 'src/**/*.ts' --write",
|
||||
"lint": "eslint --fix src/",
|
||||
"lint:fix": "yarn run format && yarn run lint",
|
||||
"initialise": "node scripts/initialise.js",
|
||||
"multi:enable": "node scripts/multiTenancy.js enable",
|
||||
"multi:disable": "node scripts/multiTenancy.js disable",
|
||||
"selfhost:enable": "node scripts/selfhost.js enable",
|
||||
"selfhost:disable": "node scripts/selfhost.js disable"
|
||||
"multi:disable": "node scripts/multiTenancy.js disable"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
|
@ -49,8 +48,7 @@
|
|||
"!src/automations/tests/**/*",
|
||||
"!src/utilities/fileProcessor.js",
|
||||
"!src/utilities/fileSystem/**/*",
|
||||
"!src/utilities/redis.js",
|
||||
"!src/api/controllers/row/internalSearch.js"
|
||||
"!src/utilities/redis.js"
|
||||
],
|
||||
"coverageReporters": [
|
||||
"lcov",
|
||||
|
@ -64,9 +62,9 @@
|
|||
"author": "Budibase",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@budibase/auth": "^0.9.125-alpha.18",
|
||||
"@budibase/client": "^0.9.125-alpha.18",
|
||||
"@budibase/string-templates": "^0.9.125-alpha.18",
|
||||
"@budibase/auth": "^0.9.136",
|
||||
"@budibase/client": "^0.9.136",
|
||||
"@budibase/string-templates": "^0.9.136",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
"@koa/router": "8.0.0",
|
||||
"@sendgrid/mail": "7.1.1",
|
||||
|
@ -98,7 +96,7 @@
|
|||
"lodash": "4.17.21",
|
||||
"mongodb": "3.6.3",
|
||||
"mssql": "6.2.3",
|
||||
"mysql": "^2.18.1",
|
||||
"mysql": "2.18.1",
|
||||
"node-fetch": "2.6.0",
|
||||
"open": "7.3.0",
|
||||
"pg": "8.5.1",
|
||||
|
@ -112,12 +110,14 @@
|
|||
"to-json-schema": "0.2.5",
|
||||
"uuid": "3.3.2",
|
||||
"validate.js": "0.13.1",
|
||||
"worker-farm": "1.7.0",
|
||||
"yargs": "13.2.4",
|
||||
"zlib": "1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/preset-env": "^7.14.4",
|
||||
"@budibase/standard-components": "^0.9.136",
|
||||
"@jest/test-sequencer": "^24.8.0",
|
||||
"@types/bull": "^3.15.1",
|
||||
"@types/jest": "^26.0.23",
|
||||
|
|
Loading…
Reference in New Issue