Merge branch 'master' of github.com:budibase/budibase into budi-7659-sqs-investigate-handle-more-complex-types
This commit is contained in:
commit
4c24a43465
|
@ -92,7 +92,6 @@ jobs:
|
|||
test-libraries:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DEBUG: testcontainers,testcontainers:exec,testcontainers:build,testcontainers:pull
|
||||
REUSE_CONTAINERS: true
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
|
@ -151,7 +150,6 @@ jobs:
|
|||
test-server:
|
||||
runs-on: budi-tubby-tornado-quad-core-150gb
|
||||
env:
|
||||
DEBUG: testcontainers,testcontainers:exec,testcontainers:build,testcontainers:pull
|
||||
REUSE_CONTAINERS: true
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.22.18",
|
||||
"version": "2.22.19",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*",
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"dev:all": "yarn run kill-all && lerna run --stream dev",
|
||||
"dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built",
|
||||
"dev:docker": "yarn build --scope @budibase/server --scope @budibase/worker && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0",
|
||||
"test": "lerna run --stream test --stream",
|
||||
"test": "REUSE_CONTAINERS=1 lerna run --concurrency 1 --stream test --stream",
|
||||
"lint:eslint": "eslint packages --max-warnings=0",
|
||||
"lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\"",
|
||||
"lint": "yarn run lint:eslint && yarn run lint:prettier",
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
export default class IntercomClient {
|
||||
constructor(token) {
|
||||
this.token = token
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* Instantiate intercom using their provided script.
|
||||
*/
|
||||
init() {
|
||||
if (!this.token) return
|
||||
|
||||
const token = this.token
|
||||
|
||||
var w = window
|
||||
var ic = w.Intercom
|
||||
if (typeof ic === "function") {
|
||||
ic("reattach_activator")
|
||||
ic("update", w.intercomSettings)
|
||||
} else {
|
||||
var d = document
|
||||
var i = function () {
|
||||
i.c(arguments)
|
||||
}
|
||||
i.q = []
|
||||
i.c = function (args) {
|
||||
i.q.push(args)
|
||||
}
|
||||
w.Intercom = i
|
||||
var l = function () {
|
||||
var s = d.createElement("script")
|
||||
s.type = "text/javascript"
|
||||
s.async = true
|
||||
s.src = "https://widget.intercom.io/widget/" + token
|
||||
var x = d.getElementsByTagName("script")[0]
|
||||
x.parentNode.insertBefore(s, x)
|
||||
}
|
||||
if (document.readyState === "complete") {
|
||||
l()
|
||||
} else if (w.attachEvent) {
|
||||
w.attachEvent("onload", l)
|
||||
} else {
|
||||
w.addEventListener("load", l, false)
|
||||
}
|
||||
|
||||
this.initialised = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the intercom chat bubble.
|
||||
* @param {Object} user - user to identify
|
||||
* @returns Intercom global object
|
||||
*/
|
||||
show(user = {}, enabled) {
|
||||
if (!this.initialised || !enabled) return
|
||||
|
||||
return window.Intercom("boot", {
|
||||
app_id: this.token,
|
||||
...user,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Update intercom user details and messages.
|
||||
* @returns Intercom global object
|
||||
*/
|
||||
update() {
|
||||
if (!this.initialised) return
|
||||
|
||||
return window.Intercom("update")
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture analytics events and send them to intercom.
|
||||
* @param {String} event - event identifier
|
||||
* @param {Object} props - properties for the event
|
||||
* @returns Intercom global object
|
||||
*/
|
||||
captureEvent(event, props = {}) {
|
||||
if (!this.initialised) return
|
||||
|
||||
return window.Intercom("trackEvent", event, props)
|
||||
}
|
||||
|
||||
/**
|
||||
* Disassociate the user from the current session.
|
||||
* @returns Intercom global object
|
||||
*/
|
||||
logout() {
|
||||
if (!this.initialised) return
|
||||
|
||||
return window.Intercom("shutdown")
|
||||
}
|
||||
}
|
|
@ -1,14 +1,12 @@
|
|||
import { API } from "api"
|
||||
import PosthogClient from "./PosthogClient"
|
||||
import IntercomClient from "./IntercomClient"
|
||||
import { Events, EventSource } from "./constants"
|
||||
|
||||
const posthog = new PosthogClient(process.env.POSTHOG_TOKEN)
|
||||
const intercom = new IntercomClient(process.env.INTERCOM_TOKEN)
|
||||
|
||||
class AnalyticsHub {
|
||||
constructor() {
|
||||
this.clients = [posthog, intercom]
|
||||
this.clients = [posthog]
|
||||
this.initialised = false
|
||||
}
|
||||
|
||||
|
@ -31,20 +29,10 @@ class AnalyticsHub {
|
|||
|
||||
captureEvent(eventName, props = {}) {
|
||||
posthog.captureEvent(eventName, props)
|
||||
intercom.captureEvent(eventName, props)
|
||||
}
|
||||
|
||||
showChat(user) {
|
||||
intercom.show(user)
|
||||
}
|
||||
|
||||
initPosthog() {
|
||||
posthog.init()
|
||||
}
|
||||
|
||||
async logout() {
|
||||
posthog.logout()
|
||||
intercom.logout()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
import TourWrap from "components/portal/onboarding/TourWrap.svelte"
|
||||
import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js"
|
||||
import { goto } from "@roxi/routify"
|
||||
import { onMount } from "svelte"
|
||||
|
||||
export let application
|
||||
export let loaded
|
||||
|
@ -151,10 +150,6 @@
|
|||
notifications.error("Error refreshing app")
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
analytics.initPosthog()
|
||||
})
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
|
|
|
@ -2,7 +2,6 @@ import { derived, writable, get } from "svelte/store"
|
|||
import { API } from "api"
|
||||
import { admin } from "stores/portal"
|
||||
import analytics from "analytics"
|
||||
import { sdk } from "@budibase/shared-core"
|
||||
|
||||
export function createAuthStore() {
|
||||
const auth = writable({
|
||||
|
@ -42,20 +41,6 @@ export function createAuthStore() {
|
|||
.activate()
|
||||
.then(() => {
|
||||
analytics.identify(user._id)
|
||||
analytics.showChat(
|
||||
{
|
||||
email: user.email,
|
||||
created_at: (user.createdAt || Date.now()) / 1000,
|
||||
name: user.account?.name,
|
||||
user_id: user._id,
|
||||
tenant: user.tenantId,
|
||||
admin: sdk.users.isAdmin(user),
|
||||
builder: sdk.users.isBuilder(user),
|
||||
"Company size": user.account?.size,
|
||||
"Job role": user.account?.profession,
|
||||
},
|
||||
!!user?.account
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
||||
// This request may fail due to browser extensions blocking requests
|
||||
|
|
|
@ -77,9 +77,6 @@ export default defineConfig(({ mode }) => {
|
|||
isProduction ? "production" : "development"
|
||||
),
|
||||
"process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN),
|
||||
"process.env.INTERCOM_TOKEN": JSON.stringify(
|
||||
process.env.INTERCOM_TOKEN
|
||||
),
|
||||
}),
|
||||
copyFonts("fonts"),
|
||||
...(isProduction ? [] : devOnlyPlugins),
|
||||
|
|
Loading…
Reference in New Issue