@desktalk/miniapp-preference 0.1.0-alpha.1

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.
@@ -0,0 +1,19 @@
1
+ {
2
+ "packageName": "@desktalk/miniapp-preference",
3
+ "packageScope": "preference",
4
+ "locales": [
5
+ "zh-CN"
6
+ ],
7
+ "messages": [
8
+ {
9
+ "key": "notifications.resetAll",
10
+ "defaultText": "All settings have been reset to defaults.",
11
+ "placeholders": []
12
+ },
13
+ {
14
+ "key": "notifications.restartRequired",
15
+ "defaultText": "This change requires a restart to take effect.",
16
+ "placeholders": []
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "notifications.resetAll": "所有设置都已恢复为默认值。",
3
+ "notifications.restartRequired": "此更改需要重启后生效。"
4
+ }
package/dist/meta.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "iconFile": "icons/miniapp-preference-icon.png"
3
+ }
@@ -0,0 +1,55 @@
1
+ export interface PreferenceSchema {
2
+ key: string;
3
+ label: string;
4
+ description: string;
5
+ type: 'string' | 'number' | 'boolean';
6
+ default: string | number | boolean;
7
+ options?: string[];
8
+ min?: number;
9
+ max?: number;
10
+ category: string;
11
+ requiresRestart?: boolean;
12
+ sensitive?: boolean;
13
+ }
14
+ export type Config = Record<string, string | number | boolean>;
15
+ export declare const CATEGORIES: readonly ["General", "Server", "AI", "Voice"];
16
+ export type Category = (typeof CATEGORIES)[number];
17
+ export interface AiProviderDefinition {
18
+ id: string;
19
+ label: string;
20
+ supportsApiKey: boolean;
21
+ supportsBaseUrl: boolean;
22
+ }
23
+ export interface VoiceProviderDefinition {
24
+ id: string;
25
+ label: string;
26
+ supportsApiKey: boolean;
27
+ supportsBaseUrl: boolean;
28
+ supportsModel: boolean;
29
+ supportsAzureDeployment: boolean;
30
+ supportsAzureApiVersion: boolean;
31
+ }
32
+ export declare const DEFAULT_AI_PROVIDER_ID = "openai";
33
+ export declare const AI_PROVIDER_DEFINITIONS: AiProviderDefinition[];
34
+ export declare const DEFAULT_VOICE_PROVIDER_ID = "openai-whisper";
35
+ export declare const VOICE_PROVIDER_DEFINITIONS: VoiceProviderDefinition[];
36
+ export declare function getAiProviderDefinition(providerId: string): AiProviderDefinition | undefined;
37
+ export declare function getAiProviderConfigKeys(providerId: string): string[];
38
+ export declare function parseAiEnabledProviders(value: unknown): string[];
39
+ export declare function serializeAiEnabledProviders(providerIds: string[]): string;
40
+ export declare function hasAiProviderConfig(config: Config, providerId: string): boolean;
41
+ export declare function getVoiceProviderDefinition(providerId: string): VoiceProviderDefinition | undefined;
42
+ export declare function getVoiceProviderConfigKeys(providerId: string): string[];
43
+ export declare function parseVoiceEnabledProviders(value: unknown): string[];
44
+ export declare function serializeVoiceEnabledProviders(providerIds: string[]): string;
45
+ export declare function hasVoiceProviderConfig(config: Config, providerId: string): boolean;
46
+ export declare const PREFERENCE_SCHEMAS: PreferenceSchema[];
47
+ /** Build the default config from schemas */
48
+ export declare function getDefaultConfig(): Config;
49
+ /** Find schema by key */
50
+ export declare function getSchema(key: string): PreferenceSchema | undefined;
51
+ /** Get all schemas for a category */
52
+ export declare function getSchemasByCategory(category: string): PreferenceSchema[];
53
+ /** Mask a sensitive value — show only last 4 characters */
54
+ export declare function maskSensitive(value: string): string;
55
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC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,CAEzE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAK/E;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GACjB,uBAAuB,GAAG,SAAS,CAErC;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBvE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAanE;AAED,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,CAE5E;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAKlF;AAgKD,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAsFhD,CAAC;AAEF,4CAA4C;AAC5C,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC;AAED,yBAAyB;AACzB,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEnE;AAED,qCAAqC;AACrC,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAEzE;AAED,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnD"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@desktalk/miniapp-preference",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "Preferences MiniApp for DeskTalk.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/vincentdchan/DeskTalk.git",
10
+ "directory": "packages/miniapp-preference"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "icon": "./icons/miniapp-preference-icon.png",
16
+ "files": [
17
+ "dist",
18
+ "icons"
19
+ ],
20
+ "exports": {
21
+ "./backend": {
22
+ "types": "./dist/backend.d.ts",
23
+ "import": "./dist/backend.js"
24
+ },
25
+ "./frontend": {
26
+ "types": "./dist/frontend.d.ts",
27
+ "import": "./dist/frontend.js"
28
+ }
29
+ },
30
+ "dependencies": {
31
+ "react": "^19.0.0",
32
+ "react-dom": "^19.0.0",
33
+ "@desktalk/sdk": "0.1.0-alpha.1"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "^5.7.0",
37
+ "@types/react": "^19.0.0",
38
+ "@types/react-dom": "^19.0.0",
39
+ "@desktalk/ui": "0.1.0-alpha.1"
40
+ },
41
+ "scripts": {
42
+ "build": "desktalk-build",
43
+ "clean": "rm -rf dist"
44
+ }
45
+ }