@asgardeo/nextjs 0.0.1 → 0.0.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.
- package/dist/AsgardeoNextClient.d.ts +10 -3
- package/dist/AsgardeoNextClient.js +124 -36
- package/dist/AsgardeoNextClient.js.map +1 -1
- package/dist/cjs/index.js +17 -12
- package/dist/cjs/index.js.map +3 -3
- package/dist/client/components/actions/SignInButton/SignInButton.d.ts +49 -0
- package/dist/client/components/actions/SignInButton/SignInButton.js +52 -0
- package/dist/client/components/actions/SignInButton/SignInButton.js.map +1 -0
- package/dist/client/components/actions/{SignOutButton.d.ts → SignOutButton/SignOutButton.d.ts} +3 -2
- package/dist/client/components/actions/{SignOutButton.js → SignOutButton/SignOutButton.js} +2 -2
- package/dist/client/components/actions/SignOutButton/SignOutButton.js.map +1 -0
- package/dist/client/components/actions/{SignUpButton.d.ts → SignUpButton/SignUpButton.d.ts} +3 -2
- package/dist/client/components/actions/{SignUpButton.js → SignUpButton/SignUpButton.js} +2 -2
- package/dist/client/components/actions/SignUpButton/SignUpButton.js.map +1 -0
- package/dist/client/components/control/{SignedIn.js → SignedIn/SignedIn.js} +1 -1
- package/dist/client/components/control/SignedIn/SignedIn.js.map +1 -0
- package/dist/client/components/control/{SignedOut.js → SignedOut/SignedOut.js} +1 -1
- package/dist/client/components/control/SignedOut/SignedOut.js.map +1 -0
- package/dist/client/components/presentation/SignIn/SignIn.d.ts +69 -0
- package/dist/client/components/presentation/SignIn/SignIn.js +82 -0
- package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -0
- package/dist/client/components/presentation/User/User.d.ts +61 -0
- package/dist/client/components/presentation/User/User.js +52 -0
- package/dist/client/components/presentation/User/User.js.map +1 -0
- package/dist/client/contexts/{AsgardeoContext.d.ts → Asgardeo/AsgardeoContext.d.ts} +8 -1
- package/dist/client/contexts/Asgardeo/AsgardeoContext.js.map +1 -0
- package/dist/client/{providers → contexts/Asgardeo}/AsgardeoProvider.d.ts +6 -1
- package/dist/client/contexts/Asgardeo/AsgardeoProvider.js +95 -0
- package/dist/client/contexts/Asgardeo/AsgardeoProvider.js.map +1 -0
- package/dist/client/{hooks → contexts/Asgardeo}/useAsgardeo.d.ts +1 -1
- package/dist/client/{hooks → contexts/Asgardeo}/useAsgardeo.js +1 -1
- package/dist/client/contexts/Asgardeo/useAsgardeo.js.map +1 -0
- package/dist/configs/InternalAuthAPIRoutesConfig.js +1 -0
- package/dist/configs/InternalAuthAPIRoutesConfig.js.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/models/api.d.ts +5 -0
- package/dist/server/AsgardeoProvider.d.ts +1 -1
- package/dist/server/AsgardeoProvider.js +1 -1
- package/dist/server/AsgardeoProvider.js.map +1 -1
- package/package.json +6 -6
- package/dist/client/components/actions/SignInButton.d.ts +0 -41
- package/dist/client/components/actions/SignInButton.js +0 -42
- package/dist/client/components/actions/SignInButton.js.map +0 -1
- package/dist/client/components/actions/SignOutButton.js.map +0 -1
- package/dist/client/components/actions/SignUpButton.js.map +0 -1
- package/dist/client/components/control/SignedIn.js.map +0 -1
- package/dist/client/components/control/SignedOut.js.map +0 -1
- package/dist/client/contexts/AsgardeoContext.js.map +0 -1
- package/dist/client/hooks/useAsgardeo.js.map +0 -1
- package/dist/client/providers/AsgardeoProvider.js +0 -23
- package/dist/client/providers/AsgardeoProvider.js.map +0 -1
- /package/dist/client/components/control/{SignedIn.d.ts → SignedIn/SignedIn.d.ts} +0 -0
- /package/dist/client/components/control/{SignedOut.d.ts → SignedOut/SignedOut.d.ts} +0 -0
- /package/dist/client/contexts/{AsgardeoContext.js → Asgardeo/AsgardeoContext.js} +0 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AsgardeoNodeClient, SignInOptions, SignOutOptions, User } from '@asgardeo/node';
|
|
18
|
+
import { AsgardeoNodeClient, EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse, SignInOptions, SignOutOptions, SignUpOptions, User, UserProfile, Organization, EmbeddedSignInFlowHandleRequestPayload, EmbeddedFlowExecuteRequestConfig } from '@asgardeo/node';
|
|
19
19
|
import { NextRequest, NextResponse } from 'next/server';
|
|
20
20
|
import { AsgardeoNextConfig } from './models/config';
|
|
21
21
|
/**
|
|
@@ -28,12 +28,19 @@ declare class AsgardeoNextClient<T extends AsgardeoNextConfig = AsgardeoNextConf
|
|
|
28
28
|
private asgardeo;
|
|
29
29
|
constructor();
|
|
30
30
|
initialize(config: T): Promise<boolean>;
|
|
31
|
-
getUser(): Promise<User>;
|
|
31
|
+
getUser(userId?: string): Promise<User>;
|
|
32
|
+
getOrganizations(): Promise<Organization[]>;
|
|
33
|
+
getUserProfile(): Promise<UserProfile>;
|
|
34
|
+
switchOrganization(organization: Organization): Promise<void>;
|
|
35
|
+
getCurrentOrganization(): Promise<Organization | null>;
|
|
32
36
|
isLoading(): boolean;
|
|
33
37
|
isSignedIn(sessionId?: string): Promise<boolean>;
|
|
34
|
-
signIn(options?: SignInOptions, sessionId?: string,
|
|
38
|
+
signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
39
|
+
signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
35
40
|
signOut(options?: SignOutOptions, afterSignOut?: (redirectUrl: string) => void): Promise<string>;
|
|
36
41
|
signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (redirectUrl: string) => void): Promise<string>;
|
|
42
|
+
signUp(options?: SignUpOptions): Promise<void>;
|
|
43
|
+
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
37
44
|
handler(req: NextRequest): Promise<NextResponse>;
|
|
38
45
|
middleware(req: NextRequest): Promise<NextResponse>;
|
|
39
46
|
}
|
|
@@ -15,15 +15,13 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AsgardeoNodeClient, LegacyAsgardeoNodeClient,
|
|
19
|
-
// removeTrailingSlash,
|
|
20
|
-
} from '@asgardeo/node';
|
|
18
|
+
import { AsgardeoNodeClient, AsgardeoRuntimeError, LegacyAsgardeoNodeClient, initializeEmbeddedSignInFlow, executeEmbeddedSignInFlow, CookieConfig, generateSessionId, EmbeddedSignInFlowStatus, } from '@asgardeo/node';
|
|
21
19
|
import { NextResponse } from 'next/server';
|
|
20
|
+
import InternalAuthAPIRoutesConfig from './configs/InternalAuthAPIRoutesConfig';
|
|
22
21
|
import deleteSessionId from './server/actions/deleteSessionId';
|
|
23
22
|
import getSessionId from './server/actions/getSessionId';
|
|
24
|
-
import
|
|
23
|
+
import getIsSignedIn from './server/actions/isSignedIn';
|
|
25
24
|
import decorateConfigWithNextEnv from './utils/decorateConfigWithNextEnv';
|
|
26
|
-
import InternalAuthAPIRoutesConfig from './configs/InternalAuthAPIRoutesConfig';
|
|
27
25
|
const removeTrailingSlash = (path) => (path.endsWith('/') ? path.slice(0, -1) : path);
|
|
28
26
|
/**
|
|
29
27
|
* Client for mplementing Asgardeo in Next.js applications.
|
|
@@ -38,34 +36,56 @@ class AsgardeoNextClient extends AsgardeoNodeClient {
|
|
|
38
36
|
this.asgardeo = new LegacyAsgardeoNodeClient();
|
|
39
37
|
}
|
|
40
38
|
initialize(config) {
|
|
41
|
-
const { baseUrl, clientId, clientSecret, afterSignInUrl } = decorateConfigWithNextEnv(
|
|
42
|
-
afterSignInUrl: config.afterSignInUrl,
|
|
43
|
-
baseUrl: config.baseUrl,
|
|
44
|
-
clientId: config.clientId,
|
|
45
|
-
clientSecret: config.clientSecret,
|
|
46
|
-
});
|
|
39
|
+
const { baseUrl, clientId, clientSecret, afterSignInUrl, ...rest } = decorateConfigWithNextEnv(config);
|
|
47
40
|
return this.asgardeo.initialize({
|
|
48
41
|
baseUrl,
|
|
49
|
-
|
|
42
|
+
clientId,
|
|
50
43
|
clientSecret,
|
|
51
|
-
|
|
44
|
+
afterSignInUrl,
|
|
45
|
+
enablePKCE: false,
|
|
46
|
+
...rest,
|
|
52
47
|
});
|
|
53
48
|
}
|
|
54
|
-
getUser() {
|
|
49
|
+
async getUser(userId) {
|
|
50
|
+
const resolvedSessionId = userId || (await getSessionId());
|
|
51
|
+
return this.asgardeo.getUser(resolvedSessionId);
|
|
52
|
+
}
|
|
53
|
+
async getOrganizations() {
|
|
54
|
+
throw new Error('Method not implemented.');
|
|
55
|
+
}
|
|
56
|
+
getUserProfile() {
|
|
57
|
+
throw new Error('Method not implemented.');
|
|
58
|
+
}
|
|
59
|
+
switchOrganization(organization) {
|
|
60
|
+
throw new Error('Method not implemented.');
|
|
61
|
+
}
|
|
62
|
+
getCurrentOrganization() {
|
|
55
63
|
throw new Error('Method not implemented.');
|
|
56
64
|
}
|
|
57
65
|
isLoading() {
|
|
58
66
|
return false;
|
|
59
67
|
}
|
|
60
68
|
isSignedIn(sessionId) {
|
|
61
|
-
return this.asgardeo.
|
|
69
|
+
return this.asgardeo.isSignedIn(sessionId);
|
|
62
70
|
}
|
|
63
|
-
async signIn(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
async signIn(...args) {
|
|
72
|
+
const arg1 = args[0];
|
|
73
|
+
const arg2 = args[1];
|
|
74
|
+
const arg3 = args[2];
|
|
75
|
+
const arg4 = args[3];
|
|
76
|
+
if (typeof arg1 === 'object' && 'flowId' in arg1 && typeof arg1 === 'object' && 'url' in arg2) {
|
|
77
|
+
if (arg1.flowId === '') {
|
|
78
|
+
return initializeEmbeddedSignInFlow({
|
|
79
|
+
payload: arg2.payload,
|
|
80
|
+
url: arg2.url,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return executeEmbeddedSignInFlow({
|
|
84
|
+
payload: arg1,
|
|
85
|
+
url: arg2.url,
|
|
86
|
+
});
|
|
67
87
|
}
|
|
68
|
-
return this.asgardeo.signIn(
|
|
88
|
+
return this.asgardeo.signIn(arg4, arg3, arg1?.code, arg1?.session_state, arg1?.state, arg1);
|
|
69
89
|
}
|
|
70
90
|
async signOut(...args) {
|
|
71
91
|
if (args[1] && typeof args[1] !== 'string') {
|
|
@@ -74,37 +94,105 @@ class AsgardeoNextClient extends AsgardeoNodeClient {
|
|
|
74
94
|
const resolvedSessionId = args[1] || (await getSessionId());
|
|
75
95
|
return Promise.resolve(await this.asgardeo.signOut(resolvedSessionId));
|
|
76
96
|
}
|
|
97
|
+
async signUp(...args) {
|
|
98
|
+
throw new AsgardeoRuntimeError('Not implemented', 'react-AsgardeoReactClient-ValidationError-002', 'react', 'The signUp method with SignUpOptions is not implemented in the React client.');
|
|
99
|
+
}
|
|
77
100
|
async handler(req) {
|
|
78
101
|
const { pathname, searchParams } = req.nextUrl;
|
|
79
102
|
const sanitizedPathname = removeTrailingSlash(pathname);
|
|
80
103
|
const { method } = req;
|
|
104
|
+
// Handle POST sign-in request
|
|
105
|
+
if (method === 'POST' && sanitizedPathname === InternalAuthAPIRoutesConfig.signIn) {
|
|
106
|
+
try {
|
|
107
|
+
// Get session ID from cookies directly since we're in middleware context
|
|
108
|
+
let userId = req.cookies.get(CookieConfig.SESSION_COOKIE_NAME)?.value;
|
|
109
|
+
// Generate session ID if not present
|
|
110
|
+
if (!userId) {
|
|
111
|
+
userId = generateSessionId();
|
|
112
|
+
}
|
|
113
|
+
const signInUrl = new URL(await this.asgardeo.getSignInUrl({ response_mode: 'direct' }, userId));
|
|
114
|
+
const { pathname: urlPathname, origin, searchParams: urlSearchParams } = signInUrl;
|
|
115
|
+
console.log('[AsgardeoNextClient] Sign-in URL:', signInUrl.toString());
|
|
116
|
+
console.log('[AsgardeoNextClient] Search Params:', Object.fromEntries(urlSearchParams.entries()));
|
|
117
|
+
const body = await req.json();
|
|
118
|
+
console.log('[AsgardeoNextClient] Sign-in request:', body);
|
|
119
|
+
const { payload, request } = body;
|
|
120
|
+
const response = await this.signIn(payload, {
|
|
121
|
+
url: request?.url ?? `${origin}${urlPathname}`,
|
|
122
|
+
payload: request?.payload ?? Object.fromEntries(urlSearchParams.entries()),
|
|
123
|
+
}, userId);
|
|
124
|
+
// Clean the response to remove any non-serializable properties
|
|
125
|
+
const cleanResponse = response ? JSON.parse(JSON.stringify(response)) : { success: true };
|
|
126
|
+
// Create response with session cookie
|
|
127
|
+
const nextResponse = NextResponse.json(cleanResponse);
|
|
128
|
+
// Set session cookie if it was generated
|
|
129
|
+
if (!req.cookies.get(CookieConfig.SESSION_COOKIE_NAME)) {
|
|
130
|
+
nextResponse.cookies.set(CookieConfig.SESSION_COOKIE_NAME, userId, {
|
|
131
|
+
httpOnly: CookieConfig.DEFAULT_HTTP_ONLY,
|
|
132
|
+
maxAge: CookieConfig.DEFAULT_MAX_AGE,
|
|
133
|
+
sameSite: CookieConfig.DEFAULT_SAME_SITE,
|
|
134
|
+
secure: CookieConfig.DEFAULT_SECURE,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (response.flowStatus === EmbeddedSignInFlowStatus.SuccessCompleted) {
|
|
138
|
+
const res = await this.signIn({
|
|
139
|
+
code: response?.authData?.code,
|
|
140
|
+
session_state: response?.authData?.session_state,
|
|
141
|
+
state: response?.authData?.state,
|
|
142
|
+
}, {}, userId, (afterSignInUrl) => null);
|
|
143
|
+
const afterSignInUrl = await (await this.asgardeo.getStorageManager()).getConfigDataParameter('afterSignInUrl');
|
|
144
|
+
const redirectUrl = String(afterSignInUrl);
|
|
145
|
+
console.log('[AsgardeoNextClient] Sign-in successful, redirecting to:', redirectUrl);
|
|
146
|
+
return NextResponse.redirect(redirectUrl, 303);
|
|
147
|
+
}
|
|
148
|
+
return nextResponse;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error('[AsgardeoNextClient] Failed to initialize embedded sign-in flow:', error);
|
|
152
|
+
return NextResponse.json({ error: 'Failed to initialize sign-in flow' }, { status: 500 });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Handle GET sign-in request or callback with code
|
|
81
156
|
if ((method === 'GET' && sanitizedPathname === InternalAuthAPIRoutesConfig.signIn) || searchParams.get('code')) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
157
|
+
try {
|
|
158
|
+
if (searchParams.get('code')) {
|
|
159
|
+
// Handle OAuth callback
|
|
160
|
+
await this.signIn();
|
|
161
|
+
const cleanUrl = new URL(req.url);
|
|
162
|
+
cleanUrl.searchParams.delete('code');
|
|
163
|
+
cleanUrl.searchParams.delete('state');
|
|
164
|
+
cleanUrl.searchParams.delete('session_state');
|
|
165
|
+
return NextResponse.redirect(cleanUrl.toString());
|
|
166
|
+
}
|
|
167
|
+
// Regular GET sign-in request
|
|
168
|
+
await this.signIn();
|
|
169
|
+
return NextResponse.next();
|
|
89
170
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
cleanUrl.searchParams.delete('state');
|
|
94
|
-
cleanUrl.searchParams.delete('session_state');
|
|
95
|
-
return NextResponse.redirect(cleanUrl.toString());
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error('[AsgardeoNextClient] Sign-in failed:', error);
|
|
173
|
+
return NextResponse.json({ error: 'Sign-in failed' }, { status: 500 });
|
|
96
174
|
}
|
|
97
|
-
return NextResponse.next();
|
|
98
175
|
}
|
|
99
176
|
if (method === 'GET' && sanitizedPathname === InternalAuthAPIRoutesConfig.session) {
|
|
100
177
|
try {
|
|
101
|
-
const
|
|
102
|
-
return NextResponse.json({ isSignedIn
|
|
178
|
+
const isSignedIn = await getIsSignedIn();
|
|
179
|
+
return NextResponse.json({ isSignedIn });
|
|
103
180
|
}
|
|
104
181
|
catch (error) {
|
|
105
182
|
return NextResponse.json({ error: 'Failed to check session' }, { status: 500 });
|
|
106
183
|
}
|
|
107
184
|
}
|
|
185
|
+
if (method === 'GET' && sanitizedPathname === InternalAuthAPIRoutesConfig.user) {
|
|
186
|
+
try {
|
|
187
|
+
const user = await this.getUser();
|
|
188
|
+
console.log('[AsgardeoNextClient] User fetched successfully:', user);
|
|
189
|
+
return NextResponse.json({ user });
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
console.error('[AsgardeoNextClient] Failed to get user:', error);
|
|
193
|
+
return NextResponse.json({ error: 'Failed to get user' }, { status: 500 });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
108
196
|
if (method === 'GET' && sanitizedPathname === InternalAuthAPIRoutesConfig.signOut) {
|
|
109
197
|
try {
|
|
110
198
|
const afterSignOutUrl = await this.signOut();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsgardeoNextClient.js","sourceRoot":"","sources":["../src/AsgardeoNextClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,kBAAkB,EAClB,wBAAwB
|
|
1
|
+
{"version":3,"file":"AsgardeoNextClient.js","sourceRoot":"","sources":["../src/AsgardeoNextClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EAGpB,wBAAwB,EAMxB,4BAA4B,EAG5B,yBAAyB,EAEzB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAc,YAAY,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,2BAA2B,MAAM,uCAAuC,CAAC;AAEhF,OAAO,eAAe,MAAM,kCAAkC,CAAC;AAC/D,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,yBAAyB,MAAM,mCAAmC,CAAC;AAE1E,MAAM,mBAAmB,GAAG,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AC,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,kBAAkB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,39 +29,44 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
|
-
AsgardeoContext: () => import_AsgardeoContext.default,
|
|
33
32
|
AsgardeoNext: () => import_AsgardeoNextClient.default,
|
|
34
33
|
AsgardeoProvider: () => import_AsgardeoProvider.default,
|
|
34
|
+
SignIn: () => import_SignIn.default,
|
|
35
35
|
SignInButton: () => import_SignInButton.default,
|
|
36
36
|
SignOutButton: () => import_SignOutButton.default,
|
|
37
37
|
SignedIn: () => import_SignedIn.default,
|
|
38
|
+
SignedInProps: () => import_SignedIn2.SignedInProps,
|
|
38
39
|
SignedOut: () => import_SignedOut.default,
|
|
40
|
+
SignedOutProps: () => import_SignedOut2.SignedOutProps,
|
|
41
|
+
User: () => import_User.default,
|
|
39
42
|
isSignedIn: () => import_isSignedIn.default
|
|
40
43
|
});
|
|
41
44
|
module.exports = __toCommonJS(index_exports);
|
|
42
45
|
var import_AsgardeoProvider = __toESM(require("./server/AsgardeoProvider"), 1);
|
|
43
46
|
__reExport(index_exports, require("./server/AsgardeoProvider"), module.exports);
|
|
44
47
|
var import_isSignedIn = __toESM(require("./server/actions/isSignedIn"), 1);
|
|
45
|
-
var import_SignedIn = __toESM(require("./client/components/control/SignedIn"), 1);
|
|
46
|
-
|
|
47
|
-
var import_SignedOut = __toESM(require("./client/components/control/SignedOut"), 1);
|
|
48
|
-
|
|
49
|
-
var import_SignInButton = __toESM(require("./client/components/actions/SignInButton"), 1);
|
|
50
|
-
var
|
|
51
|
-
var
|
|
48
|
+
var import_SignedIn = __toESM(require("./client/components/control/SignedIn/SignedIn"), 1);
|
|
49
|
+
var import_SignedIn2 = require("./client/components/control/SignedIn/SignedIn");
|
|
50
|
+
var import_SignedOut = __toESM(require("./client/components/control/SignedOut/SignedOut"), 1);
|
|
51
|
+
var import_SignedOut2 = require("./client/components/control/SignedOut/SignedOut");
|
|
52
|
+
var import_SignInButton = __toESM(require("./client/components/actions/SignInButton/SignInButton"), 1);
|
|
53
|
+
var import_SignIn = __toESM(require("./client/components/presentation/SignIn/SignIn"), 1);
|
|
54
|
+
var import_SignOutButton = __toESM(require("./client/components/actions/SignOutButton/SignOutButton"), 1);
|
|
55
|
+
var import_User = __toESM(require("./client/components/presentation/User/User"), 1);
|
|
52
56
|
var import_AsgardeoNextClient = __toESM(require("./AsgardeoNextClient"), 1);
|
|
53
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
58
|
0 && (module.exports = {
|
|
55
|
-
AsgardeoContext,
|
|
56
59
|
AsgardeoNext,
|
|
57
60
|
AsgardeoProvider,
|
|
61
|
+
SignIn,
|
|
58
62
|
SignInButton,
|
|
59
63
|
SignOutButton,
|
|
60
64
|
SignedIn,
|
|
65
|
+
SignedInProps,
|
|
61
66
|
SignedOut,
|
|
67
|
+
SignedOutProps,
|
|
68
|
+
User,
|
|
62
69
|
isSignedIn,
|
|
63
|
-
...require("./server/AsgardeoProvider")
|
|
64
|
-
...require("./client/components/control/SignedIn"),
|
|
65
|
-
...require("./client/components/control/SignedOut")
|
|
70
|
+
...require("./server/AsgardeoProvider")
|
|
66
71
|
});
|
|
67
72
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport {default as AsgardeoProvider} from './server/AsgardeoProvider';\nexport * from './server/AsgardeoProvider';\n\nexport {default as isSignedIn} from './server/actions/isSignedIn';\n\nexport {default as SignedIn} from './client/components/control/SignedIn';\nexport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,8BAA0C;AAC1C,0BAAc,sCAnBd;AAqBA,wBAAoC;AAEpC,sBAAkC;AAClC,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport {default as AsgardeoProvider} from './server/AsgardeoProvider';\nexport * from './server/AsgardeoProvider';\n\nexport {default as isSignedIn} from './server/actions/isSignedIn';\n\nexport {default as SignedIn} from './client/components/control/SignedIn/SignedIn';\nexport {SignedInProps} from './client/components/control/SignedIn/SignedIn';\n\nexport {default as SignedOut} from './client/components/control/SignedOut/SignedOut';\nexport {SignedOutProps} from './client/components/control/SignedOut/SignedOut';\n\nexport {default as SignInButton} from './client/components/actions/SignInButton/SignInButton';\nexport type {SignInButtonProps} from './client/components/actions/SignInButton/SignInButton';\n\nexport {default as SignIn} from './client/components/presentation/SignIn/SignIn';\nexport type {SignInProps} from './client/components/presentation/SignIn/SignIn';\n\nexport {default as SignOutButton} from './client/components/actions/SignOutButton/SignOutButton';\nexport type {SignOutButtonProps} from './client/components/actions/SignOutButton/SignOutButton';\n\nexport {default as User} from './client/components/presentation/User/User';\nexport type {UserProps} from './client/components/presentation/User/User';\n\nexport {default as AsgardeoNext} from './AsgardeoNextClient';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,8BAA0C;AAC1C,0BAAc,sCAnBd;AAqBA,wBAAoC;AAEpC,sBAAkC;AAClC,IAAAA,mBAA4B;AAE5B,uBAAmC;AACnC,IAAAC,oBAA6B;AAE7B,0BAAsC;AAGtC,oBAAgC;AAGhC,2BAAuC;AAGvC,kBAA8B;AAG9B,gCAAsC;",
|
|
6
|
+
"names": ["import_SignedIn", "import_SignedOut"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
19
|
+
import { BaseSignInButtonProps } from '@asgardeo/react';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link SignInButton}
|
|
22
|
+
*/
|
|
23
|
+
export type SignInButtonProps = BaseSignInButtonProps;
|
|
24
|
+
/**
|
|
25
|
+
* SignInButton component that supports both render props and traditional props patterns for Next.js.
|
|
26
|
+
*
|
|
27
|
+
* @example Using render props
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <SignInButton>
|
|
30
|
+
* {({isLoading}) => (
|
|
31
|
+
* <button type="submit" disabled={isLoading}>
|
|
32
|
+
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
33
|
+
* </button>
|
|
34
|
+
* )}
|
|
35
|
+
* </SignInButton>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example Using traditional props
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <SignInButton className="custom-button">Sign In</SignInButton>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* In Next.js with server actions, the sign-in is handled via form submission.
|
|
45
|
+
* When using render props, the custom button should use `type="submit"` instead of `onClick={signIn}`.
|
|
46
|
+
* The `signIn` function in render props is provided for API consistency but should not be used directly.
|
|
47
|
+
*/
|
|
48
|
+
declare const SignInButton: ForwardRefExoticComponent<BaseSignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
49
|
+
export default SignInButton;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
'use client';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { forwardRef } from 'react';
|
|
21
|
+
import InternalAuthAPIRoutesConfig from '../../../../configs/InternalAuthAPIRoutesConfig';
|
|
22
|
+
import { BaseSignInButton } from '@asgardeo/react';
|
|
23
|
+
/**
|
|
24
|
+
* SignInButton component that supports both render props and traditional props patterns for Next.js.
|
|
25
|
+
*
|
|
26
|
+
* @example Using render props
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <SignInButton>
|
|
29
|
+
* {({isLoading}) => (
|
|
30
|
+
* <button type="submit" disabled={isLoading}>
|
|
31
|
+
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
32
|
+
* </button>
|
|
33
|
+
* )}
|
|
34
|
+
* </SignInButton>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Using traditional props
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <SignInButton className="custom-button">Sign In</SignInButton>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* In Next.js with server actions, the sign-in is handled via form submission.
|
|
44
|
+
* When using render props, the custom button should use `type="submit"` instead of `onClick={signIn}`.
|
|
45
|
+
* The `signIn` function in render props is provided for API consistency but should not be used directly.
|
|
46
|
+
*/
|
|
47
|
+
const SignInButton = forwardRef(({ className, style, ...rest }, ref) => {
|
|
48
|
+
return (_jsx("form", { action: InternalAuthAPIRoutesConfig.signIn, children: _jsx(BaseSignInButton, { className: className, style: style, ref: ref, type: "submit", ...rest }) }));
|
|
49
|
+
});
|
|
50
|
+
SignInButton.displayName = 'SignInButton';
|
|
51
|
+
export default SignInButton;
|
|
52
|
+
//# sourceMappingURL=SignInButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignInButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignInButton/SignInButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAC,UAAU,EAA8D,MAAM,OAAO,CAAC;AAC9F,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AAOxE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,YAAY,GAAG,UAAU,CAC7B,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAoB,EAAE,GAA2B,EAAgB,EAAE;IAC5F,OAAO,CACL,eAAM,MAAM,EAAE,2BAA2B,CAAC,MAAM,YAC9C,KAAC,gBAAgB,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,KAAK,IAAI,GAAI,GACrF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,eAAe,YAAY,CAAC"}
|
package/dist/client/components/actions/{SignOutButton.d.ts → SignOutButton/SignOutButton.d.ts}
RENAMED
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FC,
|
|
18
|
+
import { FC, PropsWithChildren } from 'react';
|
|
19
|
+
import { BaseSignOutButtonProps } from '@asgardeo/react';
|
|
19
20
|
/**
|
|
20
21
|
* Interface for SignInButton component props.
|
|
21
22
|
*/
|
|
22
|
-
export type SignOutButtonProps =
|
|
23
|
+
export type SignOutButtonProps = BaseSignOutButtonProps;
|
|
23
24
|
/**
|
|
24
25
|
* SignInButton component. This button initiates the sign-in process when clicked.
|
|
25
26
|
*
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
'use client';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { forwardRef } from 'react';
|
|
21
|
-
import InternalAuthAPIRoutesConfig from '
|
|
21
|
+
import InternalAuthAPIRoutesConfig from '../../../../configs/InternalAuthAPIRoutesConfig';
|
|
22
22
|
import { BaseSignOutButton } from '@asgardeo/react';
|
|
23
23
|
/**
|
|
24
24
|
* SignInButton component. This button initiates the sign-in process when clicked.
|
|
@@ -37,6 +37,6 @@ import { BaseSignOutButton } from '@asgardeo/react';
|
|
|
37
37
|
* }
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
const SignOutButton = forwardRef(({
|
|
40
|
+
const SignOutButton = forwardRef(({ className, style, ...rest }, ref) => (_jsx("form", { action: InternalAuthAPIRoutesConfig.signOut, children: _jsx(BaseSignOutButton, { className: className, style: style, ref: ref, type: "submit", ...rest }) })));
|
|
41
41
|
export default SignOutButton;
|
|
42
42
|
//# sourceMappingURL=SignOutButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignOutButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignOutButton/SignOutButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAK,UAAU,EAAuC,MAAM,OAAO,CAAC;AAC3E,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,iBAAiB,EAAyB,MAAM,iBAAiB,CAAC;AAO1E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,aAAa,GAA8C,UAAU,CAIzE,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAwC,EAAE,GAA2B,EAAgB,EAAE,CAAC,CACjH,eAAM,MAAM,EAAE,2BAA2B,CAAC,OAAO,YAC/C,KAAC,iBAAiB,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,KAAK,IAAI,GAAI,GACtF,CACR,CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FC,
|
|
18
|
+
import { FC, PropsWithChildren } from 'react';
|
|
19
|
+
import { BaseSignUpButtonProps } from '@asgardeo/react';
|
|
19
20
|
/**
|
|
20
21
|
* Interface for SignInButton component props.
|
|
21
22
|
*/
|
|
22
|
-
export type SignUpButtonProps =
|
|
23
|
+
export type SignUpButtonProps = BaseSignUpButtonProps;
|
|
23
24
|
/**
|
|
24
25
|
* SignInButton component. This button initiates the sign-in process when clicked.
|
|
25
26
|
*
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
'use client';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { forwardRef } from 'react';
|
|
21
|
-
import InternalAuthAPIRoutesConfig from '
|
|
21
|
+
import InternalAuthAPIRoutesConfig from '../../../../configs/InternalAuthAPIRoutesConfig';
|
|
22
22
|
import { BaseSignUpButton } from '@asgardeo/react';
|
|
23
23
|
/**
|
|
24
24
|
* SignInButton component. This button initiates the sign-in process when clicked.
|
|
@@ -37,6 +37,6 @@ import { BaseSignUpButton } from '@asgardeo/react';
|
|
|
37
37
|
* }
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
const SignUpButton = forwardRef(({
|
|
40
|
+
const SignUpButton = forwardRef(({ className, style, ...rest }, ref) => (_jsx("form", { action: InternalAuthAPIRoutesConfig.signUp, children: _jsx(BaseSignUpButton, { className: className, style: style, ref: ref, type: "submit", ...rest }) })));
|
|
41
41
|
export default SignUpButton;
|
|
42
42
|
//# sourceMappingURL=SignUpButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUpButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignUpButton/SignUpButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAK,UAAU,EAAuC,MAAM,OAAO,CAAC;AAC3E,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AAOxE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,YAAY,GAA6C,UAAU,CAIvE,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAuC,EAAE,GAA2B,EAAgB,EAAE,CAAC,CAChH,eAAM,MAAM,EAAE,2BAA2B,CAAC,MAAM,YAC9C,KAAC,gBAAgB,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,KAAK,IAAI,GAAI,GACrF,CACR,CACF,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
'use client';
|
|
19
19
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { useEffect, useState } from 'react';
|
|
21
|
-
import isSignedIn from '
|
|
21
|
+
import isSignedIn from '../../../../server/actions/isSignedIn';
|
|
22
22
|
/**
|
|
23
23
|
* A component that only renders its children when the user is signed in.
|
|
24
24
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedIn.js","sourceRoot":"","sources":["../../../../../src/client/components/control/SignedIn/SignedIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAmC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAY/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,QAAQ,GAAyC,CAAC,EACtD,QAAQ,EACR,QAAQ,GAAG,IAAI,GACkB,EAAE,EAAE;IACrC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAmB,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAY,MAAM,UAAU,EAAE,CAAC;gBAE3C,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,cAAc,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEzC,OAAO,4BAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAI,CAAC;AACrD,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
'use client';
|
|
19
19
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { useEffect, useState } from 'react';
|
|
21
|
-
import isSignedIn from '
|
|
21
|
+
import isSignedIn from '../../../../server/actions/isSignedIn';
|
|
22
22
|
/**
|
|
23
23
|
* A component that only renders its children when the user is signed out.
|
|
24
24
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedOut.js","sourceRoot":"","sources":["../../../../../src/client/components/control/SignedOut/SignedOut.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAmC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAY/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,SAAS,GAA0C,CAAC,EACxD,QAAQ,EACR,QAAQ,GAAG,IAAI,GACmB,EAAE,EAAE;IACtC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAmB,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAY,MAAM,UAAU,EAAE,CAAC;gBAE3C,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,cAAc,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEzC,OAAO,4BAAG,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAI,CAAC;AACtD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|