@cosmoops/connect-sdk 0.7.0 → 0.15.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/CHANGELOG.md +662 -0
- package/README.md +376 -124
- package/dist/cjs/cli/doctor.js +3 -3
- package/dist/cjs/cli/init.js +3 -3
- package/dist/cjs/client/components/access-gate.js +59 -5
- package/dist/cjs/client/components/ai-format.js +135 -0
- package/dist/cjs/client/components/ai-widgets.js +232 -0
- package/dist/cjs/client/components/app-shell.js +80 -45
- package/dist/cjs/client/components/apps-grid.js +3 -2
- package/dist/cjs/client/components/ask-ai.js +353 -0
- package/dist/cjs/client/components/confirm-dialog.js +40 -0
- package/dist/cjs/client/components/cursor-pagination.js +22 -0
- package/dist/cjs/client/components/filter-tabs.js +24 -0
- package/dist/cjs/client/components/grievance-notice.js +30 -0
- package/dist/cjs/client/components/link-button.js +17 -10
- package/dist/cjs/client/components/logo.js +4 -3
- package/dist/cjs/client/components/nav.js +42 -1
- package/dist/cjs/client/components/plan-pricing.js +27 -0
- package/dist/cjs/client/components/plans.js +1 -1
- package/dist/cjs/client/components/platform-gate.js +48 -0
- package/dist/cjs/client/components/shell-context.js +149 -0
- package/dist/cjs/client/components/side-nav.js +50 -24
- package/dist/cjs/client/components/sidebar.js +127 -0
- package/dist/cjs/client/components/subscribe-dialog.js +2 -2
- package/dist/cjs/client/components/subscription.js +1 -1
- package/dist/cjs/client/components/user-menu.js +122 -40
- package/dist/cjs/client/components/workspace-switcher.js +100 -0
- package/dist/cjs/client/components/workspace-type-gate.js +48 -0
- package/dist/cjs/client/index.js +98 -3
- package/dist/cjs/client/provider.js +100 -2
- package/dist/cjs/client/use-checkout.js +9 -5
- package/dist/cjs/errors.js +1 -1
- package/dist/cjs/index.js +11 -1
- package/dist/cjs/next/index.js +2 -2
- package/dist/cjs/server/client.js +25 -2
- package/dist/cjs/server/handler.js +237 -16
- package/dist/cjs/server/http.js +52 -26
- package/dist/cjs/server/resources/acting-as.js +16 -0
- package/dist/cjs/server/resources/ai.js +15 -2
- package/dist/cjs/server/resources/data.js +374 -0
- package/dist/cjs/server/resources/entitlements.js +41 -0
- package/dist/cjs/server/resources/identity.js +9 -3
- package/dist/cjs/server/resources/kv.js +84 -0
- package/dist/cjs/server/resources/platform.js +43 -0
- package/dist/cjs/server/resources/sessions.js +1 -1
- package/dist/cjs/server/resources/workspaces.js +74 -0
- package/dist/cjs/store.js +152 -0
- package/dist/cjs/ui/empty-state.js +28 -0
- package/dist/cjs/ui/index.js +44 -0
- package/dist/cjs/ui/page-header.js +27 -0
- package/dist/cjs/ui/page-shell.js +44 -0
- package/dist/cjs/ui/section.js +20 -0
- package/dist/cjs/ui/setting-row.js +14 -0
- package/dist/cjs/ui/status-chip.js +17 -0
- package/dist/esm/cli/doctor.js +3 -3
- package/dist/esm/cli/init.js +3 -3
- package/dist/esm/client/components/access-gate.js +60 -6
- package/dist/esm/client/components/ai-format.js +129 -0
- package/dist/esm/client/components/ai-widgets.js +223 -0
- package/dist/esm/client/components/app-shell.js +85 -50
- package/dist/esm/client/components/apps-grid.js +3 -2
- package/dist/esm/client/components/ask-ai.js +350 -0
- package/dist/esm/client/components/confirm-dialog.js +37 -0
- package/dist/esm/client/components/cursor-pagination.js +19 -0
- package/dist/esm/client/components/filter-tabs.js +21 -0
- package/dist/esm/client/components/grievance-notice.js +27 -0
- package/dist/esm/client/components/link-button.js +17 -10
- package/dist/esm/client/components/logo.js +4 -3
- package/dist/esm/client/components/nav.js +41 -1
- package/dist/esm/client/components/plan-pricing.js +25 -0
- package/dist/esm/client/components/plans.js +2 -2
- package/dist/esm/client/components/platform-gate.js +45 -0
- package/dist/esm/client/components/shell-context.js +141 -0
- package/dist/esm/client/components/side-nav.js +49 -22
- package/dist/esm/client/components/sidebar.js +120 -0
- package/dist/esm/client/components/subscribe-dialog.js +3 -3
- package/dist/esm/client/components/subscription.js +2 -2
- package/dist/esm/client/components/user-menu.js +121 -41
- package/dist/esm/client/components/workspace-switcher.js +97 -0
- package/dist/esm/client/components/workspace-type-gate.js +45 -0
- package/dist/esm/client/index.js +58 -5
- package/dist/esm/client/provider.js +94 -2
- package/dist/esm/client/use-checkout.js +9 -5
- package/dist/esm/errors.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/next/index.js +2 -2
- package/dist/esm/server/client.js +25 -2
- package/dist/esm/server/handler.js +237 -16
- package/dist/esm/server/http.js +52 -26
- package/dist/esm/server/resources/acting-as.js +13 -0
- package/dist/esm/server/resources/ai.js +15 -2
- package/dist/esm/server/resources/data.js +369 -0
- package/dist/esm/server/resources/entitlements.js +41 -0
- package/dist/esm/server/resources/identity.js +9 -3
- package/dist/esm/server/resources/kv.js +80 -0
- package/dist/esm/server/resources/platform.js +39 -0
- package/dist/esm/server/resources/sessions.js +1 -1
- package/dist/esm/server/resources/workspaces.js +70 -0
- package/dist/esm/store.js +141 -0
- package/dist/esm/ui/empty-state.js +25 -0
- package/dist/esm/ui/index.js +34 -0
- package/dist/esm/ui/page-header.js +24 -0
- package/dist/esm/ui/page-shell.js +41 -0
- package/dist/esm/ui/section.js +17 -0
- package/dist/esm/ui/setting-row.js +11 -0
- package/dist/esm/ui/status-chip.js +14 -0
- package/dist/theme.css +87 -0
- package/dist/types/client/components/access-gate.d.ts +17 -3
- package/dist/types/client/components/ai-format.d.ts +24 -0
- package/dist/types/client/components/ai-widgets.d.ts +42 -0
- package/dist/types/client/components/app-shell.d.ts +85 -31
- package/dist/types/client/components/apps-grid.d.ts +11 -2
- package/dist/types/client/components/ask-ai.d.ts +73 -0
- package/dist/types/client/components/confirm-dialog.d.ts +34 -0
- package/dist/types/client/components/cursor-pagination.d.ts +27 -0
- package/dist/types/client/components/filter-tabs.d.ts +26 -0
- package/dist/types/client/components/grievance-notice.d.ts +31 -0
- package/dist/types/client/components/link-button.d.ts +32 -9
- package/dist/types/client/components/logo.d.ts +18 -2
- package/dist/types/client/components/nav.d.ts +27 -3
- package/dist/types/client/components/plan-pricing.d.ts +10 -0
- package/dist/types/client/components/platform-gate.d.ts +53 -0
- package/dist/types/client/components/shell-context.d.ts +116 -0
- package/dist/types/client/components/side-nav.d.ts +28 -14
- package/dist/types/client/components/sidebar.d.ts +95 -0
- package/dist/types/client/components/user-menu.d.ts +70 -23
- package/dist/types/client/components/workspace-switcher.d.ts +49 -0
- package/dist/types/client/components/workspace-type-gate.d.ts +48 -0
- package/dist/types/client/index.d.ts +36 -7
- package/dist/types/client/provider.d.ts +149 -3
- package/dist/types/client/use-checkout.d.ts +8 -4
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/next/index.d.ts +1 -1
- package/dist/types/server/client.d.ts +25 -2
- package/dist/types/server/http.d.ts +14 -3
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/server/resources/acting-as.d.ts +11 -0
- package/dist/types/server/resources/ai.d.ts +9 -1
- package/dist/types/server/resources/data.d.ts +258 -0
- package/dist/types/server/resources/entitlements.d.ts +33 -1
- package/dist/types/server/resources/kv.d.ts +63 -0
- package/dist/types/server/resources/platform.d.ts +32 -0
- package/dist/types/server/resources/workspaces.d.ts +55 -0
- package/dist/types/store.d.ts +96 -0
- package/dist/types/types.d.ts +491 -13
- package/dist/types/ui/empty-state.d.ts +34 -0
- package/dist/types/ui/index.d.ts +40 -0
- package/dist/types/ui/page-header.d.ts +34 -0
- package/dist/types/ui/page-shell.d.ts +39 -0
- package/dist/types/ui/section.d.ts +26 -0
- package/dist/types/ui/setting-row.d.ts +18 -0
- package/dist/types/ui/status-chip.d.ts +36 -0
- package/package.json +13 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { ConnectPageHeader } from "./page-header.js";
|
|
3
|
+
export interface ConnectPageShellProps {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
clamp?: boolean;
|
|
8
|
+
/** Rendered above the header - a breadcrumb trail, a back link, a banner. */
|
|
9
|
+
above?: ReactNode;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The frame a page opens with: its vertical rhythm, its header, and the
|
|
14
|
+
* suspended regions beneath.
|
|
15
|
+
*
|
|
16
|
+
* **The header is a prop, so it renders in the static shell** - above and
|
|
17
|
+
* outside every `<Suspense>` boundary. That is the one bug this component
|
|
18
|
+
* exists to make unrepresentable: rendering the header inside the async child
|
|
19
|
+
* makes a page's own title wait on a data read, and under Next's partial
|
|
20
|
+
* prefetching the route's shared App Shell loses it as well. There is no
|
|
21
|
+
* arrangement of `children` that reaches the header slot.
|
|
22
|
+
*
|
|
23
|
+
* A detail route is the honest exception, and it has its own door:
|
|
24
|
+
* `ConnectPageShell.Header` renders the identical header from inside an async
|
|
25
|
+
* child, for a page whose title is data it does not have yet. Pair it with a
|
|
26
|
+
* skeleton header in the fallback. The rule is that a *static* title must
|
|
27
|
+
* never be made to wait, not that every title can be static.
|
|
28
|
+
*
|
|
29
|
+
* `space-y-5` is the page gap, owned here so it has exactly one definition.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ConnectPageShell({ title, description, action, clamp, above, children, }: Readonly<ConnectPageShellProps>): import("react").JSX.Element;
|
|
32
|
+
export declare namespace ConnectPageShell {
|
|
33
|
+
var Header: typeof ConnectPageHeader;
|
|
34
|
+
var Async: ({ fallback, children, }: Readonly<{
|
|
35
|
+
/** Omit where the region has nothing to draw while it waits. */
|
|
36
|
+
fallback?: ReactNode;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}>) => import("react").JSX.Element;
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface ConnectSectionProps {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
/** What the block is for. Omit when the title says everything. */
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
/** Rendered opposite the title. One control - a section has one action. */
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
/** Set to reference the heading from an `aria-labelledby` in the body. */
|
|
9
|
+
titleId?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
bodyClassName?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One titled block inside a page: a card, its heading, what it is for, and the
|
|
16
|
+
* one control that acts on it.
|
|
17
|
+
*
|
|
18
|
+
* The heading is an `h3` - `ConnectPageHeader` renders the page title as an
|
|
19
|
+
* `h2`, so a block *inside* a page is a level below it. Hand-rolled sections
|
|
20
|
+
* reliably use `h2`, which makes every settings block a sibling of the page it
|
|
21
|
+
* sits in and flattens the outline a screen reader announces.
|
|
22
|
+
*
|
|
23
|
+
* As in the page header, the action is a peer of the title rather than of the
|
|
24
|
+
* block, so its position does not move with the length of the description.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ConnectSection({ title, description, action, titleId, className, bodyClassName, children, }: Readonly<ConnectSectionProps>): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface ConnectSettingRowProps {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
/** The control this row is about - a switch, a button, a value with an edit link. */
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
/** Rendered under both, full width - a validation message, or a nested field the row reveals. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One labelled setting inside a `ConnectSection`.
|
|
13
|
+
*
|
|
14
|
+
* Stacks on a phone and goes side-by-side from `sm` up, rather than shrinking
|
|
15
|
+
* a two-column row until neither column is readable. The control keeps its
|
|
16
|
+
* intrinsic width so truncation lands on the description.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ConnectSettingRow({ title, description, action, children, className, }: Readonly<ConnectSettingRowProps>): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed set of tones a status may resolve to.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately five, and deliberately narrower than HeroUI's `Chip` colour
|
|
5
|
+
* union: a status is either fine, needs attention, is broken, is in progress,
|
|
6
|
+
* or is inert. A sixth tone would have to mean one of those five again, which
|
|
7
|
+
* is where hand-written status chips start disagreeing with each other.
|
|
8
|
+
*/
|
|
9
|
+
export type ConnectStatusTone = "success" | "warning" | "danger" | "accent" | "default";
|
|
10
|
+
/**
|
|
11
|
+
* How one domain's status union is presented: a tone and a human label per
|
|
12
|
+
* member.
|
|
13
|
+
*
|
|
14
|
+
* Both are **total** `Record`s, and that is the load-bearing property - adding
|
|
15
|
+
* a member to the status union fails the type gate until it has been given a
|
|
16
|
+
* presentation. A loose `Record<string, …>` map silently renders the new
|
|
17
|
+
* status as `undefined`.
|
|
18
|
+
*/
|
|
19
|
+
export interface ConnectStatusPresentation<TStatus extends string> {
|
|
20
|
+
readonly tone: Readonly<Record<TStatus, ConnectStatusTone>>;
|
|
21
|
+
readonly label: Readonly<Record<TStatus, string>>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One status, rendered the way every status should be.
|
|
25
|
+
*
|
|
26
|
+
* Domain knowledge stays in the domain: each caller exports its own
|
|
27
|
+
* `ConnectStatusPresentation` next to the union it describes, and this renders
|
|
28
|
+
* it. A status whose *rendering* carries real logic - a scheduled cancellation
|
|
29
|
+
* outranking a running trial, say - keeps its own component and calls this for
|
|
30
|
+
* the final chip. A map cannot express precedence.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ConnectStatusChip<TStatus extends string>({ status, presentation, className, }: Readonly<{
|
|
33
|
+
status: TStatus;
|
|
34
|
+
presentation: ConnectStatusPresentation<TStatus>;
|
|
35
|
+
className?: string;
|
|
36
|
+
}>): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmoops/connect-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Official server-side SDK for the CosmoOps Connect platform API - Login with Connect, entitlements, billing and metering.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"import": "./dist/esm/client/index.js",
|
|
37
37
|
"require": "./dist/cjs/client/index.js"
|
|
38
38
|
},
|
|
39
|
+
"./ui": {
|
|
40
|
+
"types": "./dist/types/ui/index.d.ts",
|
|
41
|
+
"import": "./dist/esm/ui/index.js",
|
|
42
|
+
"require": "./dist/cjs/ui/index.js"
|
|
43
|
+
},
|
|
39
44
|
"./theme.css": "./dist/theme.css",
|
|
40
45
|
"./package.json": "./package.json"
|
|
41
46
|
},
|
|
@@ -67,12 +72,12 @@
|
|
|
67
72
|
"verify:pack": "bun run scripts/verify-pack.ts",
|
|
68
73
|
"prepublishOnly": "bun run build && bun run verify:pack",
|
|
69
74
|
"test": "bun test",
|
|
70
|
-
"docs": "typedoc",
|
|
71
75
|
"docs:md": "typedoc --options typedoc.markdown.json",
|
|
72
76
|
"storybook": "storybook dev -p 6106",
|
|
73
77
|
"build:storybook": "storybook build -o storybook-static"
|
|
74
78
|
},
|
|
75
79
|
"devDependencies": {
|
|
80
|
+
"@connect/ai": "workspace:*",
|
|
76
81
|
"@connect/data": "workspace:*",
|
|
77
82
|
"@heroui/react": "^3.2.2",
|
|
78
83
|
"@heroui/styles": "^3.2.2",
|
|
@@ -87,6 +92,7 @@
|
|
|
87
92
|
"react": "19.2.8",
|
|
88
93
|
"react-dom": "19.2.8",
|
|
89
94
|
"storybook": "^10.5.10",
|
|
95
|
+
"streamdown": "^2.5.0",
|
|
90
96
|
"tailwindcss": "^4.3.3",
|
|
91
97
|
"typedoc": "^0.28.20",
|
|
92
98
|
"typedoc-plugin-markdown": "^4.12.0",
|
|
@@ -98,7 +104,8 @@
|
|
|
98
104
|
"lucide-react": ">=0.400.0",
|
|
99
105
|
"motion": ">=12",
|
|
100
106
|
"react": ">=19",
|
|
101
|
-
"react-dom": ">=19"
|
|
107
|
+
"react-dom": ">=19",
|
|
108
|
+
"streamdown": ">=2.5.0"
|
|
102
109
|
},
|
|
103
110
|
"peerDependenciesMeta": {
|
|
104
111
|
"@heroui/react": {
|
|
@@ -115,6 +122,9 @@
|
|
|
115
122
|
},
|
|
116
123
|
"react-dom": {
|
|
117
124
|
"optional": true
|
|
125
|
+
},
|
|
126
|
+
"streamdown": {
|
|
127
|
+
"optional": true
|
|
118
128
|
}
|
|
119
129
|
}
|
|
120
130
|
}
|