Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(editor): Change upgrade CTA on community editions (no-changelog) #6317

Merged
merged 12 commits into from
Jun 5, 2023

Conversation

RicardoE105
Copy link
Contributor

Github issue / Community forum post (link here to close automatically):

@github-actions
Copy link
Contributor

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Files matching **/*.vue:

  • Used composition API for all new components.
  • Added component or unit tests to cover functionality.

Files matching packages/editor-ui/**/*.vue:

  • Added E2E if adding new features.
  • Used design system tokens (colors, spacings...) where possible.

Make sure to check off this list before asking for review.

@RicardoE105 RicardoE105 changed the title Change upgrade CTA on community editions feat(editor): Change upgrade CTA on community editions (no-changelog) May 24, 2023
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels May 24, 2023
@RicardoE105 RicardoE105 force-pushed the ado-669-change-upgrade-cta-on-community-editions branch from 2a9da66 to f08e9e6 Compare May 24, 2023 22:03
@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.08 ⚠️

Comparison is base (4eb8437) 28.32% compared to head (ad217c5) 28.25%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6317      +/-   ##
==========================================
- Coverage   28.32%   28.25%   -0.08%     
==========================================
  Files        2982     2981       -1     
  Lines      185148   185176      +28     
  Branches    20298    20300       +2     
==========================================
- Hits        52447    52316     -131     
- Misses     131916   132073     +157     
- Partials      785      787       +2     
Impacted Files Coverage Δ
packages/editor-ui/src/composables/index.ts 100.00% <ø> (ø)
packages/editor-ui/src/stores/ui.store.ts 69.70% <100.00%> (-0.06%) ⬇️
...kages/editor-ui/src/views/SettingsUsageAndPlan.vue 100.00% <100.00%> (ø)
packages/editor-ui/src/views/VariablesView.vue 69.61% <100.00%> (-0.34%) ⬇️

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

OlegIvaniv
OlegIvaniv previously approved these changes May 29, 2023
@github-actions
Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

OlegIvaniv
OlegIvaniv previously approved these changes Jun 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

✅ All Cypress E2E specs passed

@cypress
Copy link

cypress bot commented Jun 5, 2023

Passing run #1105 ↗︎

0 228 0 0 Flakiness 0

Details:

🌳 ado-669-change-upgrade-cta-on-community-editions 🖥️ browsers:node18.12.0-chr...
Project: n8n Commit: ad217c5c2d
Status: Passed Duration: 06:45 💡
Started: Jun 5, 2023 3:23 PM Ended: Jun 5, 2023 3:30 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 5, 2023

✅ All Cypress E2E specs passed

@RicardoE105 RicardoE105 merged commit dc58340 into master Jun 5, 2023
@RicardoE105 RicardoE105 deleted the ado-669-change-upgrade-cta-on-community-editions branch June 5, 2023 17:39
MiloradFilipovic added a commit that referenced this pull request Jun 13, 2023
* master:
  test(editor): Unit test Version control frontend components (#6408)
  fix: Fist name to First Name in certain nodes (no-changelog) (#6404)
  fix(core): Allow all executions to be stopped (#6386)
  fix(core): RMC boolean value fix (#6397)
  fix(editor): Remove root level tag selector from css module to avoid making it a global style (#6392)
  fix(Ldap Node): Add DN field to update operation (#6371)
  feat: New trigger PostgreSQL  (#5495)
  build: Update pnpm lock file (no-changelog) (#6395)
  fix(Date & Time Node): Reset responseData at end of loop (#6385)
  refactor(core): Google service account remove duplicated functions (no-changelog) (#6368)
  refactor(LoneScale List Node)!: Rename to LoneScale (#6337)
  fix(editor): Update version control setup CTA tooltip (#6393)
  ci: Fix build (no-changelog) (#6391)
  fix(editor): Add button to refresh branches (#6387)
  fix(editor): Add Set up version control CTA (#6356)
  fix(editor): Remove explicit parameter name scanning for code editors (#6390)
  ci: Fix build (no-changelog) (#6379)
  fix(editor): Adding branch color (#6380)
  refactor(editor): Remove user activation modal (no-changelog) (#6361)
  feat(editor): Change upgrade CTA on community editions (no-changelog) (#6317)
@janober
Copy link
Member

janober commented Jun 14, 2023

Got released with n8n@0.232.0

csuermann pushed a commit that referenced this pull request Oct 13, 2023
## Issue

In community edition, clicking on "View plans" button on "Settings" ->
"Usage and plan" page (e.g. http://127.0.0.1:5678/settings/usage) opens
two new tabs with n8n pricing (one of them with UTM tracking, another
without).
This was introduced in #6317 , when click handler of "View plans" link
container [started
calling](https://github.com/n8n-io/n8n/pull/6317/files#diff-0bf26afac8a06e03b3d39d0668f22408859355b585a9ab420800c125e33f0691R109)
`uiStore.goToUpgrade(...)` which opens n8n pricing in a new tab, while
browser opens another tab for the link URL.

The simplest fix, implemented in this PR, is to prevent default event
handling (so that, after `onViewPlans` is called, browser will not
attempt to process the click additionally as clicking on the link),
similarly to how it is prevented on some other pages. It only solves the
immediate problem of browser opening two new tabs on clicking "View
plans".

Note that **I didn't implement any tests for the changed behavior**,
because it was not covered by tests before, and I couldn't quite figure
out how to cover it now within the existing test approach (considering
that testing the fact that only one new tab is open will likely require
to write entirely new tests relying on puppeteer; as far as I can see,
no existing `editor-ui` tests are doing anything like that). I'll gladly
implement tests for the new behavior if you tell me how you would like
them to look.
The existing tests for `editor-ui` still pass; I didn't run tests for
other subpackages (see "additional contribution notes" below).

## Additional notes on the issue.

I'm not sure that the change in this PR is the correct long-term
solution for the issue, because the URLs for these two methods (custom
click handler for link container and default link handling) are slightly
different:
* Custom click handler calls `useTelemetryStore().track('User clicked
upgrade CTA', ...)`; then calls `sendUsageTelemetry('view_plans')` (it
feels weird that two calls to telemetry are made); then opens new tab
for `https://n8n.io/pricing?utm_campaign=open&source=usage_page` (note
that prior to #7316 the second call to telemetry was done after the new
tab is opened, not before);
* Link itself refers to another page, with slightly different tracking
parameters:
`https://subscription.n8n.io/?instanceid=[REDACTED]&version=1.10.0&callback=http%3A%2F%2F127.0.0.1%3A5678%2Fsettings%2Fusage&source=usage_page`;
but this page redirects to `https://n8n.io/pricing/`.
It is not clear which one of the two is the right way of doing things.
Although `goToUpgrade` is called in 20 places throughout `editor-ui`,
while `viewPlansUrl`, as far as I can see, is used for this button only.

Additionally, since Settings pages don't work without JS anyway, I can
only think of two separate scenarios where any tab would be opened:
* Left-clicking the link (or Ctrl-clicking, or pressing Space or Enter
when the link is focused, or tapping): previously, both custom click
handler was executed and link's `href` was opened; in this PR, only
custom click handler is executed (similarly to how it is done in the
other places where `goToUpgrade` is called);
* Right-clicking (or long tapping, or opening context menu in any other
way) and selecting "open link in new tab" (or similar): opens a new tab
for URL from the `href` attribute (and does not send any telemetry at
all).

I'd say that the better permanent solution would probably be to get rid
of one of these methods entirely, and only rely on another in all cases
(for me, as an outside contributor, the preferred way would be for
custom click handler to only send telemetry, while letting my browser
handle the actual navigation). However, that would be a large change,
much more than one line in this PR.
Additionally, other similar places where `goToUpgrade` is currently
called (directly or indirectly) would also need to be adapted for this
change.

## Additional contribution notes

As a first-time contributor, I've encountered several things I didn't
expect; I'm not sure if they should be expected or are issues:

1. Tests for the entire monorepo consume a lot of RAM; 20GB free RAM was
not enough, so I couldn't run tests for the entire monorepo and had to
only run them for `packages/editor-ui`;
2. Linting is very slow; `pnpm lint` in `packages/editor-ui` takes ten
minutes to complete;
3. It seems that types are not checked. Code OSS highlights numerous
errors in code files: for example, `'debug'` is incompatible with
`CloudUpdateLinkSourceType` expected by `goToUpgrade` here:
https://github.com/n8n-io/n8n/blob/3e7a4d3b2cc12fcb1b011fccd0773bb807986884/packages/editor-ui/src/composables/useExecutionDebugging.ts#L128
However, I'm not getting any errors during build. There is a `typecheck`
script defined in `package.json`, but `pnpm typecheck` fails with:
    ```
    n8n-toy-demo:~/projects/n8n/packages/editor-ui$ pnpm typecheck

> n8n-editor-ui@1.10.0 typecheck
/home/inga/projects/n8n/packages/editor-ui
    > vue-tsc --emitDeclarationOnly

error TS5069: Option 'emitDeclarationOnly' cannot be specified without
specifying
    option 'declaration' or option 'composite'.


    Found 1 error.

     ELIFECYCLE  Command failed with exit code 1.
    n8n-toy-demo:~/projects/n8n/packages/editor-ui$ 
    ```
Replacing `--emitDeclarationsOnly` with `--noEmit` in `package.json`
unblocks typechecking and results in seemingly, at first glance, correct
"Found 1924 errors in 306 files" (at least several of the reported
errors that I've checked seem to be correct).
But maybe I'm missing something and there are not in fact two thousands
type errors in `editor-ui`?
@github-actions github-actions bot mentioned this pull request Oct 18, 2023
elsmr pushed a commit that referenced this pull request Oct 19, 2023
## Issue

In community edition, clicking on "View plans" button on "Settings" ->
"Usage and plan" page (e.g. http://127.0.0.1:5678/settings/usage) opens
two new tabs with n8n pricing (one of them with UTM tracking, another
without).
This was introduced in #6317 , when click handler of "View plans" link
container [started
calling](https://github.com/n8n-io/n8n/pull/6317/files#diff-0bf26afac8a06e03b3d39d0668f22408859355b585a9ab420800c125e33f0691R109)
`uiStore.goToUpgrade(...)` which opens n8n pricing in a new tab, while
browser opens another tab for the link URL.

The simplest fix, implemented in this PR, is to prevent default event
handling (so that, after `onViewPlans` is called, browser will not
attempt to process the click additionally as clicking on the link),
similarly to how it is prevented on some other pages. It only solves the
immediate problem of browser opening two new tabs on clicking "View
plans".

Note that **I didn't implement any tests for the changed behavior**,
because it was not covered by tests before, and I couldn't quite figure
out how to cover it now within the existing test approach (considering
that testing the fact that only one new tab is open will likely require
to write entirely new tests relying on puppeteer; as far as I can see,
no existing `editor-ui` tests are doing anything like that). I'll gladly
implement tests for the new behavior if you tell me how you would like
them to look.
The existing tests for `editor-ui` still pass; I didn't run tests for
other subpackages (see "additional contribution notes" below).

## Additional notes on the issue.

I'm not sure that the change in this PR is the correct long-term
solution for the issue, because the URLs for these two methods (custom
click handler for link container and default link handling) are slightly
different:
* Custom click handler calls `useTelemetryStore().track('User clicked
upgrade CTA', ...)`; then calls `sendUsageTelemetry('view_plans')` (it
feels weird that two calls to telemetry are made); then opens new tab
for `https://n8n.io/pricing?utm_campaign=open&source=usage_page` (note
that prior to #7316 the second call to telemetry was done after the new
tab is opened, not before);
* Link itself refers to another page, with slightly different tracking
parameters:
`https://subscription.n8n.io/?instanceid=[REDACTED]&version=1.10.0&callback=http%3A%2F%2F127.0.0.1%3A5678%2Fsettings%2Fusage&source=usage_page`;
but this page redirects to `https://n8n.io/pricing/`.
It is not clear which one of the two is the right way of doing things.
Although `goToUpgrade` is called in 20 places throughout `editor-ui`,
while `viewPlansUrl`, as far as I can see, is used for this button only.

Additionally, since Settings pages don't work without JS anyway, I can
only think of two separate scenarios where any tab would be opened:
* Left-clicking the link (or Ctrl-clicking, or pressing Space or Enter
when the link is focused, or tapping): previously, both custom click
handler was executed and link's `href` was opened; in this PR, only
custom click handler is executed (similarly to how it is done in the
other places where `goToUpgrade` is called);
* Right-clicking (or long tapping, or opening context menu in any other
way) and selecting "open link in new tab" (or similar): opens a new tab
for URL from the `href` attribute (and does not send any telemetry at
all).

I'd say that the better permanent solution would probably be to get rid
of one of these methods entirely, and only rely on another in all cases
(for me, as an outside contributor, the preferred way would be for
custom click handler to only send telemetry, while letting my browser
handle the actual navigation). However, that would be a large change,
much more than one line in this PR.
Additionally, other similar places where `goToUpgrade` is currently
called (directly or indirectly) would also need to be adapted for this
change.

## Additional contribution notes

As a first-time contributor, I've encountered several things I didn't
expect; I'm not sure if they should be expected or are issues:

1. Tests for the entire monorepo consume a lot of RAM; 20GB free RAM was
not enough, so I couldn't run tests for the entire monorepo and had to
only run them for `packages/editor-ui`;
2. Linting is very slow; `pnpm lint` in `packages/editor-ui` takes ten
minutes to complete;
3. It seems that types are not checked. Code OSS highlights numerous
errors in code files: for example, `'debug'` is incompatible with
`CloudUpdateLinkSourceType` expected by `goToUpgrade` here:
https://github.com/n8n-io/n8n/blob/3e7a4d3b2cc12fcb1b011fccd0773bb807986884/packages/editor-ui/src/composables/useExecutionDebugging.ts#L128
However, I'm not getting any errors during build. There is a `typecheck`
script defined in `package.json`, but `pnpm typecheck` fails with:
    ```
    n8n-toy-demo:~/projects/n8n/packages/editor-ui$ pnpm typecheck

> n8n-editor-ui@1.10.0 typecheck
/home/inga/projects/n8n/packages/editor-ui
    > vue-tsc --emitDeclarationOnly

error TS5069: Option 'emitDeclarationOnly' cannot be specified without
specifying
    option 'declaration' or option 'composite'.


    Found 1 error.

     ELIFECYCLE  Command failed with exit code 1.
    n8n-toy-demo:~/projects/n8n/packages/editor-ui$ 
    ```
Replacing `--emitDeclarationsOnly` with `--noEmit` in `package.json`
unblocks typechecking and results in seemingly, at first glance, correct
"Found 1924 errors in 306 files" (at least several of the reported
errors that I've checked seem to be correct).
But maybe I'm missing something and there are not in fact two thousands
type errors in `editor-ui`?
netroy pushed a commit that referenced this pull request Oct 23, 2023
## Issue

In community edition, clicking on "View plans" button on "Settings" ->
"Usage and plan" page (e.g. http://127.0.0.1:5678/settings/usage) opens
two new tabs with n8n pricing (one of them with UTM tracking, another
without).
This was introduced in #6317 , when click handler of "View plans" link
container [started
calling](https://github.com/n8n-io/n8n/pull/6317/files#diff-0bf26afac8a06e03b3d39d0668f22408859355b585a9ab420800c125e33f0691R109)
`uiStore.goToUpgrade(...)` which opens n8n pricing in a new tab, while
browser opens another tab for the link URL.

The simplest fix, implemented in this PR, is to prevent default event
handling (so that, after `onViewPlans` is called, browser will not
attempt to process the click additionally as clicking on the link),
similarly to how it is prevented on some other pages. It only solves the
immediate problem of browser opening two new tabs on clicking "View
plans".

Note that **I didn't implement any tests for the changed behavior**,
because it was not covered by tests before, and I couldn't quite figure
out how to cover it now within the existing test approach (considering
that testing the fact that only one new tab is open will likely require
to write entirely new tests relying on puppeteer; as far as I can see,
no existing `editor-ui` tests are doing anything like that). I'll gladly
implement tests for the new behavior if you tell me how you would like
them to look.
The existing tests for `editor-ui` still pass; I didn't run tests for
other subpackages (see "additional contribution notes" below).

## Additional notes on the issue.

I'm not sure that the change in this PR is the correct long-term
solution for the issue, because the URLs for these two methods (custom
click handler for link container and default link handling) are slightly
different:
* Custom click handler calls `useTelemetryStore().track('User clicked
upgrade CTA', ...)`; then calls `sendUsageTelemetry('view_plans')` (it
feels weird that two calls to telemetry are made); then opens new tab
for `https://n8n.io/pricing?utm_campaign=open&source=usage_page` (note
that prior to #7316 the second call to telemetry was done after the new
tab is opened, not before);
* Link itself refers to another page, with slightly different tracking
parameters:
`https://subscription.n8n.io/?instanceid=[REDACTED]&version=1.10.0&callback=http%3A%2F%2F127.0.0.1%3A5678%2Fsettings%2Fusage&source=usage_page`;
but this page redirects to `https://n8n.io/pricing/`.
It is not clear which one of the two is the right way of doing things.
Although `goToUpgrade` is called in 20 places throughout `editor-ui`,
while `viewPlansUrl`, as far as I can see, is used for this button only.

Additionally, since Settings pages don't work without JS anyway, I can
only think of two separate scenarios where any tab would be opened:
* Left-clicking the link (or Ctrl-clicking, or pressing Space or Enter
when the link is focused, or tapping): previously, both custom click
handler was executed and link's `href` was opened; in this PR, only
custom click handler is executed (similarly to how it is done in the
other places where `goToUpgrade` is called);
* Right-clicking (or long tapping, or opening context menu in any other
way) and selecting "open link in new tab" (or similar): opens a new tab
for URL from the `href` attribute (and does not send any telemetry at
all).

I'd say that the better permanent solution would probably be to get rid
of one of these methods entirely, and only rely on another in all cases
(for me, as an outside contributor, the preferred way would be for
custom click handler to only send telemetry, while letting my browser
handle the actual navigation). However, that would be a large change,
much more than one line in this PR.
Additionally, other similar places where `goToUpgrade` is currently
called (directly or indirectly) would also need to be adapted for this
change.

## Additional contribution notes

As a first-time contributor, I've encountered several things I didn't
expect; I'm not sure if they should be expected or are issues:

1. Tests for the entire monorepo consume a lot of RAM; 20GB free RAM was
not enough, so I couldn't run tests for the entire monorepo and had to
only run them for `packages/editor-ui`;
2. Linting is very slow; `pnpm lint` in `packages/editor-ui` takes ten
minutes to complete;
3. It seems that types are not checked. Code OSS highlights numerous
errors in code files: for example, `'debug'` is incompatible with
`CloudUpdateLinkSourceType` expected by `goToUpgrade` here:
https://github.com/n8n-io/n8n/blob/3e7a4d3b2cc12fcb1b011fccd0773bb807986884/packages/editor-ui/src/composables/useExecutionDebugging.ts#L128
However, I'm not getting any errors during build. There is a `typecheck`
script defined in `package.json`, but `pnpm typecheck` fails with:
    ```
    n8n-toy-demo:~/projects/n8n/packages/editor-ui$ pnpm typecheck

> n8n-editor-ui@1.10.0 typecheck
/home/inga/projects/n8n/packages/editor-ui
    > vue-tsc --emitDeclarationOnly

error TS5069: Option 'emitDeclarationOnly' cannot be specified without
specifying
    option 'declaration' or option 'composite'.


    Found 1 error.

     ELIFECYCLE  Command failed with exit code 1.
    n8n-toy-demo:~/projects/n8n/packages/editor-ui$ 
    ```
Replacing `--emitDeclarationsOnly` with `--noEmit` in `package.json`
unblocks typechecking and results in seemingly, at first glance, correct
"Found 1924 errors in 306 files" (at least several of the reported
errors that I've checked seem to be correct).
But maybe I'm missing something and there are not in fact two thousands
type errors in `editor-ui`?
@github-actions github-actions bot mentioned this pull request Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants