From 16323959fdecfb8294deb2319ab5444d87fd3684 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 29 Nov 2023 10:41:18 +0000 Subject: [PATCH] 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 --- .eslintignore | 2 + .eslintrc.js | 14 + .github/workflows/ci-frontend.yml | 4 + .run/PostHog.run.xml | 4 +- ee/frontend/exports.ts | 19 +- .../__snapshots__/transform.test.ts.snap | 429 ++++++++ ee/frontend/mobile-replay/index.ts | 73 ++ ee/frontend/mobile-replay/mobile.types.ts | 172 ++++ .../schema/mobile/rr-mobile-schema.json | 324 ++++++ .../schema/web/rr-web-schema.json | 951 ++++++++++++++++++ ee/frontend/mobile-replay/transform.test.ts | 301 ++++++ ee/frontend/mobile-replay/transformers.ts | 269 +++++ ee/frontend/mobile-replay/wireframeStyle.ts | 95 ++ frontend/@posthog/ee/exports.ts | 15 +- frontend/@posthog/ee/types.ts | 9 +- frontend/src/lib/ee.test.ts | 13 +- .../src/scenes/plugins/source/formatSource.ts | 2 + .../__mocks__/recording_snapshots.ts | 20 + .../player/inspector/PlayerInspectorList.tsx | 7 +- .../player/sessionRecordingDataLogic.test.ts | 2 +- .../player/sessionRecordingDataLogic.ts | 55 +- .../player/utils/segmenter.test.ts | 6 +- frontend/utils.mjs | 2 +- jest.config.ts | 34 +- package.json | 11 +- pnpm-lock.yaml | 739 ++++---------- tsconfig.json | 4 +- 27 files changed, 2980 insertions(+), 596 deletions(-) create mode 100644 .eslintignore create mode 100644 ee/frontend/mobile-replay/__snapshots__/transform.test.ts.snap create mode 100644 ee/frontend/mobile-replay/index.ts create mode 100644 ee/frontend/mobile-replay/mobile.types.ts create mode 100644 ee/frontend/mobile-replay/schema/mobile/rr-mobile-schema.json create mode 100644 ee/frontend/mobile-replay/schema/web/rr-web-schema.json create mode 100644 ee/frontend/mobile-replay/transform.test.ts create mode 100644 ee/frontend/mobile-replay/transformers.ts create mode 100644 ee/frontend/mobile-replay/wireframeStyle.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..298aa758576 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +.eslintrc.js +jest.config.ts diff --git a/.eslintrc.js b/.eslintrc.js index d8a5b12f00f..e9434574a73 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -54,6 +54,7 @@ module.exports = { 'compat', 'posthog', 'simple-import-sort', + 'import', ], rules: { 'no-console': ['error', { allow: ['warn', 'error'] }], @@ -261,6 +262,19 @@ module.exports = { 'no-constant-condition': 'off', 'no-prototype-builtins': 'off', 'no-irregular-whitespace': 'off', + 'import/no-restricted-paths': [ + 'error', + { + zones: [ + { + target: './frontend/**', + from: './ee/frontend/**', + message: + "EE licensed TypeScript should only be accessed via the posthogEE objects. Use `import posthogEE from '@posthog/ee/exports'`", + }, + ], + }, + ], }, overrides: [ { diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml index c586598152f..7d49cd5c23c 100644 --- a/.github/workflows/ci-frontend.yml +++ b/.github/workflows/ci-frontend.yml @@ -107,6 +107,10 @@ jobs: if: needs.changes.outputs.frontend == 'true' run: pnpm schema:build:json && git diff --exit-code + - name: Check if mobile replay "schema.json" is up to date + if: needs.changes.outputs.frontend == 'true' + run: pnpm mobile-replay:schema:build:json && git diff --exit-code + - name: Check toolbar bundle size if: needs.changes.outputs.frontend == 'true' uses: preactjs/compressed-size-action@v2 diff --git a/.run/PostHog.run.xml b/.run/PostHog.run.xml index df41d468add..b36e0c48a93 100644 --- a/.run/PostHog.run.xml +++ b/.run/PostHog.run.xml @@ -17,7 +17,7 @@ - + @@ -48,4 +48,4 @@