@canopy-io/nextjs 0.1.0 → 0.2.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @canopy-io/nextjs
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 09d63c0: Adds the embedded sign-in form to `@canopy-io/nextjs`, with the session kept on the server. `<SignInForm>` from `@canopy-io/nextjs/client` draws the form in a page of the app; a server component hands it `signInFormProps()`, which returns the publishable key, Canopy's origin and the proxy's route and never a secret. `canopyProxy` answers the form at `/auth/direct` (`routes.direct`): only the Direct API calls the form makes, only from a page whose `Origin` is `CANOPY_APP_URL` (and whose `Sec-Fetch-Site`, when sent, is `same-origin`), only as one JSON object of at most 64 KB. Each is forwarded to Canopy with the configured publishable key and the secret `CANOPY_API_KEY`, the browser's address, user agent and language, and nothing else of the browser's. The access and refresh tokens are sealed into the session cookie and taken out of the answer, so the browser receives who signed in and the next screen; an answer with an access token and no refresh token (a secret key from another Environment) is refused with `500` and sets no cookie. Canopy's cookies are never passed on, every answer is `Cache-Control: no-store`, and a failure to reach Canopy is a `502` in its `{ error }` shape. A remembered device is kept in its own encrypted cookie and sent back on the next sign-in. Refresh and sign-out of such a session go through the Direct API from the proxy; `auth()` verifies its token with the Environment's id as the audience (a Hosted Login session's with the client id, never either for both) and fills `user` from the identity kept in the cookie. `signInPage` sends a signed-out visitor from a protected path to the app's own sign-in page, and `clientAddress` reads the browser's address where `X-Forwarded-For` is not the host's. On a custom auth domain, whose issuer names no Environment, `CANOPY_ENVIRONMENT_ID` (option `environmentId`) gives the Environment's id; it must be a UUID, and the same Environment as an issuer that names one. `CANOPY_CLIENT_ID` and `CANOPY_CLIENT_SECRET` are now required only by Hosted Login, `CANOPY_PUBLISHABLE_KEY` and `CANOPY_API_KEY` only by the form, each naming what needs it when missing. The session cookie now records how the person signed in, so a session sealed by an earlier version reads as signed out.
8
+
9
+ `createCanopyDirectClient` takes `session: "server"` for a page whose own server keeps the session: a sign-in carries no token, the client reports `signed-in` with the identity, never refreshes, and anything that would need the access token throws `CanopyAuthError` with the code `server_held_session` (`SERVER_HELD_SESSION`). `publicBaseUrl` (default `baseUrl`) is where the browser reaches Canopy itself: the configuration, the form's words and CSS, and the social and SSO starts; `mountSignIn` gives it to `<canopy-captcha>`. With neither option set, nothing changes.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [8abdc13]
14
+ - Updated dependencies [f1fca62]
15
+ - Updated dependencies [09d63c0]
16
+ - Updated dependencies [9893c6f]
17
+ - Updated dependencies [09d63c0]
18
+ - Updated dependencies [eaee2f6]
19
+ - @canopy-io/browser@0.6.0
20
+ - @canopy-io/node@0.27.0
21
+ - @canopy-io/react@0.2.0
22
+
3
23
  ## 0.1.0
4
24
 
5
25
  ### Minor Changes
package/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # @canopy-io/nextjs
2
2
 
3
- Sign a Next.js app in on the server through [Canopy](https://canopy-io.com)'s hosted login, and decide what each page shows from the person's permissions, before anything renders.
3
+ Sign people in to a Next.js app with [Canopy](https://canopy-io.com), on your own server: through Canopy's hosted login, or through Canopy's sign-in form drawn inside a page of your app. Decide what each page shows from the person's permissions before anything renders.
4
4
 
5
- The session lives in an encrypted, HttpOnly cookie that only your server can read. A page arrives already signed in, with no loading state, and a protected route turns a signed-out visitor away before any HTML is sent. Token verification and the permission checks are [`@canopy-io/node`](https://www.npmjs.com/package/@canopy-io/node)'s; this package connects them to Next.js.
5
+ ## Which package
6
+
7
+ - **A Next.js App Router app:** this package. The session lives in an encrypted, HttpOnly cookie that only your server can read, so a page arrives already signed in and a protected route turns a signed-out visitor away before any HTML is sent. Token verification and permission checks are [`@canopy-io/node`](https://www.npmjs.com/package/@canopy-io/node)'s; this package connects them to Next.js.
8
+ - **A React single-page app with no backend:** [`@canopy-io/react`](https://www.npmjs.com/package/@canopy-io/react).
9
+ - **Any other app with a backend:** [`@canopy-io/node`](https://www.npmjs.com/package/@canopy-io/node).
6
10
 
7
11
  ## Install
8
12
 
@@ -10,11 +14,15 @@ The session lives in an encrypted, HttpOnly cookie that only your server can rea
10
14
  npm install @canopy-io/nextjs
11
15
  ```
12
16
 
13
- Next.js 15.5 or 16, App Router, on the Node.js runtime.
17
+ Next.js 15.5 or 16, App Router, on the Node.js runtime. `@canopy-io/node`, `@canopy-io/react` and `@canopy-io/browser` come with it.
18
+
19
+ ## Hosted Login
20
+
21
+ The person signs in on Canopy's hosted pages and comes back to your app, whose server signs in as a **confidential** OAuth client.
14
22
 
15
- ## Before the first sign-in
23
+ **Setup**
16
24
 
17
- 1. In the Developer Console (Integrations → OAuth Clients), register an OAuth client with **Client Type** set to **Confidential**. Add `https://app.example.com/auth/callback` as a redirect URI, and the page sign-out lands on (`https://app.example.com/` by default) as a post-logout redirect URL.
25
+ 1. In the Developer Console, open **Access Control → Integrations → OAuth Clients** and register a client with **Client Type** set to **Confidential**. Add `https://app.example.com/auth/callback` as a redirect URI, and the page sign-out lands on (`https://app.example.com/` by default) as a post-logout redirect URL.
18
26
  2. Set these environment variables on the server:
19
27
 
20
28
  ```bash
@@ -24,11 +32,11 @@ CANOPY_CLIENT_SECRET=<client_secret>
24
32
  CANOPY_APP_URL=https://app.example.com
25
33
  # Seals the session cookie: at least 32 characters (openssl rand -base64 32).
26
34
  CANOPY_SECRET=<random secret>
27
- # Only for permission checks at a node: a secret API key from the same Environment.
35
+ # For permission checks the token cannot answer: a secret API key from the same Environment.
28
36
  CANOPY_API_KEY=<secret API key>
29
37
  ```
30
38
 
31
- ## Use
39
+ **Example**
32
40
 
33
41
  ```ts
34
42
  // proxy.ts (Next.js 16)
@@ -44,18 +52,21 @@ export const config = {
44
52
  On Next.js 15.5 the same file is `middleware.ts`, and its `config` adds `runtime: "nodejs"`.
45
53
 
46
54
  ```tsx
47
- // app/reports/page.tsx, a server component
55
+ // app/reports/[teamId]/page.tsx, a server component
48
56
  import { auth } from "@canopy-io/nextjs";
49
57
 
50
- export default async function ReportsPage({ team }: { team: { id: string } }) {
58
+ export default async function ReportsPage({
59
+ params,
60
+ }: {
61
+ params: Promise<{ teamId: string }>;
62
+ }) {
63
+ const { teamId } = await params;
51
64
  const { user, can } = await auth();
52
65
 
53
66
  return (
54
67
  <>
55
68
  <p>Signed in as {user?.email}</p>
56
- {(await can("deals.update", { nodeId: team.id })) && (
57
- <button>Edit</button>
58
- )}
69
+ {(await can("deals.update", { nodeId: teamId })) && <button>Edit</button>}
59
70
  </>
60
71
  );
61
72
  }
@@ -67,13 +78,65 @@ export default async function ReportsPage({ team }: { team: { id: string } }) {
67
78
  <a href="/auth/sign-out">Sign out</a>
68
79
  ```
69
80
 
70
- - `canopyProxy(options)` answers `/auth/sign-in`, `/auth/callback` and `/auth/sign-out` (`routes` renames them). On every other request it opens the session cookie, refreshes the access token shortly before it expires, and sends a signed-out visitor from a `protect`ed path to sign in, coming back to the page they asked for. A string in `protect` covers that path and everything under it; a function decides for itself.
71
- - `auth()` in a server component, route handler or server action returns `isSignedIn`, `userId`, `user` (the ID token's claims, for display), `claims` (the verified access token's), `organization` (`{ orgId, orgRoles, orgScope }`), `accessToken` for calling your own API, and `can(permission, { nodeId })`.
72
- - Sign-out revokes the refresh token, clears the cookie and ends the session at Canopy too, so the next sign-in asks for a password again.
81
+ ## Embedded sign-in form
82
+
83
+ `<SignInForm>` draws Canopy's sign-in and sign-up screens inside a page of your app: the hosted pages' screens, in the Environment's words, languages and styles. Its calls go to the proxy, which signs the person in as your server and keeps the session in the same encrypted cookie. No token ever reaches the browser.
84
+
85
+ **Setup**
86
+
87
+ 1. In the Developer Console, open **Access Control → Integrations → Publishable Keys** and create a **Web** key. It is not a secret.
88
+ 2. If you offer social or SSO sign-in, add the sign-in page's URL to the Environment's **Redirect URLs** (**Tenant → Authentication → Allowed URLs**).
89
+ 3. Set these environment variables on the server, beside `CANOPY_ISSUER`, `CANOPY_APP_URL` and `CANOPY_SECRET` above. `CANOPY_CLIENT_ID` and `CANOPY_CLIENT_SECRET` are needed only if the app also signs in through Hosted Login.
90
+
91
+ ```bash
92
+ # The Environment's web publishable key (pk_…). Not a secret.
93
+ CANOPY_PUBLISHABLE_KEY=<publishable key>
94
+ # A secret API key from the publishable key's Environment. Required here.
95
+ CANOPY_API_KEY=<secret API key>
96
+ # Only when CANOPY_ISSUER is a custom auth domain (https://auth.example.com): the Environment's id.
97
+ CANOPY_ENVIRONMENT_ID=<environment_id>
98
+ ```
73
99
 
74
- ## Client components
100
+ **Example**
75
101
 
76
- Client components receive the session from the server; they hold no token and send no request.
102
+ ```ts
103
+ // proxy.ts: send signed-out visitors to your own page.
104
+ export default canopyProxy({ protect: ["/reports"], signInPage: "/sign-in" });
105
+ ```
106
+
107
+ ```tsx
108
+ // app/sign-in/page.tsx, a server component
109
+ import { signInFormProps } from "@canopy-io/nextjs";
110
+ import { SignInForm } from "@canopy-io/nextjs/client";
111
+
112
+ export default async function SignInPage({
113
+ searchParams,
114
+ }: {
115
+ searchParams: Promise<{ returnTo?: string }>;
116
+ }) {
117
+ const { returnTo } = await searchParams;
118
+
119
+ return <SignInForm {...signInFormProps()} returnTo={returnTo ?? "/"} />;
120
+ }
121
+ ```
122
+
123
+ After a sign-in the form goes to `returnTo` and refreshes the route, so server components render signed in. `auth()` and everything below work the same after either kind of sign-in.
124
+
125
+ ## API
126
+
127
+ **Server** (`@canopy-io/nextjs`)
128
+
129
+ - `canopyProxy(options)` answers `/auth/sign-in`, `/auth/callback`, `/auth/sign-out` and the form's `/auth/direct` (`routes` renames them). On every other request it opens the session cookie, refreshes the access token shortly before it expires, and sends a signed-out visitor from a `protect`ed path to sign in, coming back to the page they asked for. A string in `protect` covers that path and everything under it; a function decides for itself. `signInPage` sends them to your own page instead of Hosted Login.
130
+ - `auth()`, in a server component, route handler or server action, returns `isSignedIn`, `userId`, `user` (for display), `claims` (the verified access token's), `organization` (`{ orgId, orgRoles, orgScope }`), `accessToken` for calling your own API, and `can(permission, { nodeId })`.
131
+ - `signInFormProps()` returns what the form needs from the server: the publishable key, Canopy's origin and the proxy's route. Never the secret key or the cookie secret.
132
+ - `clientSession(await auth())` is the part of the session a client component may hold.
133
+ - `canopyProxy` and `auth()` take the settings in code instead of the environment (`issuer`, `environmentId`, `clientId`, `clientSecret`, `publishableKey`, `apiKey`, `appUrl`, `secret`), plus `scopes`, `routes`, `afterSignOutPath` and `sessionMaxAgeSec`.
134
+ - Sign-out revokes the refresh token, clears the cookie, ends the session at Canopy and lands on `afterSignOutPath`.
135
+
136
+ **Client** (`@canopy-io/nextjs/client`)
137
+
138
+ - `<SignInForm>` takes `signInFormProps()` and `returnTo` (a path on this site; anything else goes to `/`), plus `onSignedIn`, `language`, `initialScreen` (`"sign-in"` or `"sign-up"`), `appearance` (published `--hp-*` tokens), `fallback` and `className`. Rendering again sends nothing.
139
+ - `<CanopySessionProvider session>` and `useCanopySession()` give client components the session from the server. They hold no token and send no request.
77
140
 
78
141
  ```tsx
79
142
  // app/layout.tsx
@@ -97,29 +160,39 @@ export default async function RootLayout({
97
160
  }
98
161
  ```
99
162
 
100
- ```tsx
101
- "use client";
102
- import { useCanopySession } from "@canopy-io/nextjs/client";
163
+ **The form's proxy route**
103
164
 
104
- export function Avatar() {
105
- const { user } = useCanopySession();
165
+ - It forwards only the calls the form makes, only from a page whose `Origin` is `CANOPY_APP_URL`, with the configured publishable key and secret key. Of the browser's own, only its address, user agent and language go with them: no cookie and no `Authorization`. The tokens are sealed into the cookie and taken out of the answer.
166
+ - Canopy records and rate-limits each sign-in by the browser's address, which the proxy reads from the first entry of `X-Forwarded-For`. When your host does not set that header itself, pass `clientAddress: (request) => …` to `canopyProxy` with the address your host does provide.
167
+ - Where the Environment requires CAPTCHA, the form shows `<canopy-captcha>`: load its script on the sign-in page from `<Canopy's origin>/auth/static/canopy-captcha.js`.
168
+ - A remembered device (**Remember this device** on the second-factor challenge) is kept in its own encrypted cookie and offered on this browser's next sign-in.
106
169
 
107
- return <span>{user?.name}</span>;
108
- }
109
- ```
170
+ ## Permissions
110
171
 
111
- Pass a permission answer to a client component as a prop: check it with `can()` in the server component that renders it.
172
+ `can(permission, { nodeId })` from `auth()` answers whether the person holds `permission` at `nodeId` (walking its ancestors), or anywhere in the Environment without one. Pass the answer to a client component as a prop.
112
173
 
113
- ## What a request costs
174
+ **What a request costs.**
114
175
 
115
176
  - **A page with a valid session sends nothing to Canopy.** The proxy opens the cookie and reads the expiry, and `auth()` verifies the access token with signing keys read once and cached.
116
- - **A refresh happens once per session, about every 15 minutes.** Requests of one page that arrive together share it. Requests on other instances that refresh at the same moment are all answered with the same new refresh token, so none signs the person out.
117
- - **The commonest checks cost nothing.** A check with no node is answered from the token's `permissions` claim, and a check at the session's organization from `org_permissions`. That needs the `permissions` scope (`scopes` option), which works only on an OAuth client registered with it: a client created with the defaults refuses it with `invalid_scope`.
118
- - **A check at a node reads the identity's grants once,** with `CANOPY_API_KEY`, and holds them for 60 seconds, revalidating with an `ETag` that Canopy answers with an empty `304` when nothing changed. Repeating a check within that time asks nothing new.
119
- - **On a serverless host, the cache lives as long as the instance.** A warm instance behaves like a long-running server: about one grants read a minute per active person. A cold start begins empty and reads the grants and the hierarchy in full, so a host that starts a new instance for every page reads them on every page. Keep instances warm (for example Vercel's Fluid compute, or a minimum instance count) when pages check permissions at nodes.
177
+ - **A refresh happens about every 15 minutes per session.** Requests that refresh within 30 seconds of each other, on one instance or several, are answered with the same new refresh token, so a race between them does not sign the person out.
178
+ - **The commonest checks cost nothing.** A check with no node is answered from the token's `permissions` claim, and a check at the session's organization from `org_permissions`. On Hosted Login that needs the `permissions` scope (`scopes` option), which an OAuth client accepts only when registered with it: a client created with the defaults refuses it with `invalid_scope`. A session from the form carries them when the Environment turns on `direct_api_permissions_claim_enabled`.
179
+ - **A check at a node reads the identity's grants once,** with `CANOPY_API_KEY`, and holds them for 60 seconds, revalidating with an `ETag` that Canopy answers with an empty `304` when nothing changed.
180
+ - **On a serverless host, the cache lives as long as the instance.** A cold start reads the grants and the hierarchy in full, so a host that starts a new instance for every page reads them on every page. Keep instances warm (for example Vercel's Fluid compute, or a minimum instance count) when pages check permissions at nodes.
181
+
182
+ These checks decide what a page shows. Your API still verifies the access token (`TokenVerifier` in `@canopy-io/node`, with `audience` set to the `client_id` for Hosted Login, or to the Environment's id for a session from the form) and authorizes every request it receives.
183
+
184
+ ## Errors
185
+
186
+ - `CanopyConfigError`: something the package needs is missing or wrong, such as an unset environment variable or, on a custom auth domain, no `CANOPY_ENVIRONMENT_ID`. Its message names what is missing.
187
+ - `CanopySessionError`: Canopy refused or could not answer a sign-in, a refresh or a sign-out. `code` is Canopy's error (`invalid_grant`), or `connection_failed` when no answer could be read.
188
+ - The form's proxy route answers a failure to reach Canopy with `502` in Canopy's `{ error }` shape.
189
+
190
+ ## Learn more
120
191
 
121
- These checks decide what a page shows. Your API still verifies the access token (`TokenVerifier` in `@canopy-io/node`, with `audience` set to the `client_id`) and authorizes every request it receives.
192
+ - [Hosted Login for Next.js apps](https://canopy-io.com/docs/authentication/hosted-login#nextjs-apps)
193
+ - [Direct API](https://canopy-io.com/docs/authentication/direct-api)
194
+ - [Changelog](./CHANGELOG.md): the package is pre-1.0, so a minor version may carry a breaking change. Read the entry before upgrading.
122
195
 
123
196
  ## License
124
197
 
125
- MIT
198
+ MIT © Canopy Identity Inc.
package/dist/client.cjs CHANGED
@@ -22,10 +22,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var client_exports = {};
23
23
  __export(client_exports, {
24
24
  CanopySessionProvider: () => CanopySessionProvider,
25
+ SignInForm: () => SignInForm,
25
26
  useCanopySession: () => useCanopySession
26
27
  });
27
28
  module.exports = __toCommonJS(client_exports);
28
- var import_react = require("react");
29
+ var import_browser = require("@canopy-io/browser");
30
+ var import_react = require("@canopy-io/react");
31
+ var import_navigation = require("next/navigation");
32
+ var import_react2 = require("react");
33
+
34
+ // src/return-to.ts
35
+ function safeReturnTo(value) {
36
+ if (!value || !value.startsWith("/") || value.startsWith("//") || value.startsWith("/\\")) {
37
+ return "/";
38
+ }
39
+ return value;
40
+ }
41
+
42
+ // src/client.tsx
29
43
  var import_jsx_runtime = require("react/jsx-runtime");
30
44
  var SIGNED_OUT = {
31
45
  isSignedIn: false,
@@ -33,7 +47,7 @@ var SIGNED_OUT = {
33
47
  user: null,
34
48
  organization: { orgId: null, orgRoles: [], orgScope: null }
35
49
  };
36
- var SessionContext = (0, import_react.createContext)(SIGNED_OUT);
50
+ var SessionContext = (0, import_react2.createContext)(SIGNED_OUT);
37
51
  function CanopySessionProvider({
38
52
  session,
39
53
  children
@@ -41,6 +55,45 @@ function CanopySessionProvider({
41
55
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SessionContext.Provider, { value: session, children });
42
56
  }
43
57
  function useCanopySession() {
44
- return (0, import_react.useContext)(SessionContext);
58
+ return (0, import_react2.useContext)(SessionContext);
59
+ }
60
+ function SignInForm({
61
+ publishableKey,
62
+ canopyOrigin,
63
+ directPath,
64
+ returnTo,
65
+ onSignedIn,
66
+ ...form
67
+ }) {
68
+ const router = (0, import_navigation.useRouter)();
69
+ const client = (0, import_react2.useMemo)(() => {
70
+ if (safeReturnTo(directPath) !== directPath) {
71
+ throw new TypeError(
72
+ `SignInForm's directPath must be a path on this site, as signInFormProps() gives it; "${directPath}" is not one.`
73
+ );
74
+ }
75
+ return (0, import_browser.createCanopyDirectClient)({
76
+ publishableKey,
77
+ baseUrl: directPath,
78
+ publicBaseUrl: canopyOrigin,
79
+ session: "server"
80
+ });
81
+ }, [publishableKey, directPath, canopyOrigin]);
82
+ const destination = safeReturnTo(returnTo);
83
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
+ import_react.SignInForm,
85
+ {
86
+ ...form,
87
+ client,
88
+ onSignedIn: (step) => {
89
+ if (onSignedIn) {
90
+ onSignedIn(step);
91
+ return;
92
+ }
93
+ router.replace(destination);
94
+ router.refresh();
95
+ }
96
+ }
97
+ );
45
98
  }
46
99
  //# sourceMappingURL=client.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\n/**\n * What a client component may know about the session: who is signed in and\n * the organization, handed down from the server. It holds no token, and\n * nothing here sends a request.\n */\nexport interface CanopyClientSession {\n isSignedIn: boolean;\n userId: string | null;\n user: {\n sub: string;\n name?: string;\n email?: string;\n picture?: string;\n } | null;\n organization: {\n orgId: string | null;\n orgRoles: string[];\n orgScope: \"all\" | null;\n };\n}\n\nconst SIGNED_OUT: CanopyClientSession = {\n isSignedIn: false,\n userId: null,\n user: null,\n organization: { orgId: null, orgRoles: [], orgScope: null },\n};\n\nconst SessionContext = createContext<CanopyClientSession>(SIGNED_OUT);\n\n/**\n * Puts the session `clientSession()` read on the server where client\n * components can reach it. Render it in the root layout:\n * `<CanopySessionProvider session={clientSession(await auth())}>`.\n */\nexport function CanopySessionProvider({\n session,\n children,\n}: {\n session: CanopyClientSession;\n children?: ReactNode;\n}): ReactNode {\n return (\n <SessionContext.Provider value={session}>\n {children}\n </SessionContext.Provider>\n );\n}\n\n/** The session, in a client component. */\nexport function useCanopySession(): CanopyClientSession {\n return useContext(SessionContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0D;AA6CtD;AAtBJ,IAAM,aAAkC;AAAA,EACtC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,cAAc,EAAE,OAAO,MAAM,UAAU,CAAC,GAAG,UAAU,KAAK;AAC5D;AAEA,IAAM,qBAAiB,4BAAmC,UAAU;AAO7D,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AACF,GAGc;AACZ,SACE,4CAAC,eAAe,UAAf,EAAwB,OAAO,SAC7B,UACH;AAEJ;AAGO,SAAS,mBAAwC;AACtD,aAAO,yBAAW,cAAc;AAClC;","names":[]}
1
+ {"version":3,"sources":["../src/client.tsx","../src/return-to.ts"],"sourcesContent":["import {\n createCanopyDirectClient,\n type MountSignInOptions,\n type SignedInStep,\n} from \"@canopy-io/browser\";\nimport { SignInForm as EmbeddedSignInForm } from \"@canopy-io/react\";\nimport { useRouter } from \"next/navigation\";\nimport { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nimport { safeReturnTo } from \"./return-to\";\n\n/**\n * What a client component may know about the session: who is signed in and\n * the organization, handed down from the server. It holds no token, and\n * nothing here sends a request.\n */\nexport interface CanopyClientSession {\n isSignedIn: boolean;\n userId: string | null;\n user: {\n sub: string;\n name?: string;\n email?: string;\n picture?: string;\n } | null;\n organization: {\n orgId: string | null;\n orgRoles: string[];\n orgScope: \"all\" | null;\n };\n}\n\nconst SIGNED_OUT: CanopyClientSession = {\n isSignedIn: false,\n userId: null,\n user: null,\n organization: { orgId: null, orgRoles: [], orgScope: null },\n};\n\nconst SessionContext = createContext<CanopyClientSession>(SIGNED_OUT);\n\n/**\n * Puts the session `clientSession()` read on the server where client\n * components can reach it. Render it in the root layout:\n * `<CanopySessionProvider session={clientSession(await auth())}>`.\n */\nexport function CanopySessionProvider({\n session,\n children,\n}: {\n session: CanopyClientSession;\n children?: ReactNode;\n}): ReactNode {\n return (\n <SessionContext.Provider value={session}>\n {children}\n </SessionContext.Provider>\n );\n}\n\n/** The session, in a client component. */\nexport function useCanopySession(): CanopyClientSession {\n return useContext(SessionContext);\n}\n\n/**\n * What `signInFormProps()` reads from the server's configuration for\n * `<SignInForm>`: the three values the browser may see, and nothing else.\n */\nexport interface SignInFormConfig {\n /** The Environment's `web` publishable key. Not a secret. */\n publishableKey: string;\n /** Canopy's origin, where the browser reads the form's configuration, words and CSS. */\n canopyOrigin: string;\n /** The proxy's direct route, where the form's sign-in calls go. */\n directPath: string;\n}\n\nexport interface SignInFormProps extends SignInFormConfig {\n /** A path on this site to go to after a sign-in. Anything else is `/`. */\n returnTo?: string;\n language?: string;\n initialScreen?: \"sign-in\" | \"sign-up\";\n /** Published `--hp-*` tokens set on the form's root. */\n appearance?: NonNullable<MountSignInOptions[\"appearance\"]>;\n /** Called after a sign-in in place of going to `returnTo`. */\n onSignedIn?: (step: SignedInStep) => void;\n /** Shown until the form has drawn its first screen. */\n fallback?: ReactNode;\n className?: string;\n}\n\n/**\n * Canopy's sign-in and sign-up form, drawn in this page, signing in through\n * the proxy's direct route. The proxy keeps the session in the encrypted\n * cookie, so no token reaches the browser, and server components render\n * signed in once the form has finished: it then goes to `returnTo` and\n * refreshes the route, unless `onSignedIn` is given. Pass it\n * `signInFormProps()` from a server component.\n *\n * The form mounts once, after the page is in the browser; rendering again\n * with the same keys sends nothing.\n */\nexport function SignInForm({\n publishableKey,\n canopyOrigin,\n directPath,\n returnTo,\n onSignedIn,\n ...form\n}: SignInFormProps): ReactNode {\n const router = useRouter();\n const client = useMemo(() => {\n // The form posts the person's password here, so it is never another\n // site.\n if (safeReturnTo(directPath) !== directPath) {\n throw new TypeError(\n `SignInForm's directPath must be a path on this site, as signInFormProps() gives it; \"${directPath}\" is not one.`,\n );\n }\n\n return createCanopyDirectClient({\n publishableKey,\n baseUrl: directPath,\n publicBaseUrl: canopyOrigin,\n session: \"server\",\n });\n }, [publishableKey, directPath, canopyOrigin]);\n const destination = safeReturnTo(returnTo);\n\n return (\n <EmbeddedSignInForm\n {...form}\n client={client}\n onSignedIn={(step) => {\n if (onSignedIn) {\n onSignedIn(step);\n\n return;\n }\n\n router.replace(destination);\n router.refresh();\n }}\n />\n );\n}\n","/** Only a path on this site: never another origin, and never `//host`. */\nexport function safeReturnTo(value: string | null | undefined): string {\n if (\n !value ||\n !value.startsWith(\"/\") ||\n value.startsWith(\"//\") ||\n value.startsWith(\"/\\\\\")\n ) {\n return \"/\";\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAIO;AACP,mBAAiD;AACjD,wBAA0B;AAC1B,IAAAA,gBAAmE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edSignInForm"]}
package/dist/client.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import { MountSignInOptions, SignedInStep } from '@canopy-io/browser';
1
2
  import { ReactNode } from 'react';
2
3
 
3
4
  /**
@@ -31,5 +32,42 @@ declare function CanopySessionProvider({ session, children, }: {
31
32
  }): ReactNode;
32
33
  /** The session, in a client component. */
33
34
  declare function useCanopySession(): CanopyClientSession;
35
+ /**
36
+ * What `signInFormProps()` reads from the server's configuration for
37
+ * `<SignInForm>`: the three values the browser may see, and nothing else.
38
+ */
39
+ interface SignInFormConfig {
40
+ /** The Environment's `web` publishable key. Not a secret. */
41
+ publishableKey: string;
42
+ /** Canopy's origin, where the browser reads the form's configuration, words and CSS. */
43
+ canopyOrigin: string;
44
+ /** The proxy's direct route, where the form's sign-in calls go. */
45
+ directPath: string;
46
+ }
47
+ interface SignInFormProps extends SignInFormConfig {
48
+ /** A path on this site to go to after a sign-in. Anything else is `/`. */
49
+ returnTo?: string;
50
+ language?: string;
51
+ initialScreen?: "sign-in" | "sign-up";
52
+ /** Published `--hp-*` tokens set on the form's root. */
53
+ appearance?: NonNullable<MountSignInOptions["appearance"]>;
54
+ /** Called after a sign-in in place of going to `returnTo`. */
55
+ onSignedIn?: (step: SignedInStep) => void;
56
+ /** Shown until the form has drawn its first screen. */
57
+ fallback?: ReactNode;
58
+ className?: string;
59
+ }
60
+ /**
61
+ * Canopy's sign-in and sign-up form, drawn in this page, signing in through
62
+ * the proxy's direct route. The proxy keeps the session in the encrypted
63
+ * cookie, so no token reaches the browser, and server components render
64
+ * signed in once the form has finished: it then goes to `returnTo` and
65
+ * refreshes the route, unless `onSignedIn` is given. Pass it
66
+ * `signInFormProps()` from a server component.
67
+ *
68
+ * The form mounts once, after the page is in the browser; rendering again
69
+ * with the same keys sends nothing.
70
+ */
71
+ declare function SignInForm({ publishableKey, canopyOrigin, directPath, returnTo, onSignedIn, ...form }: SignInFormProps): ReactNode;
34
72
 
35
- export { type CanopyClientSession, CanopySessionProvider, useCanopySession };
73
+ export { type CanopyClientSession, CanopySessionProvider, SignInForm, type SignInFormConfig, type SignInFormProps, useCanopySession };
package/dist/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { MountSignInOptions, SignedInStep } from '@canopy-io/browser';
1
2
  import { ReactNode } from 'react';
2
3
 
3
4
  /**
@@ -31,5 +32,42 @@ declare function CanopySessionProvider({ session, children, }: {
31
32
  }): ReactNode;
32
33
  /** The session, in a client component. */
33
34
  declare function useCanopySession(): CanopyClientSession;
35
+ /**
36
+ * What `signInFormProps()` reads from the server's configuration for
37
+ * `<SignInForm>`: the three values the browser may see, and nothing else.
38
+ */
39
+ interface SignInFormConfig {
40
+ /** The Environment's `web` publishable key. Not a secret. */
41
+ publishableKey: string;
42
+ /** Canopy's origin, where the browser reads the form's configuration, words and CSS. */
43
+ canopyOrigin: string;
44
+ /** The proxy's direct route, where the form's sign-in calls go. */
45
+ directPath: string;
46
+ }
47
+ interface SignInFormProps extends SignInFormConfig {
48
+ /** A path on this site to go to after a sign-in. Anything else is `/`. */
49
+ returnTo?: string;
50
+ language?: string;
51
+ initialScreen?: "sign-in" | "sign-up";
52
+ /** Published `--hp-*` tokens set on the form's root. */
53
+ appearance?: NonNullable<MountSignInOptions["appearance"]>;
54
+ /** Called after a sign-in in place of going to `returnTo`. */
55
+ onSignedIn?: (step: SignedInStep) => void;
56
+ /** Shown until the form has drawn its first screen. */
57
+ fallback?: ReactNode;
58
+ className?: string;
59
+ }
60
+ /**
61
+ * Canopy's sign-in and sign-up form, drawn in this page, signing in through
62
+ * the proxy's direct route. The proxy keeps the session in the encrypted
63
+ * cookie, so no token reaches the browser, and server components render
64
+ * signed in once the form has finished: it then goes to `returnTo` and
65
+ * refreshes the route, unless `onSignedIn` is given. Pass it
66
+ * `signInFormProps()` from a server component.
67
+ *
68
+ * The form mounts once, after the page is in the browser; rendering again
69
+ * with the same keys sends nothing.
70
+ */
71
+ declare function SignInForm({ publishableKey, canopyOrigin, directPath, returnTo, onSignedIn, ...form }: SignInFormProps): ReactNode;
34
72
 
35
- export { type CanopyClientSession, CanopySessionProvider, useCanopySession };
73
+ export { type CanopyClientSession, CanopySessionProvider, SignInForm, type SignInFormConfig, type SignInFormProps, useCanopySession };
package/dist/client.js CHANGED
@@ -1,7 +1,22 @@
1
1
  "use client";
2
2
 
3
3
  // src/client.tsx
4
- import { createContext, useContext } from "react";
4
+ import {
5
+ createCanopyDirectClient
6
+ } from "@canopy-io/browser";
7
+ import { SignInForm as EmbeddedSignInForm } from "@canopy-io/react";
8
+ import { useRouter } from "next/navigation";
9
+ import { createContext, useContext, useMemo } from "react";
10
+
11
+ // src/return-to.ts
12
+ function safeReturnTo(value) {
13
+ if (!value || !value.startsWith("/") || value.startsWith("//") || value.startsWith("/\\")) {
14
+ return "/";
15
+ }
16
+ return value;
17
+ }
18
+
19
+ // src/client.tsx
5
20
  import { jsx } from "react/jsx-runtime";
6
21
  var SIGNED_OUT = {
7
22
  isSignedIn: false,
@@ -19,8 +34,48 @@ function CanopySessionProvider({
19
34
  function useCanopySession() {
20
35
  return useContext(SessionContext);
21
36
  }
37
+ function SignInForm({
38
+ publishableKey,
39
+ canopyOrigin,
40
+ directPath,
41
+ returnTo,
42
+ onSignedIn,
43
+ ...form
44
+ }) {
45
+ const router = useRouter();
46
+ const client = useMemo(() => {
47
+ if (safeReturnTo(directPath) !== directPath) {
48
+ throw new TypeError(
49
+ `SignInForm's directPath must be a path on this site, as signInFormProps() gives it; "${directPath}" is not one.`
50
+ );
51
+ }
52
+ return createCanopyDirectClient({
53
+ publishableKey,
54
+ baseUrl: directPath,
55
+ publicBaseUrl: canopyOrigin,
56
+ session: "server"
57
+ });
58
+ }, [publishableKey, directPath, canopyOrigin]);
59
+ const destination = safeReturnTo(returnTo);
60
+ return /* @__PURE__ */ jsx(
61
+ EmbeddedSignInForm,
62
+ {
63
+ ...form,
64
+ client,
65
+ onSignedIn: (step) => {
66
+ if (onSignedIn) {
67
+ onSignedIn(step);
68
+ return;
69
+ }
70
+ router.replace(destination);
71
+ router.refresh();
72
+ }
73
+ }
74
+ );
75
+ }
22
76
  export {
23
77
  CanopySessionProvider,
78
+ SignInForm,
24
79
  useCanopySession
25
80
  };
26
81
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\n/**\n * What a client component may know about the session: who is signed in and\n * the organization, handed down from the server. It holds no token, and\n * nothing here sends a request.\n */\nexport interface CanopyClientSession {\n isSignedIn: boolean;\n userId: string | null;\n user: {\n sub: string;\n name?: string;\n email?: string;\n picture?: string;\n } | null;\n organization: {\n orgId: string | null;\n orgRoles: string[];\n orgScope: \"all\" | null;\n };\n}\n\nconst SIGNED_OUT: CanopyClientSession = {\n isSignedIn: false,\n userId: null,\n user: null,\n organization: { orgId: null, orgRoles: [], orgScope: null },\n};\n\nconst SessionContext = createContext<CanopyClientSession>(SIGNED_OUT);\n\n/**\n * Puts the session `clientSession()` read on the server where client\n * components can reach it. Render it in the root layout:\n * `<CanopySessionProvider session={clientSession(await auth())}>`.\n */\nexport function CanopySessionProvider({\n session,\n children,\n}: {\n session: CanopyClientSession;\n children?: ReactNode;\n}): ReactNode {\n return (\n <SessionContext.Provider value={session}>\n {children}\n </SessionContext.Provider>\n );\n}\n\n/** The session, in a client component. */\nexport function useCanopySession(): CanopyClientSession {\n return useContext(SessionContext);\n}\n"],"mappings":";;;AAAA,SAAS,eAAe,kBAAkC;AA6CtD;AAtBJ,IAAM,aAAkC;AAAA,EACtC,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,cAAc,EAAE,OAAO,MAAM,UAAU,CAAC,GAAG,UAAU,KAAK;AAC5D;AAEA,IAAM,iBAAiB,cAAmC,UAAU;AAO7D,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AACF,GAGc;AACZ,SACE,oBAAC,eAAe,UAAf,EAAwB,OAAO,SAC7B,UACH;AAEJ;AAGO,SAAS,mBAAwC;AACtD,SAAO,WAAW,cAAc;AAClC;","names":[]}
1
+ {"version":3,"sources":["../src/client.tsx","../src/return-to.ts"],"sourcesContent":["import {\n createCanopyDirectClient,\n type MountSignInOptions,\n type SignedInStep,\n} from \"@canopy-io/browser\";\nimport { SignInForm as EmbeddedSignInForm } from \"@canopy-io/react\";\nimport { useRouter } from \"next/navigation\";\nimport { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nimport { safeReturnTo } from \"./return-to\";\n\n/**\n * What a client component may know about the session: who is signed in and\n * the organization, handed down from the server. It holds no token, and\n * nothing here sends a request.\n */\nexport interface CanopyClientSession {\n isSignedIn: boolean;\n userId: string | null;\n user: {\n sub: string;\n name?: string;\n email?: string;\n picture?: string;\n } | null;\n organization: {\n orgId: string | null;\n orgRoles: string[];\n orgScope: \"all\" | null;\n };\n}\n\nconst SIGNED_OUT: CanopyClientSession = {\n isSignedIn: false,\n userId: null,\n user: null,\n organization: { orgId: null, orgRoles: [], orgScope: null },\n};\n\nconst SessionContext = createContext<CanopyClientSession>(SIGNED_OUT);\n\n/**\n * Puts the session `clientSession()` read on the server where client\n * components can reach it. Render it in the root layout:\n * `<CanopySessionProvider session={clientSession(await auth())}>`.\n */\nexport function CanopySessionProvider({\n session,\n children,\n}: {\n session: CanopyClientSession;\n children?: ReactNode;\n}): ReactNode {\n return (\n <SessionContext.Provider value={session}>\n {children}\n </SessionContext.Provider>\n );\n}\n\n/** The session, in a client component. */\nexport function useCanopySession(): CanopyClientSession {\n return useContext(SessionContext);\n}\n\n/**\n * What `signInFormProps()` reads from the server's configuration for\n * `<SignInForm>`: the three values the browser may see, and nothing else.\n */\nexport interface SignInFormConfig {\n /** The Environment's `web` publishable key. Not a secret. */\n publishableKey: string;\n /** Canopy's origin, where the browser reads the form's configuration, words and CSS. */\n canopyOrigin: string;\n /** The proxy's direct route, where the form's sign-in calls go. */\n directPath: string;\n}\n\nexport interface SignInFormProps extends SignInFormConfig {\n /** A path on this site to go to after a sign-in. Anything else is `/`. */\n returnTo?: string;\n language?: string;\n initialScreen?: \"sign-in\" | \"sign-up\";\n /** Published `--hp-*` tokens set on the form's root. */\n appearance?: NonNullable<MountSignInOptions[\"appearance\"]>;\n /** Called after a sign-in in place of going to `returnTo`. */\n onSignedIn?: (step: SignedInStep) => void;\n /** Shown until the form has drawn its first screen. */\n fallback?: ReactNode;\n className?: string;\n}\n\n/**\n * Canopy's sign-in and sign-up form, drawn in this page, signing in through\n * the proxy's direct route. The proxy keeps the session in the encrypted\n * cookie, so no token reaches the browser, and server components render\n * signed in once the form has finished: it then goes to `returnTo` and\n * refreshes the route, unless `onSignedIn` is given. Pass it\n * `signInFormProps()` from a server component.\n *\n * The form mounts once, after the page is in the browser; rendering again\n * with the same keys sends nothing.\n */\nexport function SignInForm({\n publishableKey,\n canopyOrigin,\n directPath,\n returnTo,\n onSignedIn,\n ...form\n}: SignInFormProps): ReactNode {\n const router = useRouter();\n const client = useMemo(() => {\n // The form posts the person's password here, so it is never another\n // site.\n if (safeReturnTo(directPath) !== directPath) {\n throw new TypeError(\n `SignInForm's directPath must be a path on this site, as signInFormProps() gives it; \"${directPath}\" is not one.`,\n );\n }\n\n return createCanopyDirectClient({\n publishableKey,\n baseUrl: directPath,\n publicBaseUrl: canopyOrigin,\n session: \"server\",\n });\n }, [publishableKey, directPath, canopyOrigin]);\n const destination = safeReturnTo(returnTo);\n\n return (\n <EmbeddedSignInForm\n {...form}\n client={client}\n onSignedIn={(step) => {\n if (onSignedIn) {\n onSignedIn(step);\n\n return;\n }\n\n router.replace(destination);\n router.refresh();\n }}\n />\n );\n}\n","/** Only a path on this site: never another origin, and never `//host`. */\nexport function safeReturnTo(value: string | null | undefined): string {\n if (\n !value ||\n !value.startsWith(\"/\") ||\n value.startsWith(\"//\") ||\n value.startsWith(\"/\\\\\")\n ) {\n return \"/\";\n }\n\n return value;\n}\n"],"mappings":";;;AAAA;AAAA,EACE;AAAA,OAGK;AACP,SAAS,cAAc,0BAA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