@n8n/frontend-module-inbox 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE.md +88 -0
  2. package/LICENSE_EE.md +27 -0
  3. package/README.md +61 -2
  4. package/biome.jsonc +4 -0
  5. package/eslint.config.mjs +4 -0
  6. package/package.json +72 -3
  7. package/src/__tests__/design-system-icons.test.ts +24 -0
  8. package/src/__tests__/setup.ts +4 -0
  9. package/src/components/InboxEmptyState.vue +86 -0
  10. package/src/components/InboxList.test.ts +289 -0
  11. package/src/components/InboxList.vue +195 -0
  12. package/src/components/InboxListItem.vue +208 -0
  13. package/src/components/InboxListSection.vue +168 -0
  14. package/src/composables/useReviewInboxSectionCollapse.test.ts +66 -0
  15. package/src/composables/useReviewInboxSectionCollapse.ts +42 -0
  16. package/src/inbox.api.ts +20 -0
  17. package/src/inbox.constants.ts +19 -0
  18. package/src/inbox.module.ts +55 -0
  19. package/src/inbox.routes.test.ts +140 -0
  20. package/src/inbox.routes.ts +49 -0
  21. package/src/inbox.store.test.ts +444 -0
  22. package/src/inbox.store.ts +305 -0
  23. package/src/index.ts +5 -0
  24. package/src/reviews/WorkflowReviewDetail.test.ts +647 -0
  25. package/src/reviews/WorkflowReviewDetail.vue +257 -0
  26. package/src/reviews/components/WorkflowReviewActivityFeed.test.ts +923 -0
  27. package/src/reviews/components/WorkflowReviewActivityFeed.vue +312 -0
  28. package/src/reviews/components/WorkflowReviewChangesList.test.ts +97 -0
  29. package/src/reviews/components/WorkflowReviewChangesList.vue +143 -0
  30. package/src/reviews/components/WorkflowReviewChangesSection.test.ts +331 -0
  31. package/src/reviews/components/WorkflowReviewChangesSection.vue +217 -0
  32. package/src/reviews/components/WorkflowReviewCommentComposer.test.ts +175 -0
  33. package/src/reviews/components/WorkflowReviewCommentComposer.vue +83 -0
  34. package/src/reviews/components/WorkflowReviewDecisionPopover.test.ts +288 -0
  35. package/src/reviews/components/WorkflowReviewDecisionPopover.vue +203 -0
  36. package/src/reviews/components/WorkflowReviewDetailMetadata.test.ts +206 -0
  37. package/src/reviews/components/WorkflowReviewDetailMetadata.vue +245 -0
  38. package/src/reviews/components/WorkflowReviewDetailTabs.decisionNote.test.ts +90 -0
  39. package/src/reviews/components/WorkflowReviewDetailTabs.test.ts +500 -0
  40. package/src/reviews/components/WorkflowReviewDetailTabs.vue +329 -0
  41. package/src/reviews/components/WorkflowReviewStatusDot.vue +67 -0
  42. package/src/reviews/components/_activity-card.scss +36 -0
  43. package/src/reviews/components/activity-entries/WorkflowReviewActivityActorAvatar.vue +50 -0
  44. package/src/reviews/components/activity-entries/WorkflowReviewActivityComment.test.ts +103 -0
  45. package/src/reviews/components/activity-entries/WorkflowReviewActivityComment.vue +116 -0
  46. package/src/reviews/components/activity-entries/WorkflowReviewActivityEventEntry.vue +361 -0
  47. package/src/reviews/components/activity-entries/WorkflowReviewActivityFallback.vue +49 -0
  48. package/src/reviews/components/activity-entries/WorkflowReviewActivityWorkflowLink.vue +36 -0
  49. package/src/reviews/components/activityEntryRegistry.ts +27 -0
  50. package/src/reviews/constants.ts +41 -0
  51. package/src/reviews/reviewActivity.store.test.ts +463 -0
  52. package/src/reviews/reviewActivity.store.ts +186 -0
  53. package/src/reviews/reviewDetail.store.test.ts +135 -0
  54. package/src/reviews/reviewDetail.store.ts +74 -0
  55. package/src/reviews/workflowReviewStatus.utils.ts +44 -0
  56. package/src/reviews/workflowReviews.api.ts +61 -0
  57. package/src/reviews/workflowReviews.utils.ts +18 -0
  58. package/src/self-healing/SelfHealingResultDetail.vue +19 -0
  59. package/src/views/InboxView.test.ts +568 -0
  60. package/src/views/InboxView.vue +260 -0
  61. package/stylelint.config.mjs +9 -0
  62. package/vite.config.ts +52 -0
package/LICENSE.md ADDED
@@ -0,0 +1,88 @@
1
+ # License
2
+
3
+ Portions of this software are licensed as follows:
4
+
5
+ - Content of branches other than the main branch (i.e. "master") are not licensed.
6
+ - Source code files that contain ".ee." in their filename or ".ee" in their dirname are NOT licensed under
7
+ the Sustainable Use License.
8
+ To use source code files that contain ".ee." in their filename or ".ee" in their dirname you must hold a
9
+ valid n8n Enterprise License specifically allowing you access to such source code files and as defined
10
+ in "LICENSE_EE.md".
11
+ - All third party components incorporated into the n8n Software are licensed under the original license
12
+ provided by the owner of the applicable component.
13
+ - Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
14
+ License" as defined below.
15
+
16
+ ## Sustainable Use License
17
+
18
+ Version 1.0
19
+
20
+ ### Acceptance
21
+
22
+ By using the software, you agree to all of the terms and conditions below.
23
+
24
+ ### Copyright License
25
+
26
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
27
+ to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
28
+ to the limitations below.
29
+
30
+ ### Limitations
31
+
32
+ You may use or modify the software only for your own internal business purposes or for non-commercial or
33
+ personal use. You may distribute the software or provide it to others only if you do so free of charge for
34
+ non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
35
+ the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
36
+
37
+ ### Patents
38
+
39
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
40
+ license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
41
+ subject to the limitations and conditions in this license. This license does not cover any patent claims that
42
+ you cause to be infringed by modifications or additions to the software. If you or your company make any
43
+ written claim that the software infringes or contributes to infringement of any patent, your patent license
44
+ for the software granted under these terms ends immediately. If your company makes such a claim, your patent
45
+ license ends immediately for work on behalf of your company.
46
+
47
+ ### Notices
48
+
49
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
50
+ terms. If you modify the software, you must include in any modified copies of the software a prominent notice
51
+ stating that you have modified the software.
52
+
53
+ ### No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in these terms.
56
+
57
+ ### Termination
58
+
59
+ If you use the software in violation of these terms, such use is not licensed, and your license will
60
+ automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
61
+ violation of this license no later than 30 days after you receive that notice, your license will be reinstated
62
+ retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
63
+ terms will cause your license to terminate automatically and permanently.
64
+
65
+ ### No Liability
66
+
67
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
68
+ not be liable to you for any damages arising out of these terms or the use or nature of the software, under
69
+ any kind of legal claim.
70
+
71
+ ### Definitions
72
+
73
+ The “licensor” is the entity offering these terms.
74
+
75
+ The “software” is the software the licensor makes available under these terms, including any portion of it.
76
+
77
+ “You” refers to the individual or entity agreeing to these terms.
78
+
79
+ “Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
80
+ all organizations that have control over, are under the control of, or are under common control with that
81
+ organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
82
+ management and policies by vote, contract, or otherwise. Control can be direct or indirect.
83
+
84
+ “Your license” is the license granted to you for the software under these terms.
85
+
86
+ “Use” means anything you do with the software requiring your license.
87
+
88
+ “Trademark” means trademarks, service marks, and similar rights.
package/LICENSE_EE.md ADDED
@@ -0,0 +1,27 @@
1
+ # The n8n Enterprise License (the “Enterprise License”)
2
+
3
+ Copyright (c) 2022-present n8n GmbH.
4
+
5
+ With regard to the n8n Software:
6
+
7
+ This software and associated documentation files (the "Software") may only be used in production, if
8
+ you (and any entity that you represent) hold a valid n8n Enterprise license corresponding to your
9
+ usage. Subject to the foregoing sentence, you are free to modify this Software and publish patches
10
+ to the Software. You agree that n8n and/or its licensors (as applicable) retain all right, title and
11
+ interest in and to all such modifications and/or patches, and all such modifications and/or patches
12
+ may only be used, copied, modified, displayed, distributed, or otherwise exploited with a valid n8n
13
+ Enterprise license for the corresponding usage. Notwithstanding the foregoing, you may copy and
14
+ modify the Software for development and testing purposes, without requiring a subscription. You
15
+ agree that n8n and/or its licensors (as applicable) retain all right, title and interest in and to
16
+ all such modifications. You are not granted any other rights beyond what is expressly stated herein.
17
+ Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense, and/or
18
+ sell the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
21
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
23
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ For all third party components incorporated into the n8n Software, those components are licensed
27
+ under the original license provided by the owner of the applicable component.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # @n8n/frontend-module-inbox
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The shared Inbox lists workflow reviews and saved Assistant results. Review details, comments, and decisions live in `src/reviews`. The editor supplies only the workflow diff renderer through the SDK component registry. Backend services keep their existing access rules and actions.
4
+
5
+ Open has two groups: Waiting for review and Authored by you. Assistant results go
6
+ in Waiting for review. Each group has its own cursor, Load more button, and retry.
7
+ Closed is a flat list with infinite scroll. Group collapse state persists per user.
8
+
9
+ Review decisions update the loaded rows and counts in place. Approving a selected
10
+ review opens the Closed tab, as before.
11
+
12
+ Self-healing detail UI remains gated by the disabled-by-default self-healing rollout. AST-1518 replaces the explicit unavailable detail state.
13
+
14
+ Frontend feature module. Consumed from source by the editor-ui shell through
15
+ `src/app/modules.manifest.ts`; there is no build step and no `dist`.
16
+
17
+ Read the full guide at `packages/@n8n/module-cli/frontend-module-guide.md`. It gives the
18
+ descriptor contract, the registration points and the known problems. This README gives a
19
+ summary only.
20
+
21
+ ```bash
22
+ pnpm turbo typecheck --filter=@n8n/frontend-module-inbox
23
+ pnpm turbo lint --filter=@n8n/frontend-module-inbox
24
+ pnpm turbo lint:styles --filter=@n8n/frontend-module-inbox
25
+ pnpm turbo test --filter=@n8n/frontend-module-inbox
26
+ ```
27
+
28
+ Go through turbo, not `pnpm --filter <pkg> typecheck`: this package is consumed
29
+ from source, and on a cold tree its platform dependencies have not been built
30
+ yet. Turbo builds them first; the bare pnpm form does not.
31
+
32
+ ## Import rules
33
+
34
+ - Depend on foundation and platform packages only (`@n8n/design-system`,
35
+ `@n8n/stores`, `@n8n/composables`, `@n8n/i18n`, `@n8n/rest-api-client`,
36
+ `@n8n/api-types`, `@n8n/permissions`, `@n8n/frontend-constants`, `n8n-workflow`,
37
+ `@n8n/frontend-module-sdk`). Never import another
38
+ `@n8n/frontend-module-*`, and never import `@/…` from the shell.
39
+ - `@n8n/stores` and `@n8n/composables` are **subpath-only** — import
40
+ `@n8n/stores/settings.store`, not `@n8n/stores`.
41
+ - The no-cross-module rule is currently a convention: the shared tsconfig base
42
+ omits sibling modules from `paths`, which blocks an accidental import but not
43
+ a deliberate one (declaring the dependency makes it typecheck clean). The
44
+ ESLint rule that actually enforces it is CAT-3692.
45
+
46
+ ## Adding UI
47
+
48
+ `vite.config.ts` already carries the three plugins a design-system consumer
49
+ needs, so a `.vue` file compiles in tests without further setup:
50
+
51
+ - `@vitejs/plugin-vue` — single-file components.
52
+ - `unplugin-icons` — the `~icons/lucide/*` virtual modules behind `N8nIcon`.
53
+ - `vite-svg-loader` — design-system's `custom/*.svg` icon components. Without
54
+ it an `.svg` import is a data-URI string, which Vue renders as a tag name.
55
+
56
+ `src/__tests__/design-system-icons.test.ts` renders one icon of each kind, so a
57
+ plugin dropped from `vite.config.ts` fails this package's own suite. Keep that
58
+ test while the module renders any design-system component.
59
+
60
+ SCSS goes in a scoped `<style lang="scss">` block, with tokens from
61
+ design-system — `stylelint.config.mjs` holds this package to the same rules the
62
+ shell uses. Route components must load lazily.
package/biome.jsonc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "../../../../node_modules/@biomejs/biome/configuration_schema.json",
3
+ "extends": ["../../../../biome.jsonc"]
4
+ }
@@ -0,0 +1,4 @@
1
+ import { defineConfig } from 'eslint/config';
2
+ import { frontendConfig } from '@n8n/eslint-config/frontend';
3
+
4
+ export default defineConfig(frontendConfig);
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@n8n/frontend-module-inbox",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "main": "src/index.ts",
6
+ "exports": {
7
+ ".": "./src/index.ts"
8
+ },
9
+ "dependencies": {
10
+ "@n8n/api-types": "1.45.0",
11
+ "@n8n/composables": "1.35.0",
12
+ "@n8n/design-system": "2.44.0",
13
+ "@n8n/frontend-module-sdk": "0.15.0",
14
+ "@n8n/i18n": "2.45.0",
15
+ "@n8n/rest-api-client": "2.45.0",
16
+ "@n8n/stores": "2.45.0",
17
+ "n8n-workflow": "2.45.0",
18
+ "pinia": "^2.2.4",
19
+ "reka-ui": "^2.5.0",
20
+ "vue": "^3.5.13",
21
+ "vue-router": "^4.5.0",
22
+ "@n8n/frontend-constants": "0.11.0",
23
+ "@vueuse/core": "^14.3.0",
24
+ "lodash": "4.18.1",
25
+ "vue-i18n": "^11.4.4"
26
+ },
27
+ "devDependencies": {
28
+ "@iconify/json": "^2.2.488",
29
+ "@n8n/eslint-config": "0.0.1",
30
+ "@n8n/frontend-test-utils": "0.1.0",
31
+ "@n8n/frontend-vite-config": "0.1.0",
32
+ "@n8n/playwright-janitor": "0.1.0",
33
+ "@n8n/stylelint-config": "0.0.1",
34
+ "@n8n/typescript-config": "1.12.0",
35
+ "@n8n/vitest-config": "1.24.0",
36
+ "@testing-library/jest-dom": "^6.6.3",
37
+ "@testing-library/vue": "^8.1.0",
38
+ "@vitejs/plugin-vue": "^6.0.8",
39
+ "eslint": "9.29.0",
40
+ "stylelint": "^16.23.0",
41
+ "typescript": "6.0.2",
42
+ "unplugin-icons": "^23.0.1",
43
+ "vite": "^8.0.2",
44
+ "vite-svg-loader": "5.1.0",
45
+ "vitest": "5.0.1",
46
+ "vue-tsc": "^2.2.8",
47
+ "@pinia/testing": "^0.1.6",
48
+ "@testing-library/user-event": "^14.6.1",
49
+ "@types/lodash": "4.17.17",
50
+ "@n8n/utils": "1.52.0"
51
+ },
52
+ "license": "SEE LICENSE IN LICENSE.md",
53
+ "homepage": "https://n8n.io",
54
+ "author": {
55
+ "name": "Jan Oberhauser",
56
+ "email": "jan@n8n.io"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/n8n-io/n8n.git"
61
+ },
62
+ "scripts": {
63
+ "clean": "rimraf .turbo",
64
+ "typecheck": "vue-tsc --noEmit",
65
+ "test": "vitest run",
66
+ "test:changed": "janitor test-scoped",
67
+ "test:dev": "vitest",
68
+ "lint": "eslint src --quiet",
69
+ "lint:fix": "eslint src --fix",
70
+ "lint:styles": "stylelint \"src/**/*.{scss,sass,vue}\" --cache --allow-empty-input",
71
+ "lint:styles:fix": "stylelint \"src/**/*.{scss,sass,vue}\" --fix --cache --allow-empty-input",
72
+ "format": "biome format --write . && prettier --write . --ignore-path ../../../../.prettierignore",
73
+ "format:check": "biome ci . && prettier --check . --ignore-path ../../../../.prettierignore"
74
+ }
6
75
  }
@@ -0,0 +1,24 @@
1
+ import { N8nIcon } from '@n8n/design-system';
2
+ import { render } from '@testing-library/vue';
3
+
4
+ /**
5
+ * A build-config test, not a feature test. `@n8n/design-system` is consumed from source, so its
6
+ * two icon mechanisms are this package's problem, and each package carries its own
7
+ * `vite.config.ts`. Both cases fail loudly when a plugin goes missing from that file:
8
+ *
9
+ * - `box` comes from `~icons/lucide/box`, which only `unplugin-icons` resolves.
10
+ * - `webhook` comes from `custom/webhook.svg`, which only `svgLoader` turns into a component.
11
+ * Without it the import is a data-URI string, which Vue renders as a tag name.
12
+ *
13
+ * Keep this test while the module renders any design-system component.
14
+ */
15
+ describe('design-system icons', () => {
16
+ it.each([
17
+ ['a lucide icon', 'box'],
18
+ ['a custom svg icon', 'webhook'],
19
+ ])('renders %s', (_case, icon) => {
20
+ const { container } = render(N8nIcon, { props: { icon } });
21
+
22
+ expect(container.querySelector('svg')).not.toBeNull();
23
+ });
24
+ });
@@ -0,0 +1,4 @@
1
+ // The shared frontend test harness: the jsdom environment, english messages, and a fresh pinia
2
+ // per test. It lives in `@n8n/frontend-test-utils` rather than in `@n8n/vitest-config`, because
3
+ // `@n8n/i18n` devDepends on the latter and importing i18n there closes a cycle in the turbo graph.
4
+ import '@n8n/frontend-test-utils/setup';
@@ -0,0 +1,86 @@
1
+ <script setup lang="ts">
2
+ import { N8nEmptyState, N8nLoading, type EmptyStateIconCards } from '@n8n/design-system';
3
+ import { useI18n } from '@n8n/i18n';
4
+ import { storeToRefs } from 'pinia';
5
+ import { computed } from 'vue';
6
+
7
+ import { useInboxStore } from '../inbox.store';
8
+
9
+ const store = useInboxStore();
10
+ const {
11
+ activeTab,
12
+ hasItems,
13
+ loading,
14
+ initialLoadFailed,
15
+ partial,
16
+ isEmpty,
17
+ openCount,
18
+ closedCount,
19
+ } = storeToRefs(store);
20
+ const i18n = useI18n();
21
+ const alertIcon = { type: 'icon', value: 'circle-alert' } as const;
22
+ const inboxIcon: EmptyStateIconCards = {
23
+ type: 'cards',
24
+ center: 'inbox',
25
+ sides: ['file-diff', 'git-branch', 'circle-check', 'list', 'message-square'],
26
+ };
27
+ const noSelectionHeading = computed(() => {
28
+ const count = activeTab.value === 'closed' ? closedCount.value : openCount.value;
29
+ if (count === null) return i18n.baseText(`inbox.items.${activeTab.value}`);
30
+ return i18n.baseText(`inbox.noSelection.title.${activeTab.value}`, {
31
+ adjustToNumber: count,
32
+ interpolate: { count: String(count) },
33
+ });
34
+ });
35
+ </script>
36
+
37
+ <template>
38
+ <N8nLoading v-if="loading" :loading="true" :rows="3" />
39
+ <div v-else :class="$style.emptyStateWrapper">
40
+ <N8nEmptyState
41
+ v-if="initialLoadFailed && !hasItems"
42
+ :class="$style.emptyState"
43
+ :icon="alertIcon"
44
+ :heading="i18n.baseText('workflowReviews.error.load')"
45
+ :button-text="i18n.baseText('generic.retry')"
46
+ @click:button="store.fetchActiveTab()"
47
+ />
48
+ <N8nEmptyState
49
+ v-else-if="partial && !hasItems"
50
+ :class="$style.emptyState"
51
+ :icon="alertIcon"
52
+ :heading="i18n.baseText('inbox.partial')"
53
+ :button-text="i18n.baseText('generic.retry')"
54
+ @click:button="store.refreshListAndSummary()"
55
+ />
56
+ <N8nEmptyState
57
+ v-else-if="isEmpty"
58
+ :class="$style.emptyState"
59
+ :icon="inboxIcon"
60
+ :heading="i18n.baseText(activeTab === 'open' ? 'inbox.empty.open' : 'inbox.empty.closed')"
61
+ :description="i18n.baseText(`inbox.empty.body.${activeTab}`)"
62
+ data-test-id="inbox-empty"
63
+ />
64
+ <N8nEmptyState
65
+ v-else-if="hasItems"
66
+ :class="$style.emptyState"
67
+ :icon="inboxIcon"
68
+ :heading="noSelectionHeading"
69
+ :description="i18n.baseText('inbox.noSelection.body')"
70
+ />
71
+ </div>
72
+ </template>
73
+
74
+ <style lang="scss" module>
75
+ .emptyStateWrapper {
76
+ display: flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ height: 100%;
80
+ }
81
+
82
+ .emptyStateWrapper .emptyState {
83
+ border: none;
84
+ padding: 0;
85
+ }
86
+ </style>