@geenius/feedback 0.1.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.
- package/.changeset/config.json +11 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +11 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/ci.yml +23 -0
- package/.github/workflows/release.yml +29 -0
- package/.nvmrc +1 -0
- package/.project/ACCOUNT.yaml +4 -0
- package/.project/IDEAS.yaml +7 -0
- package/.project/PROJECT.yaml +11 -0
- package/.project/ROADMAP.yaml +15 -0
- package/CHANGELOG.md +8 -0
- package/CODE_OF_CONDUCT.md +16 -0
- package/CONTRIBUTING.md +26 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/SECURITY.md +15 -0
- package/SUPPORT.md +8 -0
- package/package.json +75 -0
- package/packages/convex/package.json +42 -0
- package/packages/convex/src/index.ts +3 -0
- package/packages/convex/src/mutations.ts +88 -0
- package/packages/convex/src/queries.ts +78 -0
- package/packages/convex/src/schema.ts +47 -0
- package/packages/convex/tsconfig.json +18 -0
- package/packages/convex/tsup.config.ts +17 -0
- package/packages/react/README.md +1 -0
- package/packages/react/package.json +49 -0
- package/packages/react/src/components/FeedbackCard.tsx +51 -0
- package/packages/react/src/components/FeedbackForm.tsx +43 -0
- package/packages/react/src/components/FeedbackWidget.tsx +32 -0
- package/packages/react/src/components/NPSSurvey.tsx +62 -0
- package/packages/react/src/components/index.ts +4 -0
- package/packages/react/src/hooks/index.ts +5 -0
- package/packages/react/src/hooks/useFeedback.ts +23 -0
- package/packages/react/src/hooks/useFeedbackAdmin.ts +24 -0
- package/packages/react/src/hooks/useFeedbackForm.ts +35 -0
- package/packages/react/src/hooks/useNPS.ts +26 -0
- package/packages/react/src/index.tsx +13 -0
- package/packages/react/src/pages/FeedbackAdminPage.tsx +71 -0
- package/packages/react/src/pages/FeedbackPublicPage.tsx +42 -0
- package/packages/react/src/pages/FeedbackWidgetPage.tsx +25 -0
- package/packages/react/src/pages/index.ts +3 -0
- package/packages/react/tsconfig.json +19 -0
- package/packages/react/tsup.config.ts +12 -0
- package/packages/react-css/README.md +1 -0
- package/packages/react-css/package.json +36 -0
- package/packages/react-css/src/components/index.ts +5 -0
- package/packages/react-css/src/components/index.tsx +107 -0
- package/packages/react-css/src/hooks/index.ts +2 -0
- package/packages/react-css/src/index.tsx +5 -0
- package/packages/react-css/src/pages/FeedbackAdminPage.tsx +112 -0
- package/packages/react-css/src/pages/FeedbackPage.tsx +76 -0
- package/packages/react-css/src/styles.css +281 -0
- package/packages/react-css/tsconfig.json +19 -0
- package/packages/react-css/tsup.config.ts +10 -0
- package/packages/shared/README.md +1 -0
- package/packages/shared/package.json +44 -0
- package/packages/shared/src/__tests__/feedback.test.ts +72 -0
- package/packages/shared/src/config.ts +49 -0
- package/packages/shared/src/index.ts +111 -0
- package/packages/shared/src/types.ts +59 -0
- package/packages/shared/tsconfig.json +18 -0
- package/packages/shared/tsup.config.ts +11 -0
- package/packages/shared/vitest.config.ts +4 -0
- package/packages/solidjs/README.md +1 -0
- package/packages/solidjs/package.json +45 -0
- package/packages/solidjs/src/components.tsx +72 -0
- package/packages/solidjs/src/index.tsx +3 -0
- package/packages/solidjs/src/primitives.ts +49 -0
- package/packages/solidjs/tsconfig.json +20 -0
- package/packages/solidjs/tsup.config.ts +12 -0
- package/packages/solidjs-css/README.md +1 -0
- package/packages/solidjs-css/package.json +32 -0
- package/packages/solidjs-css/src/index.tsx +4 -0
- package/packages/solidjs-css/src/pages/FeedbackAdminPage.tsx +78 -0
- package/packages/solidjs-css/src/pages/FeedbackPage.tsx +65 -0
- package/packages/solidjs-css/src/primitives/index.ts +1 -0
- package/packages/solidjs-css/src/styles.css +281 -0
- package/packages/solidjs-css/tsconfig.json +20 -0
- package/packages/solidjs-css/tsup.config.ts +10 -0
- package/pnpm-workspace.yaml +2 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "public",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @mxn2020
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
branches: [main]
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
check:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: pnpm/action-setup@v4
|
|
14
|
+
with:
|
|
15
|
+
version: 10
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version-file: '.nvmrc'
|
|
19
|
+
cache: 'pnpm'
|
|
20
|
+
- run: pnpm install --frozen-lockfile
|
|
21
|
+
- run: pnpm build
|
|
22
|
+
- run: pnpm lint
|
|
23
|
+
- run: pnpm test
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
|
|
6
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: pnpm/action-setup@v4
|
|
14
|
+
with:
|
|
15
|
+
version: 10
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version-file: '.nvmrc'
|
|
19
|
+
cache: 'pnpm'
|
|
20
|
+
registry-url: 'https://registry.npmjs.org'
|
|
21
|
+
- run: pnpm install --frozen-lockfile
|
|
22
|
+
- run: pnpm build
|
|
23
|
+
- uses: changesets/action@v1
|
|
24
|
+
with:
|
|
25
|
+
publish: pnpm changeset publish
|
|
26
|
+
version: pnpm changeset version
|
|
27
|
+
env:
|
|
28
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
name: geenius-feedback
|
|
2
|
+
description: "Geenius Feedback — User feedback collection for Convex apps (React + SolidJS)"
|
|
3
|
+
category: library
|
|
4
|
+
priority: high
|
|
5
|
+
tags:
|
|
6
|
+
- geenius
|
|
7
|
+
- npm-package
|
|
8
|
+
- react
|
|
9
|
+
- solidjs
|
|
10
|
+
deploy_url: null
|
|
11
|
+
npm_scope: "@geenius-feedback"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: "0.1"
|
|
2
|
+
milestones:
|
|
3
|
+
- name: "v0.1.0 — Initial Release"
|
|
4
|
+
status: in-progress
|
|
5
|
+
items:
|
|
6
|
+
- "Core shared types and logic"
|
|
7
|
+
- "React hooks and components"
|
|
8
|
+
- "SolidJS primitives"
|
|
9
|
+
- "npm publishing via Changesets"
|
|
10
|
+
- name: "v0.2.0 — Stability"
|
|
11
|
+
status: planned
|
|
12
|
+
items:
|
|
13
|
+
- "Test coverage ≥ 50%"
|
|
14
|
+
- "API documentation"
|
|
15
|
+
- "Convex adapter"
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
8
|
+
education, socio-economic status, nationality, personal appearance, race,
|
|
9
|
+
religion, or sexual identity and orientation.
|
|
10
|
+
|
|
11
|
+
## Enforcement
|
|
12
|
+
|
|
13
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
14
|
+
reported to the project team at conduct@geenius.app.
|
|
15
|
+
|
|
16
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Contributing to @geenius-feedback
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/mxn2020/geenius-feedback.git
|
|
9
|
+
cd geenius-feedback
|
|
10
|
+
pnpm install
|
|
11
|
+
pnpm build
|
|
12
|
+
pnpm test
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Pull Request Process
|
|
16
|
+
|
|
17
|
+
1. Fork the repo and create a feature branch from `main`
|
|
18
|
+
2. Add or update tests as appropriate
|
|
19
|
+
3. Run `pnpm changeset` to describe your changes for the changelog
|
|
20
|
+
4. Open a PR against `main`
|
|
21
|
+
|
|
22
|
+
## Code Style
|
|
23
|
+
|
|
24
|
+
- TypeScript strict mode
|
|
25
|
+
- ESLint + Prettier formatting
|
|
26
|
+
- Conventional commits preferred
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mehdi Nabhani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# ✦ geenius-feedback\n\n> Geenius Feedback — User feedback collection for Convex apps (React + SolidJS)\n\n---\n\n## Overview\nBuilt with Steve Jobs-level minimalism and Jony Ive-level craftsmanship, this package is designed to deliver unparalleled developer experience (DX) and rock-solid performance.\n\n## Installation\n\n```bash\npnpm add geenius-feedback\n```\n\n## Usage\n\n```typescript\nimport { init } from 'geenius-feedback';\n\n// Initialize the module with absolute precision\ninit({\n mode: 'premium',\n});\n```\n\n## Architecture\n- **Zero-config**: It just works.\n- **Strictly Typed**: Fully written in TypeScript for flawless IntelliSense.\n- **Framework Agnostic**: seamlessly integrates into the Geenius ecosystem.\n\n---\n\n*Designed by Antigravity HQ*\n
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | --------- |
|
|
7
|
+
| 0.x.x | ✅ |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
Please report security vulnerabilities by emailing **security@geenius.app**.
|
|
12
|
+
|
|
13
|
+
Do **not** open a public GitHub issue for security vulnerabilities.
|
|
14
|
+
|
|
15
|
+
We will acknowledge receipt within 48 hours and provide a detailed response within 5 business days.
|
package/SUPPORT.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Support
|
|
2
|
+
|
|
3
|
+
## Getting Help
|
|
4
|
+
|
|
5
|
+
- 📖 [Documentation](https://docs.geenius.app)
|
|
6
|
+
- 🐛 [Bug Reports](https://github.com/mxn2020/geenius-feedback/issues/new?template=bug_report.md)
|
|
7
|
+
- 💡 [Feature Requests](https://github.com/mxn2020/geenius-feedback/issues/new?template=feature_request.md)
|
|
8
|
+
- 📧 Email: support@geenius.app
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geenius/feedback",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Geenius Feedback — User feedback collection for Convex apps (React + SolidJS)",
|
|
6
|
+
"author": "Antigravity HQ",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/mxn2020/geenius-feedback.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"feedback",
|
|
14
|
+
"bug-reports",
|
|
15
|
+
"feature-requests",
|
|
16
|
+
"nps",
|
|
17
|
+
"convex",
|
|
18
|
+
"react",
|
|
19
|
+
"solidjs",
|
|
20
|
+
"geenius"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "pnpm -r --parallel type-check",
|
|
24
|
+
"build": "pnpm -r build",
|
|
25
|
+
"clean": "pnpm -r clean",
|
|
26
|
+
"lint": "pnpm -r --parallel type-check",
|
|
27
|
+
"test": "echo \"No tests configured yet\" && exit 0",
|
|
28
|
+
"type-check": "pnpm -r type-check",
|
|
29
|
+
"format": "prettier --write \"packages/*/src/**/*.{ts,tsx}\"",
|
|
30
|
+
"version:patch": "pnpm -r exec -- npm version patch --no-git-tag-version && npm version patch -m 'v%s'",
|
|
31
|
+
"version:minor": "pnpm -r exec -- npm version minor --no-git-tag-version && npm version minor -m 'v%s'",
|
|
32
|
+
"version:major": "pnpm -r exec -- npm version major --no-git-tag-version && npm version major -m 'v%s'",
|
|
33
|
+
"release": "git push && git push --tags",
|
|
34
|
+
"publish:all": "pnpm -r publish --access public"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"prettier": "^3.8.1",
|
|
38
|
+
"typescript": "~6.0.2"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20.0.0"
|
|
42
|
+
},
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./packages/shared/dist/index.d.ts",
|
|
46
|
+
"import": "./packages/shared/dist/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./shared": {
|
|
49
|
+
"types": "./packages/shared/dist/index.d.ts",
|
|
50
|
+
"import": "./packages/shared/dist/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./convex": {
|
|
53
|
+
"types": "./packages/convex/dist/index.d.ts",
|
|
54
|
+
"import": "./packages/convex/dist/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./react": {
|
|
57
|
+
"types": "./packages/react/dist/index.d.ts",
|
|
58
|
+
"import": "./packages/react/dist/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./react-css": {
|
|
61
|
+
"types": "./packages/react-css/dist/index.d.ts",
|
|
62
|
+
"import": "./packages/react-css/dist/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./solidjs": {
|
|
65
|
+
"types": "./packages/solidjs/dist/index.d.ts",
|
|
66
|
+
"import": "./packages/solidjs/dist/index.js"
|
|
67
|
+
},
|
|
68
|
+
"./solidjs-css": {
|
|
69
|
+
"types": "./packages/solidjs-css/dist/index.d.ts",
|
|
70
|
+
"import": "./packages/solidjs-css/dist/index.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"main": "./packages/shared/dist/index.js",
|
|
74
|
+
"types": "./packages/shared/dist/index.d.ts"
|
|
75
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geenius-feedback/convex",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Convex backend functions and schema for the Geenius Feedback system",
|
|
7
|
+
"author": "Antigravity HQ",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"type-check": "tsc --noEmit",
|
|
29
|
+
"prepublishOnly": "pnpm clean && pnpm build"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"convex": "^1.34.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"convex": "^1.34.0",
|
|
36
|
+
"tsup": "^8.5.1",
|
|
37
|
+
"typescript": "~6.0.2"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { mutation } from './_generated/server'
|
|
2
|
+
import { v } from 'convex/values'
|
|
3
|
+
|
|
4
|
+
export const submitFeedback = mutation({
|
|
5
|
+
args: {
|
|
6
|
+
type: v.union(v.literal('bug'), v.literal('feature'), v.literal('general'), v.literal('suggestion')),
|
|
7
|
+
title: v.string(), description: v.string(),
|
|
8
|
+
url: v.optional(v.string()), userId: v.optional(v.string()), userEmail: v.optional(v.string()),
|
|
9
|
+
userName: v.optional(v.string()), browser: v.optional(v.string()), os: v.optional(v.string()),
|
|
10
|
+
tags: v.optional(v.array(v.string())),
|
|
11
|
+
},
|
|
12
|
+
handler: async (ctx, args) => {
|
|
13
|
+
const now = new Date().toISOString()
|
|
14
|
+
return ctx.db.insert('feedback_items', {
|
|
15
|
+
...args, tags: args.tags ?? [], status: 'open', priority: 'medium',
|
|
16
|
+
votes: 0, createdAt: now, updatedAt: now,
|
|
17
|
+
})
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const updateFeedbackStatus = mutation({
|
|
22
|
+
args: {
|
|
23
|
+
feedbackId: v.id('feedback_items'),
|
|
24
|
+
status: v.union(v.literal('open'), v.literal('under-review'), v.literal('planned'), v.literal('in-progress'), v.literal('done'), v.literal('declined')),
|
|
25
|
+
adminNote: v.optional(v.string()),
|
|
26
|
+
},
|
|
27
|
+
handler: async (ctx, args) => {
|
|
28
|
+
const updates: Record<string, unknown> = { status: args.status, updatedAt: new Date().toISOString() }
|
|
29
|
+
if (args.adminNote !== undefined) updates.adminNote = args.adminNote
|
|
30
|
+
await ctx.db.patch(args.feedbackId, updates)
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export const updateFeedbackPriority = mutation({
|
|
35
|
+
args: {
|
|
36
|
+
feedbackId: v.id('feedback_items'),
|
|
37
|
+
priority: v.union(v.literal('low'), v.literal('medium'), v.literal('high'), v.literal('critical')),
|
|
38
|
+
},
|
|
39
|
+
handler: async (ctx, args) => {
|
|
40
|
+
await ctx.db.patch(args.feedbackId, { priority: args.priority, updatedAt: new Date().toISOString() })
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export const deleteFeedback = mutation({
|
|
45
|
+
args: { feedbackId: v.id('feedback_items') },
|
|
46
|
+
handler: async (ctx, args) => {
|
|
47
|
+
const votes = await ctx.db.query('feedback_votes').withIndex('by_feedbackId', q => q.eq('feedbackId', args.feedbackId)).collect()
|
|
48
|
+
for (const v of votes) await ctx.db.delete(v._id)
|
|
49
|
+
await ctx.db.delete(args.feedbackId)
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export const voteFeedback = mutation({
|
|
54
|
+
args: { feedbackId: v.id('feedback_items'), userId: v.string() },
|
|
55
|
+
handler: async (ctx, args) => {
|
|
56
|
+
const existing = await ctx.db.query('feedback_votes').withIndex('by_userId_feedbackId', q => q.eq('userId', args.userId).eq('feedbackId', args.feedbackId)).first()
|
|
57
|
+
if (existing) return
|
|
58
|
+
await ctx.db.insert('feedback_votes', { ...args, createdAt: new Date().toISOString() })
|
|
59
|
+
const item = await ctx.db.get(args.feedbackId)
|
|
60
|
+
if (item) await ctx.db.patch(args.feedbackId, { votes: item.votes + 1 })
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export const unvoteFeedback = mutation({
|
|
65
|
+
args: { feedbackId: v.id('feedback_items'), userId: v.string() },
|
|
66
|
+
handler: async (ctx, args) => {
|
|
67
|
+
const existing = await ctx.db.query('feedback_votes').withIndex('by_userId_feedbackId', q => q.eq('userId', args.userId).eq('feedbackId', args.feedbackId)).first()
|
|
68
|
+
if (!existing) return
|
|
69
|
+
await ctx.db.delete(existing._id)
|
|
70
|
+
const item = await ctx.db.get(args.feedbackId)
|
|
71
|
+
if (item) await ctx.db.patch(args.feedbackId, { votes: Math.max(0, item.votes - 1) })
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
export const submitNPS = mutation({
|
|
76
|
+
args: { score: v.number(), comment: v.optional(v.string()), userId: v.optional(v.string()) },
|
|
77
|
+
handler: async (ctx, args) => ctx.db.insert('nps_responses', { ...args, submittedAt: new Date().toISOString() }),
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
export const addAttachment = mutation({
|
|
81
|
+
args: { feedbackId: v.id('feedback_items'), url: v.string(), name: v.string(), size: v.number() },
|
|
82
|
+
handler: async (ctx, args) => {
|
|
83
|
+
const item = await ctx.db.get(args.feedbackId)
|
|
84
|
+
if (!item) throw new Error('Feedback not found')
|
|
85
|
+
const attachments = [...(item.attachments ?? []), { url: args.url, name: args.name, size: args.size }]
|
|
86
|
+
await ctx.db.patch(args.feedbackId, { attachments, updatedAt: new Date().toISOString() })
|
|
87
|
+
},
|
|
88
|
+
})
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { query } from './_generated/server'
|
|
2
|
+
import { v } from 'convex/values'
|
|
3
|
+
|
|
4
|
+
export const listFeedback = query({
|
|
5
|
+
args: {
|
|
6
|
+
type: v.optional(v.union(v.literal('bug'), v.literal('feature'), v.literal('general'), v.literal('suggestion'))),
|
|
7
|
+
status: v.optional(v.union(v.literal('open'), v.literal('under-review'), v.literal('planned'), v.literal('in-progress'), v.literal('done'), v.literal('declined'))),
|
|
8
|
+
priority: v.optional(v.union(v.literal('low'), v.literal('medium'), v.literal('high'), v.literal('critical'))),
|
|
9
|
+
limit: v.optional(v.number()),
|
|
10
|
+
},
|
|
11
|
+
handler: async (ctx, args) => {
|
|
12
|
+
const limit = args.limit ?? 100
|
|
13
|
+
let items
|
|
14
|
+
if (args.type) items = await ctx.db.query('feedback_items').withIndex('by_type', q => q.eq('type', args.type!)).order('desc').take(limit)
|
|
15
|
+
else if (args.status) items = await ctx.db.query('feedback_items').withIndex('by_status', q => q.eq('status', args.status!)).order('desc').take(limit)
|
|
16
|
+
else if (args.priority) items = await ctx.db.query('feedback_items').withIndex('by_priority', q => q.eq('priority', args.priority!)).order('desc').take(limit)
|
|
17
|
+
else items = await ctx.db.query('feedback_items').order('desc').take(limit)
|
|
18
|
+
return items
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const getFeedback = query({
|
|
23
|
+
args: { id: v.id('feedback_items') },
|
|
24
|
+
handler: async (ctx, args) => ctx.db.get(args.id),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const getFeedbackStats = query({
|
|
28
|
+
args: {},
|
|
29
|
+
handler: async (ctx) => {
|
|
30
|
+
const items = await ctx.db.query('feedback_items').collect()
|
|
31
|
+
const byType: Record<string, number> = { bug: 0, feature: 0, suggestion: 0, general: 0 }
|
|
32
|
+
const byStatus: Record<string, number> = { open: 0, 'under-review': 0, planned: 0, 'in-progress': 0, done: 0, declined: 0 }
|
|
33
|
+
for (const item of items) { byType[item.type]++; byStatus[item.status]++ }
|
|
34
|
+
return { total: items.length, byType, byStatus }
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export const listNPS = query({
|
|
39
|
+
args: { limit: v.optional(v.number()) },
|
|
40
|
+
handler: async (ctx, args) => ctx.db.query('nps_responses').order('desc').take(args.limit ?? 100),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
export const getNPSStats = query({
|
|
44
|
+
args: {},
|
|
45
|
+
handler: async (ctx) => {
|
|
46
|
+
const responses = await ctx.db.query('nps_responses').collect()
|
|
47
|
+
let promoters = 0, passives = 0, detractors = 0, totalScore = 0
|
|
48
|
+
for (const r of responses) {
|
|
49
|
+
totalScore += r.score
|
|
50
|
+
if (r.score >= 9) promoters++
|
|
51
|
+
else if (r.score >= 7) passives++
|
|
52
|
+
else detractors++
|
|
53
|
+
}
|
|
54
|
+
const total = responses.length
|
|
55
|
+
return {
|
|
56
|
+
averageScore: total > 0 ? Math.round((totalScore / total) * 10) / 10 : 0,
|
|
57
|
+
totalResponses: total, promoters, passives, detractors,
|
|
58
|
+
npsScore: total > 0 ? Math.round(((promoters - detractors) / total) * 100) : 0,
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
export const getUserVotes = query({
|
|
64
|
+
args: { userId: v.string() },
|
|
65
|
+
handler: async (ctx, args) => {
|
|
66
|
+
const votes = await ctx.db.query('feedback_votes').withIndex('by_userId_feedbackId', q => q.eq('userId', args.userId)).collect()
|
|
67
|
+
return votes.map(v => v.feedbackId)
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
export const searchFeedback = query({
|
|
72
|
+
args: { query: v.string() },
|
|
73
|
+
handler: async (ctx, args) => {
|
|
74
|
+
const items = await ctx.db.query('feedback_items').order('desc').collect()
|
|
75
|
+
const q = args.query.toLowerCase()
|
|
76
|
+
return items.filter(i => i.title.toLowerCase().includes(q) || i.description.toLowerCase().includes(q))
|
|
77
|
+
},
|
|
78
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from 'convex/server'
|
|
2
|
+
import { v } from 'convex/values'
|
|
3
|
+
|
|
4
|
+
export default defineSchema({
|
|
5
|
+
feedback_items: defineTable({
|
|
6
|
+
type: v.union(v.literal('bug'), v.literal('feature'), v.literal('general'), v.literal('suggestion')),
|
|
7
|
+
title: v.string(),
|
|
8
|
+
description: v.string(),
|
|
9
|
+
status: v.union(v.literal('open'), v.literal('under-review'), v.literal('planned'), v.literal('in-progress'), v.literal('done'), v.literal('declined')),
|
|
10
|
+
priority: v.union(v.literal('low'), v.literal('medium'), v.literal('high'), v.literal('critical')),
|
|
11
|
+
userId: v.optional(v.string()),
|
|
12
|
+
userEmail: v.optional(v.string()),
|
|
13
|
+
userName: v.optional(v.string()),
|
|
14
|
+
url: v.optional(v.string()),
|
|
15
|
+
browser: v.optional(v.string()),
|
|
16
|
+
os: v.optional(v.string()),
|
|
17
|
+
tags: v.array(v.string()),
|
|
18
|
+
votes: v.number(),
|
|
19
|
+
createdAt: v.string(),
|
|
20
|
+
updatedAt: v.string(),
|
|
21
|
+
attachments: v.optional(v.array(v.object({ url: v.string(), name: v.string(), size: v.number() }))),
|
|
22
|
+
adminNote: v.optional(v.string()),
|
|
23
|
+
})
|
|
24
|
+
.index('by_type', ['type'])
|
|
25
|
+
.index('by_status', ['status'])
|
|
26
|
+
.index('by_priority', ['priority'])
|
|
27
|
+
.index('by_userId', ['userId'])
|
|
28
|
+
.index('by_createdAt', ['createdAt']),
|
|
29
|
+
|
|
30
|
+
nps_responses: defineTable({
|
|
31
|
+
score: v.number(),
|
|
32
|
+
comment: v.optional(v.string()),
|
|
33
|
+
userId: v.optional(v.string()),
|
|
34
|
+
submittedAt: v.string(),
|
|
35
|
+
})
|
|
36
|
+
.index('by_userId', ['userId'])
|
|
37
|
+
.index('by_score', ['score'])
|
|
38
|
+
.index('by_submittedAt', ['submittedAt']),
|
|
39
|
+
|
|
40
|
+
feedback_votes: defineTable({
|
|
41
|
+
feedbackId: v.id('feedback_items'),
|
|
42
|
+
userId: v.string(),
|
|
43
|
+
createdAt: v.string(),
|
|
44
|
+
})
|
|
45
|
+
.index('by_feedbackId', ['feedbackId'])
|
|
46
|
+
.index('by_userId_feedbackId', ['userId', 'feedbackId']),
|
|
47
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"target": "ES2022",
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "bundler"
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"src"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: {
|
|
5
|
+
index: 'src/index.ts',
|
|
6
|
+
},
|
|
7
|
+
format: ['esm'],
|
|
8
|
+
dts: true,
|
|
9
|
+
clean: true,
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
external: [
|
|
12
|
+
'convex',
|
|
13
|
+
'convex/server',
|
|
14
|
+
'convex/values',
|
|
15
|
+
'convex/react',
|
|
16
|
+
],
|
|
17
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# ✦ @geenius-feedback/react\n\n> Geenius Feedback — React components & hooks\n\n---\n\n## Overview\nBuilt with Steve Jobs-level minimalism and Jony Ive-level craftsmanship, this package is designed to deliver unparalleled developer experience (DX) and rock-solid performance.\n\n## Installation\n\n```bash\npnpm add @geenius-feedback/react\n```\n\n## Usage\n\n```typescript\nimport { init } from '@geenius-feedback/react';\n\n// Initialize the module with absolute precision\ninit({\n mode: 'premium',\n});\n```\n\n## Architecture\n- **Zero-config**: It just works.\n- **Strictly Typed**: Fully written in TypeScript for flawless IntelliSense.\n- **Framework Agnostic**: seamlessly integrates into the Geenius ecosystem.\n\n---\n\n*Designed by Antigravity HQ*\n
|