@deepseek-ai/dsh-client-ui-settings-account 0.1.7-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.
package/lib/index.js ADDED
@@ -0,0 +1,28 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ //#region lib/types/contact-config.js
3
+ /** Public questionnaire deployment options shared by Host and Client. */
4
+ /** Validate public questionnaire options. */
5
+ const Config = z.object({
6
+ contactFormUrl: z.string().pattern(/^https:\/\/[^/\s]+\//).default("https://trtgsjkv6r.feishu.cn/share/base/form/shrcnhcHE4A6lQaQ3v0raCXmBAg"),
7
+ contactSource: z.string().default("")
8
+ });
9
+ /** Bootstrap key containing no account credentials. */
10
+ const CONTACT_CONFIG_GLOBAL = "__DSH_CONTACT_CONFIG__";
11
+ //#endregion
12
+ //#region lib/types/index.js
13
+ /**
14
+ * Publish public questionnaire options before browser plugins activate.
15
+ * @param ctx - Host context collecting page initialization data.
16
+ * @param config - validated deployment options.
17
+ */
18
+ function apply(ctx, config) {
19
+ ctx.on("webserver/index-inject", (table) => {
20
+ table.push({
21
+ kind: "global",
22
+ name: CONTACT_CONFIG_GLOBAL,
23
+ value: config
24
+ });
25
+ });
26
+ }
27
+ //#endregion
28
+ export { Config, apply };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Render a decorative avatar next to the account identity.
3
+ * @param props - profile picture URL; absent while signed out or loading.
4
+ * @returns picture or the default account icon.
5
+ */
6
+ export declare function AccountAvatar({ url }: {
7
+ url?: string | null | undefined;
8
+ }): import("react").JSX.Element;
9
+ //# sourceMappingURL=AccountAvatar.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { AccountSectionInjected } from './AccountSection.tsx';
3
+ /** Account launcher composed by the settings shell. */
4
+ export type AccountMenuProps = PropsRuntime<'settings.launcher'> & PropsLocale<'settings.account'> & InjectFace<AccountSectionInjected>;
5
+ /** The signed-in label stays empty while the profile loads.
6
+ * @param props - sidebar geometry, settings navigation and account operations.
7
+ * @returns account menu launcher.
8
+ */
9
+ export declare function AccountMenu({ wide, openSettings, openOnboarding, useAccount, signOut, contactUs, showLogin, start, cancel, t, }: AccountMenuProps): import("react").JSX.Element;
10
+ //# sourceMappingURL=AccountMenu.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { AccountSectionInjected } from './AccountSection.tsx';
3
+ /** @param props - onboarding completion, account state and actions. @returns account dialog while signed out. */
4
+ export declare function AccountOnboarding({ complete, useApiKey, useAccount, setOnboarding, showLogin, start, cancel, t }: PropsRuntime<'settings.models.sign-in'> & PropsLocale<'settings.account'> & InjectFace<AccountSectionInjected>): import("react").JSX.Element | null;
5
+ //# sourceMappingURL=AccountOnboarding.d.ts.map
@@ -0,0 +1,46 @@
1
+ import type { AccountDetails, AccountView, SignInAttemptId } from '@deepseek-ai/dsh-deepseek-account/types';
2
+ import type { PropsRuntime, PropsLocale, InjectFace, HostObservable } from '@deepseek-ai/dsh-client-ui-slots';
3
+ import { type PlatformBridge } from './PlatformOverlay.tsx';
4
+ /** Safe account snapshot shared by the settings page and launcher. */
5
+ export interface AccountSnapshot {
6
+ /** Latest Host state, absent until the stream responds. */
7
+ view: AccountView | undefined;
8
+ /** Sanitized profile and balance query outcomes, absent while loading. */
9
+ details: Partial<AccountDetails> | undefined;
10
+ /** Whether the state stream failed. */
11
+ failed: boolean;
12
+ /** Explicitly opened account dialog outside onboarding. */
13
+ loginVisible?: boolean;
14
+ /** Latest explicit start request failed before a Host state was available. */
15
+ loginFailed?: boolean;
16
+ /** Mounted onboarding owns the dialog while active. */
17
+ onboarding?: boolean;
18
+ }
19
+ /** Host operations injected into the Cordis-free account component. */
20
+ export interface AccountSectionInjected {
21
+ /** Desktop-only commands; absent in ordinary browsers. */
22
+ platform?: PlatformBridge;
23
+ /** Host-owned account stream observed through framework hooks. */
24
+ hooks: {
25
+ account: HostObservable<AccountSnapshot>;
26
+ };
27
+ /** @returns after account details are refreshed; concurrent refreshes share a request. */
28
+ refresh: () => Promise<void>;
29
+ /** Open the external support questionnaire with the current account and environment. */
30
+ contactUs: () => void;
31
+ /** Open or dismiss the login dialog. */
32
+ showLogin: (visible: boolean) => void;
33
+ /** Claim dialog ownership for the onboarding step. */
34
+ setOnboarding: (active: boolean) => void;
35
+ /** @returns after the login attempt is created. */
36
+ start: () => Promise<void>;
37
+ /** @param id - attempt to cancel. @returns after cancellation or an already-admitted commit. */
38
+ cancel: (id: SignInAttemptId) => Promise<void>;
39
+ /** @returns after local account credentials are removed. */
40
+ signOut: () => Promise<void>;
41
+ }
42
+ /** Composed account section props. */
43
+ export type AccountSectionProps = PropsRuntime<'settings.section'> & PropsLocale<'settings.account'> & InjectFace<AccountSectionInjected>;
44
+ /** @param props - localized actions and account subscription. @returns account settings UI. */
45
+ export declare function AccountSection({ t, useAccount, start, cancel, refresh, platform }: AccountSectionProps): import("react").JSX.Element;
46
+ //# sourceMappingURL=AccountSection.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Figma IcDsLogOutOutline16 glyph, stored inline for theme-aware rendering. */
2
+ /** @returns the account menu logout glyph. */
3
+ export declare function LogoutIcon(): import("react").JSX.Element;
4
+ //# sourceMappingURL=LogoutIcon.d.ts.map
@@ -0,0 +1,30 @@
1
+ /** Non-secret commands supplied by the desktop application preload. */
2
+ export interface PlatformBridge {
3
+ /** @param page - supported Platform destination. @param bounds - viewport rectangle. @returns after document load. */
4
+ open(this: void, page: 'usage' | 'top-up', bounds: {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ }): Promise<void>;
10
+ /** @param bounds - viewport rectangle. @returns after native bounds update. */
11
+ setBounds(this: void, bounds: {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ }): Promise<void>;
17
+ /** @returns after the native document is destroyed. */
18
+ close(this: void): Promise<void>;
19
+ }
20
+ /** @param props - native commands, localized copy, and return action. @returns full-window Platform container. */
21
+ export declare function PlatformOverlay({ bridge, page, backLabel, loadingLabel, failureLabel, retryLabel, onClose }: {
22
+ bridge: PlatformBridge;
23
+ page: 'usage' | 'top-up';
24
+ backLabel: string;
25
+ loadingLabel: string;
26
+ failureLabel: string;
27
+ retryLabel: string;
28
+ onClose: () => void;
29
+ }): import("react").ReactPortal;
30
+ //# sourceMappingURL=PlatformOverlay.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { AccountSnapshot } from './AccountSection.tsx';
2
+ import type { SignInAttemptId } from '@deepseek-ai/dsh-deepseek-account/types';
3
+ import type { AccountKey } from './locales.ts';
4
+ /** @param props - safe account state, localized copy, and user actions. @returns login dialog. */
5
+ export declare function SignInDialog({ account, start, cancel, close, useApiKey, t }: {
6
+ account: AccountSnapshot;
7
+ start: () => Promise<void>;
8
+ cancel: (id: SignInAttemptId) => Promise<void>;
9
+ close: () => void;
10
+ useApiKey: () => void;
11
+ t: (key: AccountKey) => string;
12
+ }): import("react").JSX.Element;
13
+ //# sourceMappingURL=SignInDialog.d.ts.map
@@ -0,0 +1,18 @@
1
+ /** Feishu questionnaire context follows the Platform Web ticket fields. */
2
+ import type { Config } from '../contact-config.ts';
3
+ import type { AccountProfile } from '@deepseek-ai/dsh-deepseek-account/types';
4
+ /**
5
+ * Build an external questionnaire URL without authentication credentials.
6
+ * @param config - questionnaire destination and supported source option.
7
+ * @param context - currently available account and browser environment.
8
+ * @returns questionnaire URL with hidden, optionally prefilled context fields.
9
+ */
10
+ export declare function contactUrl(config: Config, context: {
11
+ uid: AccountProfile['id'];
12
+ version: string | undefined;
13
+ locale: string;
14
+ width: number;
15
+ height: number;
16
+ pixelRatio: number;
17
+ }): string;
18
+ //# sourceMappingURL=contact-url.d.ts.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Format a balance using Platform Web's two-decimal and sub-cent display rules.
3
+ * @param amount - validated decimal balance string.
4
+ * @param symbol - currency symbol.
5
+ * @returns signed currency text with grouped digits.
6
+ */
7
+ export declare function formatBalance(amount: string, symbol: '¥' | '$'): string;
8
+ //# sourceMappingURL=formatBalance.d.ts.map
@@ -0,0 +1,17 @@
1
+ /** Desktop account settings registration and reconnecting Remote subscription. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import { type AccountKey } from './locales.ts';
4
+ export type { AccountSectionInjected, AccountSectionProps } from './AccountSection.tsx';
5
+ export type { AccountMenuProps } from './AccountMenu.tsx';
6
+ export type { AccountSnapshot } from './AccountSection.tsx';
7
+ export type { AccountKey } from './locales.ts';
8
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
9
+ interface LocaleNamespaceMap {
10
+ 'settings.account': AccountKey;
11
+ }
12
+ }
13
+ /** Services required by account settings. */
14
+ export declare const inject: string[];
15
+ /** Register account UI only in the Desktop renderer. @param ctx - client plugin context. */
16
+ export declare function apply(ctx: Context): void;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,53 @@
1
+ /** Account settings copy, owned by the account feature. */
2
+ export declare const en: {
3
+ readonly close: "Close";
4
+ readonly addApiKey: "Add API Key";
5
+ readonly retry: "Sign in again";
6
+ readonly loginTitle: "Start creating";
7
+ readonly loginDescription: "Sign in to create, edit, and share your design projects. Everything is saved locally.";
8
+ readonly browserTitle: "Waiting for sign in";
9
+ readonly browserPrompt: "Page did not open automatically? ";
10
+ readonly copyLink: "Copy sign-in link";
11
+ readonly copiedLink: "Link copied";
12
+ readonly copyFailed: "Copy failed";
13
+ readonly browserDescription: ", then open it in your browser to finish signing in.";
14
+ readonly timeoutTitle: "Sign in timed out";
15
+ readonly timeoutDescription: "Sign in again to continue.";
16
+ readonly failureTitle: "Could not sign in";
17
+ readonly platformFailed: "Could not complete the operation. Try again.";
18
+ readonly platformRetry: "Retry";
19
+ readonly loading: "Loading…";
20
+ readonly backToHarness: "Back to DeepSeek Harness";
21
+ readonly settings: "Settings";
22
+ readonly contactUs: "Contact us";
23
+ readonly menu: "Account menu";
24
+ readonly nav: "Account";
25
+ readonly signedIn: "Signed in to DeepSeek";
26
+ readonly signedOut: "Not signed in";
27
+ readonly signIn: "Sign in";
28
+ readonly signOut: "Sign out";
29
+ readonly cancel: "Cancel";
30
+ readonly open: "Open browser";
31
+ readonly initializing: "Starting sign in…";
32
+ readonly waiting: "Continue in your browser";
33
+ readonly completing: "Completing sign in…";
34
+ readonly expired: "Sign in expired. Try again.";
35
+ readonly failed: "Could not complete the operation. Try again.";
36
+ readonly settingsSignedOutTitle: "You are not signed in to DeepSeek Harness";
37
+ readonly settingsSignedOutDescription: "Sign in to DeepSeek Harness to get your dedicated API Key";
38
+ readonly signInDescription: "Use your DeepSeek account to get started.";
39
+ readonly profileUnavailable: "Account details are not available yet.";
40
+ readonly balance: "Recharge balance";
41
+ readonly bonusBalance: "Bonus balance";
42
+ readonly balanceUnavailable: "View on Platform";
43
+ readonly balanceSignedOut: "Sign in to view";
44
+ readonly accountInfo: "More account information";
45
+ readonly more: "More";
46
+ readonly usage: "View usage";
47
+ readonly topUp: "Top up";
48
+ };
49
+ /** Account locale keys. */
50
+ export type AccountKey = keyof typeof en;
51
+ /** Chinese account settings copy. */
52
+ export declare const zh: Record<AccountKey, string>;
53
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Public questionnaire deployment options shared by Host and Client. */
2
+ import z from '@deepseek-ai/schemastery';
3
+ /** Questionnaire destination and its supported source option. */
4
+ export interface Config {
5
+ /** HTTPS questionnaire URL; override for a test form. */
6
+ contactFormUrl: string;
7
+ /** Questionnaire source option; empty until Harness is supported by the form. */
8
+ contactSource: string;
9
+ }
10
+ /** Validate public questionnaire options. */
11
+ export declare const Config: z<Partial<Config>, Config>;
12
+ /** Bootstrap key containing no account credentials. */
13
+ export declare const CONTACT_CONFIG_GLOBAL = "__DSH_CONTACT_CONFIG__";
14
+ //# sourceMappingURL=contact-config.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** Host configuration for the account settings client. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import { type Config } from './contact-config.ts';
4
+ export { Config } from './contact-config.ts';
5
+ /**
6
+ * Publish public questionnaire options before browser plugins activate.
7
+ * @param ctx - Host context collecting page initialization data.
8
+ * @param config - validated deployment options.
9
+ */
10
+ export declare function apply(ctx: Context, config: Config): void;
11
+ //# sourceMappingURL=index.d.ts.map
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-client-ui-settings-account",
3
+ "description": "Manage DeepSeek login and open Platform billing pages",
4
+ "version": "0.1.7-alpha.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/client/ui-settings-account"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./client": {
22
+ "types": "./lib/types/client/index.d.ts",
23
+ "default": "./lib/client.js"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "dsh": {
29
+ "client": {
30
+ "inject": [
31
+ "@deepseek-ai/dsh-api-remotes",
32
+ "@deepseek-ai/dsh-client-ui-settings",
33
+ "@deepseek-ai/dsh-client-locale"
34
+ ],
35
+ "platform": "web"
36
+ }
37
+ },
38
+ "license": "MIT",
39
+ "peerDependencies": {
40
+ "@deepseek-ai/cordis": "^4.0.3"
41
+ },
42
+ "devDependencies": {
43
+ "@testing-library/react": "^16.1.0",
44
+ "@types/big.js": "^6.2.2",
45
+ "@types/react": "~18.3.1",
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0",
48
+ "@types/react-dom": "~18.3.0",
49
+ "big.js": "^7.0.1",
50
+ "@deepseek-ai/cordis": "^4.0.3",
51
+ "@deepseek-ai/dsh-api-remotes": "^0.1.7-alpha.1",
52
+ "@deepseek-ai/dsh-client-locale": "^0.1.7-alpha.1",
53
+ "@deepseek-ai/dsh-client-test-runtime": "^0.1.7-alpha.1",
54
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-alpha.1",
55
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.7-alpha.1",
56
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.7-alpha.1",
57
+ "@deepseek-ai/dsh-deepseek-account": "^0.1.7-alpha.1",
58
+ "@deepseek-ai/dsh-client-ui-settings-models": "^0.1.7-alpha.1",
59
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-alpha.1",
60
+ "@deepseek-ai/dsh-host-webserver": "^0.1.7-alpha.1"
61
+ },
62
+ "files": [
63
+ "lib/index.js",
64
+ "lib/client.js",
65
+ "lib/types/**/*.d.ts"
66
+ ],
67
+ "dependencies": {
68
+ "@deepseek-ai/schemastery": "^3.18.3"
69
+ },
70
+ "scripts": {
71
+ "bundle": "tsdown",
72
+ "watch": "tsdown --watch"
73
+ }
74
+ }