* 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>
* bugfix: make sure to send pageleave with current URL
* another bugfix: avoid triggering pageleaves in SPAs unless listeningPageLeave is true
* revert behavioural change in manual extension
* test manual script extension
* WIP: Start refactoring revenue metrics
* Hacks to make things work
* Remove old revenue code, remove revenue metrics if needed
* Update query_optimizer docs
* Minor fixes
* Add tests around average/total revenue when non-revenue goal filtering going on
* Optimize, calculate filters as expected (OR-ing clauses)
* Revenue: Handle cases where revenue metrics should not be returned or nil
* Expose revenue metrics in internal schema, add tests
* Docstring
* Remove TODO
* Typegen
* Solve warnings
* Remove nesting
* ce_test fix
* Tag tests as ee_only
* Fix: When filtering by revenue goal and no conversions, return 0.0 instead of nil
* More straight-forward preloading logic
* Refactor comparisons to a new options format
Prerequisite for APIv2 comparison work
* Experiment with default include deduplication
* WIP
Oops, breaks `include.total_rows`
* WIP
* Refactor breakdown.ex
* Pagination fix: dont paginate split subqueries
* Timeseries tests pass
* Aggregate tests use QueryExecutor
* Simplify QueryExecutor
* Handle legacy time-on-page metric in query_executor.ex
No behavioral changes
* Remove keep_requested_metrics
* Clean up imports
* Refactor aggregate.ex to be more straight-forward in output format building
* top stats: compute comparison via apiv2
* Minor cleanups
* WIP: Pipelines
* WIP: refactor for code cleanliness
* QueryExecutor to QueryRunner
* Make compilable
* Comparisons for timeseries works
Except for comparisons where comparison window is bigger than source query window
* Add special case for timeseries
* JSON schema tests for comparisons
* Test comparisons with the new API
* comparison date range parsing improvement
* Make comparisons api internal-only
* typegen
* credo
* Different schemata
* get_comparison_query
* Add comment on timeseries result format
* comparisons typegen
* Percent change for revenue metrics fix
* Use defstruct for query_runner over map
* Remove preloading atoms
* Outline /settings/v2 fundamentals
* Add setting tiles stubs
* Bootstrap name change
* Bootstrap theme change
* Bootstrap security settings
* Use table component for listing sessions
* Disable current e-mail field
* Implement Danger Zone
* Deal with compilation warnings
* Implement "Subscription" section
* Implement invoices list
* Fix invoices empty state & add API keys
* Fix headings in Subscription section
* Fix API keys mobile view
* Fix subscription boxes width
* Fix formatting
* Move tests for settings WIP
* Adjust remaining tests and router placement
Include docs links in tiles, where applicable.
* Fix remaining routes and remove dead code
* Fix route in a live view where no @conn is available
* Update mobile view settings picker
* Format
* Fix subscription section headings
* Fix account e-mail on dark mode
* Delete unused template
* Fix mobile setting section picker
* Optimize Login Management tile for mobile
* Update invoices section with docs link
* Update copy
* Remove trailing dots from (sub)titles
* Fix CSV export padding for "exporting" state
* Align subscription status to the right
* Fix failing test
* Fix subscription status alignment once again
* Improve subscription mobile view a little
* Fixup test compilation 🙈
* Add extra margin to subscription status box
* Make cancel button in 2FA modals expand in mobile view
* Stats API only
* Capitalize "Current session" indicator
* Show "Show More" invoices button only when there's >12
* tiny change
* Update changelog
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
Co-authored-by: Marko Saric <34340819+metmarkosaric@users.noreply.github.com>
* Enable exceptions when revoking all user sessions
* Add `User` changeset for changing password
* Make button in `2fa_input` component optional
* Implement password change from User Settings
* Add tests
* Fix 2FA modal cancel button formatting
* Update changelog
* Don't pass redundant params to `render_settings` and clean up code a bit
* Render one error per field in password reset form
* Refactor inline form 2FA validation
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Update generic components library
* Import generic components via `PlausibleWeb`
* Update Settings/Danger Zone
* Update new shared link template and convert to heex
* Update site settings layout
* Update site settings sidebar tab layout
* Update Settings/Email Reports
* Update Funnels
* Update ComboBox
* Extend/update form components
* Update Modal live component
* Update Settings/Goals
* Update Shields
* Update Settings/Props
* Update Settings/Import & Export
* Update flow progress
* Import Routes in settings
* Update Billing components
* Update Billing notice component
* Update feature toggle component
* Update 2fa component
* Update verification markup
* Update installation
* Update Settings/Integrations/Plugins
* Update domain change markup
* Update Settings/General
* Update Settings/Integrations
* Update Settings/People
* Update Settings/Integrations/GSC
* Update Settings/Visiblity
* ukuwip
* ukuwip
* Tables & paddings
* Imports exports
* Brighten disabled input text color for dark mode
* Tune down table border/divider in dark mode
* Format
* Fix goal list on mobile
* Fix IP Shields table on mobile
* Fix country shields list on mobile
* Fix country shield list on mobile
* Fix page shields list on mobile
* Fix import/export settings on mobile
* Fix combobox dropdown background in dark mode
* Fix filter bar search input on mobile
* Revert @ukutaht's changes to goal list
* Maybe maybe maybe
* Revert the current prod goal list + fix mobile issues
* Format
* Revert tests change
cc @ukutaht
* Fix markup expectation in a test
* Set autocomplete="off" again
* Bring back `text-sm` where previously removed
---------
Co-authored-by: Uku Taht <uku.taht@gmail.com>
* add experimental pageleave script variant
* also send pageleave events on SPA navigation
* disallow goals with 'pageleave' event name
* do not count pageleaves towards the event metric
* remove duplication in test file
* do not update sessions on pageleave events
* ignore pageleaves in the current time_on_page implementation
* make pageleave events not billable
* rename function
* Prevent multiple pageleaves being sent at the same time
* Implement listing user sessions in user settings
* Make copy adjustments (h/t @metmarkosaric)
* Make warning button text color more consistent across user settings
* Add tests for `UserAuth.revoke_user_session/2`
* Test and improve `Auth.UserSessions`
* Test and improve controller actions
* Update CHANGELOG.md
* Stop typescript command clearing previous server start output in dev
* Allow auth site access plug to specify that domain is found in request body at some key
* Fix init order
* Make domain retrieval part of the role pipeline
* Add tests
* Refactor how is_binary is applied in get_domain/2
* Make plug tests rely on dedicated test routes for more stability
* Consistently treat empty `allowed_roles` list as permitting all roles
* Fix async test param, add extra case for init
* Make `DocsQueryTest` async again
* Improve a bit and document plug configuration
* Make docs more legible when viewed from source directly
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Check usage for users with active/cancelled/past due subscriptions
So that over limit e-mails and grace period is handled
regardless - they're still subscribers.
* Ensure current subscription is fetched, for an ongoing plan
* Add extra test
* Revert "Ensure current subscription is fetched, for an ongoing plan"
This reverts commit 9ddc7bdccb.
* Fixup test
* Reapply "Ensure current subscription is fetched, for an ongoing plan"
This reverts commit 7ab537954b.
* Do a subscription preload and assert ID match
* Use inner lateral join to fetch subscriptions