@next-vibe/checker 1.0.11
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/.dist/LICENSE +674 -0
- package/.dist/README.md +458 -0
- package/.dist/bin/vibe-runtime.js +55482 -0
- package/.dist/bin/vibe-runtime.js.map +431 -0
- package/LICENSE +10 -0
- package/README.md +458 -0
- package/check.config.ts +989 -0
- package/package.json +129 -0
- package/src/config/constants.ts +9 -0
- package/src/config/debug.ts +30 -0
- package/src/config/env-client.ts +62 -0
- package/src/config/env.ts +59 -0
- package/src/config/i18n/de/index.ts +3 -0
- package/src/config/i18n/en/index.ts +60 -0
- package/src/config/i18n/pl/index.ts +3 -0
- package/src/i18n/core/config.ts +229 -0
- package/src/i18n/core/language-utils.ts +236 -0
- package/src/i18n/core/localization-utils.ts +422 -0
- package/src/i18n/core/scoped-translation.ts +120 -0
- package/src/i18n/core/shared-component.tsx +30 -0
- package/src/i18n/core/shared-translation-utils.ts +97 -0
- package/src/i18n/core/shared.ts +44 -0
- package/src/i18n/core/static-types.ts +72 -0
- package/src/i18n/core/translation-utils.ts +218 -0
- package/src/i18n/de/index.ts +8 -0
- package/src/i18n/en/index.ts +7 -0
- package/src/i18n/index.ts +100 -0
- package/src/i18n/pl/index.ts +7 -0
package/package.json
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@next-vibe/checker",
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"main": "./.dist/bin/vibe-runtime.js",
|
|
5
|
+
"author": "Max Brandstätter",
|
|
6
|
+
"description": "TypeScript code quality checker with CLI and MCP support",
|
|
7
|
+
"license": "GPL-3.0-only",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"packageManager": "bun@1.3.5",
|
|
10
|
+
"files": [
|
|
11
|
+
".dist/**/*",
|
|
12
|
+
"src/app/api/[locale]/system/check/**/*",
|
|
13
|
+
"src/app/api/[locale]/system/unified-interface/cli/**/*",
|
|
14
|
+
"src/app/api/[locale]/system/unified-interface/mcp/**/*",
|
|
15
|
+
"src/app/api/[locale]/system/unified-interface/shared/**/*",
|
|
16
|
+
"src/app/api/[locale]/system/unified-interface/tasks/**/*",
|
|
17
|
+
"src/app/api/[locale]/system/generators/**/*",
|
|
18
|
+
"src/app/api/[locale]/system/generated/**/*",
|
|
19
|
+
"src/app/api/[locale]/shared/**/*",
|
|
20
|
+
"src/i18n/**/*",
|
|
21
|
+
"src/config/**/*",
|
|
22
|
+
"check.config.ts"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"postinstall": "bun src/app/api/[locale]/system/unified-interface/cli/vibe-runtime.ts setup --force || echo 'Vibe setup failed - run manually if needed'",
|
|
26
|
+
"vibe": "bun src/app/api/[locale]/system/unified-interface/cli/vibe-runtime.ts",
|
|
27
|
+
"build": "bun run vibe builder",
|
|
28
|
+
"check": "bun run vibe check",
|
|
29
|
+
"lint": "echo redirecting to check && vibe check",
|
|
30
|
+
"typecheck": "echo redirecting to check && vibe check",
|
|
31
|
+
"mcp:test": "bunx @modelcontextprotocol/inspector bun src/app/api/[locale]/system/unified-interface/cli/vibe-runtime.ts mcp"
|
|
32
|
+
},
|
|
33
|
+
"contributors": [
|
|
34
|
+
{
|
|
35
|
+
"name": "Max Brandstaetter",
|
|
36
|
+
"email": "max@a42.ch"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Augment"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Claude Code"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "t3.chat"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "ChatGPT (fired)"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "Copilot (fired)"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "v0.dev (fired)"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "Devin (fired)"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "Cursor"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@inquirer/prompts": "8.1.0",
|
|
65
|
+
"argon2": "0.44.0",
|
|
66
|
+
"chalk": "5.6.2",
|
|
67
|
+
"commander": "14.0.2",
|
|
68
|
+
"date-fns": "4.1.0",
|
|
69
|
+
"dotenv": "17.2.3",
|
|
70
|
+
"eslint-plugin-i18next": "6.1.3",
|
|
71
|
+
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
72
|
+
"fs-extra": "^11.3.3",
|
|
73
|
+
"glob": "13.0.0",
|
|
74
|
+
"gradient-string": "3.0.0",
|
|
75
|
+
"jose": "6.1.3",
|
|
76
|
+
"jsonc-parser": "3.3.1",
|
|
77
|
+
"server-only": "0.0.1",
|
|
78
|
+
"typescript": "5.9.3",
|
|
79
|
+
"vite": "7.3.0",
|
|
80
|
+
"zod": "4.2.1"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@types/eslint-plugin-jsx-a11y": "6.10.1",
|
|
84
|
+
"@types/gradient-string": "1.1.6",
|
|
85
|
+
"@types/node": "25.0.3",
|
|
86
|
+
"@types/react": "~19.2.7",
|
|
87
|
+
"@types/react-dom": "~19.2.3",
|
|
88
|
+
"@types/supertest": "6.0.3",
|
|
89
|
+
"@types/webpack": "5.28.5",
|
|
90
|
+
"@typescript/native-preview": "7.0.0-dev.20251227.1",
|
|
91
|
+
"@vitejs/plugin-react": "5.1.2",
|
|
92
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
93
|
+
"@vitest/ui": "4.0.16",
|
|
94
|
+
"autoprefixer": "10.4.23",
|
|
95
|
+
"babel-preset-expo": "54.0.9",
|
|
96
|
+
"baseline-browser-mapping": "2.9.11",
|
|
97
|
+
"bun-types": "1.3.5",
|
|
98
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
99
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
100
|
+
"globals": "16.5.0",
|
|
101
|
+
"ignore-loader": "^0.1.2",
|
|
102
|
+
"oxlint": "1.35.0",
|
|
103
|
+
"typescript-eslint": "8.50.1",
|
|
104
|
+
"vite-tsconfig-paths": "6.0.3"
|
|
105
|
+
},
|
|
106
|
+
"bin": {
|
|
107
|
+
"vibe": ".dist/bin/vibe-runtime.js"
|
|
108
|
+
},
|
|
109
|
+
"keywords": [
|
|
110
|
+
"cli",
|
|
111
|
+
"typescript",
|
|
112
|
+
"react",
|
|
113
|
+
"nextjs",
|
|
114
|
+
"api",
|
|
115
|
+
"fullstack",
|
|
116
|
+
"framework"
|
|
117
|
+
],
|
|
118
|
+
"repository": {
|
|
119
|
+
"type": "git",
|
|
120
|
+
"url": "git+https://github.com/techfreaque/next-vibe.git"
|
|
121
|
+
},
|
|
122
|
+
"bugs": {
|
|
123
|
+
"url": "https://github.com/techfreaque/next-vibe/issues"
|
|
124
|
+
},
|
|
125
|
+
"homepage": "https://github.com/techfreaque/next-vibe#readme",
|
|
126
|
+
"engines": {
|
|
127
|
+
"node": ">=18.0.0"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const LOCALE_COOKIE_NAME = "locale";
|
|
2
|
+
export const LEAD_ID_COOKIE_NAME = "lead_id";
|
|
3
|
+
|
|
4
|
+
export const AUTH_TOKEN_COOKIE_MAX_AGE_DAYS = 30;
|
|
5
|
+
export const AUTH_TOKEN_COOKIE_MAX_AGE_SECONDS =
|
|
6
|
+
60 * 60 * 24 * AUTH_TOKEN_COOKIE_MAX_AGE_DAYS; // 30 days
|
|
7
|
+
export const AUTH_TOKEN_COOKIE_NAME = "token";
|
|
8
|
+
export const RESET_TOKEN_EXPIRY = 4; // hours
|
|
9
|
+
export const useTurbopack = true; // Set to true to use Turbopack, false for Webpack
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// use 'vibe dev -v' to enable debug logging
|
|
2
|
+
export let enableDebugLogger = false;
|
|
3
|
+
// use 'vibe dev -v' to enable middleware debug logging
|
|
4
|
+
export let debugMiddleware = false;
|
|
5
|
+
// set by the mcp server to disable all console output
|
|
6
|
+
export let mcpSilentMode = false;
|
|
7
|
+
// Shows the translation keys in the UI
|
|
8
|
+
export const translationsKeyMode = false;
|
|
9
|
+
// Speeds up the typecheck by 100x but disables translation typesafety
|
|
10
|
+
export const translationsKeyTypesafety = true;
|
|
11
|
+
|
|
12
|
+
// Form clearing behavior in development
|
|
13
|
+
export const clearFormsAfterSuccessInDev = false;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Used to enable debug mode at runtime via --verbose flag
|
|
17
|
+
* Should be called at startup
|
|
18
|
+
*/
|
|
19
|
+
export function enableDebug(): void {
|
|
20
|
+
enableDebugLogger = true;
|
|
21
|
+
debugMiddleware = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Used to enable MCP silent mode at runtime
|
|
26
|
+
* Disables ALL console output for MCP protocol compatibility
|
|
27
|
+
*/
|
|
28
|
+
export function enableMcpSilentMode(): void {
|
|
29
|
+
mcpSilentMode = true;
|
|
30
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Client Environment
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Environment } from "next-vibe/shared/utils/env-util";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
import { defineEnvClient } from "@/app/api/[locale]/system/unified-interface/shared/env/define-env-client";
|
|
9
|
+
|
|
10
|
+
const isServer = typeof window === "undefined";
|
|
11
|
+
const isBrowser = !isServer && typeof document !== "undefined";
|
|
12
|
+
|
|
13
|
+
export const platform = { isServer, isReactNative: false, isBrowser };
|
|
14
|
+
|
|
15
|
+
export const requireEnvs = false as const;
|
|
16
|
+
|
|
17
|
+
// Helper to create properly typed schemas based on requireEnvs
|
|
18
|
+
type RequireEnvs = typeof requireEnvs;
|
|
19
|
+
|
|
20
|
+
export function createSchema<T extends z.ZodTypeAny, U extends z.ZodTypeAny>(
|
|
21
|
+
required: T,
|
|
22
|
+
optional: U,
|
|
23
|
+
): RequireEnvs extends true ? T : U {
|
|
24
|
+
return (requireEnvs ? required : optional) as RequireEnvs extends true
|
|
25
|
+
? T
|
|
26
|
+
: U;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const { envClient } = defineEnvClient({
|
|
30
|
+
NODE_ENV: {
|
|
31
|
+
schema: createSchema(
|
|
32
|
+
z.enum(Environment),
|
|
33
|
+
z.enum(Environment).default(Environment.DEVELOPMENT),
|
|
34
|
+
),
|
|
35
|
+
value: process.env.NODE_ENV,
|
|
36
|
+
example: "development",
|
|
37
|
+
},
|
|
38
|
+
NEXT_PUBLIC_APP_URL: {
|
|
39
|
+
schema: createSchema(z.string().url(), z.string().optional()),
|
|
40
|
+
value: process.env.NEXT_PUBLIC_APP_URL,
|
|
41
|
+
example: "http://localhost:3000",
|
|
42
|
+
},
|
|
43
|
+
NEXT_PUBLIC_TEST_SERVER_URL: {
|
|
44
|
+
schema: createSchema(z.string(), z.string().optional()),
|
|
45
|
+
value: process.env.NEXT_PUBLIC_TEST_SERVER_URL,
|
|
46
|
+
example: "http://localhost:4000",
|
|
47
|
+
},
|
|
48
|
+
NEXT_PUBLIC_DEBUG_PRODUCTION: {
|
|
49
|
+
schema: createSchema(
|
|
50
|
+
z.string().transform((v) => v === "true"),
|
|
51
|
+
z
|
|
52
|
+
.string()
|
|
53
|
+
.optional()
|
|
54
|
+
.default("false")
|
|
55
|
+
.transform((v) => v === "true"),
|
|
56
|
+
),
|
|
57
|
+
value: process.env.NEXT_PUBLIC_DEBUG_PRODUCTION,
|
|
58
|
+
example: "false",
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export type EnvClient = typeof envClient;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Server Environment
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import "server-only";
|
|
6
|
+
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
import { Environment } from "@/app/api/[locale]/shared/utils/env-util";
|
|
10
|
+
import { defineEnv } from "@/app/api/[locale]/system/unified-interface/shared/env/define-env";
|
|
11
|
+
|
|
12
|
+
import { createSchema } from "./env-client";
|
|
13
|
+
|
|
14
|
+
export const { env } = defineEnv({
|
|
15
|
+
NODE_ENV: {
|
|
16
|
+
schema: createSchema(
|
|
17
|
+
z.enum(Environment),
|
|
18
|
+
z.enum(Environment).default(Environment.DEVELOPMENT),
|
|
19
|
+
),
|
|
20
|
+
example: "development",
|
|
21
|
+
},
|
|
22
|
+
PROJECT_ROOT: {
|
|
23
|
+
schema: z.string().optional(),
|
|
24
|
+
example: "/path/to/your/project",
|
|
25
|
+
},
|
|
26
|
+
NEXT_PUBLIC_APP_URL: {
|
|
27
|
+
schema: createSchema(z.string().url(), z.string().url().optional()),
|
|
28
|
+
example: "http://localhost:3000",
|
|
29
|
+
},
|
|
30
|
+
NEXT_PUBLIC_TEST_SERVER_URL: {
|
|
31
|
+
schema: createSchema(z.string().url(), z.string().url().optional()),
|
|
32
|
+
example: "http://localhost:4000",
|
|
33
|
+
},
|
|
34
|
+
DATABASE_URL: {
|
|
35
|
+
schema: createSchema(z.string().url(), z.string().url().optional()),
|
|
36
|
+
example: "postgres://localhost:5432/postgres",
|
|
37
|
+
comment: "Database",
|
|
38
|
+
},
|
|
39
|
+
JWT_SECRET_KEY: {
|
|
40
|
+
schema: createSchema(z.string().min(32), z.string().min(32).optional()),
|
|
41
|
+
example: "your-secret-key-min-32-chars!!",
|
|
42
|
+
comment: "JWT secret",
|
|
43
|
+
},
|
|
44
|
+
CRON_SECRET: {
|
|
45
|
+
schema: createSchema(z.string().min(1), z.string().min(1).optional()),
|
|
46
|
+
example: "your-cron-secret",
|
|
47
|
+
},
|
|
48
|
+
ENABLE_ANALYTICS: {
|
|
49
|
+
schema: createSchema(
|
|
50
|
+
z.string().transform((v) => v === "true"),
|
|
51
|
+
z
|
|
52
|
+
.string()
|
|
53
|
+
.optional()
|
|
54
|
+
.default("false")
|
|
55
|
+
.transform((v) => v === "true"),
|
|
56
|
+
),
|
|
57
|
+
example: "false",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const translations = {
|
|
2
|
+
appName: "unbottled.ai",
|
|
3
|
+
framework: "NextVibe.dev",
|
|
4
|
+
websiteUrl: "https://unbottled.ai",
|
|
5
|
+
group: {
|
|
6
|
+
name: "Unbottled.ai",
|
|
7
|
+
legalForm: "Limited Liability Company (LLC)",
|
|
8
|
+
registrationNumber: "REG-2024-UNBOTTLED-AI",
|
|
9
|
+
foundedYear: 2024,
|
|
10
|
+
jurisdiction: {
|
|
11
|
+
country: "Switzerland",
|
|
12
|
+
city: "Zurich",
|
|
13
|
+
},
|
|
14
|
+
address: {
|
|
15
|
+
title: "Address",
|
|
16
|
+
street: "123 AI Innovation Drive",
|
|
17
|
+
city: "San Francisco, CA 94105",
|
|
18
|
+
country: "United States",
|
|
19
|
+
addressIn1Line:
|
|
20
|
+
"123 AI Innovation Drive, San Francisco, CA 94105, United States",
|
|
21
|
+
},
|
|
22
|
+
responsiblePerson: {
|
|
23
|
+
name: "Chief Executive Officer",
|
|
24
|
+
},
|
|
25
|
+
contact: {
|
|
26
|
+
phone: "+1 (555) 123-4567",
|
|
27
|
+
telephone: "+1-555-0123",
|
|
28
|
+
title: "Contact",
|
|
29
|
+
description:
|
|
30
|
+
"If you have any questions about this Privacy Policy, please contact us at",
|
|
31
|
+
content:
|
|
32
|
+
"If you have any questions about these Terms of Service, please contact us at",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
emails: {
|
|
36
|
+
privacy: "privacy@unbottled.ai",
|
|
37
|
+
legal: "legal@unbottled.ai",
|
|
38
|
+
support: "support@unbottled.ai",
|
|
39
|
+
hello: "hello@unbottled.ai",
|
|
40
|
+
reports: "reports@unbottled.ai",
|
|
41
|
+
newsletter: "newsletter@unbottled.ai",
|
|
42
|
+
admin: "hi@unbottled.ai",
|
|
43
|
+
},
|
|
44
|
+
services: {
|
|
45
|
+
supportLevel: "24/7 Support",
|
|
46
|
+
},
|
|
47
|
+
social: {
|
|
48
|
+
twitterHandle: "@unbottled_ai",
|
|
49
|
+
twitterUrl: "https://twitter.com/unbottled_ai",
|
|
50
|
+
discordInvite: "https://discord.gg/unbottled",
|
|
51
|
+
linkedinUrl: "https://linkedin.com/company/unbottled",
|
|
52
|
+
facebookUrl: "https://facebook.com/unbottled",
|
|
53
|
+
instagramUrl: "https://instagram.com/unbottled",
|
|
54
|
+
},
|
|
55
|
+
timezone: {
|
|
56
|
+
PL: "Europe/Warsaw",
|
|
57
|
+
DE: "Europe/Berlin",
|
|
58
|
+
GLOBAL: "UTC",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// ----------------
|
|
2
|
+
// TYPES
|
|
3
|
+
|
|
4
|
+
import { allTranslations, languageConfig, languageDefaults } from "../../i18n";
|
|
5
|
+
|
|
6
|
+
// ----------------
|
|
7
|
+
export type Countries = keyof typeof languageConfig.countries;
|
|
8
|
+
export type Currencies = keyof typeof languageConfig.currencies;
|
|
9
|
+
export type Languages =
|
|
10
|
+
(typeof languageConfig.languages)[keyof typeof languageConfig.languages];
|
|
11
|
+
export type CountryLanguage = `${Languages}-${Countries}`;
|
|
12
|
+
|
|
13
|
+
export type TranslationSchema = typeof languageDefaults.translations;
|
|
14
|
+
|
|
15
|
+
export interface CountryInfo {
|
|
16
|
+
code: Countries;
|
|
17
|
+
name: string;
|
|
18
|
+
language: Languages;
|
|
19
|
+
langName: string;
|
|
20
|
+
flag: string;
|
|
21
|
+
currency: Currencies;
|
|
22
|
+
symbol: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Enum-like objects to replace the enums
|
|
26
|
+
|
|
27
|
+
export const Countries = languageConfig.countries;
|
|
28
|
+
export const CountriesArr = languageConfig.countriesArr;
|
|
29
|
+
|
|
30
|
+
export const Currencies = languageConfig.currencies;
|
|
31
|
+
export const CurrenciesArr = languageConfig.currenciesArr;
|
|
32
|
+
|
|
33
|
+
export const Languages = languageConfig.languages;
|
|
34
|
+
export const LanguagesArr = languageConfig.languagesArr;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Countries Options for select fields
|
|
38
|
+
* Maps country codes to translation keys for UI display
|
|
39
|
+
*/
|
|
40
|
+
export const CountriesOptions = [
|
|
41
|
+
{
|
|
42
|
+
value: Countries.GLOBAL,
|
|
43
|
+
label: "app.common.countries.global" as const,
|
|
44
|
+
},
|
|
45
|
+
{ value: Countries.DE, label: "app.common.countries.de" as const },
|
|
46
|
+
{ value: Countries.PL, label: "app.common.countries.pl" as const },
|
|
47
|
+
{ value: Countries.US, label: "app.common.countries.us" as const },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Languages Options for select fields
|
|
52
|
+
* Maps language codes to translation keys for UI display
|
|
53
|
+
*/
|
|
54
|
+
export const LanguagesOptions = [
|
|
55
|
+
{
|
|
56
|
+
value: Languages.EN,
|
|
57
|
+
label: "app.common.languages.en" as const,
|
|
58
|
+
},
|
|
59
|
+
{ value: Languages.DE, label: "app.common.languages.de" as const },
|
|
60
|
+
{ value: Languages.PL, label: "app.common.languages.pl" as const },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Country Filter Enum
|
|
65
|
+
* Includes all countries plus an "all" option for filtering
|
|
66
|
+
*/
|
|
67
|
+
export enum CountryFilter {
|
|
68
|
+
ALL = "all",
|
|
69
|
+
DE = "DE",
|
|
70
|
+
PL = "PL",
|
|
71
|
+
US = "US",
|
|
72
|
+
GLOBAL = "GLOBAL",
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Country Filter Options for select fields
|
|
77
|
+
* Includes "all" option for filtering scenarios
|
|
78
|
+
*/
|
|
79
|
+
export const CountryFilterOptions = [
|
|
80
|
+
{
|
|
81
|
+
value: CountryFilter.ALL,
|
|
82
|
+
label: "app.admin.leads.leads.admin.filters.countries.all" as const,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
value: CountryFilter.GLOBAL,
|
|
86
|
+
label: "app.admin.leads.leads.admin.filters.countries.global" as const,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
value: CountryFilter.DE,
|
|
90
|
+
label: "app.admin.leads.leads.admin.filters.countries.de" as const,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
value: CountryFilter.PL,
|
|
94
|
+
label: "app.admin.leads.leads.admin.filters.countries.pl" as const,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Language Filter Enum
|
|
100
|
+
* Includes common languages plus an "all" option for filtering
|
|
101
|
+
*/
|
|
102
|
+
export enum LanguageFilter {
|
|
103
|
+
ALL = "all",
|
|
104
|
+
EN = "en",
|
|
105
|
+
DE = "de",
|
|
106
|
+
PL = "pl",
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Language Filter Options for select fields
|
|
111
|
+
* Includes "all" option for filtering scenarios
|
|
112
|
+
*/
|
|
113
|
+
export const LanguageFilterOptions = [
|
|
114
|
+
{
|
|
115
|
+
value: LanguageFilter.ALL,
|
|
116
|
+
label: "app.admin.leads.leads.filter.all_languages" as const,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
value: LanguageFilter.EN,
|
|
120
|
+
label: "app.admin.leads.leads.admin.filters.languages.en" as const,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: LanguageFilter.DE,
|
|
124
|
+
label: "app.admin.leads.leads.admin.filters.languages.de" as const,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
value: LanguageFilter.PL,
|
|
128
|
+
label: "app.admin.leads.leads.admin.filters.languages.pl" as const,
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Convert country filter - handles CountryFilter and returns string or null
|
|
134
|
+
*/
|
|
135
|
+
export function convertCountryFilter(
|
|
136
|
+
country: CountryFilter | Countries | undefined,
|
|
137
|
+
): Countries | null {
|
|
138
|
+
if (!country || country === CountryFilter.ALL) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
return country as Countries;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Convert language filter - handles LanguageFilter and returns string or null
|
|
146
|
+
*/
|
|
147
|
+
export function convertLanguageFilter(
|
|
148
|
+
language: LanguageFilter | Languages | undefined,
|
|
149
|
+
): Languages | null {
|
|
150
|
+
if (!language || language === LanguageFilter.ALL) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return language as Languages;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Create a proper enum-like object for CountryLanguageValues that works with z.enum()
|
|
157
|
+
export const CountryLanguageValues = Object.values(
|
|
158
|
+
languageConfig.languages,
|
|
159
|
+
).reduce(
|
|
160
|
+
(acc, language) => {
|
|
161
|
+
Object.keys(languageConfig.countries).forEach((country) => {
|
|
162
|
+
const key: CountryLanguage = `${language as Languages}-${String(country) as Countries}`;
|
|
163
|
+
(acc as Record<string, CountryLanguage>)[key] = key;
|
|
164
|
+
});
|
|
165
|
+
return acc;
|
|
166
|
+
},
|
|
167
|
+
{} as { [K in CountryLanguage]: K },
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// Other useful exports
|
|
171
|
+
export const currencyByCountry = languageConfig.mappings.currencyByCountry;
|
|
172
|
+
export const translations = allTranslations;
|
|
173
|
+
export const defaultLocaleConfig = languageDefaults;
|
|
174
|
+
export const defaultLocale: CountryLanguage = `${languageDefaults.language}-${languageDefaults.country}`;
|
|
175
|
+
export const globalCountryInfo: CountryInfo = languageConfig.countryInfo
|
|
176
|
+
.GLOBAL as CountryInfo;
|
|
177
|
+
export const availableCountries: readonly CountryInfo[] = [
|
|
178
|
+
languageConfig.countryInfo.DE as CountryInfo,
|
|
179
|
+
languageConfig.countryInfo.PL as CountryInfo,
|
|
180
|
+
languageConfig.countryInfo.US as CountryInfo,
|
|
181
|
+
languageConfig.countryInfo.GLOBAL as CountryInfo,
|
|
182
|
+
];
|
|
183
|
+
export const availableLanguages = Object.values(languageConfig.languages);
|
|
184
|
+
|
|
185
|
+
export interface TranslationsConfig<TTranslationSchema> {
|
|
186
|
+
[key: string]: TTranslationSchema;
|
|
187
|
+
}
|
|
188
|
+
export interface LanguageConfig {
|
|
189
|
+
debug: boolean;
|
|
190
|
+
countries: {
|
|
191
|
+
[key: string]: string;
|
|
192
|
+
};
|
|
193
|
+
countriesArr: string[];
|
|
194
|
+
currencies: {
|
|
195
|
+
[key: string]: string;
|
|
196
|
+
};
|
|
197
|
+
currenciesArr: string[];
|
|
198
|
+
languages: {
|
|
199
|
+
[key: string]: string;
|
|
200
|
+
};
|
|
201
|
+
languagesArr: string[];
|
|
202
|
+
mappings: {
|
|
203
|
+
currencyByCountry: {
|
|
204
|
+
[key: string]: string;
|
|
205
|
+
};
|
|
206
|
+
languageByCountry: {
|
|
207
|
+
[key: string]: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
countryInfo: {
|
|
212
|
+
[key: string]: {
|
|
213
|
+
code: string;
|
|
214
|
+
name: string;
|
|
215
|
+
language: string;
|
|
216
|
+
langName: string;
|
|
217
|
+
flag: string;
|
|
218
|
+
currency: string;
|
|
219
|
+
symbol: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface LanguageDefaults<TTranslationSchema> {
|
|
225
|
+
country: string;
|
|
226
|
+
currency: string;
|
|
227
|
+
language: string;
|
|
228
|
+
translations: TTranslationSchema;
|
|
229
|
+
}
|