0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 00:47:50 +01:00
Commit Graph

28 Commits

Author SHA1 Message Date
Michael Matloka
eb55c47bd1
feat(navigation): Search in environments switcher (#25374) 2024-10-07 18:09:36 +02:00
Marius Andra
b2fd4b164f
feat(hog): use Hog in the frontend (#24670) 2024-08-30 10:55:40 +02:00
Michael Matloka
05d8ec843d
refactor: Simplify breadcrumb keys (#19370)
* Rework breadcrumb keys with IDs to include scene

* Use the breadcrumb key in data-attr

* Remove `globalKey`

* Fix selectors

* Use joined breadcrumb key for fragment and `data-attr`

* Fix missing `sceneBreadcrumbs` keys
2024-01-04 20:43:58 +01:00
Michael Matloka
a2763eba4e
chore(frontend): Enable isolated modules and incremental compilation (#19168)
* Enable isolated modules and incremental compilation

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Fix typo

Co-authored-by: Paul D'Ambra <paul@posthog.com>

* Restore `include`/`exclude`

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Paul D'Ambra <paul@posthog.com>
2023-12-08 11:52:00 +00:00
Paul D'Ambra
16323959fd
feat: add ee licensed replay transformer (#18874)
first pass through using the EE licensed replay transformer in playback

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Newell <d.newell1@outlook.com>
2023-11-29 10:41:18 +00:00
Ben White
4ad3928c74
feat: Added ability to import code from ee folder (#18841)
We want to experiment with some conditional licensing of frontend code via the ee folder.

---------

Co-authored-by: Paul D'Ambra <paul@posthog.com>
2023-11-23 16:40:46 +00:00
Michael Matloka
69becac200
chore(frontend): Sort imports (#18663)
* chore(frontend): Sort imports

* Fix Storybook build problem

* Try a different fix

* Fix another circular import

* Fix more circular imports

* Fix logic connection

* Ignore `cypress` in TS

* Don't check import order in logic types

* Fix another `connect()`

* Don't sort imports in Notebooks nodes code

* Fix another connection

* Increase specificity of .LemonButton against .Link

* Fix styling issues

* Update UI snapshots for `chromium` (2)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-22 15:07:34 +01:00
Michael Matloka
5c783c744c
chore: Add debug info to JSX output (#12295)
* chore: Add debug info to JSX output

* Pin React to `^16.14.0` instead of `^16.13.0`

* Remove redundant `React`s

* Add `@babel/preset-react` for Storybook

* Update babel.config.js
2022-10-17 19:30:31 +02:00
Marius Andra
2069c4cd8b
feat(frontend): build @posthog/lemon-ui and @posthog/apps-common (#10120)
* fix dayjs

* fix timeouts (we're not strictly speaking running in nodejs)

* export unexported type

* consolidate on a single FormInstance

* no need to rename

* fuse

* forminstance 2

* locationChanged

* BuiltLogic

* remove Type.ts exception

* fix duh

* playing with common apps

* playing with common apps

* fix some scss deprecations 🤷

* revert

* move packages/apps-common

* remove compiled json file

* build apps-common before other packages

* mkdirp, build types before running

* build types before the rest

* move imports json to packages folder

* mark some packages as external, saving 200kb

* revert nonsense

* remove ant dep

* make app source editor types optional for speed

* move dev server reloads to utils.mjs

* remove webpack start scripts (unused)

* refactor build/utils to support various dirs

* apps package

* revert some stuff

* yarn

* go back to the old location and commit packages.json in

* commit it in

* out of scope

* fix bad imports

* fix some postcss mess

* move to @posthog/apps-common

* add more stuff to apps

* include that in packages.json

* simple cjs build

* export everything

* simplify

* make separate package for lemonade

* more lemonade

* fix jest imports

* fix jest imports

* yarn as well

* src

* write types before building

* rename lemon-ui, part 1

* add readmes

* rename to lemon-ui, part 2

* this app source editor tsd is committed into the repo, so we don't need it before a build
2022-06-10 17:03:06 +02:00
Marius Andra
a072c21984
chore(frontend): code javascript like it's 2019 (#9937) 2022-05-24 11:14:11 +00:00
Marius Andra
f04dcf1cfc
chore(typescript): fix a lot of frontend types (#9933)
* upgrade typegen

* fix all un-exported local types for typegen

* fix another bunch of TS errors

* target an even newer version of JS for string.replaceAll

* revert deleted comment

* add String.replaceAll warning
2022-05-24 12:38:18 +02:00
Marius Andra
6bb8a6a570
feat(apps): frontend apps (#9831)
* create plugin source model

* edit source via plugin_source model

* deprecate "source"

* test plugin source updates

* add support for index.ts and index.js

* refactor plugin loading, support plugin sources from db

* fix source code in tests

* remove transpilation code

* reload plugin after saving

* store defaults in the db instead of persisting in form

* remove fields that don't exist

* feat(apps): transpile frontend.tsx

* update timestamp even if no local fields changed

* yarn.lock

* feat(apps): load apps with frontend.tsx in the frontend

* fix import

* reload apps, show if transpiling

* remove unused fields

* commit suggestion

* rename to PluginSourceFile

* rename to PluginSourceFile

* remove dead code

* cleaner types

* PluginSourceFile

* fix nag

* fix types

* one more merge conflict

* transpile when adding frontend

* fix test

* edit app from sidebar

* sneaky edit button

* fix code feedback

* add comments

* make it safer to call

* convert to upsert

* convert to upsert

* comment on the null

* revert plugin server changes

* get source from new model behind the scenes

* simplify

* revert accidental changes

* revert accidental changes

* remove defaults

* sync the old source field

* use the source model in the plugin server

* cache the source from pluginsourcefile

* test that getPluginSource gets data from the database

* safer null check that doesn't override `{}` in the db with `null`

* clarify origins

* use enum

* fix error from migration 0233 ([] is falsy in python!)

* fix merge

* error as null

* use the explicit "source__index_ts" field

* cache transpiled code

* remove unused type

* cleaner query

* remove extra line

* fix test

* improved error handling and run code through prettier

* new packages

* loading state in source editor

* kinder error

* sync plugin state if pluginsLogic, retry loading

* update snapshot after kea-forms update

* remove "updateAppConfig"

* add a query

* add examples to editor

* refactor sidebar

* add more lemons

* simplify app config

* rename action and add todo

* some helpful comments

* create appConfig if enabling a plugin and none was yet provided in django's app context

* re-enable app only if enabled

* fix last bug

* add back onInit and move types around

* show apps section header only if any link in the list

* remove dead code

* fix few errors, only allow editing of source apps

* stringify json

* completely bail out of apps if the flag is off

* Update snapshots

* fix broken link

* Update snapshots

* use new icon for "apps" now that it's not "plugins" any longer

* Update snapshots

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-05-20 18:14:58 +02:00
Marius Andra
c271eb99a5
feat(storybook): cleanup volume 1 (#9033)
* rearrange stories

* fix bug in storybook with mock data

* convert to TS, fix static path deprecation

* wrap all scenes with KeaStory, deprecate getReduxState

* remove old text

* don't complain about postcss

* remove ApiSelector, revert to ".js" main

* preview ".ts"

* fix msw

* move kea story

* fix urls

* add /decide handler

* mount logics that are there on app

* reduce boilerplate

* refactor history list storybook api

* separate data
2022-03-15 17:36:51 +01:00
Karl-Aksel Puulmann
d5d5fcd32b
WIP: Groups FE filtering (#6764)
* Add /api/projects/@current/groups/property_definitions

To load property definitions for groups

* Add routes for fetching group types

* FE: Group analytics feature flag

* FE: Group analytics base types for properties

* FE: Initial implementation of fetching logics

* add group tabs to filter

* make sure group properties populate and refactor things

* prettier

* disable unused vars

* allow indexing objects by number

* mount group properties logic

Co-authored-by: Li Yi Yu <li@posthog.com>
2021-11-05 10:21:28 -04:00
Yakko Majuri
e4fd5c5774
Plugin server tests CI (#6897)
* remove workflows from plugin server subdir

* wip plugin server ci tests

* prettier

* add ignore paths

* update paths
2021-11-04 15:03:28 -07:00
Marius Andra
b5a02e2ca7
Bundle our frontend via esbuild (#6758)
* esbuild package

* almost get esbuild working

* fix react-virtualized imports

* add splitting

* fix funny import reorder bug

* fix squeakAudio referring to itself

* write index.html file

* fix some bad imports

* update antd paths

* remove raw-loader usage, it didn't work anyway

* refactor and copy public

* build app and toolbar

* get toolbar working, but without styles

* make toolbar and its styles work

* shared dashboards

* clean frontend build before rebuilding

* add watch mode

* reorder tasks

* revert js url

* incremental builds of app with debounced chokidar watching

* common build/watch script

* improve logs

* watch during firrst build

* fix toolbar url

* fix wrongly exported scene

* create sceneProxyLogic to untangle sceneLogic from all bundles

* disconnect sceneLogic and refactor setPageTitle

* live reloading server

* rename utils file

* only wait for /static

* fix encoding

* simplify

* add missing dayjs plugins

* fix pathless logics

* simplify options

* add jsx for webapck

* slight delay to catch changes

* a type is a type

* fix build

* esbuild in start

* funnelLogic path

* include all files with a "." (so .mjs, etc) in /frontend/ to docker

* rename to "utils.mjs", make "build.mjs" executable

* improve erroring

* revert some needless changes

* more reverts

* change some scripts

* remove setuff

* clarify function

* make "--host 0.0.0.0" work

* fix import order issue in webpack

* remove webpack css inlining for toolbar to simplify config

* make toolbar with external styles work in storybook

* move live server injection into django

* fix undefined bug

* simplify setup to work with injection directly in http://localhost:8000 (no proxying needed on :8234)

* add comments

* Fix `fse` usage

I was getting this otherwise:

$ node frontend/build.mjs
file:///Users/twixes/Developer/posthog/frontend/utils.mjs:46
    fse.copySync(srcDir, destDir, { overwrite: true }, function (err) {
        ^

TypeError: fse.copySync is not a function
    at copyPublicFolder (file:///Users/twixes/Developer/posthog/frontend/utils.mjs:46:9)
    at file:///Users/twixes/Developer/posthog/frontend/build.mjs:5:1
    at ModuleJob.run (internal/modules/esm/module_job.js:146:23)
    at async Loader.import (internal/modules/esm/loader.js:165:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

* Mock `process` for VFile used by ReactMarkdown

I was getting this otherwise:

core.js:55 Uncaught ReferenceError: process is not defined
    at new VFile (core.js:55)
    at VFile (core.js:49)
    at Function.parse (index.js:273)
    at ReactMarkdown2 (react-markdown.js:42)
    at renderWithHooks (react-dom.development.js:14803)
    at mountIndeterminateComponent (react-dom.development.js:17482)
    at beginWork (react-dom.development.js:18596)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)

* Mock `process.env` for VFile used by ReactMarkdown

I was getting this otherwise:

platform.ts:73 Uncaught TypeError: Cannot read properties of undefined (reading 'ENABLE_VSCODE_BROWSER_CODE_LOADING')
    at platform.ts:73
    at platform.ts:79
    at Function.r._invokeFactory (loader.js:1118)
    at r.complete (loader.js:1128)
    at r._onModuleComplete (loader.js:1754)
    at r._resolve (loader.js:1714)
    at r.defineModule (loader.js:1357)
    at _ (loader.js:1804)
    at numbers.ts:10
    at fake:1

* pass the heavy appScenes to sceneLogic through props via App.tsx

* remove sceneProxyLogic

* remove exported variables

* fix sceneLogic test

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-11-03 09:50:24 +01:00
Alex Gyujin Kim
8121a4d933
Fix and standardize multiple table UI inconsistencies (#4727)
* fix multiple table bugs and standardize table overflows

* support more es2019 functions like Object.fromEntries

* simplify getting active breakout value

* unset maxWidth for resizable cols by default

* fix feature flag key cutoff and empty description bug

* ellipsify feature flag table

* labels or dates or days

* fix bugs; refactor table scroll

* fix double key and increase the width just a bit

Co-authored-by: Marius Andra <marius.andra@gmail.com>
Co-authored-by: Sam Winslow <sammywinslow@gmail.com>
2021-06-24 17:09:41 +02:00
Michael Matloka
598aea06b9
Make Jest tests work better with TypeScript (#2558)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-01-12 17:46:59 -06:00
Marius Andra
3fe093f80b
Fix typescript errors #1 (#2027)
* add TSC check, fix tsconfig.json error

* fix toolbar ts errors

* fix the first 100 errors

* fix key bug

* fix some more types

* fix even more types

* webhook setting logic

* fix more logic types

* fix more logic types

* use billingSubscription from action payload
2020-10-27 09:57:06 +01:00
Marius Andra
034ba7eee0
Fix click outside spam & public paths (#2022)
* improve "public" import paths

* fix `useOutsideClickHandler` firing an event on any click anywhere in the page

Co-authored-by: Michael Matloka <dev@twixes.com>
2020-10-26 12:49:50 +01:00
Karl-Aksel Puulmann
d92e533dd5
Session recording: persistent URLs, session_id, UI changes (#1953)
* Hide $session_id properties

* Exclude $snapshot events from event views

* Add end_time to sessions queries

This might be used by SessionRecording queries

* Add WIP way to return session recording

Note that this mutates existing responses - might not be the best way to
do this.

* Query for feature flags in a consistent way in frontend

* Improve documentation on featureFlagLogic

* Update frontend types

* Set up endpoint for querying event data for rrweb

* Sort snapshot data in BE before sending to FE

* Show sessions player in a drawer, load data from API

This makes for a smoother experience (IMO, will iterate). At the very
least, drawers enable us to have differing urls via kea

* Show loader while replay is loading

* Make player full-width

* Remove debug code

* Implement persistent URLs for sessions

This should make it possible to share recordings with team.

The URLs are currently quite long - perhaps we can get rid of
distinct_id long-term within it?

* Use only $session_id for filtering sessions

There's a small risk of collisions, but this cleans code up a lot

* WIP

* Add `array.flatMap` to tsconfig

* Add selectors for prev/next session recording

* Clean up whitespace

* Make next and previous buttons work

* Patch prev/next behavior when not visible in page

* Session recording query testing

* Fix typing errors

* Make Sessions queries work properly

It was previously overwriting things even in queries not returning a
list of sessions

* Blacklist browsers w/o flatMap (PR review)

* Close sessions player on back

* fix back button and small bugs

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2020-10-23 16:53:59 +03:00
Marius Andra
e7a944ea96
Fix tsconfig.json lib property (#1818)
* fix tsconfig lib

* minor ts fix

Co-authored-by: Yakko Majuri <38760734+yakkomajuri@users.noreply.github.com>
2020-10-08 00:43:23 +02:00
Marius Andra
45f10a8eaf
Kea TypeGen 0.2 (#1427)
* kea-typegen 0.2

* remove old Type.ts files

* more setup for typegen-0.2, update yarn scripts, remove webpackbar

* import types from the right paths

* update ENV in build script
2020-08-14 17:02:57 +02:00
Marius Andra
cf98e8ba35
Toolbar Typings (#1306)
* update to kea-typegen that runs through prettier

* remove posthog-js yalc package regression

* add types to toolbar

* add react-dom and react-redux types

* add types to toolbar react components

* convert a lot of components to typescript

* convert more components to typescript

* fix error

* actions return void

* clean up other Type.ts files as well

* fix last untyped files

* upgrade kea, fix webpack config entrypoint

* add stricter typechecking

* add types for a few more files

* fix bug with nth_child selectors (introduced in this PR, now fixed)

* fix one more type
2020-07-30 19:16:59 +02:00
Tim Glaser
bfb258cbe9
Refactor analytics queries (#1280)
* Refactor analytics queries

* Fix timedelta issue

* Fix tests

* Improve test

* Fix stickiness action

* Add default shape

* Refactor tests

* Add types to filter func

* Add comments to functions

* Fix tests

* remove unused import

* remove more unused imports

* Fix retention issues
2020-07-29 21:07:02 +02:00
Marius Andra
3f47ad2d0c
Kea TypeGen (#1286)
* update typescript eslint config / fix tsconfig.json path bug

* add kea-typegen and UserType

* kea-typegen first run, add types to userLogic
2020-07-28 22:25:24 +02:00
Marius Andra
5623551b04
Launch toolbar (#1186)
Co-authored-by: Twixes <dev@twixes.com>
2020-07-17 19:57:42 +02:00
Marius Andra
a256373526
Add Typescript Support (#1157)
* explicitly ignore some linting errors

* add typescript support and fix postcss dev warnings

* convert a few files to ".ts"

* fix return values
2020-07-08 09:45:23 +02:00