chore(deps): Update posthog-js to 1.112.1 (#20782)
1
.github/workflows/ci-e2e.yml
vendored
@ -183,7 +183,6 @@ jobs:
|
||||
DISABLE_SECURE_SSL_REDIRECT=1
|
||||
SECURE_COOKIES=0
|
||||
OPT_OUT_CAPTURE=0
|
||||
SELF_CAPTURE=1
|
||||
E2E_TESTING=1
|
||||
SKIP_SERVICE_VERSION_REQUIREMENTS=1
|
||||
EMAIL_HOST=email.test.posthog.net
|
||||
|
@ -49,7 +49,6 @@ done
|
||||
export DEBUG=1
|
||||
export NO_RESTART_LOOP=1
|
||||
export CYPRESS_BASE_URL=http://localhost:8080
|
||||
export OPT_OUT_CAPTURE="${OPT_OUT_CAPTURE:=1}"
|
||||
export SECURE_COOKIES=0
|
||||
export SKIP_SERVICE_VERSION_REQUIREMENTS=1
|
||||
export KAFKA_HOSTS=kafka:9092
|
||||
|
@ -7,7 +7,7 @@ To test feature flags you can intercept the call to the `decide` endpoint
|
||||
```javascript
|
||||
// sometimes the system under test calls `/decide`
|
||||
// and sometimes it calls https://app.posthog.com/decide
|
||||
cy.intercept('https://app.posthog.com/decide/*', (req) =>
|
||||
cy.intercept('**/decide/*', (req) =>
|
||||
req.reply(
|
||||
decideResponse({
|
||||
// add feature flags here, for e.g.
|
||||
|
@ -1,5 +1,3 @@
|
||||
import * as fflate from 'fflate'
|
||||
|
||||
const UNSUBSCRIBE_SURVEY_ID = '018b6e13-590c-0000-decb-c727a2b3f462'
|
||||
|
||||
describe('Billing', () => {
|
||||
@ -7,8 +5,6 @@ describe('Billing', () => {
|
||||
cy.intercept('/api/billing-v2/', { fixture: 'api/billing-v2/billing-v2.json' })
|
||||
|
||||
cy.visit('/organization/billing')
|
||||
|
||||
cy.intercept('POST', '**/e/?compression=gzip-js*').as('capture')
|
||||
})
|
||||
|
||||
it('Show and submit unsubscribe survey', () => {
|
||||
@ -22,19 +18,16 @@ describe('Billing', () => {
|
||||
cy.get('[data-attr=unsubscribe-reason-survey-textarea]').type('Product analytics')
|
||||
cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click()
|
||||
|
||||
cy.wait('@capture').then(({ request }) => {
|
||||
const data = new Uint8Array(request.body)
|
||||
const decoded = fflate.strFromU8(fflate.decompressSync(data))
|
||||
const decodedJSON = JSON.parse(decoded)
|
||||
|
||||
// These should be a 'survey sent' event somewhere in the decodedJSON
|
||||
const matchingEvents = decodedJSON.filter((event) => event.event === 'survey sent')
|
||||
cy.window().then((win) => {
|
||||
const events = (win as any)._cypress_posthog_captures
|
||||
const matchingEvents = events.filter((event) => event.event === 'survey sent')
|
||||
expect(matchingEvents.length).to.equal(1)
|
||||
const matchingEvent = matchingEvents[0]
|
||||
expect(matchingEvent.properties.$survey_id).to.equal(UNSUBSCRIBE_SURVEY_ID)
|
||||
expect(matchingEvent.properties.$survey_response).to.equal('Product analytics')
|
||||
expect(matchingEvent.properties.$survey_response_1).to.equal('product_analytics')
|
||||
})
|
||||
|
||||
cy.get('.LemonModal').should('not.exist')
|
||||
cy.wait(['@unsubscribeProductAnalytics'])
|
||||
})
|
||||
|
@ -7,19 +7,19 @@ const interceptPropertyDefinitions = (): void => {
|
||||
fixture: 'api/event/property_definitions',
|
||||
})
|
||||
|
||||
cy.intercept('/api/projects/1/property_definitions?is_feature_flag=false&search=&*', {
|
||||
cy.intercept('/api/projects/*/property_definitions?is_feature_flag=false&search=&*', {
|
||||
fixture: 'api/event/property_definitions',
|
||||
})
|
||||
|
||||
cy.intercept('/api/projects/1/property_definitions?is_feature_flag=false&search=%24time*', {
|
||||
cy.intercept('/api/projects/*/property_definitions?is_feature_flag=false&search=%24time*', {
|
||||
fixture: 'api/event/only_time_property_definition',
|
||||
})
|
||||
|
||||
cy.intercept('/api/projects/1/property_definitions?is_feature_flag=false&search=%24browser*', {
|
||||
cy.intercept('/api/projects/*/property_definitions?is_feature_flag=false&search=%24browser*', {
|
||||
fixture: 'api/event/only_browser_version_property_definition',
|
||||
})
|
||||
|
||||
cy.intercept('/api/projects/1/property_definitions?is_feature_flag=true*', {
|
||||
cy.intercept('/api/projects/*/property_definitions?is_feature_flag=true*', {
|
||||
fixture: 'api/event/feature_flag_property_definition',
|
||||
})
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ describe('Experiments', () => {
|
||||
fixture: 'api/experiments/user',
|
||||
})
|
||||
|
||||
cy.intercept('/api/projects/1/experiments?limit=1000', {
|
||||
cy.intercept('/api/projects/*/experiments?limit=1000', {
|
||||
fixture: 'api/experiments/experiments',
|
||||
})
|
||||
|
||||
cy.intercept('/api/projects/1/experiments/1234/', {
|
||||
cy.intercept('/api/projects/*/experiments/1234/', {
|
||||
fixture: 'api/experiments/new-experiment',
|
||||
})
|
||||
|
||||
|
@ -4,7 +4,7 @@ describe('Feature Flags', () => {
|
||||
let name
|
||||
|
||||
beforeEach(() => {
|
||||
cy.intercept('https://us.i.posthog.com/decide/*', (req) =>
|
||||
cy.intercept('**/decide/*', (req) =>
|
||||
req.reply(
|
||||
decideResponse({
|
||||
'new-feature-flag-operators': true,
|
||||
@ -12,7 +12,7 @@ describe('Feature Flags', () => {
|
||||
)
|
||||
)
|
||||
|
||||
cy.intercept('/api/projects/1/property_definitions?type=person*', {
|
||||
cy.intercept('/api/projects/*/property_definitions?type=person*', {
|
||||
fixture: 'api/feature-flags/property_definition',
|
||||
})
|
||||
cy.intercept('/api/person/values/*', {
|
||||
|
@ -3,7 +3,7 @@ import { decideResponse } from '../fixtures/api/decide'
|
||||
|
||||
describe('Onboarding', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('https://us.i.posthog.com/decide/*', (req) =>
|
||||
cy.intercept('**/decide/*', (req) =>
|
||||
req.reply(
|
||||
decideResponse({
|
||||
'product-intro-pages': 'test',
|
||||
|
@ -74,8 +74,8 @@ describe('Signup', () => {
|
||||
cy.get('.Toastify [data-attr="error-toast"]').contains('Inactive social login session.')
|
||||
})
|
||||
|
||||
it('Shows redirect notice if redirecting for maintenance', () => {
|
||||
cy.intercept('https://us.i.posthog.com/decide/*', (req) =>
|
||||
it.only('Shows redirect notice if redirecting for maintenance', () => {
|
||||
cy.intercept('**/decide/*', (req) =>
|
||||
req.reply(
|
||||
decideResponse({
|
||||
'redirect-signups-to-instance': 'us',
|
||||
|
@ -16,6 +16,8 @@ const E2E_TESTING = Cypress.env('E2E_TESTING')
|
||||
Cypress.on('window:before:load', (win) => {
|
||||
cy.spy(win.console, 'error')
|
||||
cy.spy(win.console, 'warn')
|
||||
|
||||
win._cypress_posthog_captures = []
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
@ -24,7 +26,7 @@ beforeEach(() => {
|
||||
Cypress.env('POSTHOG_PROPERTY_GITHUB_ACTION_RUN_URL', process.env.GITHUB_ACTION_RUN_URL)
|
||||
cy.useSubscriptionStatus('subscribed')
|
||||
|
||||
cy.intercept('https://us.i.posthog.com/decide/*', (req) =>
|
||||
cy.intercept('**/decide/*', (req) =>
|
||||
req.reply(
|
||||
decideResponse({
|
||||
// set feature flags here e.g.
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 32 KiB |
@ -27,7 +27,7 @@ CONSTRAINED_PREVIEWS.add('constrained-test-2' as FeatureFlagKey)
|
||||
const Template: StoryFn<StoryProps> = ({ earlyAccessFeatures, enabledFeatureFlags }) => {
|
||||
useStorybookMocks({
|
||||
get: {
|
||||
'https://app.posthog.com/api/early_access_features/': { earlyAccessFeatures },
|
||||
'https://us.i.posthog.com/api/early_access_features/': { earlyAccessFeatures },
|
||||
},
|
||||
})
|
||||
setFeatureFlags(enabledFeatureFlags)
|
||||
|
@ -42,10 +42,15 @@ export function loadPostHogJS(): void {
|
||||
autocapture: {
|
||||
capture_copied_text: true,
|
||||
},
|
||||
// Helper to capture events for assertions in Cypress
|
||||
_onCapture: (window as any)._cypress_posthog_captures
|
||||
? (_, event) => (window as any)._cypress_posthog_captures.push(event)
|
||||
: undefined,
|
||||
})
|
||||
)
|
||||
|
||||
const Cypress = (window as any).Cypress
|
||||
|
||||
if (Cypress) {
|
||||
Object.entries(Cypress.env()).forEach(([key, value]) => {
|
||||
if (key.startsWith('POSTHOG_PROPERTY_')) {
|
||||
|
@ -100,7 +100,7 @@ export const defaultMocks: Mocks = {
|
||||
// We don't want to show the "new version available" banner in tests
|
||||
'https://api.github.com/repos/posthog/posthog-js/tags': () => [200, []],
|
||||
'https://www.gravatar.com/avatar/:gravatar_id': () => [404, ''],
|
||||
'https://app.posthog.com/api/early_access_features': {
|
||||
'https://us.i.posthog.com/api/early_access_features': {
|
||||
earlyAccessFeatures: [],
|
||||
},
|
||||
'/api/billing-v2/': {
|
||||
@ -108,11 +108,11 @@ export const defaultMocks: Mocks = {
|
||||
},
|
||||
},
|
||||
post: {
|
||||
'https://app.posthog.com/e/': (): MockSignature => [200, 'ok'],
|
||||
'https://us.i.posthog.com/e/': (): MockSignature => [200, 'ok'],
|
||||
'/e/': (): MockSignature => [200, 'ok'],
|
||||
'https://app.posthog.com/decide/': (): MockSignature => [200, 'ok'],
|
||||
'https://us.i.posthog.com/decide/': (): MockSignature => [200, 'ok'],
|
||||
'/decide/': (): MockSignature => [200, 'ok'],
|
||||
'https://app.posthog.com/engage/': (): MockSignature => [200, 'ok'],
|
||||
'https://us.i.posthog.com/engage/': (): MockSignature => [200, 'ok'],
|
||||
'/api/projects/:team_id/insights/:insight_id/viewed/': (): MockSignature => [201, null],
|
||||
},
|
||||
}
|
||||
|
@ -142,7 +142,7 @@
|
||||
"pmtiles": "^2.11.0",
|
||||
"postcss": "^8.4.31",
|
||||
"postcss-preset-env": "^9.3.0",
|
||||
"posthog-js": "1.111.1",
|
||||
"posthog-js": "1.112.1",
|
||||
"posthog-js-lite": "2.5.0",
|
||||
"prettier": "^2.8.8",
|
||||
"prop-types": "^15.7.2",
|
||||
|
@ -1,4 +1,4 @@
|
||||
lockfileVersion: '6.0'
|
||||
lockfileVersion: '6.1'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
@ -245,8 +245,8 @@ dependencies:
|
||||
specifier: ^9.3.0
|
||||
version: 9.3.0(postcss@8.4.31)
|
||||
posthog-js:
|
||||
specifier: 1.111.1
|
||||
version: 1.111.1
|
||||
specifier: 1.112.1
|
||||
version: 1.112.1
|
||||
posthog-js-lite:
|
||||
specifier: 2.5.0
|
||||
version: 2.5.0
|
||||
@ -335,7 +335,7 @@ dependencies:
|
||||
optionalDependencies:
|
||||
fsevents:
|
||||
specifier: ^2.3.2
|
||||
version: 2.3.3
|
||||
version: 2.3.2
|
||||
|
||||
devDependencies:
|
||||
'@babel/core':
|
||||
@ -12745,7 +12745,6 @@ packages:
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/fsevents@2.3.3:
|
||||
@ -17386,8 +17385,8 @@ packages:
|
||||
resolution: {integrity: sha512-Urvlp0Vu9h3td0BVFWt0QXFJDoOZcaAD83XM9d91NKMKTVPZtfU0ysoxstIf5mw/ce9ZfuMgpWPaagrZI4rmSg==}
|
||||
dev: false
|
||||
|
||||
/posthog-js@1.111.1:
|
||||
resolution: {integrity: sha512-glBx1uYFNzC7WXcB2V+FAPqTwumXMC+RhB0C2MzSGkyBjVB53ZnvSJnoEbwCo8eHzTIdlt+jWL6DtXf4SOu3OA==}
|
||||
/posthog-js@1.112.1:
|
||||
resolution: {integrity: sha512-BWYMLCu5bnSeahOyVkGgMvsiJSPqD/OEgwOJn8xi8U/i4pYwgeRfgMgkArexD7JVe9FAAdOmKw+995H0pJUDQw==}
|
||||
dependencies:
|
||||
fflate: 0.4.8
|
||||
preact: 10.19.6
|
||||
|
@ -20,6 +20,7 @@
|
||||
<script>
|
||||
window.JS_POSTHOG_API_KEY = {{js_posthog_api_key | safe}};
|
||||
window.JS_POSTHOG_HOST = {{js_posthog_host | safe}};
|
||||
window.JS_POSTHOG_UI_HOST = {{js_posthog_ui_host | safe}};
|
||||
window.JS_POSTHOG_SELF_CAPTURE = {{self_capture | yesno:"true,false" }};
|
||||
window.POSTHOG_USER_IDENTITY_WITH_FLAGS = JSON.parse("{{ posthog_bootstrap | escapejs }}")
|
||||
window.IMPERSONATED_SESSION = {{is_impersonated_session | yesno:"true,false"}};
|
||||
|
@ -299,10 +299,14 @@ def render_template(
|
||||
context["debug"] = True
|
||||
context["git_branch"] = get_git_branch()
|
||||
|
||||
context["js_posthog_ui_host"] = "''"
|
||||
|
||||
if settings.E2E_TESTING:
|
||||
context["e2e_testing"] = True
|
||||
context["js_posthog_api_key"] = "'phc_ex7Mnvi4DqeB6xSQoXU1UVPzAmUIpiciRKQQXGGTYQO'"
|
||||
context["js_posthog_host"] = "'https://app.posthog.com'"
|
||||
context["js_posthog_host"] = "'https://internal-e.posthog.com'"
|
||||
context["js_posthog_ui_host"] = "'https://us.posthog.com'"
|
||||
|
||||
elif settings.SELF_CAPTURE:
|
||||
api_token = get_self_capture_api_token(request)
|
||||
|
||||
|