Merge branch 'master' of github.com:Budibase/budibase into labday/sqs

This commit is contained in:
mike12345567 2024-04-08 13:18:22 +01:00
commit fbcc4b83a1
6 changed files with 17 additions and 16 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.22.17", "version": "2.22.18",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*", "packages/*",

@ -1 +1 @@
Subproject commit 532c4db35cecd346b5c24f0b89ab7b397a122a36 Subproject commit a0ee9cad8cefb8f9f40228705711be174f018fa9

View File

@ -72,7 +72,7 @@
"fast-json-patch": "^3.1.1", "fast-json-patch": "^3.1.1",
"json-format-highlight": "^1.0.4", "json-format-highlight": "^1.0.4",
"lodash": "4.17.21", "lodash": "4.17.21",
"posthog-js": "^1.116.6", "posthog-js": "^1.118.0",
"remixicon": "2.5.0", "remixicon": "2.5.0",
"sanitize-html": "^2.7.0", "sanitize-html": "^2.7.0",
"shortid": "2.2.15", "shortid": "2.2.15",

View File

@ -38,6 +38,10 @@ class AnalyticsHub {
intercom.show(user) intercom.show(user)
} }
initPosthog() {
posthog.init()
}
async logout() { async logout() {
posthog.logout() posthog.logout()
intercom.logout() intercom.logout()

View File

@ -33,13 +33,10 @@
import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js" import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { onMount } from "svelte" import { onMount } from "svelte"
import PosthogClient from "../../analytics/PosthogClient"
export let application export let application
export let loaded export let loaded
const posthog = new PosthogClient(process.env.POSTHOG_TOKEN)
let unpublishModal let unpublishModal
let updateAppModal let updateAppModal
let revertModal let revertModal
@ -156,7 +153,7 @@
} }
onMount(() => { onMount(() => {
posthog.init() analytics.initPosthog()
}) })
</script> </script>

View File

@ -5,29 +5,29 @@
import Provider from "./context/Provider.svelte" import Provider from "./context/Provider.svelte"
import { onMount, getContext } from "svelte" import { onMount, getContext } from "svelte"
import { enrichButtonActions } from "../utils/buttonActions.js" import { enrichButtonActions } from "../utils/buttonActions.js"
import { memo } from "@budibase/frontend-core"
export let params = {} export let params = {}
const context = getContext("context") const context = getContext("context")
const onLoadActions = memo()
// Get the screen definition for the current route // Get the screen definition for the current route
$: screenDefinition = $screenStore.activeScreen?.props $: screenDefinition = $screenStore.activeScreen?.props
$: onLoadActions.set($screenStore.activeScreen?.onLoad)
$: runOnLoadActions(params) $: runOnLoadActions($onLoadActions, params)
// Enrich and execute any on load actions. // Enrich and execute any on load actions.
// We manually construct the full context here as this component is the // We manually construct the full context here as this component is the
// one that provides the url context, so it is not available in $context yet // one that provides the url context, so it is not available in $context yet
const runOnLoadActions = params => { const runOnLoadActions = (actions, params) => {
const screenState = get(screenStore) if (actions?.length && !get(builderStore).inBuilder) {
const enrichedActions = enrichButtonActions(actions, {
if (screenState.activeScreen?.onLoad && !get(builderStore).inBuilder) {
const actions = enrichButtonActions(screenState.activeScreen.onLoad, {
...get(context), ...get(context),
url: params, url: params,
}) })
if (actions != null) { if (enrichedActions != null) {
actions() enrichedActions()
} }
} }
} }