@monocloud/auth-nextjs 0.1.5 → 0.1.6

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/README.md CHANGED
@@ -1,4 +1,21 @@
1
- ![MonoCloud Logo](https://raw.githubusercontent.com/monocloud/auth-js/refs/heads/main/MonoCloud.png)
1
+ <div align="center">
2
+ <a href="https://www.monocloud.com?utm_source=github&utm_medium=auth_js" target="_blank" rel="noopener noreferrer">
3
+ <picture>
4
+ <img src="https://raw.githubusercontent.com/monocloud/auth-js/refs/heads/main/packages/nextjs/banner.svg" alt="MonoCloud Banner">
5
+ </picture>
6
+ </a>
7
+ <div align="right">
8
+ <a href="https://www.npmjs.com/package/@monocloud/auth-nextjs" target="_blank">
9
+ <img src="https://img.shields.io/npm/v/@monocloud/auth-nextjs" alt="NPM" />
10
+ </a>
11
+ <a href="https://opensource.org/licenses/MIT">
12
+ <img src="https://img.shields.io/:license-MIT-blue.svg?style=flat" alt="License: MIT" />
13
+ </a>
14
+ <a href="https://github.com/monocloud/auth-js/actions/workflows/build.yml">
15
+ <img src="https://github.com/monocloud/auth-js/actions/workflows/build.yml/badge.svg" alt="Build Status" />
16
+ </a>
17
+ </div>
18
+ </div>
2
19
 
3
20
  ## Introduction
4
21
 
@@ -11,8 +28,8 @@ This SDK is designed specifically for **Next.js**, providing first-class integra
11
28
  ## 📘 Documentation
12
29
 
13
30
  - **Documentation:** [https://www.monocloud.com/docs](https://www.monocloud.com/docs?utm_source=github&utm_medium=auth_js)
14
- - **Quickstart:** [https://www.monocloud.com/docs/quickstarts/nextjs-app-router](https://www.monocloud.com/docs/quickstarts/nextjs-app-router?utm_source=github&utm_medium=auth_js)
15
- - **SDK Reference:** [https://www.monocloud.com/docs/sdk-reference/nextjs](https://www.monocloud.com/docs/sdk-reference/nextjs/index?utm_source=github&utm_medium=auth_js)
31
+ - **Quickstart:** [https://www.monocloud.com/docs/quickstarts/nextjs-app-router](https://www.monocloud.com/docs/quickstarts/nextjs-app-router?utm_source=github&utm_medium=auth_js)
32
+ - **SDK Reference:** [https://www.monocloud.com/docs/sdk-reference/nextjs](https://www.monocloud.com/docs/sdk-reference/nextjs/index?utm_source=github&utm_medium=auth_js)
16
33
  - **API Reference:** [https://monocloud.github.io/auth-js](https://monocloud.github.io/auth-js?utm_source=github&utm_medium=auth_js)
17
34
 
18
35
  ## Supported Platforms
@@ -1,4 +1,4 @@
1
- //#region rolldown:runtime
1
+ //#region \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,5 @@
1
- const require_client = require('../client-xfBYYato.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_protect = require('../protect-BCIji2i7.cjs');
2
3
 
3
- exports.protectPage = require_client.protectPage;
4
- exports.useAuth = require_client.useAuth;
4
+ exports.protectPage = require_protect.protectPage;
5
+ exports.useAuth = require_protect.useAuth;
@@ -1,6 +1,6 @@
1
- import { a as GroupOptions, i as ExtraAuthParams } from "../types-CsBjAJce.mjs";
1
+ import { a as GroupOptions, i as ExtraAuthParams } from "../types-Cx32VRoI.mjs";
2
2
  import { MonoCloudUser } from "@monocloud/auth-node-core";
3
- import React, { ComponentType, JSX } from "react";
3
+ import React, { ComponentType } from "react";
4
4
 
5
5
  //#region src/client/use-auth.d.ts
6
6
  /**
@@ -122,11 +122,11 @@ type ProtectPageOptions = {
122
122
  /**
123
123
  * A custom react element to render when the user is not authenticated.
124
124
  */
125
- fallback?: (user?: MonoCloudUser) => JSX.Element;
125
+ onAccessDenied?: () => React.ReactNode;
126
126
  /**
127
127
  * A custom react element to render when the user is authenticated but does not belong to the required groups.
128
128
  */
129
- groupFallback?: (user: MonoCloudUser) => JSX.Element;
129
+ onGroupAccessDenied?: (user: MonoCloudUser) => React.ReactNode;
130
130
  /**
131
131
  * Authorization parameters to be used during authentication.
132
132
  */
@@ -138,7 +138,7 @@ type ProtectPageOptions = {
138
138
  * @param error - The error object.
139
139
  * @returns JSX element to handle the error.
140
140
  */
141
- onError?: (error: Error) => JSX.Element;
141
+ onError?: (error: Error) => React.ReactNode;
142
142
  } & GroupOptions;
143
143
  /**
144
144
  * Function to protect a client rendered page component.
@@ -179,7 +179,7 @@ type ProtectPageOptions = {
179
179
  * { returnUrl: "/dashboard", authParams: { loginHint: "username" } }
180
180
  * );
181
181
  * ```
182
- * @example Custom Fallback
182
+ * @example Fallback with onAccessDenied
183
183
  *
184
184
  * ```tsx
185
185
  * "use client";
@@ -191,12 +191,12 @@ type ProtectPageOptions = {
191
191
  * return <>You are signed in</>;
192
192
  * },
193
193
  * {
194
- * fallback: () => <div>Please sign in to continue</div>
194
+ * onAccessDenied: () => <div>Please sign in to continue</div>
195
195
  * }
196
196
  * );
197
197
  * ```
198
198
  *
199
- * @example Group Protection with Group Fallback
199
+ * @example Group Protection with onGroupAccessDenied
200
200
  *
201
201
  * ```tsx
202
202
  * "use client";
@@ -209,7 +209,7 @@ type ProtectPageOptions = {
209
209
  * },
210
210
  * {
211
211
  * groups: ["admin"],
212
- * groupFallback: (user) => <div>User {user.email} is not an admin</div>
212
+ * onGroupAccessDenied: (user) => <div>User {user.email} is not an admin</div>
213
213
  * }
214
214
  * );
215
215
  * ```
@@ -1,3 +1,3 @@
1
- import { r as useAuth, t as protectPage } from "../client-D-3RMRNY.mjs";
1
+ import { r as useAuth, t as protectPage } from "../protect-K9srvUkq.mjs";
2
2
 
3
3
  export { protectPage, useAuth };
@@ -1,5 +1,7 @@
1
- const require_chunk = require('../../chunk-CbDLau6x.cjs');
2
- const require_client = require('../../client-xfBYYato.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('../../chunk-C0xms8kb.cjs');
3
+ const require_protect = require('../../protect-BCIji2i7.cjs');
4
+ require('../../client/index.cjs');
3
5
  let _monocloud_auth_node_core_utils = require("@monocloud/auth-node-core/utils");
4
6
  let react = require("react");
5
7
  react = require_chunk.__toESM(react);
@@ -92,7 +94,7 @@ react = require_chunk.__toESM(react);
92
94
  */
93
95
  const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
94
96
  (0, react.useEffect)(() => {
95
- require_client.redirectToSignIn({
97
+ require_protect.redirectToSignIn({
96
98
  returnUrl,
97
99
  ...authParams
98
100
  });
@@ -110,7 +112,7 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
110
112
  *
111
113
  * @param props - Props for customizing the Protected component.
112
114
  *
113
- * @returns The children if authorized, the `fallback` or `groupFallback` content if unauthenticated or unauthorized,
115
+ * @returns The children if authorized, the `fallback` or `onGroupAccessDenied` content if unauthenticated or unauthorized,
114
116
  * or `null` while loading.
115
117
  *
116
118
  * @example App Router
@@ -141,7 +143,7 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
141
143
  * export default function Home() {
142
144
  * return (
143
145
  * <Protected
144
- * groupFallback={<>Only admins are allowed.</>}
146
+ * onGroupAccessDenied={() => <>Only admins are allowed.</>}
145
147
  * groups={["admin"]}
146
148
  * >
147
149
  * <>Signed in as admin</>
@@ -174,7 +176,7 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
174
176
  * export default function Home() {
175
177
  * return (
176
178
  * <Protected
177
- * groupFallback={<>Only admins are allowed.</>}
179
+ * onGroupAccessDenied={(user) => <>User {user?.email} is not allowed.</>}
178
180
  * groups={["admin"]}
179
181
  * >
180
182
  * <>Signed in as admin</>
@@ -184,14 +186,14 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
184
186
  * ```
185
187
  *
186
188
  */
187
- const Protected = ({ children, groups, groupsClaim, matchAllGroups = false, fallback = null, groupFallback = null }) => {
188
- const { isLoading, error, isAuthenticated, user } = require_client.useAuth();
189
+ const Protected = ({ children, groups, groupsClaim, matchAllGroups = false, fallback = null, onGroupAccessDenied = () => /* @__PURE__ */ react.default.createElement(react.default.Fragment, null) }) => {
190
+ const { isLoading, error, isAuthenticated, user } = require_protect.useAuth();
189
191
  if (isLoading) return null;
190
192
  if (error || !isAuthenticated || !user) {
191
- if (fallback) return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, fallback);
193
+ if (fallback) return fallback;
192
194
  return null;
193
195
  }
194
- return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, !groups || (0, _monocloud_auth_node_core_utils.isUserInGroup)(user, groups, groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM, matchAllGroups) ? children : groupFallback);
196
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, !groups || (0, _monocloud_auth_node_core_utils.isUserInGroup)(user, groups, groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM, matchAllGroups) ? children : onGroupAccessDenied(user));
195
197
  };
196
198
 
197
199
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useAuth"],"sources":["../../../src/components/client/redirect-to-signin.tsx","../../../src/components/client/protected.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { redirectToSignIn } from '../../client/protect';\nimport { ExtraAuthParams } from '../../types';\n\n/**\n * Props for the `<RedirectToSignIn />` Component\n */\nexport interface RedirectToSignInProps extends ExtraAuthParams {\n /**\n * The url where the user will be redirected to after sign in.\n */\n returnUrl?: string;\n}\n\n/**\n * A client side component that will redirect users to the sign in page.\n *\n * **Note⚠️: Since `window.location` is set as `returnUrl` query param by default, you need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for returning to the same page.**\n *\n * @param props - The props for customizing RedirectToSignIn\n *\n * @returns\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example App Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n */\nexport const RedirectToSignIn = ({\n returnUrl,\n ...authParams\n}: RedirectToSignInProps): null => {\n useEffect(() => {\n redirectToSignIn({ returnUrl, ...authParams });\n }, [authParams, returnUrl]);\n return null;\n};\n","import { isUserInGroup } from '@monocloud/auth-node-core/utils';\nimport React, { JSX } from 'react';\nimport { useAuth } from '../../client';\n\nexport interface ProtectedComponentProps {\n /**\n * Components that should be rendered if the user is authenticated.\n */\n children: React.ReactNode;\n\n /**\n * A list of group names or IDs to which the user must belong to. The user should belong to atleast one of the specified groups.\n */\n groups?: string[];\n\n /**\n * Name of the claim of user's groups. default: `groups`.\n */\n groupsClaim?: string;\n\n /**\n * Flag indicating if all groups specified should be present in the users profile. default: false.\n */\n matchAllGroups?: boolean;\n\n /**\n * A fallback component that should render if the user is not authenticated.\n */\n fallback?: React.ReactNode;\n\n /**\n * A fallback component that should render if the user is authenticated but does not belong to the required groups.\n */\n groupFallback?: React.ReactNode;\n}\n\n/**\n * A wrapper component that conditionally renders its children based on the user's authentication\n * status and group membership.\n *\n * **Note⚠️: The component is hidden from view. The data is present in the browser. Use server side `protectPage()` for protecting components before that data is sent to the client.**\n *\n * @param props - Props for customizing the Protected component.\n *\n * @returns The children if authorized, the `fallback` or `groupFallback` content if unauthenticated or unauthorized,\n * or `null` while loading.\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example App Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * groupFallback={<>Only admins are allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * groupFallback={<>Only admins are allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n */\nexport const Protected = ({\n children,\n groups,\n groupsClaim,\n matchAllGroups = false,\n fallback = null,\n groupFallback = null,\n}: ProtectedComponentProps): JSX.Element | null => {\n const { isLoading, error, isAuthenticated, user } = useAuth();\n\n if (isLoading) {\n return null;\n }\n\n if (error || !isAuthenticated || !user) {\n if (fallback) {\n return <>{fallback}</>;\n }\n\n return null;\n }\n\n return (\n <>\n {!groups ||\n isUserInGroup(\n user,\n groups,\n groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM,\n matchAllGroups\n )\n ? children\n : groupFallback}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,MAAa,oBAAoB,EAC/B,WACA,GAAG,iBAC8B;AACjC,4BAAgB;AACd,kCAAiB;GAAE;GAAW,GAAG;GAAY,CAAC;IAC7C,CAAC,YAAY,UAAU,CAAC;AAC3B,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACUT,MAAa,aAAa,EACxB,UACA,QACA,aACA,iBAAiB,OACjB,WAAW,MACX,gBAAgB,WACiC;CACjD,MAAM,EAAE,WAAW,OAAO,iBAAiB,SAASA,wBAAS;AAE7D,KAAI,UACF,QAAO;AAGT,KAAI,SAAS,CAAC,mBAAmB,CAAC,MAAM;AACtC,MAAI,SACF,QAAO,0EAAG,SAAY;AAGxB,SAAO;;AAGT,QACE,0EACG,CAAC,6DAEA,MACA,QACA,eAAe,QAAQ,IAAI,yCAC3B,eACD,GACG,WACA,cACH"}
1
+ {"version":3,"file":"index.cjs","names":["useAuth"],"sources":["../../../src/components/client/redirect-to-signin.tsx","../../../src/components/client/protected.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { redirectToSignIn } from '../../client/protect';\nimport { ExtraAuthParams } from '../../types';\n\n/**\n * Props for the `<RedirectToSignIn />` Component\n */\nexport interface RedirectToSignInProps extends ExtraAuthParams {\n /**\n * The url where the user will be redirected to after sign in.\n */\n returnUrl?: string;\n}\n\n/**\n * A client side component that will redirect users to the sign in page.\n *\n * **Note⚠️: Since `window.location` is set as `returnUrl` query param by default, you need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for returning to the same page.**\n *\n * @param props - The props for customizing RedirectToSignIn\n *\n * @returns\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example App Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n */\nexport const RedirectToSignIn = ({\n returnUrl,\n ...authParams\n}: RedirectToSignInProps): null => {\n useEffect(() => {\n redirectToSignIn({ returnUrl, ...authParams });\n }, [authParams, returnUrl]);\n return null;\n};\n","import { isUserInGroup } from '@monocloud/auth-node-core/utils';\nimport React from 'react';\nimport { useAuth } from '../../client';\nimport type { MonoCloudUser } from '@monocloud/auth-node-core';\n\nexport interface ProtectedComponentProps {\n /**\n * Components that should be rendered if the user is authenticated.\n */\n children: React.ReactNode;\n\n /**\n * A list of group names or IDs to which the user must belong to. The user should belong to atleast one of the specified groups.\n */\n groups?: string[];\n\n /**\n * Name of the claim of user's groups. default: `groups`.\n */\n groupsClaim?: string;\n\n /**\n * Flag indicating if all groups specified should be present in the users profile. default: false.\n */\n matchAllGroups?: boolean;\n\n /**\n * A fallback component that should render if the user is not authenticated.\n */\n fallback?: React.ReactNode;\n\n /**\n * A fallback component that should render if the user is authenticated but does not belong to the required groups.\n */\n onGroupAccessDenied?: (user?: MonoCloudUser) => React.ReactNode;\n}\n\n/**\n * A wrapper component that conditionally renders its children based on the user's authentication\n * status and group membership.\n *\n * **Note⚠️: The component is hidden from view. The data is present in the browser. Use server side `protectPage()` for protecting components before that data is sent to the client.**\n *\n * @param props - Props for customizing the Protected component.\n *\n * @returns The children if authorized, the `fallback` or `onGroupAccessDenied` content if unauthenticated or unauthorized,\n * or `null` while loading.\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example App Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * onGroupAccessDenied={() => <>Only admins are allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * onGroupAccessDenied={(user) => <>User {user?.email} is not allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n */\nexport const Protected = ({\n children,\n groups,\n groupsClaim,\n matchAllGroups = false,\n fallback = null,\n onGroupAccessDenied = (): React.ReactNode => <></>,\n}: ProtectedComponentProps): React.ReactNode | null => {\n const { isLoading, error, isAuthenticated, user } = useAuth();\n\n if (isLoading) {\n return null;\n }\n\n if (error || !isAuthenticated || !user) {\n if (fallback) {\n return fallback;\n }\n\n return null;\n }\n\n return (\n <>\n {!groups ||\n isUserInGroup(\n user,\n groups,\n groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM,\n matchAllGroups\n )\n ? children\n : onGroupAccessDenied(user)}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,MAAa,oBAAoB,EAC/B,WACA,GAAG,iBAC8B;AACjC,4BAAgB;AACd,mCAAiB;GAAE;GAAW,GAAG;GAAY,CAAC;IAC7C,CAAC,YAAY,UAAU,CAAC;AAC3B,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACWT,MAAa,aAAa,EACxB,UACA,QACA,aACA,iBAAiB,OACjB,WAAW,MACX,4BAA6C,yEAAK,OACG;CACrD,MAAM,EAAE,WAAW,OAAO,iBAAiB,SAASA,yBAAS;AAE7D,KAAI,UACF,QAAO;AAGT,KAAI,SAAS,CAAC,mBAAmB,CAAC,MAAM;AACtC,MAAI,SACF,QAAO;AAGT,SAAO;;AAGT,QACE,0EACG,CAAC,6DAEA,MACA,QACA,eAAe,QAAQ,IAAI,yCAC3B,eACD,GACG,WACA,oBAAoB,KAAK,CAC5B"}
@@ -1,5 +1,6 @@
1
- import { i as ExtraAuthParams } from "../../types-CsBjAJce.mjs";
2
- import React, { JSX } from "react";
1
+ import { i as ExtraAuthParams } from "../../types-Cx32VRoI.mjs";
2
+ import { MonoCloudUser } from "@monocloud/auth-node-core";
3
+ import React from "react";
3
4
 
4
5
  //#region src/components/client/redirect-to-signin.d.ts
5
6
  /**
@@ -126,7 +127,7 @@ interface ProtectedComponentProps {
126
127
  /**
127
128
  * A fallback component that should render if the user is authenticated but does not belong to the required groups.
128
129
  */
129
- groupFallback?: React.ReactNode;
130
+ onGroupAccessDenied?: (user?: MonoCloudUser) => React.ReactNode;
130
131
  }
131
132
  /**
132
133
  * A wrapper component that conditionally renders its children based on the user's authentication
@@ -136,7 +137,7 @@ interface ProtectedComponentProps {
136
137
  *
137
138
  * @param props - Props for customizing the Protected component.
138
139
  *
139
- * @returns The children if authorized, the `fallback` or `groupFallback` content if unauthenticated or unauthorized,
140
+ * @returns The children if authorized, the `fallback` or `onGroupAccessDenied` content if unauthenticated or unauthorized,
140
141
  * or `null` while loading.
141
142
  *
142
143
  * @example App Router
@@ -167,7 +168,7 @@ interface ProtectedComponentProps {
167
168
  * export default function Home() {
168
169
  * return (
169
170
  * <Protected
170
- * groupFallback={<>Only admins are allowed.</>}
171
+ * onGroupAccessDenied={() => <>Only admins are allowed.</>}
171
172
  * groups={["admin"]}
172
173
  * >
173
174
  * <>Signed in as admin</>
@@ -200,7 +201,7 @@ interface ProtectedComponentProps {
200
201
  * export default function Home() {
201
202
  * return (
202
203
  * <Protected
203
- * groupFallback={<>Only admins are allowed.</>}
204
+ * onGroupAccessDenied={(user) => <>User {user?.email} is not allowed.</>}
204
205
  * groups={["admin"]}
205
206
  * >
206
207
  * <>Signed in as admin</>
@@ -216,8 +217,8 @@ declare const Protected: ({
216
217
  groupsClaim,
217
218
  matchAllGroups,
218
219
  fallback,
219
- groupFallback
220
- }: ProtectedComponentProps) => JSX.Element | null;
220
+ onGroupAccessDenied
221
+ }: ProtectedComponentProps) => React.ReactNode | null;
221
222
  //#endregion
222
223
  export { Protected, type ProtectedComponentProps, RedirectToSignIn, type RedirectToSignInProps };
223
224
  //# sourceMappingURL=index.d.mts.map
@@ -1,4 +1,5 @@
1
- import { n as redirectToSignIn, r as useAuth } from "../../client-D-3RMRNY.mjs";
1
+ import { n as redirectToSignIn, r as useAuth } from "../../protect-K9srvUkq.mjs";
2
+ import "../../client/index.mjs";
2
3
  import { isUserInGroup } from "@monocloud/auth-node-core/utils";
3
4
  import React, { useEffect } from "react";
4
5
 
@@ -108,7 +109,7 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
108
109
  *
109
110
  * @param props - Props for customizing the Protected component.
110
111
  *
111
- * @returns The children if authorized, the `fallback` or `groupFallback` content if unauthenticated or unauthorized,
112
+ * @returns The children if authorized, the `fallback` or `onGroupAccessDenied` content if unauthenticated or unauthorized,
112
113
  * or `null` while loading.
113
114
  *
114
115
  * @example App Router
@@ -139,7 +140,7 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
139
140
  * export default function Home() {
140
141
  * return (
141
142
  * <Protected
142
- * groupFallback={<>Only admins are allowed.</>}
143
+ * onGroupAccessDenied={() => <>Only admins are allowed.</>}
143
144
  * groups={["admin"]}
144
145
  * >
145
146
  * <>Signed in as admin</>
@@ -172,7 +173,7 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
172
173
  * export default function Home() {
173
174
  * return (
174
175
  * <Protected
175
- * groupFallback={<>Only admins are allowed.</>}
176
+ * onGroupAccessDenied={(user) => <>User {user?.email} is not allowed.</>}
176
177
  * groups={["admin"]}
177
178
  * >
178
179
  * <>Signed in as admin</>
@@ -182,14 +183,14 @@ const RedirectToSignIn = ({ returnUrl, ...authParams }) => {
182
183
  * ```
183
184
  *
184
185
  */
185
- const Protected = ({ children, groups, groupsClaim, matchAllGroups = false, fallback = null, groupFallback = null }) => {
186
+ const Protected = ({ children, groups, groupsClaim, matchAllGroups = false, fallback = null, onGroupAccessDenied = () => /* @__PURE__ */ React.createElement(React.Fragment, null) }) => {
186
187
  const { isLoading, error, isAuthenticated, user } = useAuth();
187
188
  if (isLoading) return null;
188
189
  if (error || !isAuthenticated || !user) {
189
- if (fallback) return /* @__PURE__ */ React.createElement(React.Fragment, null, fallback);
190
+ if (fallback) return fallback;
190
191
  return null;
191
192
  }
192
- return /* @__PURE__ */ React.createElement(React.Fragment, null, !groups || isUserInGroup(user, groups, groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM, matchAllGroups) ? children : groupFallback);
193
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, !groups || isUserInGroup(user, groups, groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM, matchAllGroups) ? children : onGroupAccessDenied(user));
193
194
  };
194
195
 
195
196
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/client/redirect-to-signin.tsx","../../../src/components/client/protected.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { redirectToSignIn } from '../../client/protect';\nimport { ExtraAuthParams } from '../../types';\n\n/**\n * Props for the `<RedirectToSignIn />` Component\n */\nexport interface RedirectToSignInProps extends ExtraAuthParams {\n /**\n * The url where the user will be redirected to after sign in.\n */\n returnUrl?: string;\n}\n\n/**\n * A client side component that will redirect users to the sign in page.\n *\n * **Note⚠️: Since `window.location` is set as `returnUrl` query param by default, you need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for returning to the same page.**\n *\n * @param props - The props for customizing RedirectToSignIn\n *\n * @returns\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example App Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n */\nexport const RedirectToSignIn = ({\n returnUrl,\n ...authParams\n}: RedirectToSignInProps): null => {\n useEffect(() => {\n redirectToSignIn({ returnUrl, ...authParams });\n }, [authParams, returnUrl]);\n return null;\n};\n","import { isUserInGroup } from '@monocloud/auth-node-core/utils';\nimport React, { JSX } from 'react';\nimport { useAuth } from '../../client';\n\nexport interface ProtectedComponentProps {\n /**\n * Components that should be rendered if the user is authenticated.\n */\n children: React.ReactNode;\n\n /**\n * A list of group names or IDs to which the user must belong to. The user should belong to atleast one of the specified groups.\n */\n groups?: string[];\n\n /**\n * Name of the claim of user's groups. default: `groups`.\n */\n groupsClaim?: string;\n\n /**\n * Flag indicating if all groups specified should be present in the users profile. default: false.\n */\n matchAllGroups?: boolean;\n\n /**\n * A fallback component that should render if the user is not authenticated.\n */\n fallback?: React.ReactNode;\n\n /**\n * A fallback component that should render if the user is authenticated but does not belong to the required groups.\n */\n groupFallback?: React.ReactNode;\n}\n\n/**\n * A wrapper component that conditionally renders its children based on the user's authentication\n * status and group membership.\n *\n * **Note⚠️: The component is hidden from view. The data is present in the browser. Use server side `protectPage()` for protecting components before that data is sent to the client.**\n *\n * @param props - Props for customizing the Protected component.\n *\n * @returns The children if authorized, the `fallback` or `groupFallback` content if unauthenticated or unauthorized,\n * or `null` while loading.\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example App Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * groupFallback={<>Only admins are allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * groupFallback={<>Only admins are allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n */\nexport const Protected = ({\n children,\n groups,\n groupsClaim,\n matchAllGroups = false,\n fallback = null,\n groupFallback = null,\n}: ProtectedComponentProps): JSX.Element | null => {\n const { isLoading, error, isAuthenticated, user } = useAuth();\n\n if (isLoading) {\n return null;\n }\n\n if (error || !isAuthenticated || !user) {\n if (fallback) {\n return <>{fallback}</>;\n }\n\n return null;\n }\n\n return (\n <>\n {!groups ||\n isUserInGroup(\n user,\n groups,\n groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM,\n matchAllGroups\n )\n ? children\n : groupFallback}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,MAAa,oBAAoB,EAC/B,WACA,GAAG,iBAC8B;AACjC,iBAAgB;AACd,mBAAiB;GAAE;GAAW,GAAG;GAAY,CAAC;IAC7C,CAAC,YAAY,UAAU,CAAC;AAC3B,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACUT,MAAa,aAAa,EACxB,UACA,QACA,aACA,iBAAiB,OACjB,WAAW,MACX,gBAAgB,WACiC;CACjD,MAAM,EAAE,WAAW,OAAO,iBAAiB,SAAS,SAAS;AAE7D,KAAI,UACF,QAAO;AAGT,KAAI,SAAS,CAAC,mBAAmB,CAAC,MAAM;AACtC,MAAI,SACF,QAAO,0DAAG,SAAY;AAGxB,SAAO;;AAGT,QACE,0DACG,CAAC,UACF,cACE,MACA,QACA,eAAe,QAAQ,IAAI,yCAC3B,eACD,GACG,WACA,cACH"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/client/redirect-to-signin.tsx","../../../src/components/client/protected.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { redirectToSignIn } from '../../client/protect';\nimport { ExtraAuthParams } from '../../types';\n\n/**\n * Props for the `<RedirectToSignIn />` Component\n */\nexport interface RedirectToSignInProps extends ExtraAuthParams {\n /**\n * The url where the user will be redirected to after sign in.\n */\n returnUrl?: string;\n}\n\n/**\n * A client side component that will redirect users to the sign in page.\n *\n * **Note⚠️: Since `window.location` is set as `returnUrl` query param by default, you need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for returning to the same page.**\n *\n * @param props - The props for customizing RedirectToSignIn\n *\n * @returns\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example App Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n *\n * @example Pages Router with options\n *\n * You can customize the authorization request by passing in props. See {@link RedirectToSignInProps}.\n *\n * ```tsx\n * import { useAuth } from \"@monocloud/auth-nextjs/client\";\n * import { RedirectToSignIn } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * const { isLoading, isAuthenticated } = useAuth();\n *\n * if (!isLoading && !isAuthenticated) {\n * return <RedirectToSignIn returnUrl=\"/dashboard\" loginHint=\"username\" />;\n * }\n *\n * return <>You are signed in</>;\n * }\n * ```\n */\nexport const RedirectToSignIn = ({\n returnUrl,\n ...authParams\n}: RedirectToSignInProps): null => {\n useEffect(() => {\n redirectToSignIn({ returnUrl, ...authParams });\n }, [authParams, returnUrl]);\n return null;\n};\n","import { isUserInGroup } from '@monocloud/auth-node-core/utils';\nimport React from 'react';\nimport { useAuth } from '../../client';\nimport type { MonoCloudUser } from '@monocloud/auth-node-core';\n\nexport interface ProtectedComponentProps {\n /**\n * Components that should be rendered if the user is authenticated.\n */\n children: React.ReactNode;\n\n /**\n * A list of group names or IDs to which the user must belong to. The user should belong to atleast one of the specified groups.\n */\n groups?: string[];\n\n /**\n * Name of the claim of user's groups. default: `groups`.\n */\n groupsClaim?: string;\n\n /**\n * Flag indicating if all groups specified should be present in the users profile. default: false.\n */\n matchAllGroups?: boolean;\n\n /**\n * A fallback component that should render if the user is not authenticated.\n */\n fallback?: React.ReactNode;\n\n /**\n * A fallback component that should render if the user is authenticated but does not belong to the required groups.\n */\n onGroupAccessDenied?: (user?: MonoCloudUser) => React.ReactNode;\n}\n\n/**\n * A wrapper component that conditionally renders its children based on the user's authentication\n * status and group membership.\n *\n * **Note⚠️: The component is hidden from view. The data is present in the browser. Use server side `protectPage()` for protecting components before that data is sent to the client.**\n *\n * @param props - Props for customizing the Protected component.\n *\n * @returns The children if authorized, the `fallback` or `onGroupAccessDenied` content if unauthenticated or unauthorized,\n * or `null` while loading.\n *\n * @example App Router\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example App Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * \"use client\";\n *\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * onGroupAccessDenied={() => <>Only admins are allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected fallback={<>Sign in to view the message.</>}>\n * <>You are breathtaking</>\n * </Protected>\n * );\n * }\n * ```\n *\n * @example Pages Router with group options\n *\n * See {@link ProtectedComponentProps}.\n *\n * ```tsx\n * import { Protected } from \"@monocloud/auth-nextjs/components/client\";\n *\n * export default function Home() {\n * return (\n * <Protected\n * onGroupAccessDenied={(user) => <>User {user?.email} is not allowed.</>}\n * groups={[\"admin\"]}\n * >\n * <>Signed in as admin</>\n * </Protected>\n * );\n * }\n * ```\n *\n */\nexport const Protected = ({\n children,\n groups,\n groupsClaim,\n matchAllGroups = false,\n fallback = null,\n onGroupAccessDenied = (): React.ReactNode => <></>,\n}: ProtectedComponentProps): React.ReactNode | null => {\n const { isLoading, error, isAuthenticated, user } = useAuth();\n\n if (isLoading) {\n return null;\n }\n\n if (error || !isAuthenticated || !user) {\n if (fallback) {\n return fallback;\n }\n\n return null;\n }\n\n return (\n <>\n {!groups ||\n isUserInGroup(\n user,\n groups,\n groupsClaim ?? process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_GROUPS_CLAIM,\n matchAllGroups\n )\n ? children\n : onGroupAccessDenied(user)}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,MAAa,oBAAoB,EAC/B,WACA,GAAG,iBAC8B;AACjC,iBAAgB;AACd,mBAAiB;GAAE;GAAW,GAAG;GAAY,CAAC;IAC7C,CAAC,YAAY,UAAU,CAAC;AAC3B,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACWT,MAAa,aAAa,EACxB,UACA,QACA,aACA,iBAAiB,OACjB,WAAW,MACX,4BAA6C,yDAAK,OACG;CACrD,MAAM,EAAE,WAAW,OAAO,iBAAiB,SAAS,SAAS;AAE7D,KAAI,UACF,QAAO;AAGT,KAAI,SAAS,CAAC,mBAAmB,CAAC,MAAM;AACtC,MAAI,SACF,QAAO;AAGT,SAAO;;AAGT,QACE,0DACG,CAAC,UACF,cACE,MACA,QACA,eAAe,QAAQ,IAAI,yCAC3B,eACD,GACG,WACA,oBAAoB,KAAK,CAC5B"}
@@ -1,4 +1,5 @@
1
- const require_chunk = require('../chunk-CbDLau6x.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('../chunk-C0xms8kb.cjs');
2
3
  let react = require("react");
3
4
  react = require_chunk.__toESM(react);
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/components/signin.tsx","../../src/components/signup.tsx","../../src/components/signout.tsx"],"sourcesContent":["import React, { JSX } from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignInProps extends ExtraAuthParams {\n children: React.ReactNode;\n /**\n * URL to redirect to after a successful sign-in.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-in flow.\n *\n * @param props - Properties for the SignIn component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the specified parameters.\n *\n * @example App Router and Pages Router\n *\n * **Sign-in component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignIn>Sign In</SignIn>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignInProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return (\n * <SignIn loginHint=\"username\" authenticatorHint=\"password\">\n * Sign In\n * </SignIn>\n * );\n * }\n * ```\n */\nexport const SignIn = ({\n children,\n authenticatorHint,\n loginHint,\n prompt,\n display,\n uiLocales,\n scopes,\n acrValues,\n resource,\n maxAge,\n returnUrl,\n ...props\n}: SignInProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): JSX.Element => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n if (authenticatorHint) {\n query.set('authenticator_hint', authenticatorHint);\n }\n\n if (prompt) {\n query.set('prompt', prompt);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (loginHint) {\n query.set('login_hint', loginHint);\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a\n href={`${signInUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n","import React, { JSX } from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignUpProps extends Omit<\n ExtraAuthParams,\n 'authenticatorHint' | 'loginHint' | 'prompt'\n> {\n /**\n * URL to redirect to after a successful sign-up.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-up flow.\n * * It functions similarly to the SignIn component but explicitly sets the `prompt` parameter to `create`.\n *\n * @param props - Properties for the SignUp component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.\n *\n * @example App Router and Pages Router\n *\n * **Sign-up component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp>Sign Up</SignUp>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignUpProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp returnUrl=\"/dashboard\">Sign Up</SignUp>;\n * }\n * ```\n */\nexport const SignUp = ({\n children,\n returnUrl,\n acrValues,\n display,\n maxAge,\n resource,\n scopes,\n uiLocales,\n ...props\n}: SignUpProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): JSX.Element => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n query.set('prompt', 'create');\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a href={`${signInUrl}?${query.toString()}`} {...props}>\n {children}\n </a>\n );\n};\n","import React, { JSX } from 'react';\n\nexport interface SignOutProps {\n /** URL to redirect the user to after they have been signed out. */\n postLogoutUrl?: string;\n\n /** Whether to also sign out the user from MonoCloud */\n federated?: boolean;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-out flow.\n *\n * @param props - Properties for the SignOut component.\n *\n * @returns An anchor element that links to the sign-out endpoint.\n *\n * @example App Router and Pages Router\n *\n * **Sign-out component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut>Sign Out</SignOut>;\n * }\n * ```\n *\n * @example Customize the request\n *\n * You can customize the request by passing in props. See {@link SignOutProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut federated={true}>Sign Out</SignOut>;\n * }\n * ```\n */\nexport const SignOut = ({\n children,\n postLogoutUrl,\n federated,\n ...props\n}: SignOutProps &\n React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element => {\n const signOutUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNOUT_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signout`;\n\n const query = new URLSearchParams();\n\n if (postLogoutUrl) {\n query.set('post_logout_url', postLogoutUrl);\n }\n\n if (typeof federated === 'boolean') {\n query.set('federated', federated.toString());\n }\n\n return (\n <a\n href={`${signOutUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,UAAU,EACrB,UACA,mBACA,WACA,QACA,SACA,WACA,QACA,WACA,UACA,QACA,WACA,GAAG,YAKgB;CACnB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,kBACF,OAAM,IAAI,sBAAsB,kBAAkB;AAGpD,KAAI,OACF,OAAM,IAAI,UAAU,OAAO;AAG7B,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,4CAAC;EACC,MAAM,GAAG,YAAY,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC3D,GAAI;IAEH,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxER,MAAa,UAAU,EACrB,UACA,WACA,WACA,SACA,QACA,UACA,QACA,WACA,GAAG,YAKgB;CACnB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,OAAM,IAAI,UAAU,SAAS;AAE7B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,4CAAC;EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,UAAU;EAAI,GAAI;IAC9C,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/DR,MAAa,WAAW,EACtB,UACA,eACA,WACA,GAAG,YAE4D;CAC/D,MAAM,aACJ,QAAQ,IAAI,0CAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,cACF,OAAM,IAAI,mBAAmB,cAAc;AAG7C,KAAI,OAAO,cAAc,UACvB,OAAM,IAAI,aAAa,UAAU,UAAU,CAAC;AAG9C,QACE,4CAAC;EACC,MAAM,GAAG,aAAa,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC5D,GAAI;IAEH,SACC"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/components/signin.tsx","../../src/components/signup.tsx","../../src/components/signout.tsx"],"sourcesContent":["import React from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignInProps extends ExtraAuthParams {\n children: React.ReactNode;\n /**\n * URL to redirect to after a successful sign-in.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-in flow.\n *\n * @param props - Properties for the SignIn component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the specified parameters.\n *\n * @example App Router and Pages Router\n *\n * **Sign-in component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignIn>Sign In</SignIn>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignInProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return (\n * <SignIn loginHint=\"username\" authenticatorHint=\"password\">\n * Sign In\n * </SignIn>\n * );\n * }\n * ```\n */\nexport const SignIn = ({\n children,\n authenticatorHint,\n loginHint,\n prompt,\n display,\n uiLocales,\n scopes,\n acrValues,\n resource,\n maxAge,\n returnUrl,\n ...props\n}: SignInProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): React.ReactNode => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n if (authenticatorHint) {\n query.set('authenticator_hint', authenticatorHint);\n }\n\n if (prompt) {\n query.set('prompt', prompt);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (loginHint) {\n query.set('login_hint', loginHint);\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a\n href={`${signInUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n","import React from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignUpProps extends Omit<\n ExtraAuthParams,\n 'authenticatorHint' | 'loginHint' | 'prompt'\n> {\n /**\n * URL to redirect to after a successful sign-up.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-up flow.\n * * It functions similarly to the SignIn component but explicitly sets the `prompt` parameter to `create`.\n *\n * @param props - Properties for the SignUp component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.\n *\n * @example App Router and Pages Router\n *\n * **Sign-up component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp>Sign Up</SignUp>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignUpProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp returnUrl=\"/dashboard\">Sign Up</SignUp>;\n * }\n * ```\n */\nexport const SignUp = ({\n children,\n returnUrl,\n acrValues,\n display,\n maxAge,\n resource,\n scopes,\n uiLocales,\n ...props\n}: SignUpProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): React.ReactNode => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n query.set('prompt', 'create');\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a href={`${signInUrl}?${query.toString()}`} {...props}>\n {children}\n </a>\n );\n};\n","import React from 'react';\n\nexport interface SignOutProps {\n /** URL to redirect the user to after they have been signed out. */\n postLogoutUrl?: string;\n\n /** Whether to also sign out the user from MonoCloud */\n federated?: boolean;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-out flow.\n *\n * @param props - Properties for the SignOut component.\n *\n * @returns An anchor element that links to the sign-out endpoint.\n *\n * @example App Router and Pages Router\n *\n * **Sign-out component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut>Sign Out</SignOut>;\n * }\n * ```\n *\n * @example Customize the request\n *\n * You can customize the request by passing in props. See {@link SignOutProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut federated={true}>Sign Out</SignOut>;\n * }\n * ```\n */\nexport const SignOut = ({\n children,\n postLogoutUrl,\n federated,\n ...props\n}: SignOutProps &\n React.AnchorHTMLAttributes<HTMLAnchorElement>): React.ReactNode => {\n const signOutUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNOUT_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signout`;\n\n const query = new URLSearchParams();\n\n if (postLogoutUrl) {\n query.set('post_logout_url', postLogoutUrl);\n }\n\n if (typeof federated === 'boolean') {\n query.set('federated', federated.toString());\n }\n\n return (\n <a\n href={`${signOutUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,UAAU,EACrB,UACA,mBACA,WACA,QACA,SACA,WACA,QACA,WACA,UACA,QACA,WACA,GAAG,YAKoB;CACvB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,kBACF,OAAM,IAAI,sBAAsB,kBAAkB;AAGpD,KAAI,OACF,OAAM,IAAI,UAAU,OAAO;AAG7B,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,4CAAC;EACC,MAAM,GAAG,YAAY,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC3D,GAAI;IAEH,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxER,MAAa,UAAU,EACrB,UACA,WACA,WACA,SACA,QACA,UACA,QACA,WACA,GAAG,YAKoB;CACvB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,OAAM,IAAI,UAAU,SAAS;AAE7B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,4CAAC;EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,UAAU;EAAI,GAAI;IAC9C,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/DR,MAAa,WAAW,EACtB,UACA,eACA,WACA,GAAG,YAEgE;CACnE,MAAM,aACJ,QAAQ,IAAI,0CAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,cACF,OAAM,IAAI,mBAAmB,cAAc;AAG7C,KAAI,OAAO,cAAc,UACvB,OAAM,IAAI,aAAa,UAAU,UAAU,CAAC;AAG9C,QACE,4CAAC;EACC,MAAM,GAAG,aAAa,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC5D,GAAI;IAEH,SACC"}
@@ -1,5 +1,5 @@
1
- import { i as ExtraAuthParams } from "../types-CsBjAJce.mjs";
2
- import React, { JSX } from "react";
1
+ import { i as ExtraAuthParams } from "../types-Cx32VRoI.mjs";
2
+ import React from "react";
3
3
 
4
4
  //#region src/components/signin.d.ts
5
5
  interface SignInProps extends ExtraAuthParams {
@@ -59,7 +59,7 @@ declare const SignIn: ({
59
59
  maxAge,
60
60
  returnUrl,
61
61
  ...props
62
- }: SignInProps & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "resource">) => JSX.Element;
62
+ }: SignInProps & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "resource">) => React.ReactNode;
63
63
  //#endregion
64
64
  //#region src/components/signup.d.ts
65
65
  interface SignUpProps extends Omit<ExtraAuthParams, 'authenticatorHint' | 'loginHint' | 'prompt'> {
@@ -112,7 +112,7 @@ declare const SignUp: ({
112
112
  scopes,
113
113
  uiLocales,
114
114
  ...props
115
- }: SignUpProps & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "resource">) => JSX.Element;
115
+ }: SignUpProps & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "resource">) => React.ReactNode;
116
116
  //#endregion
117
117
  //#region src/components/signout.d.ts
118
118
  interface SignOutProps {
@@ -159,7 +159,7 @@ declare const SignOut: ({
159
159
  postLogoutUrl,
160
160
  federated,
161
161
  ...props
162
- }: SignOutProps & React.AnchorHTMLAttributes<HTMLAnchorElement>) => JSX.Element;
162
+ }: SignOutProps & React.AnchorHTMLAttributes<HTMLAnchorElement>) => React.ReactNode;
163
163
  //#endregion
164
164
  export { SignIn, type SignInProps, SignOut, type SignOutProps, SignUp, type SignUpProps };
165
165
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/components/signin.tsx","../../src/components/signup.tsx","../../src/components/signout.tsx"],"sourcesContent":["import React, { JSX } from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignInProps extends ExtraAuthParams {\n children: React.ReactNode;\n /**\n * URL to redirect to after a successful sign-in.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-in flow.\n *\n * @param props - Properties for the SignIn component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the specified parameters.\n *\n * @example App Router and Pages Router\n *\n * **Sign-in component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignIn>Sign In</SignIn>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignInProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return (\n * <SignIn loginHint=\"username\" authenticatorHint=\"password\">\n * Sign In\n * </SignIn>\n * );\n * }\n * ```\n */\nexport const SignIn = ({\n children,\n authenticatorHint,\n loginHint,\n prompt,\n display,\n uiLocales,\n scopes,\n acrValues,\n resource,\n maxAge,\n returnUrl,\n ...props\n}: SignInProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): JSX.Element => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n if (authenticatorHint) {\n query.set('authenticator_hint', authenticatorHint);\n }\n\n if (prompt) {\n query.set('prompt', prompt);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (loginHint) {\n query.set('login_hint', loginHint);\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a\n href={`${signInUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n","import React, { JSX } from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignUpProps extends Omit<\n ExtraAuthParams,\n 'authenticatorHint' | 'loginHint' | 'prompt'\n> {\n /**\n * URL to redirect to after a successful sign-up.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-up flow.\n * * It functions similarly to the SignIn component but explicitly sets the `prompt` parameter to `create`.\n *\n * @param props - Properties for the SignUp component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.\n *\n * @example App Router and Pages Router\n *\n * **Sign-up component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp>Sign Up</SignUp>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignUpProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp returnUrl=\"/dashboard\">Sign Up</SignUp>;\n * }\n * ```\n */\nexport const SignUp = ({\n children,\n returnUrl,\n acrValues,\n display,\n maxAge,\n resource,\n scopes,\n uiLocales,\n ...props\n}: SignUpProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): JSX.Element => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n query.set('prompt', 'create');\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a href={`${signInUrl}?${query.toString()}`} {...props}>\n {children}\n </a>\n );\n};\n","import React, { JSX } from 'react';\n\nexport interface SignOutProps {\n /** URL to redirect the user to after they have been signed out. */\n postLogoutUrl?: string;\n\n /** Whether to also sign out the user from MonoCloud */\n federated?: boolean;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-out flow.\n *\n * @param props - Properties for the SignOut component.\n *\n * @returns An anchor element that links to the sign-out endpoint.\n *\n * @example App Router and Pages Router\n *\n * **Sign-out component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut>Sign Out</SignOut>;\n * }\n * ```\n *\n * @example Customize the request\n *\n * You can customize the request by passing in props. See {@link SignOutProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut federated={true}>Sign Out</SignOut>;\n * }\n * ```\n */\nexport const SignOut = ({\n children,\n postLogoutUrl,\n federated,\n ...props\n}: SignOutProps &\n React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element => {\n const signOutUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNOUT_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signout`;\n\n const query = new URLSearchParams();\n\n if (postLogoutUrl) {\n query.set('post_logout_url', postLogoutUrl);\n }\n\n if (typeof federated === 'boolean') {\n query.set('federated', federated.toString());\n }\n\n return (\n <a\n href={`${signOutUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,UAAU,EACrB,UACA,mBACA,WACA,QACA,SACA,WACA,QACA,WACA,UACA,QACA,WACA,GAAG,YAKgB;CACnB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,kBACF,OAAM,IAAI,sBAAsB,kBAAkB;AAGpD,KAAI,OACF,OAAM,IAAI,UAAU,OAAO;AAG7B,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,oCAAC;EACC,MAAM,GAAG,YAAY,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC3D,GAAI;IAEH,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxER,MAAa,UAAU,EACrB,UACA,WACA,WACA,SACA,QACA,UACA,QACA,WACA,GAAG,YAKgB;CACnB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,OAAM,IAAI,UAAU,SAAS;AAE7B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,oCAAC;EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,UAAU;EAAI,GAAI;IAC9C,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/DR,MAAa,WAAW,EACtB,UACA,eACA,WACA,GAAG,YAE4D;CAC/D,MAAM,aACJ,QAAQ,IAAI,0CAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,cACF,OAAM,IAAI,mBAAmB,cAAc;AAG7C,KAAI,OAAO,cAAc,UACvB,OAAM,IAAI,aAAa,UAAU,UAAU,CAAC;AAG9C,QACE,oCAAC;EACC,MAAM,GAAG,aAAa,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC5D,GAAI;IAEH,SACC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/components/signin.tsx","../../src/components/signup.tsx","../../src/components/signout.tsx"],"sourcesContent":["import React from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignInProps extends ExtraAuthParams {\n children: React.ReactNode;\n /**\n * URL to redirect to after a successful sign-in.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-in flow.\n *\n * @param props - Properties for the SignIn component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the specified parameters.\n *\n * @example App Router and Pages Router\n *\n * **Sign-in component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignIn>Sign In</SignIn>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignInProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignIn } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return (\n * <SignIn loginHint=\"username\" authenticatorHint=\"password\">\n * Sign In\n * </SignIn>\n * );\n * }\n * ```\n */\nexport const SignIn = ({\n children,\n authenticatorHint,\n loginHint,\n prompt,\n display,\n uiLocales,\n scopes,\n acrValues,\n resource,\n maxAge,\n returnUrl,\n ...props\n}: SignInProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): React.ReactNode => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n if (authenticatorHint) {\n query.set('authenticator_hint', authenticatorHint);\n }\n\n if (prompt) {\n query.set('prompt', prompt);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (loginHint) {\n query.set('login_hint', loginHint);\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a\n href={`${signInUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n","import React from 'react';\nimport { ExtraAuthParams } from '../types';\n\nexport interface SignUpProps extends Omit<\n ExtraAuthParams,\n 'authenticatorHint' | 'loginHint' | 'prompt'\n> {\n /**\n * URL to redirect to after a successful sign-up.\n */\n returnUrl?: string;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-up flow.\n * * It functions similarly to the SignIn component but explicitly sets the `prompt` parameter to `create`.\n *\n * @param props - Properties for the SignUp component.\n *\n * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.\n *\n * @example App Router and Pages Router\n *\n * **Sign-up component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp>Sign Up</SignUp>;\n * }\n * ```\n *\n * @example Customize the authorization request\n *\n * You can customize the authorization request by passing in props. See {@link SignUpProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignUp } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignUp returnUrl=\"/dashboard\">Sign Up</SignUp>;\n * }\n * ```\n */\nexport const SignUp = ({\n children,\n returnUrl,\n acrValues,\n display,\n maxAge,\n resource,\n scopes,\n uiLocales,\n ...props\n}: SignUpProps &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'resource'\n >): React.ReactNode => {\n const signInUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signin`;\n\n const query = new URLSearchParams();\n\n query.set('prompt', 'create');\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n if (display) {\n query.set('display', display);\n }\n\n if (uiLocales) {\n query.set('ui_locales', uiLocales);\n }\n\n if (scopes) {\n query.set('scope', scopes);\n }\n\n if (acrValues) {\n query.set('acr_values', acrValues.join(' '));\n }\n\n if (resource) {\n query.set('resource', resource);\n }\n\n if (maxAge) {\n query.set('max_age', maxAge.toString());\n }\n\n if (returnUrl) {\n query.set('return_url', returnUrl);\n }\n\n return (\n <a href={`${signInUrl}?${query.toString()}`} {...props}>\n {children}\n </a>\n );\n};\n","import React from 'react';\n\nexport interface SignOutProps {\n /** URL to redirect the user to after they have been signed out. */\n postLogoutUrl?: string;\n\n /** Whether to also sign out the user from MonoCloud */\n federated?: boolean;\n}\n\n/**\n * A component that renders an anchor tag configured to initiate the sign-out flow.\n *\n * @param props - Properties for the SignOut component.\n *\n * @returns An anchor element that links to the sign-out endpoint.\n *\n * @example App Router and Pages Router\n *\n * **Sign-out component works on both the server and the client in pages router and app router.**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut>Sign Out</SignOut>;\n * }\n * ```\n *\n * @example Customize the request\n *\n * You can customize the request by passing in props. See {@link SignOutProps}.\n *\n * **Note⚠️: You need to set the env `MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDES=true` or `allowQueryParamOverrides` should be `true` in the client initialization for props to work**\n *\n * ```tsx\n * import { SignOut } from \"@monocloud/auth-nextjs/components\";\n *\n * export default function Home() {\n * return <SignOut federated={true}>Sign Out</SignOut>;\n * }\n * ```\n */\nexport const SignOut = ({\n children,\n postLogoutUrl,\n federated,\n ...props\n}: SignOutProps &\n React.AnchorHTMLAttributes<HTMLAnchorElement>): React.ReactNode => {\n const signOutUrl =\n process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNOUT_URL ??\n // eslint-disable-next-line no-underscore-dangle\n `${process.env.__NEXT_ROUTER_BASEPATH ?? ''}/api/auth/signout`;\n\n const query = new URLSearchParams();\n\n if (postLogoutUrl) {\n query.set('post_logout_url', postLogoutUrl);\n }\n\n if (typeof federated === 'boolean') {\n query.set('federated', federated.toString());\n }\n\n return (\n <a\n href={`${signOutUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,UAAU,EACrB,UACA,mBACA,WACA,QACA,SACA,WACA,QACA,WACA,UACA,QACA,WACA,GAAG,YAKoB;CACvB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,kBACF,OAAM,IAAI,sBAAsB,kBAAkB;AAGpD,KAAI,OACF,OAAM,IAAI,UAAU,OAAO;AAG7B,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,oCAAC;EACC,MAAM,GAAG,YAAY,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC3D,GAAI;IAEH,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxER,MAAa,UAAU,EACrB,UACA,WACA,WACA,SACA,QACA,UACA,QACA,WACA,GAAG,YAKoB;CACvB,MAAM,YACJ,QAAQ,IAAI,yCAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,OAAM,IAAI,UAAU,SAAS;AAE7B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,QACF,OAAM,IAAI,WAAW,QAAQ;AAG/B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,KAAI,OACF,OAAM,IAAI,SAAS,OAAO;AAG5B,KAAI,UACF,OAAM,IAAI,cAAc,UAAU,KAAK,IAAI,CAAC;AAG9C,KAAI,SACF,OAAM,IAAI,YAAY,SAAS;AAGjC,KAAI,OACF,OAAM,IAAI,WAAW,OAAO,UAAU,CAAC;AAGzC,KAAI,UACF,OAAM,IAAI,cAAc,UAAU;AAGpC,QACE,oCAAC;EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,UAAU;EAAI,GAAI;IAC9C,SACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/DR,MAAa,WAAW,EACtB,UACA,eACA,WACA,GAAG,YAEgE;CACnE,MAAM,aACJ,QAAQ,IAAI,0CAEZ,GAAG,QAAQ,IAAI,0BAA0B,GAAG;CAE9C,MAAM,QAAQ,IAAI,iBAAiB;AAEnC,KAAI,cACF,OAAM,IAAI,mBAAmB,cAAc;AAG7C,KAAI,OAAO,cAAc,UACvB,OAAM,IAAI,aAAa,UAAU,UAAU,CAAC;AAG9C,QACE,oCAAC;EACC,MAAM,GAAG,aAAa,MAAM,OAAO,IAAI,MAAM,UAAU,KAAK;EAC5D,GAAI;IAEH,SACC"}