@shipfox/client-projects 25.0.0 → 26.0.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.
@@ -1,4 +0,0 @@
1
- export declare function ModelProviderReminderBanner({ workspaceId }: {
2
- workspaceId: string;
3
- }): import("react").JSX.Element | null;
4
- //# sourceMappingURL=model-provider-reminder-banner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-provider-reminder-banner.d.ts","sourceRoot":"","sources":["../../src/components/model-provider-reminder-banner.tsx"],"names":[],"mappings":"AAeA,wBAAgB,2BAA2B,CAAC,EAAC,WAAW,EAAC,EAAE;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,sCAqC/E"}
@@ -1,73 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useModelProviderConfigsQuery } from '@shipfox/client-agent';
3
- import { useActiveWorkspace } from '@shipfox/client-auth';
4
- import { createTypedBrowserStorage, sessionStorageOrUndefined } from '@shipfox/client-ui';
5
- import { Alert, AlertActions, AlertClose, AlertContent, AlertDescription, AlertTitle } from '@shipfox/react-ui/alert';
6
- import { Button } from '@shipfox/react-ui/button';
7
- import { Link } from '@tanstack/react-router';
8
- import { useState } from 'react';
9
- export function ModelProviderReminderBanner({ workspaceId }) {
10
- const workspace = useActiveWorkspace();
11
- const configsQuery = useModelProviderConfigsQuery(workspaceId);
12
- const [dismissed, setDismissed] = useState(()=>isReminderDismissed(workspaceId));
13
- const configs = configsQuery.data?.configs;
14
- const unconfigured = Array.isArray(configs) && configs.length === 0 && configsQuery.data?.defaultProviderId === null;
15
- if (!unconfigured || dismissed) return null;
16
- return /*#__PURE__*/ _jsxs(Alert, {
17
- variant: "info",
18
- animated: false,
19
- onOpenChange: (open)=>{
20
- if (!open) {
21
- dismissReminder(workspaceId);
22
- setDismissed(true);
23
- }
24
- },
25
- children: [
26
- /*#__PURE__*/ _jsxs(AlertContent, {
27
- className: "pr-[28px]",
28
- children: [
29
- /*#__PURE__*/ _jsx(AlertTitle, {
30
- children: "Finish setting up a model provider"
31
- }),
32
- /*#__PURE__*/ _jsx(AlertDescription, {
33
- children: "Add workspace credentials, or keep using the instance default."
34
- }),
35
- /*#__PURE__*/ _jsx(AlertActions, {
36
- children: /*#__PURE__*/ _jsx(Button, {
37
- asChild: true,
38
- size: "sm",
39
- variant: "secondary",
40
- children: /*#__PURE__*/ _jsx(Link, {
41
- to: "/w/$workspaceSlug/settings/agents",
42
- params: {
43
- workspaceSlug: workspace.slug
44
- },
45
- children: "Agents"
46
- })
47
- })
48
- })
49
- ]
50
- }),
51
- /*#__PURE__*/ _jsx(AlertClose, {})
52
- ]
53
- });
54
- }
55
- function isReminderDismissed(workspaceId) {
56
- return reminderStorage(workspaceId).read() === true;
57
- }
58
- function dismissReminder(workspaceId) {
59
- reminderStorage(workspaceId).write(true);
60
- }
61
- function reminderStorage(workspaceId) {
62
- return createTypedBrowserStorage(sessionStorageOrUndefined, {
63
- key: 'shipfox.modelProviderReminder.dismissed',
64
- lifetime: 'session',
65
- principalScope: 'workspace',
66
- serialize: (dismissed)=>JSON.stringify(dismissed),
67
- parse: (raw)=>raw === 'true'
68
- }, {
69
- workspaceId
70
- });
71
- }
72
-
73
- //# sourceMappingURL=model-provider-reminder-banner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/model-provider-reminder-banner.tsx"],"sourcesContent":["import {useModelProviderConfigsQuery} from '@shipfox/client-agent';\nimport {useActiveWorkspace} from '@shipfox/client-auth';\nimport {createTypedBrowserStorage, sessionStorageOrUndefined} from '@shipfox/client-ui';\nimport {\n Alert,\n AlertActions,\n AlertClose,\n AlertContent,\n AlertDescription,\n AlertTitle,\n} from '@shipfox/react-ui/alert';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Link} from '@tanstack/react-router';\nimport {useState} from 'react';\n\nexport function ModelProviderReminderBanner({workspaceId}: {workspaceId: string}) {\n const workspace = useActiveWorkspace();\n const configsQuery = useModelProviderConfigsQuery(workspaceId);\n const [dismissed, setDismissed] = useState(() => isReminderDismissed(workspaceId));\n const configs = configsQuery.data?.configs;\n const unconfigured =\n Array.isArray(configs) && configs.length === 0 && configsQuery.data?.defaultProviderId === null;\n\n if (!unconfigured || dismissed) return null;\n\n return (\n <Alert\n variant=\"info\"\n animated={false}\n onOpenChange={(open) => {\n if (!open) {\n dismissReminder(workspaceId);\n setDismissed(true);\n }\n }}\n >\n <AlertContent className=\"pr-[28px]\">\n <AlertTitle>Finish setting up a model provider</AlertTitle>\n <AlertDescription>\n Add workspace credentials, or keep using the instance default.\n </AlertDescription>\n <AlertActions>\n <Button asChild size=\"sm\" variant=\"secondary\">\n <Link to=\"/w/$workspaceSlug/settings/agents\" params={{workspaceSlug: workspace.slug}}>\n Agents\n </Link>\n </Button>\n </AlertActions>\n </AlertContent>\n <AlertClose />\n </Alert>\n );\n}\n\nfunction isReminderDismissed(workspaceId: string): boolean {\n return reminderStorage(workspaceId).read() === true;\n}\n\nfunction dismissReminder(workspaceId: string): void {\n reminderStorage(workspaceId).write(true);\n}\n\nfunction reminderStorage(workspaceId: string) {\n return createTypedBrowserStorage(\n sessionStorageOrUndefined,\n {\n key: 'shipfox.modelProviderReminder.dismissed',\n lifetime: 'session' as const,\n principalScope: 'workspace' as const,\n serialize: (dismissed: boolean) => JSON.stringify(dismissed),\n parse: (raw: string) => raw === 'true',\n },\n {workspaceId},\n );\n}\n"],"names":["useModelProviderConfigsQuery","useActiveWorkspace","createTypedBrowserStorage","sessionStorageOrUndefined","Alert","AlertActions","AlertClose","AlertContent","AlertDescription","AlertTitle","Button","Link","useState","ModelProviderReminderBanner","workspaceId","workspace","configsQuery","dismissed","setDismissed","isReminderDismissed","configs","data","unconfigured","Array","isArray","length","defaultProviderId","variant","animated","onOpenChange","open","dismissReminder","className","asChild","size","to","params","workspaceSlug","slug","reminderStorage","read","write","key","lifetime","principalScope","serialize","JSON","stringify","parse","raw"],"mappings":";AAAA,SAAQA,4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BAAgBzB,WAAmB;IAC1C,OAAOZ,0BACLC,2BACA;QACEuC,KAAK;QACLC,UAAU;QACVC,gBAAgB;QAChBC,WAAW,CAAC5B,YAAuB6B,KAAKC,SAAS,CAAC9B;QAClD+B,OAAO,CAACC,MAAgBA,QAAQ;IAClC,GACA;QAACnC;IAAW;AAEhB"}
@@ -1,75 +0,0 @@
1
- import {useModelProviderConfigsQuery} from '@shipfox/client-agent';
2
- import {useActiveWorkspace} from '@shipfox/client-auth';
3
- import {createTypedBrowserStorage, sessionStorageOrUndefined} from '@shipfox/client-ui';
4
- import {
5
- Alert,
6
- AlertActions,
7
- AlertClose,
8
- AlertContent,
9
- AlertDescription,
10
- AlertTitle,
11
- } from '@shipfox/react-ui/alert';
12
- import {Button} from '@shipfox/react-ui/button';
13
- import {Link} from '@tanstack/react-router';
14
- import {useState} from 'react';
15
-
16
- export function ModelProviderReminderBanner({workspaceId}: {workspaceId: string}) {
17
- const workspace = useActiveWorkspace();
18
- const configsQuery = useModelProviderConfigsQuery(workspaceId);
19
- const [dismissed, setDismissed] = useState(() => isReminderDismissed(workspaceId));
20
- const configs = configsQuery.data?.configs;
21
- const unconfigured =
22
- Array.isArray(configs) && configs.length === 0 && configsQuery.data?.defaultProviderId === null;
23
-
24
- if (!unconfigured || dismissed) return null;
25
-
26
- return (
27
- <Alert
28
- variant="info"
29
- animated={false}
30
- onOpenChange={(open) => {
31
- if (!open) {
32
- dismissReminder(workspaceId);
33
- setDismissed(true);
34
- }
35
- }}
36
- >
37
- <AlertContent className="pr-[28px]">
38
- <AlertTitle>Finish setting up a model provider</AlertTitle>
39
- <AlertDescription>
40
- Add workspace credentials, or keep using the instance default.
41
- </AlertDescription>
42
- <AlertActions>
43
- <Button asChild size="sm" variant="secondary">
44
- <Link to="/w/$workspaceSlug/settings/agents" params={{workspaceSlug: workspace.slug}}>
45
- Agents
46
- </Link>
47
- </Button>
48
- </AlertActions>
49
- </AlertContent>
50
- <AlertClose />
51
- </Alert>
52
- );
53
- }
54
-
55
- function isReminderDismissed(workspaceId: string): boolean {
56
- return reminderStorage(workspaceId).read() === true;
57
- }
58
-
59
- function dismissReminder(workspaceId: string): void {
60
- reminderStorage(workspaceId).write(true);
61
- }
62
-
63
- function reminderStorage(workspaceId: string) {
64
- return createTypedBrowserStorage(
65
- sessionStorageOrUndefined,
66
- {
67
- key: 'shipfox.modelProviderReminder.dismissed',
68
- lifetime: 'session' as const,
69
- principalScope: 'workspace' as const,
70
- serialize: (dismissed: boolean) => JSON.stringify(dismissed),
71
- parse: (raw: string) => raw === 'true',
72
- },
73
- {workspaceId},
74
- );
75
- }