@cosmoops/connect-sdk 0.2.0 → 0.6.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 +125 -0
- package/README.md +284 -7
- package/dist/cjs/cli/doctor.js +209 -0
- package/dist/cjs/cli/init.js +20 -8
- package/dist/cjs/client/components/access-gate.js +162 -0
- package/dist/cjs/client/components/account-sessions.js +21 -19
- package/dist/cjs/client/components/app-shell.js +157 -0
- package/dist/cjs/client/components/apps-grid.js +2 -1
- package/dist/cjs/client/components/integrations-modal.js +95 -0
- package/dist/cjs/client/components/motion.js +27 -0
- package/dist/cjs/client/components/nav.js +97 -0
- package/dist/cjs/client/components/plans.js +39 -37
- package/dist/cjs/client/components/readiness.js +3 -1
- package/dist/cjs/client/components/side-nav.js +58 -0
- package/dist/cjs/client/components/subscription.js +2 -1
- package/dist/cjs/client/components/surfaces.js +54 -0
- package/dist/cjs/client/components/usage-meter.js +3 -2
- package/dist/cjs/client/components/user-menu.js +30 -3
- package/dist/cjs/client/index.js +29 -1
- package/dist/cjs/client/provider.js +54 -2
- package/dist/cjs/client/use-active-path.js +77 -0
- package/dist/cjs/errors.js +1 -1
- package/dist/cjs/next/index.js +96 -15
- package/dist/cjs/server/client.js +10 -2
- package/dist/cjs/server/handler.js +89 -6
- package/dist/cjs/server/index.js +8 -1
- package/dist/cjs/server/resources/analytics.js +66 -0
- package/dist/cjs/server/resources/identity.js +1 -1
- package/dist/cjs/server/resources/integrations.js +66 -0
- package/dist/cjs/server/resources/sessions.js +1 -1
- package/dist/cjs/server/webhooks.js +127 -0
- package/dist/cjs/this-entry-is-server-only.js +31 -0
- package/dist/esm/cli/doctor.js +206 -0
- package/dist/esm/cli/init.js +20 -8
- package/dist/esm/client/components/access-gate.js +158 -0
- package/dist/esm/client/components/account-sessions.js +21 -19
- package/dist/esm/client/components/app-shell.js +154 -0
- package/dist/esm/client/components/apps-grid.js +2 -1
- package/dist/esm/client/components/integrations-modal.js +92 -0
- package/dist/esm/client/components/motion.js +21 -0
- package/dist/esm/client/components/nav.js +89 -0
- package/dist/esm/client/components/plans.js +39 -37
- package/dist/esm/client/components/readiness.js +3 -1
- package/dist/esm/client/components/side-nav.js +53 -0
- package/dist/esm/client/components/subscription.js +2 -1
- package/dist/esm/client/components/surfaces.js +51 -0
- package/dist/esm/client/components/usage-meter.js +3 -2
- package/dist/esm/client/components/user-menu.js +31 -4
- package/dist/esm/client/index.js +15 -1
- package/dist/esm/client/provider.js +53 -2
- package/dist/esm/client/use-active-path.js +74 -0
- package/dist/esm/errors.js +1 -1
- package/dist/esm/next/index.js +95 -15
- package/dist/esm/server/client.js +10 -2
- package/dist/esm/server/handler.js +89 -6
- package/dist/esm/server/index.js +5 -0
- package/dist/esm/server/resources/analytics.js +62 -0
- package/dist/esm/server/resources/identity.js +1 -1
- package/dist/esm/server/resources/integrations.js +62 -0
- package/dist/esm/server/resources/sessions.js +1 -1
- package/dist/esm/server/webhooks.js +123 -0
- package/dist/esm/this-entry-is-server-only.js +30 -0
- package/dist/theme.css +28 -0
- package/dist/types/cli/doctor.d.ts +23 -0
- package/dist/types/cli/init.d.ts +2 -3
- package/dist/types/client/components/access-gate.d.ts +79 -0
- package/dist/types/client/components/app-shell.d.ts +115 -0
- package/dist/types/client/components/integrations-modal.d.ts +21 -0
- package/dist/types/client/components/motion.d.ts +22 -0
- package/dist/types/client/components/nav.d.ts +110 -0
- package/dist/types/client/components/side-nav.d.ts +31 -0
- package/dist/types/client/components/surfaces.d.ts +51 -0
- package/dist/types/client/index.d.ts +12 -1
- package/dist/types/client/provider.d.ts +38 -3
- package/dist/types/client/use-active-path.d.ts +8 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/next/index.d.ts +40 -0
- package/dist/types/server/client.d.ts +8 -2
- package/dist/types/server/index.d.ts +17 -2
- package/dist/types/server/resources/analytics.d.ts +31 -0
- package/dist/types/server/resources/identity.d.ts +12 -2
- package/dist/types/server/resources/integrations.d.ts +40 -0
- package/dist/types/server/webhooks.d.ts +67 -0
- package/dist/types/this-entry-is-server-only.d.ts +1 -0
- package/dist/types/types.d.ts +182 -1
- package/package.json +22 -4
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ConnectLinkRenderer, type ConnectNav } from "./nav.js";
|
|
3
|
+
import type { ThemeMode } from "../../types.js";
|
|
4
|
+
export interface ConnectAppShellProps {
|
|
5
|
+
/** This service's name, in the `cosmo·ops VOICE` lockup. See `ConnectLogo`. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** This service's glyph, drawn on the CosmoOps badge. Falls back to the Connect rings. */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** Where the lockup links. Defaults to `/`. */
|
|
10
|
+
homeHref?: string;
|
|
11
|
+
/** The sidebar's destinations - items, sections, or a mix. See `ConnectNav`. */
|
|
12
|
+
nav: ConnectNav;
|
|
13
|
+
/** Current path. Pass `usePathname()` in Next; see `ConnectSideNavProps.activePath`. */
|
|
14
|
+
activePath?: string;
|
|
15
|
+
/** See `ConnectLinkRenderer` - how this app renders a link. Defaults to a plain `<a>`. */
|
|
16
|
+
renderLink?: ConnectLinkRenderer;
|
|
17
|
+
/**
|
|
18
|
+
* Page heading in the top bar. A string renders as the page's `<h1>`, so
|
|
19
|
+
* don't also put one at the top of the page; pass a node for breadcrumbs or
|
|
20
|
+
* anything else.
|
|
21
|
+
*/
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
/** Your own controls in the top bar, left of the Connect ones. */
|
|
24
|
+
headerActions?: ReactNode;
|
|
25
|
+
/** Extra content pinned to the bottom of the sidebar, above the fold-away. */
|
|
26
|
+
sidebarFooter?: ReactNode;
|
|
27
|
+
/** Rendered below `children`, inside the scrolling content pane. */
|
|
28
|
+
footer?: ReactNode;
|
|
29
|
+
/** Start the rail collapsed. Ignored when `collapsed` is supplied. */
|
|
30
|
+
defaultCollapsed?: boolean;
|
|
31
|
+
/** Drive the rail yourself. Supply `onCollapsedChange` with it. */
|
|
32
|
+
collapsed?: boolean;
|
|
33
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
34
|
+
/** Remove the collapse control and pin the rail expanded. */
|
|
35
|
+
collapsible?: boolean;
|
|
36
|
+
/** The app launcher in the top bar. On by default. */
|
|
37
|
+
showAppsGrid?: boolean;
|
|
38
|
+
/** "Continue with Connect" / "Create account" in the top bar when signed out. On by default. */
|
|
39
|
+
showAuthButtons?: boolean;
|
|
40
|
+
/** Passed to `ConnectUserMenu` - the SDK has no theme provider, so this is host-controlled. */
|
|
41
|
+
theme?: ThemeMode;
|
|
42
|
+
onThemeChange?: (theme: ThemeMode) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Wrap `children` in `ConnectAccessGate` - suspended, no plan, onboarding
|
|
45
|
+
* pending, payment due, decided once for the whole app. **On by default**,
|
|
46
|
+
* because the shell is exactly the "wrap your app content once" place that
|
|
47
|
+
* gate asks for, and an app that mounts a shell and forgets the gate is an
|
|
48
|
+
* app that lets a suspended workspace keep working.
|
|
49
|
+
*
|
|
50
|
+
* The chrome is never gated: the sidebar, the lockup, the user menu and
|
|
51
|
+
* sign-out stay reachable in every blocked state, so a blocked customer can
|
|
52
|
+
* always get to the page that unblocks them.
|
|
53
|
+
*
|
|
54
|
+
* Routes flagged `gateExempt` on their nav item render outside it - see
|
|
55
|
+
* `ConnectNavItem.gateExempt` and `gateExemptRoutes`.
|
|
56
|
+
*/
|
|
57
|
+
gate?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Extra ungated paths, on top of the ones flagged `gateExempt` in `nav`.
|
|
60
|
+
* For a route that is not in the sidebar at all - a `/checkout/callback`,
|
|
61
|
+
* say. Prefix-matched, same as the nav's active resolution.
|
|
62
|
+
*/
|
|
63
|
+
gateExemptRoutes?: string[];
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Classes on the scrolling content pane - override the default max-width and padding here. */
|
|
66
|
+
contentClassName?: string;
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The application frame every CosmoOps service platform runs inside: a
|
|
71
|
+
* collapsible sidebar, a top bar carrying the app launcher and the account
|
|
72
|
+
* menu, and your pages in the middle.
|
|
73
|
+
*
|
|
74
|
+
* This is the piece each partner was otherwise writing by hand, and writing
|
|
75
|
+
* slightly differently - which is how a family of services stops looking like
|
|
76
|
+
* one product. Everything that should be identical across platforms (the
|
|
77
|
+
* lockup, the rail geometry, the active-route treatment, the launcher, the
|
|
78
|
+
* account menu, the access gate) lives here; everything that genuinely
|
|
79
|
+
* differs is a prop:
|
|
80
|
+
*
|
|
81
|
+
* ```tsx
|
|
82
|
+
* "use client";
|
|
83
|
+
* import Link from "next/link";
|
|
84
|
+
* import { usePathname } from "next/navigation";
|
|
85
|
+
* import { ConnectAppShell } from "@cosmoops/connect-sdk/client";
|
|
86
|
+
* import { LayoutDashboard, Truck } from "lucide-react";
|
|
87
|
+
*
|
|
88
|
+
* export function Shell({ children }: { children: React.ReactNode }) {
|
|
89
|
+
* return (
|
|
90
|
+
* <ConnectAppShell
|
|
91
|
+
* name="Dispatch"
|
|
92
|
+
* icon={<Truck />}
|
|
93
|
+
* activePath={usePathname()}
|
|
94
|
+
* renderLink={(props) => <Link {...props} />}
|
|
95
|
+
* nav={[
|
|
96
|
+
* { label: "Overview", href: "/", icon: <LayoutDashboard className="size-5" /> },
|
|
97
|
+
* { label: "Plans", href: "/plans", icon: <Truck className="size-5" />, gateExempt: true },
|
|
98
|
+
* ]}
|
|
99
|
+
* >
|
|
100
|
+
* {children}
|
|
101
|
+
* </ConnectAppShell>
|
|
102
|
+
* );
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* There is no `isSignedIn` branch anywhere in here, and there should be none
|
|
107
|
+
* in yours: the auth buttons render nothing once a session exists, the user
|
|
108
|
+
* menu renders nothing without one, and the launcher renders nothing when
|
|
109
|
+
* signed out. The swap happens inside the components.
|
|
110
|
+
*
|
|
111
|
+
* It renders no provider of its own - mount `ConnectProvider` above it, once,
|
|
112
|
+
* so a page with a shell, a plan table and a usage meter still makes one
|
|
113
|
+
* session read.
|
|
114
|
+
*/
|
|
115
|
+
export declare function ConnectAppShell({ name, icon, homeHref, nav, activePath, renderLink, title, headerActions, sidebarFooter, footer, defaultCollapsed, collapsed: controlledCollapsed, onCollapsedChange, collapsible, showAppsGrid, showAuthButtons, theme, onThemeChange, gate, gateExemptRoutes, className, contentClassName, children, }: ConnectAppShellProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ConnectIntegrationsModalProps {
|
|
2
|
+
/** Extra classes on the trigger button. */
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Trigger label, both visible and for screen readers. */
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A grid of every Composio-hosted toolkit this organization can connect -
|
|
9
|
+
* Google Calendar, Slack, Twitter/X, whatever a platform admin enabled in
|
|
10
|
+
* Connect's own Console. Each tile carries its own connect/reconnect/
|
|
11
|
+
* disconnect action and its own pending state, independent of every other
|
|
12
|
+
* tile - see the doc comment on `pendingSlug` below for why that matters.
|
|
13
|
+
*
|
|
14
|
+
* Not optimistic: a tile stays whatever it already was after "Connect" is
|
|
15
|
+
* pressed, because the connection isn't settled until Composio's webhook
|
|
16
|
+
* confirms it - `mutateResource` here only ever gets as far as `pending`
|
|
17
|
+
* before the browser navigates away to complete the provider's OAuth screen.
|
|
18
|
+
*
|
|
19
|
+
* Renders nothing when signed out, same as `ConnectAppsGrid`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ConnectIntegrationsModal({ className, label }: ConnectIntegrationsModalProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export { m, AnimatePresence } from "motion/react";
|
|
3
|
+
/** HeroUI's --ease-out-quart, transcribed for motion transitions. */
|
|
4
|
+
export declare const EASE_OUT_QUART: readonly [0.165, 0.84, 0.44, 1];
|
|
5
|
+
export declare const ENTER: {
|
|
6
|
+
readonly duration: 0.3;
|
|
7
|
+
readonly ease: readonly [0.165, 0.84, 0.44, 1];
|
|
8
|
+
};
|
|
9
|
+
export declare const METER_SPRING: {
|
|
10
|
+
readonly type: "spring";
|
|
11
|
+
readonly stiffness: 170;
|
|
12
|
+
readonly damping: 26;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Per-component motion root. domAnimation keeps the feature bundle small,
|
|
16
|
+
* `strict` restricts rendering to `m.*` components, and reducedMotion="user"
|
|
17
|
+
* drops transform animation (keeping opacity) under prefers-reduced-motion -
|
|
18
|
+
* the same contract HeroUI's own `motion-reduce` styles follow.
|
|
19
|
+
*/
|
|
20
|
+
export declare function MotionProvider({ children }: Readonly<{
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* One destination in the shell's sidebar.
|
|
4
|
+
*
|
|
5
|
+
* `href` is a path in *your* app, not a Connect URL - the shell never
|
|
6
|
+
* routes anywhere itself, it hands `href` to `renderLink` and lets your
|
|
7
|
+
* router do the work.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConnectNavItem {
|
|
10
|
+
label: string;
|
|
11
|
+
href: string;
|
|
12
|
+
/**
|
|
13
|
+
* A pre-rendered glyph, e.g. `<LayoutDashboard className="size-5" />`.
|
|
14
|
+
* Required in practice for anything in the primary rail: the collapsed rail
|
|
15
|
+
* is icon-only, and an item with no icon collapses to an empty box.
|
|
16
|
+
*/
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
/** Trailing content on the row - a count `<Chip>`, a status dot. Hidden while collapsed. */
|
|
19
|
+
badge?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Match this route only when the path is exactly `href`, never as a prefix.
|
|
22
|
+
* `/` is always treated as exact regardless, since every path starts with it.
|
|
23
|
+
*/
|
|
24
|
+
exact?: boolean;
|
|
25
|
+
/** Opens in a new tab, with a trailing arrow. For docs, status pages, anything outside the app. */
|
|
26
|
+
external?: boolean;
|
|
27
|
+
/** One level of children, revealed beneath the parent when the parent or a child is active. */
|
|
28
|
+
items?: ConnectNavItem[];
|
|
29
|
+
/**
|
|
30
|
+
* Leave this route *outside* `ConnectAccessGate` - see
|
|
31
|
+
* `ConnectAppShellProps.gate`. Declared here, next to the route it applies
|
|
32
|
+
* to, rather than as a second list somewhere else that has to be kept in
|
|
33
|
+
* step with this one.
|
|
34
|
+
*/
|
|
35
|
+
gateExempt?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A titled group of items. Untitled groups render as a plain divider-free block. */
|
|
38
|
+
export interface ConnectNavSection {
|
|
39
|
+
title?: string;
|
|
40
|
+
items: ConnectNavItem[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What `ConnectAppShell`/`ConnectSideNav` accept for `nav`: a flat list of
|
|
44
|
+
* items, a list of sections, or a mix. Consecutive bare items fold into one
|
|
45
|
+
* untitled section, so the common case is just an array of items.
|
|
46
|
+
*/
|
|
47
|
+
export type ConnectNav = ReadonlyArray<ConnectNavItem | ConnectNavSection>;
|
|
48
|
+
/** Props the shell hands to `renderLink`. Spread them onto whatever your router's link component is. */
|
|
49
|
+
export interface ConnectNavLinkProps {
|
|
50
|
+
href: string;
|
|
51
|
+
className: string;
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
onClick?: () => void;
|
|
54
|
+
"aria-current"?: "page";
|
|
55
|
+
/**
|
|
56
|
+
* Always set, and the only name the link has while the rail is collapsed -
|
|
57
|
+
* spread it through rather than dropping it, or an icon-only rail reads as
|
|
58
|
+
* a column of unlabelled links.
|
|
59
|
+
*/
|
|
60
|
+
"aria-label": string;
|
|
61
|
+
target?: string;
|
|
62
|
+
rel?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* How this app renders a link.
|
|
66
|
+
*
|
|
67
|
+
* The SDK ships into any React app and cannot import `next/link`,
|
|
68
|
+
* `react-router` or anything else framework-specific, so routing is a prop.
|
|
69
|
+
* The default is a plain `<a>`, which is correct but costs a full page load;
|
|
70
|
+
* an app with a client router should pass its own:
|
|
71
|
+
*
|
|
72
|
+
* ```tsx
|
|
73
|
+
* renderLink={(props) => <Link {...props} />} // next/link
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export type ConnectLinkRenderer = (props: ConnectNavLinkProps) => ReactNode;
|
|
77
|
+
/** Folds a mixed `ConnectNav` into sections, gathering consecutive bare items into one untitled group. */
|
|
78
|
+
export declare function normalizeNav(nav: ConnectNav): ConnectNavSection[];
|
|
79
|
+
/** Every item in the tree, parents and children alike, in render order. */
|
|
80
|
+
export declare function flattenNav(nav: ConnectNav): ConnectNavItem[];
|
|
81
|
+
/**
|
|
82
|
+
* `https://x.test/billing/?tab=1#top` -> `/billing`.
|
|
83
|
+
*
|
|
84
|
+
* Trailing slashes go too, so `/billing/` and `/billing` are the same route -
|
|
85
|
+
* they are, to every router, and treating them as different is how a nav item
|
|
86
|
+
* ends up unhighlighted on exactly one of the two URLs a user can arrive at.
|
|
87
|
+
*/
|
|
88
|
+
export declare function normalizePath(path: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* The href of the nav item the current path belongs to, or `null`.
|
|
91
|
+
*
|
|
92
|
+
* Longest prefix wins, so `/settings/billing` lights up Billing and not also
|
|
93
|
+
* its parent Settings - a plain `startsWith` over an unordered list lights up
|
|
94
|
+
* both, and the sidebar grows two highlights.
|
|
95
|
+
*
|
|
96
|
+
* External items never match: they leave the app, so no path inside it is
|
|
97
|
+
* ever "on" them.
|
|
98
|
+
*/
|
|
99
|
+
export declare function resolveActivePath(pathname: string, nav: ConnectNav): string | null;
|
|
100
|
+
/**
|
|
101
|
+
* Whether `item` is the destination `resolveActivePath` picked.
|
|
102
|
+
*
|
|
103
|
+
* Not just `normalizePath(item.href) === activeHref`, which is the trap this
|
|
104
|
+
* exists to close: `normalizePath` strips the origin off an absolute URL, so
|
|
105
|
+
* an external item pointed at `https://docs.example.com` normalizes to `/` and
|
|
106
|
+
* lights up on every app's home route. External items are never active.
|
|
107
|
+
*/
|
|
108
|
+
export declare function isNavItemActive(item: ConnectNavItem, activeHref: string | null): boolean;
|
|
109
|
+
/** Hrefs declared `gateExempt` - the routes `ConnectAppShell` renders outside its `ConnectAccessGate`. */
|
|
110
|
+
export declare function gateExemptPaths(nav: ConnectNav): string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ConnectLinkRenderer, type ConnectNav } from "./nav.js";
|
|
2
|
+
/** A plain anchor - correct anywhere, and a full page load. See `ConnectLinkRenderer`. */
|
|
3
|
+
export declare const defaultRenderLink: ConnectLinkRenderer;
|
|
4
|
+
export interface ConnectSideNavProps {
|
|
5
|
+
/** Items, sections, or a mix - see `ConnectNav`. */
|
|
6
|
+
nav: ConnectNav;
|
|
7
|
+
/**
|
|
8
|
+
* The current path. Pass your router's own (`usePathname()` in Next) -
|
|
9
|
+
* without it the nav reads `window.location` and patches `history` to hear
|
|
10
|
+
* about client-side navigations, which works but is guesswork the router
|
|
11
|
+
* never has to do. See `useActivePath`.
|
|
12
|
+
*/
|
|
13
|
+
activePath?: string;
|
|
14
|
+
/** See `ConnectLinkRenderer`. Defaults to a plain `<a>`. */
|
|
15
|
+
renderLink?: ConnectLinkRenderer;
|
|
16
|
+
/** Icon-only rail. Labels move into tooltips and children are hidden. */
|
|
17
|
+
collapsed?: boolean;
|
|
18
|
+
/** Called after any nav link is pressed - the mobile drawer closes itself with this. */
|
|
19
|
+
onNavigate?: () => void;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The sidebar's nav column on its own - sections, items, one level of
|
|
24
|
+
* children, and the active highlight.
|
|
25
|
+
*
|
|
26
|
+
* `ConnectAppShell` renders this inside its rail and its mobile drawer, and it
|
|
27
|
+
* is exported for a host that wants the shell's navigation without its
|
|
28
|
+
* chrome: the same items, the same active resolution, dropped into a layout
|
|
29
|
+
* you already have.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ConnectSideNav({ nav, activePath, renderLink, collapsed, onNavigate, className, }: ConnectSideNavProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one elevation model every panel inside a Connect modal follows.
|
|
3
|
+
*
|
|
4
|
+
* This exists because "just use `bg-surface`" is wrong here, and wrong in a
|
|
5
|
+
* way that is invisible until you look at the tokens. `Modal.Dialog` paints
|
|
6
|
+
* itself `bg-overlay`, and in the shared theme (`theme.css`) `--overlay` and
|
|
7
|
+
* `--surface` sit at the *same lightness* in both schemes - 100% against 100%
|
|
8
|
+
* in light, 21% against 21% in dark. A `bg-surface` panel dropped on a modal
|
|
9
|
+
* therefore has no fill contrast at all; only its border separates it from
|
|
10
|
+
* the dialog behind it.
|
|
11
|
+
*
|
|
12
|
+
* That is how the account modal ended up looking half-finished: the identity
|
|
13
|
+
* card used `bg-surface-secondary` and read as a solid block, while the
|
|
14
|
+
* destination tiles and the session list used `bg-surface` and read as
|
|
15
|
+
* hairline outlines floating on nothing. Same nesting depth, two different
|
|
16
|
+
* physical materials, for no reason a user could infer.
|
|
17
|
+
*
|
|
18
|
+
* Three levels, and nesting one inside another always steps the fill:
|
|
19
|
+
*
|
|
20
|
+
* - **L0 - the dialog itself.** `bg-overlay`, owned by HeroUI. Not ours.
|
|
21
|
+
* - **L1 - a panel on the dialog.** `PANEL_FILL` + `border-border`. The
|
|
22
|
+
* identity card, each destination tile, the session list.
|
|
23
|
+
* - **L2 - a medallion inside a panel.** `bg-surface`, which is L0's value
|
|
24
|
+
* and therefore reads as *inset* against L1 rather than raised. Light:
|
|
25
|
+
* white on grey. Dark: near-black on charcoal. Both directions legible.
|
|
26
|
+
*
|
|
27
|
+
* The inversion at L2 is deliberate and is why this is written down. Reaching
|
|
28
|
+
* for a "lighter" fill one step down works in light mode and quietly fails in
|
|
29
|
+
* dark; stepping *back to the dialog's own value* is the trick that reads in
|
|
30
|
+
* both, because the contrast comes from the gap between L1 and L0 rather than
|
|
31
|
+
* from a direction of travel.
|
|
32
|
+
*/
|
|
33
|
+
export declare const PANEL_FILL = "bg-surface-secondary";
|
|
34
|
+
/**
|
|
35
|
+
* The icon well shared by destination tiles and session rows: a 40px box
|
|
36
|
+
* holding a 20px glyph.
|
|
37
|
+
*
|
|
38
|
+
* Half the well, which is the point. Both surfaces used to run a `size-4`
|
|
39
|
+
* (16px) icon inside a `size-9` (36px) well - a 44% fill that reads as an
|
|
40
|
+
* icon someone forgot to finish, and the specific thing that made the
|
|
41
|
+
* Profile/Billing/Connect tiles look under-drawn. They also disagreed on
|
|
42
|
+
* shape (a circle in the tiles, a rounded square in the session rows) for
|
|
43
|
+
* what is the same component role, so the two surfaces never looked related.
|
|
44
|
+
*
|
|
45
|
+
* Pair with `ICON` on the glyph inside. Session rows override the well to
|
|
46
|
+
* `size-9` for density but keep the same `ICON`, so glyph size stays constant
|
|
47
|
+
* across the whole modal even where the well does not.
|
|
48
|
+
*/
|
|
49
|
+
export declare const MEDALLION = "size-10";
|
|
50
|
+
/** The glyph inside a `MEDALLION`. Constant across every well in the modal - see `MEDALLION`. */
|
|
51
|
+
export declare const ICON = "size-5";
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* whatever theme the host service platform already configured, and one theme
|
|
11
11
|
* change lands identically in all of them.
|
|
12
12
|
*/
|
|
13
|
-
export { ConnectProvider, useConnect, useConnectUser, useConnectEntitlements, useConnectPlans, useConnectApps, useConnectAddonUsage, useConnectSessions, useConnectResource, CONNECT_APP_URL, } from "./provider.js";
|
|
13
|
+
export { ConnectProvider, useConnect, useConnectUser, useConnectEntitlements, useConnectPlans, useConnectApps, useConnectAddonUsage, useConnectSessions, useConnectIntegrations, useConnectResource, CONNECT_APP_URL, } from "./provider.js";
|
|
14
14
|
export type { ConnectProviderProps, ConnectContextValue, ConnectSession } from "./provider.js";
|
|
15
15
|
export { blockingBlockers, normalizePlanFeatures } from "../helpers.js";
|
|
16
16
|
export type { WirePlanFeature } from "../helpers.js";
|
|
@@ -25,8 +25,17 @@ export { ConnectUserMenu, ConnectManageSubscriptionButton, ConnectInvoicesButton
|
|
|
25
25
|
export { ConnectAccountSessions } from "./components/account-sessions.js";
|
|
26
26
|
export type { ConnectAccountSessionsProps } from "./components/account-sessions.js";
|
|
27
27
|
export type { ConnectUserMenuProps } from "./components/user-menu.js";
|
|
28
|
+
export { ConnectAppShell } from "./components/app-shell.js";
|
|
29
|
+
export type { ConnectAppShellProps } from "./components/app-shell.js";
|
|
30
|
+
export { ConnectSideNav } from "./components/side-nav.js";
|
|
31
|
+
export type { ConnectSideNavProps } from "./components/side-nav.js";
|
|
32
|
+
export { useActivePath } from "./use-active-path.js";
|
|
33
|
+
export { normalizeNav, flattenNav, normalizePath, resolveActivePath, isNavItemActive, gateExemptPaths, } from "./components/nav.js";
|
|
34
|
+
export type { ConnectNav, ConnectNavItem, ConnectNavSection, ConnectNavLinkProps, ConnectLinkRenderer, } from "./components/nav.js";
|
|
28
35
|
export { ConnectAppsGrid } from "./components/apps-grid.js";
|
|
29
36
|
export type { ConnectAppsGridProps } from "./components/apps-grid.js";
|
|
37
|
+
export { ConnectIntegrationsModal } from "./components/integrations-modal.js";
|
|
38
|
+
export type { ConnectIntegrationsModalProps } from "./components/integrations-modal.js";
|
|
30
39
|
export { ConnectPlans } from "./components/plans.js";
|
|
31
40
|
export type { ConnectPlansProps } from "./components/plans.js";
|
|
32
41
|
export { ConnectSubscribeDialog } from "./components/subscribe-dialog.js";
|
|
@@ -35,6 +44,8 @@ export { ConnectSubscriptionGate, ConnectNoSubscriptionCard, ConnectSubscription
|
|
|
35
44
|
export type { ConnectSubscriptionGateProps, ConnectNoSubscriptionCardProps, ConnectSubscriptionCardProps, ConnectTrialBannerProps, ConnectSubscriptionState, } from "./components/subscription.js";
|
|
36
45
|
export { ConnectReadinessBanner, ConnectReadinessGate } from "./components/readiness.js";
|
|
37
46
|
export type { ConnectReadinessBannerProps, ConnectReadinessGateProps } from "./components/readiness.js";
|
|
47
|
+
export { ConnectAccessGate, useConnectAccessGate } from "./components/access-gate.js";
|
|
48
|
+
export type { ConnectAccessGateProps, ConnectAccessGateState, ConnectAccessGateResult, } from "./components/access-gate.js";
|
|
38
49
|
export { ConnectFeatureGate, useConnectFeature } from "./components/feature-gate.js";
|
|
39
50
|
export type { ConnectFeatureGateProps } from "./components/feature-gate.js";
|
|
40
51
|
export { ConnectUsageMeter } from "./components/usage-meter.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { AddonUsageResponse, ConnectUser, OrganizationApp, PlansResponse, ReadinessResponse, ServiceRole, SessionsListResponse, SessionSubscription, SubscriptionResponse } from "../types.js";
|
|
2
|
+
import type { AddonUsageResponse, ConnectUser, IntegrationsListResponse, OrganizationApp, PlansResponse, ReadinessResponse, ServiceRole, SessionsListResponse, SessionSubscription, SubscriptionResponse } from "../types.js";
|
|
3
3
|
export declare const CONNECT_APP_URL = "https://connect.cosmoops.com";
|
|
4
4
|
export interface ConnectSession {
|
|
5
5
|
user: ConnectUser | null;
|
|
@@ -61,7 +61,7 @@ export interface ConnectContextValue {
|
|
|
61
61
|
}
|
|
62
62
|
export interface ConnectProviderProps {
|
|
63
63
|
/**
|
|
64
|
-
* This service's public `client_id`, from its
|
|
64
|
+
* This service's public `client_id`, from its Integration tab in Connect.
|
|
65
65
|
*
|
|
66
66
|
* Not needed for the default sign-in flow: `signIn()` with no `redirectUri`
|
|
67
67
|
* bounces the browser to your own `/signin` route, which already knows
|
|
@@ -87,6 +87,27 @@ export interface ConnectProviderProps {
|
|
|
87
87
|
* child effects.
|
|
88
88
|
*/
|
|
89
89
|
fetch?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
90
|
+
/**
|
|
91
|
+
* Sign in a returning visitor automatically, with no click.
|
|
92
|
+
*
|
|
93
|
+
* When the first `/session` read comes back signed out, the browser is sent
|
|
94
|
+
* on one round trip to Connect with OIDC `prompt=none`. If they still have
|
|
95
|
+
* a Connect session and have authorised this app before, they come straight
|
|
96
|
+
* back signed in and never see a screen. If not, they come straight back
|
|
97
|
+
* signed out, with no error and nothing rendered differently - your normal
|
|
98
|
+
* signed-out UI just appears a beat later.
|
|
99
|
+
*
|
|
100
|
+
* **Off by default, and it is a real trade, not just caution.** It costs a
|
|
101
|
+
* full-page redirect on the first load of every signed-out visit - a brief
|
|
102
|
+
* flash on a marketing page, invisible on an app shell - so it belongs on
|
|
103
|
+
* apps whose visitors are overwhelmingly already Connect users. It is
|
|
104
|
+
* attempted at most once per tab (a `sessionStorage` marker), so a visitor
|
|
105
|
+
* who genuinely has no session does not bounce on every navigation.
|
|
106
|
+
*
|
|
107
|
+
* Requires `createConnectHandler` mounted at `basePath`; the redirect goes
|
|
108
|
+
* to your own `/signin`, which mints the `state` server-side.
|
|
109
|
+
*/
|
|
110
|
+
silentSignIn?: boolean;
|
|
90
111
|
children: ReactNode;
|
|
91
112
|
}
|
|
92
113
|
/**
|
|
@@ -103,7 +124,7 @@ export interface ConnectProviderProps {
|
|
|
103
124
|
* </ConnectProvider>
|
|
104
125
|
* ```
|
|
105
126
|
*/
|
|
106
|
-
export declare function ConnectProvider({ clientId, basePath, redirectUri, appUrl, fetch: fetchImpl, children, }: ConnectProviderProps): import("react").JSX.Element;
|
|
127
|
+
export declare function ConnectProvider({ clientId, basePath, redirectUri, appUrl, fetch: fetchImpl, silentSignIn, children, }: ConnectProviderProps): import("react").JSX.Element;
|
|
107
128
|
export declare function useConnect(): ConnectContextValue;
|
|
108
129
|
/** The signed-in user, or `null`. Sugar over `useConnect().session`. */
|
|
109
130
|
export declare function useConnectUser(): ConnectUser | null;
|
|
@@ -174,6 +195,20 @@ export declare function useConnectApps(): {
|
|
|
174
195
|
*/
|
|
175
196
|
refetch(): void;
|
|
176
197
|
};
|
|
198
|
+
/** Enabled Composio-hosted toolkits and this organization's connection status for each. */
|
|
199
|
+
export declare function useConnectIntegrations(): {
|
|
200
|
+
data: IntegrationsListResponse | null;
|
|
201
|
+
isLoading: boolean;
|
|
202
|
+
error: string | null;
|
|
203
|
+
/**
|
|
204
|
+
* Forces a fresh read - the provider's cache clears the mutated path's
|
|
205
|
+
* entry on a successful `mutateResource` call, but nothing re-triggers
|
|
206
|
+
* this hook's own effect on its own (none of its dependencies change from
|
|
207
|
+
* a cache write nobody here observes). Call this right after a
|
|
208
|
+
* `mutateResource` you made against the same `path` completes.
|
|
209
|
+
*/
|
|
210
|
+
refetch(): void;
|
|
211
|
+
};
|
|
177
212
|
/**
|
|
178
213
|
* This Connect account's own login sessions - account-wide, not scoped to
|
|
179
214
|
* this service, see `SessionsListResponse`'s doc comment. The component
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The current path, from `activePath` when given and from the browser
|
|
3
|
+
* otherwise.
|
|
4
|
+
*
|
|
5
|
+
* Exported because a host building its own shell out of `ConnectSideNav`
|
|
6
|
+
* needs the same fallback the shell uses.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useActivePath(activePath?: string): string;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class ConnectError extends Error {
|
|
|
52
52
|
* guessing keys. These two are the exception: reaching them required
|
|
53
53
|
* presenting a key whose hash matched, so you already hold it, and what you
|
|
54
54
|
* need to know is that no retry and no scope change will fix this - the key
|
|
55
|
-
* has to be reissued from the service's
|
|
55
|
+
* has to be reissued from the service's Integration tab.
|
|
56
56
|
*
|
|
57
57
|
* Worth alerting on. It is the one failure that will not resolve itself and
|
|
58
58
|
* takes down every call your integration makes.
|
|
@@ -81,6 +81,9 @@ export { handle as GET, handle as POST };
|
|
|
81
81
|
* if (!session) redirect("/api/connect/signin?next=/dashboard");
|
|
82
82
|
* ```
|
|
83
83
|
*
|
|
84
|
+
* `requireConnectSession()` below is that exact check in one call, for the
|
|
85
|
+
* common case of "redirect if signed out."
|
|
86
|
+
*
|
|
84
87
|
* Pass a `Request` to use it somewhere `next/headers` does not exist - a
|
|
85
88
|
* framework-agnostic handler, a test, a custom server. Both forms take the
|
|
86
89
|
* same path afterwards; the argument is only how the cookie is found.
|
|
@@ -92,11 +95,48 @@ export { handle as GET, handle as POST };
|
|
|
92
95
|
*
|
|
93
96
|
* Returns `null` for every failure - an expired session and a missing one both
|
|
94
97
|
* mean "not signed in", and a page guard should not need a try/catch.
|
|
98
|
+
*
|
|
99
|
+
* **Memoized per request for the plain, zero-argument call** - the shape
|
|
100
|
+
* every page, layout and Server Action actually uses - via React's `cache()`.
|
|
101
|
+
* Passing an explicit `request`, `client` or `session` bypasses the cache
|
|
102
|
+
* and always makes a live call: those are for tests and non-ambient
|
|
103
|
+
* callers, where a fresh read every time is the point, not an oversight.
|
|
95
104
|
*/
|
|
96
105
|
export declare function getConnectSession(request?: Request, options?: {
|
|
97
106
|
client?: ConnectClient;
|
|
98
107
|
session?: ConnectSessionStore;
|
|
99
108
|
}): Promise<UserResponse | null>;
|
|
109
|
+
/**
|
|
110
|
+
* `getConnectSession()`, minus the boilerplate of checking it and redirecting
|
|
111
|
+
* yourself:
|
|
112
|
+
*
|
|
113
|
+
* ```tsx
|
|
114
|
+
* // app/dashboard/page.tsx
|
|
115
|
+
* const session = await requireConnectSession();
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* Redirects to `/signin` under the same `basePath` as `getConnectSession`'s
|
|
119
|
+
* default (`/api/connect`) when signed out - pass `signInPath` if you mounted
|
|
120
|
+
* the bridge somewhere else, and `next` to send the visitor back to where
|
|
121
|
+
* they were once they're signed in. Only sensible in a Server Component,
|
|
122
|
+
* Route Handler or Server Action, the same three places `redirect()` from
|
|
123
|
+
* `next/navigation` itself works.
|
|
124
|
+
*
|
|
125
|
+
* A thin wrapper, not a framework of its own - reach for `getConnectSession`
|
|
126
|
+
* plus your own check when "not signed in" isn't "redirect to sign-in"
|
|
127
|
+
* (an API route returning 401, say). Role and entitlement checks stay
|
|
128
|
+
* outside this function on purpose: `session.serviceRole.granted` and
|
|
129
|
+
* `connect.entitlements.*` are one line each on top of the session this
|
|
130
|
+
* already gives you, and where that line redirects (a plans page, a
|
|
131
|
+
* "forbidden" screen) is a decision only your app can make - see
|
|
132
|
+
* "Authentication & authorization" for the pattern.
|
|
133
|
+
*/
|
|
134
|
+
export declare function requireConnectSession(request?: Request, options?: {
|
|
135
|
+
client?: ConnectClient;
|
|
136
|
+
session?: ConnectSessionStore;
|
|
137
|
+
signInPath?: string;
|
|
138
|
+
next?: string;
|
|
139
|
+
}): Promise<UserResponse>;
|
|
100
140
|
export { createConnectHandler } from "../server/handler.js";
|
|
101
141
|
export type { ConnectSessionStore } from "../server/handler.js";
|
|
102
142
|
export { ConnectClient } from "../server/client.js";
|
|
@@ -6,13 +6,15 @@ import { BillingResource } from "./resources/billing.js";
|
|
|
6
6
|
import { DriveResource } from "./resources/drive.js";
|
|
7
7
|
import { EntitlementsResource } from "./resources/entitlements.js";
|
|
8
8
|
import { IdentityResource } from "./resources/identity.js";
|
|
9
|
+
import { IntegrationsResource } from "./resources/integrations.js";
|
|
9
10
|
import { LogsResource } from "./resources/logs.js";
|
|
11
|
+
import { AnalyticsResource } from "./resources/analytics.js";
|
|
10
12
|
import { OtpResource } from "./resources/otp.js";
|
|
11
13
|
import { SessionsResource } from "./resources/sessions.js";
|
|
12
14
|
export declare const DEFAULT_BASE_URL = "https://connect.cosmoops.com";
|
|
13
15
|
export interface ConnectClientOptions {
|
|
14
16
|
/**
|
|
15
|
-
* The API key plaintext from this service's
|
|
17
|
+
* The API key plaintext from this service's Integration tab, shown once at
|
|
16
18
|
* creation.
|
|
17
19
|
*
|
|
18
20
|
* One credential does three jobs: it is the `Authorization: Bearer` value
|
|
@@ -75,9 +77,13 @@ export declare class ConnectClient {
|
|
|
75
77
|
readonly otp: OtpResource;
|
|
76
78
|
/** Feature events into the Console's audit log, filterable to your service. */
|
|
77
79
|
readonly logs: LogsResource;
|
|
80
|
+
/** Emit product events and read back this service's aggregated numbers. */
|
|
81
|
+
readonly analytics: AnalyticsResource;
|
|
78
82
|
/** This Connect account's own login sessions - account-wide, not scoped to this service. Requires the `sessions:manage` scope. */
|
|
79
83
|
readonly sessions: SessionsResource;
|
|
84
|
+
/** Composio-hosted third-party connections (Google Calendar, Slack, ...) an organization has connected. */
|
|
85
|
+
readonly integrations: IntegrationsResource;
|
|
80
86
|
constructor(options: ConnectClientOptions);
|
|
81
87
|
}
|
|
82
88
|
/** Kept in step with `package.json` by `sdk.test.ts`. */
|
|
83
|
-
export declare const SDK_VERSION = "0.
|
|
89
|
+
export declare const SDK_VERSION = "0.6.0";
|
|
@@ -10,6 +10,21 @@ export type { ConnectClientOptions } from "./client.js";
|
|
|
10
10
|
export { createConnectHandler } from "./handler.js";
|
|
11
11
|
export type { ConnectHandlerOptions, ConnectSessionStore } from "./handler.js";
|
|
12
12
|
export { createState } from "./resources/identity.js";
|
|
13
|
-
export type { AuthorizeUrlInput, ExchangeCodeInput } from "./resources/identity.js";
|
|
14
|
-
export type { UploadInput } from "./resources/drive.js";
|
|
13
|
+
export type { AuthorizeUrlInput, ExchangeCodeInput, IdentityResource } from "./resources/identity.js";
|
|
14
|
+
export type { UploadInput, DriveResource } from "./resources/drive.js";
|
|
15
15
|
export type { FetchLike } from "./http.js";
|
|
16
|
+
export type { AccessResource } from "./resources/access.js";
|
|
17
|
+
export type { AppsResource } from "./resources/apps.js";
|
|
18
|
+
export type { EntitlementsResource } from "./resources/entitlements.js";
|
|
19
|
+
export type { BillingResource } from "./resources/billing.js";
|
|
20
|
+
export type { AiResource } from "./resources/ai.js";
|
|
21
|
+
export type { OtpResource } from "./resources/otp.js";
|
|
22
|
+
export type { LogsResource } from "./resources/logs.js";
|
|
23
|
+
export type { AnalyticsResource } from "./resources/analytics.js";
|
|
24
|
+
export type { SessionsResource } from "./resources/sessions.js";
|
|
25
|
+
export type { ExecuteIntegrationActionInput, IntegrationsResource } from "./resources/integrations.js";
|
|
26
|
+
/**
|
|
27
|
+
* Webhook verification and a ready-made POST route. Server-only for the
|
|
28
|
+
* obvious reason: the signing secret must never reach a browser bundle.
|
|
29
|
+
*/
|
|
30
|
+
export { createConnectWebhookHandler, verifyConnectWebhook, type ConnectWebhookHandlers, type ConnectWebhookHandlerOptions, } from "./webhooks.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type TransportOptions } from "../http.js";
|
|
2
|
+
import type { AnalyticsQuery, AnalyticsResponse, EmitEventInput, EmitEventsResponse } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Your service's own analytics: emit product events, and read back the daily
|
|
5
|
+
* numbers Connect aggregates from them.
|
|
6
|
+
*
|
|
7
|
+
* There is no way to name a service in either call. The scope is always the one
|
|
8
|
+
* your API key belongs to - that is the endpoint's security model, not an
|
|
9
|
+
* omission.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AnalyticsResource {
|
|
12
|
+
private readonly transport;
|
|
13
|
+
constructor(transport: TransportOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Daily series for the requested metrics, up to 90 days.
|
|
16
|
+
*
|
|
17
|
+
* **Throws on failure**, unlike `emit` below. A read whose result you are
|
|
18
|
+
* about to render has to be able to say "I could not load"; silently
|
|
19
|
+
* returning an empty series would draw a chart of zeroes.
|
|
20
|
+
*/
|
|
21
|
+
series(query: AnalyticsQuery): Promise<AnalyticsResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Never throws - the same judgement `LogsResource.write` makes, for the same
|
|
24
|
+
* reason: telemetry that takes down the code path it was observing is worse
|
|
25
|
+
* than a lost event. A failure is reported through `delivered`.
|
|
26
|
+
*
|
|
27
|
+
* Up to 50 events per call. Pass `sessionToken` on an event to attribute it
|
|
28
|
+
* to the signed-in user; without one it still lands, just unattributed.
|
|
29
|
+
*/
|
|
30
|
+
emit(events: EmitEventInput[]): Promise<EmitEventsResponse>;
|
|
31
|
+
}
|
|
@@ -4,8 +4,18 @@ export interface AuthorizeUrlInput {
|
|
|
4
4
|
redirectUri: string;
|
|
5
5
|
/** Fresh and random per request; check it matches on the way back. `createState()` makes one. */
|
|
6
6
|
state: string;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* `"create"` opens registration instead of sign-in, so one entry point
|
|
9
|
+
* serves both buttons.
|
|
10
|
+
*
|
|
11
|
+
* `"none"` is OIDC silent authentication: Connect answers from the
|
|
12
|
+
* visitor's existing session without showing them anything, returning a
|
|
13
|
+
* code if they are signed in and have already authorised this client, and
|
|
14
|
+
* `error=login_required`/`consent_required`/`interaction_required` if not.
|
|
15
|
+
* Use it to sign in a returning visitor with no click - never to *start* a
|
|
16
|
+
* sign-in, since by definition it will never show them a login screen.
|
|
17
|
+
*/
|
|
18
|
+
prompt?: "create" | "none";
|
|
9
19
|
/** Required only if this service enforces PKCE. */
|
|
10
20
|
codeChallenge?: string;
|
|
11
21
|
}
|