* Increase max_parser_depth setting
This is currently causing issues in production with exports w/ comparisons, but
would blow up in other cases with sufficient data.
The reason this is now blowing up is that we create a large AND/OR condition
for breakdown comparisons. ecto-ch nests each conditional in its separate parentheses
causing us to reach the default 1000 max_parser_depth limit
We can improve this in a couple of ways:
- Not add unneccessary parentheses in ecto-ch
- Adding a new operator to make the AND/OR nesting require less conditionals, using
arrays and tuples instead
* Don't query comparisons for exports
csv exports don't actually output any comparison data, so querying for
it just causes issues.
* Sync removing and rejecting invitations and site transfers
* Sync invitation/transfer ID with each new invite
* Accept only subset of guest invitations on sync
* Pass test
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Revert "Revert "Remove no change icon, better alignment""
This reverts commit a69d0a14a7fe038fe110907571240ad99a2ba6a4.
* different arrows
* Render graph tooltips in react
* Use ChangeArrow in graph tooltips
* Only display a single date if viewing a single date
* Tests for breakdown responses with labels
* Simplify code a bit
* strokeClass
* refactor ChangeArrow
* Play with stroke widths
* jest tests
* Silence logging in jest tests
* not variable stroke width
* prettier
* Conversion rate widths
* Update a test
* Trim trailing dates for label when comparing running month
* Reformat file
* Update expect.toHaveTextContent for multiline
* Update date range labelling to be more consistent with the frontend
* reformat
* move util function to util module
* move playwright config file to tracker dir root
* update Playwright + add gitignores
* Playwright: enable reuseExistingServer (non-CI env)
* store tracker src copies to avoid re-compilation in dev env
* test pageleave on simple navigation
* fix test util fn
* rename local_test npm script
* make test util able to expect multiple requests
* test pageleaves in SPAs
* test pageleave with manual URL
* test pageleave not sent in manual when pageview not triggered
* extend util fn to refute event requests
* test pageleaves not sent in excluded hash pages
* store hashes instead of file copies to detect /tracker/src changes
* drop async
* speed up test suite
* Clean site transfers after 48 hours
* Sync accepting site transfers and invitations within transaction
* Add dry run mode to teams backfill and make it a default
* Extend invitation clean worker tests
* Lost tapes: bring back premium feature notices in tiles
* Ensure that e-mail CTA is only presented to business/enterprise customers
* Format
* Fix typespecs
* Add t() type to EnterprisePlan
* Reduce Plan.t() definition
Found no reason for it to be there.
* Extend team consistency checks
* Sync team against user right after creating the site
* Prune orphaned team guest memberships and invitations on site removal
* Comparisons: Only render comparisons in top stats when both query and data support it
This fixes a bug from navigation:
1. Comparison disabled, choose a non-realtime period (e.g. press T for "Last 30 days")
2. Enable comparison mode (press X)
3. Choose the realtime period (press R)
4. Choose a non-realtime period again (press T)
Kudos to robert for discovering the repro case.
* Fix conditional
Broken when fixing another bug d727ba5ed5 (diff-f2361637bc87773faced883d7560491e4612b7581f4748f03241821f4ff8f6feL166)
* new endpoint for custom prop value filter suggestions
* add test coverage for searching prop suggestions
* plug the new endpoint into FE
* update changelog
* format JS
* Update CHANGELOG.md
Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
---------
Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
* Ensure team is present before use in sync logic
* Ensure teams backfill works against partially assigned sites
* Associate site with team on creation
* Associate site with team on sync
* Reuse alias
* Add tests for invitation creation sync
* Move team assertions to a helper module
* Format
* Test team creation on site creation via Sites context module
* Add tests for teams sync on subscription changes
* Tag tests
* Test grace period start syncing up with teams
* Test grace period manual lock sycning w/ teams
* Test grace period end sycing up w/ teams
* Test clearing grace period sync with teams
* Update moduledoc
* Fix missing preloads and wrong result pattern matching in sync logic
* Test sync on accepting invites and site transfers
* Test sync on membership role update and member removal
* transfer async fix WIP
* Stop privisioning team in site factory
* Remove unused relationship from Site schema
* Ensure consistent parsing of `passthrough` from Paddle webhook
* Update team passthrough notification tests & logic
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Fix conversions graph tooltips
* Show revenue value instead of `undefined` in graph
This broke due to the unification of formatters. Not sure if this is the best fix
* Log warnings on HTTP GA4 import errors and add Sentry context on socket errors
* Treat socket and 5xx errors as recoverable (up for retry in ~1hr) in GA4 imports
* Add filter clauses for each main result filter
This handles the case where main query has a limit and results change. Doesnt handle metrics like percentage.
* Fix percentage calculations by ignoring breakdown-related filters in totals queries
* Refactor comparisons test suite
* Move comparisons logic to comparisons module
* New route for internal query tests
Only to be used in testing
* Support comparison queries with imports/breakdowns
* time dimension predicate extraction
* Clean up a test
* Update docstring
* Update route test
* fix a typo
* Comparisons: Move code to LegacyQueryBuilder
* WIP: Return comparison results to frontend
* refactor: remove useless param
* Different result format
* Pass object to metric.renderValue
* remove dead code
* Fixup response format
* Comparison in a tooltip
Not perfect at all, but a good start. Problems arise with money etc.
* Simple change arrow
* Extract metric entry to ts
* popper attempt WIP
* Slightly nicer content
* Solve warning
* Unified changeArrow in app
* Remove needless spanning
* Always set `graph_metric` in top stats.
FE already has business logic around whether a given metric is graphable
* Remove dead code
* Move Money module under dashboard utils, keep in build
* change <Metric /> definition to take in a `formatter` and store default formatters in another (typed) const
* Use standard system for formatting numbers
* Arrows only in table
* remove dead import
* Inline renderValue
* Render metric name in tooltip
* numberFormatter -> numberShortFormatter
* numberShortFormatter update
* Separate long/short formatters
* Use long vs short formatters
* Put column name into tooltip
* Slightly improved label handling for percentages, conversion rate
* Improved boundary handling in tooltip.js
* Iterate tooltips, no tooltip for - revenue
* Update top stats tests after graph_metric change
* Change revenue metrics stats API return structure
Conversion now happens earlier in query pipeline, we return float for comparison purposes
* useQueryContext in a component
* graph_metric for current visitors to fix realtime view
* No tooltips if fully - row
* renderValue as a proper function
* Simplify MetricEntry
* Use common const
* tooltip to typescript
* More explicit return structure
* metric-entry -> metric-value
* Restore some files
* ChangeArrow
* Restore MoreLink
* Fix typing in MoreLink
* <MetricValue />
* Tests for MetricValue and ChangeArrow
* details modal fixups
* re-add space between arrow and percentage
* Solve stylelint issues
* Update test
* Format
* Add flag `breakdown_comparisons_ui`
* reformat
* Remove no change icon, better alignment
* Revert "Remove no change icon, better alignment"
This reverts commit a8d62b6383.
* number-formatter.ts
* numberLongFormatter refactor
* useMemo dependency
* Handle nulls/undefined in top stats
---------
Co-authored-by: Uku Taht <uku.taht@gmail.com>
* Extend schemas with new fields and relationships for teams
* Implement listing sites and sites with invitations with teams
* Implement creating invitations with teams
* Implement accepting invites with teams
* Add `Teams.SiteTransfer` schema
* Implement creating ownership transfers
* Implement accepting site transfer between teams
* Make results shapes from `Teams.Memberships` role functions more consistent
* Remove :team relation from ApiKey schema
* Pass and provision team on subscription creation
* Pass and provision team on enterprise plan creation
* Implement creating site for a team
* Keep team in sync during legacy ownership transfer and invitations
* Resolve conflict in `Teams.get_or_create` without transaction
* Abstract `GracePeriod` manipulation behind `Plausible.Users`
* Put `User.start_trial` behind `Plausible.Users` API
* Sync team fields on user update, if team exists
* Sync cleaning invitations, updating and removing members
* Transfer invitations too
* Implement backfill script
* Allow separate pg repo for backfill script
* Rollback purposefully at the end
* Update backfill script with parallel processing
* Use `IS DISTINCT FROM` when comparing nullable fields
* Handle no teams to backfill case gracefully when reporting
* Parallelize guest memberships backfill
* Remove transaction wrapping and query timeouts
* Make team sync check more granular and fix formatting
* Wrap single team backfill in a transatction for consistent restarts
* Make invitation and site transfer backfills preserve invitation ID
* Update migration repo config for easier dev access
* Backfill teams for users with subscriptions without sites
* Log timestamps
* Put teams sync behind a compile-time flag
* Keep timestamps in sync and fix subscriptions backfill
* Fix formatting
* Make credo happy
* Don't `use Plausible.Migration` to avoid dialyzer complaining
None of the tooling from there is used anywhere and `@repo` can
be defined directly in the migration script.
* Drop SSL workarounds in the backfill script
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Add migration adding team related tables and fields
* Add `team_site_transfers` table to the teams migration
* Remove team_id FK from api_keys table
* Change new FK constraints on existing tables to `nilify_all` on delete
* Ensure unique indexes on invitation_id and transfer_id fields
* replace styled_link and unstyled_link components with plan anchor tag in email templates
* format
* change formatting for better whitespace
* use phx-no-format on bad anchor
* Set root domain `(none)` for ingests without hostname
* No `nil` hostname should be allowed to enter ingestion
* Invoke `sanitize_hostname` only when applicable
* Turn .eex templates into .heex
* Add new compile-time presets to `PlausibleWeb`
* Fix remaining templates
* Update static components
* Update live components
* Update live views
* Update rest of the owl
* Update mjml template
* Format
* Format
* Revert MJML stuff, it's coupled with EEx
* yawn at test
* Get rid of `FormHelpers` module
* Ensure YOU label shows up first on IP rules list
* Update lib/plausible_web/templates/email/welcome_email.html.heex
Co-authored-by: Artur Pata <artur.pata@gmail.com>
* Fix create site email link
* Fix server error markup (and turn thanks into heex)
* Format
---------
Co-authored-by: Artur Pata <artur.pata@gmail.com>