@monocloud/auth-nextjs 0.1.1 → 0.1.3

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.
@@ -9,6 +9,36 @@ react = require_chunk.__toESM(react);
9
9
  * @param props - Properties for the SignIn component.
10
10
  *
11
11
  * @returns An anchor element that links to the sign-in endpoint with the specified parameters.
12
+ *
13
+ * @example App Router and Pages Router
14
+ *
15
+ * **Sign-in component works on both the server and the client in pages router and app router.**
16
+ *
17
+ * ```tsx
18
+ * import { SignIn } from "@monocloud/auth-nextjs/components";
19
+ *
20
+ * export default function Home() {
21
+ * return <SignIn>Sign In</SignIn>;
22
+ * }
23
+ * ```
24
+ *
25
+ * @example Customize the authorization request
26
+ *
27
+ * You can customize the authorization request by passing in props. See {@link SignInProps}.
28
+ *
29
+ * **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**
30
+ *
31
+ * ```tsx
32
+ * import { SignIn } from "@monocloud/auth-nextjs/components";
33
+ *
34
+ * export default function Home() {
35
+ * return (
36
+ * <SignIn loginHint="username" authenticatorHint="password">
37
+ * Sign In
38
+ * </SignIn>
39
+ * );
40
+ * }
41
+ * ```
12
42
  */
13
43
  const SignIn = ({ children, authenticatorHint, loginHint, prompt, display, uiLocales, scopes, acrValues, resource, maxAge, returnUrl, ...props }) => {
14
44
  const signInUrl = process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ?? `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/api/auth/signin`;
@@ -38,6 +68,32 @@ const SignIn = ({ children, authenticatorHint, loginHint, prompt, display, uiLoc
38
68
  * @param props - Properties for the SignUp component.
39
69
  *
40
70
  * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.
71
+ *
72
+ * @example App Router and Pages Router
73
+ *
74
+ * **Sign-up component works on both the server and the client in pages router and app router.**
75
+ *
76
+ * ```tsx
77
+ * import { SignUp } from "@monocloud/auth-nextjs/components";
78
+ *
79
+ * export default function Home() {
80
+ * return <SignUp>Sign Up</SignUp>;
81
+ * }
82
+ * ```
83
+ *
84
+ * @example Customize the authorization request
85
+ *
86
+ * You can customize the authorization request by passing in props. See {@link SignUpProps}.
87
+ *
88
+ * **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**
89
+ *
90
+ * ```tsx
91
+ * import { SignUp } from "@monocloud/auth-nextjs/components";
92
+ *
93
+ * export default function Home() {
94
+ * return <SignUp returnUrl="/dashboard">Sign Up</SignUp>;
95
+ * }
96
+ * ```
41
97
  */
42
98
  const SignUp = ({ children, returnUrl, acrValues, display, maxAge, resource, scopes, uiLocales, ...props }) => {
43
99
  const signInUrl = process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ?? `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/api/auth/signin`;
@@ -65,11 +121,38 @@ const SignUp = ({ children, returnUrl, acrValues, display, maxAge, resource, sco
65
121
  * @param props - Properties for the SignOut component.
66
122
  *
67
123
  * @returns An anchor element that links to the sign-out endpoint.
124
+ *
125
+ * @example App Router and Pages Router
126
+ *
127
+ * **Sign-out component works on both the server and the client in pages router and app router.**
128
+ *
129
+ * ```tsx
130
+ * import { SignOut } from "@monocloud/auth-nextjs/components";
131
+ *
132
+ * export default function Home() {
133
+ * return <SignOut>Sign Out</SignOut>;
134
+ * }
135
+ * ```
136
+ *
137
+ * @example Customize the request
138
+ *
139
+ * You can customize the request by passing in props. See {@link SignOutProps}.
140
+ *
141
+ * **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**
142
+ *
143
+ * ```tsx
144
+ * import { SignOut } from "@monocloud/auth-nextjs/components";
145
+ *
146
+ * export default function Home() {
147
+ * return <SignOut federated={true}>Sign Out</SignOut>;
148
+ * }
149
+ * ```
68
150
  */
69
- const SignOut = ({ children, postLogoutUrl, ...props }) => {
151
+ const SignOut = ({ children, postLogoutUrl, federated, ...props }) => {
70
152
  const signOutUrl = process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNOUT_URL ?? `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/api/auth/signout`;
71
153
  const query = new URLSearchParams();
72
154
  if (postLogoutUrl) query.set("post_logout_url", postLogoutUrl);
155
+ if (typeof federated === "boolean") query.set("federated", federated.toString());
73
156
  return /* @__PURE__ */ react.default.createElement("a", {
74
157
  href: `${signOutUrl}${query.size ? `?${query.toString()}` : ""}`,
75
158
  ...props
@@ -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 */\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 */\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\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 */\nexport const SignOut = ({\n children,\n postLogoutUrl,\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 return (\n <a\n href={`${signOutUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,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,CAA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AO,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, { 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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I;IAEH,SACC"}
@@ -1,4 +1,4 @@
1
- import { i as ExtraAuthParams } from "../types-BleaXQUP.mjs";
1
+ import { i as ExtraAuthParams } from "../types-DOfZTKa6.mjs";
2
2
  import React, { JSX } from "react";
3
3
 
4
4
  //#region src/components/signin.d.ts
@@ -15,6 +15,36 @@ interface SignInProps extends ExtraAuthParams {
15
15
  * @param props - Properties for the SignIn component.
16
16
  *
17
17
  * @returns An anchor element that links to the sign-in endpoint with the specified parameters.
18
+ *
19
+ * @example App Router and Pages Router
20
+ *
21
+ * **Sign-in component works on both the server and the client in pages router and app router.**
22
+ *
23
+ * ```tsx
24
+ * import { SignIn } from "@monocloud/auth-nextjs/components";
25
+ *
26
+ * export default function Home() {
27
+ * return <SignIn>Sign In</SignIn>;
28
+ * }
29
+ * ```
30
+ *
31
+ * @example Customize the authorization request
32
+ *
33
+ * You can customize the authorization request by passing in props. See {@link SignInProps}.
34
+ *
35
+ * **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**
36
+ *
37
+ * ```tsx
38
+ * import { SignIn } from "@monocloud/auth-nextjs/components";
39
+ *
40
+ * export default function Home() {
41
+ * return (
42
+ * <SignIn loginHint="username" authenticatorHint="password">
43
+ * Sign In
44
+ * </SignIn>
45
+ * );
46
+ * }
47
+ * ```
18
48
  */
19
49
  declare const SignIn: ({
20
50
  children,
@@ -45,6 +75,32 @@ interface SignUpProps extends Omit<ExtraAuthParams, 'authenticatorHint' | 'login
45
75
  * @param props - Properties for the SignUp component.
46
76
  *
47
77
  * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.
78
+ *
79
+ * @example App Router and Pages Router
80
+ *
81
+ * **Sign-up component works on both the server and the client in pages router and app router.**
82
+ *
83
+ * ```tsx
84
+ * import { SignUp } from "@monocloud/auth-nextjs/components";
85
+ *
86
+ * export default function Home() {
87
+ * return <SignUp>Sign Up</SignUp>;
88
+ * }
89
+ * ```
90
+ *
91
+ * @example Customize the authorization request
92
+ *
93
+ * You can customize the authorization request by passing in props. See {@link SignUpProps}.
94
+ *
95
+ * **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**
96
+ *
97
+ * ```tsx
98
+ * import { SignUp } from "@monocloud/auth-nextjs/components";
99
+ *
100
+ * export default function Home() {
101
+ * return <SignUp returnUrl="/dashboard">Sign Up</SignUp>;
102
+ * }
103
+ * ```
48
104
  */
49
105
  declare const SignUp: ({
50
106
  children,
@@ -62,6 +118,8 @@ declare const SignUp: ({
62
118
  interface SignOutProps {
63
119
  /** URL to redirect the user to after they have been signed out. */
64
120
  postLogoutUrl?: string;
121
+ /** Whether to also sign out the user from MonoCloud */
122
+ federated?: boolean;
65
123
  }
66
124
  /**
67
125
  * A component that renders an anchor tag configured to initiate the sign-out flow.
@@ -69,10 +127,37 @@ interface SignOutProps {
69
127
  * @param props - Properties for the SignOut component.
70
128
  *
71
129
  * @returns An anchor element that links to the sign-out endpoint.
130
+ *
131
+ * @example App Router and Pages Router
132
+ *
133
+ * **Sign-out component works on both the server and the client in pages router and app router.**
134
+ *
135
+ * ```tsx
136
+ * import { SignOut } from "@monocloud/auth-nextjs/components";
137
+ *
138
+ * export default function Home() {
139
+ * return <SignOut>Sign Out</SignOut>;
140
+ * }
141
+ * ```
142
+ *
143
+ * @example Customize the request
144
+ *
145
+ * You can customize the request by passing in props. See {@link SignOutProps}.
146
+ *
147
+ * **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**
148
+ *
149
+ * ```tsx
150
+ * import { SignOut } from "@monocloud/auth-nextjs/components";
151
+ *
152
+ * export default function Home() {
153
+ * return <SignOut federated={true}>Sign Out</SignOut>;
154
+ * }
155
+ * ```
72
156
  */
73
157
  declare const SignOut: ({
74
158
  children,
75
159
  postLogoutUrl,
160
+ federated,
76
161
  ...props
77
162
  }: SignOutProps & React.AnchorHTMLAttributes<HTMLAnchorElement>) => JSX.Element;
78
163
  //#endregion
@@ -7,6 +7,36 @@ import React from "react";
7
7
  * @param props - Properties for the SignIn component.
8
8
  *
9
9
  * @returns An anchor element that links to the sign-in endpoint with the specified parameters.
10
+ *
11
+ * @example App Router and Pages Router
12
+ *
13
+ * **Sign-in component works on both the server and the client in pages router and app router.**
14
+ *
15
+ * ```tsx
16
+ * import { SignIn } from "@monocloud/auth-nextjs/components";
17
+ *
18
+ * export default function Home() {
19
+ * return <SignIn>Sign In</SignIn>;
20
+ * }
21
+ * ```
22
+ *
23
+ * @example Customize the authorization request
24
+ *
25
+ * You can customize the authorization request by passing in props. See {@link SignInProps}.
26
+ *
27
+ * **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**
28
+ *
29
+ * ```tsx
30
+ * import { SignIn } from "@monocloud/auth-nextjs/components";
31
+ *
32
+ * export default function Home() {
33
+ * return (
34
+ * <SignIn loginHint="username" authenticatorHint="password">
35
+ * Sign In
36
+ * </SignIn>
37
+ * );
38
+ * }
39
+ * ```
10
40
  */
11
41
  const SignIn = ({ children, authenticatorHint, loginHint, prompt, display, uiLocales, scopes, acrValues, resource, maxAge, returnUrl, ...props }) => {
12
42
  const signInUrl = process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ?? `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/api/auth/signin`;
@@ -36,6 +66,32 @@ const SignIn = ({ children, authenticatorHint, loginHint, prompt, display, uiLoc
36
66
  * @param props - Properties for the SignUp component.
37
67
  *
38
68
  * @returns An anchor element that links to the sign-in endpoint with the prompt set to 'create'.
69
+ *
70
+ * @example App Router and Pages Router
71
+ *
72
+ * **Sign-up component works on both the server and the client in pages router and app router.**
73
+ *
74
+ * ```tsx
75
+ * import { SignUp } from "@monocloud/auth-nextjs/components";
76
+ *
77
+ * export default function Home() {
78
+ * return <SignUp>Sign Up</SignUp>;
79
+ * }
80
+ * ```
81
+ *
82
+ * @example Customize the authorization request
83
+ *
84
+ * You can customize the authorization request by passing in props. See {@link SignUpProps}.
85
+ *
86
+ * **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**
87
+ *
88
+ * ```tsx
89
+ * import { SignUp } from "@monocloud/auth-nextjs/components";
90
+ *
91
+ * export default function Home() {
92
+ * return <SignUp returnUrl="/dashboard">Sign Up</SignUp>;
93
+ * }
94
+ * ```
39
95
  */
40
96
  const SignUp = ({ children, returnUrl, acrValues, display, maxAge, resource, scopes, uiLocales, ...props }) => {
41
97
  const signInUrl = process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNIN_URL ?? `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/api/auth/signin`;
@@ -63,11 +119,38 @@ const SignUp = ({ children, returnUrl, acrValues, display, maxAge, resource, sco
63
119
  * @param props - Properties for the SignOut component.
64
120
  *
65
121
  * @returns An anchor element that links to the sign-out endpoint.
122
+ *
123
+ * @example App Router and Pages Router
124
+ *
125
+ * **Sign-out component works on both the server and the client in pages router and app router.**
126
+ *
127
+ * ```tsx
128
+ * import { SignOut } from "@monocloud/auth-nextjs/components";
129
+ *
130
+ * export default function Home() {
131
+ * return <SignOut>Sign Out</SignOut>;
132
+ * }
133
+ * ```
134
+ *
135
+ * @example Customize the request
136
+ *
137
+ * You can customize the request by passing in props. See {@link SignOutProps}.
138
+ *
139
+ * **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**
140
+ *
141
+ * ```tsx
142
+ * import { SignOut } from "@monocloud/auth-nextjs/components";
143
+ *
144
+ * export default function Home() {
145
+ * return <SignOut federated={true}>Sign Out</SignOut>;
146
+ * }
147
+ * ```
66
148
  */
67
- const SignOut = ({ children, postLogoutUrl, ...props }) => {
149
+ const SignOut = ({ children, postLogoutUrl, federated, ...props }) => {
68
150
  const signOutUrl = process.env.NEXT_PUBLIC_MONOCLOUD_AUTH_SIGNOUT_URL ?? `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/api/auth/signout`;
69
151
  const query = new URLSearchParams();
70
152
  if (postLogoutUrl) query.set("post_logout_url", postLogoutUrl);
153
+ if (typeof federated === "boolean") query.set("federated", federated.toString());
71
154
  return /* @__PURE__ */ React.createElement("a", {
72
155
  href: `${signOutUrl}${query.size ? `?${query.toString()}` : ""}`,
73
156
  ...props
@@ -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 */\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 */\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\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 */\nexport const SignOut = ({\n children,\n postLogoutUrl,\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 return (\n <a\n href={`${signOutUrl}${query.size ? `?${query.toString()}` : ''}`}\n {...props}\n >\n {children}\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;AAkBA,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,K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AAM,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, { 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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